Posts

Showing posts from July, 2012

functional programming - how to get an int list of months by giving two days of a year? -

write function named month_range takes 2 days of year named day_one , day_two (e.g. 65, 128, assuming year has 365 days) input , return int list of months. size of int list must day_two - day_one + 1; aware, if day_one>day_two, size of list = 0 example : month_range(25,36) should return [1,1,1,1,1,1,1,2,2,2,2,2] january(25,26,27,..,31) , february(1,2,..,5) i wrote code doesn't work : fun month_range (day1:int,day2:int) = let val month_days= [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; fun what_month(day :int) = let fun aux(sum :int, numbers: int list) = let val numbers_tail = tl numbers in if sum <= (hd numbers) 1 else 1 + aux(sum, (hd numbers + hd numbers_tail)::(tl numbers_tail)) end in aux(day, month_days) end in if (day1>day2) [] else what_month(day1) @ what_month(day2) end well per previous question , have function what_month , return month number of given day of year. you pretty simple iterate day_one

.net - ReaderWriterLockSlim (not so slim) replacement, recursive, with upgradeable read? -

somehow got lot of readerwriterlockslim in our code. each of them takes 6k memory, has become big issue. as quick fix, i'm looking less memory-hungry replacement. i'm trying joe duffy's rw-lock , it's not upgradeable , write-recursive (and pretty hard make such). is there other, more memory-light replacement? well, obvious approach use readwriterlock (sans slim), believe less memory intensive (but less efficient in scenarios).

Symfony 2.1 with PHPPDF -

i trying include image (a jpg file) pdf being created using phppdf bundle of symfony 2.1.3. i able create pdf's cannot them include images. i using, inside twig template: img src="{{ pdf_image('gimage.jpg') }}" i have tried putting jpg in number of different places , tried number of different paths e.g. img src="{{ pdf_image('xx/xx/xx/gimage.jpg') }}" nothing works. have tried path image without pdf_image . can help? are using psliwa pdfbundle ? if says use.. <img src="{{ pdf_image('symfonywebconfiguratorbundle:blue-arrow.png') }}" /> which think linking to.. path/to/symfonywebconfiguratorbundle/resources/blue-arrow.png

BootStrap Mobile CSS Code Not Registering -

this may stupid question, have website , i'm learning bootstrap. have styles working correctly on browser(even when shrink them down mobile view). if @ on mobile website through phone, nothing registering...any ideas? http://goo.gl/yfhni - link viewing. thanks! a couple of details closer answer. in head, add <meta charset="utf-8"> and on line 24, close h4 tag. see happens after make corrections. good luck!

json - Facebook Fan Page feed on Website (Age-Protected) -

need in trying posts/wall posts fan page age-gated on facebook show on site. the fan page age gated let 17 , on view (when logged facebook). but, website behind age gate (locally), want show posts facebook page on site. i've seen done before, never able @ person's code see how he/she did , can't locate has tried or pulled off. i've created app on facebook, tied account, able see page on facebook (whether it's age gated or not): here code <?php function fetchurl($url){ $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_timeout, 20); $feeddata = curl_exec($ch); curl_close($ch); return $feeddata; } $profile_id = "(page id)"; //app info, needed auth $app_id = "123456789"; $app_secret = "123456789abcdefghij"; $authtoken = fetchurl("https://graph.facebook.com/oauth/access_token?type=client_cred&client_id={$app_id}&clien

HTML calling POST action on embedded php -

i have html page displaying phpbb3 forum through iframe using following: <iframe name="inlineframe" src="http://www.website.net/forums/index.php" frameborder="0" scrolling="auto" width="100%" height="1500" marginwidth="5" marginheight="5" ></iframe>. i doing in order display html coded menu bar on top of forum. on html page (the home page), have container input fields allowing log in directly forums via following code: <form action="http://www.website.net/login.php?mode=login" method="post"> <label for="username">username</label><input type="text" name="username" required> <label for="password">password</label><input type="password" name="password" required> <input type="submit" name="login" value="lo

multithreading - How can I copy/clone a single row from a ResultSet in Java? Multithread implementation -

i retrieve resultset lot of rows. each row has analyzed, i'd analyze each row in new thread (don't worry: won't start threads simultaneously, let 10 in row). entire resultset used exclusively read data (so, it's kind of static read-only table). so i'd is: resultset rs; public void loadresultset(){ ... rs = _preparedstatement.executequery(); int rowsize = 0; while (rs.next()) { rowsize++; } //this method starts 10 threads simultaneously runthreads(rowsize); ... } and... @override public void run() { //unknown object allows me store copy of single row resultset foo foo = rs.absolute(index); //then can retrieve data normal resultset string s = foo.getstring(1); .... .... } any suggestion? samples appreciated! thanks! if u, rather execute queries in separate threads like: select * table_name mod(id,threadcount)=threadid just give id each thread , execute them. this

Which iOS crash-reporting services are unreliable? (< 50% of bugs caught) -

i've tried crashlytics, crittercism, bugsense, , flurry, , none of them seem consistently report crashes. first 3 don't catch crashes claim to, , last 1 explicitly doesn't catch low-level errors de-referencing null pointer. miss lot of them. yesterday created ~9 errors crashlytics, , caught 3. have others had similar experiences? there better crash reporting service? or have done wrong bad data?

javascript - How do I make a loop? -

i have php array writes <div id="first_<?php echo $z; ?>" class="source"> i'm trying create loop in javascript can change style.display property of each. total amount of first_ s can anywhere 0 100. all know how this: function setup() { cow = document.getelementbyid('first_1'); cow.style.display='none'; cow = document.getelementbyid('first_2'); cow.style.display='none'; cow = document.getelementbyid('first_3'); cow.style.display='none'; } my guess on how this: for (var = 0; < 100; i++) { cow = document.getelementbyid('first_'var i); cow.style.display='none'; } for (var = 0; < 100; i++) { var cow = document.getelementbyid('first_' + (i + 1)); if (cow) cow.style.display='none'; }

url rewriting - php htaccess url rewrite issue -

im trying url rewrite work , im not getting where. want have 3 pages 1 music , general products , other mvies, each have query string of &pagetype=general etc url http://shopnbuy.vacau.com/browse/computers.html?pagetype=general redirect general_products.php , there music_products , movie_products. have same url except there different parameter &pagetype=. below htaccess file first attempt @ doing this # not remove line, otherwise mod_rewrite rules stop working rewritebase / rewriteengine on rewriterule ^browse/([a-za-z0-9_-])\.html general_products.php?department=$1&pagetype=general rewriterule ^browse/([a-za-z0-9_-])\.html music_products.php?department=$1&pagetype=music rewriterule ^browse/([a-za-z0-9_-])\.html movie_products.php?department=$1&pagetype=movie url suppose http://shopnbuy.vacau.com/browse/computers.html all im getting error each url rewrite i don't know htacess, used lately , found out can't use "/" effectively.

regex - How to find the multiline pattern match (they must be first time match)? -

i know question how find patterns across multiple lines using grep? think problem more complicated. need help. i have dictionary file bcfile as boundary { inlet { type fixedvalue; value uniform (5 0 0); } outlet { type inletoutlet; inletvalue $internalfield; value $internalfield; } .... } i writing script print out inlet boundary condition fixedvalue , , outlet boundary condition inletoutlet . if use cat bcfile | grep "type" | awk '{printf $2}' | tr -d ";" , won't work keyword type occurs many times. if use awk -v rs='}' '/inlet/ { print $4 }' bcfile , won't work either, because keyword inlet occurs many times. i need way find pattern first search key word inlet , search closest { , } . anyone knows how smartly? since didn't provide expected output input posted we're guessing

android - How do I save the state of my activity -

how save way activity when closed button , resumed same way when closed. this activity code: public class levels extends activity{ @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); settheme(android.r.style.theme_notitlebar_fullscreen); setcontentview(r.layout.levels); final edittext anstext1 = (edittext) findviewbyid(r.id.anstext1); button button1 = (button) findviewbyid(r.id.button1); button1.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { string result = anstext1.gettext().tostring(); if(result.equals("they")) setcontentview(r.layout.social); else toast.maketext(getapplicationcontext(), "wrong", toast.length_long).show(); } }); } } in onsaveinstancestate() method can add data bundle ,

css - Fixed Bootstrap navbar disappearing with 768 x 1024 view -

i downloaded bootstrap azy responsive 1 page template , cannot fixed navbar stay @ top of screen 768 x 1024 (ipad - portrait) resolution. remains fixed @ top others 240 x 320 1024 x 768. i've created fiddle: http://jsfiddle.net/b2sw6/ i tried using didn't work: .navbar-fixed-top { position: fixed; right: 0; left: 0; z-index: 1030; top: 0; } if drag center divider bar across approx. 768px width see black navbar scrolls rest of page instead of remaining in place @ top. does have hints on how update css correct this? you have small fix. add position:fixed; .navbar-fixed-top in mediaqueries 979px. change @media (max-width: 979px){ .navbar-fixed-top { margin-bottom: 0px; } } with @media screen , (max-width: 979px){ .navbar-fixed-top { margin-bottom: 0px; position: fixed; } } good luck.

android - Why doesn't onSurfaceCreated ever run in this code? -

i create game element way in activity: public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); mgame = new game(this); mgame.bootstrap(); setcontentview(commonobject.scommonparams.touch); mgame.loadtextures(); } then in bootstrap create glsurfaceview way: (callingactivity passed when created mgame) commonobject.scommonparams.openglview = new glsurfaceview(callingactivity); commonobject.scommonparams.openglview.setrenderer(new gamerenderer()); commonobject.scommonparams.openglview.setrendermode(glsurfaceview.rendermode_when_dirty); is because pass glsurfaceview static object it's not working? turns out had to setcontentview(commonobject.scommonparams.openglview); for onsurfacecreated run. sad since trying avoid doing that.

python - 2D Numpy Array Beginner troubles -

my issues trying work arrays each elements tuple of 2 values. specifically problem generate random 2-dimensional walk of 200 (but testing 2) steps max distance, 100 (try 2) of walks per stage, , commencing each stage @ largest distance origin of previous stage. i can generate array of random steps , them return final position (x,y) value , calculate distance of them origin of each walk: that's defined in these functions: #............................................................getpositioninteger def getposint(description) : """asks user enter positive integer""" askagain = false while askagain == false: try: posint = eval(raw_input("\n %s : " %description)) assert 0 < posint , "not positive integer" assert type(posint) == int , "not positive integer" askagain = true except : print "input failed, not positive int

php - Is there anyway to get the primary key before a TRANSACTION is submitted? -

actually think of scenario this: let's managing library stores many books. our web application library allows user add books shelf. database has 2 tables, books , authors. schemas these: create table books (book_id int not null identity(1,1), book_name nvarchar(100) not null, author_id int not null, primary key (book_id), foreign key ( author_id ) references authors(author_id),) create table authors (author_id int not null identity(1,1), author_name nvarchar(100) not null, primary key (author_id)) assume request author name , book name store book on shelf. automatically generate entry author if there no such author. want operation transaction.(i want rollback if goes wrong.) can primary key before ending transaction this? $server_name = "s3"; $connection_info = array( "database"=>"bis_testing", "uid"=>"bisuser", "pwd"=>"111"); $conn = sqlsrv_connect( $server_name, $connection_info); sqls

internet explorer - Omniture code issue in IE -

we trying implement omniture tracking our site involves lot of ajax calls. send omniture code response of ajax request. works chrome , other browsers. having problem ie. line, if (navigator.appversion.indexof('msie') >= 0) document.write(unescape('%3c') + '!-' + '-') is causing access denied error in ie. understand of document.write append current document if , when document loading. since ours ajax request, document in ready state, , cause document.write overwrite our whole page <!-- . can suggest way tackle issue? for versions of ie code implemented for? support ie >= 7 , safe if remove line? this article prove valuable you: breaking down sitecatalyst's page-level code if don't care data coming browsers older ie7 or non-javascript users, can call s.t() function itself. the noscript tag there @ least data non-javascript visitors, , line of code have in question used stop ie sending both regular image req

javascript - How to delete an object from inside? -

i'd know how delete object inside, when object no longer used. for example : var myobject = function () { return { 'some': function() {...}, 'actions': function() {...}, 'destroy': function() { = null; // throws "referenceerror: invalid left-hand side in assignment" }, } } // doing so, able : var obj = new myobject(); obj.some(); // , when have finished : obj.destroy(); the reason behind can't destroy outside (the object created on "click" on dom element, destroyed when click somewhere else, scope of creation (in "onclick" method) not available want delete it. how can ? thanks help! javascript doesn't work way. in fact, can't destroy objects whatsoever. 1 , thing can make sure not have references object make eligible garbage collection js runtime. if post more complete snippet can tell whether have memory leak or not, if have done correspond

java - Rest service running with JUnit -

i have created sample project given on soapui.org: http://www.soapui.org/rest-testing/getting-started.html . after creating it, have exported test case folder "soaprest.xml". want integrate service junit. tried following code: import com.eviware.soapui.tools.soapuitestcaserunner; public class sample_restservice { @test public void soapuirest(){ soapuitestcaserunner runner = new soapuitestcaserunner(); runner.setprojectfile("c:\\users\\meharkoduri\\soaprest.xml"); try { runner.run(); } catch (exception e) { system.out.println(e); //e.printstacktrace(); } } } i getting following error: soapui 4.0.0 testcase runner 11:46:57,736 warn [soapui] missing folder [c:\users\meharkoduri\workspace\soaprest_project\.\ext] external libraries 11:46:57,738 info [defaultsoapuicore] creating new settings @ [c:\users\meharkoduri\soapui-settings.xml] org.apache.xmlbea

jquery remember option selected -

how use jquery remember option user has selected when post itself? (selected="selected") <form action="abc.php" method="post"> <select id="dropdown"> <option value="a">a</option> <option value="b">b</option> <option value="c">c</option> </select> <input type="submit" /> </form> if really want javascript you'll have use cookies. can read here . there cookie management plugins jquery, google along lines of jquery cookie plugin . otherwise, if you're returning form because fields not filled or similar problem suggest using php (as see you're using it) set selected values.

php - codeigniter edit details page -

Image
i have page user can go edit information entered himself. code: <html> <head> <title></title> <meta http-equiv='content-type' content='text/html; charset=utf-8'> </head> <body dir="rtl"> <?php echo form_open('profile/edit'); ?> <h5>الاسم الكامل</h5> <input type="text" name="fullname" value="<?php echo $fullname; ?>" /> <h5>الايميل</h5> <input type="text" name="email" value="<?php echo $email; ?>" /> <h5>الجوال</h5> <input type="text" name="mobile" value="<?php echo $mobile; ?>" /> <h5>هاتف</h5> <input type="text" name="telephone" value="<?php echo $telephone; ?>" /> <h5>العنوان</h5> <input type="text" name="address" value="<?php echo

nlp - What other inputs are there to Word Sense Disambiguation task? -

in natural language processing (nlp), word sense disambiguation (wsd) task computationally determines meaning(s) or sense(s) or concept(s) of polysemous word given sentence word appears in. example: "some stupid enough rob central bank* ."* "the river bank is full of stones" do know on wsd performed in paragraph or document level? other disambiguate senses/meaning context words in 1 sentence, what other input introduce perform wsd task? (i've seen wsd images before, http://acl.ldc.upenn.edu/w/w03/w03-0601.pdf ) when start talking paragraphs or documents, times rather word senses interested in topics. use collection of word senses assigned words in paragraph figure out topic, problems connected, although it's better think in terms of topics rather senses (which associated words or perhaps phrases). good luck, ted

java - Does com.day.cq.search.impl.SimpleSearchImpl expose an addPredicate() method? -

i need filter pages won't appear in search. there method called addpredicate(new predicate("mytype", "type").set("group.4_group.1_property", "jcr:content/cq:template")); this method not present in com.day.cq.wcm.foundation.search . i'm not sure in api addpredicate method present. in cq5 docs, said method implemented in simplesearchimpl , present in package com.day.cq.search.impl.simplesearchimpl . however, when try import package, throws error saying package invalid. if simplesearchimpl not required class addpredicate method, can please tell me class needed method addpredicate ? the com.day.cq.search.simplesearch interface exported cq-search bundle, not com.day.cq.search.impl.simplesearchimpl implementation class. you can see list of exported packages here: http://localhost:4502/system/console/bundles/com.day.cq.cq-search you can reference simplesearch implementation adapting resource or using scr refer

jquery - Multi Level Filter using in a CheckBox using JavaScript -

i have check box list filters results. options : spa(7) bar(3) spa/bar(4) the values in brackets(7,3,4) respectively indicates total rooms having mentioned facility. when select spa, desired list should display 7 results(i have 7 rooms spa facility) when select bar, desired list should display 3 results(i have 3 rooms barfacility) when select spa/bar, desired list should display 4 results(i have 4 rooms spa/bar) if select spa/bar , spa both should 4 results. if select spa/bar , bar both should 3 results. the problem facing : when selecting spa/bar , spa , getting 7 results. code : var selectedthemes = themes.split(','); var hotelthemes = ''; var isthemeexist = false; (var j = 0; j < e.htname.length; j++) { if (e.htname[j].htname != null && typeof (e.htname[j].htname) != 'undefined') hotelthemes += (hotelthemes != "" ? "," : "") + $.trim(e.htname[j].htname.tolowercase());

path - Flash automatically finds curve intersection points. Can I use that code like I use curveTo in actionscript? -

or have down , dirty math , spline intersection math myself? know basic math quadratic b-splines. i'm trying make procedural randomly generated celtic knot-work animates itself. i'm inspired book of kells original book -and animation of same name. means @ best complicated - lots of curves animating fast. i'm going generative -responsive user- celtic knots of highest possible complexity.... may mean 12 points animating randomly , in response mouse movements but... i'd love hundreds or tens of thousands... day. developing moving random curvy double lined loop scribble easy. of curves made 12 14 random points. want weave on under on under. -- need find intersections of lots of random curves each frame. when draw curves in flash in -not object- drawing mode... flash intersections , generates points automatically me. questions: -is there equivalent intersection class/method/function in actionscript 3.0 intersections done in flash drawing interface? -how of in

ios - Migrating Core Data and Mapping Model -

i hope fine :) i have database using core data. in application v1.0, users can import file in apps. now, v2.0, add attribute in model, users have v1.0 , have stored files have hold files (no deleting if upgrade app...). so, created new data model new attribute, , set current versioned core data model new data model... ok. if launch app, file deleted. normally, have use mapping model. how ? source data model , destination data model when i'm creating mapping model ? thank help! have day all! :) edit: if add new attribute not edit names of attributes, maybe don't need create mapping model... no ? if using mapping model, source model v1.0 model , destination new v2.0 model. may able away without using mapping model using lightweight migration, documentation here . the gist of says you'll need go app delegate , set relevant options persistent store. it should like nsdictionary *options = @{nsmigratepersistentstoresautomaticallyoption: @yes, nsinfer

javascript - Having trouble unbinding a function -

i have 4 images of people, each person has 4 images of food corresponds them. when name of person clicked, bolds name. un-bolds if click name. the second thing i'm trying do, have food images switch when click on each person. far, seem compiling, , not dumping previous. tried unbinding functions pull in images try , have images disappear when click new name, can't make work! anyone know can do? appreciated! $(document).ready(function(){ $('a').click(function(){ $(".onclick").removeclass('onclick'); $(this).addclass('onclick'); return false; }); $('#jim').click(function(){ grocerylist (jim); $("#jim").unbind(); return false; }); $('#jane').click(function(){ grocerylist (jane); $("#jane").unbind(); return false; }); $('#bob').click(function(){ grocerylist (bob); $("#bob").unbind(); return false; }); $('#roberta'

javascript - Adding a method to a Class protoype, error -

quick question adding method object. why errors back? checked syntax , seem correct. new javascript. // create animal class here function animal(name, numlegs) { this.name = name; this.numlegs = numlegs; } // create sayname method animal animal.prototype.sayname = function() { console.log("hi name " + this.name); }; // test var penguin = new animal("captain cook", 2); penguin.sayname(); i error when trying run code typeerror: object #<animal> has no method 'sayname' yeah, because you've declared method sayname small n letter. javascript case sensitive language.

c# - Timer starts only after the Form is closed -

i working on c# application runs on windows ce 5 device ms compact framework 2.0. in application call singleton dialog keyboard-hook asynchronously via begininvoke: this.begininvoke((threadstart)delegate() { dlgx.getinstance().display(taskcontroller.getinstance().getactivetask().getvalues(), true); }); in display method of dialog want set focus control. win ce device slow, have use timer delay focus() execution: system.windows.forms.timer timer = new system.windows.forms.timer(); timer.interval = 600; timer.enabled = true; timer.tick += (eventhandler)delegate(object obj, eventargs args) { button1.focus(); timer.dispose(); }; unfortunately not work. timer gets executed close dialog. doing wrong? thank in advance help! edit: whole display() method of dialog: public void display(list<inputrow> fvlist, bool validate) { this.fvlist = fvlist; ctlcount = (fvlist.count > 5 ? 5 : fvlist.count); (int = 0; < ctlcount; i++) { //som

Multi-part identifier could not be bound sql server -

i trying retrieve list of rows based on 3 tables: competences , user_competences , skills . try following query says the multi-part identifier "skillmgt.timestamp" not bound query: select competences.*, user_competence.e_id competences inner join user_competence on user_competence.c_id = competences.competence_id user_competence.e_id = 112 , datename(yyyy, skillmgt.timestamp) = year(getdate()) see if helps select competences.*, user_competence.e_id competences inner join user_competence on user_competence.c_id = competences.competence_id inner join skillmgt sm on user_competence.e_id = sm.eid user_competence.e_id = 112 , datename(yyyy, sm.timestamp) = year(getdate())

java - Log.v work but unable to debug app in android simulator -

Image
i trying debug application it's not working. please can suggest me happening screenshot have posted below: @kumar bibek comment still confused talking about. know tell me it's disabled it's goes hide if toggle it. it's removed or show this. never got without cross. window -> show view -> other... -> debug -> breakpoints there symbol corresponding icons on screenshot (breakpoint line through). click it, , breakpoints won't skipped.

Enabling Interrupts in U-boot for ARM cortex A-9 -

i trying configure gpio interrupt in uboot, test interrupt response time without os intervention (bare-metal). able configure pin-muxing , successful in setting interrupt gpio pin. my question regarding registering of interrupt service routine. see interrupt vector table platform @ address 0xffff0000 ( read system control register find out this). interrupt id gpio 56 , calculated address interrupt service routine should reside , tried writing address pointer isr routine. right way of doing it? or have take care of other things context saving etc myself? note : using arm cortex a-9. edit : based on answers went through code have following questions. definition of do_irq architecture( arm v7) not doing , config_use_irq not work me since functions arch_interrupt_init not defined me. can conclude interrupts not supported architecture. if have define on own functions need implement working? since small part of proj , want see if can feasible implement. want know if requires fe

c# - How to close a UserControl after success button click in jquery asp.net? -

hi iam using jquery in asp.net ihave user control few contols , save button. iam writing ajax calls save data . iam getting data saved successfully. after mu success alert user control popup still in page. wanted hide/close. for tried code , not working. success: function (html) { try { alert("added successfuly"); $(".modalbackground").hide(); } catch (ex) { alert("errcode:1"); } my ascx: which contains modalpopup few fileds <ajax:modalpopupextender id="modalpopupcontext" runat="server" targetcontrolid="btncontextpopup" behaviorid="modalpopupextender" popupcontrolid="pnlpopupcontext" backgroundcssclass="modalbackground"> </ajax:modalpopupextender> <panel ....>

c# - How to allow SQL Server database connection from an ASP.NET web app and a Windows service? -

i have asp.net web application , windows service running on same server machine. both need connect same database, using following code: using (sqlconnection cn = new sqlconnection(strdbconnect)) { cn.open(); //and on... } but gives me exception when try connect service: "cannot open user default database. login failed.\r\nlogin failed user 'nt authority\system'." the connection string i'm using both is, may different on actual deployment server: data source=.\sqlexpress;integrated security=sspi;attachdbfilename='c:\users\user\databases\app_data\database1.mdf';user instance=true;connection timeout=15 so i'm assuming need add sharing parameter connection string. question is, how ensure more 1 process can connect sql server database? create specific user. use user identity of app pool use user identity service. add user sql server necessary rights.

mysqli - MySQL Match column_name to Column data -

so trying work 2 (already) generated tables. in 1 table 1 there column named column_code in table 2 columns named data in column_code per example table 1: meta_data ---------------------------------- | pid | 1 | | question | favorite website | | column_code | aa123zz | ---------------------------------- where column_code has content named: 'aa123zz' , question called: favorite website table 2: content ----------------------------------- | id | 4 | | submit_date | 14-01-2013 | | aa123zz | stackoverflow.com | ----------------------------------- the content of table_name aa123zz instance " stackoverflow.com " now want query result like: id: = 1 favorite website: stackoverflow.com so aa123zz stands question, have no other way of matching these together, how can this? i sorry cannot make clearer. got these 2 tables , indeed seem missing something. so try make bit clearer

iphone - UITableview custom section view move to the top -

i have uitableview use view header section method customize view drop down that,when select particular button on section header view cell row appears,like drop down.i need in way such when select particular section section should go top of tableview . there solution implement this.

Android: LinearLayout (horizontal) cuts off last column -

very simple layout: have 2 textviews displayed in single line. layout centered on screen , 2 strings set programmatically, first vairaible length string while second string either empty or (let's say) "x": <linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginbottom="5dp" android:gravity="center_horizontal" android:orientation="horizontal" > <textview android:id="@+id/lblselectionname" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" android:singleline="true" android:text="@string/empty" android:textappearance="?android:attr/textappearancemedium" /> <textview android:id="@+id/lblselectionattribute" android:layout_width=&

akka github source contains unprintable characters -

i downloaded akka source github. find many files have these junk characters in them. => converts ⇒ <- converts � trait onlycausestacktrace { self: throwable ⇒ override def fillinstacktrace(): throwable = { setstacktrace(getcause match { case null ⇒ array.empty case ⇒ some.getstacktrace }) } } this present in every version. akka-master, akka-releasing-2.2-m2 , akka-release-2.1 these give error when import code eclipse after generating eclipse project sbt how download: download zip file github website. cannot use eclipse import github behind firewall. no, you're not editing them using utf-8 (as in): https://github.com/akka/akka/blob/master/project/akkabuild.scala#l575

set javascaript variable in the php (php is in javascript) -

i write php code in side javascript. this type:- function load(){ var lan= "22.3000"; var lng= "70.7833"; var radius = "7000"; var xml; var data = lan+","+lng+","+radius; xml = '<?php echo file_get_contents("http://services.gisgraphy.com/geoloc/search?lat=23.00&lng=72.00&radius10000");?>' xmldoc = $.parsexml( xml ); $xml = $( xmldoc ); abc= xmldoc.getelementsbytagname("asciiname")[0].firstchild.nodevalue; alert(abc); } want set in php javascript variable value lan lng , radius when page load what want load page ajax call load page lat , lng , radius parameters.

floating point - regex for float with 6 decimals and 3 numbers -

i need regex float number positive or negative maximum of 3 numbers before decimal separator , 6 (only 6) numbers after. can me? in javascript - match want. without further clarification there's nothing more done: /[+|-][0-9]{0,3}\.[0-9]{6}/g cheers.

c++ - determine if multiplication output fits into max value of 64 bits -

this question has answer here: how detect integer overflow? 30 answers i have multiplication line can result in output greater 64 bit values. (max can hold). i want determine best way determine if output greater 64 bits. i have tried things like. uint64_t val1, val2, val3; if ((val1 * val2 * val3 ) > uint64_max) { //warning message } else { //do } variables initialized values. a multiplication a * b of 2 unsigned (!) integer numbers of arbitrary size, let's call type t , overflow if , if result greater maximum number t can hold. standard library can access maximum number of type t using std::numeric_limits . the above statement can written as: a * b overflow if , if a > max(t) / b , same b > max(t) / a (where / integer division , max(t) maximum number t can hold). example: let's t = uint8_t , max(t) == 255 . coupl

ios - UIViewController released before its view has been closed -

i'm developing ios application latest sdk , using arc . i show uiviewcontroller : - (ibaction)showmyobjectsmenu:(id)sender { myobjectsmenuviewcontroller* myobjectscontroller = [[myobjectsmenuviewcontroller alloc] initwithnibname:@"myobjectsmenuviewcontroller" bundle:nil]; [self.view addsubview:myobjectscontroller.view]; } but wrong because myobjectscontroller released @ of method - (ibaction)showmyobjectsmenu:(id)sender . how can show viewcontroller on right way? either add controller child view controller (ios 5.0+) or otherwise store in instance variable somewhere. same other variable needs longer storage.

python - XML error object has no attribute 'cssselect' -

the following not appear parse xml data correctly or doing wrong. this code being run. from lxml import etree lxml.etree import fromstring if request.post: xml = request.post['xml'].encode('utf-8') parser = etree.xmlparser(ns_clean=true, recover=true, encoding='utf-8') h = fromstring(xml, parser=parser) status = h.cssselect('itagg_delivery_receipt status').text_content() return httpresponse(status) the error: attributeerror: 'lxml.etree._element' object has no attribute 'cssselect' status this xml document being sent: <?xml version="1.1" encoding="iso-8859-1"?> <itagg_delivery_receipt> <version>1.0</version> <msisdn>447889000000</msisdn> <submission_ref> 845tgrgsehg394g3hdfhhh56445y7ts6</ submission_ref> <status>delivered</status> <reason>4</reason> <timestamp>20050709120945</timestamp> <ret

Meteor 0.6.0 and Collection API -

upgraded latest 0.6.0 of meteor , collection api not define, meteor not start correctly more: referenceerror: collectionapi not defined i copy pasted collectionapi app "packages" folder, still not run. there else have do, use collection api latest meteor 0.6.0? meteor add collectionapi - says: collectionapi: using thanks in advance kind of information , help! i'm not sure copying , pasting packages idea. have tried reinstalling meteor remove collectionapi , adding again? update: seem getting same problem 1 of packages, chartjs . it's giving similar error yours, saying referenceerror: chart not defined . chart scoped window, accessed in client js files. must due scoping changes in 0.6.0, i'm not sure yet how resolve - package needs updating. update 2: yup, akshat dead right, js file @ heart of chartjs package needed var chart changing chart scoped window object. have sent a pull request package.

java - How does reflection and immutability supposed to work together -

according jsr-133 immutable objects thread safe , don't need synchronization. it's possible update values of final fields using reflection: package com.stackoverflow; import java.lang.reflect.field; public class whatsgoingon { static class immutable { private final int value; public immutable(int value) { this.value = value; } public int getvalue() { return value; } } public static void main(string[] args) throws nosuchfieldexception, securityexception, illegalargumentexception, illegalaccessexception { final immutable immutable = new immutable(integer.min_value); final field f = immutable.class.getdeclaredfield("value"); f.setaccessible(true); system.out.println(immutable.getvalue()); f.set(immutable, integer.max_value); system.out.println(immutable.getvalue()); } } given number of frameworks (spring , hibernate few) rely on

r - How to add elements to a plot using a knitr chunk without original markdown output? -

Image
for documentary purposes, want code plot in html-output, not plot. later, have call plotting code, , add plot, seeing additional code. tried this: ```{r non.finished.plotting, eval=false} plot(1,type="n") ``` explanatory text here in output: "this produces empty plot, , add points manually." ```{r add.layer, fig.width=5, fig.height=5} <<non.finished.plotting, echo=false>> points(x=rnorm(100,1,0.1), y=rnorm(100,0.8,0.1) ) ``` i have found echo-notation @ yihui's , when knit this, error message in output. ## error: plot.new has not been called yet i tried fiddling chunk options , not find combination want. ( sorry, basic, did not find quite example. ) chunk references in <<>> not respect chunk options, <<non.finished.plotting, echo=false>> not work. can move chunk option echo main chunk this: ```{r add.layer, fig.width=5, fig.height=5, echo=-1} <<non.finished.plotting>> points(x=rnorm(

python - Is there a more pythonic way to loop over multiple similar indices using list comprehension? -

i have following code a = [(x(x), y(y), z(z)) x in range(n) y in range(n) z in range(n)] it want - produce list of tuples representing cartesian coordinates according functions x, y , z - not pretty. tried a = [(x(x), y(y), z(z)) x, y, z in range(n)] but didn't work. there more elegant , pythonic way this? from itertools import product = [(x(x), y(y), z(z)) x, y, z in product(range(n), repeat=3)]

c# - Error while converting String with DateTime.ParseExact() function -

i trying convert string value in date time. know question asked many times. checked answers. didn't answer problem. following code: string objtime = "5/4/2013 10:30 pm"; datetime d = datetime.parseexact(objtime, "dd/mm/yyyy h:mm", cultureinfo.currentculture); i have checked chenging system datetime format. and have use this: datetime d = datetime.parseexact(objtime, "d/m/yyyy h:mm tt", cultureinfo.currentculture); can 1 please me solve problem? and have check changing format d/m/yyy h:mm still giving me error. using visual studio 2012 . your string has day , month in single digit, , trying parse format supports double digits day/month you should do: string objtime = "5/4/2013 10:30 pm"; datetime d = datetime.parseexact(objtime, "d/m/yyyy h:mm tt", cultureinfo.currentculture); you should use single d , m , support single digit , double digit day/month parsing. you should use lower case h si

php - ZF2 Form Collections - filtering empty records -

i'm trying work out how filter empty records form collection. application have 2 entities, competition , league . competition may have 0 or more leagues. so create competition form ( competitionform ), competition fieldset ( competitionfieldset ) , league fieldset ( leaguefieldset ). the competitionfieldset added competitionform , , competitionfieldset uses zend\form\element\collection allow user add 1 or more leagues. i've added current code each class below. by default, want display input fields 3 leagues within competition, within competitionfieldset , when add zend\form\element\collection item, set count option 3. but if user doesn't supply data leagues, want ignore them. @ present, 3 empty associated leagues created within database. if set inputfilter on leaguefieldset make name field required example, form won't validate. i should maybe mention i'm using doctrine2 model entities , hydrate forms etc. i'm sure make work additional

mongodb - Query without projection is not covered -

see shell example below (assumes db.test not exist): db.test.ensureindex({info: 1, _id: 1}) db.test.insert({info: "info1"}) db.test.insert({info: "info2"}) db.test.insert({info: "info3"}) db.test.find({info: "info1"}).explain().indexonly //is false db.test.find({info: "info1"}, {_id: 1, info: 1}).explain().indexonly //is true the first explain has indexonly : false whereas second has indexonly : true although 2 queries strictly equivalent. why isn't db.test.find({info: "info1"}) a covered query ? i have been thinking , testing more , make sense now. if add no projection mongodb has no way of "knowing" if index have fills entire return; mean how can know index covers projection without looking @ documents? it same select * , select d,e in sql. how can know * same d,e without looking? if supply projection mongodb can "know" looking @ index give full result set however, witho

java - Sorting of two-dimensional array based on two parameters -

the following code performs 'hierarchical' sorting of two-dimensional matrix. firstly, sorts elements based on values of ranks . secondly, takes sorted matrix, searches elements have same values of ranks , , sorts them based on dist . in descending order. question 1: possible achieve same result in easier way? tried create comparator , provided incorrect result particular case. question 2: how indexes of unsorted elements after sorting? import java.util.arraylist; public class test { public static void main(string args[]) { arraylist<arraylist<double>> values = new arraylist<arraylist<double>>(); arraylist<double> ranks = new arraylist<double>(); arraylist<double> dist = new arraylist<double>(); ranks.add(8.0); ranks.add(3.0); ranks.add(8.0); ranks.add(1.0); dist.add(1.8); dist.add(2.8); dist.add(1.9); dist.add(2.1);

mysql - SQL cursor & stored procedure order arrangement -

i working on stored procedure update order field in product table. works problem the last item in loop(cur), increased twice instead of once (so dubbeled). so: +-----------------+ |product + order | |_id | | | | | | 1 | 0 | | 2 | 1 | | etc.. | etc..| | 36 | 35 | | 37 | 36 | | 38 | 38 | | | +-----------------+ i cant figure out why. link table(categoryproduct) in case goes 38 category_id of 2 call curorder(2); stored procedure: delimiter // create procedure curorder( in catid int ) begin declare done int default false; declare int default 0; declare p int; declare cur cursor select product_id test.categoryproduct category_id = catid; declare continue handler not found set done = true; open cur; read_loop: loop fetch cur p; update `test`.`product` set `order` = `product`.`product_id` =p; set = + 1; if

asp.net mvc 4 - How do I get my MVC application to send commands and subscribe to events in NServiceBus -

perhaps i'm missing here , question maybe same this one sorry duplication. i have mvc4 site quite happily sends() commands nservicebus server. want same mvc site able subscribe ievents publish()ed same nservicebus server. can't work. messages being published server , showing in msmq can't mvc site pick them up. is possible nservicebus 3.3.5? , if so, how have set mvc site make work? thanks in advance! edit: here's config have in mvc app: configure.with() .log4net() .structuremapbuilder() .msmqtransport() .istransactional(false) .purgeonstartup(false) .unicastbus() .loadmessagehandlers() .impersonatesender(false) .jsonserializer() .createbus() .start(() => configure.instance.forinstallationon<nservicebus.installation.environments.windows>().install()); i don't have endpointconfig class implements iconfigur