Posts

Showing posts from June, 2010

netbeans - X3D Relative URL's -

so i'm developing x3d scene netbeans , x3d plugins (similar x3d-edit), after validating file built in quality assurance validator following error; <inline def='mymodel'/> url array address(es) missing online http/https references (url='"model.x3d"') [/x3d/scene/group/transform[1]/inline, info] it seems want online url refer inline node. question is, can somehow use relative url instead of online one? have tried using file:// protocol error when doing so; <inline def='mymodel'/> url array contains file:/ local address, not portable across web servers (url='"file://model.x3d"') [/x3d/scene/group/transform[2]/inline, warning] you cand find in vrml node reference: "the inline node grouping node reads children data location in world wide web" http://www.web3d.org/x3d/specifications/vrml/iso-iec-14772-vrml97/part1/nodesref.html#inline which means inline url cannot point local file yo

c++ - Prevent mixing of console output and written text -

Image
i have c++ console application prints output while accepts commands (using std::cin ) user - output , input happen in separate threads. if write text while output appears written text mixed application output. how can prevent behaviour? to solve problem, need display program one line above line text typed. i'd inspire myself in minecraft bukkit server's solution - need same c++. assuming want output appear while things being typed, you'll need screen control facilities have output go somewhere different input area. if tasked implement writing terminal refresh ncurses experience. realize on windows console , have no idea if windows console capable of screen control needed make happen. you can possibly tie custom stream buffers std::cin , std::cout using curses functionality under hood may not worth it. in case, isn't entirely trivial.

A bug in my simple python program of lcs -

import numpy np def lcs(i, j): global x, y, c if <= 0 or j <= 0: return 0 else: if c[i][j] < 0: if x[i - 1] == y[j - 1]: c[i][j] = lcs(i - 1, j - 1) + 1 else: m = lcs(i - 1, j) n = lcs(i, j - 1) print m, n c[i][j] = max(m, n) else: return c[i][j] c = np.zeros((8, 8), int) c = c - 1 x = 'abcbdab' y = 'bdcaba' lcs(7, 6) print c the program has bugs lookup 'm','n', the print results come 'none' ex: 0 0 0 none 0 none 0 none none none then program occur error: typeerror: long() argument must string or number, not 'nonetype' i don't know 'none' comes i'm newer, thanks i don't know 'none' comes if don't return anything, return value of python function none . in particular, don't return in if c[i][j] < 0: branch.

php - Copy as Curl in Chrome with POST says error 302 moved temporarily -

i'm trying out in shell curl before developing full app. need obtain information public site input in 2 lines of info , returns one-line response in browser. when enter in data in chrome, under chrome developer tools under network shows post command status '302 moved temporarily.' when run 'copy curl' data curl directly in shell receive " this document requested has moved temporarily. it's @ href="http....... url sending me same except http instead of https. there way can use curl this? if not there tools should examining? need dozens of similar sites. can using human emulation commands i'd prefer more stealthy doesn't launch browser windows. chrome data http://oi42.tinypic.com/2rxjiax.jpg since hasn't been answered yet, , got here looking solution problem had me stumped while maybe helps someone: i getting '302 moved temporarily' , re-direct on same resource trying post form had been populated editing. had set emai

java - Can I use specific method for dependency injection in ejb? -

for example have class gets dependecy in constructor, like class exampleservice() { private dependency dep; public exampleservice(dependency dep) { this.dep = dep; } } and dependecy class: class dependency { public static dependency getinstance() { return new dependency(); } private dependency() { /*constructor implementation here*/ } } i want inject result of dependency.getinstance() method exampleservice constructor @inject ejb annotation. possible? how? thankyou. in cdi producer method can static , using example, following work fine: class exampleservice() { private dependency dep; @inject public exampleservice(dependency dep) { this.dep = dep; } } class dependency { @produces public static dependency getinstance() { return new dependency(); } private dependency() { /*constructor implementation here*/ } } however, mentioned in comments

chromecast - Third party Google Cast devices -

is google cast open third party receiver devices (dial 1st-screen devices), or chromecast remain option? can expect smarttv makers natively support cast protocol, chromecast device not needed? as developer, have implement in order google cast device?

android - How to get values of all EditText inside a ListView -

i want values of edittext elements present inside listview. code : final listview editorlist = (listview) findviewbyid(r.id.editorlist); final editoradapter adapter = new editoradapter(context, data); editorlist.setadapter(adapter); button commitbutton = (button) findviewbyid(r.id.commit_button); commitbutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub try{ //system.out.println("size of list : " + editorlist.getchildcount()); for(int =0;i< data.size() ;i++){ system.out.println("size of list : " + data.size()); edittext value = adapter.getitem(i); string propertyvalue = value.gettext().tostring(); system.out.println("propertyvalue : " + propertyva

excel vba - VBA Open any workbook -

i have macro opens spreadsheet specific folder , saves output worksheet called sheet1 in workbook. macro works if file name called "myfile.xls" able run on file name must have "book2" worksheet. here code: dim source workbook dim output workbook dim sourcesheet worksheet dim outputsheet worksheet dim file string file = "c:\spreadsheets\myfile.xls" 'i handle files location' set output = thisworkbook output.activate if len(dir$(file)) > 0 set source = workbooks.open(file) set sourcesheet = source.worksheets("book2") 'must run if sheet called book2' set outputsheet = output.worksheets("sheet1") 'saves sheets new sheet called sheet1' end sub is trying? (tried , tested) sub sample() dim source workbook, output workbook dim sourcesheet worksheet, outputsheet worksheet dim file '~~> show dialog open excel file file = application.getopenfilename("excel file

c - Expected constant expression -

we have snippet of c codes below. solution cause of have been declared , initialize void fillprocess(void *unused, uint8 *stream, int len) { uint8 *waveptr; int waveleft=0; waveptr = wave.sound + wave.soundpos; waveleft = wave.soundlen - wave.soundpos; while ( waveleft <= len ) { /* process samples */ uint8 process_buf[waveleft]; sdl_memcpy(process_buf, waveptr, waveleft); /* processing here, e.g. */ /* processing audio samples in process_buf[*] */ // play processed audio samples sdl_memcpy(stream, process_buf, waveleft); stream += waveleft; len -= waveleft; // ready repeat play audio waveptr = wave.sound; waveleft = wave.soundlen; wave.soundpos = 0; } } getting 3 errors below error 1 error c2057: expected constant expression error 2 error c2466: cannot allocate array of constant size 0 error 3 error c2133: 'process_buf' : unknown size uint8 process_buf[waveleft

c++ - CUB (CUDA UnBound) equivalent of thrust::gather -

due performance issues thrust libraries (see this page more details), planning on re-factoring cuda application use cub instead of thrust. specifically, replace thrust::sort_by_key , thrust::inclusive_scan calls). in particular point in application need sort 3 arrays key. how did thrust: thrust::sort_by_key(key_iter, key_iter + numkeys, indices); thrust::gather_wrapper(indices, indices + numkeys, thrust::make_zip_iterator(thrust::make_tuple(values1ptr, values2ptr, values3ptr)), thrust::make_zip_iterator(thrust::make_tuple(valuesout1ptr, valuesout2ptr, valuesout3ptr)) ); where key iter thrust::device_ptr points keys want sort by indices point sequence (from 0 numkeys-1) in device memory values{1,2,3}ptr device_ptrs values want sort values{1,2,3}outptr device_ptrs sorted values with cub sortpairs function can sort single value buffer, not 3 in 1 shot. problem don't see cub "gather-like" utilities. suggestions? edit: i suppose im

fortran - Fortran90 wrong output -

i'm working on small program course in university , i'm finished somehow doesn't work want work. now, output file gravity1.dat should give me values unequal 0. doesnt... somewhere in last formula calculate g(surf), 1 of variables 0. if tried in power correct can't seem fix it. program gravity implicit none real(8) lx,ly,sx,sy,xsphere,ysphere,r,a,rho1,rho2,dx,g integer np,nel,nelx,nely,i,nnx,nny,j,counter,nsurf real(8),dimension(:),allocatable :: xcgrid real(8),dimension(:),allocatable :: ycgrid real(8),dimension(:),allocatable :: xgrid real(8),dimension(:),allocatable :: ygrid real(8),dimension(:),allocatable :: rho real(8),dimension(:),allocatable :: xsurf, gsurf real(8),dimension(:),allocatable :: ysurf nnx=11. nny=11. lx=10. ly=10. nelx=nnx-1. nely=nny-1. nel=nelx*nely np=nnx*nny sx=lx/nelx sy=ly/nely xsphere=5. ysphere=5. r=3. nsurf=7 !number of gravimeters dx=lx/(nsurf-1.) !========================================================== allocate(xgrid(np))

javascript - how to scroll to set the bottom of a DIV at the bottom of the screen (monitor) -

there div in website , height not fixed. when user moves mouse on image div appeared , display information image. there several images in grid format on page , every 1 has own information. images @ bottom of screen mouseover section of information div off screen. want automatically control situation , when section of div off screen scrollbar goes down until reaches bottom of div . this pseudo code not implement in jquery. calculate screenheight calculate divheight calculate divdistancefromtopofscreen if ( screenheight < divheight + divdistancefromtopofscreen ) then scroll down bottom of `div` if think algorithm right how can implement such thing? this should it. javascript: var top = $('.thediv').offset().top; // top of div relative document var div_height = $('.thediv').height(); // height of div window.scrollto(0, top + div_height); // scroll bottom of div references: jquery offset: http://api.jquery.com/offs

vagrant - Chef Solo Jetty Cookbook Attributes -

i'm having issue chef.json attributes in vagrantfile seem getting ignored/overwritten. environment: mac os x 10.8 host, ubuntu 12.04 guest virtualized in virtualbox 4.18. using berkshelf cookbook dependencies , opscode cookbooks of recipes. the box spinning fine, i'm trying configure more if downloaded jetty , un-tarred archive, rather bunch of symlinks /usr/share/jetty on filesystem way seems defaulting to. here's chef portion of vagrantfile: config.vm.provision :chef_solo |chef| chef.json = { :java => { :install_flavor => "oracle", :jdk_version => '7', :oracle => { :accept_oracle_license_terms => true } }, :jetty => { :port => '8080', :home => '/opt/jetty', :config_dir => '/opt/jetty/conf', :log_dir => '/opt/

java - Canvas and InputMap -

i'm building 2d game in java , decided use canvas on display images relevant current frame. i'm using canvas because i've heard more efficient in terms of time jpanel. true? also, add input game through key bindings since key listeners cause focus issues , lower level construct: keylistener not working after clicking button (see answer). there way use key bindings canvas? or use keylistener. you can't add keybindings awt.canvas, there isn't method implemented in api you can add keylistener change decision , use jpanel/jcomponent

C# using HttpWebRequest Post method doesn't work -

hey i'm trying figure out using httpwebrequest post request login page, yahoo mail, , examine returned page source. but using post method still got login page. here method: public static string getresponse(string surl, ref cookiecontainer cookies, string sparameters) { httpwebrequest httprequest = (httpwebrequest)webrequest.create(surl); httprequest.useragent = "mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.36 (khtml, gecko) chrome/29.0.1547.66 safari/537.36"; httprequest.cookiecontainer = cookies; httprequest.method = "post"; httprequest.contenttype = "application/x-www-form-urlencoded"; httprequest.contentlength = sparameters.length; httprequest.allowautoredirect = true; using (stream stream = httprequest.getrequeststream()) { stream.write(encoding.utf8.getbytes(sparameters), 0, sparameters.length); } httpwebresponse h

matlab - Converting to for loop -

how can convert code loop if add more forces , moments? lot code , computing unit vector , finding sum of forces in x direction, y direction , z direction , doing same moments. this 1 particular case want put in loop when new forces applied accounted for. any or nudge in right direction huge help! in advance. load ('inputdata.mat') a= zeros(6,6); b= zeros (6,1); % calculate force in x,y,z direction, sums them , puts them in b % vector positions 1,2,3 nf1=((forcedir(1,2))^2+(forcedir(1,3))^2+(forcedir(1,4))^2)^(1/2); f1i=(forcedir(1,2)/nf1)* forcedir(1,1); f1j=(forcedir(1,3)/nf1)* forcedir(1,1); f1k=(forcedir(1,4)/nf1)*forcedir(1,1); nf2= ((forcedir(2,2))^2+(forcedir(2,3))^2+(forcedir(2,4))^2)^(1/2); f2i=(forcedir(2,2)/nf2)* forcedir(2,1); f2j=(forcedir(2,3)/nf2)* forcedir(2,1); f2k=(forcedir(2,4)/nf2)* forcedir(2,1); b(1,1)= f1i+f2i; %external force in x b(2,1)= f1j+f2j; %external force in y b(3,1)= f1k+f2k; %external force in z % calculate moments i

java - Report back progress of long request on Google Appengine -

i'm working on implementing web application, google appengine backend, on expected behaviour follows: user selects couple of parameters complex analysis user presses 'start' an empty 'response' page returned user, processing continues the analysis somehow continues on server , partial results being computed shown / added in response page. i'm expecting total computation around 30-40 seconds (so way under 60 seconds required appengine). steps 1 , 2 trivial. know step 4 somehow completed using step ajax, i'm not sure how implement step 3. thanks! you can use task queue , datastore. need 3 handlers: the task handler, doing hard work. store progress in datastore. a handler starts task in background , returns 'blank' page a handler status note: page cannot blank. must have javascript on checks status. think true channel api too. anyway heres code in python: class longtaskstatus(ndb.model): is_complete = ndb.boolean

Jquery Set Interval does not work in Chrome -

i have issue slyding pictures on site. slides automatically while entering site. after 1st slide, 2nd slide not work automatcally, can check on site: http://happylife-travel.com function resetinterval () { clearinterval(gallerysliderinterval); gallerysliderinterval = setinterval(next, 3000); } function next () { $('.homepage_slider').animate({left: '-830px'}, 1000, function () { $('.homepage_slider').css({left: '0px'}).children(':first').remove().appendto($('.homepage_slider')); }); } function previous () { $('.homepage_slider').css({left: '-830px'}).children(':last').remove().prependto($('.homepage_slider')); $('.homepage_slider').animate({left: '0px'}, 1000); }

vba - Powershell - Get the cell location (e.g. B32) after running search for value in Excel document -

how the cell location of value once have confirmed exists after search? e.g. once script finds cell location "app name" in each sheet - want echoed out me $i=0 foreach ($b in $b_names) { $b = $b_names[$i] $sheet = $wb.worksheets.item($b) $range = $sheet.range("b1").entirecolumn $s = $range.find("app name") $i=$i+1 } thanks! two things try. message box [system.windows.forms.messagebox]::show("range found: $s.address().tostring()", "alert title") write-host write-host "range found: " $s.address().tostring()

query optimization - Instructing MySQL to apply WHERE clause to rows returned by previous WHERE clause -

i have following query: select dt_stamp claim_notes type_id = 0 , dt_stamp >= :dt_stamp , date( dt_stamp ) = :date , user_id = :user_id , note :click_to_call order dt_stamp limit 1 the claim_notes table has half million rows, query runs since has search against unindexed note column (which can't about). know when type_id , dt_stamp , , user_id conditions applied, i'll searching against 60 rows instead of half million. mysql doesn't seem apply these in order. i'd see if there's way tell mysql apply note :click_to_call condition rows meet former conditions it's not searching rows condition. what i've come this: select dt_stamp ( select * claim_notes type_id = 0 , dt_stamp >= :dt_stamp , date( dt_stamp ) = :date , user_id = :user_id

javascript - How to change the selected text in a drop down list in rails application based on a variable? -

i have select drop down box list of currencies. make easier users, want change default selected value in drop down when page loads based on user country (will use geoip gem that) writing ruby code: $country = geoip.geolocation(request.remote_ip, :precision => :country) how change selected value of drop down list box based on $country value? should javascript? or rails forms helper?? , code it? all need set <option> element has country selected='selected' . how depends on how built option list. for example, options_for_select takes selected element 2nd argument. options_for_select(['alpha', 'beta', 'gamma'], 'beta') # => <option value="alpha">alpha</option> # => <option value="beta" selected="selected">beta</option> # => <option value="gamma">gamma</option>

Gitlab without mail / let user sign up -

i'm having trouble getting mail setup work gitlab 6 want users able sign account , assign own password instead of receiving temporary password mail. changes i've made: /home/git/gitlab/config/gitlab.yml: `signup_enabled: true` but if access gitlab in browser it's still redirecting me "sign in" page , i'm not able "sign up" or register new account. there i'm missing? thanks! you have restart gitlab server after making change.

timer - AHK script for a timed autofire function -

goal of script: continually press numpad0 10 seconds each time hotkey pressed. current code: toggle = 0 #maxthreadsperhotkey 2 timertoggle: toggle := !toggle sleep 10000 toggle := !toggle f12:: settimer, timertoggle, -1 while toggle{ send {numpad0} sleep 100 } return at present, script run intended, once. attempting run again after first time nothing. missing? your script doesn't toggle variable correctly. here cleaner version of trying uses a_tickcount : f12::settimer, holdnumpad, -1 holdnumpad: kdown := a_tickcount while ((a_tickcount - kdown) < 10000) { send {numpad0} sleep 100 } return note pressing f12 while label running not have affect. edit: made settimer use -1 period run once, mcl.

algorithm - Generating random "break points" in a sequence a minimum distance from each other -

i have sequence n elements, randomly place k "break points" each @ least mindist away each other (and ends). example, n=9, k=2, mindist=2 , want generate 1 of following equal probability: [2 4][2 5][2 6][2 7][3 5][3 6][3 7][4 6][4 7][5 7] so far i've come with: placing 1 randomly, "disabling" required amount of nodes around it, picking random number, strikes me unefficient. i'm programming in matlab, language fine. i using initialize population genetic algorithms, have each of possabilities equally likely, ensure i'm covering whole search space. deterministically distributing break points not enough. here's function generates possible breakpoint combinations, can store them in list instead of printing them, , uniformly choose 1 of them: static void breakpointcombinations(list<int> possiblepositions, list<int> breakpointcombination, int remainingbreakpoints, int minspace, int currentpos) { if (remainingbreakpoi

node.js - EventEmitter implementation that allows you to get the listeners' results? -

i realise nodejs has powerful eventemitter constructor allows emit events. however, eventemitter missing way event emitter see listeners returned . this functionality after: e = new fantasticeventemitter(); e.on( 'event1', function( param1, param2, cb ){ console.log("first listener called...") cb( null, 10 ); }); e.on( 'event1', function( param2, param2, cb ){ console.log("ah, listener called!"); cb( null, 20 ); }); e.emit( 'event1', 'firstparameter', 'secondparameter', function( err, res ){ console.log("event emitted, res [ 10, 20]"); }); basically, want listeners able register, getting called when event fired up, and : listeners passed callback parameter. callback "collect" results emitters have callback, called result collections is there library already, before reinvent wheel? there no easy way it. allow asked for, wrote guthub module: eventemittercollector .

ruby on rails - Devise Invitable send different emails based on the type of user -

i using devise_invitable in previous versions send different invitation emails different user roles. example, admin user sent different invitation regular user. send different emails users did following: @user = user.invite!(params[:user], current_user) |u| u.skip_invitation = true end if params[:admin_id] # admin invite @user.deliver_invitation email = notificationmailer.admin_invite_message(@user, @venue, @from, @subject, @content) else @user.deliver_invitation notificationmailer.user_invite_message(@user, @from, @subject, @content) end this type of approach gives great deal of flexibility. newest changes way token generate (see below), no longer possible use approach. # generates new random token invitation, , stores time # token being generated def generate_invitation_token raw, enc = devise.token_generator.generate(self.class, :invitation_token) @raw_invitation_token = raw self.invitation_token = enc end using resource.invitation_token yields encryp

c++ - Pseudocode for date function definition -

pseudocode recieved: date& operator++(){ //add 1 d //tomorrow, unless @ end of month //if is_date false // //need change first of next month // set d 1 // if m december // //need change next year // set m january // increment y // else // increment m return *this; } my interpretation: date& date::operator++(){ if (is_date==false){ m=m+1; d=1; } if (m==dec && d==29){ m=jan; y=y+1; } else{ m=m+1; } d=d+1; } does ok? i'm doing hw assignment based off of stroustrups book. needed verification let's increment 2010-03-10 : if (is_date==false){ m=m+1; d=1; } we assume is_date true, no action happens. if (m==dec && d==29){ m=jan; y=y+1; } m not dec , d not 29, no action happens. else{ m=m+1;

jquery - How to Apply CSS to element added by Javascript -

in application applying css onload , appending html using jquery! problem css not being applied newly added element. how can make sure css applied newly appended html? please have @ jsfiddle html: <body onload="loaded()"> <div id="a"> <div class="main">a</div> <div class="main">b</div> <div class="main">c</div> <div class="main">d</div> </div> <input type="button" value="click me" onclick="clickme()" /> </body> javascript: function loaded() { var posts = $('.main'), postcount = posts.length, posthalf = math.round(postcount / 2), wraphtml = '<div class="tab"></div>'; posts.slice(0, posthalf).wrapall(wraphtml); posts.slice(posthalf, postcount).wrapall(wraphtml); } function clickme() { $("#a").append("<div class

css - Background color and background image below element -

the idea make not valid error tip comes when people fail fill out required field show speech bubble. arrowhead image shows in center , underneath text , point field missed. fiddle here html: <span class="wpcf7-not-valid-tip">please fill required field.</span> css: .wpcf7-not-valid-tip { background: red; color: white; padding: 10px; width: 100px; background-position: 0 0; background-repeat: no-repeat; background-image: url('http://s24.postimg.org/qacevkf7l/green_error_arrow.png'); } as can see have background color , arrow image needs sit in middle of element , below but, of course, if position using background-position, image hidden cannot overflow outside of element itself. easy if edit html prefer not using plugin , want free update plugin in future. question: is there pure css solution? if not (and suspect there isnt) cleanest way solve issue? use add_filter alter html put

x11 - what is the advantage of using openGLUT programming over X windows programming? -

i understand x windows library used other programs in linux environment create windows. openglut library uses x-window libraries internally create windows. advantage of using openglut on x-windows? thanks in advance it eases programming understand direct x11 programming tedious assembly programming!

javascript - Logging client-side errors and "Script error" -

how pinpoint client-side errors occur in scripts domains? for clarity let's suppose have average size web application uses several scripts hosted domains (like google maps js sdk). and 1 day started receiving script error in error logs, means there error occurred in 3rd party code. but how find exact method in code invoked 3rd party code failed? ps: error not reproducible developers , occurs on client machines quite rarely. pps: errors above window.onerror does not provide call stack, proper error message, file name , line number. provides literally nothing helpful apart of script error error message. ppps: the third party script included using <script src="http://..."></script> tags , executed using somefunctionfromthethirdpartyscript(); i had similar problem once , solution was... // parameters automatically passed window.onerror handler... function myerrorfunction(message, url, linenumber) { $.post( "https

android - Trying to get imageview to move back and forth when clicked, no errors showing up in Eclipse, but app crashes -

i've been working on side project , have been hung on part of while. i'm trying separate of code related boat imageview boat class possible. i'm not getting errors , looks right me, app keeps crashing when try run it. here boat class: package com.cannibal_photographer; import android.content.context; import android.util.attributeset; import android.view.view; import android.widget.imageview; public class boat extends imageview { imageview boatimage = (imageview)findviewbyid(r.id.imageview1); boolean state = true; public boat(context context, attributeset attrs) { super(context, attrs); boatimage.setonclicklistener(new onclicklistener() { @override public void onclick (view v) { if (state) { moveboatforward(-290); } else { moveboatreverse(290); } } }); } public void moveboatforward(int amount){ boatimage.offsettopandbottom(amount);

C++: Redirect code to certain position -

i new c++. how can "redirect" code position? basically, should put instead of comments lines here: if ( n>1 ) { // should here make code start beginning? } else { // should here make code start point? } i understand c++ not scripting language, in case code written script, how can make redirect it? thank you a goto command want it's frowned on in polite circles :-) it has place possibly better off learning structured programming techniques since overuse of goto tends lead call spaghetti code, hard understand, follow , debug. if mandate make minimal changes code sounds may badly written, goto may best solution: try_again: n = try_something(); if (n > 1) goto try_again; with structured programming, have like: n = try_something(); while (n > 1) n = try_something(); you may not see much of difference between 2 cases that's because it's simple. if end labels , goto statements separated, or forty-two differen

ios7 - how to add a UITableView into UIAlertView in iOS 7 -

Image
did googling around saw subview no longer supported in ios 7. some ppl recommend creating custom view, not sure how can that. here code, can point me in correct direction? -(ibaction)click_select_fruit_type { select_dialog = [[[uialertview alloc] init] retain]; [select_dialog setdelegate:self]; [select_dialog settitle:@"fruit type"]; [select_dialog setmessage:@"\n\n\n\n"]; [select_dialog addbuttonwithtitle:@"cancel"]; idtype_table = [[uitableview alloc]initwithframe:cgrectmake(20, 45, 245, 90)]; idtype_table.delegate = self; idtype_table.datasource = self; [select_dialog addsubview:idtype_table]; [idtype_table reloaddata]; [select_dialog show]; [select_dialog release]; } you can change accessoryview own customcontentview in standard alert view in ios7 [alertview setvalue:customcontentview forkey:@"accessoryview"]; note must call before [alertview show] . simplest illustrating example: uialertview *av = [[uialertvi

javascript - Load Element from Specific Div JS -

what need load second table (or tbody) element (un-named , has no class), div named megacontent. i'm planning have browser go page, load js , have display part only. it not clear mean "load table". if you'd display table , don't know how reach since not have class or id, this: var tbls = document.getelementbyid("megacontent").getelementsbytagname("table"); var tbl = tbls[0]; // [0] if desired table first table in div, [1] if second etc. tbl.style.display="block"; //or "table", or whatever you'd table. hope helps.

json - Show Facebook Wall of Page in iOS -

i working on app , want show posts of facebook page in tableview in ios. read before can data https://graph.facebook.com/106407802732665/feed?access_token=access_token . i know have parse json , put tableview. but don't know how that. you first parse json , data facebook feed,it have more data keys,you use required keys , customize table view cells. refer example code parse json ios programming tutorial iphone ios json parsing tutorial

java - Multi type, Multi Dimentional Arrays -

looking ways achieve in java define multi dimensional arrays each index being of different type something this... below 'values' , 'activities' related.. lack of such structure declared independently. final string[] values = new string[]{ "config", "linking twitter & facebook", "facebook direct", "twitter direct", "action bar (profiled)", "sharing", "comments", "likes", "views", "entities", "user profile (profiled)", "actions (user activity)", "subscriptions", "location", "init", "tools" }; final class<?>[] activities = new class<?>[]{ authbuttonsactivity.class, facebookactivity.class, twitteractivity.class, actionbaract

mysql - Setting root without password only for a single database -

how configure mysql [using phpmyadmin ?] use 1 database root user without password ? i have root user password. need root access 1 database without password. it's not possible that. mysql user defined combination of host+username+password (not database name). create mysql user. in current phpmyadmin version, can done via users menu. by way, it's not secure have username without password.

java - How to set my ArrayList<integer> equal to a function? -

hello doing merge sort , think correct having hard time last 2 lines of merge_sort function... on second last line says "integer cannot resolved variable, arraylist cannot resolved variable, type mismatch: cannot convert arraylist int[]." , last line says: "type mismatch cannot convert int[] arraylist." how can fix this? appreciated!! public static arraylist<integer> merge_sort(arraylist<integer> b) { if (b.size() <= 1) system.out.println(b); int midpoint = b.size()/2; arraylist<integer> left = new arraylist<integer>(midpoint); arraylist<integer> right; if(b.size() % 2 == 0) right = new arraylist<integer>(midpoint); else right = new arraylist<integer>(midpoint + 1); int[] result = new int[b.size()]; (int = 0; < midpoint; i++) left.set(i, b.get(i)); int x = 0; (int j = midpoint; j < b.size(); j++) { if(x < right.size(

authentication - Best worklight practices to logout and to remember a session -

i want know best practices, when using worklight: to logout to maintain user logged in, after application relaunch. to login user directly after account creation i using worklight 6 authentication, custom login module, hybrid app (html5) if there sample doing these feature, great, otherwise, code snippets , advices should me. thanks can't these 'best practices', in these situations: to logout don't have here. clear , user use access resources on server, including cookies. know, login modules come logout function call can perform these operations. to maintain user logged in, after application relaunch after first login, use local storage mechanism, such jsonstore , in order save credentials. jsonstore can encrypt data saved locally well. when user starts app, instead of prompting login credentials, check local storage see if credentials exist , send them server log in. to login user directly after account creation i'd

Sending an object through a socket in java -

i have 2 java netbeans projects, 1 server other client. have message class have created want pass server , other way client after modification done @ server. have included class message in both projects. use objectoutputstream , objectinputstream pass object. connection between server , client ok , object passes through @ server when read object objectinputstream using readobject() method type cast message class. classnotfoundexception thrown @ server. cant find message class. how can resolve this? code client: public void startclient() { try { // create socket socket clientsocket = new socket(host, port); // create input & output streams server objectoutputstream outtoserver = new objectoutputstream(clientsocket.getoutputstream()); objectinputstream infromserver = new objectinputstream(clientsocket.getinputstream()); // read modify // todo here /* create message object send */ linkedlist<

Android: How to create a List Item / Grid Item Overflow -

Image
does how how create overflow item in google play? 1 idea have use spinner background , fixed width wondering if there better way. below screenshot of kind of overflow menu on grid items have in mind. you can use popupmenu. give desired effect.

Python alternative to Javascript function.bind()? -

this question has answer here: how bind arguments given values in python functions? 3 answers in javascript, 1 might write var ids = ['item0', 'item1', 'item2', 'item3']; // variable length function click_callback(number, event) { console.log('this is: ', number); } (var k = 0; k < ids.length; k += 1) { document.getelementbyid(ids[k]).onclick = click_callback.bind(null, k); } so can pass callback function value of k @ time registered though has changed time function called. does python have way equivalent? the specific situation (but prefer general answer): i have variable number of matplotlib plots (one each coordinate). each has spanselector, reason designed pass 2 limit points callback function. however, have same callback function. have: def span_selected(min, max): but need def span_selected(w

java - How to stop a software with a timer repeat over and over? -

i have created software timer , when goes 0 it's going start new login screen. problem login comes on , on again. how stop this? class displaycountdown extends timertask { int seconds = 0005; public void run() { if (seconds > 0) { int hr = (int) (seconds / 3600); int rem = (int) (seconds % 3600); int mn = rem / 60; int sec = rem % 60; string hrstr = (hr < 10 ? "0" : "") + hr; string mnstr = (mn < 10 ? "0" : "") + mn; string secstr = (sec < 10 ? "0" : "") + sec; seconds--; lab.settext(hrstr + " : " + mnstr + " : " + secstr + ""); } else { login ty = new login(); login.scname.settext(scname.gettext()); login.scnum.settext(scnum.gettext()); login.mar.settext(jtextfield1.gettext()); ty.set