Posts

Showing posts from August, 2015

vue.js - Using Vue in Laravel project -

working on project in laravel , want integrate vue , vue resource it. have setup not working expected. below code: routes.php route::get('api/projects', function() { return app\project::all(); }); app.js new vue({ el: '#project', data: { projects: [] }, ready: function() { this.getprojects(); }, methods: { getprojects: function() { this.$http.get('api/projects').then(function(projects) { this.$set('projects', projects); }); } } }); my view <div class="content" v-for="project in projects"> <h3 class="title"> @{{ project.title }} </h3> @{{ project.description }} </div> with code above, nothing displayed on page if i @{{ $data | json }} i projects data in json. kind of weird, please doing wrong. thanks @programmator on laracast . answer solved issue...

ruby on rails - ActiveRecord query from an array of hash -

i have array of hash. eg) array_of_hash = [ { id: 20, name: 'john' }, { id: 30, name: 'doe'} ] i records match criteria in particular hash. query want executed is select persons.* persons persons.id = 20 , persons.name = 'john' or persons.id = 30 , persons.name = 'doe' what best way construct query array of hash? i think okay: ids = array_of_hash.map { |h| h[:id] } names = array_of_hash.map { |h| h[:name] } person.where(id: ids, name: names) (although it's not super generic) other attempt: people = person.all array_of_hash.each |h| people = people.where(h) end people # => generate long long query.

algorithm - Output a map of sets of elements that are disjoint in every other list of elements from a Map of lists -

i have map of lists, each list has integers. output map of sets of elements disjoint in every other list of elements. for ex: below map of lists list 1 - 1,2,3,4,5 list 2 - 3,4,5,6,7,8 list 3 - 1,2,3,5,6,7,8 intersection of lists - 3,5 output should map of lists (excluding 3, 5) list 1 - 1,2,4 list 2 - 4,6,7,8 list 3 - 1,2,6,7,8 i have solution using 2 loops has o(n*n) complexity. trying find optimal solution. pointers appreciated. can represent different sets using hashtables. way computing overall intersection o(m) m total number of elements across sets. then, need compute set difference between original sets , computed intersection. again, done fast using hashtables o(k*n) k number of elements in overall intersection , n number of sets. the structure of algorithm use 2 non-nested loops. first compute intersection of sets, second rid of redundant elements in sets. you find running example in c++ live on coliru . #include <vector> #in...

java - How do I retrieve the nodes deleted after a cypher query? -

so i'm deleting nodes database, , want retrieve nodes i've deleted far don't go looking them later. how neo4j ids of deleted nodes in java code? you can return ids of nodes you're deleting them: match (n:somelabel) delete n return id(n) however, mentioned in documentation, ids can reused neo4j, it's bad idea keep referencing them outside of transaction (not sure if that's use case).

javascript - Check if page is loaded from bfcache, HTTP cache, or newly retrieved -

the code below checks whether url loaded , logs console. know if there simple, clean method check if page loaded bfcache or http cache? firefox documentation states load event should not triggered if go url b , hit button url a, not experience, both load , pageshow logged regardless, know why? var tabs = require("sdk/tabs"); function onopen(tab) { tab.on("pageshow", logpageshow); tab.on("load", logloading); } function logpageshow(tab) { console.log(tab.url + " -- loaded (maybe bfcache?) "); } function logloading(tab) { console.log(tab.url + " -- loaded (not bfcache) "); } tabs.on('open', onopen); i not sure whether there purposeful api workaround came mind check value of performance.timing.responseend - performance.timing.requeststart . if <= 5 http or back-forward cache . otherwise, download web. a way recognize return page through back button instead of opening clean url use history api . ...

sql server - Sorting Multiple data regions-SSRS -

i have report contains data multiple datasets (using lookup),indicators , report item fields. use 1 of sort sort columns in asc or desc order. product id (dataset 1) sales of wk1 (dataset 1) sales of wk2 (dataset 1) sum of sales(sum of report item 2 , 3) cost (lookup dataset 2) profit (report item 4-5) profit% (indicator) how can sort using profit - lowest profit or negative profit first. there way in ssrs right click tablix, , click sorting tab. add expression each level of sorting, based on same expressions have listed. there can select ascending or descending order each sort expression.

Display Visual Studio Find In Files results in alphabetical order -

in visual studio 2015, did find in files search on solution , noticed order of results not expected. e:\source code\manager\manager.businesslogic\permission\appmodulemanager.cs(158): enumpair<permissiontype> actualpermission = permissionvalue enumpair<permissiontype>; e:\source code\businesslogic\valueobjects\enumpair.cs(9): public class enumpair<t> : observableobject e:\source code\businesslogic\valueobjects\inheritedpermissionmodel.cs(485): public enumpair<permissiontype> viewpickups { get; set; } e:\source code\reports\reports\common\model\enumpair.cs(3): public class enumpair e:\source code\businesslogic\inheritancelogic\permissioninheritancemanager.cs(148): resolvedkeywordpermissionitem.allowkeyword = new enumpair<permissiontype>(keywordpermission.allowkeyword, source.gettype().name); i thought see entries in "source code\businesslogic" first, entry in "source code\manager" second...

arrays - Lazarus setLength type mismatch -

i building compiler , error code, when compile programm: compiler_main.pas(55,4) error: type mismatch the code following: unit compiler_main; {$mode objfpc}{$h+} interface uses classes, sysutils, fileutil, synedit, forms, controls, graphics, dialogs, stdctrls, extctrls; type { tform1 } tform1 = class(tform) groupbox1: tgroupbox; groupbox2: tgroupbox; image1: timage; image2: timage; splitter1: tsplitter; splitter2: tsplitter; synedit1: tsynedit; synedit2: tsynedit; synedit3: tsynedit; procedure image1click(sender: tobject); procedure image2click(sender: tobject); procedure setforcompiling(var datasect: array of string; var textsect: array of string; var bsssect: array of string); procedure setdatasect (var datasect: array of string); //////////functions//////////////////// function compile () : boolean; private { private declarations } public { public declarations } end; var form1: t...

Why won't my YouTube Player API load videos whose ID has an underscore? -

i've tried player.loadvideobyid , player.loadvideobyurl whenever youtube video has '_' in id video not play. other videos work fine. this example of id not work: 'nj6_a9tqvle'. it has underscore , no misstakes: <iframe width="420" height="315" src="https://www.youtube.com/embed/xgsy3_czz8k"> </iframe>

r - Variable Selection with mgcv -

is there way of automating variable selection of gam in r, similar step? i've read documentation of step.gam , selection.gam , i've yet see answer code works. additionally, i've tried method= "reml" , select = true , neither remove insignificant variables model. i've theorized create step model , use variables create gam, not seem computationally efficient. example: library(mgcv) set.seed(0) dat <- data.frame(rsp = rnorm(100, 0, 1), pred1 = rnorm(100, 10, 1), pred2 = rnorm(100, 0, 1), pred3 = rnorm(100, 0, 1), pred4 = rnorm(100, 0, 1)) model <- gam(rsp ~ s(pred1) + s(pred2) + s(pred3) + s(pred4), data = dat, method = "reml", select = true) summary(model) #family: gaussian #link function: identity #formula: #rsp ~ s(pred1) + s(pred2) + s(pred3) + s(pred4) #parametric coefficients: # estimate std. error t value pr(>|t|) #(i...

user interface - Alternatives to Stingray Objective Toolkit C++ for 64bit applications? -

we using stingray objective toolkit in our c++ applications mfc ui controls. planning migrate application 64bit , when inquired version of stingray toolkit, expensive. i'm not sure of other toolkits offering 64bit source code. have idea of cheaper alternatives stingray offering 64-bit support? toolkit pro codejocks... http://www.codejock.com/ i don't know how compares stingray. library codejocks provided source code , compiles 32 , 64-bits, , mbcs , unicode.

c# - Is it bad practice to catch form's data in controller with FormCollection or Request -

i have view multiple forms not return object models, returns individual values inserted in multiple models, tell me whether practice use formcollection or request catch form values in case?. here i'm doing. public actionresult traspasarmaterial(formcollection form) { if (form == null){ tempdata["traspaso"] = false; return redirecttoaction("index"); } //cobobox id_almacen_origen regresa el id_cantidad_diponible lo buscamos para sacar el id_almacen almacenes_materiales alm_or = db.almacenes_materiales.find(convert.toint32(form["id_almacen_origen"])); int id_material = convert.toint32(form["id_material"]), id_almacen_origen = convert.toint32(alm_or.id_almacen), id_almacen_destino = convert.toint32(form["id_almacen_destino"]); double cantidad = convert.todouble(form["cantidad"]); try { var cantidad_disp = (from aux...

c - How to detect a memory leak in FreeRTOS -

i'm using freertos v9 on efm32gg board , gcc compiler, develop first embedded application :) want know how can detect memory leak in application (basic one), there techniques or algorithms that? freertos not leak memory, application might, can detect same way in non freertos application. memory allocation uses calls pvportmalloc() , vportfree(), rather malloc() , free() directly ( http://www.freertos.org/a00111.html ), , calls functions can tracked in trace tool ( http://www.freertos.org/trace ), or defining relevant trace macros, how trace tool ( http://www.freertos.org/rtos-trace-macros.html ).

Where does an android.graphics.Path object store its data? -

i can see nested classes in docs, no fields, methods. i'm trying understand how path built. in private data fields. aren't in docs because can't access them- they're private. they're subject change @ time putting them in documentation counterproductive, aren't supposed ot know or use them- if did application woul break next version of android.

Parse multi level json data with php -

{ "books": [ { "id": 2331, "image": "http://lol.org/flower.png", "images": [ { "256x144": "http://lol.org/bee.png", "650x320": "http://lol.org/fly.png" } ], .... i have json data above problem how out 650x320 data. $data = json_decode($jsondata,true); $gg = sizeof($data['books']); for($x=0;$x<$gg;$x++){ codes below works fine $image = $data['books'][$x]['image']; but how fetch images on second json level? have tried code below no luck. $image = ($data->{'books'}->{'images'}->{'320x180'}); $image = $data['books']['images'][$x]['320x180']; 'books' array of objects, need select object using numeric index. $image = $data['books'][$insertindexhere][...

"Fancybox" Global jQuery plugin implementation with JSPM / System.js as module: -

i got 'fancybox' working module, can import import fancybox 'fancybox'; inside main app js file. cannot work 'helper' js files, extend functionality of main fancybox function. jspm package.json in overrides section exports 'fancybox' function main 'source/jquery.fancybox.pack.js' file. should extended helper files. { "jspm": { "configfile": "config.js", "dependencies": { "fancybox": "bower:fancybox@^2.1.5", }, "overrides": { "bower:fancybox@2.1.5": { "main": "source/jquery.fancybox.pack.js", "format": "global", "files": [ "source/jquery.fancybox.pack.js", "source/helpers/jquery.fancybox-buttons.js", "source/helpers/jquery.fancybox-media.js", "source/helpers/jquery.fancybox-thumbs.js...

Android crash when attempting to take picture -

trying create android app. it's going second activity , return on clicking return button. want able take picture in second activity. when click button app crashes. package com.example.gary.natureall; import android.content.intent; import android.content.pm.packagemanager; import android.graphics.bitmap; import android.media.image; import android.os.bundle; import android.provider.mediastore; import android.support.v7.app.appcompatactivity; import android.view.view; import android.widget.imageview; import android.widget.textview; import java.io.ioexception; public class uploadpicscreen extends appcompatactivity { imageview ivcamera, ivupload, ivgallery, ivimage; static final int request_image_capture = 144; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.upload_picture_layout); intent activitythatcalled = getintent(); string previousactivity = activit...

java - Android : LinearLayout with weight inside a ScrollView -

Image
i'm having frustrating issue scrollview, here hierarchy : scrollview (vertical) linearlayout (vertical) imageview weight= 0.5 whatever weight= 0.1 whatever weight= 0.2 whatever weight= 0.2 if remove scrollview (and let linearlayout main item), work image : image takes 50% of screen size, , other views take fill rest. however, when scrollview here, "weight" parameter ignored if image tall : image can fit screen width, , tall , take more 50% of screen. edit : actually, "weight" attributes seem ignored : without scrollview: with scrollview: i want linear layout fit without having scrolling. possible ? i've tried change of image option (scaletype, adjustviewbounds) didn't manage have wanted. here's whole xml : <?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent...

unit testing - Cucumber Order of Execution - Ruby -

is there way specify order of execution inside cucumber? example, rather running cucumber feature/foo/foo.feature feature/foo/bar.feature have execute in order... want run bundle exec cucumber , run in specified order. i know features/scenarios should independent of each other current tests i'm running it's not practical. if there no "official way" (which seems case) recommend design implement such functionality? copying own answer here : as mentioned here, cucumber scenarios should not dependent on each other. according cucumber best practices, there shouldn’t sort of coupling between scenarios. or in other words, there should no state persists between scenarios. just example why bad practice consider case when 1 scenario step adds record database, while subsequent scenarios depend on existence of record. may work, create problem if order in scenarios run changes, or run in parallel. try review approach , see how can define scenarios differe...

terminal - BASH function for escaping spaces in filenames before opening them -

i've been trying write function bash profile quite time now. problem i'm trying overcome i'm provided file paths include spaces , it's pain having go through , escape spaces before try open in terminal. e.g. file -> /volumes/company/illustrators/website front page design.ai what i'm trying end '/volumes/company/illustrators/website\ front\ page\ design.ai' being opened terminal. so far i've managed escape spaces out, error "the file ..... not exist." my code far function opn { open "${1// /\\ }";} any appreciated. the important thing understand difference between syntax , literal data . when done correctly, escaping syntax : it's read , discarded shell. is, when run open "file spaces" or open file\ with\ spaces or even open file" "with\ spaces ...the quoting , escaping parsed , removed shell, , actual operating system call gets executed this: execv("/usr/bin/ope...

ios - Sending data over socket in Android -

i need connect socket , send credential info in order start receiving upcoming data on receive_crisis . i'm using library socket.io android code. it's hard debug since got no log connection, don't know why , fails. never received server since started working on android side. nsdictionary equivalent jsonobject on android? sendevent equivalent send() or emit() on android? need send json object or array? finally, how log error? it's working on ios part i'm kinda lost.. this ios code : (i modify address safe purpose): nsdictionary *params=@{@"user":_username,@"orgid":_organizationid}; [_socketio connecttohost:@"nodejs.myserver.com" onport:3000 ]; [_socketio sendevent:@"joinparty" withdata:params]; this android code : private void connectandlisten(int username) throws exception { socket = io.socket("nodejs.myserver.com:3000"); socket.connect(); jsonobject json = new jsonobject(); ...

Using Revolution Slider with Squarespace -

i'm having trouble determining whether jquery version of revolution slider made work squarespace site. documentation mentions need upload several folders (assets, css, fonts, js) containing files web server, can't squarespace (you can upload individual javascript files or other asset files). maybe having folder structure isn't necessary. possible use revolution slider squarespace? based on following text documentation: please upload <strong>revolution</strong> folder server. in folder find following subfolders containing of items content: assets css fonts js if slider revolution placed in different folder, don’t forget change file paths in upcoming examples! it seems use in squarespace enabling developer mode/platform . add folder called, say, "revolution" "assets" folder in squarespace. "/assets/revolution" folder contain of files referenced in docs (assets, css, fonts, js). you'd change file...

scala - How to use orderby() with descending order in Spark window functions? -

i need window function partitions keys (=column names), orders column name , returns rows top x ranks. this works fine ascending order: def gettopx(df: dataframe, top_x: string, top_key: string, top_value:string): dataframe ={ val top_keys: list[string] = top_key.split(", ").map(_.trim).tolist val w = window.partitionby(top_keys(1),top_keys.drop(1):_*) .orderby(top_value) val rankcondition = "rn < "+top_x.tostring val dftop = df.withcolumn("rn",row_number().over(w)) .where(rankcondition).drop("rn") return dftop } but when try change orderby(desc(top_value)) or orderby(top_value.desc) in line 4, syntax error. what's correct syntax here? there 2 versions of orderby , 1 works strings , 1 works column objects ( api ). code using first version, not allow changing sort order. need switch column version , call desc method, e.g., mycol.desc . now, api design territory. advantage of passing co...

active directory- see that user is admin c# -

how can see if user admin or not in active directory using c#? getting groups names not option, because in different languages roles names different (администраторы, administrators, etc) vlad, querying ad retrieve members of admin group has been asked before... server 2003 here this too since question seems concerned differentiating character string "administrator" in installed language, wouldn't have locale specific names in resources/code?

Swagger says"not a valid parameter defenition" -

i'm new swagger , appreciate direction on resources learning. i have test project i'm putting , running issues. i'm getting error saying "parameters" in "delete" block not valid. looks ok me i've seen in examples. apparently i'm missing something. ideas? swagger: "2.0" info: version: "2" title: title description: provides services vacation rentals site termsofservice: private contact: name: name url: www.myurl.com email: my@email.address license: name: mit url: http://opensource.org/licenses/mit schemes: - http host: myurl.com basepath: /api paths: /guestbook: get: summary: gets persons description: returns list containing persons. responses: 200: description: list of posts schema: type: array items: required: - firstname properties: firstname: ...

c - Problems with GCC "build file: no target in no project" -

Image
i have problem c. when want compile sources codes, see message: === build file: "no target" in "no project" (compiler: unknown) === the classic hello world works, have message. i want make program read absolute directories , subdirectories recursively, print names 252 characters or more in file. use codeblocks , gnu gcc. i have had problem codeblocks. although had compiler. the problem have not saved file correct extension - e.g. untitled4 in stead of untitled4.c or untitled4.cpp (for c++). renaming file has worked.

haskell - Can't understand result of Monad >> application -

operation >> description following: sequentially compose 2 actions, discarding value produced first, sequencing operators (such semicolon) in imperative languages. here example confuses me: > ([1] ++ [2]) >> ([2] ++ [3]) [2,3,2,3] i'm expecting list [2,3] result of right part of expression. how can result of [2,3,2,3] explained? (>>) default defined as a >> b = >>= (\_ -> b) so value being ignored a in given monadic value m a . type of >>= specialised list is: (>>=) :: [a] -> (a -> [b]) -> [b] l >>= f invokes f each element of list l product list of lists concatenated. e.g. [1,2] >>= (\i -> [i, -i]) > [1,-1,2,-2] ignoring each input element , returning value [2,3] result in n copies of list [2,3] input list of length n e.g. [1] >>= (\_ -> [2,3]) > [2,3] [1,2] >>= (\_ -> [2,3]) > [2,3,2,3] this second example equivalent ([1] ++ ...

unity3d - NetworkServer is not active. Cannot spawn objects without an active server -

i have been looking answer problem have not found solves problem. prefab registered. here code piece, in following class: "public class mynetworkmanager : networkmanager" public override void onstartserver() { networkserver.registerhandler(msgtypes.playerprefab, onresponseprefab); base.onstartserver(); spawncard (); } void spawncard () { gameobject go = gameobject.instantiate (theguy) gameobject; networkserver.spawn (go); } can hint problem is? look @ remote actions call method on other client. https://docs.unity3d.com/manual/unetactions.html

c# 3.0 - Possible to get type of an aliased type in c#? -

type.gettype("system.string") is there lookup aliases available somewhere? type.gettype("string") returns null . this not possible programmatically, since 'aliases' in fact keywords introduced in c#, , type.gettype (like every other framework method) part of language-independent framework. you create dictionary following values: bool system.boolean byte system.byte sbyte system.sbyte char system.char decimal system.decimal double system.double float system.single int system.int32 uint system.uint32 long system.int64 ulong system.uint64 object system.object short system.int16 ushort system.uint16 string system.string

Mathematica: How to obtain data points plotted by 3Dplot command? -

i've been using command posted years ago here how obtain data points 2d-function: f = sin[t]; plot = plot[f, {t, 0, 10}] points = cases[ cases[inputform[plot], line[___], infinity], {_?numericq, _?numericq}, infinity]; and export data file: export["data2/name_"<>tostring[n[index]]<>"&"<>tostring[n[a]]<>".dat",points1,"table","fieldseparators"->" "]; however, right must generalize command 3dplot case, i've tried @ documentation cases , list3dplot commands unfortunately have not been able figure out. has suggestion? i'd appreciate lot. thanks. using cases : flatten[cases[ inputform@normal@plot3d[sin[x y], {x, -1, 1}, {y, -1, 1}] , polygon[x_, ___] -> x, infinity], 1] // union using evaluationmonitor : reap[plot3d[z = sin[x y], {x, -1, 1}, {y, -1, 1}, evaluationmonitor :> sow[{x, y, z}]]][[2, 1]];

php - Why strpos returns false in this case? -

i'm trying find out if string contains string. here code $insta_share_link='https://instagram.com/p/bir-knbgyt-'; if(strpos($insta_share_link,'instagram.com/p/')) { //some code... } when wrote echo function see strpos returning, showed false. why? the needle has 'www.', haystack (' https://instagram.com ...') not. the entire string 'www.instagram.com/p/' must found in haystack strpos return position of string.

java - Comparing double for equality is not safe. So what to do if want to compare it to 0? -

i know because of binary double representation, comparison equality of 2 double s not quite safe. need perform computation this: double a; //initializing if(a != 0){ // <----------- here double b = 2 / a; //do other computation } throw new runtimeexception(); so, comparison of double s not safe, not want to devide 0. in case? i'd use bigdecimal performance not quite acceptable. well, if issue dividing zero, news can have since if value isn't 0, can divide it, if it's really, small. you can use range comparison, comparing lowest value want allow, e.g. a >= 0.0000000000001 or similar (if it's going positive).

python - Given 3 dicts of varying size, how would I find the intersections and values? -

i looked intersections of dictionaries, , tried use set library, couldn't figure out how show values , not pull out keys work them, i'm hoping help. i've got 3 dictionaries of random length: dict_a= {1: 488, 2: 336, 3: 315, 4: 291, 5: 275} dict_b={2: 0, 3: 33, 1: 61, 5: 90, 15: 58} dict_c= {1: 1.15, 9: 0, 2: 0.11, 15: 0.86, 19: 0.008, 20: 1834} i need figure out keys in dictionary a, b, , c, , combine new dictionary. need figure out keys in dictionary a&b or a&c or b&c, , pull out new dictionary. should have left on in a, b, , c ones unique dictionary. so, eventually, i'd wind separate dictionaries, follows: total_intersect= {1: {488, 61, 1.15}, 2: {336, 0, 0.11}} a&b_only_intersect = {3: {315,33}, 5:{275,90}} (then dicts a&c intersect , b&c intersect) dict_a_leftover= {4:291} (and dicts leftovers b , c) i thought using zip, it's important values stay in respective places, meaning can't have values in c position. awesome! ...

Docker, where does the firewall go? -

i'm new docker , trying understand when build system, host system need configuration users, ssh, firewall, fail2ban, etc. or go docker containers? you need protect host, since can access host can access containers. docker utilizes iptables , pre-configures firewall rules each container spins allow outbound traffic block new inbound traffic. opening inbound traffic done exposing port on host ( docker run -p ... ).

sql server 2008 - How to write insert query for stored procedure -

how write insert query stored procedure. i have 2 tables user , orders . when execute query running perfectly. eg : - insert orders values((select users.uid users users.uname = 'asim'), 15) but when i'm trying convert same stored procedure getting error. create proc insert_orders_sp @uname insert orders(uid, quantity) values((select users.uid users users.uname = @uname), 15) i couldn't understand made mistake. please me out.. orders table you missing datatype sp parameter create proc insert_orders_sp @uname varchar(10) -- missing datatype insert orders(uid, quantity) values((select users.uid users users.uname = @uname), 15) your insert stmt running separately work because not use variable. sp , ins stmt not comparable.

Split the string when alphabet is found next to a number using regex Python -

i have string this string = "3,197working age population" i want break string such when number 3,197 ends , working age population starts using regex or other efficient method. in short need 3,197 you may have @ itertools.takewhile : from itertools import takewhile string = "3,197working age population" r = ''.join(takewhile(lambda x: not x.isalpha(), string)) print(r) # '3,197' take s items string while alphabet has not been reached. result reformed string using join

unit testing - Running Angular2 tests that call setTimeout errors with "Cannot use setInterval from within an async zone test" -

i'm upgrading our angular2 app use rc4 , started getting error on unit tests: cannot use setinterval within async zone test my widget makes request data ngoninit method , puts loading indicator while request made. mocked service returns data after 1ms. here's simplified version exposes problem import { inject, async, testcomponentbuilder, componentfixture} '@angular/core/testing'; import {http, headers, requestoptions, response, http_providers} '@angular/http'; import {provide, component} '@angular/core'; import {observable} "rxjs/rx"; class myservice { constructor(private _http: http) {} getdata() { return this._http.get('/some/rule').map(resp => resp.text()); } } @component({ template: `<div> <div class="loader" *ngif="_isloading">loading</div> <div class="data" *ngif="_data">{{_data}}</div> </div>...

java - JavaMail smtp.gmail.com ANT vs Eclipse -

i have frustrating issue code that's trying send email through javamail via gmail. code works when run eclipse, when run through ant fails connect "could not connect smtp host, reponse -1" error. i'm using same jre's in both eclipse , ant , don't see classpath perspective different. the javamail debug logs below - first successful run within eclipse; debug: javamail version 1.4.2 debug: loaded resource: /meta-inf/javamail.default.providers debug: tables of loaded providers debug: providers listed class name: {com.sun.mail.smtp.smtpssltransport=javax.mail.provider[transport,smtps,com.sun.mail.smtp.smtpssltransport,sun microsystems, inc], com.sun.mail.smtp.smtptransport=javax.mail.provider[transport,smtp,com.sun.mail.smtp.smtptransport,sun microsystems, inc], com.sun.mail.imap.imapsslstore=javax.mail.provider[store,imaps,com.sun.mail.imap.imapsslstore,sun microsystems, inc], com.sun.mail.pop3.pop3sslstore=javax.mail.provider[store,pop3s,com.sun.mail.po...

ios - Stacking views changing size weirdly -

Image
i have set constraints 2 views correctly , preview different devices good. used size class changing aspect ratio ipads now when stack these 2 views, size of resulting stack changes dramatically. why size of resulting stack weird in case? i beginner in ios programming , appreciate here.

Why would this Access 2010 report have extra white space at the bottom when using a criteria? -

Image
i've developed access 2010 report shows sets of deadlines staff member. displayed part of form group header. page header, detail, , page footer set visible = no, height = 0, , detail set can shrink = yes. when open report without filtering individual staff member, shows group each staff member intended, no white space @ end. however, when filter specific staff member (which how report used), there white space below report contents. resizing window not work; report reverts same size every time open it. have event set on close opens different form, no other events. [edit add] not have background image set report screenshot:

r - How to change characters into NA? -

i have census dataset missing variables indicated ? , when checking incomplete cases in r says there none because r takes ? valid character. there way change ? na s? run multiple imputation using mice package fill in missing data after. creating data frame df df <- data.frame(a=c("?",1,2),b=c(2,3,"?")) df # b # 1 ? 2 # 2 1 3 # 3 2 ? i. using replace() function replace(df,df == "?",na) # b # 1 <na> 2 # 2 1 3 # 3 2 <na> ii. while importing file ? data <- read.table("xyz.csv",sep=",",header=t,na.strings=c("?",na)) data # b # 1 1 na # 2 2 3 # 3 3 4 # 4 na na # 5 na na # 6 4 5

typescript - Angular2 Routing with child tree -

i'll start new project in angular2 typescript, there still problems routing: i have entities this: entity id:1 child id:1 child id:2 entity id:2 child id:1 child id:2 child id:3 entity id:3 child id:1 now i'm trying code routing this: @routeconfig([ <br> {path: '/', component: entitylistcomponent}, <br> {path: '/:id/...', name: 'entity', component: entityeditcomponent}, <br> {path: '/:id/children', name: 'childlist', component: childlistcomponent} <br> {path: '/:id/children/:childnumber', name: 'child', component: childeditcomponent}<br> ]) of course, not work :-(. how can parameters entity children, or how can configure routing? thanks everybody,i hope you'll understand problem.

fortran - Bin data read differently in AIX vs Linux -

i have .bin file contains slopes , intercepts. i'm using fortran read values , i'm getting different values on machines running aix , linux. believe linux data accurate. have stack size or endians? for example, aix max value is: 0.3401589687e+39 while linux max value is: 6.031288 program read_bin_files real :: slope(2500,1250) integer :: recl=2500*1250*4 open(unit=8, file='modis_avhrr_years_slope.bin', action='read', access='direct', form='unformatted', recl=recl, iostat=iostat) read(unit=8, rec = 1, iostat = iostat) slope print *, "max slope value is:", maxval(slope) close(8) end aix runs (these days) on power cpus, usually big-endian, whereas linux usually run on x86es, little-endian. correct suspect endianness may problem. report result of running this program program read_bin_files integer*4 :: slope(2500,1250) integer :: recl=2500*1250*4 open(unit=8, file='modis_avhrr_years_slope.b...

c# - Can I use generics to change a subclass' method signature? -

i need perform operation on subclass , return result: public interface ientity { } public abstract class entity : ientity { public abstract ientity dostuff(ientity e1, ientity e2, ientity e3); } public class customer : entity { public override ientity dostuff(ientity e1, ientity e2, ientity e3) { // <-- yuck var customer1 = e1 customer; // <-- yuck var customer2 = e2 customer; // <-- yuck var customer3 = e3 customer; // <-- yuck // stuff return foo; } } i want avoid subclass' method signature, , associated typecasting. so prefer this: public override customer dostuff(customer c1, customer c2, customer c3) { // stuff return foo; } how use type system accomplish that? edit: i changed name of method compare dostuff , reiterate operation irrelevant. i'm not trying compare. want change types. how do that? ...

How to use like, or_like and get_where together in Codeigniter 3 -

i'm trying search keyword in rows business_type manufacturer it's not working , it's getting rows. method in model: public function search($keyword) { $this->db->like('category',$keyword); $this->db->or_like('keyword',$keyword); $this->db->or_like('products_deals_with',$keyword); $this->db->or_like('buisness_name',$keyword); $params['conditions'] = array( 'business_type' => 'manufacturer' ); $query = $this->db->get_where('business_listings', $params['conditions']); return $query->result_array(); } generated query is: select * `business_listings` `category` '%%' escape '!' or `keyword` '%%' escape '!' or `products_deals_with`like '%%' escape '!' or `buisness_name` '%%' escape '!' , `business_type` = 'manufacturer' i've found solution. i...

wordpress - Want My page.php file to display different pages categories Loops -

in page.php file, i'm aiming have different categories' loops different pages using conditioner: if (is_page(array('pagename1', 'pagename2'))) { } but when placed loop below inside 'is_page' braces, got blank page <?php $newsposts = get_posts('cat=4'); foreach($newsposts $post) : setup_postdata($post); ?> <a href="<?php the_permalink(); ?>"> <div class="col-lg-3 col-md-4 col-sm-6"> <div class="newsbox2 newsboxcolor1"> <div class="newsbox3pix boxeq"> <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'full', array() ); }else { ?> <img src="<?php echo get_bloginfo('template_directory');?>/images/noimage.jpg" alt="no image"> <?php ...

location - determine if waypoint has been reached, and if it's missed, move on to the next one with android google maps -

i wrote method determine distance destination along path , determine distance next waypoint along path. problem is, don't go within 10 meters of waypoint it's not getting caught having been reached. sure, increase threshold of distance make waypoint met, i'd rather come solution determine if i've passed waypoint , skip (by adding waypointsreached list) move on next one. checking see if distance location waypoint increasing instead of decreasing won't work because may stray off path before waypoint. can me wrap head around idea of way can determine if i've passed waypoint , move on next one? here's method i've written distance final destination , next waypoint. // method calculate distance destinatoin loaded route private void calculateroutetodestination(location location) { new asynctask<location, void, arraylist<double>>(){ @override protected arraylist<double> doinbackground(location... params) { ...

java - Given a number (bit sequence) and a bit index, how do I find the next highest order bit? -

if have input, 51 (00110011) , index representing bit index (ex. = 0 -> 1, = 2 -> 0), how find power of 2 these examples. sorry, i'm not great math notation can give sample input , output. example: if given 51 , index 1 (001100 1 1), want function return 00010000 = 16. also, if given 173 , index 2 (10101 1 01), function must return 00001000 = 8. i'm looking solution uses bit operations , no loops based on size of number preferably. edit : isn't homework. i'm writing program stores user selections number. i'm trying challenge myself here. here little i've been able do x--; (int j = 0; j < 5; j++) { x |= x >> (int) math.pow(2, i); } x++; return x; this takes 32 bit number , returns next power of 2. i'm not sure if of use though problem. tried seeing if else had posted similar , found , thought might play in i'm trying do. edit 2 i'm having users select days of week , store days in single n...