Posts

Showing posts from January, 2014

servlets - how to properly call a java function from a ftl file in ofbiz? -

i think have done necessary splicing me allow gui invoke java method. this ftl file process should start, on widget screens xml file , displaying contents i'm not sure of parameters used here proper call java class <form action="<@ofbizurl>methodtoinvoke</@ofbizurl>" method="post"> <input type="submit" value="id"></input> <input type="text" name="input"></input> </form> and code on controller <request-map uri="methodtoinvoke"> <security https="true" auth="true"/> <event type="java" path="com.report.someclass" invoke="methodtoinvoke"/> <response name="success" type="view" value="reports" /> <response name="error" type="view" value="reports" /> </request-map> when run application , hit b

ios - animation on alert box -

i have alert box , apply below animation when "appears": scale 0.94 1.0 opacity 0 1 time 0.50ms x1: 0.48, y1: 0.44, x2: 0.01, y2: 1.2 can guide on how achieve in swift ? code: self.view.alpha = 0 uiview.animatewithduration(0.05, animations: { () -> void in self.view.alpha = 1.0 }, thanks. self.view.frame.origin = cgpoint(x: 0.48, y: 0.44) self.view.layer.transform = catransform3dmakescale(0.94, 0.94, 1) self.view.alpha = 0 uiview.animatewithduration(0.05, animations: { () -> void in self.view.layer.transform = cgaffinetransformidentity self.view.alpha = 1.0 self.view.frame.origin = cgpoint(x: 0.01, y: 1.2) self.view.layoutifneeded() })

How to customize the related videos that appears after the video stops in youtube ? -

is possible control(to show own list of video) related video thumbnails shown after video completed ? if create official "playlist" on youtube can control order of max 200 videos. you embed playlist-code list.

php - Uploading images inside array not working -

i want upload multiple images. img[] contains image files uploaded.the values inserted database imploded commas(,) .but images not uploaded specified folder named photos . <input type="file" name="img[]" id="img[]" /> $n=$_files["img"]["name"]; $t=$_files["img"]["tmp_name"]; $image=implode(",",$n); $ex=explode(",",$image); $i=0; foreach($ex $item) { move_uploaded_file($_files["img[$i]"]["tmp_name"],"photos/$ex[$i]"); $i++; } i think correct code should <input type="file" name="img[]" id="img[]" /> $n=$_files["img"]["name"]; $t=$_files["img"]["tmp_name"]; $image=implode(",",$n); // no need explode here foreach($n $key=>$item) { //name there in $items

perl to hardcode a static value in a field -

i still learning perl , have got program written. question, simple may be, if want hardcode string field below that? thank :). $out[45]="vus"; in other lines use below define values passed `$[out], 1 in question hardcoded , others come split. @vals = split/\t/; # splits line @ tabs @mutations=split/,/,$vals[9]; # splits on comma create array of mutations ($gene,$transcript,$exon,$coding,$aa); (@mutations) { ($gene,$transcript,$exon,$coding,$aa) = split/\:/; # takes col ab , splits @ colons grep {$transcript eq $_} keys %nms or next; } @out=($.,@colsleft,$_,@colsright); $out[2]=$gene; $out[3]=$nms{$transcript}; $out[4]=$transcript; $out[15]=$coding; $out[17]=$aa; your line of code: $out[45]="vus"; correct in defining 46th element of array @out string, "vus". trying understand code, why want that? usually, better practice not hardcode if @ possible. want make goal make program dyna

ios - Error during storing values in plist file -

i have stepper, during change of value need store values in plist. so according saveappplist method need pass nsmutabledictionary changed file -> dictdata nsdata *plistdata = [nspropertylistserialization datafrompropertylist:dictdata format:nspropertylistxmlformat_v1_0 errordescription:&error]; if(plistdata) { [plistdata writetofile:plistpath atomically:yes]; } and here method stepper: -(void)changeitemquantityatrow:(int)row tovalue:(double)value { nsmutabledictionary *item = [[items objectatindex:row] mutablecopy]; [item setobject:[nsnumber numberwithdouble:value] forkey:@"quantity"]; [items setobject:item atindexedsubscript:row]; nslog(@"%@", items); nsmutabledictionary *plistdict = [nsdictionary dictionarywithobjects:items forkeys:[nsarray arraywithobjects:@"name", @"price", @"quantity", nil]]; nslog(@"%@", plistdict); [self saveappplist:plistdict]; }

javascript - Hide comments from certain users? -

i'm using chrome extension web override few things , works great. right i'm trying hide comments users on stack overflow doesn't seem working. think it's way comments loaded. here javascript: $(function() { $('.comment-user:contains("devilsadvocate")').closest('.comment').hide(); }); if paste $('.comment-user:contains("devilsadvocate")').closest('.comment').hide(); console, hide comments, not when load page normally. one possible solution use mutationobserver() . this allow listen changes on comments section , react them accordingly. rough implementation can seen below. create observer , provide hide functionality hide of pertinent comments every time there mutation. then tell observer watch comments section of posts. i'm sure can write more jquery way of doing this. right cares first .comments section finds. listen child changes, attribute changes, , subtree changes well. var

Update multiple oval coordinates on canvas in python using tkinter -

i working on gui animate coin flips 1 @ time continuously. have 2 classes cointoss.py , flipbell.py. cointoss class generates value change coins , flipbell used animate process. as if have code working animate 1 coin @ time not coins @ time. when coins logic: first 1 coin comes down according value change, next 1 comes down first coin value gets updated accordingly , on. i need how move forward have tried far. have used loops animate process , thinking of using recursive method have logic part. any existing code or ideas move forward great. flipbell.py from tkinter import tk, canvas, button, w, e import random math import pi, sin, cos cointoss import * class flipbell(object): """ gui simulate cointoss. """ def __init__(self, wdw, dimension, increment, delay): """ determines layout of gui. wdw : top level widget, main window, dimension : determines size of canvas, inc

ios - xml downloading iphone -

i getting errors in downloading xml file url. downloading xml file starting of xml file starts line 2. should start line number 1. like : 1 2 <?xml version="1.0" encoding="utf-8"?> 3 <jobspecs> because of not able parse xml file. tried replace space string replacing it's not working stringbyreplacingoccurrencesofstring:@" "withstring:@"" thanks.

Query physical memory on domain computers using powershell v3.0 -

i have been beating head against can find query simple wmiobject; physicalmemory; however, need @ root level in domain. since trying @ root level, can suggest weather or not idea (is pinging going issue?). additionally, 1) can query client machine (my laptop w7 x64)? 2) can please provide me easy way query physical memory on domain computer accounts? to this, need network access machines, permission access wmi , patience. if domain 3 10 machines, should ok. if need more, suggest looking jobs get-help about_jobs this short script creates list of computers in domain physical memory in gb import-module activedirectory $computers = get-adcomputer -filter * | select dnshostname,name,distinguishedname foreach ($computer in $computers){ $w32system = get-wmiobject win32_computersystem -computer $computer.dnshostname $computer | add-member -name "physicalmemory" -value ($w32system.totalphysicalmemory/1gb) -membertype noteproperty } $computers

c++ - Can I compile remotely with Putty and sublime? -

is there way compile programs remotely on linux putty , sublime? i'm running windows , c++ compiler different programs graded on how run when compiled on server. i use winscp copy files unix box compile / run if editing on windows. or use pscp (part of putty not graphical) https://winscp.net/eng/download.php

How to automatically insert braces after starting a code block in vim? -

it's easy insert closing brace after typing opening one: inoremap { {<cr>}<esc>ko this way if (true) { converts to if (true) { | } but i'd save time , type 1 character less: if (true)<cr> so i'd create following rule: if return pressed , line starts if/for/while, execute {<cr>}<esc>ko is doable? thanks building on previous mapping, should want: inoremap )<cr> ) {<cr>}<esc>ko however, should try snippet expansion plugin snipmate or ultisnips. both plugins allow define snippets placeholders , miroring (lots of them included default) expanded when <tab> pressed after trigger. for example, have snippet associated trigger if expands into: if ([condition]) { } condition selected, ready type, and, once done, can hit <tab> again jump cursor between curly braces, ready type: if (myvar == 5) { | } this incredibly handy.

iphone - NSDateformatter Incorrect Time after daylight saving hours -

i have function produces current date depending on users location. provides correct date , time after daylight saving changes here in uk. however when try create string date seems add hour on me... e.g date stored in coredata 1/3/2013 12:00 when converted string appears 1/3/2013 13:00. ever change locale , timezones don't seem make difference. any ideas how can fix this? might worth noting "local date" function have never creates date time correct timezone. code: +(nsdate*)localdate{ nsdate* date = [nsdate date]; nstimezone* sourcetimezone = [nstimezone timezonewithabbreviation:@"gmt"]; nstimezone* destinationtimezone = [nstimezone localtimezone]; nsinteger sourcegmtoffset = [sourcetimezone secondsfromgmtfordate:date]; nsinteger destinationgmtoffset = [destinationtimezone secondsfromgmtfordate:date]; nstimeinterval interval = destinationgmtoffset - sourcegmtoffset; return [nsdate datewithtimeinterval:interval sincedate:date]; } formatted cod

multithreading - QT -> how to kill thread if thread is consuming all resources and doesnt allow slot to execute -

i working on qt 5.5 , have created seperate thread uses 3rd party library apis. api function when executes consumes resources , not allow other function execute in thread. this new thread starts click of button "start" , not know how stop or kill thread when press stop button. below sample example threadworking = new qthread(); workheavy = new workinghard; workheavy->movetothread( threadworking ); connect( threadworking, signal( started() ), workheavy, slot( slotstartstream() ) ); connect( workheavy, signal( sigstopstream() ), threadworking, slot( quit() ) ); connect( workheavy, signal( sigstopstream() ), workheavy, slot(deletelater() ) ); connect( threadworking, signal( finished() ), threadworking, slot(deletelater() ) ); connect( workheavy, signal( sigstartstream() ), this, slot( slottruestreamrun() ) ); connect( workheavy, signal( sigstopstream() ), this,

ios - What state my app will enter into when device receiving alerts (alert view) from other apps (e.g. calendar) -

while user playing app, there calendar alert (alert view) pop up. user need dismiss calendar alert app. before doing so, kind of state app running, or put in way, kind of event app receive know app "interrupted" app? i think want use applicationwillresignactive: . the docs : this method called let application know move active inactive state. can occur types of temporary interruptions (such incoming phone call or sms message) or when user quits application , begins transition background state. application in inactive state continues run not dispatch incoming events responders.

java - How to utilize a switch statement in this instance? -

i'm writing program converts units (ex. oz & lb) new units of measurement (g & kg). going have user input unit want convert , value of original unit. set constants convert selected units. i'm having issue using switch statement determine conversion should use (oz ---> g, oz --->, etc). here's code: system.out.print("convert from: "); string origmeasure = input.nextline(); system.out.print("convert to: "); string newmeasure = input.nextline(); system.out.print("value: "); double value = input.nextdouble(); double newvalue = 0; final double oz_to_g = 28.3; final double oz_to_kg = 0.028; final double lb_to_g = 453.6; final double lb_to_kg = 0.045; final double in_to_mm = 25.4; final double in_to_cm = 2.54; final double in_to_m = 0.0254; final double ft_to_mm = 304.8; final double ft_to_cm = 30.48; final double ft_to_m = 0.3048; final string oz = &quo

R fitdistrplus : Issue in plotting - 'by' argument too much small -

i understand issue plotting fitdistrplus object: ftnb = trycatch(expr = fitdist(unlist(x[,ftr]),distr="nbinom",discrete = true), error = function(err) {}) if (class(ftnb) %in% c("fitdist")) { print(summary(ftnb)) plot(ftnb)) } the summary of distribution fit follows: fitting of distribution ' nbinom ' maximum likelihood parameters : estimate std. error size 5.915112e-01 na mu 1.330646e+11 na loglikelihood: -2543.973 aic: 5091.946 bic: 5097.074 correlation matrix: [1] na i not see fit, see "na" in standard errors of 2 parameter estimates. plot command comes following error, understand: error in seq.default(min(xval), max(xval), = 1) : 'by' argument small please help.

OpenGL mathematics (GLM) port for Java -

is there java port glm library ? i'm using lwjgl , i'm missing nice capabilities of glm. i have seen mention port in this answer, don't know how contact person wrote answer (no messages on stackoverflow, no possibility add comment closed question). porting glm java wouldn't make sense - "c++" library. this github repo (found googling "glm java port opengl matrix") claims "conceptual" port. mileage may vary.

compiling Poco-1.5.1 with MinGW -

i'm trying compile poco-1.5.1 mingw (gcc 4.7.0) under windows 7. it have std::copysign issues @ foundation\include\poco\fpenvironment_dummy.h, easy solve commenting "std::" @ copysignimpl methods. my next problem comes file "foundation\src\eventlogchannel.cpp", trying include "pocomsg.h", doesn't exist. i have read pocomsg.h generated pocomsg.mc script. mc message compiler microsoft, , not present in mingw system. should include manually pocomsg.h post? poco lib dosnt compile in vs express 9 is there better way solve this? thanks. pocomsg.h should found in ../foundation/src/ it doesn't contain important stuff according post , couple of defines: #define poco_ctg_fatal 0x00000001l #define poco_ctg_critical 0x00000002l #define poco_ctg_error 0x00000003l #define poco_ctg_warning 0x00000004l #define poco_ctg_notice 0x00000005l #define poc

jenkins - Parse HTML file using Python without external module -

i trying parse html file using python without using external module. reason triggering jenkins job , running import issues lxml , beautifulsoup (tried resolving , think somewhere doing on engineering stuff done) input : <tr class="test"> <td class="test"> <a href="a.html">ba</a> </td> <td class="duration"> 0.000s </td> <td class="zero number">0</td> <td class="zero number">0</td> <td class="zero number">0</td> <td class="passrate"> n/a </td> </tr> <tr class="test"> <td class="test"> <a href="o.html">aa</a> </td> <td class="duration"> 0.000s </td> <td class="zero number">0</td>

java - Tabbing order in eclipse form base editor plugin -

i working on form based plugin editor in eclipse. form contains 3 text fields , 1 table viewer , 4 button in same order. i want add support through keyboard "tab" button. order of tabbing ok when user moves 1 text field 2nd , next. when user moves to/from table viewer, tab button doesn't work expected. but til didn't write code handle tab ordering, can 1 tell me how implement behavior form. thanks in advance.. look @ below method on composite public void settablist (control [] tablist) ex: composite comp = new composite(parent,swt.none); comp.setlayout(new gridlayout(4,false)); button b1 = new button(comp,swt.none); b1.settext("button1"); button b2 = new button(comp,swt.none); b2.settext("button2"); button b3 = new button(comp,swt.none); b3.settext("button3"); button b4 = new button(comp,swt.none); b4.settext("button4"); comp.settablist(new control[]{b1,b3,b4,b2});

bash: Apostrophe in path -

on mac os x (bash 4.2), try cd folder apostrophe in path: cd "~/documents/study/new/beej's guide unix ipc_code/examples" then got -bash: cd: ~/documents/study/new/beej's guide unix ipc_code/examples: no such file or directory i tried escaping apostrophe this: cd "~/documents/study/new/beej\'s guide unix ipc_code/examples" with result: -bash: cd: ~/documents/study/new/beej\'s guide unix ipc_code/examples: no such file or directory the thing worked me hard escaping white spaces , apostrophe without double-quotes around this: cd ~/documents/study/new/beej\'s\ guide\ to\ unix\ ipc_code/examples in case, there way can avoid hard escaping @ all? the tilde ( ~ ) won't expanded inside quotes, need leave outside quotes. of these work: cd ~/"documents/study/new/beej's guide unix ipc_code/examples" cd ~/documents/study/new/"beej's guide unix ipc_code"/examples cd ~/documents/study/new/beej&q

php - I need to get sum of income for each user in January. Which of these 3 MySQL queries is more efficient? -

i need sum of income each user in january 2016 represented payments , commissions, not deposits. table of records looks (millions of records): username amount transaction date user_1 1 deposit #1 2015-12-12 23:19:00 user_2 2 payment #2 2015-12-23 13:45:00 user_2 7 commission #3 2016-01-04 23:45:00 user_1 1 payment #4 2016-01-09 20:25:00 user_3 2 payment #5 2016-01-17 02:42:00 user_1 3 commission #6 2016-01-23 18:30:00 user_3 2 deposit #5 2016-01-29 09:58:00 ... ... ... ... my 3 queries are: select username, sum( amount ) monthly_amount balance_history month( date ) = 1 , year( date ) = 2016 , (transaction 'payment%' or transaction 'commission%') group username or select username, sum( amount ) monthly_amount balance_history '2015-12-31 23:59:59' < date , date < '2016-02-01 00

In Endeca I want to have dgraph backups saved on dgraph server automatically after baseline update. -

how have 3 dgraphs backup saved automatically in dgraph server , not on itl server . default backup of dgidx output gets saved on itl server . want saved on dgraph server ie mdex host. please help. i don't believe there out-of-the-box option backing deployed dgidx output on target server. have gone through documentation ? question whether idea. consider deploying , 2 of 3 servers have gone through third 1 fails. need roll 2 of machines. central eac not know ones rollback , ones keep. however, keeping @ central point (ie. on itl server) in event of rollback push same backup out 3 servers. assuming trying speed deployment of large indices (endeca copies entire dgidx output each mdex), can @ performance tuning guide .

ios - Identify the touch moved direction -

i doing view resize,move , rotate on single touch. i trying find touch moved direction like, if touch moved direction horizontal or vertical move view. if touch moved direction diagonal resize. , if touch moved rotate gesture rotate view. i able identify horizontal or vertical direction. please suggest me how can identify diagonal , rotation. i guess rotation, can use mehod -(void)touchesmoved:(nsset *)touches withevent:(uievent *)event . and diagonal, can compare coordinates of both points. diagonal, can take post also.

jquery - How to filter data in ui-select directive -

i have create directive (wrapper) on ui-select ease customer. dropdown have 3 sections in values 1. teachers 2. subjects 3. students requirements: headings not selectable (should disabled) can select values under of sections dropdowns. can achieve. it should multi-selectable. user can select either, teacher, student or subject. works in visual studio. filtering when user types load data when user starts type in control. i have created plunk: http://plnkr.co/edit/nob1hhfvvwxzerhsamie code index.html <body ng-controller="maincontroller"> <h1>{{ message }}</h1> <div> <data-multi-select data-model="selecteddata"></data-multi-select> </div> </body> </html> script.js (function () { var app = angular.module('githubviewer', ['ui.select', 'ngsanitize']); var maincontroller = function ($scope) { $scope.selecteddata = []

variables - PHP Cookie Controls -

i working logic operator create cookie containing string of values depending on user's traffic path through website. on web page have following variable $lgc_code = '3' and cookie control set follows: if ($lgc_code != '') { $lgc=$lgc_code; // check cookie if (isset($_cookie['lgc_cntl'])) { // read cookie $lgc_codes=$_cookie['lgc_cntl']; // check triggers in cookie $expencarr = explode(",", $lgc_codes); foreach($expencarr $code){ if ($code==$lgc_code) {$found='yes';} } if (isset($found)) { $lgc_codes=$_cookie['lgc_cntl']; } else { $lgc_codes=$_cookie['lgc_cntl'].','.$lgc; } } else { $lgc_codes=$lgc; } // add campaign cookie setcookie('lgc_cntl',$lgc_codes,time() + (86400 * 365), "/", ".domain.com"); // 86400 = 1 day } else { $lgc = '1&

opengl - GL_FRAMEBUFFER_SRGB_EXT banding problems (gamma correction) -

Image
consider following code. imagedataf float*. in fact, code shows consist of float4 values created ray tracer. of course, color values in linear space , need them gamma corrected output on screen. can simple loop gamma correction of 2.2 (see loop). also, can use gl_framebuffer_srgb_ext, works correclty has "banding" problems. left using gl_framebuffer_srgb_ext, right manual gamma correction. right picture looks perfect. there may difficulties spot on monitors. have clue how fix problem? gamma correction "free" cpu version makes gui bit laggy. note actual ray tracing done in thread using gpu(optix) in fact fast in rendering performance. glboolean srgb = gl_false; glgetbooleanv( gl_framebuffer_srgb_capable_ext, &srgb ); if (srgb) { //glenable(gl_framebuffer_srgb_ext); } for(int = 0; < 768*768*4; i++) { imagedataf[i] = (float)powf(imagedataf[i], 1.0f/2.2f); } glpixelstorei(gl_unpack_alignment, 8); gldrawpixels( static_cast<glsizei>( buf

django - How do check an instance belongs to the login user? -

below how check model belongs user that's editing it. in views.py everything, it's bit repetitive, use lot! # if have instance check belongs login. if some_object.user != request.user: return httpresponseforbidden() so, i'm wondering how others address such functionality? have been thinking moving each on save method objects? could have examples (with code) of how django developers this, there must better wayfor checking user can edit what, right? i won't rush accepting answer, i'm interested in authoritative responses more experienced devs i'm new django. thank you. mixins work if using class based views... can create own doing class requireownershipmixin(object): def get_object(self, queryset=none): obj = super(requireownershipmixin, self).get_object(queryset) if obj.user != self.request.user: return none return obj and view this class updatesomeobjectview(requireowners

java - jUnit tests no longer runnable after upgrading from NetBeans 8.0 to 8.1 -

i have workspace builds open source jedit editor, worked fine in netbeans 8.0, , upgraded netbeans 8.1, , imported ide settings. when build project has new error: error: not find or load main class org.apache.tools.ant.taskdefs.optional.junit.junittestrunner ... c:\..\jedit-svn\build.xml:453: unit test(s) failed! see reports @ c:\users\warren\ideaprojects\jedit-svn\build/test/reports/index.html build failed (total time: 15 seconds) i have junit-4.12.jar , hamcrest-core-1.3.jar referenced in project classpath/jar-list. junit plugin netbeans installed. netbeans configuration pointing @ version of ant appears correct, , being used netbeans run build , test operations. everything works command prompt in windows ( ant test ), fails inside netbeans. the output window contains above message, index.html contains other weird error: class org.jedit.io.native2asciiencodingtest unknown error forked java vm exited abnormally. please note time in report not reflect time until vm ex

error running spring program-application context error -

i new spring , i'm trying execute program following error severe: exception sending context initialized event listener instance of class org.springframework.web.context.contextloaderlistener java.lang.nosuchmethoderror: org.springframework.web.context.configurablewebapplicationcontext.setid(ljava/lang/string;)v @ org.springframework.web.context.contextloader.createwebapplicationcontext(contextloader.java:273) @ org.springframework.web.context.contextloader.initwebapplicationcontext(contextloader.java:204) @ org.springframework.web.context.contextloaderlistener.contextinitialized(contextloaderlistener.java:47) @ org.apache.catalina.core.standardcontext.listenerstart(standardcontext.java:3843) @ org.apache.catalina.core.standardcontext.start(standardcontext.java:4350) @ org.apache.catalina.core.containerbase.start(containerbase.java:1045) @ org.apache.catalina.core.standardhost.start(standardhost.java:719) @ org.apache.catalina.core.containerbase.start(containerbase.java:1045)

security - Are there reason why web devs dont use CSRF for login pages -

i realized few production web applications running. diddnt have csrf protection login page. it after authentications csrf protection kicks in. i wondering if there reasons why developers/administrators this. due heavy load of tracking anonymous users? thinking out load. love hear of yall! cheers jiachen:) csrf involves silent exploits while user logged in browser (in tab lets say). if not, request not anything, or reveal attack popping login form. so, defend stupid web user harming themselves, yeah guess try carry anticsrf token. now, tell me how begin anticsrf protection again? how possibly post anticsrf token along login form first time? have land on / or else anticsrf token while receiving login page. site have login form straight in first landing page. hence browser cannot present anticsrf token on first request (cannot use cookies, because sent browser during attacking request). anyway, that's guess.

javascript - HTML5 Canvas bezier curves - background does not want to load -

is there able me script? see jsfiddle.net/7qmsz/3 . html: <canvas id="canvas" height="1000" width="1000" class="bezier" style="cursor: default;"></canvas> css: #canvas { position: absolute; left: 100px; top: 100px; background-color: rgba(255, 255, 255, 0.1); } javascript: (function() { var canvas; var ctx; var code; var point; var style; var drag = null; var dpoint; function init(quadratic) { point = { p1: { x:50, y:100 }, p2: { x:200, y:100 }, p3: { x:50 , y:100 }, p4: { x:200 , y:100 } }; if (quadratic) { point.cp1 = { x: 50, y: 50 }; point.cp3 = { x: 250, y: -110 }; } else { point.cp1 = { x: 50, y: 10 }; point.cp2 = { x: 200, y: 10 }; point.cp3 = { x: 50, y: 190 }; point.cp4 = { x: 200, y: 190 };

why isn't my parsing from JSON working in python -

with open('tweets.json') json_data: data = json.load(json_data) print(data['text']) i want extract specific data/values keep getting error: print(data['text']) typeerror: string indices must integers i beginner python , trying learn using twitter api this json: "{\"created_at\":\"wed feb 03 03:02:04 +0000 2016\",\"id\":694717462621884416,\"id_str\":\"694717462621884416\",\"text\":\"finallyy @taylorcaniff happy bday bae, love soooo much, keep smiling, i'm proud of you've done\\u2661 https:\\/\\/t.co\\/uwjeasxsa3\",\"source\":\"\\u003ca href=\\\"http:\\/\\/twitter.com\\/download\\/android\\\" rel=\\\"nofollow\\\"\\u003etwitter android\\u003c\\/a\\u003e\",\"truncated\":false,\"in_reply_to_status_id\":null,\"in_reply_to_status_id_str\":null,\"in_reply_to_user_id\":null,\"

iphone - UIProgressView Not DIsplaying -

i have uiprogressview want run on glkviewcontroller while rest of code being loaded ios. have placed uiprogressview 'viewdidload' method. uiprogressview not display until of code has been loaded viewdidload method. how can uiprogressview display viewdidload method called , end when viewdidload method finished? - (void)viewdidload { [super viewdidload]; // progress bar [threadprogressview setprogress: 0.0]; [self performselectoronmainthread:@selector(updateprogressbar) withobject:nil waituntildone:no]; // disbale iphone locking [[uiapplication sharedapplication] setidletimerdisabled: yes]; // set context use open gl es self.context = [[eaglcontext alloc] initwithapi:keaglrenderingapiopengles2]; if (!self.context) { nslog(@"failed create es context"); } // create view display open gl es content glkview *view = (glkview *)self.view; view.context = self.context; view.drawabledepthformat = glkvi

android - NullPointerException parsing JSON data -

i'm trying parse json, i'm using this example . in example in class parser not used secondary thread , networkonmainthreadexception . to solve problem have introduced code in asynctask not transfer data since error on line: contacts = json.getjsonarray(tag_contacts); this simple code using jsonparser.java public class jsonparser { static inputstream = null; static jsonobject jobj = null; static string json = ""; // constructor public jsonparser() { } public jsonobject getjsonfromurl(string url) { new parsejson().execute(url); return jobj; } private class parsejson extends asynctask<string, void, jsonobject>{ protected jsonobject doinbackground(string... params) { // making http request try { // defaulthttpclient defaulthttpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(param

java - eclipse run configurations can't find text file -

i trying set program read file though command line args[0]. set run configuration in "arguments" tab using .txt file name under "program arguments" can't find it. i've tried importing file source , adding files project folder. have no idea i'm doing wrong. code i'm using. i'm pretty new maybe it's obvious don't know. hope question makes sense. scanner input = null; string fn = null; try{ fn = args[0]; input = new scanner(new file(fn)); }

javascript - load html link into div -

i have list of links in div...when click on link want load link content in div in same page, here code : <div> <div> <div style="padding-bottom:20px;"> <center><img src="real.gif"></center> </div> <div> <div> <div style="padding-bottom:20px;"> <a href="history.html"><h3>history of club</h3></a> </div> <div style="padding-bottom:20px;"> <a href=""><h3>photos gallery</h3></a> </div> <div style="padding-bottom:20px;"> <a href=""><h3>hall of fame</h3></a> </div> <div style="padding-bottom:20px;"> <a href=""><h3>history of club</h3>

sqlite - Using sql to sum with multiple table calls -

i'll down point. have 3 tables structured follows: orders: i_id | o_id | quantity -----+--------+---------- 1 | 1 | 5 2 | 2 | 2 1 | 3 | 3 1 | 4 | 3 2 | 5 | 4 orderinfos: o_id | c_id ------+------------ 1 | 1 2 | 2 3 | 2 4 | 1 5 | 2 customers: c_id | name_id ----------+---------- 1 | 100001 2 | 100002 then resulting chart be: name_id | i_id | quantity -----------+----------+---------- 100001 | 1 | 8 100002 | 2 | 6 100002 | 1 | 3 so basically, have summary of (in case, orders) quantity, , each order has customer id , item name associated. resulting chart gives quantity per customer, per item, in descending order customer. first implementation this: select quantcust.custidname, quantcust.itemid, quantcust.quant (select o.i_id itemid, c.name_id custidname, sum(o.quantity) quant

android - Update ViewPager Based on Dynamic Data in Firebase -

Image
i creating polling app in realtime using firebase. every day, adding new polls firebase category have under directory polls > dates > respective date > poll 1, poll 2, poll 3. want update viewpager display polls current day. each poll have image, question, answer choices, total vote count, , several other components. basically, want viewpager display each poll particular day. manually update data in firebase, , hoping firebase listeners in client/java code can update data dynamically. polls each unique instance of homepollsfragment, , having difficulty changing individual fragments display in viewpager particular day. i trying handle changes in getitemposition() override method of fragmentstatepageradapter, , trying override "view comments" textview in included screenshot (i update else later, doing "view comments" simplicity). "view comments" state "test comments poll 1" first poll, , "test comments poll 2" second