Posts

Showing posts from June, 2011

Problem connecting to external mysql database -

my problem command produces error when tried connect our server external server : mysql -h db.hostname.com -u username -pp@ssword database_name and error : error 1044 (42000): access denied user 'username'@'%' database 'database_name' i asked external server admin add our ip in firewall no avail.. has granting privileges 'username' it's not problem firewall, since mysql is denying connection. suspect, problem privileges granted user. need execute on mysql server (you might need tweak bit if don't want grant privileges db): grant on database_name.* 'username'@'%' identified 'p@ssword'; also note if connect specific host/ip, it's better idea specify host/ip, instead of using wildcard % , allow connections anywhere.

preprocessor - Erlang macros with different arity -

for logging wanted ability macro out statements @ compile time, -define rescue! for compiler flags i'm compiling erlc -dfoo, there way -ifdef determine difference between foo = ok, foo/0, , foo/1? -module(foo). -define(foo, ok). -define(foo(x), io:format("~p~n", [x])). -export([test_x/1]). %% want true iff foo = ok, not if ?foo/1 exists -ifdef(foo). test_x(x) -> ?foo(":) " ++ x). -else. test_x(x) -> ?foo(":( " ++ x). -endif. i had better write fuller reply. no, there no way test actual macro definition, can test if macro name has been defined. , can test on macro name, not on alternative macro definitions different arities. relic past, before r13b, when have 1 macro definition per name. new 1 more closely mimics functions in module. the "standard" way of doing use flag macro determine set of macros/functions use. example: -ifdef(debug). -define(debug_print(x), <... long here ...>). foo(x) -> ...

MySQL Add Data Based on Unique ID -

i've been looking around answer mysql query question have not been able find answer. appreciated... ps. i'm beginner. issue: have 2 tables, 1 main table several columns , unique id column (sequential numbers) key. table has had rows of data deleted not needed. remaining id example 1,3,5,7 etc. i have second table 2 columns, 1 being unique ids (key) , 1 text. both tables belonged same table, second 1 extracted , stored while first 1 worked on; have same ids (key). table still has ids 1,2,3,4,5,6,7 etc. i want add the column text second table, , match rows same id on first table. text second table not have matching key first table should omitted. table illustration table 1 id field 1 (here want text table 2; matching ids) 1 bla 3 bla 5 bla 7 bla table 2 id text 1 bla 2 bla 3 bla 4 bla 5 bla 6 bla 7 bla i appreciate writing query. thank you, patrik you can simple join. rows exist same id in both tables...

command line - ffmpeg: execute with more options -

i installed ffmpeg using apt-get. comes default compiled options: configuration: --enable-gpl --enable-pp --enable-swscaler --enable-pthreads --enable-libvorbis --enable-libtheora --enable-libogg --enable-libgsm --enable-dc1394 --disable-debug --enable-shared --prefix=/usr how can execute , add more options without recompiling it? i'm looking way execute including option: -enable libspeex1 . you don't. changing options requires recompiling.

Open android camera -

i see ton of results when searching how open camera, , returned image. opening camera app without return @ all? want camera function normal. you send action_camera_button intent? should trick. intent intent = new intent(action_camera_button, null); startactivity(intent); obviously, "this" needs current activity.

jquery - How to keep alive a user's session while they are posting on a forum? -

i have site session timeout of 15 minutes. on pages user spends longer 15 minutes filling in reply. best solution keep alive session in case? i use jquery on these pages, possibly pinging server, on events? the backend struts on tomcat . given don't want change site's session timeout.. set timeout/interval (< 15min) event in javascript , decide when event triggers. if want session active long page open, fine, keep pinging every < 15 min. that's not want user leaving public computer should logged out @ point. you maintain variable lastactivity , updated on each document mousemove or document keydown. if there's been activity since last ping, ping again. to more sophisticated, count events , ping server if number of events > threshold @ timeout. the basic example: setinterval(function(){ $.get('/imstillalive.action'); }, 840000); // 14 mins * 60 * 1000 with basic check typing activity: $(function(){ var lastupdate =...

python - How does Worldviz Vizard compares to Panda3D and Pygame? -

is familiar worldviz-vizard's 3d engine python? how compare panda3d? have feeling might easier learn far more limited. support python 2.4 makes me not want try it. i've never heard of worldviz vizard or panda3d seems me have reinvent wheel use pygame 3d. another option: unity. i'm not terribly experienced either heard it's good.

visual studio - VB Collection cannot be indexed because it has no default property? How to iterate a collection? -

dim rs2 ihistorian_sdk.tagrecordset ... inti = 1 rs2.item.count .... histenghigh = rs2.item(inti).hiengineeringunits now gives error interface 'vba.collection' cannot indexed because has no default property. used work when ran code in vba 6.5 via ifix have made standalone project in visual studio 2005 gives me error. so do? default , why not have one/need one? thanks never mind fixed iterating using each loop, didn't know use custom collection each item in rs2.item writelogfile(item.description) ...

python logging alternatives -

the python logging module cumbersome use. there more elegant alternative? integration desktop notifications plus. you can twiggy , it's stage attempt build more pythonic alternative logging module.

How to disable Google Instant Search from within http url query? -

some of programs send direct queries google , parse html results - instance http://www.google.com/search?q=foobar&hl=en&num=20 . unfortunately, seems since recently, when sending such queries google, "num" parameter ignored because of instant search. no matter what, 10 results shown in page. if disable instant search, works again. problem settings stored in cookie or , it's impractical, if @ possible, pre-set program side. is there way add parameter query bypass instant search , "num" working again? i'm sure i'm not 1 parsing google html results... just add "&as_qdr=all" http://www.google.com/search?q=foobar&hl=en&num=2&start=0&as_qdr=all

Finding sorted middle 50% of a sequence (in Boost Accumulators or in other data structure) -

for sequence of values, how 1 find sorted middle 50% of sequence in boost accumulators? for example, let's have following sequence, 25, 21, 9, 13, 17, 19, 12, 29, 50, 97, 10, 11 . the middle 50% data have follows: 13, 17, 19, 21 . of course, 1 can sort sequence, becomes 9, 10, 11, 12, 13, 17, 19, 21, 25, 29, 50, 97 . and 1 can collect middle 50% data. now, accumulators framework internally store , sort sequence? if yes, possible retrieve value reside in particular index? reading here , think accumulators framework not store original data , framework not appropriate problem trying solve. while writing this, find bit foolish try accomplish using accumulators. however, using other purposes , expecting solution in accumulators. now, possible build data structure efficiently maintain current , sorted middle 50% data in way size of data structure never exceeds half of size of sequence? thinking while, guess may not possible devise such data structure. @ first tho...

uitableview - iphone, tableView and appStore application -

i want create application excacly appstore. nice table (i have source code apple using custom table cell) main problem cannot find nice tutorial or guide on how make product detail page. want have label @ top text , after want have images. notice in appstore when reach images locks there while! how can that??? tried using uiscrollview believe not case. thinking using tableview again custom cells again not sure. ideas? or working example? or tutorial? time :) start here: http://blog.webscale.co.in/?p=284 which teach basic table design skills , how create custom cells images on left. then if learn how create tab bar application able have navigation controller @ top can follow descriptive tutorial step step achieve this. http://www.devx.com/wireless/article/44897 what after following these 2 tutorials? appstore application, not own version. edit: added details page how achieve appstore uiscrollview effect. follow brilliant video tutorial. http://blog.sal...

iphone - AFOpenFlow touchevent Image -

does know solution implement @ code, pictures touched , event started? - (void)viewdidload { [super viewdidload]; // loading images queue loadimagesoperationqueue = [[nsoperationqueue alloc] init]; nsstring *imagename; (int i=0; < 10; i++) { imagename = [[nsstring alloc] initwithformat:@"cover_%d.jpg", i]; imageview = [[uiimageview alloc] initwithimage:[uiimage imagenamed:imagename]]; uiimage *aktuellesimage = imageview.image; uiimage *scaledimage = [aktuellesimage scaletosize:cgsizemake(100.0f, 100.0f)]; [(afopenflowview *)self.view setimage:scaledimage forindex:i]; [imagename release]; [aktuellesimage release]; } [(afopenflowview *)self.view setnumberofimages:10]; } i hope me , sorry bad english :) in afopenflowview.m methods touchesbegan, touchmoves , touchended overriden, create new delegate method usage , adapt these methods.

arrays - How to convert the a java type to java string []? -

i want ask java string[] question. in java, if variable convents another, can add (string) , (int) , (double) ,... before variable in left hand side. however, there (string[]) in java want convent variable (string[]) . yes, there (string[]) cast array of string. but able cast string array, must have array of super type of string or super type of array (only object , serializable , cloneable ). so these casts work : string[] sarray = null; object[] oarray = null; serializable[] serarray = null; comparable[] comparray = null; charsequence[] charseqarray = null; object object = null; serializable serializable = null; cloneable cloneable = null; sarray = (string[]) oarray; sarray = (string[]) serarray; sarray = (string[]) comparray; sarray = (string[]) charseqarray; sarray = (string[]) object; sarray = (string[]) serializable; sarray = (string[]) cloneable;

memory management - How to create a list or tuple of empty lists in Python? -

i need incrementally fill list or tuple of lists. looks this: result = [] firsttime = true in range(x): j in somelistofelements: if firsttime: result.append([f(j)]) else: result[i].append(j) in order make less verbose more elegant, thought preallocate list of empty lists result = createlistofemptylists(x) in range(x): j in somelistofelements: result[i].append(j) the preallocation part isn't obvious me. when result = [[]] * x , receive list of x references same list, output of following result[0].append(10) print result is: [[10], [10], [10], [10], [10], [10], [10], [10], [10], [10]] i can use loop ( result = [[] in range(x)] ), wonder whether "loopless" solution exists. is way i'm looking result = [list(somelistofelements) _ in xrange(x)] this make x distinct lists, each copy of somelistofelements list (each item in list reference, list in copy). if makes more sense, consider ...

PHP & MySQL - How can I flag my database when a user deletes their account and after two weeks if the user has not logged in really delete the account -

i asked question earlier on how go deleting users account , got suggestion should flag database user has deleted account not delete account until after 2 weeks or so. so question how flag database , have account deleted after 2 weeks if user has not logged in using php & mysql? maybe create sql table contains users requests. when user want delete account, add request table (like wich user_id, date_request etc). , everyday, check table delete (or not) accounts. check everyday should use crontab. good luck !

How can I save div as image at client side where div contains one or more than one HTML5 canvas elements? -

div 'canvasesdiv' element contains 3 html5 canvases. <div style="position: relative; width: 400px; height: 300px;" id="canvasesdiv"> <canvas width="400" height="300px" style="z-index: 1; position: absolute; left: 0px; top: 0px;" id="layer1" /> <canvas width="400" height="300px" style="z-index: 2; position: absolute; left: 0px; top: 0px;" id="layer2"/> <canvas width="400" height="300px" style="z-index: 3; position: absolute; left: 0px; top: 0px;" id="layer3"/> </div> how can save image combining canvases present inside div 'canvasesdiv' @ client side using javascript? this similar previous question answered: save-many-canvas-element-as-image in summary: draw of canvases 1 of them , image via todataurl()

uiscrollview - How to start with particular Image using the iPhone WWDC 2010 - 104 PhotoScroller -

i going through sample code of iphone wwdc 2010 - 104 photoscroller app. it's working great project related images (pdf page images) now want start app custom image no - 5. , should show 6th image on next swipe , 4th on previous swipe. can in regard ? i think should try modifying contentoffset of uiscrollview. depending on width frame should set : imagepos * scrollview.frame.width where imagepos begin 0 , end (nbrimage - 1) good luck ;-)

iphone - IBActions are not working in another viewcontroller -

i have created project has different xib viewcontrollers.in first view selecting image through picker controller , displaying in secondviewcontroller.in secondview controller have buttons , have given ibactions them.here starts problem displaying image in secondviewcontorller when tap on button in viewcontroller app terminating , debugger showing error message program terminated due uncaught exception here code: to select pic through pickercontroller in first view -(ibaction)btnchoosepicclicked { if([uiimagepickercontroller issourcetypeavailable:uiimagepickercontrollersourcetypephotolibrary]) { uiimagepickercontroller *picker=[[uiimagepickercontroller alloc] init]; picker.delegate=self; picker.sourcetype=uiimagepickercontrollersourcetypephotolibrary; [self presentmodalviewcontroller:picker animated:yes]; [picker release]; } else { uialertview *alert =[[uialertview alloc]initwithtitle:@"error ...

xml - String tokenisation algorithm won't tokenise -

morning all, writing bash script extract values of xml tags files in given directory. have decided tokenising each line , returning th4e relavent token. problem isn't tokenising correctly , can't quite work out why. here smallest example make reconstructs issue #!/bin/bash file in `ls $my_directory` line in `cat $my_directory/$file` localifs=$ifs ifs=<>\" tokens=( $line ) ifs=$localifs echo "token 0: ${tokens[0]}" echo "token 1: ${tokens[1]}" echo "token 2: ${tokens[2]}" echo "token 3: ${tokens[3]}" done done i'm guessing issue fiddling ifs inside loop uses ifs (i.e. cat operation), has never been problem before. ideas? thanks, rik use better tool parse xml, ideally should parser, if requirement simple , know how xml structured, simple string manipulation might suffice. example, xml file , want value of tag3 $ cat fi...

asp.net mvc - How do I set the correct decimal separator in IIS 6.0? -

i hope can me here... have conflict decimal separator on host's dedicated server. db (sql server 2005) uses dot decimal separator. fact, if query directly using sql server management dots. however, when application (.net c# mvc 2) running uses comma instead of dot. think it's problem on server because here in tests server doesn't happen. i've been reading might related regional , time zone configuration i've tried setting server's time zone , regional zone u.s. , still doesn't work. the main problem have because views use jquery not working correctly, , main issue because many decimal numbers set required fields. reprogramming option expect find way set correctly due size of app. any apprecciated. thanks in advance, regards. regional settings user specific. means changing them in control panel results in changing them current user. application not use current user, need run regedit modify registry (or use script). you need update reg...

jquery - Its not validating on my submit button click using javascript -

i have code in view function validate() { if (document.getelementbyid('mandatename').value == "") { var err = document.getelementbyid('mandatenameerr'); err.innerhtml = "please enter value mandate name"; err.style.display = "block"; return false; } else { document.getelementbyid('mandatenameerr').style.display = "none"; } if (document.getelementbyid('mandatedescription').value == "") { var err = document.getelementbyid('mandatedescriptionerr'); err.innerhtml = "please enter value mandate description"; err.style.display = "block"; return false; } else { document.getelementbyid('mandatedescriptionerr').style.display = "none"; } return true; } and have on submit button validating before submiting? <button name="submit" onclick="validate(...

Why isn't my jQuery plugin loading in webkit browsers? -

i'm using galleria plug-in. works in firefox , ie 7/8 fails in chrome/safari. javascript doesn't kick in, can tell fact it's not surrounded #gallery div #galleria-container divs does. literally nothing happens, i've checked resource tracking, scripts getting loaded in (obviously because it's working in ie/ff) http://bit.ly/9gvxpj any massively appreciated; i'm go insane. if had guess, might causing issues: <link href="js/classic/galleria.classic.js" rel="stylesheet" type="text/css" media="all"/> it's hard debug because don't have control of page, webkit may interpret javascript you're including css in weird ways...i'm not sure behavior in case.

php - MySQL ON DUPLICATE KEY insert into an audit or log table -

is there way accomplish this? insert ignore some_table (one,two,three) values(1,2,3) on duplicate key (insert audit_table values(now(),'duplicate key ignored') i don't want use php :( thanks! if want consider using stored procedure, can use declare continue handler . here's example: create table users ( username varchar(30), first_name varchar(30), last_name varchar(30), primary key (username) ); create table audit_table (timestamp datetime, description varchar(255)); delimiter $$ create procedure add_user (in_username varchar(30), in_first_name varchar(30), in_last_name varchar(30)) modifies sql data begin declare duplicate_key int default 0; begin declare exit handler 1062 set duplicate_key = 1; insert users (username, first_name, last_name) values (in_username, in_first_name, in_last_name); end; if duplicate_key = 1 insert audit_ta...

ipc - Use NServiceBus for desktop app integration? -

background: we have bunch of windows apps need integrated. we think publish-subscribe ipc mechanism/library trick. inter app events don't need persisted; not apps written on .net aren't have plug-in architecture allows extending in .net the apps run users on terminal service environment. the ipc mechanism should support user isolation. don't want message sent joe's instance of app joe's instance of app b end on sam's instance of app b. as understand it, possible either: use ipc has user isolation built in (dde) use general ipc , implement user isolation myself (include user id in messages) questions: one of options thinking of nservicebus. out there used library same problem (desktop integration) ? nservicebus intended used way ? perhaps replaced default transport (msmq) volatile ? is out there had same problem , resolved diferent pub-sub mechanism ? nservicebus built resolve fallacies of distributed computing . given scenari...

SQL subquery with COUNT help -

i have sql statement works select * eventstable columnname='business' i want add subquery... count(business) row_count how do this? this easiest way, not prettiest though: select *, (select count(*) eventstable columnname = 'business') rowcount eventstable columnname = 'business' this work without having use group by select *, count(*) on () rowcount eventstables columnname = 'business'

php - Most efficient way to get last initial? -

i'm working on custom forum. use email , password log in, , forum display first name , last initial. database stores first name , full last name. what easiest way make abbreviate last name initial? it uses display full name: $name = $row['user_firstname'] . " " . $row['user_lastname']; thanks! $name = $row['user_firstname'] . " " . $row['user_lastname'][0]; just add [0] end first character.

jquery - toggle div fills up remaining space in IE but not google chrome or firefox -

i use toggle function jquery toggle 4 blocks of content. screencast of how works in google chrome: http://screenr.com/w8l screencast of how not work, in ie 7: http://screenr.com/i8l see page yourself: http://www.herkimer.edu/impact for each header (h2) click on, starts section on new line, in ie 7 displays example html: <div class="divide-details"> <h2><a href="#" title="view student perspective" class="student-perspective">student perspective</a> <a href="#" title="view student perspective" class="student-perspective"><span>&raquo;</span></a></h2> <div id="student-perspective-details"> <p>content</p> <div class="clear-both"></div> </div> </div> <div class="divide-details"> <h2><a href="#" title="view social perspective...

java - Setting both error message and body from servlet -

i want write servlet return http response so: http/1.1 500 <short custom message> content-length: ... <longer custom message> the reason want programmatic client able process response message take particular response want fill in response body longer explanation it's easy hit using browser. now, httpservletresponse has senderror(int, string) method allows me specify error code , message. javadocs message embedded in kind of html page, nothing setting http response message. after calling method, not allowed write else response. in tests (with jetty), message used both http response , html body, fine me, except want specify 2 different strings , don't think setting of http response message guaranteed different implementation. there's setstatus(int) method can call code, , can write own html body. close, except can't specify http response message. finally, there's setstatus(int, string) method want, it's deprecated due kind of ambigui...

asp.net - onClick event in VB.NET -

i programming in vb.net. trying make onclick event div tag. how can make in code behind? one possible solution create webusercontrol panel(will rendered div) , invisible button(display:none). onclick of div click button per javascript cause automatic postback. in codebehind catch buttonclick-event , raise custom event(divclicked). can reuse control everywhere. this: clickablediv.ascx <%@ control language="vb" autoeventwireup="false" codebehind="clickablediv.ascx.vb" inherits="webapplication1.clickablediv" %> <asp:panel id="thediv" runat="server" onmouseover="this.style.cursor='pointer'" onclick="this.nextsibling.click()" /><asp:button id="divbutton" runat="server" /> clickablediv.ascx codebehind partial public class clickablediv inherits system.web.ui.usercontrol public event divclicked(byval src clickablediv) private sub pag...

c# - When should Page.Header.DataBind be called? -

i'm trying resolve correct paths javascript scripts in head section using: <script src="<%# resolveurl("~/scripts/jquery-1.4.2.min.js") %>" type="text/javascript" /> in order resolve path need call databind using page.header.databind(); event should place databind call in? thanks. reference: http://leedumond.com/blog/the-controls-collection-cannot-be-modified-because-the-control-contains-code-blocks/ when put in page_load article suggests works (only firefox), wonder if correct place. when follow article ie 8 renders: <script src="/scripts/jquery-1.4.2.min.js" type="text/javascript" /> and firefox 3.6 correctly renders: <script src="../../scripts/jquery-1.4.2.min.js" type="text/javascript" /> update: fixed browser issues updating script reference in referenced user control use resolveurl. browser issues fixed. still wondering put databind. change <...

Android - getResources() and static -

i've got class public class preferences extends preferenceactivity implements onsharedpreferencechangelistener out of try call method class. method contains: mfoo.settextcolor(getresources().getcolor(r.color.orange)) but doesn't work. tells me getresources isn't static... how can change this? but doesnt work, tells me, getresources isnt static... how can change? this means trying call getresources() static method, rather regular (instance) method. easiest thing in case, if mfoo textview or other widget, call getresources() on context available widget: mfoo.settextcolor(mfoo.getcontext().getresources().getcolor(r.color.orange)); however, fact trying reference widget named mfoo static method scares crap out of me. asking memory leak. think need reconsider use of static data members , methods.

jquery - Overriding Javascript Confirm() while preserving the callback -

point, want override standard js confirm() function within jquery plugin. have figured out how simple function layout below. function confirm(opts) { //code } now, want call function within confirm function above, so... function confirm(opts) { openmodal(opts); } the openmodal function open custom modal window message , required buttons. buttons both <span> id of either submit or cancel . submit returns true , cancel returns false. now, how return either true or false based on button clicked? for example... $('#openmodal').live('click', function() { var opts = { title:'modal title', message:'this modal!' }; var resp = confirm(opts); if(resp) // user clicked <span id="submit"></span> else // user clicked <span id="cancel"></span> }); hopefully understand mean. this is possible not describe. typical way confirm function used is: if(conf...

delphi - How to override loading a TImage from the object inspector (at run-time)? -

aplogies top posting. has buggged me years , need know answer. put 150 points bounty attract interest, increase right answer. here need: i use tms obejct inpsctor tms scripter pro allow users design form @ run-time. can assume derives standard delphi object inspector , adds little functionality 90% of calls inherited methods. when click ellipsis next picture property of timage calls inherited method - don't know - allow me load picture. when have done so, not know file image loaded , want save same name in different directory. i prompt user file name, looks confusing him , plain sloppy. i find timage / tpicture descendant stores file name , allows me query it. can point out such foss component gets bounty. i derive tpicture , or timage , code myself, not change. can tell me how code gets the bounty. exactly, mean naming classes , methods. thanks in advance help. 1 annoys me. further my previous question , did not useful answer despite bounty, try rephrasing...

ruby on rails - passing hash object values as search parameter -

i have table "email" field "contents" data stored hash object. want search in table parameter "email => a5his@gmail.com" :email key , "a5his@gmail.com" value of hash object. thanks in advance this search going extremely inefficient. if plan on doing lot of of searches email, might prudent add indexed column store email in table. i assuming contents text field store serialized hash. hashes serialized using yaml format, in plain text. can perform regular wild card searches on content column. eg: hash shown below {"email" => "a5his@gmail.com"} is serialized in string "--- \nemail: a5his@gmail.com\n" so can write simple matcher follows: email.all(:conditions => ["content ? ", "%email: #{email}%"]) if planning on querying several dynamic fields then, class email < activerecord::base def self.find_all_by_dynamic(hash) ca = hash.map {|k, v| ["cont...

How do I obtain the height and width of a given YUV video clip under Matlab? Is there any reader() function or get() function? Anything else? -

how width , height of given yuv file? dimensions needed subsequent movie/matrix processing. from of videoreader %# create reader object (does not load file yet) xyloobj = videoreader('xylophone.mpg'); %# query dimensions nframes = xyloobj.numberofframes; vidheight = xyloobj.height; vidwidth = xyloobj.width; edit for older versions of matlab, can use aviinfo query properties of movie.

javascript - Will we soon have online IDE that is based on Skywriter? -

i saw skywriter released , looks promising people want create online ide other programmers. will have online ide based on skywriter think? although not based on skywriter online ides here. one of complete ones i've played around far coderun . palm's ares ide impressive. the cool part skywriter though since it's open source can integrate own applications. don't need wait new service make ide. throw on own site , edit pages on fly. particularly easy php.

Zend Architecture optimal use in website -

i have site needs user side , admin side. i can create 2 index files(dispatch) 1 each. site/index.php , site/admin/index.php. both side use same zend library , models. other things (controller,view,layout etc...) separate. application/controllers , application/admin/controllers or can use admin panel module . which best. may need change path of admin panel may site/xyz/something/admin , may need specific work admin side. now zend library class should use following concerns. date validatation , verification ( server side checks) sql injection ( use of '?' in sql select/insert/update statement instead of putting variabledirectly) url encryption url rewrite ( zend routes best 1 this) file uploading html forms (use zend forms have in build in feature validation not usefull in cases. prefer use form tags directly) advise on , suggest if have more ... zend_validate_date zend_db_adapter_abstract::quote zend_view_helper_url zend_controller_router_abs...

objective c - How do you use event handlers with parameters? -

i'm trying sort out how events work. in video 4 of stanford course on itunes u, alan cannistraro says there are "3 different flavors of action method selector types - (void)actionmethod; - (void)actionmethod:(id)sender; - (void)actionmethod:(id)sender withevent:(uievent *)event;" i thought i'd try them out simple adding program - enter 2 numbers , type sum gets places in 3rd uitextfield. have method no-parameter signature, , works fine. when change second sender parameter, code stops calling method. this works: -(void) setsum { float a1 = addend1.text.floatvalue; float a2 = addend2.text.floatvalue; float thesum = a1 + a2; nsstring * ssum = [nsstring stringwithformat:@"%g", thesum]; sum.text = ssum; } -(void)awakefromnib { sel setsummethod = @selector(setsum); [addend1 addtarget: self action: setsummethod forcontrolevents: uicontroleventeditingchanged]; [addend2 addtarget: self action: setsummethod forcontrolevents: uicontroleventeditingchanged]...

image - how do I upload a photo to facebook from my app, and have it NOT post to the wall? -

my iphone app uploads pictures user's facebook account, , automatically placed in app's photo album on facebook. in majority case, user's wall automatically updated denote photo updated. dont want this, because prefer make separate wall post link photo. it's silly user's wall have 2 entries on thumbnail of same image. 1) how can upload photo using graph api in such way isn't announced on user's wall 2) how can tell if photo upload resulted in announcement on user's wall -- doesn't. i'd rather not have ask permissions read user's wall.. from this facebook doc: if suppress story automatically generated in user's feed when publish photo (usually because plan on generating own), can add no_story=1 parameter. in case, user receive notification application has uploaded photo.

maven 2 - Do I need to install glassfish server to use it as embedded server in application? -

i trying use glassfish embedded server in ejb3.1 project. below maven dependencies.. when run tests fails deploy ejb modules. need set javaee.home or more variable ? <dependency> <groupid>org.glassfish.extras</groupid> <artifactid>glassfish-embedded-all</artifactid> <version>3.1-snapshot</version> <scope>test</scope> <type>jar</type> </dependency> <dependency> <groupid>org.glassfish.extras</groupid> <artifactid>glassfish-embedded-static-shell</artifactid> <version>3.1-snapshot</version> <scope>test</scope> <type>jar</type> </dependency> <dependency> <groupid>javax</groupid> <artifactid>javaee-api</artifactid> <version...

jquery - Keyboard events -

how call click event of link, when keyboard button pressed? i call next/previous page on ctrl + → / ctrl + ← $(document).keydown(function(e) { if(e.ctrlkey){ if(e.keycode == 37){ //ctrl + leftbutton pressed $("a.prevbutton").trigger("click"); }else if(e.keycode == 39){ //ctrl + rightbutton pressed $("a.nextbutton").trigger("click"); } } }); fiddle live

php - How Do I Create a JSON Feed from a MongoDB Collection -

i'm creating cms client work photographs , sell them on site. cms end front end, both ajax, it'd nice json feed setup can use same feed generate new "pages" , "views" js. so example feed have {[name:'a photo',description:'lorem ipsum...'],[...]} , jquery or js can create table of photographs, pages, etc. how can set myself? should create php file gets data mongodb put's in array convert array json? $cursor = $this->collection->find($params); $return = array(); $i=0; while( $cursor->hasnext() ) { $return[$i] = $cursor->getnext(); // key() function returns records '_id' $return[$i++]['_id'] = $cursor->key(); } return json_encode($return); that how return json frrom mongo.

How to filter a sub list which is part of another list in C# -

i want filter list part of list. consider, class mainclass properties string name string mainaddress list<subclass> extrainfo class subclass properties string address string city string phoneno now have 10 items in list , each item in list has 2 extrainfo items list items. now want filter list items condition city == "new york". so, 10 items in main list (list) should have extrainfo (list) items based on filter condition. i mean want filter sub list not main list. thanks in advance! sample data name mainaddress extrainfo address city phone no 1. vimal bangalore north street new york 654564646 --->sub item 1 north street california 464654565 --->sub item 2 hareesh chennai north street washington 546466466 --->sub item 1 ...

drupal - is Zen nineSixty theme compactible with iPhone? -

i have created custom theme using zen ninesixty (960 grid system) in drupal , works , looks great on major browsers. wondering if let me know if need else theme working on iphone or auto compatible. many of our potential clients use iphone wanted check in if zen ninesixty (960 grid system) iphone compatible. thanks! you don't have special things work on iphone. iphones can render normal webpages use webkit after all. 960 grid system wont problem either. if want make slick, have make mobile version though. can make site native application.

objective c - Editing one object in an NSMutableArray also changes another object in the NSMutableArray -

i had navigation application working normally. in table view, last item called "add item", , if user pressed it, create new object , pass view user enter details object. when user returned previous screen, new object show in array displayed in table. i changed "add item" field first field in table, not last. made appropriate changes array display correctly on table. however, noticing strange behavior. if edit first object in array, 7th object changes same object. if edit second object in array, fourth , sixth object change same. if edit third item in array, fifth object changes same. what happening? in viewdidload: method initialize object this: persondetails *persondetails = [[persondetails alloc] init]; this method gets executed when user selects row on table - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { // navigation logic may go here. create , push view controller. updatepersonarray = yes; arrayin...

c# - Check if a object is the same -

im doing queries active directory, building own dictionary contain name, phone , email per user. then store user file, this: domain\groupt\group\user; <checksum> where path before ; unique id user (a user can in different groups have track that) , <checksum> .gethashcode() of dictinary object user. then have timer every 30 sec checks ad , builds same dictinary user , looks id , checksum file. but not working. reason .gethashcode() generates new int when there no change name, phone or email... im thinking not function use. so how check if object has changed in way tried describe above? you may have override gethashcode method of user object create custom one. something public override int gethashcode() { return string.concat(this.domain,this.name,...).gethashcode(); } but, anyway comparing hashcodes ensures objects not equal when result different, if hashcodes same still have check if contents same or not. hashcode useful distributing object...

Css mulitple class selector -

i trying select element multiple classes. .parent1 .subparent2 .class1, .parent1 .subparent2 .class2, .parent1 .subparent2 .class3 { } as .parent1 .subparent2 .class1.class2.class3 to select element 3 classes doesn't work. any idea how this? what have works, if browser supports it , you can test here . here's test markup: <div class="parent1"> <div class="subparent2"> <div class="class1 class2 class3">match</div> <div class="class1 class2">no match</div> </div> </div>​ with current selector: .parent1 .subparent2 .class1.class2.class3 { color:red; }​ based on comments: clear, 2 selectors not equivalent, this: .parent1 .subparent2 .class1, .parent1 .subparent2 .class2 ... means child can have any of classes , match, this: .parent1 .subparent2 .class1.class2.class3 means child has have all of classes match, serve different pur...

Making Visual Studio TFS plugin store your credentials? -

every time open visual studio 2008, pop-up dialog prompting username , password ('connecting team foundation server'). presumably because have tfs server stored in team explorer tab, in servers, wants connect on startup. in addition, happens when open solution file solution associated tfs source control, obvious reasons. my problem identical described in various places on web, such as: http://kevinsmi.wordpress.com/2009/10/07/getting-visual-studio-to-remember-your-tfs-credentials-on-windows-7/ http://social.msdn.microsoft.com/forums/en-us/tfsgeneral/thread/186a469c-bc58-48c4-9db9-ffc2e0fedb11 http://hastobe.net/blogs/stevemorgan/archive/2008/08/25/stop-visual-studio-prompting-for-tfs-credentials.aspx in cases can see, suggested solution add tfs server credentials windows' stored credentials. i'm using windows 7, think way in credential manager. well, i've added tfs server credentials 'windows credentials' list, , still prompt username , p...

android - VideoView invisible in Popupwindow? -

Image
my target: trying play video when tapping on 1 of item on screen while still staying on screen. so resort popupwindow somehow videoview doesn't show in popup. i can display popup fine videoview doesn't(in fact, it's not invisible rather freeze section of screen). if @ second , third screen, see invisible area isn't rectangular. that's because animating popupwindow. i checked videoview inside activity , plays nicely. tested nexus 1 , galaxy s, both display same result. quick search on stackoverflow shows question : android video, hear sound no video leads android not playing video .mp4 , both doesn't work me. also, can see on third screen, mediacontroller doesn't attach video or popupwindow activity instead. here's screens,

python - SpringPython error following the book: AttributeError: 'module' object has no attribute 'ObjBase' -

well, bought book spring python 1.1 , have been facing problems cannot solve. going write code of each file in order make sure clear. if of know problem, please let me know because desperate. simple_service.py class service(object): def happy_birthday(self, name): results = [] in range(4): if <= 2: results.append("happy birthday dear %s!" % name) else: results.append("happy birthday you!") return results simple_service_server_ctx.py from springpython.config import * springpython.remoting.pyro import * simple_service import * class happybirthdaycontext(pythonconfig): def __init__(self): pythonconfig.__init__(self) @object def target_service(self): return service() @object def service_exporter(self): exporter = pyroserviceexporter() exporter.service = self.target_service() exporter.service_name = "service" exporte...

How to create an xml file and write in android and put into raw folder -

can tell me how create xml file, , write in android, , put file accessed again? possible put raw folder ? can tell how create xml file , write in android use java i/o . where put file aceess again use getfilesdir() place in on-board flash available application. is possible put raw folder ? no, sorry, cannot modified @ runtime.

syntax highlighting - python code highlighter for publishing in html -

i'm looking python code highlighter publishing html. i've found site http://quickhighlighter.com highlighting well. if try copy/paste python code text file, mess. if know better tool, please let me know. thanks in advance. pygmentize , handles lot more languages python , lot more formats html.

c# - Automatic Disposal Extension Method reasonable? -

i've been writing custom winform controls pretty heavy amount of drawing , therefore tend have lot of disposable graphics based fields lying around (brushes, pens, bitmaps etc..) , result control's dispose() method has call dispose on each of them. i got concerned (or future maintainer) miss field needs disposed, either forgetting dispose or not realising implements idisposable. such wrote simple extension method on object finds idisposable fields , disposes of them: static public void disposeall(this object obj) { var disposable = obj.gettype() .getfields(bindingflags.nonpublic | bindingflags.public | bindingflags.instance) .select(fi => fi.getvalue(obj)) .where(o => o != null && o idisposable) .cast<idisposable>(); foreach (var d in disposable) d.dispose(); } my question whether reasonable thing do. can't think might screw up, i'm not partic...

php - is it possible to automatically delete a row in a table if a certain condition is met? -

is possible automatically delete row in table if condition met? for example products table pid pname quantity 1 shoes 5 now condition must if quantity equal 0 whole row must deleted issue query delete table quantity = 0 , rows satisfying condition deleted.

background - iPhone: Since when did SKPaymentQueue addPayment trigger the applicationWillResignActive callback? -

did miss information in documentation? going mad?? i'm debugging payment issues , have discovered following code triggering our applicationwillresignactive callback in app delegate. skpayment *payment = [skpayment paymentwithproductidentifier:productid]; [[skpaymentqueue defaultqueue] addpayment:payment]; this happening on ios3 makes me think has been behaviour, haven't noticed because didn't implement applicationwillresignactive callback before ... is itunes storekit meant do? can't find official reference anywhere? indeed, see nothing in docs app resigning when payment added, can confirm happens me well. don't implement applicationwillresignactive: or applicationdidbecomeactive: , tossed them in see if triggered, , sure enough, do.

javascript - Reference script container element? -

i'm wondering if there way handle on dom element contains script inside it. if had: <script type="text/javascript> var x = ?; </script> is there way can assign "x" reference script element contains "x"? you include marker text in script element, , (similar david said), can loop through script elements in dom (using getelementsbytagname or whatever features library, if you're using one, may have). should find element reliably. ( live example ): <body> <script id='first' type='text/javascript'> (function() { var x = "marker:first"; })(); </script> <script id='second' type='text/javascript'> (function() { var x = "marker:second"; })(); </script> <script id='third' type='text/javascript'> (function() { var x = "marker:third"; })(); </script> <script...

Custom AutoComplete in Android -

i want display list of contact names respective phone numbers like vikas patidar <9999999999> rahul patidar <9999999999> using autocompletetextview when user type text in mobile number field. in default style can display list of names. can please tell me how can implement when user select item in list , can display number of in mobile number field. you need use adapter task. example, simpleadapter : simpleadapter adapter = new simpleadapter(context, list, r.id.row_layout, new string[] { "name", "phone" }, new int[] { r.id.name, r.id.phone }); autocompletefield.setadapter(adapter); for need make layout xml file , list must of type list<? extends map<string, ?> . strings in 4th parameter keys maps in list. ints in 5th parameter identifiers of components in layout file. or can extend adapter , use it. see link reference.

javascript - How third party sites can check if user agreed/pass sth on my site, so they can let him pass sth on their sites? -

how third party sites can check if user agreed something(i.e. click ok)/pass test on site, can let him pass hidden resources on ther site? problem is, user should not asked register on third party sites, , give sites javascript paste code , merely button , text. if help, using django. don't understand sth/pass sth means can bet answer **cookies**. edit: well, session information stored cookies have it, they're not enough. need service on domain (a server script) called 3rd party sites ajax. service respond if user qualifies (i.e. give valid/invalid output). i refute previous answer on grounds not offer solution question, not in way find solution , technically incorrect. new answer: choose method validate user did action (a cookie maybe). have server script on site responds questions validation. uservalidates.py . should check if user did action (check cookie). provide javascript snippet 3rd party includes on site. snippet create invisible iframe...

how to install module onto linux kernel 2.6.29 -

i plan install module usbserial.ko linux kernel 2.6.29, knows procedure? thanks if module compiled kernel headers, should able put in /lib/modules/2.6.29... depending on distro, name of directory under modules might different. after placing module in directory, can run: depmod -a and try , load module using: modprobe usbserial again, module has compiled current kernel sources version or else won't load correctly (check output of modprobe).

Rails 3 and 2.3.8 fail to save a model called "Update" -

i have this: class update < activerecord::base has_many :comments end class comment < activerecord::base belongs_to :update end update.first gives: #<update id: 1, body: "update 1", ...> comment.first gives: #<comment id: 1, update_id: 1, body: "comment 1", ...> when doing this: comment.first.update_attribute(:body,"this fails saved") and comment still contains "comment 1" i.e. record silently fails updated. now comes weirdest part. when remove 'belongs_to :update' comment update_attribute method succeeds . any ideas?

html - Change the look of a website when inside an Iframe -

it possible change of website (say colours, width) when contained in frame? i looking technique gonna work in browsers. you can use approach mentioned @ wiki page dedicated frame killers: http://en.wikipedia.org/wiki/framekiller

svg won't display in firefox -

is there wrong code? picture displays fine in safari firefox doesn't display anything: <div id="container"><img src="picture1.svg"/></div> you need firefox 4.0b6 or later svg in img work there, here's bug if you're interested. opera has supported svg-in-img since version 9.5 .

php - displaying names in an array -

using array_chunk have split array of names groups of 4 names, want take 1 of these groups , display in 4 divs, divs named after 1 of member group names, example group->jhon, mark, giovanni, clara divs <div id="jhon></div> <div id="mark"></div> , on.. want display other names in div not equal divs name you're creating divs @ same point you're outputting names? maybe help: $garray = array("jhon","mark","josh","buckwheat"); dogroupdiv("jhon",$garray); function dogroupdiv($group, $grouparray) { echo '<div id="' . $group . '">'; foreach ($grouparray $name) { if ($name != $group) echo $name . "<br>"; } echo '</div>'; } should yield: <div id="jhon">mark<br>josh<br>buckwheat<br></div>

c - xxd binary dump problems -

Image
is above output in format should expected xxd or presence of bizzare characters on right suggest i've done wrong? i'm attempting serialise simple linked list , that's output get. failing remove sentinal character "\0" serialisation cause error? i'm guessing serializing binary not strings , normal. each 2 hex digits on left correspond 1 character on right. one byte , i.e. 8 bits. characters printable (see ascii table bellow), not (shown dots). ascii table - | hex value - name/char | | 00 nul| 01 soh| 02 stx| 03 etx| 04 eot| 05 enq| 06 ack| 07 bel| | 08 bs | 09 ht | 0a nl | 0b vt | 0c np | 0d cr | 0e | 0f si | | 10 dle| 11 dc1| 12 dc2| 13 dc3| 14 dc4| 15 nak| 16 syn| 17 etb| | 18 can| 19 em | 1a sub| 1b esc| 1c fs | 1d gs | 1e rs | 1f | | 20 sp | 21 ! | 22 " | 23 # | 24 $ | 25 % | 26 & | 27 ' | | 28 ( | 29 ) | 2a * | 2b + | 2c , | 2d - | 2e . | 2f / | | 30 0 | 31 1 | 32 2 | 33 3 | 34 4 | 35 5 | 36 6 | 37 ...

c# - DataContractSerializer not deserializing all variables -

i'm trying deserialize xml without having original class used create object in xml. class called comopcclientconfiguration. it's succesfully setting serverurl , serverurlhda values, not rest of them... i'm asking is: how can make rest of these values set properly, , why aren't working current code. here deserialization code: conf xelement represents comclientconfiguration xml datacontractserializer ser = new datacontractserializer(typeof(comclientconfiguration), new type[] {typeof(comclientconfiguration), typeof(comopcclientconfiguration) }); comopcclientconfiguration config = (comopcclientconfiguration)ser.readobject(conf.createreader()); i don't know why have have comclientconfiguration , comopcclientconfiguration, there's better way known types hack have. it's have. here xml looks in file. <comclientconfiguration xsi:type="comopcclientconfiguration" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <...