Posts

Showing posts from September, 2015

hadoop - How to count the different values in a column in Pig and Hive -

i have data file below indicates order valid or invalid. want calculate count of valid orders , count of invalid orders. 1,flipkart,pepsi,invalid 2,flipkart,tshirt,valid 3,flipkart,shirt,valid 4,amazon,shoe,valid 5,amazon,beer,invalid 6,flipkart,jewels,valid 7,flipkart,coke,invalid so final output should how many number of valid , invalid records totally eg : valid : 7 , invalid 3 in flipkart, how many valid , invalid records , in amazon how many valid , invalid records. eg : flipkart : valid 3 , invalid : 2 amazon : valid 1 , invalid : 1 in pig - groupby , foreach assuming column names id,name,pp,state bynamestate = group my_data (name, state); bynamestatecounts = foreach bynamestate generate count(my_data) ccc;

How to read a binary file using Fortran and save to a text file? -

i have binary file following information: ifile.dat big_endian sequential, nx=530, ny= 427, t=1, 4 variables i read fortran program , write text file. trial f90 program is: bin_read.f90: integer,parameter :: nx=530, ny=427 real :: v1(nx,ny),v2(nx,ny),v3(nx,ny),v4(nx,ny) open(10, file= 'ifile.dat', form = 'unformatted', & &access='sequential',convert='big_endian') open(11, file= 'ofile.txt', form = 'formatted', & &status='unknown') j = 1, ny = 1, nx read(10,*)v1(i,j),v2(i,j),v3(i,j),v4(i,j) write(11,1)v1(i,j),v2(i,j),v3(i,j),v4(i,j) 1 format(4(1x,f8.3)) enddo enddo stop end when execute after compilation, getting following message: at line 11 of file bin_read.f90 (unit = 10, file = 'ifile.dat') fortran runtime error: format present unformatted data transfer

get - Servlet and path parameters like /xyz/{value}/test, how to map in web.xml? -

does servlet support urls follows: /xyz/{value}/test where value replaced text or number. how map in web.xml? it's not supported servlet api have url pattern wildcard * in middle of mapping. allows wildcard * in end of mapping /prefix/* or in start of mapping *.suffix . with standard allowed url pattern syntax best bet map on /xyz/* , extract path information using httpservletrequest#getpathinfo() . so, given <url-pattern>/xyz/*</url-pattern> , here's basic kickoff example how extract path information, null checks , array index out of bounds checks omitted: string pathinfo = request.getpathinfo(); // /{value}/test string[] pathparts = pathinfo.split("/"); string part1 = pathparts[1]; // {value} string part2 = pathparts[2]; // test // ... if want more finer grained control possible apache httpd's mod_rewrite , @ tuckey's url rewrite filter .

ASP.NET Hyperlinks asp:HyperLink vs A href -

in asp.net when should use: <asp:hyperlink id="home" runat="server" text="home" navigateurl="./home.aspx"> and when shoudl use <a href="./unsignedvssignedtut.aspx">home</a> ? asp.net server controls give more abilities (e.g. event handling, more properties). html controls on other hand simpler. both controls fine. can start html control , migrate asp:hyperlink if need later. you can @ these discussions: asp control vs html control asp.net control vs html control performance

javascript - Two-dimensional string array creation -

this question has answer here: array.prototype.fill() different fill go 1 answer array.prototype.fill() object passes reference , not new instance 2 answers i'm trying create two-dimensional array of 1-character strings in javascript way: var panel = new array(3).fill(new array(3).fill('*')); result is [ ['*', '*', '*'], ['*', '*', '*'], ['*', '*', '*'] ] after need replace middle string: panel[1][1] = '#'; and result is [ ['*', '#', '*'], ['*', '#', '*'], ['*', '#', '*'] ] so seems prototype fill function fills array object reference. is possible force fill function fill a

oracle9i - Oracle select count(*) into n generates ORA-01401 inserted value too large for column -

i have spent hours tracking down source of bug , stumped. managed determine below simple select statement problem (comment , not error.. yes, it's cause). n defined number, tried integer grins. n integer; n := 1; select count(*) n category ( upper(ltrim(rtrim(category_long_name))) = upper(ltrim(rtrim(cat_long_name))) or upper(ltrim(rtrim(category_short_name))) = upper(ltrim(rtrim(cat_short_name))) or upper(ltrim(rtrim(category_description))) = upper(ltrim(rtrim(cat_descr))) ) , (settings_setting_id = sett_id) , (category_id <> cat_id); when code executed, ora-01401: inserted value large column . "insert" n value row count. actual value (used debugger) 0. i don't understand how causing problem. i've seen select count(*) x code snippet in examples. procedure runs fine statement commented out. time 'n' used in next step raise , exception if it's > 0. i've literally commented

Android MVP - How to communicate between activity presenter and fragment presenter -

i have activity 3 fragments, use viewpager. want implement mvp , communicate between activity presenter , fragment presenters i.e: passing data activity presenter fragment presenters sending event fragment presenters activity presenter ... but don't know how in official way. can use busevent don't think it's practice. as per understanding, usecase, suppose activitya have viewpager having 3 fragments(fragmenta, fragmentb, fragmentc). activitya have activitypresentera fragmenta have fragmentpresentera as per mvp, fragmentpresentera should responsible logical , business flows of fragmenta , should communicate fragmenta only. therefore, fragmentpresentera can not directly communicate activitypresentera. for communication fragment activity, presenter should not involved , should done communicate in non-mvp architecture, i.e. of interface. same applies activity fragment communication. for communication between activity , fragment read here

lambda - Vectorize Loop with nested lists in Python -

looking vectorizing loop in python: for in range(len(listone)): listtwo.append(listthree[listfour[a]]) i want test potential performance gains not having call append via loop. if not vectorization, perhaps lambda expression might suffice? thoughts or assistance immensely helpful! thank time! there's nothing wrong loop, change comprehension if want avoid append() : listtwo = [listthree[listfour[a]] in range(len(listone))]

php - Setting SQLite as my database in laravel 5 -

Image
i'm creating small mockup social network in laravel 5. want use sqlite database keep things small , local. i'm having trouble, however, getting work. here's code (using blade) use table display row in database: @extends('layouts.master') @section('title') testing2 @stop @section('content') second test <a href="/">back page 1</a> <table> <tr><th>author</th> <th>text</th></tr> @foreach($posts $post) <tr> <td> {{$posts->author}} </td> </tr> <tr> <td> {{$posts->text}} </td> </tr> @endforeach </table> @stop "author" , "text" being 2 columns in database. here route use generate page: route::get('test2', function () { $sql = "select * posts";

JQuery validation rule depends on another rule -

i have form required field depend on form field value. required rule may true or false depend on other field. issue accept rule should there if required true. how can that? ..., fielda: { maxlength: 3, accept: "[0-9]{3}", required: function() { if($('#fieldb').val() == 'abcd') { return false; } else { return true; } } },... thanks in advance. i didn't realize 'accept' rule custom rule. edited code check whether optional field. this.optional(element) jquery.validator.addmethod("accept", function(value, element, param) { return this.optional(element) || value.match(new regexp("^" + param + "$")); }); @barmar help.

python - User Input to mySQL database -

i want simple python program prompt user title , search mysql database. have database constructed can't figure out how query properly. import mysqldb servername = "localhost"; username = "username"; password = "password"; conn = mysqldb.connect(user=username,host=servername, passwd=password, db=db) cursor = conn.cursor() user_input = raw_input("what want watch?:") query= ("select * videos title %s") cursor.execute(query,user_input) if, hardcode query "where title '%hardcode%' ", works fine. figure solution pretty simple life of me can't figure out. appreciated! i've tried every variation find online no avail. others tried: query= ("select * videos title concat('%',%s,'%')") cursor.execute(query,(user_input,)) query= ("select * videos title (search)" "values (%s)", user_input) ... don't work. errors seem revolve around me passing va

real time - How to make esper epl divide section and compare value -

i new using esper . don't know esper epl , i'm in trouble. problem this. user define value section. for example, level1 : 1~3 level2 : 4~6 level3 : 7~9 so when data come first, check section , make events. previous value , new value same level nothing (ex. prev value=1, next value=2 these in same level1) . in other words, when data come, check previous value , level. if have different level, something. esper epl can this? how can make it? the "prior" , "prev" both give access event before given event. sql standard "case when then" if-then-else of sql standard. this: insert categorizedstream select case when value between 1 , 3 1 when value between 4 , 6 2 when value > 6 3 end level someevent; select * categorizedstream(prior(level) != level); one use prior , case-when in 1 epl statement think becomes more readable using 2 statements.

javascript - How to abort/cancel promise for first call during 2 consecutive angular service calls? -

when 2 consecutive service calls made through $http angular service on dropdown item selection , assume first call took time return , second call return before first call resolve shows data of first call second item selection. so there way abort first promise if service call made again before first call resolves. for demo purpose created sample plunkar has dropdown few items added explicit condition on selection of first item took little longer time other items. select first item , select second item reproduce scenario, check favorite books display on screen. any appreciated! service code: app.factory('bookservice', function($http, $q, $timeout) { return { getbook: function(id) { var promise = $q.defer(); var timeoutspan = id == 1 ? 3000 : 500; $http.get("favouritebooks.json").success(function(data) { $timeout(function() { promise.resolve(data.filter(function(obj) { return obj.id == id }))

javascript - Non blocking render in ReactJS -

i'm learning reactjs , trying build application on it. when i'm trying modify state , render, page freezing , can't until render finished when components become huge. i found can use shouldcomponentupdate optimize code, question comes me is: can make render procedure non blocking? , can tell user page processing heavy loading executions , please wait or maybe show progress of execution? or if user can cancel render, example, live editor, if user edit content of editor, "preview" section stop rendering old content , trying render new content without blocking editor ui? here's heavy loading example code: <!doctype html> <html> <head> <meta charset="utf-8" /> <title>react tutorial</title> <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.0.1/react.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.0.1/react-dom.js

css - Rounded dotted border with gradient -

Image
how make rounded dotted border gradient in css3? found borders gradient , dotted borders separately. have implement: you can set white dotted border on top of gradient image covering border zone. looks request .test { width: 300px; height: 80px; margin: 10px; border: dotted 10px white; border-radius: 50px; background-image: linear-gradient(white, white), linear-gradient(blue, magenta); background-origin: border-box; background-clip: content-box, border-box; } <div class="test"></div>

AngularJS + Jersey POST Bad Request -

i have following api in jersey file upload : @path("/image/upload") @post @consumes(mediatype.multipart_form_data) @produces("application/json") public response imageupload( @queryparam("filename") string filename, @formdataparam("file") inputstream fileinputstring, @context containerrequestcontext crc) throws connectexception, sqlexception, invalidcredentialsexception, ioexception, generalexception { } and using angular js uploading file : _myapp.service('fileupload', ['$rootscope', '$http', function($rootscope, $http) { this.uploadfiletourl = function(file, uploadurl) { var fd = new formdata(); fd.append('file', file); $http.post(uploadurl, fd, { transformrequest: angular.identity, headers: { 'content-type': 'multipart/form-data',

How to select text from HTML table using PHP DOM query? -

how can text html table cells using php dom query? html table is: <table> <tr> <th>job location:</th> <td><a href="/#">kabul</a> </td> </tr> <tr> <th>nationality:</th> <td>afghan</td> </tr> <tr> <th>category:</th> <td>program</td> </tr> </table> i have following query doesn't work: $xmlpagedom = new domdocument(); @$xmlpagedom->loadhtml($html); $xmlpagexpath = new domxpath($xmlpagedom); $value = $xmlpagexpath->query('//table td /text()'); get complete table php domdocument , print it the answer this: $html = "<table id='myid'><tr><td>1</td><td>2</td></tr><tr><td>4</td><td>5</td></tr><tr><td>7</td><td>8</td></tr></table>"; $xml =

javascript - How to loop through all text box elements in a page source and find the names of all those text boxes? -

i writing program output number of gui elements in webpage if source page given input , should output names of text boxes. the code wrote : <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>my app</title> <link rel="icon" type="image/x-icon" href="favicon.ico" /> </head> <body> <textarea id="textarea1"></textarea> <br /> <input id="submit1" type="submit" value="submit" /></div> <script> var $textarea = $('#textarea1'), $submit = $('#submit1'); $submit.click(function (e) { e.preventdefault(); sourcecode = $textarea.val(); var $searchobject = $('<div id="searching"></div>'); $searchobject.append($(sourcecode));

php - How to load css files, javascript files and images in codeigniter? -

my application structure is application assets -css -images -js system 1- load url helper in controller's constructor, $this->load->helper('url'); 2- use base url function load js, css files in view <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>css/style.css"> p.s: have put js, css files in root folders. (default)

DocuSign API how to get Integrator Key -

just signed docu sign sandbox following instructions in docs when go admin > api , keys there no option create integrator key. tells me don't have any, no button allowing me create one. has had happen? there bug in system option missing. still available if use top right dropdown , "switch classic." there can go preferences --> api , generate integrator key. detailed instructions can found here.

file - Java InputStreamReader Can not read Special(Turkish) Characters -

below can see code; final bufferedreader br = new bufferedreader( new inputstreamreader(new fileinputstream(f),"utf-8"));// tried "iso-8859-9" string strline; while ((strline = br.readline()) != null) { total += "\n" + strline; } br.close(); here below output.. should do? insan�n sec�ld�g� combobox the � or u+fffd character special character defined unicode "replacement character", character display when encounter character don't recognize, or byte data malformed , character cannot read. the inputstreamreader constructor using not allow specify behavior when there malformed data or when character not recognized. assumes want default behavior of using "replacement character" when there unrecognized character or when byte data malformed, may seeing. if examine output , find turkish characters not there have been replaced "replacement character" u+fffd, can change behavior throw

c# - Url redirection on OnActionExecuting method -

we trying implement non-hosted header accept before *.website.com in asp.net. since accept subdomain, extended httpcontextbase class add custom method. public static bool validatehost(this httpcontextbase context) { var domain = context.request.url.host; //add logic check if host valid , subdomain exist in database return false; } this method validate whether context.url.host valid host or subdomain exist in database if not redirect request default host website.com . added line of codes below in our basecontroller : protected override void onactionexecuting(actionexecutingcontext filtercontext) { if (!filtercontext.httpcontext.validateurl()) { filtercontext.httpcontext.response.redirect("https://website.com/"); return; } } it redirects default host whenever returns false , throws exception: {"server cannot append header after http headers have been sent."} am missing here or logic incomplete? try red

Samza Failed to send message. Exception -

i'm using samza on aws emr instances, , have exception follows, can me?: org.apache.samza.samzaexception: failed send message. exception: java.lang.illegalstateexception: cannot send after producer closed. @ org.apache.samza.system.kafka.kafkasystemproducer$$anonfun$send$5.apply(kafkasystemproducer.scala:120) @ org.apache.samza.system.kafka.kafkasystemproducer$$anonfun$send$5.apply(kafkasystemproducer.scala:111) @ org.apache.samza.util.exponentialsleepstrategy.run(exponentialsleepstrategy.scala:81) @ org.apache.samza.system.kafka.kafkasystemproducer.send(kafkasystemproducer.scala:86) @ org.apache.samza.system.systemproducers.send(systemproducers.scala:87) @ org.apache.samza.task.taskinstancecollector.send(taskinstancecollector.scala:61) @ org.apache.samza.storage.kv.loggedstore.putall(loggedstore.scala:72) @ org.apache.samza.storage.kv.serializedkeyvaluestore.putall(serializedkeyvaluestore.scala:57) @ org.apache.samza.storage.kv.cachedstor

bitmap - Watermark coming on whole image Android -

Image
i want place watermark on bottom right of picture. but, in mobiles coming , in mobile phones, watermark coming on whole image. here code: rotatedbitmap = bitmap.createbitmap(loadedimage, 0, 0, loadedimage.getwidth(), loadedimage.getheight(), rotatematrix, false); int w = rotatedbitmap.getwidth(); int h = rotatedbitmap.getheight(); bitmap result = bitmap.createbitmap(w, h, rotatedbitmap.getconfig()); canvas canvas = new canvas(result); canvas.drawbitmap(rotatedbitmap, 0, 0, null); bitmap watermark = bitmapfactory.decoderesource(getresources(), r.drawable.watermark2); int ww = watermark.getwidth(); int hh = watermark.getheight(); canvas.drawbitmap(watermark,(w-ww),(h-hh), null); edit: here screenshots of result. in second picture, watermark coming , in

java - Same data from listview being printed multiple times -

this java activity.the data being retrieve server. based on system.out.println("hi" +co.transaction_id) , same item being printed 5 times. java problem or php problem. have try edit listview xml height match parent or fill parent doesn't help. public class connect4 extends asynctask<string, void, string> { // public static final string product_id = "product_id"; public static final string receipt_index = "receipt_index"; view view; activity activity; productadapter1 adapter; public list<contactobject> receipt = new arraylist<>(); bitmap bitmap; public connect4(activity activity, view v, productadapter1 a) { this.activity = activity; view = v; adapter = a; } string convertstreamtostring(inputstream is) { try { return new java.util.scanner(is).usedelimiter("\\a").next(); } catch (java.util.nosuchelementexception e) { return ""; } } protected string doinbackground(stri

performance - Why app slow down and use more than 40 mb Cache in android studio 2.0 -

Image
recently have updated android studio 2.0, after when run app on device in debuging use 40 mb or more cache , slow down if generate signed apk use 15 kb cache , work faster. reference image it marshmallow issue , not related studio . you can check app on marshmallow , other os see difference, marshmallow caching data app , possibly bug marshmallow itself about slow startup issue: it indeed slow startup on app studio 2.0 , studio bug or requires caching use instant run guess

xcode - Xcode7: unknown type name error in a basic C++ program -

i working on c++ program stl latest version of xcode, , error "unknown type name 'ubresultdata'" , "unknown type name 'ubfirstargument'". have tried rewrite program standard unary_function , binary_function, , errors remained same. then, build progaram vs2010 , vs2013, , built successfully. what's wrong program? the errors in last line of class binder2nd. #include <iostream> #include <vector> using namespace std; template<typename inputiterator, typename predicator> inline int countif(inputiterator first, inputiterator last, predicator pred){ int count = 0; (; first != last; ++first) { if(pred(*first))++count; } return count; } template<typename arg1, typename result> struct unarybase{ typedef arg1 ubfirstargument; typedef result ubresultdata; }; template<typename arg1, typename arg2, typename result> struct binarybase{ typedef arg1 bbfirstargument; typedef arg2 bbs

Login to website authenticated with ADFS ,WS - Trust ,SAML token using curl PHP -

i want login website using php curl have username , password.after research have found website using ws-trust , adfs authentication , authorizing.here user's browser redirected idp(adfs) , redirected saml assertion security token. after reading post on http://leandrob.com/2012/02/request-a-token-from-adfs-using-ws-trust-from-ios-objective-c-iphone-ipad-android-java-node-js-or-any-platform-or-language/ .i have tried make request creating soap envelope getting security token confused endpoint on sending request. in leandrob.com post mentioned use " https://[server]/adfs/services/trust/13/usernamemixed " endpoint .i tried sending request endpoint got blank page output. i need send request , security token back.could please explain url need considered endpoint logging ws-trust , adfs authenticated website.

MS Access 2013 objects (tables, queries) display created or modified date -

Image
is there way can make access 2013 display created , modified date ? access 2003 used display features , can't seem find solution access 2013 ? you can right-click object list header, , view -> details . that's still not overview. (oh how miss access 2003 database window...) a better way query msysobjects table, e.g.: select msysobjects.type, msysobjects.name, msysobjects.dateupdate, msysobjects.datecreate msysobjects (((msysobjects.type)<>2 , (msysobjects.type)<>3 , (msysobjects.type)<>-32757) , ((left([name],1))<>'~') , ((left([name],4))<>'msys')) order msysobjects.type, msysobjects.name; see here object type constants: meaning of msysobjects values -32758, -32757 , 3 (microsoft access) you may interested in free "database window replacement" add-in: http://www.avenius.de/index.php?produkte:dbc2007

javascript - script to randomly change background gradient colors [but from specific range] -

i found neat script randomly changes background gradient colors. ask, how can narrow spectrum of colors - use shades of yellow , orange. in advance :) function newgradient() { var c1 = { r: math.floor(math.random()*255), g: math.floor(math.random()*255), b: math.floor(math.random()*255) }; var c2 = { r: math.floor(math.random()*255), g: math.floor(math.random()*255), b: math.floor(math.random()*255) }; c1.rgb = 'rgb('+c1.r+','+c1.g+','+c1.b+')'; c2.rgb = 'rgb('+c2.r+','+c2.g+','+c2.b+')'; return 'radial-gradient(at top left, '+c1.rgb+', '+c2.rgb+')'; } function rollbg() { $('.bg.hidden').css('background', newgradient()); $('.bg').toggleclass('hidden'); } look here: var c1 = { r: math.floor(math.random()*255), g: math.floor(math.random()*255), b: math.floor(math.random()*255) }; var c2 =

Git pre-push hooks -

i run unit-tests before every git push , if tests fails, cancel push, can't find pre-push hook, there pre-commit , pre-rebase only. i rather run test in pre-commit-hook. because change recorded when committing. push , pull exchange information recorded changed. if test fails have "broken" revision in repository. whether you're pushing or not.

java - Plugin to add features to "build automatically" and "build all" in eclipse -

i need write plugin in java add custom features "build automatically" , "build all" options in eclipse. more information functionality of builds in eclipse , how modify plugins? you use incremental project builder this. use org.eclipse.core.resources.builders extension point define builder. an example builder (as shown in documentation): <extension id="coolbuilder" name="cool builder" point="org.eclipse.core.resources.builders"> <builder hasnature="false"> <run class="com.xyz.builders.cool"> <parameter name="optimize" value="true"/> <parameter name="comment" value="produced cool builder"/> </run> </builder> </extension> if extension defined in plug-in id "com.xyz.coolplugin", qualified name of builder "com.xyz.coolplugin.coolbuilder". for mor

java - Need assistance with importing an array for a programing newbie -

i'm doing assignment uni, have create class file (processmarks.class) calculate max, min, range, mode, median etc. array of 125 integers have been provided our lecturer in class called marks.class, generates array of 125 'marks' between 0 , 100. so far i'm stuck on multiple fronts assignment, main issue i'm having (which i'm sure basic stuff still can't seem work), i'm trying processmarks.class created import , use marks created in marks.class file , hold results (of marks.class) use needed when user wants calculate min, max, mean etc. i cant eclipse allow me import class used processmarks.class; keep getting error cant resolved. do need put marks.java or marks.class in specific folder? should run marks.class, , copy, paste , initialise results manually? is there obvious i'm missing or maybe basic java fundamentals i'm not understanding properly? also i'm not looking work me, need pointed in correct direction. import java.ut

node.js - function in a function return value -

import.js exports.getconfig = function() { return api.getconfig(); }; test.js // aanmaken lightbridge obj = reflector.getobj(); console.log(obj); // toon alle lichten obj.getconfig().then(function(config) { console.log(config); }).done(); in last snippet it's using function of when call getconfig() want have output in variable config. problem when want log variable test recieve undefined. if console.log(config) instead of return config; works perfectly. seems weird. the out result when want use varia.getconfig() => output of config. test exist on function not outside. can try may dirty. var test; exports.getconfig = function() { api.getconfig(function(err, config) { if (err) throw err; test = config; });

php - How to listen to change in internet connection in my Android app? -

i created android app uses web service send , retrieve json data. when make request while device online works fine when device goes offline app stuck , prints null pointer exception error. is there way listen internet connection? before request web service call method private boolean isonline() { connectivitymanager cm = (connectivitymanager) getsystemservice(context.connectivity_service); networkinfo ninfo = cm.getactivenetworkinfo(); if (ninfo != null && ninfo.isconnectedorconnecting()) return true; else return false; } if(isonline()){ // request service // make sure u have surrounded calling web-service try , catch try{ // here make request when connection go offline app catch error , ignore process }catch (exception e) { } add permission <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="android.permission.access_wifi_state&

javascript - Angular 2: Two backend service calls on success of first service -

in angular 2 app have backend service below. getuserinterests() { return this.http.get('http://localhost:8080/test/selections').map((res: response) => res.json()); } after calling service want call service on success of previous one. 2nd service let params: urlsearchparams = new urlsearchparams(); params.set('access_token', localstorage.getitem('access_token')); return this.http.get('http://localhost:8080/user/selections', { search: params }).map((res: response) => res.json()); these 2 services separately return 2 json arrays. need login these 2 arrays. edited service.ts getuserinterests() { return this.http.get('http://localhost:8080/test/selections').map((res: response) => res.json()); } getsavedselections() { let params: urlsearchparams = new urlsearchparams(); params.set('access_token', localstorage.getitem('access_token')); return this.http.get('http://localhost:80

windows - Libtorrent 1.1 unresolved external symbol if_nametoindex -

i trying make works libtorrent on vs2015 boost 1.60. built both , trying build example "simple_client" libtorrent unfortunately shows me: unresolved external symbol if_nametoindex (broadcast_socket.obj) any ideas? the if_nametoindex function defined in iphlpapi.dll. see documentation on msdn .

java - I'm confused about the basics of pointers/references -

given this: int = 10; int b = a; a++; is b = 10 or 11? if 10, why happen (i'm using android example): textview x = new textview(); textview y = x; x.settext("abcde"); which leads y's text being set "abcde", doesn't it? edit: what if use 'integer' instead of 'int'? b = 11? an int primitive, a , b don't refer object, hold value. therefore assignment int b = a; copies original value of a b , a++ modifies a . with reference types, behavior different, shown in textview snippet. x , y refer same textview instance (object), x.settext("abcde") modifies single instance referred both.

python - PyCharm recognize a module but do not import it -

i try import pydrive module in pycharm project : from pydrive.auth import googleauth . tried different things : installing directly project interpreter download pip command , import path poject interpreter the same thing in linux nothing works. each time pycharm recognize module , sugest auto-completion, when run project keeps saying importerror: no module named pydrive.auth any suggestion ? edit : when put directly pydrive folder in repository, , time : importerror: no module named httplib2 first import of pydrive. path correct , httplib2 again in pycharm project

html - How to integrate small image into text -

Image
i highlight 1 word of text within website a) special font , b) small image "around" word. here example: what best way realize this? work different browsers / window sizes? wrap word span. use pseudo element background image. body { background: white; } h1 { margin-top: 50px; } span { position: relative; } .background { color: red; } .background:before { content:''; position: absolute; right: 0; top: -25px; width: 100%; height: 35px; background: url(http://redhatsociety.com/sites/all/themes/red_hat_society/images/funstuff/hearts.png) no-repeat right top; } <h1> <span class="background"><span class="content">special</span></span> </h1>

python - Predicton API + GAE: Invalid Credentials -

i'm trying make gae (python) application talk prediction api, keep getting httperror: <httperror 401 when requesting ... returned "invalid credentials"> the gae code have is: from handler_request import request_handler # extended request handler apiclient.discovery import build oauth2client.appengine import appassertioncredentials import httplib2 api_key = "<my key server apps>" http = appassertioncredentials('https://www.googleapis.com/auth/prediction').authorize(httplib2.http()) service = build('prediction', 'v1.6', http=http, developerkey=api_key) class listmodels(request_handler): def get(self): papi = service.trainedmodels() result = papi.list( project='my_project_number', maxresults=10 ).execute() self.response.headers['content-type'] = 'text/plain' self.response.out.write('result: ' + repr(result)) all

Visual Studio Publish Not Copying All DLLs to Publish Folder -

Image
i have web project startup project , publish web project. a refers project -> b (a has project reference b) b contains reference " ref.dll " when build b, dlls of b including " ref.dll " gets copied bin folder of a however, when publish a, cannot see " ref.dll " in published folder. i learnt somewhere visual studio intelligent enough not copy dll if of it's methods not being used anywhere. in case, have verified methods in " ref.dll " being used. why so? need explicitly add reference " ref.dll " in webproject a, appear in publish folder? try setting copy local = true dll in project b.

android - onSaveInstanceState not working -

i trying save type of map user selected through menu type of map remains if device rotated or activity suspended few moments. did doesn't seem work. please can tell me doing wrong? private int maptypeselected; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); if (savedinstancestate == null){ maptypeselected = googlemap.map_type_normal; } else { maptypeselected = savedinstancestate.getint("the_map_type",googlemap.map_type_normal); } } my main menu has more choices added here relevant ones map type: @override public boolean onoptionsitemselected(menuitem item) { switch (item.getitemid()) { case r.id.change_map_type: toast.maketext(getapplicationcontext(), "change map type", toast.length_long).show(); return true; case r.id.map_type_norma

c# - Attaching auto generated pdf to email in asp.net app -

i have specific requirement. in web app, have generate pdf invoice database values, , email body. can send using smtp works perfect. but, problem can't rely on system perfect, , invoice. so, need open default mail client instead of using smtp. right now, have following code //code create script email string emailjs = ""; emailjs += "window.open('mailto:testmail@gmail.com?body=test mail" + "&attachment=" + emailattachment + "');"; //register script post clientscript.registerstartupscript(this.gettype(), "mailto", emailjs, true); this opens email perfectly, no attachment working. path supposed /web/temp/123.pdf . if use same path normal url below, opens file in new window properly. clientscript.registerstartupscript(this.gettype(), "newwindow", "window.open('/web/temp/123.pdf');", true); so, file exists, exists on server. outlook on other hand open on client machine. so, can'

How to put the time and date on a logout PHP script -

i'm wondering if there's way of putting date , time on php script when user logs out, displays along lines of you logged out on 19/04/2016 @ 11:00am . php script have <?php // include function files application require_once('bookmark_fns.php'); session_start(); $old_user = $_session['valid_user']; // store test if *were* logged in unset($_session['valid_user']); $result_dest = session_destroy(); // start output html do_html_header('logging out'); if (!empty($old_user)) { if ($result_dest) { // if logged in , logged out echo 'logged out.<br />'; do_html_url('login.php', 'login'); } else { // logged in , not logged out echo 'could not log out.<br />'; } } else { // if weren't logged in came page somehow echo 'you not logged in, , have not been logged out.<br />'; do_html_url('login.php', 'login'); } do_html_footer(); ?>

unity3d - Is it common practice to have 2 splash screens in iOS games with unity personal edition? -

this question ios developers using unity personal edition. i understand there many question regarding "how rid of unity splash screen". please bare me, not 1 of those. there 2 "splash screens" in ios unity project. editable "launch image" , unity personal edition logo. is common practice when using personal edition change "launch image"? when game loads splash displayed briefly followed unity personal edition splash. so when game loads splash displayed briefly followed unity personal edition splash. no . unity splash display before else loaded. although can display own splashscreen image only after unity splash has finished displaying. applies non pro unity version.

swift - Cocoapods: Determine pod version -

how can tell a) version of pod you're using , b) how change it? i'm getting compile errors swiftyjson , wondering if it's because i'm using newer version i'm expecting. podfile: source 'https://github.com/cocoapods/specs.git' platform :ios, '8.0' use_frameworks! target ‘xxx’ pod 'swiftyjson', :git => 'https://github.com/swiftyjson/swiftyjson.git' ....... end check podfile.lock file. documentation says : this file generated after first run of pod install, , tracks version of each pod installed. to change version example 2.2 of installed pod use : pod 'swiftyjson', '2.2.0' and run pod install hope you

linux - Using commands in Bash Script Variables -

i have bash script checks current status of dropbox #!/bin/bash while true echo dropbox status: ~/bin/dropbox.py status sleep 1 clear done this produces output can this. dropbox status: date however this. on 1 line dropbox status: update i have tried scripts such as #!/bin/bash while true status=~/bin/dropbox.py status echo dropbox status: $status sleep 1 clear done however creates errors such dropbox status.sh: status: not found is there way after? also if blatantly obvious apologize since new bash script thanks help. use printf , command substitution : printf "dropbox status: %s\n" "$(~/bin/dropbox.py status)" or intermediate variable: status=$(~/bin/dropbox.py status) printf "dropbox status: %s\n" "$status" also remember quote variables or undergo word splitting why doesn't status=~/bin/dropbox.py status work? whats happens command status called environment

c - Extra parentheses near arrow operator -

a program i'm trying decode includes following line: #define nn(sp) ((sp)->nn) from context (not shown), i'm pretty sure 'sp' pointer struct contains 'nn' 1 of variables. in expression "((sp)->nn)", inner set of parentheses serve conceivable purpose? if not, might outer set of parentheses serve no purpose? #define nn(sp) ((sp)->nn) the inner parentheses required. if pass pointer p + 10 or *p nn macro, troubles without inner parentheses -> has higher precedence + , unary * . the outer parentheses not required here expression involves postfix operation , no operator has greater precedence postfix operators.

c# - How can combine query in Entity Framework? -

i have implemented rest web service in c#. connect on database, have used entityframework. i have code: private iqueryable<clinicaldocumentdto> getclinicaldoc(string cf) { if (cf != null) { return p in db_data.clinical_doc p.codicefiscaleassisito == cf select new clinicaldocumentdto() //select new clinical_doc { code = p.code, codesystem = p.codesystem, datestart = ad.verifyeffectivetime, dateend = ad.verifyeffectivetimemax } } } now want change code, have field "datestard" , "dateend", on database, have 3 column (effetivetime, effetivetimemin, effectivetimemax). i want this: if (effectivetime == null) datestart= effectivetimemin, dateend = effectivetimemax how can in entity framework? you can use ?: operator in select mentioned below: return p in db_data.clinical_doc p.codicefiscale

ember.js - Mock many-to-many relationship using Ember CLI Mirage -

apologies in advance: new both ember (2.2.0) , mirage, , tasked creating acceptance tests existing ember application. challenge in using mirage (0.1.13) , fixtures (not factories) mock existing one-to-many or many-to-many relationships in our data. couldn't find complete examples model non-trivial relationships. consider following simple many-to-many relationship: user can have multiple roles. the respective ember models are: // models/user.js import ember "ember"; import ds 'ember-data'; export default ds.model.extend({ email: ds.attr('string'), //unidirectional m-m roles: ds.hasmany('user-role', {inverse: null}) }); // models/user-role.js import ds 'ember-data'; export default ds.model.extend({ description: ds.attr('string') }); note user-role hyphenated. my attempt @ creating fixtures: // mirage/fixtures/users.js export default [ {id: 1, email: 'user@email.com', roles: {userrole_ids: [1]}},

Amazon FPS SDK ports for node.js -

there appears no node.js sdk libraries amazon fps (flexible payment services). does know of anything? it's brutally tedious create scratch. i'm hoping answer here: https://github.com/awssum/awssum-amazon-fps/ but compared get, amazon's php sdk , doesn't help, may missing something. i'll report back. i made small lib node signing aws requests. hope find useful https://github.com/theremix/aws_signature_utils_js

javascript - Angular-ui tagging convert array to string -

i using ui-select directive in template, bound on object has property set string. since ui-select save values array in property, possible transform value automatically in model when save value string? tried ng-value="model.property.join(',')" has no effects. the complete code of element: <ui-select multiple tagging tagging-label="false" theme="bootstrap" ng-model="user" ng-value="user.keywords.join(',')"> <ui-select-match placeholder="keywords">{{$item}}</ui-select-match> <ui-select-choices repeat="keyword in user.keywords | filter:$select.search">{{keyword}}</ui-select-choices> <ui-select> and when save object sends keywords as: ["keyword", "other"]