Posts

Showing posts from September 10, 2018

Using put method on Laravel Eloquent Collection will always return an array

Image
Clash Royale CLAN TAG #URR8PPP Using put method on Laravel Eloquent Collection will always return an array I am using Lumen (Laravel Eloquent ORM) to create a web service to use in conjunction with an app I am working on. I have a Joomla website, which I use Lumen to access resources I need from the db. I'm using Lumen to get these resources into a collection, then return a new JSON object. To give an overview of the problem, I am creating two Collections: I want Laravel to return a JSON object for Collection 0 (above), which will include a JSON Array containing the data of Collection 1. Here is my code: <?php $current = Card::find($id); //Collection 0 $information = $current -> cardData -> map(function($col) return collect($col -> toArray()) ->only(['id', 'ccard_cardno', 'ccard_year', 'ccard_catc', 'ccard_catt', 'ccard_issued', 'ccard_valc', 'ccard_valtod', 'ccard_valfac', 'ccard_man...

Error: Source Path does not exist for android icon png when building for ionic

Image
Clash Royale CLAN TAG #URR8PPP Error: Source Path does not exist for android icon png when building for ionic Your system information: Cordova CLI: 6.5.0 Ionic CLI Version: 2.2.1 Ionic App Lib Version: 2.2.0 OS: macOS Sierra Node Version: v6.9.5 Xcode version: Xcode 8.2.1 Build version 8C1002 I am trying to use ionic platform add android to create an android project, but it always complains that resources/android/icon/drawable-hdpi-icon.png does not exist. In fact it doesn't -- none of these resources exist. They can get created by ionic resources . ionic platform add android resources/android/icon/drawable-hdpi-icon.png ionic resources However if I try to run ionic resources without the platform, I am told to add the platform first. This leads me to essentially do something like: ionic resources ionic platform add android ionic resources ionic platform rm android ionic platform add android Then it works properly. Is there anything I can do to make sure the resources get p...

SpringBoot Input validation of emoji

Image
Clash Royale CLAN TAG #URR8PPP SpringBoot Input validation of emoji I have a SpringBoot app. In one of the POST endpoints, in the request body it will contain emoji. POST I'm using the @Pattern annotation to do some input validation. But cannot get the emoji validation to work. @Pattern My latest attempt was for the emoji : &#128512; to use the regex: &#128512; @Pattern(regexp = "(\uD83D[\u0000-\uffff])") @Pattern(regexp = "(\uD83D[\u0000-\uffff])") and various variations with no luck. Any suggestions? By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Gmail Schema Whitelist Request - No working email adress

Image
Clash Royale CLAN TAG #URR8PPP Gmail Schema Whitelist Request - No working email adress I have a very specific problem with the Gmail Schema Whitelist Request process. Based on the guideline I should send a real-life email coming from my production servers including the markup / schema to schema.whitelisting+sample@gmail.com. Unfortunately my product does not allow the specific email adress from google, I guess because of the plus character ("+"), for registering. I want to trigger a confirmation email (One-Click Action: confirmaction). Any suggestions how to go on? Support + in your product as a valid email address character? – tehhowch Aug 9 at 16:53 + 1 Answer 1 As per advised before by the support, I tried to send my sample to schema.whitelisting@gmail.com . You can try sending your sample there too. schema.whitelisting@gmail.com Thanks a lot for sharing this. We will try it out next! – Luise Schröder Aug 10 at 13:46 By clicking "P...

HTTP request works on php but not on JS - CORS rule [duplicate]

Image
Clash Royale CLAN TAG #URR8PPP HTTP request works on php but not on JS - CORS rule [duplicate] This question already has an answer here: i have the following problem: I am using an API, which has activated the 'same-roigin-rule', so that no client with a different origin-address can fetch data from the API. When i make requests on my lokal dev-deployment, via php cURL, i can fetch data, on localhost. If i try to make an ajax request from my JS code on to the same URL, i get the CORS error (same-origin-rule is active [...]). The API requires HTTPs basic authentification, which i pass (via username and password or token from API response). Now my question is why i can do the request via php (as i say my php server is local on my computer, so a different origin i guess...) but not via JS? Thanks for you attention This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. server to server...

nginx to always serve the root index.html in every path

Image
Clash Royale CLAN TAG #URR8PPP nginx to always serve the root index.html in every path I have currently the code below. I am wondering if it's possible to still service this root even though I go to other pages like http://localhost/dog. The problem with my command below is it will return 404 server listen 80; server_name localhost; location / root /usr/src/app/angularjs/dist; 1 Answer 1 It is possible. Add the try_files directive to your location block, this will tell nginx to load all requests that cannot be matched to a filesystem path with your index.html : try_files location index.html try_files $uri /index.html; try_files $uri /index.html; By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Split access.log file by dates using command line tools

Image
Clash Royale CLAN TAG #URR8PPP Split access.log file by dates using command line tools I have a Apache access.log file, which is around 35GB in size. Grepping through it is not an option any more, without waiting a great deal. I wanted to split it in many small files, by using date as splitting criteria. Date is in format [15/Oct/2011:12:02:02 +0000] . Any idea how could I do it using only bash scripting, standard text manipulation programs (grep, awk, sed, and likes), piping and redirection? [15/Oct/2011:12:02:02 +0000] Input file name is access.log . I'd like output files to have format such as access.apache.15_Oct_2011.log (that would do the trick, although not nice when sorting.) access.log access.apache.15_Oct_2011.log 7 Answers 7 One way using awk : awk awk 'BEGIN split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ", months, " ") for (a = 1; a <= 12; a++) m[months[a]] = a split($4,array,"[:/]"); year = array[3] month =...

Block onClick function

Image
Clash Royale CLAN TAG #URR8PPP Block onClick function I am trying to block a particular onClick function on my site. I have written the following but it doesn't appear to block the function. Any ideas? It works if I remove ('xx=d&') but I only want it to block the function when this is present. JS function AJFK_AjaxUpdateForm('xx=d&') (event) event.preventDefault(); You are probably getting a syntax error on your console. Check it out. – DontVoteMeDown Aug 10 at 11:01 This part function AJFK_AjaxUpdateForm('xx=d&') (event) does not make sense, is supposed to be just function AJFK_AjaxUpdateForm(event) if you want to pass more than 1 argument function AJFK_AjaxUpdateForm(arg1, event) etc... But the question is where does 'xx=d&' come from? is it an id? class? a specific property of the element? – Bargros Aug 10 at 11:22 function AJFK_AjaxUpdateForm('xx=d&') (event) function AJFK_AjaxUpdateForm(event) ...

JS Node returning only numbers and not proper values

Image
Clash Royale CLAN TAG #URR8PPP JS Node returning only numbers and not proper values I'm trying to use js node to display a mysql query results so I can later output it to a webpage. At the moment, I'm just outputting the resulsts of a query into the console, the code is below: var mysql = require('mysql'); const querystring = require('querystring') var connection = mysql.createConnection( host : 'localhost', user : 'webuser', password: 'p0ssw0rd', database: 'balancesheet2' ); connection.connect(function(err) if (err) throw err; console.log('Connected!'); connection.query('SELECT * FROM balancesheet2.orders', function (err, result, fields) if (err) throw err; result = querystring.stringify(result,' ); ); The results i'm getting are just as below: Result: 0 := | 1 := | 2 := | 3 := I'm not sure where the problem lies, is it with the code, or is it with the database somewhere? Calling query...

Error ClassNotFoundException in jar file Maven Java app

Image
Clash Royale CLAN TAG #URR8PPP Error ClassNotFoundException in jar file Maven Java app I'm having an error when I try to package my app. It works perfectly if a run the app without packaging. I read lot of posts having the same problem but any solution is working for me. I'm trying to upload my server-side app into the server. I'm a bit new in java spring boot. The pom.xml is <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>GastosApp</groupId> <artifactId>GastosApp</artifactId> <version>1.0-SNAPSHOT</version> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-pare...

redis.clients.jedis.exceptions.JedisException: Could not get a resource from the pool

Image
Clash Royale CLAN TAG #URR8PPP redis.clients.jedis.exceptions.JedisException: Could not get a resource from the pool redis.properties #jedisPoolConfig redis.minIdle=100 redis.maxIdle=500 redis.maxTotal=50000 redis.maxWaitMillis=10000 redis.testOnBorrow=true #jedisPool redis.host=192.168.13.169 redis.port=6379 redis.timeout=3000 redis.port2=6380 #redis-sentinel redis.sentinel=192.168.13.169:26379 redis.master=mymaster spring-redis.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <!--properties配置--> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="l...

Elasticsearch DSL Query for Update

Image
Clash Royale CLAN TAG #URR8PPP Elasticsearch DSL Query for Update I understand that I am able to update a particular document by http://localhost:9200/[index_name]/[index_type]/[_id], but I have document where the _id has # symbols which Sense couldn't find them. Understand that the Query DSL will be able to perform a search where I am able to indicate the _id not in the URL. Resource: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-ids-query.html Can I check with you, how can I do the same for updating document? 2 Answers 2 If you don't want to put the ID in the URL, the only option you have is to use the update by query API, like this: POST index/_update_by_query "query": "ids": "values": ["2323#23423"] , "script": "source": "do some update here" thanks for the response. I am using Elasticsearch version 1.3.3 and I think this version don't have the update_by...

Python - Unicode issue while using json.loads

Image
Clash Royale CLAN TAG #URR8PPP Python - Unicode issue while using json.loads I have the following input in a request "input" : "skill" : ["java","Âccounts"], "cleanText" : "I am looking for a hardworking and experienced developer" , "count" : 10 I am using flask so I get the request content by the following way inp = flask.request.data And I am converting it to json by the following json library inp = json.loads(inp) And I get the following json object as output u'count': 10, u'input': u'skill': [u'java', u'xc2ccounts'], u'cleanText': u'I am looking for a hardworking and experienced developer' We can see that Âccounts is replaced by u'xc2ccounts . I have already tried to decode the string to UTF-8 and passed it to the loads function and had no luck. I want the exact Âccounts returned from the json.loads function. If it is not possible is there...

Calculating height of an object in an image giving more error percentage than calculating width

Image
Clash Royale CLAN TAG #URR8PPP Calculating height of an object in an image giving more error percentage than calculating width My application’s requirement is to measures object of interest’s height and width from the captured image. I am thinking of implementing formulae behind scantips website. I was checking the accuracy of scantips and found that width measurement is more accurate than height. I entered iPhone 7’s focal length 3.99 and crop ratio as 28/3.99 = 7.0175438596. 28 is focalLenIn35mmFilm. I got this info from captured image’s EXIF data. I entered the image height, height of object in image and manually calculated distance from that object. Observation: Height is giving more error percentage than width. Width’s error percentage is around 2-4% but height’s is more than 10%. Any pointers in the right direction will helps a lot. Show the captured image itself and give actual / measured dimensions. – meowgoesthedog Aug ...

How to push the 1) find content, 2) replaced content and 3)count

Image
Clash Royale CLAN TAG #URR8PPP How to push the 1) find content, 2) replaced content and 3)count I need to find greek characters and replace that corresponding values and its replaced counting numbers: (I need to do get this from more 100 replacements) This is my coding: use strict; use warnings; my @grkChars = qw(alpha beta gamma); my $eachGrk = join "|", @grkChars; #Greek Characters my $str = 'Trp $mathbfR^a$ locates alpha beta distantly $mathrmR^a$ from $mathitR^a$ cys25 in both gamma and cathepsin K, with alpha high and moderate $mathbbR^1H$ strengths, respectively. The protein $mathdsR^a$ modification $mathdsR^1H$ largely beta affects the binding sites and stability gamma of the gamma peptides, and the effects depend on alpha the elemental compositions of the peptides'; my $count = $str=~s\($eachGrk)\$1g && print "Content: $&n"; print "Total Count: $countn"; My Output: Content: alpha Total Count: 1 Expected output is: alpha cha...

Browse a GCS or S3 bucket visually (thumbnails)

Image
Clash Royale CLAN TAG #URR8PPP Browse a GCS or S3 bucket visually (thumbnails) I recently set up Google Cloud Storage for a client. I think it's going to work fine for them, for the most part, with one exception: The console lists assets as filenames, with no icons or thumbnails. This is fine for me, but the client is going to want to be able to preview files the way they can in Google Drive. Is there anything I can integrate with either of these services, to provide a more graphical file browsing experience? A related note: I could have sworn that when I first set up the Google Cloud Storage bucket, I would get a preview of a file when I moused over it. Even this would be acceptable for the client, I think, but suddenly, my rollover stopped working. So if someone could tell me how to re-activate that, this would be good too. 1 Answer 1 I believe that this functionality of file previews is not available at this moment at Cloud Storage in the GCP Console. A feature reques...