2018-10-22         Gustave

Laravel: get name from table users

I need get the name field in user tableMy method in the controller:public function reviewsactivity(){ $activity = Activity::orderBy('id', 'DESC')->paginate(); $users = User::orderBy('id', 'ASC')->pluck('id', 'name'); return view('reviews.reviewsactivity', compact('activity', 'users'));}And the view: @foreach($activity as $actividad) <tr> <td>{{ $actividad->description }}</td> <td>{{ $actividad->subject_type }}</td> <td>{{ $act...

 php                     2 answers                     40 view
 2018-10-22         Gustave

Perforce p4v Merge/Integrate freeze after file rename

I'm having trouble performing a merge/integrate from branch1/sql/ to b2/sqlI performed a rename operation in p4v from _1.sql to _2.sqlMade a small change to _2 file Submitted changesWent to submitted changes, and tried to perform a merge/integrate on _2 to the other branch (b2/sql).The problem is that p4v freezes at that point:What am I doing wrong ?BTW, I have the latest version: Version: Helix P4V/NTX64/2018.2/1666551 Based on the generated changelist description, P4V appears to be hopelessly confused and trying to integrate the file into itself rather than between t...

 perforce                     1 answers                     17 view
 2018-10-22         Gustave

convert string back into object in r

In R, I get the content of a binary file as a string (because of design issues, I can't access the file directly).This file was originally an lm model.How do I convert that string back into the lm model?Thanks I'm assuming you used base::dput() according to the following example (based on this answer):# Generate some model over some datadata <- sample(1:100, 30)df <- data.frame(x = data, y = 2 * data + 20)model <- lm(y ~ x, df)# Assuming this is what you did you have the model structure inside model.Rdput(model, control = c("quoteExpressions", "showAttributes"),...

 r                     1 answers                     27 view
 2018-10-22         Gustave

AWS Lambda with DynamoDb no results

I am just starting with AWS and can't get the DynamoDB running at all.I followed a tutorial and created all AWS elements and set priviledge for the DynamoDB in the lambda basic profile.I am wondering why I do not get any results from the DB or any error messages.I put some console logs in the code to troubleshoot:var AWS = require("aws-sdk");AWS.config.update({ region: "eu-west-1",});var docClient = new AWS.DynamoDB.DocumentClient();var params = { TableName: "cooking_table", Key:{ "data_type": "meal" }};console.log("Scanning table.");docClient.scan(params...

 amazon-web-services                     2 answers                     60 view
 2018-10-22         Gustave

Any better way to perform this task?

def entity_mappings(mapping, entities_list): entity_mapped = [] for (key, value) in mapping.items(): for i in entities_list: if i == key: entity_mapped.append(value) return entity_mappedI want to match the key from the entities list of ids and append the values of the key in the entity mapped list and return it is there any better way to perform this task?? Mapping is a dict. You can do like this with list comprehension,Method 1entity_mapped = [value for (key, value) in mapping.items() if key in entities_list]You can search inside ...

 python                     3 answers                     43 view
 2018-10-22         Gustave

codeigniter: get percentage in multiple table by data category

I have tables like this,table_aPID Name Type1 a selling2 b sampling3 c selling4 d sampling5 e sellingAnd,table_bID PID Qty1 2 32 2 23 1 14 3 15 1 36 5 37 4 38 3 2I need to show like this,output_sellingName Total_qty Percentagea 4 40%c 3 30%e 3 30%And,output_samplingName Total_qty Percentageb 5 62,5%d 3 ...

 php                     1 answers                     25 view
 2018-10-22         Gustave

How to make rpm auto install dependencies

I have built two RPM packagesproj1-1.0-1.x86_64.rpmlibtest1-1.0-1.x86_64.rpmproj1 depends on the file libtest1.so being present and it is reflected correctly in the RPM packages as seen here:user@my-pc:~$ rpm -qp --requires proj1-1.0-1.x86_64.rpmlibtest1.so()(64bit)user@my-pc:~$ rpm -qp --provides libtest1-1.0-1.x86_64.rpmlibtest1.so()(64bit)The installation of proj1 fails due to a missing dependency.user@my-pc:~$ rpm -ivh proj1-1.0-1.x86_64.rpmerror: Failed dependencies:libtest1.so()(64bit) is needed by proj1-1.0-1.x86_64.rpmHow do I ensure that libtest1-1.0-1.x86_64.rpm i...

 linux                     11 answers                     37 view
 2018-10-22         Gustave

Google Script .getRange skipping first row of data

I'm having an odd issue with a script I'm implementing to copy one column of data to another column. Here's the code:function copySavedtoPlan() { var TeamSheet = ss.getSheetByName('Team Selector - BattlePlan'); TeamSheet.getRange(7,3,50).copyValuesToRange(TeamSheet,2,2,7,56);The column to copy contains a set of values pulled in via HLOOKUP from another sheet, and is either text or blank:7 *P1 JTR8 *P1 JTR910 P1 Droids1112 *P1 JTR13 P1 Rebels14 *P1 JTRThe result of the function skips the first row and transposes other rows:78 *P1 JTR910 P1 Droids11 *P1...

 google-apps-script                     1 answers                     72 view
 2018-10-22         Gustave

select2 fullwidth in hidden div?

Assume I have a select2 box inside a hidden div like this:<form > <div id="agent007"> <select name="slimy" id="slimy"> <option>Good</option> <option>Bad</option> </select> </div></form>Where the selection box has full width and the div is hiddenselect{ width:100%}div{ display:none;}When I make the div visible, then the selection box has no full width.$(document).ready(function(){ $('#slimy').select2(); $('#agent007').show();});How can I make a select2 box full width that was hiding in a invisible conta...

 javascript                     4 answers                     11 view
 2018-10-22         Gustave

update row if count(*) > n

my DB has this structure:ID | text | time | validThis is my current code. I'm trying to find a way to do this as one query.rows = select * from table where ID=x order by time desc;n=0;foreach rows{ if(n > 3){ update table set valid = -1 where rows[n]; } n++}I'm checking how many rows exist for a given ID. Then I need to set valid=-1 for all rows where n >3;Is there a way to do this with one query? Assuming that (id,time) has a UNIQUE constraint, i.e. no two rows have the same id and same time:UPDATE tableX AS tu JOIN ( SELECT time FROM t...

 mysql                     4 answers                     8 view
 2018-10-22         Gustave

Kafka produce to send image

I have the following Kafka producer code. I want to know if I can send image file instead of JSON file? Is there any code reference sending an image file through Kafka producer? try { URL url = getClass().getResource("test.json"); File file = new File(url.getPath()); Properties props = new Properties(); props.put("bootstrap.servers", "yupsectory.selet.com:9092"); props.put("client.id", CLIENT_ID); props.put("key.serializer", "org.apache.kafka.common.serializat...

 java                     1 answers                     58 view
 2018-10-22         Gustave

Git fetch does not resolve pathspec error on git checkout -- *

In previous projects, I often run git checkout -- * to discard all changes in my working directory. In my current project, I get the following:$ git checkout -- *error: pathspec 'node_modules' did not match any file(s) known to git.I then do a git status:$ git statusOn branch <feature_branch>Your branch is ahead of 'origin/<feature_branch>' by 2 commits. (use "git push" to publish your local commits)Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in worki...

 git                     1 answers                     41 view
 2018-10-22         Gustave

Can I upload a whole folder in gitlab repo via API?

Gitlab API CommitThis I know but can't find an API to upload a whole folder containing various js, CSS and HTML files into gitlab repo. Does this help? How do I add files and folders into GitHub repos?git add <folder>/*git commit -m "<Message>"git pushI often use git add -A to add all modified files. But should use git status before and after adding to make sure you see which files have been added before committing. [XXX]

 gitlab                     1 answers                     50 view
 2018-10-22         Gustave

Get Public IP for the Azure Web App

I have hosted my web application and the server for it. However I will like to know if Azure Web App has an Public IP that can accessed via internet or it is only available via the azure portal?UpdateThe ip from the ping command or from custom domain. I think they are the virtual IP addresses and not public ip address. You could ping your web app URL in cmd. [XXX]Yes, your Web App has an Public IP that is accessible via the internet. You can find the IP within the Custom domains blade: [XXX]

 azure                     2 answers                     94 view
 2018-10-22         Gustave

Prevent from exposing jSON data - wp-json/contact-form-7/v1/

Can anyone help us, how to prevent exposing jSON values in WP Contact Form 7? I have copied a screen shot for reference. It impacts form validations if we stop the service via WordPress plugin - Disable Rest API. Also, I would like to know what are the major security issues by using this plugin along with below service URL.Thanks in advance for any suggestions. In the folder you need to "lock" create .htaccess file with the following content:Deny from all [XXX]I was able to fix it via Disable Rest API plugin. I have enabled only the option - /contact-form-7/v1/contac...

 json                     2 answers                     19 view
 2018-10-22         Gustave

Should I include both fflush(stdin) and a space in scanf() or will only one of them suffice?

This question already has an answer here: Using fflush(stdin) 4 answers fflush(stdin) is undefiined behavior. int fflush(FILE *ostream); ostream points to an output stream or an update stream in which the most recent operation was not input, the fflush function causes any unwritten data for that stream to be delivered to the host environment to be written to the file; otherwise, the behavior is undefined. [XXX]

 c                     1 answers                     123 view

Page 1 of 143  |  Show More Pages:  Top Prev Next Last