Posts

Showing posts from August, 2014

entity framework 4 - EF Code first doesn't load my collection of child objects -

i have 2 objects: public class program { [key] [databasegenerated(databasegeneratedoption.identity)] public long id { get; set; } public string name { get; set; } public virtual icollection<videofile> files { get; set; } } public class videofile { [key] [databasegenerated(databasegeneratedoption.identity)] public long id { get; set; } [required] public string path { get; set; } [required] public virtual program program { get; set; } } the 2 tables correctly created in database, when save program insert files childs too, when tried program file collection come nulls, have lazyload enable, , default entity framework return empty collection when child collection empty why have null?

objective c - CCLayer keeps shifting position -

i using cocos2d , have following code moves layer based on player touching screen. reason, each time code called position of layer shifts 32 in 1 direction or other. cant fathom why happening. there no other code anywhere in program manipulates position of these ccnodes (or other node). -(void) animatestructure:(int)index and:(ccsprite*)asprite at:(cgpoint)apoint { cgpoint point1 = self.position; cgpoint point2 = playersprite.position; id move = [ccmoveby actionwithduration:0.1 position:ccp(32*tempx,32*tempy)]; [self runaction:move]; id move2 = [ccmoveby actionwithduration:0.1 position:ccp(-32*tempx,-32*tempy)]; [playersprite runaction:move2]; self.position = point1; playersprite.position = point2; } not how move actions play-out if set position while action in progress, case here.

java - Best practices for sharing web-tier code (Controllers and JSPs) between similar web apps -

i'm working on rewriting aging web applications. there 2 in particular very, similar, yet share no code today , aim fix that. the projects being rewritten maven, spring mvc, , sitemesh. model tier code easy enough share using jars. don't know of ways share common web-tier code (jsps , controllers) between similar apps. here's background. these apps webstores. 1 normal store (think amazon.com) user can sign into, search products, add shopping cart, , check out. other same thing, it's punchout site. product browse , shopping cart portions identical. sign in , checkout, however, different. i'm oversimplifying, it's enough illustrate problem. there's significant portion of web-tier code in product browse , shopping cart sections should able shared between two. i don't think it's possible have same war file running either "mode" based on environment variable or settings different database. 1 of differences different sprin

Change input value but not change result in PhpExcel -

i have got problem phpexcel below function function test($a, $b) { // create new phpexcel object single sheet $objphpexcel = new phpexcel(); $activesheet = $objphpexcel->getactivesheet(); $activesheet->setcellvalue('b2',$a); $activesheet->setcellvalue('b3',$b); $activesheet->setcellvalue('c4',"=b2+b3"); $c4 = $activesheet ->getcell('c4')->getcalculatedvalue(); echo "c4:$c4<br/>"; } finally, call function test(10, 20); test(40, 70); test(30, 80); but, result is c4:30 c4:30 c4:30 why getcalculatedvalue() doesn't change result? seems function gets first value. you can change result, performance reasons calculation engine caches result of formula calculation once it's been calculated. if want change underlying data, have flush cache before requesting calculated value again: phpexcel_calculation::getinstance()->clearcalculationcache(); or

objective c - Repositioning of a UIView after CGAffineRotation -

i'm drawing map of hexagons inside uiview , next step give in isometric view. this, transformed map using cgaffinetransform, rotation , scaling, reaching goal. now, if map becomes bigger, when rotate it, lower left corner goes out screen, frame before , after transformation: 2012-03-07 17:08:06.160 pratofiorito[941:f803] x: 0.000000 - y: 0.000000 || width: 1408.734619 - height: 1640.000000 2012-03-07 17:08:06.163 pratofiorito[941:f803] x: -373.523132 - y: 281.054779 || width: 2155.781006 - height: 1077.890503 i can't understand new point of origin , how can calculate replace view correctly. can me?

mysql - Whats the best way to add arrays in php dynamically -

i iterating on data dynamically. data contains 3 fields want insert array.. array(field1,field2,field3)..and insert array array (nest it). nest array main array. problem dont know how 1 array out of loop contain nested arrays. $myarray=array(); while($row=mysql_fetch_array($result)) { $myarray+= array(field1,field2,field3); } how add them dynamically..i know wrong way..but how do it?! while ($row = mysql_fetch_assoc($result1) { $myarray[] = array($row['field1'], $row['field2'], $row['field3']); } if want add whole content of each row, i.e. every field in row, can use while ($row = mysql_fetch_assoc($result1) { $myarray[] = $row; } or single line: while ($myarray[] = mysql_fetch_assoc($result)); then can access e.g. field2 of row 5 $myarray[4]['field2'] in question use function mysql_fetch_array. please use mysql_fetch_assoc better way. mysql_fetch_array returns every value twice, once numeric index

Java - Reading from an ArrayList from another class -

we've not covered arraylists arrays , 2d arrays. need able read arraylist class. main aim read them in loop , use values stored in them display items. however, have made quick program test out , keep getting error java.lang.indexoutofboundsexception: index: 0, size: 0 @ java.util.arraylist.rangecheck(arraylist.java:604) @ java.util.arraylist.get(arraylist.java:382) @ main.main(main.java:14) here code import java.util.arraylist; public class main { public static void main() { system.out.println("test"); arraylist <objects> xcoords = new arraylist<objects>(); for( int x = 1 ; x < xcoords.size() ; x++ ) { system.out.println(xcoords.get(x)); } } } and class arraylist import java.util.arraylist; public class objects { public void xco() { arraylist xcoords = new arraylist(); //x coords //destroyable xcoords.add(5); xcoords.a

php - Opencart: CSS (based on route maintenance) -

this first question here. i'm using opencart webshop. looks i'm styling css of pages e.g. account_login.css. want maintenance page. made common_maintenance.css file. when i'm testing site isn't displaying correct. showing http://www.mywebsite.com instead of http://www.mywebsite.com/index.php?route=common/maintenance . please can me this? <?php class controllercommonmaintenance extends controller { public function index() { if ($this->config->get('config_maintenance')) { $route = ''; if (isset($this->request->get['route'])) { $part = explode('/', $this->request->get['route']); if (isset($part[0])) { $route .= $part[0]; } } // show site if logged in admin $this->load->library('user'); $this->user = new user($this->registry);

html - CSS: Opacity make display object go under other objects -

Image
my menu elements supposed on top of image. this <div class="menu">...</div> <img src="..."/> however when add opacity style of image, menu elements lay under image <div class="menu">...</div> <img src="..." style="opacity:0.9"/> does know what's going on , how fix issue? my bet opacity giving z-index image. have tried adjusting z-index on menu?

ruby on rails - How to force an RSpec test to fail? -

what's proper way force rspec test fail? i'm considering 1.should == 2 there's better. fail trick. pending useful. example: it "should something" pending "this needs implemented" end

android - Report GET_ACCOUNTS permission in other app -

i preparing release app using device google account authenticate on google app engine server. to that, need permissions : use_credentials : obviously internet : obviously get_accounts : ask user select 1 of google accounts registered on phone. my problem get_accounts : think it's quite intrusive ask permission along internet : able accounts (google, facebook, etc...) , send them server (i won't of course !). fear permission may scare users, , may not download app... i had idea report permission other app, wouldn't have internet permission. app called intent, , return account chosen user. , then, main app don't need get_accounts anymore. the source code there : http://code.google.com/p/account-chooser/ it's quite simple (only 1 screen) to send intent app use utility library intentintegrator zxing. if "account chooser" app not present on device, asks user download market. what think ? idea ? right bother user downloading mysterious app

c++ - How to specify the QString::indexOf method? -

i have written source code like: int main(int argc, char *argv[]) { qstring x = "start text here end"; qstring s = "start"; qstring e = "end"; int start = x.indexof(s, 0, qt::caseinsensitive); int end = x.indexof(e, qt::caseinsensitive); if(start != -1){ // found qstring y = x.mid(start + s.length(), ((end - (start + s.length())) > -1 ? (end - (start + s.length())) : -1)); // if dont wanna pass in number less -1 or qstring y = x.mid(start + s.length(), (end - (start + s.length()))); // should not issues passing in number less -1, still works qdebug() << y << (start + s.length()) << (end - (start + s.length())); } } the problem is, in textfile word "end" found very often. so, there way create indexof method searchs first " qstring e = "end" " appears after "qstring s = "start&qu

r - package or function to count sequence lengths? -

i wondering if there package or generic function in r counts sequence lengths. instance, if input sequence s1<-c('a','a','b','a','a','a','b','b') the proposed function f(s1,'a') return vector: [2,3] , f(s1,'b') return [1,2] those madly typing people must have gone elsewhere: s1<- c('a','a','b','a','a','a','b','b') f1 <- function(s, el) {rle(s)$lengths[rle(s)$values==el] } f1(s1, "a") #[1] 2 3 f1(s1, "b") #[1] 1 2

c# - Code Access Security is preventing PInvoking Setup API calls -

i'm rewording question since understand bit more now. originally, had vague. i've discovered i'm being routed called "code access security." old-hat reading this, i'm sure, not me. the application large in nutshell have 2 assemblies. 1 utilities assembly various "tools" used throughout program. other calling upon these tools in order function. in utilities assembly, there many functions pinvoked 1 giving me grief is: setupdigetdeviceinterfacedetail() ( see here ). function prototype looks this: [dllimport("setupapi.dll", setlasterror = true, charset = charset.auto)] [return : marshalas(unmanagedtype.bool)] public static extern bool setupdigetdeviceinterfacedetail( safehandlezeroorminusoneisinvalid deviceinfoset, ref sp_device_interface_data deviceinterfacedata, intptr deviceinterfacedetaildata, uint deviceinterfacedetaildatasize, intptr requiredsize, intptr deviceinfodata); in assembly uses function

sql - UPDATE a field in one table with the SUM of another -

i'm trying set value of field in table sum of set of fields in table by: update table1 set fieldtoupdate = ( select sum(fieldtosum) table2 ) thirdfield = 'a' but i'm not having luck. i've seen lot of examples use joins, 2 tables aren't related in way. thanks while subquery should work, break this: declare @s int; select @s = sum(fieldtosum) dbo.table2; update dbo.table1 set fieldtoupdate = @s fieldtoupdate = 'a';

How does Square Reader (squareup) device work via earphone jack in Android? -

https://squareup.com/reader describes hardware card reader plugs earphone jack on android (and iphone) too. i wonder how square app reads data earphone jack. possible send custom data via earphone jack, or kind of audio decoding (like how dial-up modem works)? square uses regular audio signals, in same way modem does.

twitter - How to use oAuth with ActionScript 3.0? -

i came across oauth library actionscript 3.0. http://code.google.com/p/oauth-as3/ it seems have need oauth, can't make heads or tails of it. i've never worked oauth (or authentication..) before , not sure how use it. can't find examples of specific library, or in general concerning oauth , as3. would mind walking me through (or directing me tutorial) concerning how use oauth interact web api's? i'm looking actionscript 3.0 interacting twitter. any appreciated! i don't post answers contain links unfortunately, given nature of question , answer, think it's choice here. first want say, try harder googling next time. many results came first try . second, there seems 2 google code repositories this. in case you're interested, here link second 1 (you provided link first) http://code.google.com/p/oauthas3/ . repository has code newer repo referenced. third, here links articles/tutorials library should provide you've requested: htt

c# - CrossThreading issue with BackgroundWorker and statusstrip update -

Image
i have been working on tool uses backgroundworker perform ping operation on regular interval. running issue backgroundworker progresschanged event. code progresschanged event below: private void backgroundworker1_progresschanged(object sender, progresschangedeventargs e) { progressupdated update = (progressupdated)e.userstate; if (sender.tostring() == "system.componentmodel.backgroundworker") { toolstripstatuslabel1.text = update.generalstatus; toolstripprogressbar1.value = update.progressstatus; toolstripstatuslabel2.text = update.specificstatus; } else { toolstripstatuslabel1.text = update.generalstatus; toolstripprogressbar2.value = update.progressstatus; toolstripstatuslabel3.text = update.specificstatus; } } the progresschanged event gets called both in backgroundwork updates first v

ASP.NET session state after closing browser -

i use vs2010, c# develop asp.net web app, users can login own username/pass , can view site, want limit users each users cannot login simultaneously 1 username, i.e. when user has logined username, username cannot logined again until have logout, create session each user when logins (session["userid"= user_id_obtained_from_database), i'm going check active sessions when when user logins, i'll allow user login if there no active session["userid"] userid i remove user sessions when logouts, happens when user closes browser page? in case how can destroy user session id can login again? user session remain open until session expires? if user closes browser page (instead of loging out), cannot login again until sessions expires on server? please me thanks you can fire ajax call on body onbeforeunload event register exit of page. if 1 of these no further page request user has left site.

performance - How to speed up a LogParser application in ASP.NET -

i've developed asp.net application receives input user sql query ran logparser. (this input kept in "sql1" string. works, works slowly. log file of 60 mb, i've received outofmemory exception. i'm sharing code down below, ideas speed up? there way directly insert ilogrecordset object datagrid, without first converting dataset? logquery ologquery = new logquery(); comiisw3cinputformat eventlog = new comiisw3cinputformat(); ilogrecord numreq = null; ilogrecordset numset = null; numset = ologquery.execute(sql1, eventlog); datatable querytable = new datatable("query"); (int = 0; < numset.getcolumncount(); i++) { datacolumn col = new datacolumn(); col.columnname = numset.getcolumnname(i); switch (numset.getcolumntype(i)) { case 1: col.datatype = typ

Can't seem to be able to modarate Facebook comments on my site -

here example: http://www.oneforisrael.org/index.php/blog/144-what-do-jewish-families-do-on-shabbat people can , commenting, fine, can't modarate it... @ source code, think did right. any love , appricaite! thanks fix warnings indicated @ http://developers.facebook.com/tools/debug/og/object?q=www.oneforisrael.org%2findex.php%2fblog%2f144-what-do-jewish-families-do-on-shabbat . most of time when cannot moderation page because of incomplete meta data or incorrect app id or admin id.

How to find which file provide(d) the feature in emacs elisp -

currently using load-history variable find file feature came from. suppose find file feature gnus came from. i execute following code in scratch buffer prints filename , symbols in separate lines consecutively. (dolist (var load-history) (princ (format "%s\n" (car var))) (princ (format "\t%s\n" (cdr var)))) and search "(provide . gnus)" , move point start of line(ctrl+a). file name in previous line file feature came from. is there thing wrong method, or better method exist. i don't know you're trying this, here notes. your method fine. way hack own solution problem in book. @tom correct shouldn't need this, because problem solved system. i.e. c-h f but that's not interesting. let's want automatic, more elegant solution. want function -- locate-feature signature: (defun locate-feature (feature) "return file-name string `feature' provided" ...) method 1 load-history approach

r - Connecting across missing values with geom_line -

Image
i'm trying figure out if it's possible connect across missing values using geom_line. example, in link below there missing values @ time 3 in facet f. i'd line connect time 2 , 4 in case. there way achieve this? https://farm8.staticflickr.com/7061/6964089563_b150e0c2a6.jpg i have data frame of cumulative values so: head(cumulative) individual series time value 1 x 1 -1.008821 2 x 2 -2.273712 3 x 3 -3.430610 4 x 4 -4.618860 5 x 5 -4.893075 6 x 6 -5.836532 which i'm plotting with: ggplot(cumulative, aes(x=time,y=value, shape=series)) + geom_point() + geom_line(aes(linetype=series)) + facet_wrap(~ individual, ncol=3) richie's answer thorough, wanted show simpler. since lines not drawn na points, approach drop these points when drawing lines. implicitly makes linear interpolation between points (as straight lines do). us

xml - need help on xslt transformations regarding the namespaces -

i working on xslt transformations. stuck @ 1 point. source xml: <?xml version="1.0" encoding="iso-8859-1"?> <content xmlns="uuid:4522eb85-0a47-45f9-8e2b-1f82c78fa920"> <first xmlns="uuid:4522eb85-0a47-45f9-8e2b-1f82c78fa920">hello world.this fisrt field</first> <second xmlns="uuid:4522eb85-0a47-45f9-8e2b-1f82c78fa920">hello world.this second field2</second> </content> output format required: <aaa>hello world.this fisrt field</aaa> <bbb>hello world.this second field</bbb> please suggest solution this. i have tried this <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns="uuid:4522eb85-0a47-45f9-8e2b-1f82c78fa920"> <xsl:output method="xml" indent="yes"/>

c++ - Release memory OpenCV , right memory allocation/deallocation ( management ) on OpenCV structures in function -

i calling next function inside class inside thread in loop ( capturing frames camera , processing them ) : cvrect imageprocessor::detectfaceinimage(const iplimage *inputimg) // { iplimage *detectimg; cvmemstorage* storage = 0; cvrect *rc = 0; cvrect rect; double count; cvseq* rects = 0; int l,n; detection_time = (double)cvgettickcount(); detectimg = cvcloneimage(inputimg); if(fastdetectmode) { facecascade = (cvhaarclassifiercascade*)cvload( facecascadefile[0].toascii().data(), 0, 0, 0 ); if( !facecascade ) { qmessagebox mbox; mbox.seticon(qmessagebox::information); mbox.settext("can't load haar cascade face detector 0"); mbox.setstandardbuttons(qmessagebox::ok); mbox.exec(); if(detectimg) cvreleaseimage(&detectimg); return cvrect(-1,-1,

c++ - Open file relative to chromium.exe -

i have build chromium use in own c++ application. managed open urls such http:://stackoverflow.com/ or file:///c:/index.html what want open html files in same folder chromium.exe. calling this: file:://index.html i application path within c++ using system specific calls. troublesome since non-ascii characters , different encodings. i hope made clear enough. thank you. consider issue resolved. stupidity, not enough escape characters.

ruby on rails - Hash does not contain 'try' method -

i noticing differences between hash object within ruby 1.8.7 , hash object within rails 3.0.10. for example, within 1.8.7 irb , get: 1.8.7 :001 > {}.try(:method) nomethoderror: undefned method `try' {}:hash (irb):1``` however, 3.0.10 rails console, get: 1.8.7 :003 > {}.try(:method_x) nomethoderror: undefined method `method_x' {}:hash (irb):3:in `try' (irb):3 this surprises me because under impression try defined in object ancestor of hash , try return nil instead of throwing nomethoderror. what missing? this surprises me because under impression try defined in object ancestor of hash , try return nil instead of throwing nomethoderror . what missing? your impression of class try defined in correct ( object ). missing file defined in. it's defined in activesupport library, not in ruby core library. so, need require 'active_support/core_ext/object/try' first.

ruby on rails - Safe way to initialize attributes from a yaml or hash -

in initialize method trying write can pass either hash or yaml object init attribute values. my yaml file looks like: defaults: &defaults host: localhost port: 4565 timeout: 3 development: <<: *defaults test: <<: *defaults staging: <<: *defaults production: <<: *defaults i have this: def initialize(options) if options.respond_to? "has_key" && options.has_key? "defaults" config = options["defaults"] else config = options end @hostname = config[:hostname] @port = config[:port] @timeout = config[:timeout] end this not working me, i'm getting error: unexpected tstring_beg, expecting keyword_then or ';' or '\n' if options.respond_to? "has_key" && options.has_key? "defaults" how can load correct environment also? (test, development, production) how can throw error if 1 of keys isn't present? (or @ least major

java - Joda time, Period to total millis -

i'm trying total amount of milliseconds ( not millis field) period object instance. i've tried multiple conversions, couldn't find method giving it. has ever needed , managed retrieve ? (i need patch, figure out negative period; negative millis = negative period.) you can't millis directly period , since fields months , years variable in terms of milliseconds. in order make work, need supply "baseline" instant period can calculate actual millisecond duration. for example, period.todurationfrom , period.todurationto methods take such baseline instant, , calculate duration object, can obtain millis. the javadoc todurationfrom says: gets total millisecond duration of period relative start instant. method adds period specified instant in order calculate duration. an instant must supplied duration of period varies. example, period of 1 month vary between equivalent of 28 , 31 days in milliseconds due different length mont

Java Servlet File Upload of images - is the code efficient or allowing for memory leak? -

my servlet following file submitted upload through jsp page. step 1 - file, image step 2 - check if needs resized step 2a - if needs resize, step 3 - resize , create thumbnail size step 4 - store new resized image in folder on server step 5 - store thumbnail image in folder on server the largest image size (per client's request) servlet accept processing 3900 x 3900...i know, huge! that's client wants. i've put servlet on tomcat on vps testing , i'm seeing pretty serious memory consumption. vps memory limits i 316mb of memory. fresh restart on tomcat, memory @ 108mb. vps running apache server. apache , tomcat stopped using 45mb, tomcat taking 63mb on initial startup. tomcat.conf - file has following set heap. # initial java heap size (in mb) wrapper.java.initmemory=100 # maximum java heap size (in mb) wrapper.java.maxmemory=128 once run image upload process - submitting image file through form on jsp page - servlet takes on there doing steps

c++ - std::string or std::vector<char> to hold raw data -

i hope question appropriate stackoverflow... difference between storing raw data bytes (8 bits) in std::string rather storing them in std::vector<char> . i'm reading binary data file , storing raw bytes in std::string . works well, there no problems or issues doing this. program works expected. however, other programmers prefer std::vector<char> approach , suggest stop using std::string it's unsafe raw bytes. i'm wondering why might unsafe use std::string hold raw data bytes? know std::string used store ascii text, byte byte, don't understand preference of std::vector<char> . thanks advice! the problem not whether works or doesn't. problem is utterly confusing next guy reading code. std::string meant displaying text. reading code expect that. you'll declare intent better std::vector<char> . it increases wtf/min in code reviews.

Split multi-page tiff with python -

what's best way split multi-page tiff python? pil doesn't seem have support multi-page images, , haven't found exact port libtiff python. pylibtiff way go? can provide simple example of how parse multiple pages within tiff? i use imagemagick external program convert multi-page fax viewable pngs: /usr/bin/convert /var/voip/fax/out/2012/04/fax_out_l1_17.tiff[0] -scale 50x100% -depth 16 /tmp/fax_images/fax_out_l1_17-0-m.png does convert first page png aaa.tiff[1] second page, , on. or extract images, do: convert -verbose fax_in_l1-1333564876.469.tiff a.png fax_in_l1-1333564876.469.tiff[0] tiff 1728x1078 1728x1078+0+0 1-bit bilevel directclass 109kib 0.030u 0:00.030 fax_in_l1-1333564876.469.tiff[1] tiff 1728x1078 1728x1078+0+0 1-bit bilevel directclass 109kib 0.020u 0:00.010 fax_in_l1-1333564876.469.tiff[2] tiff 1728x1078 1728x1078+0+0 1-bit bilevel directclass 109kib 0.020u 0:00.010 fax_in_l1-1333564876.469.tiff=>a-0.png[0] tiff 1728x1078 1728x1078

objective c - Is there an efficient way to obtain my friend's photos from Facebook API? -

a little background info; i'm making ios app uses facebook integration. using parse (www.parse.com) back-end store facebook ids, , else need app. on app, have 3 views show following: photos, friends, public photos. these not photos, ones correspond app (similar when upload photo phone, uploads "mobile uploads" album). getting photos , public photos easy since make query parse requesting photo ids author me. now full question following. if have array containing of friend's facebook ids, there way obtain photos correspond app without iterating each element in array? not wish since mean sending n requests server, not efficient. 1 know work around this? use fql query photos in app's albums (https://developers.facebook.com/docs/reference/fql/photo/). aid==album id. you can narrow search using , in clause tied specific album id's want http://developers.facebook.com/docs/reference/fql/album/

rate - Autobench how to define a decreasing profil load -

i'm using autobench test personal web server. want define scenario 3 main steps: step 1: generate increasing request load. example low_rate=10 high_rate=100 rate=10 ==> ok here step 2: want able have "fix" cpu load. example if @ end of step 1 cpu load around 50 want server stay @ load of 50 3mn before decreasing ==> possible autobench? if yes, how can it? else, can propose useful tools active step? step 3: want able do step 3: want able generate load current cpu load 0. example, configure autobench this: low_rate=100 high_rate=10 , rate=-10 (negative value) ==> not working? possible autobench? if yes how? else, , give me advises perform experience? sorry english!

java - Sobel Operator not working -

Image
i've been spending last 2 hours on , didn't realize problem is, me out? public static void sobel(img img) { int[][][] myarray = img.getmyarray(); int[][][] sobelx = img.copymyarray(); int[][][] sobely = img.copymyarray(); //itearates through matrix apply sobel operator (int line = 1; line < myarray.length -2; line++) (int column = 1; column < myarray[line].length -2; column++) for(int color = 0; color < 3; color++){ sobelx[line][column][color] = -1 * myarray[line-1][column-1][color] + -2 * myarray[line-1][column][color] + -1 * myarray[line-1][column+1][color] + 0 * myarray[line][column-1][color] + 0 * myarray[line][column][color] + 0 * myarray[line][column+1][color] + 1 * myarray[line+1][column-1][color] + 2 * myarray[line+1][column][color] +

audio - How to play .ogg files using xcode -

i want play 3 different file formats .mp3, .wav, .ogg. used avaudioplayer , managed play mp3 , wav files isn't playing .ogg files. how add .ogg support xcode project. afair, it's not directly supported frameworks, format/standard open, , multiple open readers exist. it's container so... decide level of support need.

android - fetching data from database and set it on edittext -

i doing registration page application.for need insert registration details in sqlite db.once registration done,the edittext fields should display details fetching database , submit button , text fields should disabled stop second time registration.can suggest suitable way? check code database in following link android sqlite you have store value in arraylist , retrieved database , set value edit text // myarraylist arraylist contains // data retrieved database edittext.settext(myarraylist.get(0)); after data retrieved, have check condition whether edittext.gettext().tostring() length greater 0 should not allow them edit text in edittext using following edittext.setfocusable(false);

ruby on rails - How to route an additional action for a namespaced resource? -

in routes.rb have add "settings" additional action insurances: namespace :modules namespace :insurance resources :insurances member :settings end end end end according "rake routes" gives following path: settings_modules_insurance_insurance_path but when visit path in browser, returns error: no route matches {:action=>"settings", :controller=>"modules/insurance/insurances"} this full ouput of rake routes: settings_modules_insurance_insurance /modules/insurance/insurances/:id/settings(.:format) {:action=>"settings", :controller=>"modules/insurance/insurances"} what should do? you've put new route on member, have pass id of insurance: settings_modules_insurance_insurance_path(@insurance)

c# - Why can't "return" and "yield return" be used in the same method? -

why can't use both return , yield return in same method? for example, can have getintegers1 , getintegers2 below, not getintegers3. public ienumerable<int> getintegers1() { return new[] { 4, 5, 6 }; } public ienumerable<int> getintegers2() { yield return 1; yield return 2; yield return 3; } public ienumerable<int> getintegers3() { if ( somecondition ) { return new[] {4, 5, 6}; // compiler error } else { yield return 1; yield return 2; yield return 3; } } return eager. returns entire resultset @ once. yield return builds enumerator. behind scenes c# compiler emits necessary class enumerator when use yield return . compiler doesn't runtime conditions such if ( somecondition ) when determining whether should emit code enumerable or have method returns simple array. detects in method using both not possible cannot emit code enumerator , @ same time have method return normal array , same method.

linq - getting at a deep property for a lambda Expression -

i have code thus: caseheadercomparer casecomparer = new caseheadercomparer(); list<caseheader> casestoprocess = new list<caseheader>(); foreach (groupfield fld in fields) { //get field property - ie. division system.reflection.propertyinfo pifield = typeof(caseheader).getproperty(fld.groupfieldtype.propertyname); //get item property - ie. divisionid system.reflection.propertyinfo piitem = pifield.propertytype.getproperty(fld.groupfieldtype.valuemember); foreach (caseheader ch in toprocess) { object chitem = pifield.getvalue(ch, null); guid itemid = chitem != null ? (guid)piitem.getvalue(chitem, null) : guid.empty; if (fld.items.select(i => i.itemid).contains(itemid)) { casestoprocess.add(ch); } } toprocess = toprocess.except(casestoprocess, casecomparer).tolist(); } which convert to use linq , lambdas - got close here yesterday this: list<caseheader> toprocess = ....; c

sas - Getting vector-graphics output from PROC SGPLOT in PDF -

anyone have hints getting clean pdf output proc sgplot (and similar functions sgscatter)? when create graph , write pdf ods, result looks fine in sas eg report window pdf output gets rasterized dpi setting of pdf if zoom pdf can make out pixelation. additionally, if don't define colors/line styles, output in pdf use different colors , styles (lines solid in sas report window become dashed in pdf). if make same chart proc gplot, comes vectorized text , lines don't junk when zoomed/printed. is there option need change? flag need set? i've tried things options device=svg , doesn't seem work. setting high dpi isn't solution either. code example (but really, happens on of sg * functions data/code): options nonumber orientation=landscape; ods pdf file='filename.pdf' notoc; proc sgplot data=shipped; series x=date y=weighted_price / group=type; run; proc gplot data=shipped; plot weighted_price*date=type; symbol1 c=blue i=join v=none

javascript - WordPress Theme Displaying Incorrectly In Chrome -

i'm having problem http://taxlienagents.com/ , how displaying in google chrome. when open site in google chrome, center tab area seems cover main text above it. if take @ this link , should able see talking versus when opening site in firefox. tried playing around z-index, didn't seem fix it. other issue seem having rolling on buttons ("how to," "coaching," , "done you") highlight covers 2/3 of button, think issue fancybox. if give me advice on how fix this, appreciated. you have several js related errors : 1 load jquery 2 times, in 2 different versions (one on-site, 1 google) --> remove 1 of them 2 have error in adia-paper.js keeps fancybox triggering right - , blocks js execution. --> try change $(document).ready(function() { $("#form-trigger").fancybox({ 'width' : 600, 'height' : 526, ..... to jquery(document).ready(function() { //contac

XSLT 1.0: Converting date/time to local timezone -

my xml has tag 2 separate properties, formatted_date has day.month.year format (e.g. formatted_date="02.10.2012" ) , time has hours:minutes format (e.g. time="23:00" ). i'm trying find way convert these somehow local timezone. i'm using xslt 1.0 since php-xsl can support far understand. any ideas? there no way in 'pure' xslt 1.0, must use kind of extension allow call external functions within xslt. possible in .net, environment familiar with, appears possible in php - see http://us3.php.net/manual/en/xsltprocessor.registerphpfunctions.php

c# - IronPython Script debugging -

i have .net application , there ironpython script tab-page. scripts work properly, have possibility debug them right in application , toggle breakpoints. are there solutions of problem? you can find ironpython debugger here , there series of blogs creating here .

iphone - alternative to apple keychain tool -

which terminal command line equivalent installing development certificate (.cer file) without having access keychain access utility? i have cloud rented mac doesn't offeer me access keychain utility, i'm allowed use terminal. the key use openssl in order convert ios developer certificate file pem certificate file , generate p12 file based on pem certificate , certificate key earlier generated. source openssl x509 -in developer_identity.cer -inform der -out developer_identity.pem -outform pem openssl pkcs12 -export -inkey mykey.key -in developer_identity.pem -out ios_dev.p12

iphone - How can i create slider in UIViewController -

how can make controller1 slide , down creating slider in it -(void)actionsheet:(uiactionsheet *)actionsheet clickedbuttonatindex:(nsinteger)buttonindex { switch (buttonindex) { case 0:{ //devanagari view display buttonviewcontroller *controller1 = [[buttonviewcontroller alloc]init]; controller1.delegate = self; uinavigationcontroller *navigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:controller1]; navigationcontroller.navigationbar.tintcolor = [uicolor colorwithhue:2.0/12 saturation:2.0 brightness:4.0/10 alpha:1.0]; [self presentmodalviewcontroller:navigationcontroller animated:yes]; [navigationcontroller release]; break; } i got user experience coding how-to's apple reference creating slider cgrect frame = cgrectmake(0.0, 0.0, 200.0, 10.0); uislider *slider = [[uislider alloc] initwithframe:frame]; [

javascript - Webforms - Upload Progress Bar -

i looking create file upload progress bar webforms, have read few ways yet of ways require server side scritps. use hosted cms , not have access server side scripts. there way fake progress bar using jquery? want represented realistic possible. meaning when upload large file show progress not finish before file finishes uploading. how can achieve this? note: solution must work in ie8+, ff, chrome, safari , preferably android , ios devices. you can't find out current progress of upload using javascript alone. if don't have access server, should consider alternative methods, such flash.

c++ - How to extern a global two-dimensional array? -

i want extern global two-dimensional array: float buffer[10][10]; i know "extern float buffer[];" work array single dimension, not know how extern array 2 dimensions. thanks in advance. you declare as: in header file put: extern float buffer[10][10]; in one source file put: float buffer[10][10];

When creating a new Rails application, why is there a Gemfile.lock file without running bundle install? -

and, how system install gems application without going through bundle install process? note: question process of creating new application . not same question in rails, why there new gemfile.lock when no bundle or bundle install run? (and new gemfile timestamp too) . gemfile.lock snapshot of gems , versions created when run bundle install . explained in checking code version control section of bundler rationale : gemfile.lock makes application single package of both own code , third-party code ran last time know sure worked. specifying exact versions of third-party code depend on in gemfile not provide same guarantee, because gems declare range of versions dependencies. gems can installed outside of bundler rubygems (e.g. gem install gem_name ) it's best use rvm allows install separate versions of ruby , manage individual gemsets each application explained in rvm best practices .

type mismatch - Python merge items from two rows -

it's ok if have regular format file, this: period end date 09/30/ 06/30/ 03/31/ 12/31/ 09/30/ 2012 2012 2012 2011 2011 then can merge these dates zip or print "%s%s" % (row_1[j], row_2[j]) but have irregular input this: period end date 09/30/2012 06/30/ 03/31/2011 12/31/ 09/30/2012 2011 2010 or this: period end date 09/30/ 06/30/ 03/31/2011 12/31/2011 09/30/2012 2012 2011 so final date merge of row_1 , row2 column, problem how dose python know column is. how should approach this? appreciate much! there lots of ways it, each 1 generalizing different class of inputs-like-this. how about: def dates_from_two(line1, line2): line2 = line2.split() word in line1.split(): wsplit = word.split('/') if len(wsplit) == 3: yield word if wsplit[

iphone - How to make the 'int' to 'string' with special format? -

int score=8; scorelabel.text=[nsstring stringwithformat:@"%5d",score]; i want make scorelabe show text '00008',but when line code executing,the result '8',can 1 tell me how make it? try: [nsstring stringwithformat:@"%05d", score]

sql server - Alias names for columns when using TOP N query -

i have table named user_bills , containing 192 records, sorting every user respect phone_number. query returns columns in table: select top 1 * user_bills phone_number = 4423568989 ... , actual column names follows: phone_number|user_name|reciept_number however them be: phone number|user name|reciept number i tried query below, i'm getting error missing keyword exist. there better option? select top 1 ( select phone_number 'phone number', user_name 'user name', usage_amount 'usage amount', charges 'charges', fine, month_for 'month', year, reciept user_bills ) user_bills phone_number = 4423568989 select top 1 phone_number 'phone number', user_name 'user name', usage_amount 'usage amount'