Vicheanak

1

votes
1

answer
1.3k

views

How can I query the range of date which one product has not been ordered? (LINQ)

I have three tables, Products(ProductID, ProductName) Orders(OrderID, OrderDate) OrderDetails(ProductID, OrderID) Junction table between Products and Orders. For example, there are Three ProductID in Products table A01, A02, A03 Four OrderID in Orders table 1. 01/01/2009, 2. 03/01/2009, 3. 05/01/20...
Vicheanak
1

votes
1

answer
2.1k

views

Google setOnloadcallback() function clash with window.onload

here is my code: window.onload = function(){ google.load('visualization', '1', {packages:['corechart']}); google.setOnLoadCallback(function(){ alert('Message'); }); } I know it will work if I put google load outside window.onload. But I want it to be inside the window.onload. Any suggestions? Thanks
Vicheanak
1

votes
1

answer
2.2k

views

Scrapy SgmlLinkExtractor referer none

i'm trying to make my spider working. This is my code in spider: start_urls = ['http://www.khmer24.com/'] rules = ( Rule(SgmlLinkExtractor(allow=(r'ad/\w+/67-\d+\.html',), ), callback='parse_items'), ) The sample url look like: http://www.khmer24.com/ad/honda-click-2012-98/67-258149.html I want...
Vicheanak
1

votes
1

answer
1.9k

views

Error: connect ECONNREFUSED 127.0.0.1:9200 ElasticSearch Firebase

From the firebase elastic search project flashlight: https://github.com/firebase/flashlight.git I imported data from example/seed/data.json into my https://flashlighttest.firebaseio.com I run this in root: FB_NAME='flashlighttest' node app.js I got this error. failed to index firebase/user/bruce: E...
Vicheanak
1

votes
1

answer
606

views

Angular2 Http PUT gives wrong RequestMethod

I can't understand why I can't use http put in Angular2. When I'm doing http post, it give the correct request method: However, when I use http put: it give OPTIONS as the request method: I meant what the heck is this? Here is the method that I'm using for post: let headers = new Headers({ 'Content...
Vicheanak
1

votes
2

answer
0

views

How to retrieve an Image from MS SQL Server to bind in Gridview ASP.NET by using LINQ to SQL?

I have a binary file which stores in the customerPicture column that has Image as a datatype in the CUSTOMERs table. I have saved an image by using this line of code in LINQ to SQL. Dim db = new MyCompanyDataContext Dim newCus = new CUSTOMERs Dim filebyte As Byte() = fileUploader.FileBytes Dim fileB...
Vicheanak
1

votes
1

answer
1.3k

views

How to group Objects in an Array using PHP PDO and MySQL?

I have this category table Category ============ id name ref_id 1 cat1 0 2 cat2 0 3 subCat1 1 4 subCat2 1 5 subCat3 2 6 subCat4 2 I would like to have a result that look like this: {items: [ {catId: 1, subCat:[{name: subCat1}, {name:subCat2}]}, {catId: 2, subCat:...
Vicheanak
1

votes
1

answer
1.5k

views

How to write recursive scrapy rule with regular expression?

the pattern of the url is http://www.khmer24.com/ad/change-petrol-to-gas-use-injector-special-price/67-204320.html I want to keep the domain, ad, and number 67 in the url. Here is the sample url: http://www.khmer24.com/ad/ANY-STRING/67-123456789.html here is the code in my spider: from scrapy.item i...
Vicheanak
1

votes
2

answer
764

views

How to Wait for Multiple ngResource $resource Queries to Resolve

I have these ngResource queries in my controller: Ages.query(function(ages){ $scope.ages = ages; }); Skinissues.query(function(skinissues){ $scope.skinissues = skinissues; }); Skintypes.query(function(skintypes){ $scope.skintypes = skintypes; }); Activities.query(function(activities){ $scope.activit...
Vicheanak
1

votes
1

answer
168

views

How to use Promise in Service AngularJS? Sample Data Firebase

Here is my service.js file: angular.module('starter.services', []) .factory('firebaseData', function() { return { refUserFacebook: function (userUid) { var firebaseRef = new Firebase('https://sweltering-heat-772.firebaseio.com/users/'); var user; firebaseRef.once('value', function(dataSnapshot) {...
Vicheanak
1

votes
2

answer
350

views

Find common elements in 1 array using Javascript

I have this: var mergeUniqueItems = ['-JsDEcxz_ZSGFLKwd1QM', '-JsJ2NXGDYKI6QRsuXVK', '-JsJ2RK-kOG2eGcG04xF', '-JsJ2RK-kOG2eGcG04xF', '-JsJ2YLPiP6751zh8geS'] I have used this: var duplicateArray = []; for (var i = 0; i < mergeUniqueItems.length; i ++){ for (var j = 1; j < mergeUniqueItems.lengt...
Vicheanak
18

votes
7

answer
51.3k

views

How to Export JSON to CSV or Excel - Angular 2

Say my json is like this: var readyToExport = [ {id: 1, name: 'a'}, {id: 2, name: 'b'}, {id: 3, name: 'c'} ]; How can I export this JSON into CSV or Excel file in Angular2? The browser that I'm using is Chrome. Maybe Angular2 is not relevant, however, is there any third party plugin that can be in...
Vicheanak
1

votes
1

answer
1.2k

views

How to detect event when Select open popup in Ionic2?

{{o.outletNameKh}} By this i can detect only after we select the option in the select list. How can I detect its event when the select popup appears on the screen?
Vicheanak
5

votes
2

answer
14.1k

views

How to Validate & Display Error Message - Angular2 Material Design?

I have this input: Price is required But the message Price is required doesn't show up. How should I properly format the error message? The ng-invalid class appears when the price input is empty: When I fill in something: Angular injects ng-valid class in it. I want is to have the style similar to...
Vicheanak
3

votes
4

answer
1.4k

views

Remove Multiple Items from Array using underscore.js?

I have this: var arrA = [{id:1,name:'a'},{id:2,name:'b'},{id:3,name:'c'}]; I have another array: var arrB = [{id:1,other:'c'},{id:3,other:'d'}]; How can I remove the items from arrA that have property id same as arrB using underscore.js? The expected result should be: arrA = [{id:2, name:'b'}]; Th...
Vicheanak
2

votes
2

answer
743

views

How can I group arrays in an array in PHP and encode to JSON?

I have 2 tables in MySql Section section_id name ===================== 1 Section1 2 Section2 Category category_id section_id name ========================================= 1 1 Category1 2 1 Category2 3...
Vicheanak
3

votes
1

answer
2.2k

views

window.onload doesn't work with Google Chart API

I want to put google chart into window.onload, but it doesn't show anything instead, in the status bar, it shows 'Transferring data from www.google.com...' I know if we put the code outside window.onload it will surely work, but I want to put in window.onload. Any suggestions? thanks Here is my code
Vicheanak
5

votes
1

answer
9k

views

How to Find Children Element in @ViewChild Angular2?

import { Component, ViewChild } from '@angular/core'; @Component({ selector: 'my-app', template: ` para 1 para 2 button 1 ` }) export class AppComponent { @ViewChild('container') myDiv; ngAfterViewInit(){ //this console.log would print this [p, p, button] console.log(this.myDiv.nativeElement.childre...
Vicheanak
4

votes
2

answer
6.3k

views

How to properly add document.addEventListener to Angular2?

I've came across cordova RemoteControl plugin where, to listen to its event, the addEventListener is needed to be registered. //listen for the event document.addEventListener('remote-event', function(event) { //do something }); Is it a proper way for me to do it?
Vicheanak
1

votes
3

answer
1.9k

views

how can I check the input is only number and white space in regular expression?

I have '222 22 222', '333 33 33 333', '1234/34', and 'ab345 543' and I want to check whether these inputs are numeric and white space. I.E this case, the first and the second inputs should return True by using method Test of Regular Expression, or return its own value by using Exec method. The third...
Vicheanak
6

votes
5

answer
8.3k

views

How Can I run PM2 with Angular-Cli? - Angular2

How can I run: ng serve --prod with pm2? ng serve from angular-cli, Angular2. I'm running on DigitalOcean. I have tried to test with http-server -p 4200 -d false in the dist/ folder after ng build --prod When I request from the domain https://www.unibookkh.com/, i got 404 error: (I've already set...
Vicheanak
5

votes
3

answer
3.8k

views

How Can I Check isNaN in Angular2 Expression?

When I'm trying to do this: dividerColor='{{isNaN(+price) ? 'warn' : 'primary'}}' It gives me this error: browser_adapter.ts:82 ORIGINAL EXCEPTION: TypeError: self.context.isNaN is not a function How can I check if my object is a not number in Angular2 expression?
Vicheanak
2

votes
1

answer
1.3k

views

how to print the exact word from a file by using grep?

I have this file call helloworld.txt: starthelloworld_some_text.jpgend starthelloworld_different_text.jpgend starthelloworld_another_different_one.jpgend and I would like Grep to display only like this: helloworld_some_text.jpg helloworld_different_text.jpg helloworld_another_different_text.jpg...
Vicheanak
1

votes
1

answer
1.1k

views

How to Wait for Angular2 to Handle Dynamic Multiple Http Requests?

I know that you can use Observable by calling forkJoin method to wait for multiple http requests to be done like below: getBooksAndMovies() { Observable.forkJoin( this.http.get('/app/books.json').map((res:Response) => res.json()), this.http.get('/app/movies.json').map((res:Response) => res.json())...
Vicheanak
1

votes
2

answer
352

views

Angular2 - How to Condition Import, Does More Import Slow Down the Performance?

I have this: import {StepOnePage} from '../../pages/step-one/step-one'; import {StepTwoPage} from '../../pages/step-two/step-two'; import {StepThreePage} from '../../pages/step-two/step-one'; import {StepFourPage} from '../../pages/step-two/step-one'; import {StepFivePage} from '../../pages/step-two...
Vicheanak
4

votes
1

answer
474

views

How to Perform Arithmetic Operations in Sequelize?

How can I do this in sequelize? SELECT ProductID, Name, ListPrice, ListPrice * 1.15 AS NewPrice FROM Production I've tried: db.Production.findAndCountAll( attributes: { include: [ ['ListPrice * 1.15', 'NewPrice'] ] } ).then(function(orders){ return res.jsonp(output); }) But it doesn't work. This...
Vicheanak
4

votes
4

answer
4.7k

views

How Can I make modal to become full-screen in Ionic2?

Here is my modal code: let modal = Modal.create(DailyReportPage); this.nav.present(modal); It works fine on Phone, however on the tablet it looks like this: What I want is to make it look like this:
Vicheanak
2

votes
3

answer
185

views

How to sort a collection of objects in an Array in Javascript?

I have a collection objects in an array, [{A:2, B:2},{A:2, B:3},{A:1, B: 2}, {A:1, B:1}] I would like to have a sort result of property A then property B. Therefore, as a result it should be: [{A:1, B:1}, {A:1, B:2}, {A:2, B:2}, {A:2, B:3}]
Vicheanak
37

votes
30

answer
153.6k

views

Reverse each individual word of “Hello World” string with Java

I want to reverse each individual word of a String in Java (not the entire string, just each individual word). Example: if input String is 'Hello World' then the output should be 'olleH dlroW'.
Vicheanak
3

votes
6

answer
34.3k

views

How to install Visual Studio 2008 and MS SQL Server 2008 in Ubuntu?

I would like to install Visual Studio 2008 and MS SQL Server 2008 on Ubuntu OS which I have in my PC, however, I don't know how. May I have some tips please? Thanks.
Vicheanak
2

votes
1

answer
872

views

Can't install Underscore in Angular2? angular-cli

I run this: npm install underscore --save typings install dt~underscore --global --save ng build angular-cli-build.js var Angular2App = require('angular-cli/lib/broccoli/angular2-app'); module.exports = function(defaults) { return new Angular2App(defaults, { vendorNpmFiles: [ 'systemjs/dist/system-p...
Vicheanak
2

votes
1

answer
715

views

Where is the seed log for Sequelize?

When I run db:seed:all command, it gives me this error: Seed file failed with error: Validation error How can I see the log of which validation that got error in Sequelize?
Vicheanak
2

votes
2

answer
21k

views

How to add Days through Angular Date Filter?

I have this code: Empty Angular App {{'2015-07-08T15:10:10.530Z' | date:'medium'}} Expected: Aug 23, 2015 10:10:10 PM http://codepen.io/vicheanak/pen/MwVNwG/ I'd like to add 46 days on top of '2015-07-08T15:10:10.530Z'. Expected result is: Aug 23, 2015 10:10:10 PM Thanks for your help
Vicheanak
1

votes
3

answer
2.9k

views

How to extract UUID from a uri using Regular Expression in Javascript?

I have this url string http://apistaging.yoolk.com/listings/F7B519E8-135C-43D0-A35F-764B582EDC48?domain_name=cambodiastaging.yoolk.com&display=basic I would like to get only the uuid F7B519E8-135C-43D0-A35F-764B582EDC48 from this url by using regular expression in Javascript. How could I do so? Ple...
Vicheanak
2

votes
2

answer
87

views

Scrapy XPath Incorrectly when there is Unicode in the page

I want to get all divs that have category class. Take a look at this page: www.postkhmer.com/ព័ត៌មានជាតិ in scrapy shell: scrapy shell 'www.postkhmer.com/ព័ត៌មានជាតិ' As you see I got only 2 elements back. scrapy fetch --nolog http://www.postkhmer.com/...
Vicheanak
7

votes
1

answer
40.4k

views

Unable to cast object of type 'System.Data.Linq.DataQuery`1[System.Int32]' to type 'System.IConvertible'

I'm trying to insert the data into my database which has 2 tables Products (ProductID): 1 (IDNumber) : 200900110 (ProductName) : Pepsi Order (OrderID): 1 (Auto Increment by 1) (ProductID):1 (Date): 1/1/2009 The code is this: var db = new ProductOrder(); var idNum = from p in db.Product where p.IDN...
Vicheanak
1

votes
5

answer
317

views

Byte code and Source code in Java?

I'm really confused. Please someone help to give a clear answer of which of the following contain source code and byte code in java? Student.class Student Student.java Student.exe
Vicheanak
3

votes
2

answer
2.8k

views

Build iOS failed - Cordova Ionic iOS

$ionic build ios CpResource PsarOnline/Resources/icons/[email protected] build/emulator/PsarOnline.app/[email protected] cd /Users/Roller/Working/Mobile/PsarOnline/platforms/ios export PATH='/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode...
Vicheanak
2

votes
1

answer
1.2k

views

How to keep tab when pushing a new page?

When I push a new tab like this in my controller: this.nav.push(EditPage); the tab disappears. How can I keep the tab? Pic below: When the new page comes:
Vicheanak
8

votes
1

answer
10.1k

views

How to use @ViewChildren in Angular2? [duplicate]

This question already has an answer here: How can I select an element in a component template? 10 answers In my home.html: msg 1 msg 2 msg 3 msg 4 In my home.ts: export class HomePage { @ViewChildren('pmessage') pMessages; constructor() { //using first works, result msg 1 console.log(this.pMessages...
Vicheanak

View additional