Posts

Showing posts from April, 2010

Instagram API: How to get all user media? -

in general need user media. user has more 250 photos. i /users/1/media/recent/?access_token=...&count=250 but returns 20 photos. maybe instagram has limit getting media. if is, response has pagination solve it. there max id photo. how know first (min) id photo paginate then? you're right, instagram api return 20 images per call. you'll have use pagination feature. if you're trying use api console. you'll want first allow api console authenticate via instagram login. you'll want select oauth2 under authentication dropdown. once authenticated, use left hand side menu select users/{user-id}/media/recent endpoint. sake of post {user-id} can replace self. use account retrieve information. at bare minimum what's needed endpoint. once send, you'll json returned you. @ top of returned information after server info, you'll see pagination portion next_url , next_max_id. next_max_id you'll use parameter query. remember max_id ...

mysql - SQL Multi table select query -

http://i.stack.imgur.com/mbuti.jpg i want multi select in 1 query 1 table has data many tables. have 4 tables combine single output. here image of table. i want select , don't want other data other table main table name of other tables have tried following not working. select * project_content left join project_master on project_master.id = project_content.p_id left join project_content_menu on project_content_menu.type_id = project_content.p_c_id left join project_menu_master on project_menu_master.id = project_content.m_id select * project_content left join project_master on project_master.id = project_content.p_id left join project_content_menu on project_content_menu.type_id = project_content.p_c_id left join project_menu_master on project_menu_master.id = project_content.m_id select distinct(*) project_content left outer join project_master on project_master.id = project_content.p_id left outer join ...

javascript - Scope issue inside a custom object -

i think having scope visibility issue can't figure out exactly: when log variable displayatonce right result, try use buttons nothing in return. have tried log this.navbuttons empty set... don't what's wrong code. <!-- html code --> <div id="nav"> <a href="#" data-dir="prev">previous</a> <a href="#" data-dir="next">next</a> </div> /* js script jquery */ (function() { var newsnavigator = { init: function(config) { this.navbuttons = config.navbuttons; this.displayatonce = config.displayatonce; this.counter = 0; this.shownews(); this.enablenav(); }, shownews: function() { console.log(this.displayatonce); }, enablenav: function() { console.log(this.navbuttons); this.navbuttons.on('click', function() { console.log("clicked"); }); } }; ne...

php - Google plus API for fetching business reviews? -

is there php api business reviews google plus? sample business page url: https://plus.google.com/112164489386569071900/about?gl=in&hl=en-in i suggest use google places api: guess results same 1 displayed on g+ https://developers.google.com/places/documentation/details

asp.net mvc 3 - Submit with a jQuery Prompt -

let's have generic jquery prompt asks me rename element , tells me entered: $(function () { $("#rename").click(function () { jprompt('please enter new name:', 'enter new name...', 'rename prompt', function (r) { if (r) { alert('you entered ' + r); } }); }); }); but element wish rename stored on database on server, means need run server-side script rename element. assume means need use submit, on form. i've found information .submit() jquery function here not entirely understand how works. if let me know how make submit , run server-side script appreciated. $(function () { $("#rename").click(function (e) { e.preventdefault(); jprompt('please enter new name:', 'enter new name...', 'rename prompt', function (r) { if (r) { $('input[name="newname"]').val(r.name); $.post(...

JOIN MySQL Tables -

i have following tables format: members mem_id | mem_name ------------------ 1 2 b 3 c project_members fk_mem_id | meb_parent_id ------------------------- 1 0 2 1 3 2 and require result like: mem_id | child| parent -------------------------- 1 null 2 b 3 c b i tried fail.. idea....? select pm.*, m1.meb_name child, m2.meb_name parent members m1 left join members m2 on m1.meb_parent_id = m2.meb_id select project_members.fk_mem_id, a.mem_name child, b.mem_name parent project_members inner join members on project_members.fk_mem_id = a.mem_id left join members b on project_members.meb_parent_id = b.mem_id

objective c - Connect a UITapGestureRecognizer to a UIView -

i'm trying connect gesture uiview can tap on object, not working. doing wrong? shape.h #import <uikit/uikit.h> @interface shape : uiview; - (id) initwithx: (int)xval andy: (int)yval; @end shape.m #import "shape.h" @implementation shape - (id) initwithx:(int )xval andy:(int)yval { self = [super init]; uiview *shape = [[uiview alloc] initwithframe:cgrectmake(xval, yval, 10, 10)]; shape.backgroundcolor = [uicolor redcolor]; shape.userinteractionenabled = yes; [self addsubview:shape]; return self; } @end modified code: following code in main viewcontroller. have removed uitapgesturerecognizer shape class. code works if make following change, 'box' responds tap gesture, not 'shape': [shape addgesturerecognizer:tap]; [box addgesturerecognizer:tap]; - (void)handlertap:(uitapgesturerecognizer *)recognizer { //cgpoint location = [recognizer locationinview:[recognizer.view superview]]; nslog(@...

css - Vertically and horizontally center HTML in UIWebView -

Image
i'm trying vertically , horizontally center content of unknown height in uiwebview. what have right works great in safari: http://jsfiddle.net/ht9j5/ however, not right when presented in uiwebview: any ideas how work? 1 thing cannot set viewport meta, because needs work when presenting uiwebview in modal view controller on ipad, not full width of screen: <meta name="viewport" content="width=device-width;initial-scale=1.0;maximum-scale=1.0;"/> i tried example , works fine in uiwebview. don't know how load html / css. sure css loaded correctly? have set frame of uiwebview? here code works me. set frame of uiweb smaller screen size because mentioned presenting modally. - (void)viewdidload { [super viewdidload]; nsstring *htmlstring = @"<html><head><style type='text/css'>html,body {margin: 0;padding: 0;width: 100%;height: 100%;}html {display: table;}body {display: table-cell;vertical-alig...

templates - How to use knockoutjs for templating -

i new knockoutjs. want use templating feature of knockoutjs. set website header, content section , footer. in content section, want slide in templates (from right left) when click on button. does know best way set up? or have example me? there plenty of examples in tutorials . here link documentation on "template" binding. based on admitted "newness" knockout, suggest going through tutorials first before start trying complicated things incorporating jquery or other animation libraries mix.

Can one iOS app purchase in-app non-renewable subscription products defined in another app (same vendor)? -

i have several ios apps use same subscriptions supply functionality such sync , other features. in-app purchase items non-renewable subscriptions, therefore apple handles payment, have track subscription on servers. being case don't see why need duplicate catalog each app. if pair in-app id's (unique identifiers each subscription) 1 product, , make catalog of id's available web service of apps can retrieve list of bundle id's, there reason app b can't purchase in-app products (non-renewable subscriptions) created in itunes connect app a? from app store quick reference (https://developer.apple.com/appstore/in-app-purchase/in-app-purchase-guidelines.pdf): "• in-app purchase items cannot shared across applications or platforms."

authentication - Unable to authorize on Facebook with fbconsole -

i install dean malmgren's fork of fbconsole lib , , try fbconsole.automatically_authenticate function authenticate on facebook no luck. error message: /var/virtualenvs/jd/src/fbconsole/src/fbconsole.pyc in automatically_authenticate(username, password, app_secret, redirect_uri, debug) 411 oauth["state"][0], state, 412 ) --> 413 code = oauth["code"][0] 414 415 # 4. exchange code user access token user's data keyerror: 'code' i don't know wrong. have suspicion, there problem facebook app settings (for example not able set site url http://127.0.0.1:8080 value). try run code on localhost , on production server. error still same (facebook didn't give me code parameter). does know problem please? oauth doesn't have 'code' parameter because on previous step error facebook because used expired app_id (that defined in fbconsole). correct usage of fbconsole.automatically_auth...

html - Do the browsers have a maximum height for the body/document? -

my question is, if come across limitation regarding height of html page. if browser-specific (especially ie7), or maybe client-specific (memory etc.) or else. any links or experiences welcomed. yes , there technical limit height of page. (there's practical limit – no 1 can use page that's billions of pixels high, , if page high, you're doing wrong.) that said, there 2 different limits consider: maximum height of element can specify in css, , maximum total height. both vary browser browser. slickgrid deals virtual scrolling, has know maximum height of element; the code uses detect here . put in fiddle : (these approximate) chrome: 512,000,000 firefox: 6,000,000 ie8-9: 1,000,000 ie6-7: 128,000,000 (yes, more newer ies) to test maximum total height, put this test , fills page 11,000 <div> s 99,999px in height, total of ~1.1 billion pixels of height. chrome seems lose marbles around 1.08bn px, , somewhere north of 5bn px, scrollbar d...

asp.net mvc - MVC 3 - Sessionless controllers datastore options -

i've been reading sessionless controllers lately , seems interesting idea, since improves perfomance , let ajax calls asynchronous, should be. however, can't figure nice way store data stored session. have lot of single-fetch data once , walks through several pages. first thought use memorycache, reading post begin doubt it, since iis can let go data anytime. because of this, got little confused on should store data in session way. read couple of thing nosql , mongodb, wouldn't same fetch data time need it? can give me clarifications , technologies can use serve temporary datastore? have considered using httpcontext.cache ? you're saying in session way, there no reason couldn't create cache key based upon sessionid of current request: // cache key var cachekey = string.format("{0}-{1}", "somekey", session.sessionid); // save cache httpcontext.cache.insert(cachekey, <yourobject>, null, cache.noabsoluteexpiration, time...

php - How enable magento Go Api settings -

ws-i compliance magento go can generate ws-i compliant wsdl magento go solution? seems available other magento products (according forum under services > magento core api > ws-i compliance yes). can't find setting in magento go admin console you can turn on ws-i compliance version 1.1.1.4. this release notes version 1.1.1.0 version 1.1.1.0 – july 17, 2012 what's new please see blog more details on release along uk features. implemented uk knowledge base uk based customers. added additional paypal option paypal advance. automatic paypal express accelerated on-boarding. royal mail shipping method. vat on shipping entire orders. api ws-i compliance enabled magento go minor changes & fixes twenty-five additional minor changes , fixes.

reflection - Java: Load class from string -

i know has class loaders, couldn't find example (it might i'm google-ing wrong keywords. i trying load class (or method) form string. string doesn't contain name of class, code class, e.g. class myclass implements imath { public int add(int x, int y) { return x + y; } } and this: string s = "class myclass implements imath { public int add(int x, int y) { return x + y; }}"; imath loadedclass = something.loadandinitialize(string); int result = loadedclass.add(5,6); now obviously, something.loadandinitialize(string) - part 1 don't know how achieve. possible? or easier run javascripts , somehow "give" variables / objects (like x , y)? thank hints. use java compiler api. here blog post shows how it. you can use temporary files this, requires input/output file, or can create custom implementation of javafileobject reads source string. javadoc : /** * file object used represent source coming string. ...

How to create oscilloscope for audio on android -

Image
i creating app audio recording oscilloscope. did audio recording following code add oscilloscopse shown in figure.my requirement oscilloscope's wave should zigzac according user's voice tone. have tried long time not find solution. not have idea implement oscilloscope. please me how , please provide sample code snippets. thanks. audio recording code: recorder = new audiorecord(mediarecorder.audiosource.mic,recorder_samplerate, recorder_channels,recorder_audio_encoding, buffersize); recorder.startrecording(); ... byte data[] = new byte[buffersize]; string filename = gettempfilename(); fileoutputstream outputstream = null; try { outputstream = new fileoutputstream(filename, true); } catch (filenotfoundexception e) { log.e("error @ writeaudiodatatofile() - 1 ", e.getmessage()); } int read = 0; if (null != outputstream) { while (isrecording) { read = recorder.read(data, 0, buffersize);...

php - Using multiple mysql connections in 1 class -

i writing cronjob transfer data 1 table, process , apply web application. have 2 seperate database connections this. @ moment, connection credentials same except it's different databases, going live, entirely seperated. the issue creating connection assigning in class $this->staging , other called $this->production. use mysql_ping ensure both connections working. what appears happen when query, disregards connection identifier ($this->staging example) , tries query on last of 2 connections created. i use connection identifier within query: // connection: $this->staging = $this->mysql($config['staging']); $this->production = $this->mysql($config['production']); $sql = "select * table"; $query = mysql_query($sql,$this->staging); // returns unknown table in database defined in $this->production. i return mysql_connect $this->mysql() method, , not mysql_select_db(). if try returning mysql_select_db() mysql_p...

Reading from PSV file Java -

i want read psv file using java. records in psv file has 4 columns. want read , output 3 , 4th column. best way this. here have: bufferedreader psvfile = new bufferedreader(new filereader(filename)); string datarow = psvfile.readline(); while (datarow != null) { string[] dataarray = datarow.split("\n"); (string item:dataarray) { string[] elements = item.split("|"); system.out.println(item); } system.out.println(); datarow = psvfile.readline(); } psvfile.close(); system.out.println(); based on @aljoshabre suggestion iam using csvreader, doing this: reader = new csvreader(new filereader(filename),'|'); string [] nextline; while ((nextline = reader.readnext()) != null) { system.out.println( nextline[3] + nextline[4]); } i getting desired output error: exception in thread "main" java.lang.arrayindexoutofboundsexception: 2 @ read_psv.main(read_psv.java:20) line 20 system.out.println( nextlin...

c# - Corrupt Files after uploading on server -

i have problem webapplication. have made upload-function uploading documents. local on debbuging works without problem. when run application on server works also, files after upload corrupt (e.g. word-file has signs instead correct text). i think error must somewhere in server-setting or maybe in webconfig? search since hours solution can't find similiar problem (yes, maybe search wrong keywords :( has solution? thank you! my code: <asp:fileupload id="fileupload1" runat="server" /><br /> <asp:button id="btnupload" runat="server" text="datei hochladen" onclick="btnupload_click" /> code behind //some code save fileinfos in database... ... ... //upload file fileupload1.saveas(path + filename); there no errormessage post, because works fine. problem corrupt files after uploading on server (local works) i can't see byte array generation code here(the section have commented above...

c# - Sort a list by an int property in the list differing per entry -

i working on little program myself, connected lastfm. here can fetch whole list artists, played in current week. how first fetch artists played , store them list: weeklyartistchart weeklyartists = user.getweeklyartistchart(); //weeklyartistchart list now, let's each entry in weeklyartists[i].artist has property named 'playcount'. want sort list based on property in descending order, problem is, have no idea how! your appreciated! you can use linq , enumerable.orderbydescending : var sortedartists = weeklyartists.orderbydescending(a => a.artist.playcount); if need copy of list order, need call tolist : weeklyartists = sortedartists.tolist();

.net - C# -- TcpListener.Start() causing SocketException with message "Only one usage of each socket address" -

i have service it's coming invokes start() method on tcplistener instance. listener using port not common , not known used other services. very span of minute or experiences odd error. minute service (which on failure restarts immediately) back crashes on following exception: socketexception @ system.net.sockets.socket.dobind(system.net.endpoint, system.net.socketaddress) @ system.net.sockets.socket.bind(system.net.endpoint) @ system.net.sockets.tcplistener.start(int32) @ mytestserver.server.startlistening() with exception message follows: only 1 usage of each socket address (protocol/network address/port) permitted this article suggests i'm experience port exhaustion , should tweak registry modify timeout , port range values winsock. , well, have (or expect have) 50-100 clients connecting. how possibly run out of ports? bots , port scanners? it isn't port exhaustion in post. connecting out wcf (which tcpclient). binding tcp port...

sql server 2008 - Variation of SELECT * - all columns except those explicitly referenced -

is there way convert 1 column , able reference other columns without naming them explicitly? normally this: select ,[id] ,[name] ,convert(varchar(10),[createdate], 104) [createdate] customers what in perfect world be: select * ,convert(varchar(10),[createdate], 104) [createdate] customers where * mean columns not explicitly stated in query. is there keyword enables 1 or there other way? please keep in mind has doable in query - no changing tables, making views, sps or else. there isn't programmatic way "all columns except one" unless wanted build dynamic sql sys.columns based on list provide query (it very difficult derive list of referenced columns query dynamically, introduce joins, clauses, etc). but there pretty trivial way without typing them all. expand table in object explorer, , drag "columns" node onto query editor window. remove createdate column list.

Spock framework has conflict with other plugins in Grails 1.3.8 -

i have installed spock on grails 1.3.8 application. fails after running test-app. seems has conflicts other plugins cannot figure out. have on 20 plugins installed. the error : org.codehaus.groovy.control.multiplecompilationerrorsexception: startup failed: not instantiate global transform class org.spockframework.compiler.spocktransform specified @ jar:file: /c:/documents%20and%20settings/xxxxxxx/.ivy2/cache/org.spock framework/spock-core/jars/spock-core-0.6-groovy-1.8.jar!/meta-inf/services /org.codehaus.groovy.transform.asttransformation because of exception org.spockframework.util.incompatiblegroovyversionexception: spock compiler plugin cannot execute because spock 0.6.0-groovy-1.8 not compatible groovy 1.7.8. more information,see http://versioninfo.spockframework.org spock location: file:/c:/documents%20and%20settings/xxxxxx/.ivy2/cache /org.spockframework /spock-core/jars/spock-core-0.6-groovy-1.8.jar ...

dynamic - JavaScript load script dynamically inside a DIV -

i have created div dynamically , want contain javascript link, output on it. javascript link source absolute. obviously, doesn't work: var div = document.createelement('div'); div.id = 'mydiv'; div.innerhtml = "<script type='text/javascript' " + "src='http://mydomain.com/myscript.js'></script>"; document.body.appendchild(div); so tried one var script = document.createelement('script') script.setattribute('type', 'text/javascript'); script.setattribute('src', 'http://mydomain.com/myscript.js'); var div = document.createelement('div'); div.id = 'mydiv'; div.appendchild(script); document.body.appendchild(div); in script file have simple alert('testing...'); code. problem doesn't work. script inclusion typed inside div (i see when inspect div in chrome), doesn't work. don't see ...

jquery - jqPlot hourly graph -

Image
i'd jqplot similar this, http://www.jqplot.com/deploy/dist/examples/date-axes.html however i'd hourly. i've got 2 weeks of data i'd displayed hourly , x-axis display this: 8am 9am 10am ... 11pm 12am 1am 2am 3am ... |----june 1, 2012----| |----june 2, 2012----| is there way this? the problem doing naive modification of example x-axis label becomes unreadable, when using small amounts of data. naive modification of code: $(document).ready(function(){ var line1=[... data snipped...]; var plot2 = $.jqplot('chart2', [line1], { title:'customized date axis', axes:{ xaxis:{ renderer:$.jqplot.dateaxisrenderer, tickoptions:{formatstring:'%b %#d, %#i %p'}, min:'june 1, 2012 8:00am', tickinterval:'1 hour' } }, series:[{linewidth:4, markeroptions:{style:'square'}}] }); });​ see jsfiddle live editing of issue. http://jsfiddle...

php - Determining if an array of NULL values is considered empty -

i'm building array determine if need take action. executing query. table has sent_date field determine if email has been sent user or not. once has been sent user, sent_date field populated getdate() . here how i'm building: $sent_date_sql = " select ind_id, sent_date profileemail "; $results = dbexec($sent_date_sql); i build array: foreach ($results $r){ array_push($sent_date,$r['sent_date']); $query_count = count($results); } this working gloriously. issue when go check sent_date array. first time in month script runs, sent_date values null. array looks like: array(228) { [0]=> null [1]=> null [2]=> null [3]=> null [4]=> null ...etc. now going try evaluate $sent_date : if(empty($sent_date)){ my empty condition never hits because values of array null. there alternative way achieve trying do? should looping through $sent_date array , evaluating each value? if (!array_filter($s...

partitioning - Using Partitioner with PLINQ in F# -

i use following plinq-implemented parallel map function. let parmap f (xs:list<_>) = xs.asparallel().select(fun x -> f x) |> seq.tolist i want improve speedup on 4 cores i'm not able above 2. found 1 can custom partitioning improve parallel performance. have seen c# examples , not sure how work f#. following doesn't change think default partitioning used tpl? how can use different (static, dynamic,...) partitioning options here? let pmap_plinqlst_parts f (xs:list<_>) = let parts = partitioner.create(xs) parts.asparallel().select(fun x -> f x) |> seq.tolist typically custom partitioner used if work units extremely small. when faced problem may better off switching task rather async more suited smaller more numerous amounts of work, async being more suited io type operations latency typically longer. for example batch calculations in sequences amongst parallel threads. yield vary depending on size of work units , number of t...

Java Pelops and Cassandra NoSQL DB: Can I Batch Delete Rows? -

i'm trying figure out how batch delete rows in cassandra db using pelops. ideally, specify keyrange of rows need deleted. work fine purposes. however, (albeit brief) research leading me believe not possible. rowdeletor takes rowkey, , not keyrange. these findings correct? i should able programmatically using modified version of 1 of list functions, but, again, keyrange preferable. no, don't think can batch delete rows pelops, rowdeletor not participate in batches, , mutator class has deletion operations explicitly named columns. if take @ code pelops' deletecolumns can see creates deletion , adds list of mutations, think adding more deletions list make them issued in same batch. getmutationlist method protected, perhaps can make subclass either exposes method, or has way add more deletions list. it looks can hector, mutator interface has methods take multiple row keys, e.g. adddeletion(k key, string cf) , adddeletion(iterable<k> keys, stri...

Rails impossible to get post response in rack middleware -

i made rails 3 rack middleware log users actions request = rack::request.new(env) . so send database request.fullpath , request.user_agent , detailed below: my issue appears want post response (to ids, people name extracted json payload ...). so response = rack::response.new(request.path) . when print response.body , have request.path , , request.params not contain ... by looking @ response firebug, can see data want. thanks responses. problem resolved ! i add status, headers, body = @app.call(env) middleware , send body variable service. each post request, body contains post response want.

sql server - Copy missing rows from one table to another with multi-column primary key -

Image
this topic related copy missing rows 1 table in sql server stored procedure time problem bit more complex. i have tables in different databases (on same server) identical. need transfer data rows left database table right database table, want transfer rows aren't in right database table already. my table have 4 primary keys, see image i'd use this insert [extern_epi6r2].[dbo].[tblbigtablereference] select * [extern].[dbo].[tblbigtablereference] ( pkid not in (select pkid [extern_epi6r2].[dbo].[tblbigtablereference]) , propertyname not in (select propertyname [extern_epi6r2].[dbo].[tblbigtablereference]) , iskey not in (select iskey [extern_epi6r2].[dbo].[tblbigtablereference]) , [index] not in (select [index] [extern_epi6r2].[dbo].[tblbigtablereference]) ) but, wont work since stacking of conditions wrong in way. im using sql server 2008 r2 your query not correct because various conditions can matched on different rows. insert [ex...

PHP, SMTP Server -

i studying php, , working on wamp server uses th gmail smtp server. i want create own email, example: (me@me.something) , install own smtp server, know there few free smtp server providers, don't know start? maybe iis webmatrix, or iis smtp server? can please recommend guide or free smtp server? welcome, thank , have nice day. unless need bunch of users, google apps free best bet. unless concerned google hosting mail.

c# - Trimming ASP.NET Hyperlink Variables -

i have question regarding applying rtrim on asp:hyperlink statement. code have follows: <asp:hyperlink runat="server" class="iframe" id="modellink" navigateurl='<%# string.format("allaudits.aspx?model={0}&date={1}", trim(eval("model_number")), trim(eval("record_date")))%>' text='<%# eval("model_number") %>'> </asp:hyperlink> essentially, want pass model_number , record_date want apply rtrim eval statements. have searched literally everywhere , not sure else try. point me in right direction? thanks! actually, got working using following: navigateurl='<%# string.format("allaudits.aspx?model={0}&date={1}", eval("model_number").tostring().trim(), eval("record_date").tostring().trim())%>' text='<%# eval("model_number") %>' didn't think i'd able find it, there is!

php - Place Wordpress "Site Title" function within "Theme Options" page -

i've created " theme-options.php " page within wordpress, can found under wp api " appearance " settings menu. on this page include 2 things from settings > general-options page (the site title , tagline/subheading ) can edited here (on theme options page) , saved.. how go achieving this? have far, displays boxes , information needed, not save/update properly. missing? theme-options.php : // build our page function build_options_page() { // page structure ob_start(); ?> <div class="wrap"> <?php screen_icon();?> <h2>theme options</h2> <p><b><label for="blogname"><?php _e('site title') ?></label></b></p> <p><input name="blogname" type="text" id="blogname" value="<?php form_option('blogname'); ?>" class="regular-text" /> <s...

User table database best practices -

i wondering best practices organizing user data. should store user data per row in 1 table or should cutting smaller chunks , using multiple tables related primary key? for example. to start want record personal info name, occupation, location etc. nice have option add usage history. in how many , surveys filled out , articles commented on. while typing makes sense me have table comments table username+password, table personal info , keep adding tables needs grow... would confirmation though. if there going one-to-many relations should split up, things one-to-one shouldn't. if user going have multiple addresses, phone numbers, history, friends, etc, have addresses table (or phone numbers, history, or friends tables) tied customer's id. for username , password wouldn't need separate table.

javascript - Create playlist with JPlayer Circle Player -

i know wasn't meant in particular, know how can make jplayer circle player play songs playlist? play song after song , loop entire playlist (if possible.) when finishes. i'd store playlist in json object contains list of songs want play on server. when song ends, there's ended function of jplayer object can override, call play event again next song on playlist. documentation play function: http://jplayer.org/latest/developer-guide/#jplayer-play

python - How to import mailbox module from python2.5 if I also have installed python2.6 and python3.1 on my machine? -

have small problem python , import of module: want use mailbox module python2.5 problem have installed python2.6 , python3.1 on machine , when program reaches line import mailbox following error raised (it`s final part of error): file "/usr/lib/python2.6/mailbox.py", line 19, in import email.message importerror: no module named message how can force app import mailbox module /usr/lib/python2.5? thanks in advance help! run using appropriate executable. python2.5 somescript.py

servlets - Using regular expressions for filter-mapping -

i know cannot use regular expressions url-pattern of filter-mapping, wanted know if possible somehow map filter using /foo/.+/* no. wildcard matching, <url-pattern> supports prefix ( /folder/* ) or suffix ( *.extension ) matching. if want more finer grained matching possible apache httpd's mod_rewrite , use tuckey's urlrewritefilter or ocpsoft rewrite instead. support mod_rewrite -like expressions xml configuration.

c++ - Socket exchange between winsock & QTcpServer -

i found socket code winsock2.h http://www.tidytutorials.com/2009/12/c-winsock-example-using-client-server.html code client. int hsock; int * p_int ; hsock = socket(af_inet, sock_stream, 0); /// char buffer[1024]; int buffer_len = 1024; int bytecount; int c; memset(buffer, '\0', buffer_len); for(char* p=buffer ; (c=getch())!=13 ; p++){ printf("%c", c); *p = c; } if( (bytecount=send(hsock, buffer, strlen(buffer),0))==socket_error){ code server done qt qtcpserver class: void fortunethread::run() { qtcpsocket tcpsocket; if (!tcpsocket.setsocketdescriptor(socketdescriptor)) { emit error(tcpsocket.error()); cout<<"socket error"<<endl; return; } char buffer[1024]; int buffer_len = 1024; memset(buffer, 0, buffer_len); strcat(buffer, " server echo"); qbytearray block; qdatastream out(&block, qiodevice::writeonly); out.setversion(qdatastream::qt_4_0); o...

php - Running a long code using facebook API -

i'm trying make app goes , actions friends user of app has. problem didn't find yet platform can develop such app on. @ first tried using php, used heroku , code worked because had many friends loop went more 30 seconds , request timed out , operation stopped in middle of action. don't mind using platform want work! python, c++, php. fine me. in advance. let's start can change timeout settings, depending on restriction set, can on php explained set_time_limit function documentation : set number of seconds script allowed run. if reached, script returns fatal error. default limit 30 seconds or, if exists, max_execution_time value defined in php.ini. but can set on server itself. issue routers on route have own timeout limit, experience ~60 seconds max. as want do, problem not language/technology use, fact you're making lot of http requests facebook take bit of time, , believe bottleneck, , if that's case there's not can improve ch...

javascript - How to maintain a WebSockets connection between pages? -

on 1 of scripts have code: var websocket = window.websocket || window.mozwebsocket; window.ws = new websocket('ws://64.121.210.140:2585/consoleappsample', 'my-protocol'); which works fine. however, when user changes pages, have re-establish connection. believe causing problems in code because if client sends data server , changes pages, data may not received , race conditions occurring. i tried put window.ws in global scope didn't seem fix problem. there way websockets connection persist between pages connection not need reestablished? the global scope mentioned related javascript context, , context created each windows (and destroyed when document unloaded memory). therefore, effort useless: can't keep connection opened if user change page. of course can have webapp "single page" application, data loaded using xmlhttprequest / ajax / websocket. so, leaving page means leaving / shutdown application, , makes sense close socket. ano...

Kohana routing external url -

i want have url in application http://website.com/click/http://google.com with route::set('click', 'click(/<action>(/<link>))', array('link' =>'[\w\d-_/:]+')) ->defaults(array( 'controller' => 'admanager', 'action' => 'index', )); but does't work http:// works when omitting http:// url please advice, abbas you need base64 encode that. putting raw url inside url (see problem? :) never work well.

Output full xml in Perl (XML::Xpath) -

some perl code i'm looking @ returning xml data method call. how view xml data? code: print "$xml"; what get: xml::xpath=hash(0xa408dbc) what want: actual xml contents, i.e: <sometag> <sometag2/> </sometag> i believe want 1 of print $xml->find('/')->string_value; print $xml->findnodes_as_string('/'); that is, find root (' / ') node of xpath object, , print out string.

shell - ZSH for loop array variable issue -

im working in zsh, im sure bash instructions also. need have loop goes thru values stored in array lw , launches shell script, based on name stored in array. so far, i've come with: $lw=('plugin1' 'plugin2' 'plugin3') in $lw; . ~/library/rogall/plugins/$lw[$i]/lw.prg end; done it gives me error when run saying can't find ~/library/rogall/plugins//lw.prg, appears ignoring variable togethor. any ideas i've messed up? it's simpler that: lw=('plugin1' 'plugin2' 'plugin3') in $lw; . ~/library/rogall/plugins/$i/lw.prg end done in summary: assign "foo", not "$foo" (the shell try expand $foo , assign whatever expands to; typically not useful) use loop variable directly; contains array value rather index

graphics - Generating Polygon Mesh From Control Points of Bezier Patch -

i wanna make program on bézier surfaces, found on internet this article , there 1 approach how it, don't understand second step , third step particularly. or may cant imagine author can mean that. b. use blending tables calculate points in "row curve": for( u = 0; u < 10; u++ ) { blend row 0 control points -> new control point blend row 1 control points -> new control point blend row 2 control points -> new control point blend row 3 control points -> new control point for( v = 0; v < 10; v++ ) { blend 4 new control points -> point on surface } } c. generate edges , polygons grid of surface points. can explain mean? thx. a bezier-surface bezier-curve, control-points moving along other bezier-curves, instead of being stationary. b(0,u) = (1-u)^3 b(1,u) = 3*u*(1-u)^2 b(2,u) = 3*u^2*(1-u) b(3,u) = u^3 c[0..3, 0..3] = control points curve(t,c0,c1,c2,c3) = b(0,t)*c0 + b(1,t)*c1 + b(2,t)*c2 + b(3,t)*...

java - Good way to implement a child class -

so have 10-15 classes (this grow larger number in time) , have similar variables within them: temp conditions humidity load ..and stuff that. i'm looking implement parent class (abstract) better manage since runnable. there's part call constructor each of them , it's... bad. public threadhandler(nh.nhandler nsh, int threadnum){ this.threadnum=threadnum; this.nsh = nsh; } public threadhandler(opa.opahandler sgesh, int threadnum){ this.threadnum=threadnum; this.opash = opash; } public threadhandler(sge.sgehandler sgesh, int threadnum){ this.threadnum=threadnum; this.sgesh = sgesh; } ..... , on 15 how implement parent class do public threadhandler(objecttype name, int threadnum){ //do stuff } thanks help. you need create interface, say, ihandler common methods , handlers should implement interface public interface ihandler { .... declare public methods } public nhandler implements ihandler { ...

asp.net - C# in Page_Load puts code on top of <html> -

more specifically, have made small webpage using c# , .aspx document. c# code have put in <head> part of document, inside page_load this: <script language="c#" runat="server"> protected void page_load(object s, eventargs e) { response.write(@"<div class=""header"">foo bar</div>"); ... } </script> this works somehow, problem html generated gets stuffed on top of beginning <html> tag in document results in broken character setting (doesn't read meta tag?) , strange things not supposed happen. i'm new using asp.net , it's obvious. put statements reachable <body> using <% delimiters? you put them in body. particular code doesn't more write directly spot you've put it. <body> <%= @"<div class=""header"">foo bar</div>"; %> </body> i'm sure test of something, if want wr...

Capture audio out Python -

i capture raw data audio out, using python. in python docs seems using ossaudiodev works purpose. however, using ubuntu 11.10, has no /dev/dsp: >>> import ossaudiodev >>> ossaudiodev.open('r'); traceback (most recent call last): file "<stdin>", line 1, in <module> ioerror: [errno 2] no such file or directory: '/dev/dsp' has got clue how capture sound sound card outputs using python? oss older , deprecated audio system linux. current standard use alsa, , layer on top of alsa either jack or pulseaudio. ubuntu uses pulseaudio. the best thing find python bindings connecting pulseaudio. did quick google search , didn't find you, , don't have time follow more right now. edit: remembered alsa have oss compatibility mode. might able install oss compatibility stuff, use python code have. https://help.ubuntu.com/community/alsa-oss http://www.alsa-project.org/main/index.php/main_page

mdx - Problems when using RANKX on PowerPivot -

i'm trying use rankx funcion rank sales, table looks this productid | producttotal | i want have third column called productrank rank the products depending on producttotal, have =rankx(all('query'[productid]),'query'[producttotal]) however, nor working :( any this? thanks if [producttotal] column following should work =rankx(all('query'[productid]),calculate(sum('query'[producttotal])))

winforms - How do i send a set of keys to my program to implement using code only no keyboard C#? -

how implement set of keys have been sent me program , example (alt & f4) or other wanted sequence ? , thanks in advance :) thanks every 1 turned out ,c# makes available static class this: sendkeys.send("abc"); this send top form abc , more keys check link http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.send.aspx

javascript string length returning undefined -

i cant seem string length value in form textfield here's code function, getting passed parameter of textfields name function validate(thing) { var location = document.getelementbyid(thing); var cardst = location.value; window.alert (cardst); cardst = string(cardst); window.alert (cardst.lenght); the first alert works, alerts whatever type textfield, second 1 undefined. can see did cast string get undefined.. ideas?? that because misspelled length :-) use instead: cardst.length; // <- 'th', not 'ht'

themes - Is there a jquery plugin like the one on Google Shopping? - June 4 2012 -

google shopping looking achieve same carousel effect.... transitions smooth!! also wordpress themes or plugins work. there many carousel's can similar effects. take @ jquery cycle. need style pager way want: demo: http://jsfiddle.net/lucuma/3tz9v/ http://jquery.malsup.com/cycle/

php - Get the id of selected option of select tag in symfony2 controller -

i have form 1 select tag. want id of selected option tag in controller when user submit form. form is <div class="one_third"> <form name="portfolios" action="{{ path('munichinnovationgroupbundle_portfolio') }}" method="post" > <h2>select portfolio</h2> <p>change portfolio managed:<br /> <select name="portfolio" style="width: 265px; height:28px;"> <option selected="selected" value="default">switch portfolio</option> {% portfolio in portfolios %} <option id={{ portfolio.id }}>{{ portfolio.portfolioname }}</option> {% endfor %} </select> </p> <p> <input style="margin-left:100px; height:26px; cursor:pointer; backgroun...

java - Bukkit won't load the plugin: name is not defined -

here's code: package me.chimericalhobo.blockchanger; import java.util.arraylist; import java.util.logging.logger; import org.bukkit.chatcolor; import org.bukkit.command.command; import org.bukkit.command.commandsender; import org.bukkit.entity.player; import org.bukkit.plugin.pluginmanager; import org.bukkit.plugin.java.javaplugin; public class blockchanger extends javaplugin { private static final logger log = logger.getlogger("minecraft"); private final blockchangerlistener blocklistener = new blockchangerlistener(this); public final arraylist<player> blockchangerusers = new arraylist<player>(); @override public void onenable() { log.info("[blockchanger] has been enabled!"); pluginmanager pm = getserver().getpluginmanager(); pm.registerevents(this.blocklistener, this); } @override public void ondisable() { log.info("[blockchanger] has been disabled!"); } @override public boolean oncommand(commandsender sender,...

c - segmentation fault on g_slice_alloc () from gtk_file_chooser_dialog_new () -

i'm writing text editor in gtk+ 2.0 , gtksourceview 2.0 way learn c. i'm getting segfault when try open file, happens reside on sshfs. isn't problem, don't know if sshfs has it. here block of code open function: printf("\nentered open_activated\n"); gtksourcelanguage *lang; gtksourcelanguagemanager *lm; gtkwidget *dialog; gtkwidget *tablabel; gtktextbuffer *tbuffer; int opentabs = 0; const gchar *folder; int page = 0; char *path,*string; page = gtk_notebook_get_current_page(gtk_notebook(notebook)); path = paths[notebookpages[page]]; folder = folderfrompath(path); printf("folder: %s\n\n",folder); dialog = gtk_file_chooser_dialog_new("open file", parent, gtk_file_chooser_action_open,gtk_stock_cancel,gtk_response_cancel,gtk_stock_open,gtk_response_accept,null); gtk_file_chooser_set_current_folder (gtk_file_chooser(dialog), folder); additional info notebookpages global array of integers: #defi...

c# - How do I get the iOS Device and Version in Monotouch -

how can determine iphone, ipod, ipad model using application? output like: iphone, iphone 3g, iphone 3gs etc like answer plain objective c: answer question in objective c took example , updated current list of ios devices , simulators of march 24th 3pm pst. enjoy. using system; using system.runtime.interopservices; using monotouch.foundation; using monotouch.uikit; namespace yournamespace { public class iosdevicehardware { public const string hardwareproperty = "hw.machine"; public enum ioshardware { iphone, iphone3g, iphone3gs, iphone4, iphone4reva, iphone4cdma, iphone4s, iphone5gsm, iphone5cdmagsm, ipodtouch1g, ipodtouch2g, ipodtouch3g, ipodtouch4g, ipodtouch5g, ipad, ipad3g, ipad2, ipad2gsm, ipad2cdma, ipad2reva, ipadmini, ipadminigsm, ipadminicdmagsm, ip...

c++ - Clang 3.1 and user defined literals -

clang 3.1 claims support user defined literals. can define this: int operator"" _tryit(long double n) { return int(n); } but when try use error: int m = 5_tryit; invalid suffix '_tryit' on integer constant 5 cannot implicitly converted long double in case. need change 5.0 make long double or explicitly invoke function implicit conversion work: int m = 5.0_tryit; or int n = operator"" _tryit(5); (tested both clang version 3.1 (trunk) (llvm/trunk 155821) ) this question has explanation of rules. (also, abarnert mentions, make sure passing -std=c++11 flag compiler when compiling).

sql - Select row by specifying date column -

i have record in table name username password dateadded skype someusername somepassword 05/06/2012 01:18:50 i trying execute statement fails. some attempts: (all fails) select * passwords dateadded = '05/06/2012 01:18:50' select * passwords dateadded = #05/06/2012 01:18:50# select * passwords dateadded = '06/05/2012 01:18:50' select * passwords dateadded = '2012/06/05 01:18:50' select * passwords dateadded = '2012/05/06 01:18:50' select * passwords dateadded '2012/06/05 01:18:50' the column dateadded in database of type datetime , not nvchar . i new in sql, wrong query? could perhaps have fractional seconds stored? try this: select * passwords dateadded between '2012-05-06 01:18:50' , '2012-05-06 01:18:51'; (i prefer format of datetime literal because it's unambiguous, yours should work well. tsql take almost throw @ it .

html - How can I dynamically add and change divs in javascript? -

i have following code: <!doctype html> <html> <head> <script type="text/javascript"> function timemsg() { var t=settimeout("enterquestion()",900000); } function enterquestion() { document.getelementbyid("questions").innerhtml += '<p>' + document.getelementbyid("question").value; } </script> </head> <body> <h1>testing website</h1> <p id="questions"></p> <input type="text" name="question" id="question" /> <button type="button" onclick="timemsg()">enter question</button> </body> </html> all code allows user enter question , adds question list of questions after 15 minutes have passed. all i'd code make puts text "question recorded" in place question show up, instead of adding question end, should replace "question recorded" text question....

algorithm - calculate a simple expression in java -

how can evaluate infix expression in java : ((1) 2/4+2-1). knew can use 2 stacks : 1 1st characters( +-/). 2nd integers. then check priorities of characters , calculate simultaneously!? so there more perfect way calculating expression?! .. thanks, are writing calculator? @ reverse polish notation algorithm (that might you). can use third-party library or dynamic language (javascript engine/groovy/beanshell/google: java calculator library/etc.)

android - Recognizing a button from a dynamic view -

i have written code dynamic layout using loop generate pair of buttons (this part of code generate them) for(int = 1; <= 2 ; i++) { button button1 = new button(this); button1.settag("age"); button1.setid(i); layout.addview(button1); button button2 = new button(this); button2.setid(i); button2.settag("country"); button2.setenabled(false); layout.addview(button2); button1.setonclicklistener(this); button2.setonclicklistener(this); } what wish if button1 clicked, button2 should enabled (initially disabled). this easy task if buttons created in xml have separate r.id.xxxxx names each, here unable understand how detect other button in onclick(view v) method can change if enabled or not, have tried add tag each button have parameter recognize buttons have no idea how recognize other button view information of clicked button1. i assume using button tags ...