Posts

Showing posts from September, 2011

jquery - CakePHP Sending data from view to controller via ajax -

i'm new cakephp. i'm trying make simple ajax request modify part of screen. i've found several examples on web, can't mix them together! when click button btnnewphon , want send content of input txtphon sent controller admincontroller. in view, div datatoshow updated show data sent controller. i'm there, don't know how send content of inputs phonid , phontxt controller , don't know how data in controller. here's code. view index.ctp : <div id="datatoshow"></div> <input id="phonid" type="text"> <input id="phontxt" type="text"> <button id="btnnewphon">new</button> ajax view ajax_response.ctp : <?php echo $content; ?> javascript admin.js (included in view): $(function() { $('#btnnewphon').click(function() { = $("#txtphon").val ; $.ajax({ type:"post", datatype:'json', cach

html - iOS Safari: 100% width fixed position header wider than viewport -

i have run in problem effects safari on ios. i building page has fixed position header width of viewport. content of page series of images (variable in number) should scroll right. header should remain in place when user scrolls. on ios safari, fixed header, larger viewport, , scrolls @ different speed rest of content. i've cut code down following, , still cannot work out how solve problem - following code works in other browsers have tested. (i targeting ie8+) i've hosted example of problem here. thanks advice , help. <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>test</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1.0

javascript - How to run gulp tasks sequentially? -

this question has answer here: how run gulp tasks sequentially 1 after other 13 answers i have few tasks in gulp , of them except 1 run in parallel. let's consider example: var gulp = require('gulp'); gulp.task('clean', function() { // clean output folder }); gulp.task('copy1', function() { // writes stream in output folder }); gulp.task('copy2', function() { // writes stream in output folder }); gulp.task('default', ['clean', 'copy1', 'copy2']); in example need run copy1 , copy2 in parallel after clean . how can trick? var runsequence = require('run-sequence'); gulp.task('default', function(callback) { runsequence('clean', ['copy1', 'copy2'], callback); });

Proper way to print unicode characters to the console in Python when using inline scripts -

i looking way print unicode characters utf-8 aware linux console, using python 2.x's print method. what is: $ python2.7 -c "print u'é'" é what want: $ python2.7 -c "print u'é'" é python detects correctly console configured utf-8. $ python2.7 -c "import sys; print sys.stdout.encoding" utf-8 i have looked @ 11741574 , proposed solution uses sys.stdout , whereas looking solution using print . i have looked @ 5203105 , using encode method not fix anything. $ python -c "print u'é'.encode('utf8')" é solutions as suggested @klausd. , @itzmeontv $ python2.7 -c "print 'é'" é as suggested @pm2ring $ python -c "# coding=utf-8 > print u'é'" é see accepted answer explanation cause of issue. the problem isn't printing console, problem interpreting -c argument command line: $ python -c "print repr('é')" '\xc3\xa9

php - How am i able to connect to mysql without entering any username or password? -

Image
i new php. learning in ubuntu operating system. i tried connecting mysql, made mistake forgot enter username , password still able connect. how ?? my code : <?php mysql_connect('localhost','','') or die('could not connect database'); echo "connected database"; ?> output : before starts flaming using mysql_connect, suggest check manual functions. ( here can find infos function http://php.net/manual/en/function.mysql-connect.php , see it's deprecated. use @ least mysqli.). another great resource http://www.phptherightway.com/#mysql_extension the answer above correct (you're passing empty string) looking in manual, you'll see without passing should able connect ("default value defined mysql.default_user" if sql_safe_mode off, in php.ini). i imagine fault not yours using mysql_connect, of old tutorial still around! keep , cheers!

android - Retrolambda: Lint crashes when using lambda expressions with retrolambda -

i'm trying use retrolambda along gradle-retrolambda plugin. in general works fine, when compile release, lint stage fails exception: :playground.dagger:lintvitalreleasefailed converting ecj parse tree lombok file d:\....\playground\dagger\mainactivity.java java.lang.unsupportedoperationexception: unknown astnode child: lambdaexpression @ lombok.ast.ecj.ecjtreevisitor.visitother(ecjtreevisitor.java:368) @ lombok.ast.ecj.ecjtreevisitor.visitecjnode(ecjtreevisitor.java:364) @ lombok.ast.ecj.ecjtreeconverter.visit(ecjtreeconverter.java:295) @ lombok.ast.ecj.ecjtreeconverter.totree(ecjtreeconverter.java:236) @ lombok.ast.ecj.ecjtreeconverter.filllist(ecjtreeconverter.java:282) @ lombok.ast.ecj.ecjtreeconverter.filllist(ecjtreeconverter.java:252) @ lombok.ast.ecj.ecjtreeconverter.access$100(ecjtreeconverter.java:141) @ lombok.ast.ecj.ecjtreeconverter$2.visitmessagesend(ecjtreeconverter.java:1042) @ lombok.ast.ecj.ecjtreevisitor.visitecjnode(ec

java - Hibernate one-to-many mapping configuration -

i new hibernate , trying implement one-to-many relationship cascade loading , updating. however, code generates org.apache.jasper.jasperexception: org.hibernate.mappingexception: not constructor org.hibernate.persister.entity.singletableentitypersister exception. take on attempt , suggest doing wrong? the general idea there company class contains set of customers. when creating new instance of customer, add him company , persist everything. entities (only displaying relevant parts, or @ least hope so) public class company implements serializable { private static final long serialversionuid = 146243652; private string id; private string name; private string website; private set<customer> customers; ... getters, setters etc public class customer implements serializable { private static final long serialversionuid = 864235654; private string name; private string surname; private string adress; private string id; private

list - Python - count words not in a distance of three (3) words from specific words -

i using following python code count words in text (.txt) files , checking whether of words in text file belong in of two lists of words considering (the word lists .csv files, imagine these "dictionaries") import re import collections collections import counter import csv import sys find_words = re.compile(r'(?<!\s)[a-za-z]+(?!\s)').findall wanted1 = set(find_words(open('word_list1.csv').read().lower())) wanted2 = set(find_words(open('word_list2.csv').read().lower())) f in sys.argv[1:]: cnt1 = cnt2 = cntwords = 0 wanted = 20 open(f) inputfile: line in inputfile: word in find_words(line.lower()): myfile.write(word+ "\n") cntwords += 1 if word in wanted1: file1.write(word+ "\n") cnt1 += 1 if word in wanted2: file2.write(word+ "\n") cnt2 +

javascript - Update DIV element on the page while looping an object -

i have function loops through object many elements using for loop. while looping through each element connects server , sends data through ajax, waits response , goes next element in object. if object has many elements can take 2 or more minutes before looping has finished. visually show on page how many elements left before looping has finished. the problem screen freezes while looping. there way update div element on page while looping through object ? var a;//let's assume array ... ... for(var =0;i<n;i++) { (function(a,b){settimeout(f(a,b),0);})(i,a[i]); } ... ... function f(current, element) { //call server api here //send data div using value of current }

(PHP) The include function only includes some parts of the file -

i have problem including php file. have searched on web, , troubleshooted in different ways 3 hours, can't figure out on own. i have file called "side9test.php" code: <?php include "styret/fil-liste.php"; ?> the file "fil-liste.php" contains: <?php echo "</br>"; echo file_get_contents("filsystem_navn/m_0.txt"); ?> the file "m_0.txt" contains this: forste mappa the problem though, when run "side9test.php", gives me is: </br> i appreciate feedback! i think file path correct, change code echo file_get_contents("filsystem_navn/m_0.txt",true); setting true or 1 search include path :)

finite automata - Proof the language is regular or not regular using Pumping lemma? -

Image
can 1 figure out l = { a m b n , m ≥ n + 2, m ≤ 3 } regular or not using pumping lemma, seems bit difficult prove. i have tried used pumping lemma , shows regular language confused right or not. i have tried used pumping lemma , shows regular language confused right or not. first note, pumping lemma can used proof "certain language not regular language". can not use pumping lemma proof "certain language is regular". yes, pumping lemma regular languages describes essential property of regular languages, , if languages don't satisfy conditions described pumping lemma or don't satisfy pumping lemma property language not regular language, converse of not true!! &mdash- there "languages satisfies pumping lemma's conditions , may still non -regular", means:- pumping lemma 'necessary not sufficient condition' language regular. like: every engineer math student - if student engineer can knows math, m

Is it possible to add a specific screen resolution option (i.e. 1720 x 1440) to windows 8.1 -

i have 2 widescreen curved monitors (optimal resolution 3440 x 1440) option split each screen 2 independent displays own media source. i use functionality 1 of screens because appropriate screen resolution (i.e. 1720 x 1440) not available result windows being stretched. is possible add screen resolutions default windows list (i.e. via regedit) or there application enables me adjust integrally? my graphic card intel® hd graphics 4600. i used tool amd 7970 , worked great. http://www.monitortests.com/forum/thread-custom-resolution-utility-cru add detailed resolution, restart machine, pick screen resolution options , off go.

multithreading - multi threaded downloader in java -

ok using following function create multiple threads download file. can see functions takes link, starting byte, ending byte , path download file argument. call function 2 times create 2 threads download required file. for example, if file of 100 bytes following thread-1 --> downloadfile(" http://localhost/file.zip ", 0, 50, "output.zip"); thread-2 --> downloadfile(" http://localhost/file.zip ", 50, 100, "output.zip"); but know happens, few bytes don't downloaded , progress bar gets stuck @ 99%. that's problem!!! why gets stuck @ 99%? in words why bytes being lost? see total number of bytes in downloaded variable. here function public void downloadfile(final string link, final long start,final long end, final string path){ new thread(new runnable(){ public void run(){ try { url url = new url(link); httpurlconnection conn = (httpurlconnection) url.openconnection

c++ - Undo name hiding by "using" keyword. Does not work in grandchild class -

for example in below program undo name hiding "using" keyword. if have base , 1 derived class "im getting expected ambiguous call error". if have 2 derived class(child , grand child) child , grand child having same overloaded function here undo name hiding "using" keyword. getting compiled , got output. question why im not getting error "ambiguous call overloaded function". class basenamehiding { protected: int namehidingexample(int t) { cout<<"im baseeeeeeeeeeee"<<endl; return 0; } }; class derivednamehiding:public basenamehiding { public: float namehidingexample(float s) { cout<<"im derived"<<endl; return 0; } using basenamehiding::namehidingexample; }; class grandderivednamehiding:public derivednamehiding { public: float namehidingexample(float f) { cout<<"im grand derived"<<endl; return 0; } using

javascript - count number of multiple selected in jquery autocomplete field -

in jquery's autocomplete multiple value , try add counter selected values. should updated immediately, when chose/add 1 more values. both codes of workaround not working. 1 function checkreceiver() { var str = document.forms[0].tags.value, regex = /417/igm, count = str.match(regex), count = (count) ? count.length : 0; console.log(count); document.forms[0].receiver.value=count; } 2 var str = document.forms[0].tags.value; count = (str.match(/417/g) || []).length; document.forms[0].receiver.value=count; is there trigger, can use in autocomplete function directly? demo on jsfiddle you quite close working solution. propose following changes: instead of testing regex, split on commas : plugin using puts comma automatically after each new selected value. therefore, can count number of values number of commas. example: function checkreceiver() { var str = document.forms[0].tags.value; var words = str.split(','); // split on

Can not set java.lang.Integer field ...User.id to java.lang.Integer exception in Hibernate -

i building restful service hibernate jersey , spring on java , realized relationships between entities should without including instance of classes, identifiers (foreign keys). have exceptions when try query entities. have following entities: @entity @javax.persistence.table(name = "manager_user") public class manageruser extends user { @manytoone(targetentity = shopadminuser.class) private integer shopadminuserid; //... } @entity @javax.persistence.table(name = "shop_admin_user") public class shopadminuser extends user { @lob private string contactdata; public string getcontactdata() { return contactdata; } public void setcontactdata(string contactdata) { this.contactdata = contactdata; } } @entity @inheritance(strategy= inheritancetype.table_per_class) public abstract class user { @id @generatedvalue(strategy = generationtype.table) private integer id; private string firstname; pri

android - How to convert ascii to char in NDK? -

i trying use convert ascii char in android ndk gives me fatal error segement , app force stops. code: value = "116"; char word = atoi(value); return (*env)->newstringutf(env, word); error: fatal signal 11 (sigsegv) @ 0x00000074 you need provide newstringutf() c-string (i.e. array of char ending null): value = "116"; char word[2]; word[0] = atoi(value); // first char converted want word[1] = 0; // null termination (aka '\0') return (*env)->newstringutf(env, word);

javascript - How to take value from input and take it to AJAX request link? -

so have done ajax request angularjs: http://jsfiddle.net/c0lkja0h/1/ when use link example $http.get('http://api.wunderground.com/api/key/forecast/geolookup/conditions/q/san_francisco.json') (without '+ city +' in link) works great. when add variable, add ng-model="city" , hit submit, says city not defined how can make take city name input , use in newajaxreq function when click "find weather" button ? cool default link static link (when person first visited site), , after city taken input if user wants. thanks! there couple of things wrong approach. don't name controller. should anonymous function take parameters modules want inject, such .controller(function($http){ //do }); or .controller(['$http',function($http){ //do }]) avoid losing reference variables when minify js files. inside controller, define function want takes parameter city, such $scope.sendajax = function(city){ //do } . in view gonna call

integral - Integration with Riemann Sum Python -

i have been trying solve integration riemann sum. function has 3 arguments a,b,d lower limit b higher limit , d part a +(n-1)*d < b . code far but. output 28.652667999999572 should 28.666650000000388 . if input b lower has calculate have solved problem already. def integral(a, b, d): if > b: a,b = b,a delta_x = float((b-a)/1000) j = abs((b-a)/delta_x) = int(j) n = s = 0 x = while n < i: delta_a = (x**2+3*x+4) * delta_x x += delta_x s += delta_a n += 1 return abs(s) print(integral(1,3,0.01)) there no fault here, neither algorithm nor code (or python). riemann sum approximation of integral , per se not "exact". approximate area of (small) stripe of width dx, between x , x+dx, , f(x) area of rectangle of same width , height of f(x) it's left upper corner. if function changes it's value when go x x+dx area of rectangle deviates true integral. have noticed, can make approx

ruby - How can I turn an array of keys into an array of values? -

i have hash like hash = { 'burger': 2, 'kebab': 5, 'pizza': 10 } and have array of keys like ['burger', 'burger', 'pizza'] how create array of corresponding values? inject method best method sum value array together? actually, don't need prepare key arrays. to keys: hash.keys to values: hash.values if want values or values in order, then a = [:burger, :pizza] hash.values_at(*a) # => [2, 10]

css - How do I put two or more images side by side in HTML? -

say have 2 images , want place them side side few spaces between them, how do that? heard float? , how can/would use it? usually images behave floating left, nicael pointed out, can place them next each other. or can use style="float:left;" stated in first answer. on other hand, image element has nice align attribute, allows manipulation in way: <p>some text above</p> <img src="http://urlref.at/images/3o.gif" align="left" /> <img src="http://urlref.at/images/3o.gif" align="left" /> <img src="http://urlref.at/images/3o.gif" /> <p>some text underneath</p> then not put align left in last image text goes underneath , not next image. to space image can use vspace , hspace attributes: <p>some text above</p> <img src="http://urlref.at/images/3o.gif" align="left" hspace="20" /> <img src="http://urlref.at/images/3o.

c++ - segmentation fault on joining pthread -

i trying implement thread interface class i having problem join() function, gives me segmentation fault the output: g++ threadinterface.cpp -lpthread [murtraja@localhost src]$ ./a.out name: thread # 0 policy: fifo scope: system state: detached name: thread! policy: round robin scope: system state: joinable running thread! segmentation fault (core dumped) what interesting when call gdb , set break @ mythread::run, prime nos printed , message that: ....... 48 not prime 49 not prime 0x000000000040141c in main () (gdb) s single stepping until exit function main, has no line number information. program received signal sigsegv, segmentation fault. 0x00007ffff7bc920a in pthread_join () /lib64/libpthread.so.0 please refer code , me, new threads. btw, i've removed code , kept necessary #include <iostream> #include<pthread.h> #include<stdio.h> #include<cstring> using namespace std; class mythread { int policy, state, scope; char name[

javascript - Using ajax to download a file -

i have javascript file uses ajax , passes array of ids rails controller action. controller maps these model objects , generates file containing of data. problem lies in downloading file. before, saving needed objects in database first, , controller format .ics, call same action, file downloaded. now more dynamic, , i'm having trouble rendering file have pass in params. there way this? i've tried render :layout => false, :text => @calendar.to_ical and send_data @calendar.to_ical, :type=> 'text/ics' and render :text => @calendar.to_ical all of complete successfully, no file ever downloaded. any appreciated! thank you! the short answer cannot use ajax download files (for security reasons). check out this question other options, setting window.location= or using jquery file download plugin.

java - neo4j transaction not rolling back -

i using neo4j 2.1.7 java. try(transaction transaction = this.graphdatabaseservice.begintx()) { node user = this.graphdatabaseservice.createnode(); user.setproperty("userid", userid); transaction.failure(); } so getting object of graphdatabaseservice , creating new transaction , marking rollback. according javadocs: void failure() marks transaction failed, means unconditionally rolled when close() called. once method has been invoked, doesn't matter if success() invoked afterwards -- transaction still rolled back. but see node gets created no matter what. tried throwing exception . tried not calling transaction.success() @ all. still see changes committed , not rolled back. not sure of behaviour , explanation. thanks. if must know, trying build commit() function nested transactions such if operation fail within inner transactions, parent transaction must fail too. however, in process found no matter do, tra

javascript - How can I make a popup show up only if the device is android? -

Image
i trying make popup appear if person traveled on website using android device. have seen done on other websites can't seem figure out how this. attaching screenshot of wanting do. please if can please me appreciate it. you can check user agent , if android device, call code display pop this: var ua = navigator.useragent.tolowercase(); var isandroid = ua.indexof("android") > -1; if(isandroid) { // call popup code here }

Display a new member to an html display list in javascript -

i want display new member html display. i'm working json object array. have 2 functions, 1 displays list in memberslist , supposed push single member list. i'm not clear on i'm doing wrong, maybe way i'm passing (or not) function? i'm getting [object][object] in list ... see jsfiddle: http://jsfiddle.net/lakenney/njndcyqm/ // display members list inside id 'memberslist' on html page function displaymembers() { //console.log("dislpaying members"); var len = members.length; var memberslist = document.getelementbyid('memberslist'); memberslist.innerhtml += ''; // loop through each member object in array, , print each element (member string) pge (var = 0; < len; i++) { //console.log(members[i]); // members memberslist.innerhtml += members[i] + '<br>'; } //console.log(members); } /* functions displays single member on page. * * @param member - single membe

java - Android - Plug-in com.android.ide.eclipse.adt unable to load com.android.ide.eclipse.adt.ToolsLocator -

i'm having issue eclipse when start eclipse shows me error in message box "plug-in com.android.ide.eclipse.adt unable load class com.android.ide.eclipse.adt.toolslocator". when click ok screen here can see snapshot of (image link http://postimg.org/image/tixjg91gp/full/ ) things have tried are: reinstalling eclipse+adt, restarting eclipse+pc, searching , found no results. please if know please post answer under this, thank you. issue i'm having android - eclipse project making , r file error

JavaScript function that prevents YouTube video playing at the same time (No iframe) -

just clarify, aware of youtube playback control required: player.pausevideo():void but know how can utilise without using iframe , javascript function needed, have multiple videos choose , want avoid videos playing @ same time. i have inserted videos youtube using code: <div id="apdiv10"><embed width="200" height="140" id="yt9" src="https://www.youtube.com/v/a2p17bdrgqu"></div> <div id="apdiv11"><embed width="200" height="140" id="yt10" src="https://www.youtube.com/v/membfbz_9we"></div> can provide run down me , how can apply function?

c++ - How to create a QInputDialog in a new thread? -

basically i'm calling function thread using qtconcurrent . working expected once create qinputdialog within called function, i'm getting assertion exception telling me have create dialog in main gui thread. to more specific line: password = qinputdialog::gettext( , tr( "password" ) , tr( "enter password:" ) , qlineedit::password , selectedpassword , &ok ); now question how can call dialog new thread without work. you can't create widgets outside main thread. can emit signal network thread , create dialog in main thread. or (pseudo-code): class notificationmanager : public qobject { q_object //... public slots: void showmessage( const qstring& text ) { if ( qthread::currendthread() != this->thread() ) { qmetaobject::invoke( this, "showmessage", qt::queuedconnection, q_arg( qstring, text ); // or use qt::blockingqueuedconnection freeze caller thread, until dialog closed return;

google app engine - How to avoid "safety" over quota panic when accessing datastore ? (billing is enabled) -

i deployed site google app engine (using golang , datastore 1000 records). billing enabled , daily budget established. quota details page indicates under quota. doing urlfetch obtain tsv file use build data entities in datastore. two problems: only 778 entities create - log indicates long running process appears terminate prematurely without error message. docs normal the second step involves creating json file entities in datastore. process causes "panic: overquota" because process taking long suppose. how proceed? should divide tsv datafile several smaller files? can request "more time" don't go on safety quotas? important note datastore part of developers console showing problems: although application has access 778 datastore entities, console reports 484 entities of kind total of 704 entities of kinds (actually 933) i've been working @ while , wondering if there going on system or there things can data entities set properly. w

Problems loading Alternative PHP Cache (APC) -

i have vps hosted linode running ubunutu 12.04 lts. took @ error.log file , looks apc isn't loading. i have extension=apc.so in php.ini file , i've tried: sudo apt-get purge php-apc sudo apt-get install php-apc but didn't fix it. here's error i'm getting. [28-mar-2015 10:39:01 america/los_angeles] php warning: php startup: unable load dynamic library '/usr/lib/php5/20121212/apc.so' - /usr/lib/php5/20121212/apc.so: cannot open shared object file: no such file or directory in unknown on line 0 i found copy of apc.so file here: /usr/lib/php5/20090626/apc.so i tried changing php.ini file to: extension=/usr/lib/php5/20090626/apc.so and restarted apache sudo service apache2 restart but got error instead [28-mar-2015 10:56:43 america/los_angeles] php warning: php startup: unable load dynamic library '/usr/lib/php5/20090626/apc.so' - /usr/lib/php5/20090626/apc.so: undefined symbol: zend_unmangle_property_name in unknown

security - Secure REST service to consume only by specific android app -

my server exposes number of rest services, want secure web services such way can consumed android apps owned me. essentially both client (android app) , server developed me; , need expose rest service android app. i thought of number ways securing rest service like using username/password based authentication jwt token signature based verification etc. in cases android app should store password in app; in case hacker can decompile app , password. how can secure rest can accessed android app? edit: client app doesn't require authentication user you can't. authentication done sharing secret between client , server. if put secret in app, decompiled , stolen (if cares enough to). if give secret person (like password), can authenticate person- person can type fake app. when you're dealing unknown hardware not under control, there's no way assure app , not else's- can assure user authorized.

loops over the registered variable to inspect the results in ansible -

i have ansible-playbook creates multiple ec2 security groups using with_items , register result. here var file playbook: --- ec2_security_groups: - sg_name: nat_sg sg_description: sg nat instance sg_rules: - proto: tcp from_port: 22 to_port: 22 cidr_ip: 0.0.0.0/0 - sg_name: web_sg sg_description: sg web instance sg_rules: - proto: tcp from_port: 22 to_port: 22 cidr_ip: 0.0.0.0/0 - proto: tcp from_port: 80 to_port: 80 cidr_ip: 0.0.0.0/0 and here playbook creates ec2 security groups: --- - name: ec2group | creating ec2 security group inside mentioned vpc local_action: module: ec2_group name: "{{ item.sg_name }}" description: "{{ item.sg_description }}" region: "{{ vpc_region }}" # change aws region here vpc_id: "{{ vpc.vpc_id }}" # vpc resgister name, can set manually state:

Using php or javascript to change picture in a webpage according to some sort of url code -

right have simple website looks this. http://i.imgur.com/opllm1y.png i need way change image , description @ same time keep navbar , title same not want 100s of pages on website. would best put image url's database , call out php along description? or there way it. does content need change without leaving page? if so, using jquery , ajax. goto jquery offical web site, , download javascript file them, upload server. just before closing tag body, insert this: <script src="your.jquery.file.js" type="text/javascript" ></script> now, on page, simple way make sure img , div tags have id's: <img id="image_to_change src="start.png"> <div id="text_content"></div> after script tag included, use script tag, time, we're gonna put javascript of our own in here <script type="text/javascript"> $(document).ready(function(){ $('#image_to_change').onc

android - How Can make Toast.makeText in Google map? -

i want know how can make 'toast.maketext`to tell me order of cities in path code : shortest = tsp.tsp(matrix); for(int i=0; < 20 ; i++) { googlemap.addpolyline(new polylineoptions().geodesic(true) .add(new latlng(placelatitude[shortest[i]],placelongitude[shortest[i]])) .add(new latlng(placelatitude[shortest[i+1]],placelongitude[shortest[i+1]])) ); } } here full description on toast. , i'm guessing can record cities being added in order in string array , run loop append text displayed on toast message.

javascript - Generating divs each with random class from the array -

i'm having trouble figuring out why following function not achieving should: function example() { var $element; var rndclass; var classesarr = ['one', 'two', 'three']; var container = $('.container'); for(i=0; i<10; i++) { rndclass = math.floor(math.random()*classesarr.length); $element = $('</div>', {'class': 'card '+classesarr[rndclass]+''}); $(container).append($element); } } in nutshel want generate 10 divs each having class of card + class classesarr (array) selected randomly , after append each of these divs container div, far nothing seems happening. here jsfiddle https://jsfiddle.net/u5llx8gq/4/ as sidenote, great if guys suggest better way these random clases, there should more or less equal amount of these used in 10 divs. to more or less number of class types while still selecting @ random can this. jquery(function($) { v

performance - PHP: Improve speed returning Mesh terms from Entrez database (Pubmed) -

i want extract mesh terms search results in pubmed database. using php. i made script works slow. opens each article, parses xml , retrieves mesh terms. "fopen" function slow part. $url= $base."efetch.fcgi?db=$db&id=$id&rettype=abstract"; $opts = array( 'http' => array( 'method' => "get", 'header' => "user-agent:myagent/1.0\r\n" ) ); $context = stream_context_create($opts); $fp = fopen($url,'r',false,$context); $output=stream_get_contents($fp); the script opens each article big xml file: http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&id=19616537&retmode=xml is there way retrieve mesh terms, or @ least smaller part of xml? or load half of file? thank you update: got improvement. using efetch retmode=text , rettype=medline reduced download 1 file 15 kb 4kb. bundled downloads reduce amount of requests. it takes 4.8s load 500 results.

logging - SVN: Would like to see the computer each commit came from when looking at the logs -

i'm using different svn clients on windows (tortoise), linux (netbeans) , mac (smartsvn). i'd know if possible configure svn server (or clients) keeps (or know) computer (e.g. ip address) @ origin of every commit? how using different versions of name when commit? e.g. using bart@windows , bart@linux , bart@mac solve problem in hurry.

Exception loading Facebook Login Button in Android Studio -

i want make app facebook integration. i'm using android studio 1.1.0. i'm able import facebook skd 4.0.0 in build.gradle (module:app) , use in java code: apply plugin: 'com.android.application' android { compilesdkversion 21 buildtoolsversion "22.0.1" defaultconfig { applicationid "package.test" minsdkversion 15 targetsdkversion 21 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } repositories { mavencentral() } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.0.0' compile 'com.facebook.android:facebook-android-sdk:4.0.0' } i put loginbutton layout file activity: <relativelayout xmlns:

visual studio 2013 - IntelliSense and browsing information will not be available for C++ projects -

Image
in visual studio trying create blank c++ project win32 console application app settings are console application check empty project precompiled headers unchecked visual studio tries set , gives me follow error: everything works except project has 0 intellisense. here tried far: i tried install latest version of microsoft sql server compact 4.0 keeps telling me version trying install older version , 1 have - latest. there fallback location setting true, tried still same. tried run vs in admin mode, same error. maybe had similar problem? i have had same problem too. figured out problem install microsoft sql server compact 3.5 service pack 2 windows desktop. link https://www.microsoft.com/en-us/download/confirmation.aspx?displaylang=en&id=5783 may can problem. luck

algorithm - Give two integer vectors in c++ (same size and type), I'd like to sort one from smallest to largest element and change the order of the second vector -

this question has answer here: how sort std::vector values of different std::vector? 12 answers give 2 integer vectors in c++ (same size), i'd sort 1 of vectors smallest largest element , change order of second vector respectively. how can achieve without using boost library? thanks. you can restructure code that, instead of 2 vectors of integers, uses vector of s , s structure containing 2 integers. can define specific operator< used sort function. this has advantage strict coupling between 2 sets of data stated in way stored.

php - JSON encoding returns array of objects, how to access them? -

ajax call $.ajax({ type: 'post', url: './php/testing/notification-regrab.php', async: false, contenttype: 'text/json', error: function (result) { alert("error124"); }, success: function (result) { var data = $.parsejson(result); console.log(data); } }); result without json.parse {"notes":{"0":{"id":"3","sender":"0000000011","sendee":"0000000001","sent":"2015-03-11 00:00:00","is_read":"0","type":"14","ix_msg":"you have recived response group invitation!","sender_fname":"mot","sender_lname":"mot","sender_username":"mot","msg":"sure, join project group.","target":"1","skill_list":null,"resource_list":null,"response&q