2018-10-22         Jack

Laravel MIX not working, using CDN does work

I'm a bit lost here. I'm NOT new to Laravel Mix so this is really confusing.I have a layout blade file and it looks something like this<html> .... <script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.9.0/katex.min.js"></script> <script src="{{ mix('/js/myjs.js") }}></script> </body></html>The myjs.js is compiled using Laravel Mix and contains dozen of libraries and all of them compile and work properly.However if I include this require('katex'); //so it's above everything else to simulate situation from above, when it'...

 laravel                     1 answers                     4 view
 2018-10-22         Jack

Change parent component props/state from child

I'm currently learning REACT to create a web app.In this app, I have a list of selectedCharacters in the parent's state and in each child component I have an input for the player name.I'm struggling to update the player name in the parent's state.class Game extends React.Component { state = { selectedCharacters: [{"name":"Loup Garou","imgName":"base_loup.png","uniqueKey":"loup","playerName":""},{"uniqueKey":"voyante","imgName":"base_voyante.png","name":"Voyante","maxInGame":1,"left":1}] }; changePlayerName = (char, newName) => { char.playerName = newName; }; r...

 reactjs                     4 answers                     85 view
 2018-10-22         Jack

How to get User Id and Access Token in Microsoft Graph API C#

I am attempting to create a multi-tenant app that will allow users to access their OneDrive. Due to the type of device that the app will be run on, it is not practical to have users entering their username and password each time they access the app, so I was going to setup the app so that an administrator can grant permissions on behalf of their users using the app only permissions (I have the admin consenting bit done).The bit I am having trouble with now is that when a user accesses the app, I only have their email address.How can I get an access token based on the user'...

 c#                     2 answers                     85 view
 2018-10-22         Jack

Always require stage parameter for Serverless framework

Is there a way to make Serverless abort execution if the stage is not given?Looks like it defaults to "dev", which is not preferred in a multi-environment setup where a "default" environment doesn't exist.The closest I could get was reading a 'stage' config variable from a local file. Unfortunately Serverless still defaults to 'dev' if the stage variable is missing from the (existing) local file. It does give a warning for the missing variable, though.provider: name: aws runtime: nodejs8.10 region: eu-west-1 stage: ${file(serverless-local.yml):stage} This is a bit of...

 aws-lambda                     2 answers                     34 view
 2018-10-22         Jack

Working of @cache_page() decorator in django-redis-cache

I am using(trying) redis as a cache to my django app. This is how I am trying to do it.def postview(request): post_list = [] if cache.get("posts") == None: post_list = Post.objects.all() cache.set("posts", post_list, timeout=None) else : post_list = cache.get("posts") context = {"post_list" : post_list} return render(request, 'post_list.html', context)@cache_page(60*15, key_prefix="test_cache")def new(request): print("testing") return HttpResponse("hello, I am mohammed")This is the output in redis-cliluvpreet@DHARI-Inspiro...

 django                     1 answers                     94 view
 2018-10-22         Jack

How to use browserSync with gulp in angular2 app with angular cli?

I'm developing an Angular 2 app using angular cli. I'm also using gulp as a task runner in the project. I want to use BrowserSync with gulp instead of the default ember live reload plugin that angular cli provides with. I have tried using proxy option in gulp browserSync to that of the default ng serve port ie: 4200. But then when gulp is running, I'm unable to run the project (ng serve). So can anyone please help me with this problem as I want to run browserSync with gulp. This might be a very n00b question as I'm new to gulp and angular, but help would be appreciated. Tha...

 angular                     1 answers                     13 view
 2018-10-22         Jack

PHP: Emailing HTML Body of PHP Template file

I'm currently using PHP's mail() function to email the HTML Body of another PHP file using concatenation.This is currently working fine, however, I would prefer the script to simply get the parsed HTML Body rather than using the concatenation method.I've read a few incomplete forum posts regarding using fopen() and fread() but had no luck myself.Any output I have got to work has not parsed the PHP within the file.Is there a function available that can do this? You can do:ob_start();require 'some_script.php';$html = ob_get_clean();and then you have the output of the scrip...

 php                     1 answers                     48 view
 2018-10-22         Jack

Aptana Javascript templates

I'd like to set my Eclipse to use javascript templates with Aptana Studio.I've set a new template here: window/preferences/aptana/editors/javascript/templates.The template's description: name: ccc, context: javascript, description: own comment, pattern: // --I open .js files with aptana JS editor and the perspective is Aptana Web.When I type "ccc" and push ctrl + shift I don't get any suggestion or insertion.When I type "c" I can find my template in the suggestion list and choose it, but it's cumbersome.Why can I find the template in the suggestion list with one character a...

 javascript                     1 answers                     81 view
 2018-10-22         Jack

Tuning Multi-Level Rows-to-Cols Query

In the answer to a previous post (Tuning Rows-to-Cols Query), I learned how to more efficiently construct a row-to-cols query which allows for filtering by date. However, I now need to take this one level further.The schema for the query below is as follows:SAMPLE (1-to-many) TEST (1-to-many) RESULT (1-to-MANY)Each sample has one or more tests, and each test has one or more results.Question: How can I rewrite this view more efficiently, still allowing fast filtering by "Date Sampled?"Concern: The points for MAX(tst.created_on) should be the set of unique tests with test_id...

 sql                     1 answers                     75 view
 2018-10-22         Jack

Query problem - rows are returned when query is run in sql navigator , but not in my c# program

Update:This is the query from the debugger, which was retrieved from a string builder:{SELECT * FROM FCR.V_REPORT WHERE DATE BETWEEN to_date('14/09/2001' , 'dd/mm/yyyy') AND to_date('30/09/2011' , 'dd/mm/yyyy')}If you remove the curly brackets and post it in Navigator, it works.Original:I have a problem when running my program. The query in sql navigator returns 192 rows but when I run the query on c#(visual studio 2010) the query returns 0 rows.Below is my c# code: public static DataTable GetReport(string date1, string date2){ DatabaseAdapter dba = DatabaseAdapter.GetInst...

 c#                     6 answers                     39 view
 2018-10-22         Jack

Spring JPA : Update entity with updated child entities

DB Used : Postgres with Spring jpaI have a Main Entity which has structure as follows :Parent (CascadeType.All for childs)-->Child 1 (Join column with parent here)-->Child 2 (Join column with parent here)-->Child 3 (Join column with parent here)-->Child 4 (Join column with parent here)-->Child 5 (Join column with parent here)When I first save parent entity in db(Child 2..5 are null) it saves successfully. Then i update Child 2..5 and do save operation with same object it gives me error that it exceeds no of column size of Postgres which is 1665.(This is becau...

 postgresql                     1 answers                     56 view
 2018-10-22         Jack

Why Kafka so fast

If I have same hardware, to use Kafka or our current solution(ServiceMix/Camel). Is there any difference? Can Kafka handle "bigger" data than it? Why?There is a article to talk about how fast could it be? But I still don't get clearly why Kafka is so fast comparing to other solutions?Benchmarking Apache Kafka: 2 Million Writes Per Second (On Three Cheap Machines) Kafka is fast for a number of reasons. To name a few.Zero Copy - See https://en.wikipedia.org/wiki/Zero-copy basically itcalls the OS kernal direct rather than at the application layer to movedata fast. Batch Da...

 bigdata                     1 answers                     27 view
 2018-10-22         Jack

Asp.net chart controls not loading windows azure

I have developed MVC application with a page with asp.net chart controls and it is working fine in local. After i deployed the code in Azure, they are not loading on the page. I have around 10 charts but only 1 or 2 charts are loading randomly. Does any one had faced the same issue?Thanks Check in the console.log of your browser if there is an error. If not, it means that there is a problem related to how the charts get information. (connection string for example).My tip: create a new page with the same charts, but with fixed values (Fake List for example) and see if it...

 c#                     1 answers                     59 view
 2018-10-22         Jack

Using COUNT(*) OVER() in current query with SQLAlchemy over PostgreSQL

In a prototype application that uses Python and SQLAlchemy with a PostgreSQL database I have the following schema (excerpt):class Guest(Base): __tablename__ = 'guest' id = Column(Integer, primary_key=True) name = Column(String(50)) surname = Column(String(50)) email = Column(String(255)) [..] deleted = Column(Date, default=None)I want to build a query, using SQLAlchemy, that retrieves the list of guests, to be displayed in the back-office.To implement pagination I will be using LIMIT and OFFSET, and also COUNT(*) OVER() to get the total amount of record...

 python                     2 answers                     30 view
 2018-10-22         Jack

Update an Object/Instance by overwriting the save method of another Model, by using the FK

I have the following models: class Acc(models.Model): name = models.CharField( max_length=35)class User(AbstractBaseUser, PermissionsMixin): acc = models.ForeignKey(Acc, blank=True, null=True, related_name='owner', on_delete=models.CASCADE)class Note(models.Model): name = models.CharField( max_length=35 receiver = models.ForeignKey(settings.AUTH_USER_MODEL, blank=True, null=True, on_delete=models.CASCADE)class Item(models.Model): note = models.ForeignKey(Notification, on_delete=models.CASCADE,) acc = models.ForeignKey(Acc, on_delete=models.CASCADE) ...

 django                     1 answers                     98 view
 2018-10-22         Jack

CSS/ cut an img's width when reducing the screen/window width

I wanted to have an Image on 100% width, with a max-height. When scaling the window and you're reaching the max-height, the width should still be at a 100% but "cropping" the image bigger (provided image size is fitting). This means you can see more of the image sides (left and right) when its on a big scale window, and you can see less on a small sized window. I'll post my css try down, but i don'thave a clue how to do that at this point. Hope you're getting my issue, i'll attach a visualisation.My Code, don't get confused, I wanted to do a slider but lets focus on only on...

 javascript                     3 answers                     49 view

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