Posts

Showing posts from February, 2012

php - .htaccess Issue : 404 for index -

this .htaccess file in sub-folder ... <ifmodule mod_rewrite.c> rewriteengine on rewriterule ^index\.php$ - [l] rewriterule (.*) ./index.php?id=$1 [l] </ifmodule> i want mydomain.com/sub-folder/string processed index.php mydomain.com/sub-folder/?id=string but getting 404... not sure why. root .htaccess # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule> # end wordpress keep root .htaccess as: # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^(index\.php|sub-folder(/.*)?)$ - [l,nc] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . index.php [l] </ifmodule> # end wordpress and keep in /sub-folder/.htaccess : <ifmodule mod_rewrite.c> rewriteengine on rewritebase /sub-folder/ rewrite

java - JAVAC Error with Path Change to jdk\bin -

problem still exists path change jdk67/bin. microsoft windows [version 6.1.7601] copyright (c) 2009 microsoft corporation. rights reserved. c:\users\dell>java -version java version "1.7.0_67" java(tm) se runtime environment (build 1.7.0_67-b01) java hotspot(tm) client vm (build 24.65-b04, mixed mode, sharing) c:\users\dell>javac 'javac' not recognized internal or external command, operable program or batch file. c:\users\dell>echo %path% c:\windows\system32;c:\windows;c:\windows\system32\wbem;c:\windows\system32\wind owspowershell\v1.0\;c:\ant194\bin;c:\maven323\bin;c:\java\jdk67\bin;c:\ruby200\b in c:\users\dell>javac 'javac' not recognized internal or external command, operable program or batch file. c:\users\dell> please let me know. this may you, 1.copy path upto 'bin' (eg:-c:\program files\java\jdk1.7.0_07\bin) 2.go properties of 'my computer' 3.select 'advanced system settings'

batch file - How to run a remote task using user name and password when password contains a '€' character? -

i'm trying run task on remote server using jenkins. i'm using command line: schtasks /run /s <remote server> /u <user> /p <password> /tn <task name> this worked fine new customer has '€' character inside password , can't figure out how pass cmd line correctly. it's being replaced '?' because standard cmd font doesn't support th € sign. inside cmd console can solve problem changing dafault font "lucida console" can't in jenkins or make batch-script use font. most services/server require authentication user name , password not allow characters code value greater decimal 127 because results in problems one. the euro sign has code value 20ac (hexadecimal, 8364 decimal) in unicode table. but in code page windows-1252 western european , north american countries euro sign has code value 80 (hexadecimal, 128 decimal). in code page windows-1251 cyrillic text euro sign has code value 88 (hexadecima

python - Filtering another filter object -

i trying generate prime endlessly,by filtering out composite numbers. using list store , test primes makes whole thing slow, tried use generators. from itertools import count def chk(it,num): in it: if i%num: yield(i) genstore = [count(2)] primestore = [] while 1: prime = next(genstore[-1]) primestore.append(prime) genstore.append(chk(genstore[-1],num)) it works quite well, generating primes, until hit maximum recursion depth. found ifilter (or filter in python 3). documentation of python standard library : make iterator filters elements iterable returning predicate true. if predicate none, return items true. equivalent to: def ifilter(predicate, iterable): # ifilter(lambda x: x%2, range(10)) --> 1 3 5 7 9 if predicate none: predicate = bool x in iterable: if predicate(x): yield x so following: from itertools import count genstore = [count(2)] primestore = [] while 1: prime = next(ge

Static methods added in interfaces in java 1.8 -

as know in java 1.8 static methods allowed in interfaces , have seen answers static methods defined in interface jdk 1 8 why did need so not satisfied. furthermore think may cause problems : public interface myinterface{ public static void mymethod(); } class myclass{ myinterface.mymethod(); // since mymethod static huge error waiting here ? } but still think there way out of since added by professionals , can please explain how oracle solves issue , need add ? thank in adavance. have not used java 1.8 never knew static methods in java needs defined not declared , thought of interfaces pure abstract class think that's why idea of defining method seemed strange me . thank ! . talking "what need add" static methods: quoting http://www.informit.com/articles/article.aspx?p=2191423 before java 8 made possible declare static methods in interfaces, common practice place these methods in companion utility classes. exampl

java - /_ah/queue/__deferred__ in App Engine Logs -

i have app engine application uses google cloud sql, , page in application doing database operation; whenever page accessed, not able perform database operations. when go console, see /_ah/queue/__deferred__ . i able run application without issues on localhost code has no errors, however, there issue cloud sql after deploying it. note : have not used queues anywhere in code. what actual cause for /_ah/queue/__deferred__ to appear in app engine logs? i had similar issue. i've found that in 1 of filters opening session each incomming connection: httprequest.getsession(true); //or 1 below - both opens valid http session httprequest.getsession(); and appengine-web.xml configured store session asynchronously <sessions-enabled>true</sessions-enabled> <async-session-persistence enabled="true"/> this has resulted in creating lot of tasks in default queue , each 1 of them tried store empty session. avoid this, make sure opening sess

ios - how to add done button on uidatepicker -

uidatepicker *datepicker = [[uidatepicker alloc]init]; [datepicker setdate:[nsdate date]]; [datepicker addtarget:self action:@selector(updatetextfield:) forcontrolevents:uicontroleventvaluechanged]; [txt_time setinputview:datepicker]; uibarbuttonitem *barbutton=[[uibarbuttonitem alloc]initwithtitle:@"done" style:uibarbuttonitemstylebordered target:self action:@selector(addordeleterows)]; how add done button on top of uidatepicker when press on textfield uidatepicker show after enter date done button show.after clicked on done button uidatepicker should hide of answer on stackoverflow how add done button date picker, one: display uidatepicker in uiactionsheet when tapping on uitextfield helpful. achieves desired result minimum code , custom configuration.

neo4j - Count each node number of parents in a tree graph -

i pretty new cypher. i have hierarchical tree built in neo4j, , need set "depth" property on each node, contains number of parents. there single cypher query set/update properties ? / \ b c / \ d e so in tree, a.depth = 0, b.depth = 1, c.depth =1, d.depth = 2, e.depth = 2, , on... thanks ! you can assign path variable , use length: match p=(a:mylabel {key:''value'})-[*..20]->(x) set x.depth = length(p)

Launching additional Powershell instance with commands from a text file -

i'm writing powershell script takes in text file parameter. text file looks similar this: echo "1" echo "2" echo "3" what want each line executed in new powershell instance. in example above, 3 additional instances created , each of 3 execute 1 line text file. i'm able launch instances, cannot instances treat lines in file commands. $textfile=$args[0] #file powershell commands foreach($cmdd in get-content $textfile){ cmd /c start powershell -noexit -command {param($cmdd) iex $cmdd} -argumentlist $cmdd } running code opens instances, prints lot of information, , closes. closes cannot see info is. however, since text file composed of printing numbers 1, 2, , 3, don't think it's working correctly. there way keep windows closing after execution? if you're launching additional instances of powershell powershell, won't need call cmd. try using start-process : $textfile=$args[0] #file powershell commands forea

angularjs - Argument passed to $modal is undefined? -

using angularjs ui i'm trying pass argument modal. the thing is, item undefined. i've checked out documentation etc. , don't i'm doing wrong here. the controller 'newproject' 1 calling following code: var modalinstance = $modal.open({ templateurl: 'app/projects/createtask.html', controller: 'createtask vm', resolve: { item: function () { return 'itemvalue'; } } }); inside 'createtask' controller have following code (the beginning displayed here): (function () { 'use strict'; var controllerid = 'createtask'; angular.module('app').controller(controllerid, ['common', '$modalinstance', createtask]); function createtask(common, $modalinstance, item) { //why item undefined here?!?!?! note

Matlab: Comparing 2 images with different dimension and pixel size -

i have 2 images need compare: image 1: size [512 x 512] pixel dimension: 0.41 mm image 2: size [210 x 210] pixel dimension 1 mm tried use: imresize imresize(image_1, [210 210]) % change size/pixel however reduce resolution , image not clear @ all. suggestion welcome! you have problem comparing 2 images of different resolutions. pre-processing of images make them comparable, maybe more making them of same size. pre-processing depends on images. anyway, perhaps better re-size smaller 1 larger version using 1 of methods mentioned here: http://www.mathworks.com/help/images/ref/imresize.html , compare them. example, enlarge smaller image using 'lanczos3' method. imresize(image_2,[512 512],'lanczos3');

python - Duplicate strings in nested lists -

set - have list nested lists (call relay sets) looks this: relay_sets = [ [[80100, 'a']], [[75000, 'b']], [[64555, 'c']], [[55000, 'd'], [44000, 'e']], [[39000, 'f'], [2000, 'g']], [[2000, 'h'], [999, 'i'], [999, 'j']], [[999, 'k'], [999, 'l'], [343, 'm']] ] a user put in 1 of relay sets (with uniform probability) , again uses 1 of nested lists in sublist equal probability. example user has 1/7 chance of being put in [[80100, 'a']] guaranteed use [80100, 'a'] , whereas user has 1/7 chance of being put in [[55000, 'd'], [44000, 'e']] , has 1/2 chance of using [55000, 'd'] . i wrote script finds probability of using relay: def prob_using_relay(relay, relaysets): prob1 = 1 / float(len(relaysets)) index, item in enumerate(relaysets): in item: if relay in i: num_relays_in_set = le

jquery - skipping columns in table javascript -

good day, i trying skip columns on table not stored variable cant make work. i want add "skip" class on every "th" element want skip, column shouldn't included on loop. but stuck on iterating array condition false on next loop causing stored in variable on next loop. heres js var = []; var value = []; $('.report-table tr').each(function(){ $('th', this).each(function(index){ if($(this).hasclass('skip')) { console.log(index); i.push(index); } else { value.push($(this).text()); } }); $('td', this).each(function(index){ if(i.length!=0){ //this stuck right for(var t = i.length-1; t>=0;t--){ if(i[t]==index) { console.log("skip :"+index); } else{

dplyr - Substitute LHS of = in R -

i replace lhs of "=" in expression in r. in personal case, need make sure following creates variable not exist in data frame df %>% mutate(v = mean(w)) i tried eval(substitute()) lhs not substituted eval(substitute(df %>% mutate(v = mean(w)), list(v = as.name("id")))) #similarly in list eval(substitute(l <- list(v=1:10),list(v=as.name("id")))) l $v [1] 1 2 3 4 5 6 7 8 9 10 why can't v substituted throught eval/substitute? what's best way work around it? 1) eval/parse create cmd string, parse , evaluate it: f2 <- function(df, x, env = parent.frame()){ cmd <- sprintf("mutate(%s, %s = mean(v1))", deparse(substitute(df)), x) eval(parse(text = cmd), env) } f2(df, "v1_name") giving v1 v1_mean 1 1 2 2 2 2 3 3 2 ... etc ... 2) eval/as.call way construct list, convert call , evaluate it. (this approach mutate_each_q in dplyr takes.) f3 <- functi

hash - The memory cost of a hash_map structure in C++ STL -

in order use hash_map, assume consecutive memory block allocated, what's size of block default? this following unordered_map - name hash map in c++11 onwards... while initial size implementation specific, default .max_load_factor() stipulated standard 1.0 , in general number of buckets automatically increase when .size() becomes greater. gives bit of feel things.... you can call .bucket_count() instantaneous count.

performance - Octal to octal multiplying in Java -

can me multiplying octal octal numbers in java? i'm thinking if user input long octal number multiplied long octal number how result? please show codes. thanks. result = carry + result; carry = result / 10; numtemp = result % 10; result = result - numtemp; for(int ii = 0; ii < numarray.length; ii++){ numarray[ii] = numarray[ii] / 10; } you multiply numbers , not string representations of numbers, octal notation 1 way of representing number. just parse input int variables, perform multiplication , print out again. (here: formatted in octal representation, can print number in format want) string num1 = "01234"; string num2 = "04321"; int result = integer.parseint(num1, 8) * integer.parseint(num2, 8); system.out.printf("%#o", result);

GoogleApiClient fails for Android Wear API requires update but I'm already updated -

i'm trying setup google wear app, on mobile side, i'm trying create googleapiclient uses wearable api, error saying need update (service_version_update_required). phone @ latest version of google play services. used standard android studio create wizard create app wear app, , main activity (and added "" manifest. import android.app.activity; import android.app.dialog; import android.os.bundle; import android.util.log; import com.google.android.gms.common.connectionresult; import com.google.android.gms.common.googleplayservicesutil; import com.google.android.gms.common.api.googleapiclient; import com.google.android.gms.wearable.wearable; public class myactivity extends activity implements googleapiclient.connectioncallbacks, googleapiclient.onconnectionfailedlistener { private googleapiclient mgoogleapiclient; private string tag = "myapp"; @override protected void oncreate(bundle savedinstancestate) {

full text search - SQL Statement to check first character for first and last name from textbox -

i trying write sql statement or statements retrieve account information based on textbox entry of person’s initials (last, first). following statement works when enter 1 letter, not too. 'variable dim strdatasource string dim connstr string = "provider=microsoft.jet.oledb.4.0;" & _ "data source = chapter4.mdb" strdatasource = "select custid, lastname, firstname " & _ "from tblcustomers " & _ "where ucase(trim(lastname)) '" & ucase(me.txtcustid.text) & "%'" dim dt new datatable dim dataadapter = new oledb.oledbdataadapter(strdatasource, connstr) dataadapter.fill(dt) dataadapter.dispose() me.dgvdisplay.datasource = dt i cannot figure out how add firstname search. i don't know names of fields in form, rajesh suggesting similar following. if want first or last name match, use or instead of , in clause. strdatasource = "select custid, lastname, fi

how to put True type font file in assets folder in android studio -

Image
i have true type fonts file contains fonts of rockwell.i need put in assets folder in android studio.but not able put it.can tell how this? just create assets directory under main directory of project (src/main/assets). copy , paste in folder , use it. these links maybe useful complete information : gradle based projects

javascript - What does [ ] mean in JS? -

i have array below , jquery syntax place data on array table. working fine, but i don't quite understand keys [ ] mean! such "<td>" + datelist[i]["name"] + "</td>"; if data isn't array, xml, or json, "<td>" + datelist[i]["name"] + "</td>"; still working? var datelist =[ { name: "mike jenson", email: "mike_j@yesware.com", phone: "9433550193", joined: "05/23/2014", }, { name: "jim stevens", email: "jim_s@yesware.com", phone: "1299331944", joined: "05/22/2014" } ]; $("#mytable").html(""); (var i=0; i< datelist.length; i++) { var tr="<tr>"; var td1 = "<td>" + datelist[i]["name"] + "</td>"; var td2 = "<td>

print solution (new to C) -

i cant figure out why program wont print final solution (totaldough). inputs 8,10,12 40,100 , 200: const int dough_per_sqft = 0.75; const int inches_per_feet = 12; #define m_pi 3.14159265358979323846 int main(){ // declare , initialize variables int smallrin; printf("what radius of small pizza, in inches?\n"); scanf("%d", &smallrin); int mediumrin; printf("what radius of medium pizza, in inches?\n"); scanf("%d", &mediumrin); int largerin; printf("what radius of large pizza, in inches?\n"); scanf("%d", &largerin); // number of pizzas sold int smallsold; printf("how many small pizzas expect sell week?\n"); scanf("%d", &smallsold); int mediumsold; printf("how many medium pizzas expect sell week?\n"); scanf("%d", &mediumsold); int largesold; printf("how many large pizzas expect sel

java - How to determine the direction of a Linked List -

Image
i have make linked list adds left im thinking it's boxes nodes , arrow link: tail [] <- [] <- [] <- ... [] head but how determine direction of linked list when adding second node? how know side it's going placed on? 2nd? 1st 2nd? [] [] [] for example code: head = new intnode(5,head) add right if linked list this: head tail [] -> [] -> [] -> [] but that's when adding made list format, side start when creating new linked list? well there no left , right linked lists. that direction used convenient graphical representation since can picture it. can technically draw linked list side ways, down, down up, left right, doesn't matter. all linked lists have single direction head tail . or in case of doubly linked lists, bi-direction head tail , tail head . i guess technically make doubly linked list "left" or "prev" pointers null make seem goes right. or make of "right&

go regex parsing string to environment variable -

i have string trying parse using go regexp , convert os.getenv(env) . assuming have string "hello world -p $path -f $hostname " in go, , want use regexp read os.getenv("path") , os.getenv("hostname") . can me proper regexp parser extract out "$" along word pass through os.getenv() parameter getting environment variable? the os.expandenv function replaces $var or ${var} in string according values in environment. recommend using function instead of writing own using regular expressions.

javascript - Whats wrong with this code? .checked is probably the one i am not using correctly -

i have simple html form. trouble logging in page, 2 radio buttons, 1 forgot password, , forgot username. when user click 1 of radio buttons, small form appears below option , can proceed further. have written username part. , have written small function it, not working properly, in fact, not working @ all. i have checked jquery selector, form #usernamedrop hide, if statement not working properly. $(document).ready(function(e){ $("#usernamedrop").hide(); $("#usernameradio").change(function(e){ if($("#usernameradio").checked){ $("#usernamedrop").show(); }else { $("#usernamedrop").hide(); } }); }); the html following: <body> <div id="logindiv"> <h1>what problem?</h1> <div> <div class="formentry"> <input type="radio" name="troublekind" id="usernameradio" valu

php - Upload resized image to S3, using Yii -

i want upload resized image amazon s3 bucket, using yii framework, directly -- without uploading original (not resized) image folder, anywhere within yii, website or server structure. i have used thumbsgen extension create thumbnail of image. code works, if upload file on own server. but, if upload image s3, not create thumbnail. my code this: <?php yii::app()->setcomponents(array('thumbsgen' => array( 'class' => 'ext.thumbsgen.thumbsgen', 'thumbwidth' => yii::t('constants', 'secretcode_width'), 'thumbheight' => yii::t('constants', 'secretcode_height'), 'basesourcedir' => yii::app()->request->s3baseurl.'/uploads/secretcode/original/', 'basedestdir' => yii::app()->request->s3baseurl. '/uploads/secretcode/thumbs/', 'postfixthumbname' => null, 'nameimages' => ar

wordpress - How to get the full URL of the current page using PHP -

this question has answer here: can read hash portion of url on server-side application (php, ruby, python, etc.)? 11 answers what "less code needed" way parameters url query string formatted following? my current url www.mysite.com/category/subcategory/#myqueryhash i put code $url="http://".$_server['http_host'].$_server['request_uri']; it returns www.mysite.com/category/subcategory/ output should : www.mysite.com/category/subcategory/#myqueryhash you can use http request <?php $current_url="http://".$_server['http_host'].$_server['request_uri']; ?> you can use https request <?php $current_url="https://".$_server['http_host'].$_server['request_uri']; ?> you can use http/https request <?php $current_url="//".$_server['

java - How to set videoView inside Fragment in android -

how set videoview inside fragment. pushed a.mp4 file inside file explorer. 3 error shows 1. method findviewbyid(int) undefined type videos. 2. constructor mediacontroller(videos) undefined. 3. create method getwindowmanager(). please me how set videoview inside fragment. public class videos extends fragment { videoview video_player_view; surfaceview sur_view; mediacontroller media_controller; displaymetrics dm; public videos() {} @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.frag_videos, container, false); return rootview; } public void getinit() { video_player_view = (videoview)findviewbyid(r.id.videoview1); media_controller = new mediacontroller(this); dm = new displaymetrics(); this.getwindowmanager().getdefaultdisplay().getmetrics(dm); int height = dm.heightpixel

android - SharedPreferences getString returns null though set by editor in AsyncTask -

i have loginactivity calls asynctask post username , password server , on response, write username sharedpreferences (can retrieve username sp here) , return may app's mainactivity . however, retrieve username sp in mainactivity , null . did wrong? asynctask code: //activity context passed loginactivity (using "this") protected void onpostexecute(string result) { if(result!=null){ try { jsontokener jsonparser = new jsontokener(result); jsonobject msg = (jsonobject) jsonparser.nextvalue(); string data=msg.getstring("data"); int code=integer.parseint(msg.getstring("code")); if(code==0){ //write local storage sharedpreferences settings = activity.getpreferences(context.mode_private); sharedpreferences.editor editor = settings.edit(); jsontokener dataparser = new jsontokener(data); jsonobject

How to save Paypal credit card transaction details into database using php? -

i want store payment transaction details(e.g., transaction_id , payment amount , payment status, date , userid etc.) after payment credit card on paypal , database same stores transaction details paypal. i have searched haven't found solution. please suggest me right solutions. thanks in advance! you can check out sample apps e.g. in node https://github.com/paypal/rest-api-sample-app-nodejs (samples apps there rails, php, java, dotnet, python) full on application built using paypal rest apis , databases used. should you.

c# - i m getting Error in in Repeater with in Repeater in Data Source -

<b><%# databinder.eval(container.dataitem, "hotel_floorid")%></b> <b><%# databinder.eval(container.dataitem, "hotel_floorname")%></b> <br> <asp:repeater id="childrepeater" runat="server" datasource='<%# ((datarowview)container.dataitem).row.getchildrows ("myrelation") %>' > <itemtemplate> <%# databinder.eval(container.dataitem, "[\"roomdoorno\"]")%><br> </itemtemplate> </asp:repeater> </itemtemplate> protected void page_load(object sender, eventargs e) { string css = configurationmanager.connectionstrings["cs"].connectionstring; sqlconnection cnn = new sqlconnection(css); cnn.open(); sqldataadapter cmd1 = new sqldataadapter("select * hm_hotel_floor", cnn); dataset ds = new dataset(); cmd1.fill(ds

python - Send method to subprocess -

i'm implementing process pool using twisted. ultimate goal simple defertoprocess function, defertothread. i'm aware of ampoule module, i'm avoiding because it's apparently not maintained, because requires amp subclasses, , because i'm interested in writing anyway. i want able call arbitrary static function in current project defertoprocess. twisted creates arbitrary process, got invoke current python interpreter, duplicated import path. find module level function determine module function resides in, import module , call function. occurred me might tricky pass function reference say, static class method or lambda. to figure out options were, took @ python's multiprocessing module. tried worked perfectly, reference global object in parent process. >>> class test(object): ... @staticmethod ... def test(): ... print 'found it!' ... >>> p = multiprocessing.process(target=test.test, args=()) >>> p.start

How to replicate, for DR purposes, a Greenplum DB to another data centre? -

we planning large greenplum db (growing 10 100tb on first 18 months). traditional backup , restore tools aren't going have 24hr rpo/rtos deal with. there way replicate db across our dr site without resorting block replication (i.e. place segment on san , mirror)? you've got number of options choose: dual etl. replicate input data , run same etl on 2 sites. synchronize them backup-restore every week or so backup-restore. simple backup-restore can not efficient. if use datadomain can perform deduplication on block level , store changed blocks. can offload deduplication task run on greenplum cluster (ddboost). in case of replication remote site replicate changed blocks, reduce replication time. in experience, if clean backup on dd takes 12 hours, subsequent ddboost backup take 4 hours + 4 hours replicate data custom solution. know case when data replicatioin remote site made part of etl process. etl job know tables changed, added replication queue , moved remote

php - How to keep form data even after submiting not to dispear -

in this <form method="post" action=""> <input type="text" class="field small-field" name="tex1" /> <input type="submit" value="search" name="search"/> <input type="submit" value="print" name="print"/> </form> after submit form, page refreshes , data inside input texts gets blank is possible keep data after submit? regards. try echo, ever variable named input. <form method="post" action=""> <input type="text" class="field small-field" name="tex1" value="<?php echo $_post['tex1'];?>" /> <input type="submit" value="search" name="search"/> <input type="submit" value="print" name="print"/> </form>

optimization - Optimizing pages from side of javascript -

i need know 2 things. looking on google not found good. first thing is: location of scripts in structure of documents. can explain me what's going on? how works optimize pages , should put scripts? second thing is: packing , compressing js code. i find packers in google this: http://dean.edwards.name/packer/ how work? writen scripts should pack? please explanation or link article. concerning first point, 1 answer @ one: https://stackoverflow.com/a/24070373/1145461 concerning 2nd point, link help: http://en.wikipedia.org/wiki/minification_(programming)

php - Separate MySQL query results by month -

the situation i have mysql database table many dates in it. now need create table tableentries should this: may | | 22.05.2014 | person 1 | person 2 23.05.2014 | person 1 | person 2 june | | 02.06.2014 | person 1 | person 2 25.06.2014 | person 1 | person 2 etc.. the code i trying create loop through query results so. , right there stuck. i having this: in "while" (fetch assoc) loop have this: while ($row = $stmt->fetch(pdo::fetch_assoc)) { $date = $row['pp_date']; $month = date('m', strtotime($date)); $entryarray = array(); } you can see, first save month of date array. , don't know, how create array hold rows each month in array output result table. i assume table report 1 year. if so, can use month index key on array. $table = array(); while ($row = $stmt->fetch(pdo::fetch_assoc)) { $month = date('m', strtotime($row['pp_date'])); if(!isset($table[$month])

Cannot reproduce the first example from XML library in R -

when run: example(readhtmltable) i following error: error: failed load http resource library xml installed , running. session info: > sessioninfo() r version 3.1.1 (2014-07-10) platform: x86_64-w64-mingw32/x64 (64-bit) locale: [1] lc_collate=english_united states.1252 lc_ctype=english_united states.1252 [3] lc_monetary=english_united states.1252 lc_numeric=c [5] lc_time=english_united states.1252 attached base packages: [1] stats graphics grdevices utils datasets methods base other attached packages: [1] reshape2_1.4 ggplot2_1.0.0 xml_3.98-1.1 dplyr_0.2 loaded via namespace (and not attached): [1] assertthat_0.1 colorspace_1.2-4 digest_0.6.4 grid_3.1.1 gtable_0.1.2 [6] magrittr_1.0.1 mass_7.3-33 munsell_0.4.2 parallel_3.1.1 plyr_1.8.1 [11] proto_0.3-10 rcpp_0.11.2 scales_0.2.4 stringr_0.6.2 tools_3.1.1 do need install additional libraries? wh

ruby on rails - Paperclip is not generating url properly for CNAME -

i'm tying cloudfront distribution wired custom domain paperclip it's not generating url properly. here configuration: # initializers/paperclip_defaults.rb paperclip::attachment.default_options.merge!({ :storage => :s3, :s3_credentials => "#{rails.root}/config/amazon_s3.yml", :bucket => "my-image-bucket", :path => "production/attachments/:attachment/:id/:style/:basename.:extension", :url => ":s3_host_alias", :s3_headers => {'cache-control' => 'max-age=2147483648'}, :s3_protocol => :https, :s3_host_alias => "cdn.mydomain.com", }) according docs , every blog post i've read should correct. problem winds generating this: https://s3.amazonaws.com/my-image-bucket/production/products/images/44/original/my-image.jpg the way i've gotten use cname specifying s3_host_name according documentation used tokyo region. , breaks uploads. ideas i'm doing wrong? i

android - Generating token to access google account -

i've problem generating second token in application. registered 2 accounts on phone. when use first account token generating, when choose second token isn't generated. code: accountmanager.getauthtokenbyfeatures("com.google", "manage tasks", null, this, bundle.empty, bundle.empty, new accountmanagercallback<bundle>() { @override public void run(accountmanagerfuture<bundle> bundleaccountmanagerfuture) { try { string token = bundleaccountmanagerfuture.getresult() .getstring(accountmanager.key_authtoken); log.e("token", token); } catch (authenticatorexception e) { e.printstacktrace();

r - data.table column name and definition defined by variable -

this question has answer here: assign multiple columns using := in data.table, group 1 answer how create data.table column, name , column definition determined variable? in case, data.table looks like dt <- data.table(deltapaid = c(1,2,4,8)) dt deltapaid 1: 1 2: 2 3: 4 4: 8 now, if variable cap passed 3.... cap <- 3 dt[, deltapaid.capped.3:=pmin(3, deltapaid)] dt deltapaid deltapaid.capped.3 1: 1 1 2: 2 2 3: 4 3 4: 8 3 in other words, column name paste("deltapaid.capped.",cap,sep="") , column definition paste(":=pmin(",cap,", deltapaid)",sep="") . i tried dt <- data.table(deltapaid = c(1,2,4,8)) cap <- 3 expr <- paste("deltapaid.capped.",cap

java - Need help making a Fortune Telling program using eclipse -

this fortune telling program based on origami fortune teller elementary kids used. person had choose number displayed inside fortune teller. chosen number counted out opening , closing fortune teller. person chose number available numbers on display inside fortune teller (they may or may not have been same numbers before) again counted out. final number chosen , fortune under flap read! design , create fortune telling program works follows: generate number between 0 , 2 , allow user choose number, number plus 1 or number plus 2 (in other words 1 of 3 consecutive numbers starting randomly chosen number) generate number (0-2) , based on number display 3 colors (of possible 4 colors) choose based on number , color combination selected, tell user fortune. some requirements: choices must random color combination must random first input must number, second must color. make sure type these user variables appropriately. type has ramifications on if /sw

How to programatically detect if an app supports Android Wear? -

im trying detect if app supports android wear or watch face. packagemanager pm = getactivity().getpackagemanager(); list<packageinfo> packs = pm.getinstalledpackages(0); (int = 0; < packs.size(); i++) {} is code im using. feedback or suggestions awsome! to check if android wear package exists on system: public void foobar() { boolean doesexist = ispackageinstalled("com.google.android.wearable.app"); } private boolean ispackageinstalled(string packagename) { packagemanager pm = getapplicationcontext().getpackagemanager(); try { pm.getpackageinfo(packagename, packagemanager.get_activities); return true; } catch (namenotfoundexception e) { //swallow exception return false; } }

scala - Type dependent implicits -

two implicits needed in function, can't have them in same parameter list, because dependent method type . considered currying once more, gives me syntax error. what's correct way this? def add[a](newannotations: seq[a]) (implicit maybeadd: maybeadd[l, seq[a]]) (implicit mod: modifier[maybeadd.out, seq[a], seq[a]]): slab[content, maybeadd.out] = { val l = maybeadd(annotations, seq[a]()) l.updatewith(_ ++ newannotations) } i edited maybeadd have aux type, suggested @milessabin. def add[a, out0](newannotations: seq[a])(implicit maybeadd: maybeadd.aux[l, seq[a], out0], mod: modifier[out0, seq[a], seq[a]]): slab[content, mod.out] = { val l = maybeadd(annotations, seq[a]()) new slab(content, mod(l, _ ++ newannotations)) }

c# - Use the MediaElement cause the error "The background audio resources are no longer available." -

in app, have use audioplaybackagent (apa) , mediaelement. used apa play songs , , when need play video, use mediaelement when navigate page use mediaelement, stop backgroundaudioplayer: backgroundaudioplayer.instance.pause(); when navigate page need play music, call apa start again, return exception "the background audio resources no longer available." :( protected override void onnavigatedto(navigationeventargs e) { base.onnavigatedto(e); try { if (backgroundaudioplayer.instance.playerstate != playstate.playing) backgroundaudioplayer.instance.play(); } catch { backgroundaudioplayer.instance.play(); } } i can use mediaplayerlauncher , solution has many disvantage (only fullscreen, lack of custom control ...). there way make media element work along audioplaybackagent, or other way playing video ??? this occurs because dat

windbg - Getting exit code of a terminated process -

i'm debugging process in windbg, , process exited: 0:009> g (bunch of regs...) ntdll!ntterminateprocess+0xc: 770ad43c c20800 ret 8 0:009> g ^ no runnable debuggees error in 'g' at point, how process' exit code? you find second argument of zwterminateprocess . ntterminateprocess kernel version of it, right? 0:000> kb childebp retaddr args child 003ff414 7774d5ac ffffffff 1234abcd 00000000 ntdll!zwterminateprocess+0x12 003ff430 759c79ec 00000000 77e8f3b0 ffffffff ntdll!rtlexituserprocess+0x85 ... or fourth parameter of rtlexituserprocess 0:000> kn # childebp retaddr 00 003ff414 7774d5ac ntdll!zwterminateprocess+0x12 01 003ff430 759c79ec ntdll!rtlexituserprocess+0x85 ... 0:000> .frame 01 01 003ff430 759c79ec ntdll!rtlexituserprocess+0x85 0:000> dd esp l4 003ff414 7771fcc2 7774d5ac ffffffff 1234abcd

c# - How to read xml from web response? -

i trying read xml web response , selected nodes (i.e link) it. have far , showing "system.xml.xmlelement" , output. wrequest method, sends post request url using web request , returns string xml response such as: <status> <code>201</code> <resources_created> <link href="####" rel="############" title="####" /> </resources_created> <warnings> <warning>display_date read-only</warning> </warnings> </status> readuri2 method public static string readuri2() { string uri = ""; string xml = wrequest(); xmldocument xmldoc = new xmldocument(); xmldoc.loadxml(xml); xmlnode elem = xmldoc.documentelement.firstchild; uri = elem.tostring(); return uri; } pageload calls protected void page_load(object sender, eventargs e) { string uri = readuri2(); label1.text = server.htmlenc

jsf - Create a custom commandButton and Input components -

i'm trying implement custom js2 command button using uicommand latest html5 attributes. but, how can handles action , actionlistener attribues? uicommand save thier values, done jsf2 runtime, how can know methode of bean should excute after button activation user in renderer class @ 'encodebegin methode'. source code primefaces commandbuton renderer class, available here complicated. in opinion, need extend class (commandbutton or commandbuttonrendered) , override methods not work want. commandbuttonrenderer: import javax.faces.component.uicomponent; import javax.faces.context.facescontext; import org.primefaces.component.commandbutton.commandbuttonrenderer; /** * * @author nuno_marinho */ public class mycommandbuttonrenderer extends commandbuttonrenderer { @override ... } or commandbutton: import javax.faces.component.uicomponent; import javax.faces.context.facescontext; import org.primefaces.component.commandbutton.commandbuttonrenderer

REST URLs that don't list items -

is okay use url /users/:user_id in rest api if there should no possibility list users /users ? if "yes" should /users return 404 or empty list? rest has defined constraints. can read them in fielding dissertation . there no constraint how design uri structure, because clients have decoupled it. not rest concern. to short can have nice uris , use custom conventions build them. have aware few things only: a single uri can identify single resource (but single resource can have multiple different uris) - uniform interface constraint / identifying resources the uri path hierarchical query non-hierarchical - uri standard (it can subjective hierarchical , not) the query part of uri (but can have own routing convention, example path can identify resource , query can describe representation details) the uris mapped resources , not operations (as soap), if human readable uri contains verb, uri mapping flawed if "yes" should /users return 404 o

c++ - Operator Error in Visual Studio (error C2784) -

i having problem of operators. operators in search , deleteword. in search i'm trying check word in list matches search word. in deleteword i'm trying check word want delete matches word in list , delete it. i've looked how fix operator don't understand. thank in advance. some errors: error 1 error c2784: 'bool std::opeator >=(const std::basic_string<_elem,_traits,_alloc> &,const_elem*): not deduce template argument 'const_elem*' 'const linkedlist' error 2 error c2784: 'bool std::operator >=(const _elem *,const std::basic_string<_elem,_traits,_alloc> &)' : not deduce template argument 'const _elem *' 'std::string' error 3 error c2784: 'bool std::operator >=(const std::basic_string<_elem,_traits,_alloc> &,const std::basic_string<_elem,_traits,_alloc> &)' : not deduce template argument 'const std::basic_string<_elem,_traits,_alloc> &

c# - Get parent device -

i have 2 usb device ids, e.g. usb\vid_e4f1&pid_0661\00000115fa9ce7750000000000000000 , usb\vid_e4f1&pid_0661&mi_00\7&b5a5ddf&0&0000 how verify device #2 direct child of device #1 (physically they’re different parts of same usb composite device)? in real-life scenarios many of them connected same usb controller. moreover, it's possible they'll of same maker , model. that's why cant verify vid, pid, , use win32_usbcontrollerdevice wmi query verify they're plugged same usb controller - need somehow verify parent-child relation, not fact they're plugged same controller. if matters, need support windows 8+. the pnp configuration manager api friend here: cm_locate_devnode opens device handle given device id; cm_get_parent finds parent device; cm_get_device_id_size , cm_get_device_id take device handle , return device id.

html - Extracting value from a div sent in to javascript -

im attempting id of specific box call. <div id="box1" onmouseover="transition(box1)" onmouseout="detransition(box1)"> <div class="box1-smallbox"> </div> function transition(prop){ document.getelementsbytagname(prop + "-smallbox").style.marginleft = x; } i want prop = box1. easy system can used 10 or 20 boxes. thanks in advance! without jquery, javascript: <div id="box1" onmouseover="transition(this.id)" onmouseout="detransition(this.id)"> <div class="box1-smallbox">aaa</div> </div> <div id="box2" onmouseover="transition(this.id)" onmouseout="detransition(this.id)"> <div class="box2-smallbox">bbb</div> </div> <div id="box3" onmouseover="transition(this.id)" onmouseout="detransition(this.id)"> <div class="b