Posts

Showing posts from August, 2012

Facebook fan page iframe tab links not opening in the iframe -

i have basic facebook iframe application sits inside fan page tab. want have links in application open inside of iframe. tried change target _self no sauce, of links open in new window. application here remove target="_blank" attribute links. btw, that's not iframe application. looks static fbml tab app.

c# - How to tell a GridViewRow to perform as a SEO-friendly link? -

i have gridview has multiple columns. let's have business modell looks this: public class myobject { public string title {get;set;} public datetime date {get;set;} public string navigateurl {get;set;} } my grid has 2 visible columns (title , date). want do, make each row clickable , act link, going specified navigateurl. no problem far. i use onrowdatabound-event assign javascript tells grid performed select , in onrowevent, perform response.redirect. not want do, because not seo friendly. how can make whole "grid row link" idea seo friendly? edit : adding extra, visible column no option provide link column in grid, , make tr's onclick event fire off link.

c# - How to get the return value of a JavaScript function/Object on Webbrowser Control -

how can can get/capture value of javascript object on page rendered in webbrowser control, or alternatively capture return value of function? the example saw following in delphi. looking better solution in c# http://www.delphidabbler.com/articles?article=21 you need invokescript call of htmldocument. msdn documentation on objectforscripting

php - How to: overwrite defined array with new POSTED data -

i'll redefine old unanswered & messy question 'cause i'm begging help. anyone... i have line inside file (choices.php) has: some choice1...||other choice2...||some data here...||overwrite me! old! on other page there button post (and store/save) new data choices.php. newdata have overwrite text ($arrkey[3]) i tried explode / implode , file_put_contents , i've found browsing answers. far newdata being added @ end of line: some choice1...||other choice2...||some data here...||overwrite me! old!i'm new data! instead of: some choice1...||other choice2...||some data here...||i'm new data! if got question right, following code want : $entries = explode('||', file_get_contents('choices.php')); $entries[3] = $_post['myfield']; // may want more strict checking before that. file_put_contents('choices.php', implode('||', $entries)); and, way, choices.php bad name, since file doesn't contain...

Simple Java Overriding Methods -

i wondering if possible override java methods in simpler way. basic problem have collection of methods, example can calculating mean of array of values. problem want have method work number variables types (int long double float etc.) there way besides creating: a new method each parameter type having new methods call 1 base method parsed parameters any appreciated. when reviewing answer, noticed have been using generics, didn't know called. here example of mean snippet. public double arithmeticmean(list<double> data) { double sum = 0; (double number : data) sum += number; return sum / data.size(); } i wondering if there anyway generalize other number variables (besides forms listed above.) have investigated using generics , define new calculator object double , float , integer etc. ?

range - How can I find and print all of the numbers between two numbers in PHP? -

right i'm asking user 2 numbers. i'm trying print numbers in between $one , $two assuming $one smaller $two. just simple for loop should trick: for($i=$a; $i<=$b; $i++) { echo $i; }

Working with Event Handlers in .NET -

when adding handlers indiscriminately object's events, realized can attach same handler event many times like. means handler called once each time attached. i'm wondering these things: is there way @ handlers have been added object's event? is possible remove handlers event? where these correlations between event , handler stored? if event marked c# event keyword there's no way outside object see subscribers - requisite information not visible. from inside, can done, though complex , relies on details of implementation might change (though, haven't yet). a workaround might useful though, it's valid remove handler that's not there - no exception thrown. so code valid: myconnection.closing -= connectionclosinghandler; myconnection.closing += connectionclosinghandler; if you're subscribed event, first line removes subscription. if you're not subscribed event, first line nothing. the second line hooks new subscriptio...

view - How to implement the ScrollImageView class in my Android application -

i found class: import android.content.context; import android.graphics.bitmap; import android.graphics.canvas; import android.graphics.paint; import android.util.attributeset; import android.view.display; import android.view.motionevent; import android.view.view; import android.view.windowmanager; // borrowed https://sites.google.com/site/androidhowto/how-to-1/custom-scrollable-image-view public class scrollimageview extends view { private final int default_padding = 10; private display mdisplay; private bitmap mimage; /* current x , y of touch */ private float mcurrentx = 0; private float mcurrenty = 0; private float mtotalx = 0; private float mtotaly = 0; /* touch distance change current touch */ private float mdeltax = 0; private float mdeltay = 0; int mdisplaywidth; int mdisplayheight; int mpadding; public scrollimageview(context context) { super(context); initscrollimageview(context); } ...

mercurial - Globally increment the Last Build Label across multiple CruiseControl.NET projects -

we use cruisecontrol.net automate our builds , keep track of last build number. however, number resets 1 newly created cc.net projects. last build number sequence continue branched projects (e.g., patches existing releases). is there way globally increment last build label across multiple cruisecontrol.net projects? th build number kept in project's state file. if branch, take build number original project's state file , put 1 of branch project (or copy state file , make necessary edits file name, project name etc.). since state files xml should easy enough programmatically if branch process script-based.

sql - MySql query same table to gather to-date and year-to-date information -

i've been struggling problem hours, though i'm sure there easy answer. i'm attempting gather monthly information , year-to-date information same table. i'm joining second table gather group name. expense table: +-----------------+---------------+------+-----+---------+----------------+ | field | type | null | key | default | | +-----------------+---------------+------+-----+---------+----------------+ | id | int(5) | no | pri | null | auto_increment | | account | char(14) | no | | null | | | batch | int(5) | no | | null | | | date | date | no | | null | | | description | varchar(50) | no | | null | | | debit | decimal(10,2) | no | | null | | | credit | decimal(10,2) | no | | null | | | account...

php - How do you query two variables in order to return one result? -

i have database columns assigned username, datepro, , quantity. $datepro date $quantity of material produced $username. i'm trying query results echo $quantity of material produced during month $username. i've experimented , searched posted cannot seem figure out on own. guidance appreciated. here's have... $resultdate = mysql_query ("select datepro power username = '$username' ") or die(mysql_error()) ; $resultquant = mysql_query("select quantity power username = '$username' ") or die(mysql_error()) ; $datepro = mysql_fetch_row($resultdate); $quantity = mysql_fetch_row($resultquant); if ($datepro = '%y-01-%d') echo $quantity; are after this: $queryobj = mysql_query ("select datepro, quantity power username = '$username' ") or die(mysql_error()) ; $row = mysql_fetch_assoc($queryobj ); if ($row['datepro'] == '%y-01-%d') echo $row['quantity'];

objective c - UIView frame larger than iPhone's screen -

i have made new iphone view-based project in xcode, , have @ xib generated, name myappviewcontroller.xib . in xib, generated view's frame looks this: { x = 160, y = 230, w = 320, h = 460 } view supposed fill entire screen, excluding status bar. expect view's frame this: { x = 0, y = 0, w = 240, y = 300 } older iphones, , { x = 0, y = 0, w = 480, h = 600 } retina display. however, weird values above. can please explain me happening here, ruining of drawing code in other project (the area draw based off of frame of view). retina display doesn't increase point size of view. when apple introduced it, made difference between points , pixels . retina display has more pixels, same amount of points. in code related uikit in points, no changes needed there, view of 100x100 still size. i don't understand question frame value can modified bounds property , center property... check if you're not modifying those.

php - Writing user input to a file -

the below code doesn't create info.txt file , dies: how can show error codes in such case - appending die command "."? $morf .= $name ." ". $family; $morf .="with username " . $user; $morf .=" , password " . $pass; $morf .=" lives in " . $city; $filelines = ""; if (file_exists("info.txt")) { $filelines = file_get_contents("info.txt"); $filenewlines = $filelines . $morf . "\n"; file_put_contents("info.txt", $filenewlines); } else { die("something went wrong !"); } you can use try...catch have debugging information upon encountering error. also, not sure if intentional, logic there has script fail when file not exist. i've included allowance condition here, not if intent. try { // not continue if file not exist if (!file_exists("info.txt")) die('something went wrong: file not exist'); // appen...

javascript - Pass additional parameters to jQuery each() callback -

i'm working on app present surveys user. markup looks this: <body> <div class="question" id="q1"> question 1 </div> <div class="question" id="q2"> question 2 </div> <!-- etc --> </body> i want construct javascript objects dom using jquery, in survey constructor i'm traversing jquery set using each() method. problem within callback function i'm unable reference survey object in order append each question object survey.questions array. how can reference survey object? there way pass additional parameter (e.g. reference survey object) callback function? function survey() { this.questions = new array; $('.question').each(function(i) { (/* survey object */).questions.push(new question(this)); }); } function question(element) { this.element = $(element); } you should able create reference survey before iterate on ques...

sql - Calculate BMI From Height / Weight tables -

clarification upon working through answers , reading interpretations of question, have following add. i need generate entire bmi history, not single value. every value in both tables needs paired (if possible) relevant value in other table. simple problem given entry in patientheight, compute bmi(body mass index) entries in patientweight entrydate falls between current patientheight entrydate , previous patientheight entrydate. true unless there entrydates in patientweight > entrydates in patientheight. in case, use latest patientheight entry compute bmi. for every entry in patientheight, compute bmi(body mass index) appropriate corresponding values in patientweight. some logic: patientheight's entrydate <= patientweight's entrydate when pairing patientheight has 1 many relationship patientweight patientheight must take account entrydate of previous patientheight , use lower boundary when matching entrydates in patientweight i have function co...

mod rewrite - Apache mod_rewrite does not work -

im using j2ee application spring framework 2.0 on apache tomcat 5.5. have used url mapping change extension .jsp .htm. have url looks http://www.800promotion.com/promotion.htm?cid=1344159422528120632840257756098788 want change http://www.800promotion.com/1344159422528120632840257756098788 have referred samples of working on mod_rewrite. cant seem working. these lines in .htaccess file. rewriteengine on rewriterule ^([^/.]+)/?$ /promotion.htm?cid=$1 [l] i have checked host , said mod_rewrite supported on server. not have access httpd.conf file. have verified support allowoverride set all. when hit url page works fine url doesnt mapped. going wrong? rewriteengine on rewriterule ^(.+)$ promotion.htm?cid=$1 [qsa,l] try this

c# - How do I display Enum Properties in a Dropdownlist? -

i'm making simple custom control , have dropdownlist of defined custom properties , i'm perplexed why code below fails display enum in properties list of combobox. how display enum values in dropdownlist? public partial class mycombobox : combobox { public enum multipliers { b = 1, kb = 2, mb = 10, gb = 20, tb = 30 } { get; set; } public string supertype { get; set; } public bool global { get; set; } } you're not showing code relating how you're putting enum values actual display list. have point combobox @ enum datasource (technically have point @ call enum.getvalues(typeof(multipliers)) ), or manually manipulate items collection, values list.

php - Help resolving SQL error that occurs in code but not in SQL workbench -

i run command in sql workbench , returns desired results, return syntax error in browser... $sql = "select substring(`last_name`, 1, 1) alpha, substring(`middle_name`, 1, 1) submiddlename, `idclients`, `type`, `first_name`, `middle_name`, `last_name`, `address`, `primary_number`, `secondary_number`, `home_number`, `office_number`, `cell_number`, `fax_number`, `ext_number`, `other_number`, `comments` `clients` `user_id` = 2 , `is_sub` = 0 , `prospect` = 1 order `last_name`"; also user_id , is_sub , , prospect of int data type if wants know. tried treat them strings in query, still didn't help. this error get you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'and prospect = 1 , type = 'buyer'' @ line 1 you're not showing same ...

c++ - How can i check for specific window name while enumerating EnumChildProc in WinApi? -

so far have been using getclassname() window handle class name interested me while enumerating enumchildproc() right in situation plenty of hwnd's use same classname way identify window assume name unique. so while enumerating thinking use like... if getwindowname() == need... have no idea function can use this, there function getwindowname() can use in enumeration? getwindowtext ?

gem - Finding the current version of rails 2.3 -

is there way of finding out current version of rails 2.3 is? right ruby on rails page has link blog post 2.3.11, imagine after few more blog posts no longer there. tried find way "gem" command, didn't see it. if run "gem update rails" don't options-- updates me rails 3.0.4, not ready yet. can "gem install -v 2.3.11 rails" presumes know current version is. also, on rails web site, there link page on rubyforge can download gem files latest 1 there 2.3.4, no help. you can run command gem list --remote -a | egrep "^rails " | awk '{ (i=1;i<=nf;i++) print $i }' | grep '2.3.' . lists versions of rails 2.3, , 1 @ top latest one.

.net - Save an excel file to a csv file in C# code -

i want open excel file , save csv file. google search no lucky. need c sharp code it. thanks nice help. if willing use excel interop: excel.application app = new excel.application(); excel.workbook wb = app.workbooks.open(@"c:\temp\testtable.xlsx"); wb.saveas(@"c:\temp\output.csv", excel.xlfileformat.xlcsvwindows); wb.close(false); app.quit(); console.writeline("done!");

Inverting results when searching error logs in App Engine's dashboard? -

is there way invert results when searching error logs in gae dashboard? (similar grep -v command) example, want able filter out paths start string, x. to filter our requests start path /x try filtering on path label: path:/[^x].*

javascript - JS regex to split by line -

how split long piece of text separate lines? why return line1 twice? /^(.*?)$/mg.exec('line1\r\nline2\r\n'); ["line1", "line1"] i turned on multi-line modifier make ^ , $ match beginning , end of lines. turned on global modifier capture all lines. i wish use regex split , not string.split because i'll dealing both linux \n , windows \r\n line endings. arrayoflines = linestring.match(/[^\r\n]+/g); as tim said, both entire match , capture. appears regex.exec(string) returns on finding first match regardless of global modifier, wheras string.match(regex) honouring global.

c# - LINQ Basics, How do I do a groupby and get a string at the end? -

hello have class so class myclass { public string string1; public string string2; public string string3; } and have list of them , want produce list of strings of unique string1 s. list<myclass> myinstance = getinstanceofmyclass(); methodthatrequireslistofstrings( myinstance.groupby(p => ??????? .tolist<string>()); what replace ??????? ? i can't believe i've gone long without doing group lambda expression... in case, not use grouping @ all. if want distinct string1 values, use distinct() . myinstance.select(obj => obj.string1).distinct(); // .tolist() if want learn how group, consider myinstance.groupby(obj => obj.string1).select(grp => grp.key); // .tolist() however, again, go first option.

Convert A String To A Variable in Coldfusion -

i using cfloop generate titles of bunch of variables. problem on output actual variable name ie #qquery.varname# instead of value ie "item name". heres quick taste of code: <cfloop query="qquery"> <cfloop query="qtest"> <cfset vartest = "qquery." & varname> <cfoutput>#vartest#</cfoutput> </cfloop> </cfloop> thanks :) try this: <cfset vartest = qquery[varname]>

Help with jQuery validate and a Zip code restriction based on the 1st three digitss -

i assuming need regular expression here? i have zip code field , zip codes must in city limits of chicago. luckily zip codes begin 606. need poll input make sure zip code entered 5 digits , begin numbers 606: my input basic enough: <label for="dzip"><span class="red">&hearts;&nbsp;</span>zip:</label> <input name="attributes[address_zip]" id="dzip" type="text" size="30" class="required zip-code" /> and script city easy enough. need apply zip-code well: jquery.validator.addmethod("chicago", function(value) { return value == "chicago"; }, '**recipient must reside in chicago city limits**'); may if show how plug-in functions phone-numbers (us). need translate zips: jquery.validator.addmethod("phoneus", function(phone_number, element) { phone_number = phone_number.replace(/\s+/g, ""); return this.opt...

c# - How to enable stream transfer with WCF service on Azure with Membership / Authorization? -

i have hit wall , have been pulling hair quite time now. basically, need create wcf service have asp.net membership , authorization providers, needs allow transfer of byte[] arrays or stream objects , save them azure. service hosted on azure. the problem have wcf wants message layer security exchange of client credentials. had following config works pretty well: <system.servicemodel> <behaviors> <servicebehaviors> <behavior name="defaultservicebehavior"> <servicemetadata httpsgetenabled="true" /> <servicedebug includeexceptiondetailinfaults="true" /> <serviceauthorization principalpermissionmode="useaspnetroles" roleprovidername="sqlroleprovider" /> <servicecredentials> <servicecertificate x509findtype="findbysubjectname" storename="my" storelocation="localmachine" findvalue="securechann...

PHP OOP architecture question (OOP against Roles) -

there users different privileges in system. privileges hierarchical class user{//abstract user not logged in //function signin(){} } class guest extends user{ } class fulluser extends guest{ static function signup(){}//create account function signout(){} } class moderator extends fulluser{ function edit(){}//some new method introduced here,never introduced before } class admin extends moderator{ //can } //can use fulluser::signup() is architecture good? can advice me else? wondering best way create user - write constructor? or let "factory" function. function signin($username, $password) i'm new oop in php, accept wise advices, links, etc. edit : i'm planning use role - checking system: if(!method_exists($user->addcomment())) die('access denied') what think of it? edit 2: should create role table role in axis x , method in axis y? comment | post | editpost | kill guest ...

Removing contents of variable in C -

i want delete contents of int variable when gets else statement. the program requests number between 1 , 5 using scanf , number stored in int variable , if number isn't between 1 , 5 user directed else statement , have used goto statement take start , wondering how removed contents of variable during else statement don't create continuos loop. with getchar it's fpurge(stdin). i'm running mac os x. below code: include int main (int argc, const char * argv[]) { int code; start: puts("please type error code."); puts("range 1-5: "); scanf("%d", &code); switch(code) { case 1: printf("information\n"); case 2: printf("information\n"); case 3: printf("information\n"); case 4: printf("information\n"); case 5: printf("information\n"); default: printf("information\n"); goto start; } } ...

iphone - ViewWillAppear/Disappear not called when the view is created programmatically -

i have root view controller class. view has few buttons. on click of button, show tab bars. basically, have implementation of tab bar , navigation controls. basically, have data shown in table view format. other view created programmatically. now, problem on root view able hide navigation bar using [self.navigationcontroller setnavigationbarhidden:yes animated:animated]; but, when click on buttons, navigation bar hidden on next view.i tried putting breaks on viewdidappear , viewdiddisapear method these methods not fired. can please me on how ensure either these methods fired or on how navigation controller shown except on first view. similar problems have been posted onto on , on , over. here explanation, check post, pay attention answer given @cduhn. push viewcontroller using uinavigationcontroller calls viewdidappear: , viewwillappear:

What's the shebang/hashbang (#!) in Facebook and new Twitter URLs for? -

i've noticed long, convoluted facebook urls we're used this: http://www.facebook.com/example.profile#!/pages/another-page/123456789012345 as far can recall, earlier year normal url-fragment-like string (starting # ), without exclamation mark. it's shebang or hashbang ( #! ), i've seen in shell scripts , perl scripts. the new twitter urls feature #! symbols. twitter profile url, example, looks this: http://twitter.com/#!/boltclock does #! play special role in urls, ajax framework or since new facebook , twitter interfaces largely ajaxified? using in urls benefit web application in way? this technique now deprecated . this used to tell google how index page. https://developers.google.com/webmasters/ajax-crawling/ this technique has been supplanted ability use javascript history api introduced alongside html5. url www.example.com/ajax.html#!key=value , google check url www.example.com/ajax.html?_escaped_fragment_=key=value fetch non-ajax v...

Why is a modulo operator (%) result implicitly cast to the left side rather than the right side in C#? -

take following code: long longinteger = 42; int normalinteger = 23; object rem = longinteger % normalinteger; if rem remainder of longinteger / normalinteger , shouldn't remainder bounded smaller sized "int", divisor? yet in c#, above code results in rem being long . is safe convert rem int without loss of data? int remainder = convert.toint32(rem); there no overload of modulo operator takes long , int , int converted long match other operand. looking @ at lower level, in cpu there no separate instruction calculating modulo, it's 1 of results of division operation. output of operation result of division, , reminder. both same size, result of division has long , reminder. as reminder has smaller divisor, can safely cast result int when divisor comes int .

actionscript 3 - As3 AddChild() in a Class -

im in as3 , im trying add movieclip inside of class don't errors image not show up. this class code, movieclip called woopa1 package { import flash.display.movieclip; import woopa1; public class koopa extends woopa1 { public function koopa() { trace(woopa1); var woopa:woopa1 = new woopa1(); addchild(woopa); woopa.x=100; woopa.y=100; woopa.height = 60; woopa.width = 38; } } } it traces [class woopa1] code in frame calling class function onenterenemy(event:event):void { var enemy:koopa = new koopa(); } why doesn't image show up? have added enemy instance display list? var enemy:koopa = new koopa(); addchild(enemy); also since create instance of woopa1 class , add koopa , koopa class should extend movieclip or sprite instead of woopa1 class. on separate note, may want name classes names start uppercase charact...

ffmpeg - xargs: unterminated quote -

i'm trying convert .flac files .mp3, can import itunes. tried find, xargs , ffmpeg, xargs give me unterminated quote error (because have quotes in filename). that`s command line: mackassner:geto boys kassner$ find . -type f | egrep "\.flac$" | xargs -i {} ffmpeg -i {} -ab 192k -acodec libmp3lame -ac 2 {}.mp3 it`s stop , raise error in filename "talkin' loud ain't saying nothin'.flac". some tricks make 1 work? -- solved find -- find . -type f -name "*.flac" -exec ffmpeg -i {} -ab 192k -acodec libmp3lame -ac 2 {}.mp3 \; use gnu parallel. built purpose: mackassner:geto boys kassner$ find . -type f | egrep "\.flac$" | parallel ffmpeg -i {} -ab 192k -acodec libmp3lame -ac 2 {}.mp3 you may want use {.}.mp3 rid of .flac: mackassner:geto boys kassner$ find . -type f | egrep "\.flac$" | parallel ffmpeg -i {} -ab 192k -acodec libmp3lame -ac 2 {.}.mp3 watch intro video learn more: http://www.youtube.c...

php - Why am I getting an error in this code? -

here's code: http://pastebin.com/uvixyhk1 this error get: parse error: syntax error, unexpected ';', expecting ')' in blog.php on line 32 anybody have idea? you need change line <?php if( $c < 4 ) : ($dummy= $c; $dummy < 5; $dummy++;) : ?> to <?php if( $c < 4 ) : ($dummy= $c; $dummy < 5; $dummy++) : ?> notice had semi-colon in for() loop

php - Ajax form sending request on page load -

i new ajax , having think small problem. wondering if 1 able me? the problem: in index.php file within head tag have following: <script type="text/javascript"> var time_variable; function getxmlobject() //xml object { var xmlhttp = false; try { xmlhttp = new activexobject("msxml2.xmlhttp") // old microsoft browsers } catch (e) { try { xmlhttp = new activexobject("microsoft.xmlhttp") // microsoft ie 6.0+ } catch (e2) { xmlhttp = false // no browser accepts xmlhttp object false } } if (!xmlhttp && typeof xmlhttprequest != 'undefined') { xmlhttp = new xmlhttprequest(); //for mozilla, opera browsers } return xmlhttp; // mandatory statement returning ajax object created } var xmlhttp = new getxmlobject(); //xmlhttp holds ajax object function ajaxfunction() { var getdate = new date(); //used prevent caching during aja...

wpf - stack panel and grid -

originally have pure grid control buttons, checkboxes , textboxes. wish implement tab control in application, added tab control , added stack panel children. see @ output nothing blank. please advice me.. thanks! example of original code: <grid width="1185" height="945" background="snow"> <button height="23" horizontalalignment="right" margin="0,133,56,0" name="commonssnamemodifybutton" verticalalignment="top" visibility="hidden" width="67" click="commonssnamemodifybutton_click">modify</button> <button height="23" horizontalalignment="right" margin="0,72,56,0" name="mobilessnamemodifybutton" verticalalignment="top" width="67" visibility="hidden" click="mobilessnamemodifybutton_click">modify</button> <label margin="588,205,497,0" name="resultlab...

ssh - how do I run multiple programs on different machines at same time? -

i have 12 computers cluster , have java program(the same) on each one, want run these programs @ same time, how can this? i can copy ( scp ) files 1 computer via ssh like #!/bin/bash scp /route1/file1 user@computerx:/route2$ scp /route1/file1 user@computery:/route2$ so wondering if can done run programs have on each computer you can run commands via #!/bin/bash ssh user@host1 <command> ssh user@host2 <command> you need use key based auth avoid entering password when script runs. alternatively take @ fabric neat way of controlling multiple hosts.

ruby on rails 3 - GEdit - Plugin to find and open a partial under cursor? -

gmate contains plugin extract portion of code partial. there opposite, ie, find partial on disk , automatically open it? use external tool 'jump' it. you find on github

iphone - NSURLConnection and grand central dispatch -

is advisable wrap nsurlconnection in gcd style blocks , run on low_priority queue? i need ensure connections not happening on main thread , connections need asynchronous. need several simultaneous requests go @ once. if go gcd route, i'm not sure thread nsurlconnectiondelegate methods invoked on. nsurlconnection relies on delegates once connection complete, whatever wrapper class handles need invoke caller. i'm not how deal of various callbacks invoked when connection work starts up/finishes: - (void)connection:(nsurlconnection *)aconnection didreceiveresponse:(nsurlresponse *)response; - (void)connection:(nsurlconnection *)connection didreceivedata:(nsdata *)incrementaldata; - (void)connection:(nsurlconnection *)connection didfailwitherror:(nserror *)error; - (void)connectiondidfinishloading:(nsurlconnection *)connection; should call synchronous versions wrapped in gcd blocks? , if want cancel call, use 'dispatch_suspend'? dispatch_async(queue,^{ ...

java - Giving error when i adding string to child node -

public void createnode(int group){ defaultmutabletreenode root = null; defaultmutabletreenode child[] = null; list<string> list = new arraylist<string>(); expressionbuilder builder=new expressionbuilder(); list = builder.getexpression(group,0); root = new defaultmutabletreenode(groupstring); defaulttreemodel = new defaulttreemodel(root); for(int i=0; i<list.size();i++){ child[i] = new defaultmutabletreenode(list.get(i)); defaulttreemodel.insertnodeinto(child[i], root, i); } } when making child array giving me error of null pointer exception. list populated correctly. defaultmutabletreenode child[] = null; the child array null. when create array need like: defaultmutabletreenode child[] = new defaultmutabletreenode[???]; so need create array after create list know size make array.

camera - iphone how to go to the image gallery after taking photo through Xcode -

hi implementing following code take photo through application [[[uiapplication sharedapplication] keywindow] setrootviewcontroller:picker]; picker.sourcetype = uiimagepickercontrollersourcetypecamera; [self presentmodalviewcontroller:picker animated:no]; can tel me how can go photo gallery after user takes photo , not return application. i think might want try this how open camera while click uibutton in iphone? or didn't question edit: can use same code uiimagepickercontrollersourcephotolibrary after taking pic camera. mean call function uiimagepickercontrollersourcephotolibrary take photo library , again application.

Please help me write a mysql query -

i need find news items news table , number of comments each news item comments table . need in single array/resultset... tables linked news.id=news_comments.news_id . help? how like select news.id, count(comments.news_id) totalcomments news left join comments on news.id=news_comments.news_id group news.id if use left join, result set return news articles no comments, if use inner join, these articles excluded result set.

fonts - Make text larger than is already - javascript -

sorry if simple, can't right. problem have makes text smaller point. mean if there aleady large text, make text small again. need make text larger before. styles elements containing text set through css, editing style property wouldn't work. thanks in advance! - tanner if text element have id can done easily. example: <p id="hey">this fabulous text change.</p> <a onmouseover=document.getelementbyid('hey').style.fontsize='10'> make tiny!</a> <a onmouseover=document.getelementbyid('hey').style.fontsize='24'> make huge!!!</a> actually document.getelementbyid('yourid').style.fontsize=yourvalue general code. use want increase text size again direct writing code or calling function.

php - how to obtain the post id in wordpress templates -

i know in wordpress loop the_id(); will output post id, if want set $var = post id; should do? instead of the_id(), echoes result, use function get_the_id(), returns id , can assing variable used in php script. $postid = get_the_id(); /* here need $postid.. */ fyi, there's nice official repository of wp apis, codex

c++ - plant growth simulation algorithm -

where can plant growth simulation algorithm c or c++ language....??? the lpfg language based on c++. resources @ http://algorithmicbotany.org/ started. can request demo version of software.

entity framework 4 - How to add a table to the EF4 Context dynamically in code - No Code First -

we run series of reports every 6 months , store results tables can queried/viewed @ time in future. depending on cycle either 2 or 4 tables added. have standard naming convention of yyyy_mmm_table_x. our website built using asp.net mvc2 , database modeled using ef4 using standard model designer, not code first. i able dynamically add report tables ef4 context @ runtime. don't want have manually add them model using designer, otherwise every reporting cycle have update , recompile model because added reports. maintenance headache when nothing else has changed. i can list of available tables querying sysobjects. if list , add tables context when site started use dynamic linq library query against them depending on table user selected dropdown. i can't use ef4's code first out of box because force me create concrete classes tables , same maintenance headache. suspect use same strategies code first framework uses dynamically update context, haven't looke...

algorithm - Solver for TSP-like Puzzle, perhaps in Javascript -

i have created puzzle derivative of travelling salesman problem, call trace perfect. it undirected graph weighted edges. goal traverse every edge @ least once in direction using minimal weight (unlike classical tsp goal visit every vertex using minimal weight). as final twist, edge assigned 2 weights, 1 each direction of traversal. i create new puzzle instance everyday , publish through json interface. now know tsp np-hard. puzzles typically have handful of edges , vertices. after need humanly solvable. brute force basic optimization might enough. i develop (javascript?) code retrieves puzzle server, , solves algorithm in reasonable amount of time. additionally, may post solution server registered in leader board. i have written basic brute force solver in java using back-end java model on server, code fat , runs out of heap-space quick, expected. is javascript solver possible , feasible? the json api simple. can find at: http://service.traceperfect.com/api/stov?pda...

grammar - Antlr parsing numbers problem -

Image
i have problem parsing integer & hex numbers. want parse c++ enums following rules: grammar enum; rule_enum : 'enum' id '{' enum_values+ '}'';'; enum_values : enum_value (comma enum_value)+; enum_value : id ('=' number)?; number : hex_number | integer_number; hex_number : '0' 'x' hex_digit+; integer_number : digit+; fragment hex_digit : ('0'..'9'|'a'..'f'|'a'..'f') ; fragment digit : ('0'..'9'); comma : ','; id : ('a'..'z'|'a'..'z'|'_') ('a'..'z'|'a'..'z'|'0'..'9'|'_')*; the problem have following - when parsing code like: enum enum { option1 = 0, option2 = 1 }; it not recognize 0 integer_number tries parse hex_number. how can resolve this? thank you. tobias first, fragment rules can "seen...

c++ - multiple definition of `login::GetEventHashTable() const' -

i got error multiple definition of `login::geteventhashtable() const' can tell me, when occour... please share code snippet, rough guess, did forget semi colon ; in @ end of class declaration in header file? like class abc { }; --> here

Avoiding copying variables during initialization in C++ with block -

please code. c++ clang 's block feature. can code avoid copying? please let me know opinion. practice of avoiding heap. class element { public: int value[1024]; // here large entity. element() { } }; class world { public: element a; element b; inline world(element& newa, element& newb) { = newa; // source of newa stored in somewhere, copies whole element during assignment. b = newb; } inline world(void(^init)(element& a, element& b)) { init(a, b); // assignment done without copying whole element. } }; the way totally avoid copying use pointer or reference. example: class world { public: element& a; element& b; inline world(element& newa, element& newb) : a(newa), b(newb) { } ... }; as other reference or pointer, approach requires variables passed not go out of scope.

java - Setting default fmt formatNumber maxFractionDigits for all jsp pages -

is possible have following tag display 5 decimal places? <fmt:formatnumber type="currency" value="${number}" /> without having change to <fmt:formatnumber type="currency" maxfractiondigits="5" value="${number}" /> basically have many of these , want them change, want 5 decimal places default. yes. cam implement extending fmt:formatnumber functionality. for this, create class extending org.apache.taglibs.standard.tag.rt.fmt.formatnumbertag set maxfractiondigits 5 default (when not supplied). you need change reference in fmt tag library descriptor (tld) file point own implementation. these should present in jstl jar located in web-inf\lib default . edit: personally, go adeel's approach of setting custom locale, if @ possible.

powershell - What's the difference between Add-PsSnapIn and Import-Module -

powershell has 2 means importing additional cmdlets session, add-pssnapin , import-module. docs not @ clear regarding when 1 chose 1 on other. know difference between these? modules came in powershell v2. v2 can still load snapins though, if necessary. big difference modules can deployed using xcopy. there no need register anything. deploy snapin, installer have hack registry, require elevated priveleges. load module, have use import-module command. modules can have lot more metadata using module manifest well, can specify kinds of things might useful end user know, including version, dependencies on other modules, , powershell hosts can run module. all being said, if writing binary module in c# or vb, still use same pssnapin base class. to more information, check out ps > about_modules

emacs - customized links in the org mode -

Image
i use org mode store shortcuts projects. such org files contain links create using org-insert-link . simple link not sufficient have use lisp functions. works fine not nice. is there way create link call lisp function? you can define new "link types" in org-mode function org-add-link-type tell elisp function want call particular protocol. so, in case, define new protocols "http-ie" , "load-xml-dirs" , write wrapper functions process parameters right. write links normal org links, protocol prefix. the example documentation page quite straightforward guess, let me know if it's not enough.

php - getting error while running phpunit test -

i made 1 file in ryapi folder connection.php in file putted code : <?php require_once 'phpunit/framework.php'; class datatest extends phpunit_framework_testcase { /** * @dataprovider provider */ public function testadd($a, $b, $c) { $this->assertequals($c, $a + $b); } public function provider() { return array( array(0, 0, 0), array(0, 1, 1), array(1, 0, 1), array(1, 1, 3) ); } } ?> when running test following getting following error : ubuntu@ip-10-162-234-205:/var/www/ryapi$ phpunit datatest php deprecated: comments starting '#' deprecated in /etc/php5/cli/conf.d/mcrypt.ini on line 1 in unknown on line 0 phpunit 3.4.5 sebastian bergmann. argument #1 of phpunit_util_fileloader:checkandload() no existing fileubuntu@ip-10-162-234-205:/var/www/ryapi$ please suggest ? edit while running command pear install --alldeps --force phpunit/phpunit ubun...

sql server - SQLServer log shipping file size limit -

i'm trying limit size of individual files transferred part of log shipping (as using webdav transport). i want ensure no trn files created more size (e.g. 16mb) seems choke webdav. i note output of sqllogship.exe, states: max transfer size: not specified can configured? thanks andy i don't think you're trying achieve possible (and damien_the_unbeliever's comment seems view up). as far can see, approach can take schedule log backups enough file size limit isn't reached.

parametrize server and database name in t-sql -

is possible paramterize sql server name , database name when changed dont have change 1 line ? thanks help your question isn't clear - i'm interpreting this: like: select (list of fields) @database.dbo.@tablename (clause) or - right? no, cannot - @ least not in standard sql - you'd have use dynamic sql (string sql command variable, , execute that). if think going there - must read erland sommarskog's excellent the curse , blessings of dynamic sql , think again if want use it.

asp.net mvc - Mvc list modelbinding -

i have view renders @ list of people , checkbox this: <% (int = 0; < model.elevselectedlist.count; i++) {%> <tr> <td> <%=html.checkboxfor(x => x.elevselectedlist[i].valgt, new { @class="elevselect" }) %> <%=html.hiddenfor(x => x.elevselectedlist[i].elevid) %> <%=html.displaytextfor(x => x.elevselectedlist[i].elevcpr) %> <%=html.hiddenfor(x => x.elevselectedlist[i].elevcpr) %> </td> <td> <%=html.displaytextfor(x => x.elevselectedlist[i].elevkuvertnavn)%> <%=html.hiddenfor(x => x.elevselectedlist[i].elevkuvertnavn)%> </td> </tr> <% } %> this produces correct input fields in output, this: <tr> <td> <input checked="checked" class="elevselect" id="elevselectedlist_0__valgt" name="elevselect...

properties - CLASSPATH vs java.ext.dirs -

is there reason why favor using (possibly long) classpath variable set jars should on classpath durign application run use java 1.5+ property -djava.ext.dirs specifies whole directory(directories) of jars searched? to make real-life example have standalone java application lib folder containig dependent jars. sofar start script setting (maybe 20) jars classpath variable 1 one. since application archive generated maven can't see in advance jar names (e.g. change version of jar). of course can go through lib dir in startup script , add jars found there classpath variable again. or make maven generate script me. here comes quiestions: 1) ok , appropriate replace of setting java.ext.dirs property contain contains + lib dir in script? caveats hidden there? thanks replies :) java.ext.dirs has specific use: it's used specify extension mechanism loads classes from. used add functionality jre or other libraries (such jai). it's not meant general-purpose ...

Adjusting position of jQuery Facebox before triggering -

i wish adjust height of dialog box. i way, there weird abrupt shift, esp if pc slow. $.facebox($("#step1facebox").html()); $("#facebox").css("top","175px"); is there way of doing such position pre-adjusted before showing up? you set default css style #facebox #facebox { display:none; } then fade in box... $.facebox($("#step1facebox").html()); $("#facebox").css("top","175px").fadein(); or , try - depends whether facebox returns in constructor: $.facebox($("#step1facebox").html()).hide(); $("#facebox").css("top","175px").fadein();

types - DB2 Character Datatype and JPA Not Working -

i working db2 universal database having lots of tables columns of datatype character. length of these columns variable (greater 1 e.g. 18). execute native query using jpa selects first character of column. seems character datatype mapped java character. how can full contents in db column. can not change database bening on vendor side. please note need both ways, i.e. : using jpql ( attribute columndefinition can work in case) using native db query (no pojo used in case , have no control on datatypes) i using hibernate implementation of jpa provided spring. if these columns common in database, can customize dialect used hibernate. see comments hhh-2304 .

php, mysql - Too many connections to database error -

good day all. have odd error. have created chat works this: questions/answers inserted db every 2 seconds ajax request sent php script fetch new questions/answers it worked fine until today when got error: uncaught exception 'pdoexception' message 'sqlstate[hy000] [1040] many connections' in /var/www/html/dbdev/include/zend/db/adapter/pdo/abstract.php:129 stack trace: #0 /var/www/html/dbdev/include/zend/db/adapter/pdo/abstract.php(129): pdo->__construct('mysql:host=loca...', '', '', array) s#1 /var/www/html/dbdev/include/zend/db/adapter/pdo/mysql.php(96): zend_db_adapter_pdo_abstract->_connect() s#2 /var/www/html/dbdev/include/zend/db/adapter/abstract.php(448): zend_db_adapter_pdo_mysql->_connect() s#3 /var/www/html/dbdev/include/zend/db/adapter/pdo/abstract.php(238): zend_db_adapter_abstract->query('select profile_...', array) s#4 /var/www/html/dbdev/include/zend/db/adapter/abstract.php(782): zend_db_adapter...