Posts

Showing posts from April, 2013

scala - Why doesn't this Python code for powerset work? -

i can't identify blatantly wrong except trying scala-type operations python. def powerset(arr): if len(arr) == 0: return [] elif len(arr) > 1: return powerset(arr[1:])+[arr[0]] i consistently error: return powerset(arr[1:])+[arr[0]] typeerror: unsupported operand type(s) +: 'nonetype' , 'list' if len(arr) == 1 nothing returned ... just change def powerset(arr): if len(arr)>0: return powerset(arr[1:])+[arr[0]] else: return [] here powerset function https://docs.python.org/2/library/itertools.html def powerset(iterable): "powerset([1,2,3]) --> () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)" s = list(iterable) return chain.from_iterable(combinations(s, r) r in range(len(s)+1)) here powerset implementation uses less magic def powerset(seq): """ returns subsets of set. generator. """ if len

database - SQL Compact is not showing data in tables -

i have program entering in values sql compact data table. problem data not showing in tables in visual studio, acting there since warning if try add values same primary key. has else had problem? there setting possibly not have set in visual studio? appreciated. in advance!

visual studio - NuGet does not execute scripts when restoring packages -

nuget not execute scripts when restoring packages in project. here's scenario: have project has custom nuget package installed. project has nuget package restore enabled solution. working flawlessly, tested multiple times getting project tfs onto empty folder. i've added init.ps1 , install.ps1 nuget package, , package still fetched , installed properly, scripts not execute unless package installed manually. to exact, if project tfs first time, neither init.ps1, nor install.ps1 executes. however, if close solution , reopen it, init.ps1 executes (as expected), but, of course, install.ps1 still doesn't since package has been restored/installed. both scripts execute when package installed/uninstalled manually (i.e. doesn't run if package "restored"). my internet searched haven't turned references behavior. missing obvious, or normal when packages restored? the package restore feature used not packages checked source control. suc

Elasticsearch: multi indices one type OR one index multi types -

as the definitive guide -> indexing employee documents said relational db ⇒ databases ⇒ tables ⇒ rows ⇒ columns elasticsearch ⇒ indices ⇒ types ⇒ documents ⇒ fields and the definitive guide -> index aliases , 0 downtime said be prepared: use aliases instead of indices in application. able reindex whenever need to. aliases cheap , should used liberally. the question is, if indices databases , if want rebuild 1 type ( table ) have reindex whole database , reasonable ? (this one index multi types ). or have create many indices project , every index has 1 type, sounds project has dozens databases! i think understand confusion. have 1 index named my_index , 3 types type1 , type2 , type3 . create alias alias1 index. now want change mapping of type1 , need reindex every document of type1 want zero downtime create new index index2 , reindex documents of type1 , if want alias1 refer new index, problem arise , said have reindex o

terminal - Shell line 7: [14: command not found -

this question has answer here: shell script command not found when comparing string 1 answer i don't know problem fix here code: #!/bin/sh while true hour=$(date '+%h') target=16 echo $hour if [$hour -gt $target]; mail -s "ip" "example@hotmail.com" <<eof global_ip=$(curl -s checkip.dyndns.org | sed -e 's/.*current ip address: //' -e 's/<.*$//') eof echo "sent" fi echo "waiting..." sleep 3600 echo "done waiting" done please help! you have add blanks after [ , before ] : if [ $hour -gt $target ];

Explanation of a number in allocation data in Android studio -

i got data allocation tracker in android studio. fine, except, don't understand particular piece of data. here screenshot . what these numbers come right after method name , colon mean? that line number with-in method allocation happened on.

ios6 - Distributing pilot iOS apps to educational institutions -

i'm looking optimal way distribute prototype/pilot apps k-12 institutions , can't quite seem figure out. it doesn't seem using either regular app store or volume purchase program stores ideal, app work our pilot classrooms teachers have been given login credentials. else not able use app in way, , we'll lowest rating, if app makes past review. the 2 options seem viable-ish are: enterprise distribution: it's technically not meant scenario, i've heard people use successfully. build app , distribute through enterprise distribution flow. problem technically, since we're not affiliated institutions we're piloting in, we'd have have them pay $300/year , add contractor developers them, don't envision happening. approach heard of of developers signing enterprise account , using institutional devices if part of company. custom b2b app: seems 1 use route well, though custom b2b apps still go through apple review process, i'm not clear if pr

java - Saving Android FaceDetector.Face[] on rotation -

i trying save facedetector.face array on screen rotation, facial detection not have performed again. app seems take longer normal rotation. however, can't store faces array in onsavedinstancestate since isn't serializable. tried extending facedetector.face implementing serializable, doesn't have default constructor. should save object array 1 on rotation, didn't implement? i suggest creating static fragment without ui on activity. once that, can use store data. keep in mind facedetector.face, object holds locations on bitmap , not bitmap itself.

JavaScript sorting using function -

while doing online course came across following code. unable understand logic of method. grateful if can me understand code: var v=[30,2,1,9,15,10,55,20,45,30,25,40,50,35]; var msg = document.getelementbyid("message") msg.innerhtml +="<p><strong>original order:</strong>[" + v + "]<p>"; v.sort(); msg.innerhtml +="<p><strong>after sorting order(string):</strong>[" + v + "]<p>"; v.sort(function(a,b){return a-b;}); msg.innerhtml +="<p><strong>after sorting order(ascending):</strong>[" + v + "]<p>"; v.sort(function(a,b){return b-a;}); msg.innerhtml +="<p><strong>after sorting order(descending):</strong>[" + v + "]<p>"; i need understand function(a,b){return a-b} - how function helping javascript sorting? please note new programming. although others have provided many great links wanted s

c# - Attach a Context Menu to a GUI.Window -

Image
i have custom window has multiple gui.window 's inside of it. can create context menu main window , works. when try create context menus gui.window doesn't work. when right click on window starts drag around main window. here have list stores window information: // stores list of windows list<storyboardwindow> windows = new list<storyboardwindow>(); then here loop through windows , call drawnodewindow : // draws windows screen void ongui() { (int = 0; < windows.count; i++) { windows[i].window = gui.window(i, windows[i].window, drawnodewindow, windows[i].windowtitle); } } i have method creates genericmenu window, doesn't work when right click on window. // supposed create context menu window void drawnodewindow(int id) { event currentevent = event.current; if (currentevent.type == eventtype.contextclick){ genericmenu menu = new genericmenu(); menu.additem(new guicontent("remove"), false, remove

How to disable a button only when EditText is numerically empty in android studio? -

i have button works according function when user enters number in edittext. however,when edittext numerically empty,when click on same button, make app stop working. help? please consider "numerically" part because not find answers query? code public void send(view v){ string text = edittext.gettext().tostring(); if (text.matches("")) { mybutton.setenabled(false); return; } } xml <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <edittext android:layout_width="0dp" android:layout_weight="1" android:inputtype="number" android:layout_height="wrap_content" android:hint="enter:" android:id="@+id/edittext" /> <button android:layout_width="wrap_content" android:lay

ios - UILabel positioning different when text is present vs when text isn't present -

Image
here picture of how want view positioned (i have constraints set in interface builder) below images want , how set in interface builder (pic # 1) the second 1 interface @ runtime. note: once labels textual data during runtime, view expands give labels space (i.e. first picture) my goal eliminate "animated movement". want view/progress bar/everything remain static once has been situated @ runtime , not bouncing , down if data in labels or if isn't. i not want use stack view because ios 7 not supported feature or would. note: it's different colors, same view problem shows stated in question. lazy , don't want explain myself how lazy , why different... you should add height constraint constant, e.g. 20, , relation "greater or equal" each of labels. way autolayout know exact height needed before label text set, , allow labels stretch vertically if text long 1 line

javascript - Google maps api async loading - have tried all the solutions - going insane -

i'm trying desperately finish project http://kenziejoy.github.io/frontend-nanodegree-map/ (that gh-pages branch, master little behind) and while tinkering other things map disappeared...forever. can't find wrong. feel i've tried everything: async, defer, async defer, callback function in html calls function in js file (someone suggested it), initmap inside viewmodel, outside viewmodel, wrapped in self running function. most of errors either, callback isn't function, google isn't defined or in js file isn't defined. i've poured through make sure isn't silly misplaced comma - i'm getting frustrated i've made stupid mistake somewhere. appreciated. @ least can map there , make progress on else. looking @ code in link in app function in main.js not declared googlemap var globally. you must declare var googlemap ; in top of main.js

wordpress - How can I add space between Posted on January 13, 2016 and January 13, 2016 by admin? -

i wan make space between "posted on january 13, 2016january 13, 2016 admin" .how can add space between posted on january 13, 2016 , january 13, 2016 admin? use css add space: .posted-on .published { margin-right: 10px; } p.s. please @ least try before posting question on so. thanks

python - When is --thunder-lock beneficial? -

this long, detailed, , entertaining article describes history , design of --thunder-lock : http://uwsgi-docs.readthedocs.org/en/latest/articles/serializingaccept.html but doesn't me decide when need it! when , isn't --thunder-lock beneficial? well... answer not easy. in general, should use when you're using multiple workers multiple threads. but... there dozens of different operating systems , thunder locking highly dependent on capabilities. there @ least 6 different mechanisms of thunder locking, choosed uwsgi based on operating system capabilities, of them better other. if you're using example linux robust pthread support, you're 99.999999% safe use thunder-lock.

c# - ManagedThreadId return same value for 2 threads -

please consider code: textbox1.text = "enter thread current thread id : " + thread.currentthread.managedthreadid.tostring(); int result = 0; task t = task.factory.startnew(delegate { (int = 0; < 5; i++) { result = result + i; system.threading.thread.sleep(1000); this.invoke((action)(() => textbox1.text += environment.newline + result.tostring() + " current thread id : " + thread.currentthread.managedthreadid.tostring())); } },cancellationtoken.none, taskcreationoptions.none); i got result: enter thread current thread id : 10 0 current thread id : 10 1 current thread id : 10 3 current thread id : 10 6 current thread id : 10 10 current thread id : 10 i ran code on windows form application. why thread.currentthread.managedthreadid return same value ui thread , task thread? code inside of task run in separate thread? thanks when did this

android - Image Fading in Java -

i facing problem while trying cross fading in android studio. first, have following code cross fading between 2 images. code works fine. public class mainactivity extends appcompatactivity { public void fade(view view) { imageview front = (imageview) findviewbyid(r.id.front); imageview image1 = (imageview) findviewbyid(r.id.image1); front.animate().alpha(0f).setduration(1000); image1.animate().alpha(1f).setduration(1000); image1.bringtofront(); } public void fade1(view view) { imageview front = (imageview) findviewbyid(r.id.front); imageview image1 = (imageview) findviewbyid(r.id.image1); image1.animate().alpha(0f).setduration(2000); front.animate().alpha(1f).setduration(2000); front.bringtofront(); } but, when try same fading using 3 images, code doesn't work. doesn't fade images properly. here code: public void

java - why can't it allow "<%@ include file" inside a HttpServletResponse? -

this question has answer here: what effects of disabling scripting in jsp? 2 answers ok, got jsp file & works ok <html> <head><title>account</title></head> <body> <%@ include file="header.jsp" %> </body> </html> now, got servlet public void doget(httpservletrequest req, httpservletresponse resp) throws ioexception { resp.getwriter().println("<html>"+ "<head><title>account</title></head>"+ "<body>"+ "<%@ include file=\"header.jsp\" %>"+ "</body"+ "</html>" } the servlet print out <%@ include file="header.jsp" %> text on page & not un

Use Facebook Access token via Android on Laravel Backend -

i have android app gets access token facebook sdk , further want send token php-laravel backend , retrieve user details. i made httppost call param accesstoken accesstoken.gettoken() laravel , there retrieve it, token same when try login web interface , token. then made call to $user = socialize::driver('facebook')->getuser($request->token); // manual function added abstractprovider class public function getuser($token){ $state = null; if ($this->usesstate()) { $this->request->getsession()->set('state', $state = str::random(40)); } $user = $this->mapusertoobject($this->getuserbytoken($token)); return $user->settoken($token); } but error in log [2016-01-16 07:30:24] local.error: exception 'guzzlehttp\exception\clientexception' message 'client error: get https://graph.facebook.com/v2.5/me?access_token=&appsecret_proof=/* proof here*/&fields=first_name,last_name,email,gender,veri

Converting javascript stringified string to java string -

i have app uses parse backend. parse calls web scraper returns string parse , have use stringify on string received because it's not allowed sent on network otherwise. once stringify string how can parse in java have original returned string. instance, how go stringified string in javascript "\"this string\"\r\n\t\t" to string in java "this string" to reiterate, start string (such "this string") have stringify send on network (result "\"this string\"\r\n\t\t"). once return stringified string android app, how can original string ("this string")? try stringescapeutils apache commons string input = "\"this string\"\r\n\t\t"; string output = stringescapeutils.unescapejava(input); system.out.println(output); "this string"

Map and HashMap in Java -

this question has answer here: what difference between hashmap , map objects in java? 12 answers i new java , came across following usage hashmaps : public static hashmap< string, integer > table1; .... table1 = new hashmap< string, integer > (); ..... public map<string, integer> table2 = new hashmap<string, integer>(); my question above statement equivalent ? see map<string, integer> used table2. hashmap< string, integer > table1 , map<string, integer> table2 same programing construct ? can used interchangeably? map interface, implemented in several implementations hashmap. and hashmap complete implementation class. an useful answer here - difference between hashmap , map in java..?

php - simple sql order by position -

okay have been putting off because has been partially working, need it. i want output: id position 1 1 2 2 15 3 16 4 i thought this^ it. getting whole pages table. select * pages order position asc id link_id menu_name position content visible 1 1 new article 1 first picture , article 1 2 1 edit articles 2 delete articles/edit 333 the * in query means you'll select every colomn, use columnames want retrieve. example: select id, position pages order position that's ;)

Verilog : How to assign values to 2 random indexes in a big array? -

i have array made like genvar p; generate (p = 0 ; p < 128 ; p = p + 1) begin assign fft_bin_th1[p] = (array_x[p] > threshold_1)? 1'b1 : 1'b0; end endgenerate the array fft_bin_th1 contain 4 ones @ random locations after statement. after doing operations 2 values of indexes , lets 23 , 42 (they random). these 1s in fft_bin_th1 array. want assign these 2 indexes (23 , 42) value 0 , rest of array fft_bin_th1 should same. how can this? from can understand looking code always@(posedge clk) begin index_1 <= logic_to_get_index1; index_2 <= logic_to_get_index2; fft_bin_th1[index_1] <= 0; fft_bin_th1[index_2] <= 0; end `

where to put a php file in cpanel which would serve my form in html -

i'm using hostgator cpanel , domain. created website using html , in use contact form on submit goes php file , sends me email. it works on amazon webserver don't know put php files in hostgator cpanel. should install php config somewhere , put there? thanks in advance. here php code <?php require 'phpmailer/phpmailerautoload.php'; $name = $_post['inputusername']; $email_address = $_post['inputemail']; $message = $_post['inputcontent']; $mail = new phpmailer; //$mail->smtpdebug = 2; $mail->issmtp(); // set mailer use smtp $mail->host = 'smtp.gmail.com'; // specify main , backup smtp servers $mail->smtpauth = true; // enable smtp authentication $mail->username = 'krishnakumar4315@gmail.com'; // smtp username $mail->password = 'password'; // smtp password $mail->smtpsecure = &#

ios - Assigning different emitters to different nodes that are randomized -

Image
i have basic emitter nodes working in first app. have created constants file references nodes throughout game, , converts them strings. great mini data base. basic whack mole game, except have 12 different characters. gamescene code this called in didmovetoview method: func star(pos: cgpoint) { let emitternode = skemitternode(filenamed: "star.sks") emitternode!.particleposition = pos self.addchild(emitternode!) self.runaction(skaction.waitforduration(2), completion: {emitternode!.removefromparent() }) } this called in touchesdidbegin method: if node.name == "charenemy" { let whackslot = node.parent!.parent as! whackslot if !whackslot.visible { continue } if whackslot.ishit { continue } star(touchlocation) whackslot.hit() ++score } i created own custom class whackslot handle charenemy node , charfriend : let name = barray[int((randomfloat(min: 0.0, max: float(b

php - $_POST on a While loop? -

my question is: can post using form , inside while loop? have supposed give me check box , titles of songs next it, want able select few check boxes , post them "process.php" code made not posting process.php. if click submit button without checking boxes defaults last result # in database, if check or few boxes says "undifined off-set # 9" last result in database. if make form inside while loop ton of submit buttons per result. not sure im doing wrong! please me!!! this need happen ⎕ song name ⎕ song name 2 submit if click submit on process.php should able use "song_name" please select songs: <br> <form method="post" action="process.php"> <?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "song_selection"; // create connection $conn = new mysql

python - Extract timestamp from large string -

i have large string this: send ok http/1.1 200 ok access-control-allow- l-allow-methods: get,post,delete access-control-allow-headers: x-requested-with, phant-private-key content-type: text/plain x-rate-limit-limit: 300 x-rate-limit-remaining: 297 x-rate-limit-reset: 1452931335.777 date: sat, 16 jan 2016 07:50:17 gmt set-cookie: serverid=; expires=thu, 01-jan-197 0 00:00:01 gmt; path=/ cache-control: private transfer-encoding: chunked it contains strings sat, 16 jan 2016 07:50:17 gmt string may of time. want string out of whole. know basic question how can in python. not string contain substrings date: . use import re datepattern = re.compile("\w{3}, \d{2} \w{3} \d{4} \d{2}:\d{2}:\d{2} \w{3}") matcher = datepattern.search(string_to_match_against) print(matcher.group(0)) with example string_to_match_against = """ send ok http/1.1 200 ok access-control-allow- l-allow-methods: get,post,delete access-control-allow-headers: x-requested-w

ios - Unit test for AFNetworking Post request -

i trying write unit test project use afnetworking in.i use following operation request: - (void)testregisterrequest{ afhttprequestoperationmanager *manager = [afhttprequestoperationmanager manager]; [manager post:url parameters:parameters success:^(afhttprequestoperation *operation, id responseobject) { xctassert(result,"register failed!"); } failure:^(afhttprequestoperation *operation, nserror *error) { //failure } as asynchronous never test xctassert line. searched lot couldn't manage find tutorial or example these test cases.please me tutorial link or hint. in advance there couple of things here. you can use expectations async tests: asynchronous testing xcode 6 you can use ohhttpstubs avoid unneeded network traffic , server load: usage examples

angularjs - router.post returns error "undefined is not a function" .Using mongo and express.js -

Image
i'm trying buld app using files link .i found posting code breaks.has express js changed or syntax mistake ? the router.post breaks once reaches maid.registermaid(new maid({... .i'm able make work using .save() explain why callback beaking ? putting code below.. sorry, i'm beginner in m.e.a.n api.js var express = require('express'), router = express.router(), passport = require('passport'); user = require('../models/user.js'); maid = require('../models/maid.js'); router.post('/addmaid', function(req, res) { console.log(req.body, req.body.firstname,req.body.lastname); maid.registermaid(new maid({ firstname: req.body.firstname }), ({lastname: req.body.lastname}), function(err, account) { if (err) { return res.status(500).json({err : err}) } return res.status(200).json({status: 'registration successful!'}); }); }); services.js angular.module('myapp').factory('authservice',

javascript - SyntaxError: Unexpected token -

i'm using parse.com build companion website 2 apps. i'm using express framework web framework. in code try run 3 parse queries in parallel , put them display information. since i'm quite new @ javascript, promises , express have problem syntax. can spot i'm sure stupid mistake. app.get('/', function (req, res) { var querydining = new parse.query("location").equalto("locationtype", 0).adddescending("updatedat").limit(10).find(); var querymosque = new parse.query("location").equalto("locationtype", 1).adddescending("updatedat").limit(10).find(); var queryshops = new parse.query("location").equalto("locationtype", 2).adddescending("updatedat").limit(10).find(); // wait them complete using parse.promise.when() // result order match order passed when() parse.promise.when(querydining, querymosque, queryshops).then(function (restaurants, mosques, sh

php - How to load select option from database in zf2 -

i have been following zf2 guide blog have created controller, factory, form, mapper, model, service, view etc in form have select element $this->add(array( 'type' => 'select', 'name' => 'roleid', 'attributes' => array( 'id' => 'roleid', 'options' => array( '1' => 'admin', '2' => 'manager', ), ), 'options' => array( 'label' => 'role', ), )); now in form want load option role database. tried loading option creating simple function, can accessed in element below, not able fetch result. have created controller, factory, form, mapper, model, service , view, can crud operation on role. $this->add(array( 'type' => 'select', 'name' => 'roleid', 'attributes' => array( 'id' => 'roleid',

How to parse Local JSON (from Asset folder) for building Bible App in android -

i planning build app bible., decided use local json parse data. please share ideas data local json. you can use gson ease process of converting json object java object , can access individual attributes of java class using getters , setters. here small example: gson gson = new gson(); try { bufferedreader br = new bufferedreader( new filereader("c:\\file.json")); //convert json string object dataobject obj = gson.fromjson(br, dataobject.class); system.out.println(obj); } catch (ioexception e) { e.printstacktrace(); }

UDP broadcast and automatic server discovery in python, TCP socket unavailable -

i'm developing reverse shell application in python, , right i'm trying implement autodiscovery feature. should work follows: the server broadcasts ip/port listens connections on, , waits client. if no client tries connect in few seconds, broadcasts again (and repeat till connection). the client tries receive broadcast of server, , connects advertised ip/port. the broadcast works fine, client receives ip/port , connects, after using connected pair of ports (server side): socket.error: [errno 35] resource temporarily unavailable server side test code: sckt = socket.socket(socket.af_inet, socket.sock_stream) sckt.setsockopt(socket.sol_socket, socket.so_reuseaddr, 1) sckt.settimeout(2) sckt.bind(('', 9999)) sckt.listen(5) broadcastsocket = socket.socket(socket.af_inet, socket.sock_dgram) broadcastsocket.setsockopt(socket.sol_socket, socket.so_broadcast, 1) broadcastsocket.setsockopt(socket.sol_socket, socket.so_reuseaddr, 1) while true: broadcastso

Integrating C++ OpenGL project with another C++ project -

i working project reads data file, performs calculations, , show results on standard output. later wanted give 3d graphical view results, made new opengl project shows data 3d object. now problem is, can not figure out way integrate these 2 independent projects, because main() in opengl project goes in non terminating glutmainloop() loop, , unable figure out put loop in main() of first project ! /**** proj1 ****/ int main() { while(esc key not pressed) { // read data file // processing // show results on standard output } } /**** proj2 ****/ int main() { glutinit(&argc, argv); init(); glutdisplayfunc(display); glutkeyboardfunc(keyboard); glutmousefunc(mouse); glutidlefunc(idle); glutmainloop(); } least mixing of codes between proj1 & proj2 requested. possible like: /**** proj1 ****/ #include <filesfromproj2> int main() { while(esc key not pressed) { // read data file

c++ - How to resolve this: invalid conversion from 'const char*' to 'const uint8_t* -

i installed sha library: https://github.com/cathedrow/cryptosuite . want implement hmac256 using arduino ide 1.6.7 installed on win. 10 , controller atmega328. i copied example given in webpage. still new , want test , try. wrote code in arduino ide. #include "sha256.h" void setup() { // put setup code here, run once: uint8_t *hash; //static const char hash[450]={}; //const char *hash; hash={}; sha256.inithmac("hash key",8); // key, , length of key in bytes sha256.print("this message hash"); hash = sha256.resulthmac(); //serial.print(hash,hex); } void loop() { // put main code here, run repeatedly: } i got error: invalid conversion 'const char*' 'const uint8_t* {aka const unsigned char*}' [-fpermissive] i not know why happens. example primitive taken library site. can help? edit: tried change line from: sha256.inithmac((const uint8_t*)"hash key",8); to: sha256.init

html - IE wrapper div takes original full height of svg image when using max-width -

when use max-width property on svg image, svg's height reduced maintain aspect ratio. if it's wrapped in div, wrapper takes image's original full height. fiddle the problem present in ie, works fine in other browsers. solutions fix this? html <div class="wrapper"> <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 174 174"><g fill="#715f6a"><path d="m113.72 95.354c-.477.516-1.11.808-1.85.95-.222.047-.443.02-.66.02-.97 0-1.87-.258-2.508-.943-.802.14-1.455.62-1.725 1.62h8.472c-.275-1-.928-1.507-1.73-1.646z"/><path d="m87.28 1.105c-47.535 0-86.07 38.536-86.07 86.072s38.535 86.07 86.07 86.07c47.537 0 86.072-38.534 86.072-86.07 0-47.536-38.535-86.072-86.07-86.072zm9.438 45.412a8.808 8.808 0 0 1 8.81 8.81c0 4.867-3.944 8.813-8.81 8.813-4.867 0-8.81-3.947-8.81-8.813a8.81 8.81 0 0 1 8.81-8.81zm-29.123-.003c4.867 0 8.813 3.944 8.813 8.81a8.814 8.814 0 0 1-8.813 8.813c-4.866 0-8.81-3.94

java - How to parse Retrofit 2 response to display data? -

this question has answer here: fetching json object , array retrofit 3 answers i want display "title" api( http://jsonplaceholder.typicode.com/posts ) using retrofit 2 , gson(or gsonformat, i'm not sure), i have created following classes, modal.java package arpit.retrodemo; public class modal { private string title; public string gettitle(){ return title; } } apiservice interface, package arpit.retrodemo; import java.util.list; import retrofit.call; import retrofit.http.get; public interface apiservice { @get("/posts") call<list<modal>> getdetails(); } mainactivity.java package arpit.retrodemo; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.util.log; import java.util.list; import retrofit.call; import retrofit.callback; import retrofit.gsonconv

sensor - Acceleration and deceleration of car using Android device -

i tried , found speed of car through location.getspeed(); , location using gps in android , want find acceleration , deceleration of car.for have android device parameters gps, or need calculate speed , time have now.i came know acceleration in device, giving coordinates.i want how calculate car acceleration , deceleration.help work outs or suggestions. use android sensor type_linear_acceleration

docker - Dockerfile: Copied file not found -

i'm trying add shell script container, , run part of build. here's relevant section of dockerfile: #phantomjs install copy conf/phantomjs.sh ~/phantomjs.sh run chmod +x ~/phantomjs.sh && ~/phantomjs.sh and here's output during build: step 16 : copy conf/phantomjs.sh ~/phantomjs.sh ---> using cache ---> 8199d97eb936 step 17 : run chmod +x ~/phantomjs.sh && ~/phantomjs.sh ---> running in 3c7ecb307bd3 [91mchmod: [0m[91mcannot access '/root/phantomjs.sh'[0m[91m: no such file or directory[0m[91m the file i'm copying exists in conf folder underneath build directory... whatever doesn't seem copied across. tl;dr don't rely on shell expansions ~ in copy instructions. use copy conf/phantomjs.sh /path/to/user/home/phantomjs.sh instead! detailed explanation using ~ shortcut user's home directory feature offered shell (i.e. bash or zsh). copy instructions in dockerfile not run in shell; take file paths

c# - Get the value from a div using HtmlAgilityPack -

Image
i trying value div using htmlagilitypack . htmlcode : i need value in news_content_container div class ca see in picture selected use code : var response1 = await http.getbytearrayasync("http://www.nsfund.ir/news?"+link); string source1 = encoding.getencoding("utf-8").getstring(response1, 0, response1.length - 1); source1 = webutility.htmldecode(source1); htmldocument resultat1 = new htmldocument(); resultat1.loadhtml(source1); var val = resultat1.documentnode.descendants().where (x => (x.name == "div" && x.attributes["class"] != null && x.attributes["class"].value.contains("news_content_container"))).tolist().first().innertext;; but result empty . try this var response1 = await http.getbytearrayasync("http://www.nsfund.ir/news?"+link); string source1 = encoding.getencoding(

linux - Wait until process is killed to launch another process -

this question has answer here: wait “any process” finish 13 answers i have no experience writting sh/bash script linux, want check if process running. if process running wait, when process killed execute proccess, (pseudo-code): while main_process.run = true { do_nothing; } execute new_process how can in small script.sh? thanks! if shell did start process waiting for, then: wait <process id> execute_new_process

javascript - How to define AngularJS controller in HTML Template -

i have following structure of files: index.html tpl/page.html app.js description: app.js has definition of main module routing page.html index.html defines view template , includes app.js page.html has definition of pagecontroller inside <script> tag , div using controller. problem when pagecontroller resides in page.html doesn't work when included app.js works. error following: argument 'pagecontroller' not ananunction, got undefined. it looks late define controller in template. requirement. want hide page.html + controller (even code) users , make visible particular group spring security. why defined security constraint page , want executed when constraints met. update #1 controller definition: <script type="text/javascript"> mainapp.controller('pagecontroller', function($scope, $rootscope) { ... }); </script> <md-content ng-controller="pagecontroller" ... if both script tag ,

multithreading - Evaluating the performance gain from multi-threading in python -

i tried compare performance gain parallel computing using multithreading module , normal sequence computing couldn't find real difference. here's did: import time, threading, queue q=queue.queue() def calc(_range): exponent=(x**5 x in _range) q.put([x**0.5 x in exponent]) def calc1(_range): exponent=(x**5 x in _range) return [x**0.5 x in exponent] def multithreds(threadlist): d=[] x in threadlist: t=threading.thread(target=calc, args=([x])) t.start() t.join() s=q.get() d.append(s) return d threads=[range(100000), range(200000)] start=time.time() #out=multithreads(threads) out1=[calc1(x)for x in threads] end=time.time() print end-start timing using threading: 0.9390001297 timing running in sequence: 0.911999940872 the timing running in sequence lower using multithreading. have feeling there's wrong multithreading code. can point me in right direction please. thanks. the reference

angular - Import unable to locate angular2 in beta.1 -

the sample code found in angularjs 2.0 getting started visual studio works alpha.28 version. when change scripts from <script src="https://github.jspm.io/jmcriffey/bower-traceur-runtime@0.0.87/traceur-runtime.js"></script> <script src="https://jspm.io/system@0.16.js"></script> <script src="https://code.angularjs.org/2.0.0-alpha.28/angular2.dev.js"></script> to <script src="https://github.jspm.io/jmcriffey/bower-traceur-runtime@0.0.87/traceur-runtime.js"></script> <script src="http://cdnjs.cloudflare.com/ajax/libs/systemjs/0.18.4/system.src.js"></script> <script src="https://code.angularjs.org/2.0.0-beta.1/angular2.js"></script> i error says "[local server]/angular2/angular2" not found. what has changed since , how configure angular2 imported cdn? basically causing error app.ts file have component resides. for importing c

javascript - C# open hidden browser and navigate -

i code opening browser window whichever default , navigate website make click on image. tried many google search since extreme newbie c# couldn't achieve result. want make textbox timer display mouse position give in x,y coordinate make mouse click. here code tried. var ie = (shdocvw.webbrowser)activator.createinstance(type.gettypefromprogid("internetexplorer.application")); ie.visible = false; //for testing purpose make visible. ie.navigate("http://www.google.com"); location.x = cursor.position.x; location.y = cursor.position.y; console.writeline("x: " + cursor.position.x + " y: " + cursor.position.y); please me. in .net have webbrowser control https://msdn.microsoft.com/en-us/library/w290k23d(v=vs.110).aspx all need create instance of control, make invisible (or size 0) and navigate using api: https://msdn.microsoft.com/en-us/library/w6t65c4y(v=vs.110).aspx once navigated ab

javascript - Change is not made onclick event on the data loaded dynamically -

this code load data dynamically php file : $(document).ready(function(){ function loading_show(){ $('#loading').html("<img src='demo/img/ajax-loader.gif'/>").fadein('fast'); } function loading_hide(){ $('#loading').fadeout('fast'); } function loaddata(page){ loading_show(); $.ajax ({ type: "post", url: "pagination/load_data.php", data: "page="+page, success: function(msg) { $("#container2").ajaxcomplete(function(event, request, settings) { loading_hide(); $("#container2").html(msg);

oauth - Integrate Yammer API into iphone app? -

can me integrate yammer iphone app. how authenticate user? how feed? how post messages? there mobile sdk ios available http://developer.yammer.com/mobile/ . authenticate , perform other tasks.

database - How to deactivate an account in PHP? -

i trying make deactivate account ...when click link want account status updated in database turn 0. every time click link here nothings happens re direct me page code deactivating <?php include "../includes/dbcon.php"; if(isset($_get['user_id'])) { $result = mysql_query("select user_id users user_id = $user_id"); while($row = mysql_fetch_array($result)) { echo $result; $status = $row($_get['status']); if($status == 1) { $status = 0; $update = mysql_query("update users set status = $status"); header("location: admin_manage_account.php"); } else { echo "already deactivated"; } } } ?> i don't know problem exactly, why select id based on id? why don't " update users set status = $sta

c# - Entity Framework list of objects contains list of object lambda -

following scenario: public class user{ public virtual icollection<mediaitem> mediaitems { get; set; } } public enum emediaitemgenre { [display(name = "pop")] pop = 0, [display(name = "other")] other = 11 } public class mediaitem { public virtual icollection<mediaitemgenre> genres { get; set; } } public class mediaitemgenre { [key] public int32 id { get; set; } public emediaitemgenre genre { get; set; } public int32 mediaitemid { get; set; } public virtual mediaitem mediaitem { get; set; } } now following: have mediaitem , find mediaitems share same genre . i did way: list<mediaitem> litems = ltcontext.mediaitems.where(x => x.genres.any(y => pgenres.contains(y))).tolist(); but error only primitive types or enumeration types supported in context. the problem trying compare complex types in database list of complex types in memory, not possible. suggest doing conver

initialize bitbucket repository with existing project using netbeans -

i have existing netbeansproject (about 20 classes, java) want manage using private repository. choosed bitbucket (have acount , repository). initialised local git repository (using netbeans). how can connect project bitbucket repository using netbeans? when try "push" error message "cannot connect to the remote repository at  https://osmosisdjones@bitbucket.org/osmosisdjones/inba.git "

Writing listview contents to html file android -

i have listview being filled database. want take contents of listview , show in html table. how can take listview , write contents html file? i did similar here. private file saveresults() { /* * write results file. */ list<riderresult> results = datamodel.get().getresults(); try { if (!environment.media_mounted.equals(environment.getexternalstoragestate())) { toast.maketext(summaryfragment.this.getcontext(), "unable access external storage.", toast.length_short).show(); return null; } /* * create file folder in external storage. */ file csvdir = new file( environment.getexternalstoragedirectory(), "android/data/ca.mydomain.myapp/results"); if (!csvdir.exists()) csvdir.mkdirs(); /* * create file in folder, today's date , time name. */ da

android - App that monitors other Apps - is this even possible? -

not sure if want possible - , appreciate advice. i want app (on iphone, android , maybe windows) loaded , monitor device screen, until particular 32x32 (or whatever) set of pixels appears. think maybe facebook being loaded , picture being present contains particular pre defined pattern - app 'does something'.... ....if monitor whether user click on pattern better still. is possible - , if how go it? phil if want develop app gives user opportunity monitor apps running on devices , handle touches inside these apps, may done of server. in general (until more details given) each app must screenshots , handle touches , send them server. , server must send info devices subscribed updates particular set of devices. on other hand, client app must updates server constantly. but should aware apple may reject such application (for activity similar spying activity), suggest read in details apple opinion case.

python - Simple application of QThread -

i getting grip on qthread in order not lock gui, while performing possibly longer threads in background. trying practice write simple application: countdown timer can start clicking on button "start", thereby initiating countdown loop, can pause clicking on button "pause". i want in "proper way" of using qthread (explained over here ), i.e. subclassing qobject , attach instance of subclass qthread via movetothread. did gui qtdesigner , modified far (from other examples on net) in python: from pyqt4 import qtgui, qtcore pyqt4.qtcore import qthread, signal import time, sys, mydesign class someobject(qtcore.qobject): def __init__(self, lcd): super(self.__class__, self).__init__() self.lcd = lcd self.looping = true finished = qtcore.pyqtsignal() def pauseloop(self): print "hello?" self.looping = false def longrunning(self): count = 10 self.lcd.display(count) w