Posts

Showing posts from July, 2014

ios - UIPopoverController and content ViewController - memory management question -

please check approach concerning release of both uipopovercontroller , loadviewcontroller - (ibaction) managecardsets:(uibarbuttonitem*)baritem { loadviewcontroller *loadviewcontroller = [[loadviewcontroller alloc] initwithstyle:uitableviewstyleplain]; self.loadpopover = [[uipopovercontroller alloc] initwithcontentviewcontroller:loadviewcontroller]; self.loadpopover.delegate = self; [self.loadpopover presentpopoverfrombarbuttonitem:baritem permittedarrowdirections:uipopoverarrowdirectiondown animated:yes]; [loadviewcontroller release]; } - (void)popovercontrollerdiddismisspopover:(uipopovercontroller *)popovercontroller { [popovercontroller.contentviewcontroller release]; self.loadpopover = nil; [_loadpopover release]; } as can see release loadviewcontroller twice , code works, no leaks, have doubts. if release once, dealloc not called in loadviewcontroller. if loadpopover property retain/copy, following line over-retaining ...

Array by reference length in C++ -

possible duplicate: calculating size of array this question has been asked before, want confirm it. let's have following c++ function: #include <stdio.h> #include <stdin.h> #define length(a) sizeof(a)/sizeof(a[0]) int main() { double c[] = {1.0, 2.0, 3.0}; printf("%d\n", getlength(c)); return 0; } int getlength(double c[]) { return length(c);} this should return wrong value because size of return size of pointer opposed size of array being pointed at. this: template<typename t, int size> int length(t(&)[size]){return size;} i know works directly, want know if can somehow call indirectly i.e. via helper function. understand 2 possible alternatives either store length of array in separate slot or use vector, want know is: given function getlength: getlength(double arr[]) { ... } is there way compute length of arr without passing more information? the template version work. said not work? template...

polymorphic associations - Database schema design - how to store specific application settings against entities -

Image
i'm trying design database tables store configuration settings entities , applications associated with. can far have hit "brick wall". i'll show mean... (do not take following: pictures, literal business problem, pictures easy way of explaining problem you). criteria we have catlog of pictures. we have several applications can consume number of these pictures. we want configure how display these pictures depending on application. bear in mind each application has specific , unique way can configured show pictures. so it's clear need 2 tables picture , application , junction table show m-m relationship, many pictures can in many applications - see below: i have highlighted in red column "config_table" - have strong suspicion bad, very, bad. showing paricular app config table store settings in. see below: so - there speicific app configurations apply pictures, depending on app talking about. assuming design broken, believe it ...

Adjust Mathematica Tooltip Placement? -

i have tooltip set display calendar, , shows fine want except calendar 1 id# showing when mouseover id# above it. there way knock down 1 column tooltip shows on right id#? tabletextstyle[10]@ grid[(# /. {i_?idq, cc__,o__} :> {tooltip[i, calendar[i, yr]], cc,o}), itemsize -> 15, sequence @@ $gridoptions] &@data /. y_string :> outputform@y;

c# - Return true or false based on whether there are duplicates -

when have duplicates in collection, want return true, otherwise, want return false. i've got following linq query. var t = in selecteddrivers group i.value g g.count() > 1 select g.count() > 1; problem though, when there multiple duplicates, return multiple trues, , if there aren't duplicates, returns nothing (should false). problem though, when there multiple duplicates, return multiple trues, , if there aren't duplicates, returns nothing (should false). well that's easy solve: bool hasdupes = t.any(); if there multiple trues, that'll true. if there none, it'll false. but frankly, inclined write own extension method bails when finds first duplicate, rather building set of duplicates , querying set: static bool hasduplicates<t>(this ienumerable<t> sequence) { var set = new hashset<t>(); foreach(t item in sequence) { if (set.contains(item)) return tru...

java - Android long-touch event -

i have 2 buttons increment , decrement value 1 each press , they're working fine onclicklistener. see onlongclicklistener exists, assume touch , hold events. how have number rapidly increment/decrement if button held? am correct in assuming onlongclicklistener fires once per long click? there more appropriate listener or property somewhere i'm not aware of? you may implement in following code. package org.me.rapidchange; import android.app.activity; import android.os.bundle; import android.os.handler; import android.os.message; import android.util.log; import android.view.keyevent; import android.view.motionevent; import android.view.view; import android.view.view.onclicklistener; import android.view.view.onkeylistener; import android.view.view.ontouchlistener; import android.widget.button; import android.widget.textview; import java.util.concurrent.executors; import java.util.concurrent.scheduledexecutorservice; import java.util.concurrent.timeunit; public c...

Use jQuery to split multiple unordered lists in two equal lists -

i'm building menu simple unordered list. menu have top level , 1 sub level. goal make 2 column layout submenus , have working static html , css this. problem need make work dynamic list. basically need jquery script go through submenu lists , split them 2 equal submenu lists. top level menus have unique class , great if script add unique classes new submenu list (column01, column02). here source code: <ul> <li class="menu01"> <a href="#">first menu</a> <ul> <li>first 01</li> <li>first 02</li> <li>first 03</li> <li>first 04</li> <li>first 05</li> </ul> </li> <li class="menu02"> <a href="#">second menu</a> <ul> <li>second 01</li> <li>second 02</li> <li>second 03</li> <li>second 04</li...

sql - Search all columns of a table for a value? -

i've looked answer this, can find people asking how search columns of tables in database value. want search columns specific table. code people have come tables question complicated , hard me figure out it's searching specific table. can me out? thanks just use third party tool. there several 100% free , can’t go wrong of these because save ton of time. apexsql search (searches both schema , data), ssms toolpack (searches schema , data not free sql server 2012), sql search (searches data only). frankly, don’t understand why experienced dbas bother writing scripts if can use tool free job.

jsp - How might I retrieve a JSTL tag from a string -

i have jstl tag in form of string i.e. <c:import url="someurl"></c:import> . want convert string jstl tag in jsp app. how might this?

ios - Exporting Part of a CoreData database -

i have application has core data database maintaining info. have managedobjectmodel , persistentstorecoordinator managing application's data. i export small subset of separate file/store (via coordinator?) can sent/emailed else same application , opened , merged contents. obviously, merge part has sticky possibilities, i'm ready that. else have pointers, suggestions, experiences on tricks, traps, or best practices? don't try @ database level. core data's database merely implementation issue...it change in future, , should not rely on database directly. instead, take objects (objects, not database entries) want share, serialize them transmission format (like json or nscoder), , decode on receiver's end.

JavaScript to test for Internet Explorer -

what shortest java-script return 0 if not internet explorer, , 6-9 version is? one option: use ie's conditional comments: <script>var ieversion</script> <!--[if ie 8]> <script>ieversion = 8</script> <![endif]-->

How can I mimic CTRL+A, CTRL+C in WebBrowser Control through COM or JavaScript? -

how can mimic ctrl + a , ctrl + v in webbrowser control automatically via com? alternatively, there way of simulating behaviour using javascript? i looked on , seems way put data clipboard use setdata() method of clipboarddata object, end html being interpreted text. need put entire webpage clipboard can pasted ms word. this answer discovered op , posted update question. moving here semantics. here's solution in javascript (can used through com well): window.document.execcommand('selectall',true); window.document.execcommand('copy',true); window.document.execcommand('unselect',true);

c# - All GridView rows disappear while selecting a row -

please consider values in comments got in debug mode: protected void filesgrid_selectedindexchanged(object sender, eventargs e) { int selected = filesgrid.selectedindex; // selected = 2 filesgrid.databind(); //added after feedback in comments. makes no change int count = filesgrid.rows.count; // count = 0 gridviewrow row = filesgrid.rows[selected]; // row = null gridviewrow row0 = filesgrid.rows[0]; // row = null } i came code while investigating why selectedvalue gives null in event handler (the datakeynames parameter set sure). can explain how possible? thank in advance. ps. here aspx code: <asp:gridview id="filesgrid" runat="server" autogeneratecolumns="false" autogenerateselectbutton="true" onselectedindexchanged="filesgrid_selectedindexchanged" style="margin-top: 0px" > <columns> <asp:commandfield showdeletebutton="true" /> ...

java - How can I increase performance on reading the InputStream? -

this may kiss moment, feel should ask anyway. i have thread , it's reading sockets inputstream. since dealing in particularly small data sizes (as in data can expect recieve in order of 100 - 200 bytes), set buffer array size 256. part of read function have check ensure when read inputstream got of data. if didn't recursively call read function again. each recursive call merge 2 buffer arrays together. my problem is, while never anticipate using more buffer of 256, want safe. if sheep begin fly , buffer more read function (by estimation) begin take exponential curve more time complete. how can increase effiency of read function and/or buffer merging? here read function stands. int buffer_amount = 256; private int read(byte[] buffer) throws ioexception { int bytes = minstream.read(buffer); // read input stream if (bytes == -1) { // if bytes == -1 didn't of data byte[] newbuffer = new byte[buffer_amount]; // try rest int newbytes; ...

sql - Is it possible to script the creation of registered servers in SSMS 2008? -

i have 60 servers want add registered servers quick access. named...is there way script don't have go through wizard 60 times? thanks! p.s. did check xml file , looks beast. not sure if copying , pasting 60 times want do... if you're comfortable in powershell, can done way. see registering sql servers in 2000 em, 2005 ssms, , 2008 ssms starting point.

php - INNER JOIN mysql boolean error -

$results2=mysql_query(" select * searchengine id in (" . implode(',', $ids) . ") or id in (" . implode(',', $ids2) . ") inner join keywords on searchengine.id=keywords.id order (relevant-irrelevant) desc, (rating/votes) desc, report asc, length(description) desc, title asc limit $page, $limit "); something in code above doesn't function thought will,the while loop returns boolean error. the code implode functions working fine. my databases searchengine , keywords searchengine : id ,title,desc... keywords : num,id,a,b the , b id should added searchengine(based on same id) make (id,title,desc,a,b...).ask need more details. note:searchengine id unique number,but keywords can have same id multiple times(one of same ids picked , b values , inserted $ids1). move clauses below joins. qualify id table name. searchengine.id select * searchengine inner join keywords on searchengine.id=keywo...

programming languages - Ruby IDE for Ubuntu Linux 64bit -

i wondering if there ruby ide ubuntu linux 64 bit. have checked around bit , found aptana studio not install launch folder. suggestions guys? i have tried several (aptana, redcar, etc.) , go using gmate, set of plugins gedit. includes several themes textmate , railscasts. it allows extract partials, display directory structure , class definitions in side bar , comes loads of autocomplete snippets common tasks, such as: typing end , pressing tab when editting erb file results in: <% end -%> i recommend tabextend plugin allows close tabs @ once, middle click close tab , close except tab in focus. installation instructions here: http://maketecheasier.com/transform-gedit-into-a-web-developer-ide/2010/12/29

performance - what are the best ways to mitigate database i/o bottoleneck for large web sites? -

for large web sites (traffic wise) has alot of incoming reads , updates end being database i/os, what're best ways mitigate performance impact? 1 solution can think of - write, cache , delayed write (using separate job); read, use memcached concept. other better solutions? here common solutions database performance: caching (memcache, etc) add memory database more database servers (master/slave or sharding) use different database type (nosql, redis, etc) indexes speed read perf. (careful, many affect write performance) ssds (fast ssds lot) raid optimize/tune sql queries

asp.net - ASP .NET razor website not showing up? -

i've published asp .net razor website ftp of domain. however, doesn't show @ all. not if set default document "default.cshtml". how come? the domain domain removed since problem solved if want check out yourself. edit why on earth getting negative votes question? please answer in comments. don't know. because linking website, or? edit 2 please don't vote post down because have directory browsing enabled. it's on purpose, , it's own choice. website blank data thing on server, , there's nothing valuable on it. furthermore, it's dedicated server won't used next week. looks me required files not on server. sure ftp process went ok?

c# - Create Clapper software with Naudio -

i'd create software listens after claps thru microphone.. my first implementation try software warn when hears high volume sound. but wondering if me in right direction? public partial class clapperform : form { wavein waveinstream; public clapperform() { initializecomponent(); } private void btnstart_click(object sender, eventargs e) { //start streaming waveinstream = new wavein(); waveinstream.dataavailable += new eventhandler<waveineventargs>(waveinstream_dataavailable); waveinstream.startrecording(); } void waveinstream_dataavailable(object sender, waveineventargs e) { //check out volume } private void btnstop_click(object sender, eventargs e) { if (waveinstream != null) { //stop streaming waveinstream.stoprecording(); waveinstream.dispose(); waveinstream = null; } } } assuming re...

real time - How to write Java JIT optimization friendly code? -

when want squeeze last bit of performance code, want utilize jit optimization best can. example, marking method final easy method inlining , avoid polymorphism in critical places, etc. but couldn't find reference or list of options java programmer can use 'hint' jit compiler faster code? shouldn't have list of 'best programming' practice low latency performance jit ? the best way write jit-friendly code write straight, simple code because jit looks , knows how optimize. no tricks! also different jvm's have different jit's, in order code works of them must not rely on of them. the usual way improve jit-performance through external configuration of jvm. jvm's these days know how inline code small method calls directly, performance gains come configuring garbage collector. here effort used in avoiding having stop program while collecting, , can tweak quite bit knowledge of how underlying hardware configured , works better others...

machine learning - How to train an artificial neural network to play Diablo 2 using visual input? -

Image
i'm trying ann play video game , , hoping wonderful community here. i've settled on diablo 2. game play in real-time , isometric viewpoint, player controlling single avatar whom camera centered on. to make things concrete, task character x experience points without having health drop 0, experience point gained through killing monsters. here example of gameplay: now, since want net operate based solely on information gets pixels on screen, must learn rich representation in order play efficiently, since presumably require know (implicitly @ least) how divide game world objects , how interact them. and of information must taught net... somehow. can't life of me think of how train thing. idea have separate program visually extract innately good/bad in game (e.g. health, gold, experience) screen, , use stat in reinforcement learning procedure. think part of answer, don't think it'll enough; there many levels of abstraction raw visual input goal-oriented b...

python - Sorting columns in a table (list of lists) whilst preserving the correspondence of the rows -

for example: list1 = ['c', 'b', 'a'] list2 = [3, 2, 1] list3 = ['11', '10', '01'] table = [list1, list2, list3] i'd sort respect first column (list1), i'd final ordering still preserve lines (so after sorting i'd still have line 'b', 2, '10'). in example sort each list individually data can't that. what's pythonic approach? one quick way use zip : >>> operator import itemgetter >>> transpose = zip(*table) >>> transpose.sort(key=itemgetter(0)) >>> table = zip(*transpose) >>> table [('a', 'b', 'c'), (1, 2, 3), ('01', '10', '11')]

iphone - What is the correct way to re-use UILabel's style? -

i have several uilabel s have same visual treatment. instead of redefining every single property every time, thinking of making copies of instance , changing text. how should done? another way create factory method, i'm not fond of idea. if you're willing learn three20, use ttlabel class, incorporated three20's stylesheet system, designed solve problem. however, have had trouble parsing three20's so-called documentation, think learning use library solve problem lot of overhead. my work-around problem put mini factory method, this: // example: - (uilabel *)makelabel { uilabel *label = [[[uilabel alloc] init] autorelease]; label.backgroundcolor = [uicolor clearcolor]; label.font = [uifont systemfontofsize:kmyfontsize]; label.textcolor = [uicolor bluecolor]; label.textalignment = uitextalignmentcenter; [self.view addsubview:label]; return label; } then when use method, other code gets cleaner: uilabel *namelabel = [self makelabel]; na...

iphone - Parent ViewController deallocated upon memory warning -

i have mainviewcontroller, new videopageviewcontroller presented modally. in viewpageviewcontroller, load web page , launch video, heavy operation , causes memory warning. when ready return mainviewcontroller dismissmodalviewcontroller, says mainviewcontroller deallocated! app crashes. this happens sometimes, not always. is there exception handling can take on it? can recreate parent view controller? help! thanks if memory low, system send memory warnings view controllers. view controller view not on screen react on memory warning unloading view (which cause reloading of view when comes on screen again,). found info here

c++ - Using Interlocks for thread synchronization and maintaining cache coherency -

if use kind of algorithm uses interlockcompareexchange operations on variable in c++ determines if set of data being written particular thread (by creating own little lock), how ensure interlocked operation updated value seen other thread if data being stored in say, level 2 cache on i7. i know cache coherency used keep data across caches of multi-core processors consistent, small frame of time when 1 core updates variable interlock function , cache checks , fixes coherency problems while core checking variable has in own cache? problem fixed if ensured variable having interlockcompareexchange operation volatile changes written directly memory? correct believe memory barrier (memorybarrier() on vs) not ensure cache coherency ensures unwanted instruction reordering? i hope question isn't vague. try answer comments if was. don't have source code post question don't have specific problems, know future reference if there problems this, c++0x having interlocks part ...

java - How to disable auto-converting to exponential expression when using Double.parseDouble()? -

when run following program: system.out.println(double.parsedouble("99999999999999") + 1); i got: 1.0e14 how can disable auto-conversion 100000000000000.0 ? that has nothing double.parsedouble , , double.tostring . try this: system.out.printf("%.1f", double.parsedouble("99999999999999") + 1);

Generate string of random characters cocoa? -

i know how generate random numbers, need string of random characters. have far: nsstring *letters = @"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz123456789?%$"; char generated; generated = //how define this? nslog(@"generated =%c", generated); [textfield setstringvalue:generated]; see q & a. generate random alphanumeric string in cocoa

jquery - Javascript Ajax prototype in existing Framework -

i write quite bit of code in asp.net mvc , use jquery quite bit make ajax calls actions return json. i've started evolve pattern make object below global object contains 'success' , 'fail' callback along 'go' method invokes core logic , takes arguments... follows: var g1 = {}; // global object project... g1.loadfilelist = { success: function (data, status, request) { // notify success - or nothing }, fail: function (request, status, err) { // notify #fail! }, go : function (args) { $.ajax({ url: '/home/somethinginterest', type: 'post', success: this.success, error: this.fail }); } }; $(document).ready(function() { g1.loadfilelist.go({ whatever = 'data' }); }); i keep thoughts organized , start working on different pattern start prototyping reuse of logging doing in error , success handlers, thought... in other js fx...

html - dynamic content box on static parent page -

i'm trying figure best way create content box below have on page @ moment. http://radiovalerie.org/testlisten.html because there flash player radio stream on page, don't want page refresh, when go section section of site, using navigation in dropdown menu (which doesn't work yet), want pop box below content subpage, if using iframe, not, cause iframes annoying! :p whats best way go this?

iphone - What is difference between NSUInteger myID and int myID? -

@interface myobject : nsobject { nsuinteger myid; } @property (nonatomic) nsuinteger myid; nsuinteger unsigned integer , int signed integer

why enum could not be resolved in JAVA? -

i using j2ee eclipse indigo, , have 3 class declare this: public interface classa { public static enum type { type1, type2 }; } public interface classb extends classa { } public class classc implements classb { system.out.println(type.type1); } there compilation error on type in classc. complain "enum cannot resolved type". , warning enum in classa, complain that: multiple markers @ line - 'enum' should not used identifier, since reserved keyword source level 1.5 on - enum cannot resolved type - syntax error, insert ";" complete fielddeclaration may know cause error in code? i had similar problem: enum can't resolved type eclipse offered import enum instead. i went preferences->java->installed_jres->execution_environment; selected javase-1.6 in "execution environments" pane; , checked jre6 in compatible jres pane. after rebuild enum recognized properly.

Who has any documents that about PostgreSQL background processes? -

who has documents postgresql background processes? i'd learn detail these background processes: postgres: logger process postgres: writer process postgres: wal writer process postgres: autovacuum launcher process postgres: archiver process postgres: stats collector process a quick internet search turned these documents, find first 1 interesting: http://raghavt.blogspot.com/2011/04/postgresql-90-architecture.html http://cisc322.files.wordpress.com/2010/10/conceptual_architecture_of_postgresql.pdf http://vibhork.blogspot.com/2011/04/postgresqlpostgres-plus-advanced-server.html

objective c - Apple in-app purchase help needed -

i trying add apple in-app purchase next game, have trouble. use nsset *productidentifiers = [nsset setwithobjects: @"com.compa.game.world1cim", @"com.compa.game.world2base", nil]; self.request = [[[skproductsrequest alloc] initwithproductidentifiers:productidentifiers] autorelease]; _request.delegate = self; [_request start]; , receive apple: - (void)productsrequest:(skproductsrequest *)request didreceiveresponse:(skproductsresponse *)response { cclog(@"received products results... %@",response.products); self.products = response.products; self.request = nil; [[nsnotificationcenter defaultcenter] postnotificationname:kproductsloadednotification object:_products]; } i have other fonctions around, not important. app set, apple id set, in-app purchase on itunes connect set. every time try receive empty array : received products results... () , yes try...

vlc hardware encoding for real-time screen multicast -

we preparing solution multicast teacher's screen 40 students' pcs. teacher , students pcs can both ubuntu , windows. some solutions tested : italc ... not stable yet. multicast "vnc -viewonly" ... no solution found capture screen vlc , multicast it. that latest seems work ... except resolution 1920x1200 cpu intensive. one idea capture 4th of screen. cpu not saturated anymore becomes slow , surface small anyway. a second idea buy pci card (or something) dedicated real-time video encoding. anyone has experience/knowledge on it? thanks! try tightvnc project's tightprojector . tightprojector program can transmit screen of particular windows computer other computers in same local-area network. data transmitted continuously, in real time.

javascript - Where can I get the slider in http://www.ibm.com/us/en/? -

where can script slider used in http://www.ibm.com/us/en/ ? please notice how reacts when mouse placed on 3 inset images of large images of slider? use jquery , animate. jquery ui has cool effects. check demo @ http://jqueryui.com/demos/effect/

ios - Is there a way to add vector image to background on ipad application? -

i trying add image background not disrupted zooming? there way this? thanks each individual view added ios interface can respond differently touch events, including not responding @ all. add uiimageview behind rest of content in interface builder, , don't implement user interaction view. here's how construct example: start apple's sample code touches . open mainwindow.xib . add image view my view . move behind other items in my view . set image available image, cyansquare.png . mode of image view should default scale fill , , user interaction enabled off, change settings if not so. run app see background image not disrupted interact squares including zooming squares.

ant - passing parameter from build.xml to java file -

when run java test file(single file) through eclipse passing arguments -dapproot=ecm -dappname=esw -dapp.module=fnt -dapp.env=loc -dclonenumber=1 test file executes without error, if dont give arguments error occurs not resolve placeholder 'approot'. i have junit target generate report in html format. <target name="junit" depends="init-junit"> <junit printsummary="on" fork="yes" forkmode="perbatch" haltonfailure="false" failureproperty="junit.failure" showoutput="false"> <classpath> <path refid="classpath_junit"/> </classpath> <batchtest fork="no" todir="${test_build_dir}"> <fileset dir="${comp_test_src}"> <include name="**/*test.java" ...

opengl - Question on rendering grass using billboard texture -

Image
every one, have been doing work on rendering grass using billboard textures recent days, , met problems, looks not bad when camera'angle xz plane not big, when angle bigger until camera on top of billboard, looks bad, cross line can seen, , not real grass. so problems follow: 1. tell me how fix problem?(looks cross) 2 what's more, did not add light or other shader effect, result looks not real, , more important factor texture used not enough, provide better texture? , teach me how add light effect , shader effect? lot. regards. use billboard grass in distance, , real, or @ least more detailed geometry close.

serialization - Debugging errors thrown from SilverlightSerializer -

i using silverlightserilaizer in wp7 app serialise variety of classes isolatedstorage. on deserialisation 1 of 3 errors; memberaccessexception, nullreferenceexception or argumentoutofrangeexception. any got pointers solutions these? thanks pat it sounds using set methods access level not equal public.

javascript - Google Map GetLocation Return String -

i have piece of code , geocoder = new gclientgeocoder(); var state; function addaddresstomap(response) { if (!response || response.status.code != 200) { alert("sorry, unable geocode address"); } else { place = response.placemark[0]; state = place.addressdetails.country.administrativearea.administrativeareaname; } } // showlocation() called when click on search button // in form. geocodes address entered form // , adds marker map @ location. function showlocation() { var address = "mutiara damansara"; geocoder.getlocations(address, addaddresstomap); return state; } alright , updated codes . try instantiate showlocation() , variable state isn't being updated addaddresstomap function . thanks your updated code helps see picture little better. it looks addaddresstomap() expecting response variable function arguments. when it's called geocoder.getlocations(address,addaddresstomap) there's no response...

php - Problem testing exceptions with PHPUnit and Zend Framework -

when user accesses /user/validate without correct post parameters, zend application throws zend exception. (i standard "an error occurred" message, framed within layout). intentional. i trying test behaviour phpunit. here's test: /** * @expectedexception zend_exception */ public function testemptyuservalidationparameterscauseexception() { $this->dispatch('/user/validate'); } when run test message saying failed, "expected exception zend_exception". ideas? i have other tests in file working fine... thanks! the zend_controller_plugin_errorhandler plugin handles exceptions , default error_controller forces 500 redirect may mean exception testing no longer exists. try following unit test , see if passes: public function testunknownuserredirectstoerrorpage() { $this->dispatch('/user/validate'); $this->assertcontroller('error'); $this->assertaction('error'); $this->assertr...

ios - Popovers in UITableView -

i display popovers uitableview 's content (this works) on button presses , selected item string buttontitle or textview text. i've found few example on how protocols still error. code: in popoverviewcontroller.h @protocol popoverviewcontrollerdelegate <nsobject> -(void)getrowtext:(nsstring *)string; @end i declare id delegate2 variable , set property to: @property(nonatomic,assign) id<popoverviewcontrollerdelegate> delegate2; in popoverviewcontroller.m file synthesize variable, , in didselectrowatindexpath method have this, , line seems cause error i`m having: [self.delegate2 getrowtext:[somearray objectatindex:indexpath.row]; in mainviewcontroller.m add popoverviewcontrollerdelegate viewcontrollers protocol , have header file imported. , have code in -(void)getrowtext: method doesnt called. uipopovers , such set work needed, problem arises when press row in tableview. terminating app due uncaught exception 'nsinvalidargumentexce...

jquery - What IDE to use for Javascript on Ubuntu 11.04? -

i used develop/debug javascript on windows visual studio. now, have started working on ubuntu , don't feel comfortable default editors offered (vim, gedit etc). have ide propose me ? (paid license accepted, ideally jquery support). there's aptana ide based 1 practical purposes can use lightweight editor such emacs, vim, or gedit or nano if want keep simple. you're looking aptana sounds best. person suggested webstorm quite (at least i've heard) company used work used quite bit , loved that's worth try although paid of course.

ruby on rails - Problem with activerecord find -

i have 5 tables , related between. everythings good, perfectly! tried make script, if in inquiry table field is_answered = 0, find respondents (by respondent_id in question table) , send them letter have mistake! i have code: inquiry = inquiry.find(:all, :conditions => ["is_answered = 0"]) question = inquiry.question respondents = respondent.find(:all, :conditions => ["id = (?)", question.user_id]) respondents.each |r| notifier.deliver_user_notification(inquiry) end and when typing ruby blah.rb error: undefined method `question' #<array:0x7f646c82b568> what mistake? ps - inquiry table ( id, question_id, respondent_i d) relationship table between questions , answers . pss - respondent table related inquiry . the problem have more inquiry following returns array. inquiry.find(:all, :conditions => ["is_answered = 0"]) try following, mindful of how many sql queries does, there optimisations ...

Google+ social network in depth -

in language google+ written (server side) ? facebook written in php , compiled in c++ example. edit: how manage link +1 google search, profile ? the server identifies als "gse": "google servlet engine". open source "minigse" available so it's java frontend server stack. but cares anyway? client matters, , google has 2 powerfull tools web apps: closure , gwt. given dom variable "closure_uid_[...]" i'd closure in use. somewhere. what else can see? - images served "googleusercontent" , webserver calls fife - - heavy caching. takes time until user image updated - googletalk integrated "as-is". barely special. integration gmail like. - flash still used (chat audio notifications) - content duplicated new stream on "reshare" - - means every user has personal stream content copied (found while google retired "mark zuckerberg" fake account: reshared content live, wrong name {the user r...

jquery - How To Append (Or Other Method) a Lot of HTML Code? -

i need append lot of html code. improve readability, don't want write in 1 line, split them regular html. 15 new-lines or something. problem javascript doesn't allow me that. var target = $('.post .comment_this[rel="' + comment_id + '"]').parent().parent(); target.append(' <div class="replies"> <p>...</p> <img src="" alt="" /> </div> '); basically, need add html in place. i need add variables too. target.append(' <div class="replies">'+ '<p>...</p>'+ '<img src="" alt="" />'+ '</div>' ); or target.append(' <div class="replies">\ <p>...</p>\ <img src="" alt="" />\ </div>' );

objective c - Error trying to access iOS store -

all, i have following code in project: - (nspersistentstorecoordinator *)persistentstorecoordinator { if (__persistentstorecoordinator != nil) { return __persistentstorecoordinator; } nserror *error = nil; nsstring *storepath = [[self applicationdocumentsdirectory] stringbyappendingpathcomponent:@"my_model.sqlite"]; nsurl *storeurl = [nsurl fileurlwithpath:storepath]; __persistentstorecoordinator = [[nspersistentstorecoordinator alloc] initwithmanagedobjectmodel:[self managedobjectmodel]]; if (![__persistentstorecoordinator addpersistentstorewithtype:nssqlitestoretype configuration:nil url:storeurl options:nil error:&error]) { nslog(@"unresolved error %@, %@", error, [error userinfo]); abort(); } return __persistentstorecoordinator; } - (nsstring *)applicationdocumentsdirectory { nserror *err = nil; return [nsstring stringwithcontentsofurl:[[[nsfilemanager defaultmanager] ...

asp.net mvc 2 - MVC2 Slash char in url -

i want use encrypted strings in mvc2 urls. typical url in app looks this: http://localhost:29558/account/passwordreset/zkgedmzikfisno8/mes7scbli+mzo1je8lm5dteect3u91arpucavt5uxfvvrfye note after passwordreset/ encrypted string. in example encrypted string contains slash, , causing mvc crash. i've tried adding maproute in global.asax.cs follows: routes.maproute( "passwordresetspecialcase", // route name "account/passwordreset/*", // url parameters new { controller = "account", action = "passwordreset" } // parameter defaults ); but mvc2 still falling on because encrypted string contains slash char. if remove slash works, that's no good. how mvc2 regard after passwordreset pure data? thanks. your maproute contains error. replace * {*nameofparameter}

Install lisp on my linux machine -

i use vim editor. "practical common lisp" suggest installing lispbox, don't know how use emacs, don't know how run lisp code t.t after find lisp plugin vim called limp.vim long , hard install instruction :(( installed "clisp" , can run lisp code simple command: clisp ~/test.lisp but how compile it? lisp compiled language? sorry, don't know anything, i'm newbie in lisp can tell me need install lisp on linux? what's slime, sbcl,.. etc.? install , learn following things: sbcl compiler install binary http://www.sbcl.org/platform-table.html once used it, compile source , keep source around. way can jump definitions of functions of sbcl m-. in emacs. emacs watch screencast see implementing raytracer raytracer in common lisp quicklisp.lisp http://www.quicklisp.org/beta/ this new package management. when started wasn't there. have , should use it. makes things lot easier. run 'sbcl --load quicklisp.lisp'...

Compare String with split in contains - LINQ -

my requirement compare values in string list of string. code: string names = "prabha,karan"; list<string> presenter = new list<string> { "prabha", "joe", "hukm" }; bool presented = presenter.contains(names.split(',')); the above code throws error , here need find names presented in presenter(presenter has splited values of names). you below: var splitnames = names.split(','); bool presented = presenter.any(p => splitnames.contains(p)); edit: if you're interested matches do: var matches = presenter.where(p => splitnames.contains(p))

jquery - jPlayer not playing right away -

i have jplayer installed on website , works great in chrome in other browsers waits download whole video before starting play - if @ demos on jplayer website work fine in browsers. there doing stopping working correctly? here code using: http://pastebin.com/kcwli22c - not including rest of page.. thanks. i believe it's issue m4v file format (your code mentions m4v assume that's format you're using). the best format streaming video in flash player flv. or ideally switch html5 video . if you're stuck m4v files this thread has suggestions on adjusting files allow streaming. problem m4v files default store important information @ start , @ end of file, can't played without whole file being downloaded. adjusting file , moving important information start of file can begin playing immediately. hope helps

symfony - Importing tables from external database in Symfony2 with doctrine -

i have symfony2 project own database, , want connect database (another project) can modify tables. i created new connection in config_dev.yml doctrine: dbal: default_connection: default connections: default: driver: pdo_mysql host: localhost dbname: database1 user: root password: buv: driver: pdo_mysql host: localhost dbname: database2 user: root password: i tried import schema following command: $ php app/console doctrine:mapping:import --em=buv mybundle yml [doctrine\dbal\schema\schemaexception] index '' not exist on table 'old_table' but of tables in database2 have no pks! , full import dosn't work. want import 2 tables, tried: $ php app/console doctrine:mapping:import --em=buv --filter="tablename"...

jquery - Plupload connection between multipart=true and showing upload percentage -

seems plupload great tool. i'm stuck in simple problem here. have set multipart = false (i don't want send data in chunks), however, want show percentage uploaded. shows no % uploaded , shows 100% @ end of upload. here code. $(function() { var pluploader = new plupload.uploader({ runtimes : 'flash', //flash,gears,flash,silverlight,browserplus,html5 browse_button : 'img_video_upload', container : 'video_upload_container', max_file_size : '3gb', //chunk_size : '100kb', multipart : false, multiple_queues : false, multi_selection: false, url : 'url('*/*/videoupload')?>', flash_swf_url : '/public/js/plupload/js/plupload.flash.swf', filters : [ {title : "video file", extensions : "flv"} ] }); pluploader.init(...

php - Using innerhtml to write html with A LOT of quotes -

i'm trying call function writes long string of html element. string similar this; '<div id='gaugearray8'> <p id='ancpub' class='plot' style='height:100px;width:175px;float:left;' title='0.0011217599587192' onclick=lowerlevelprint([{"numberselected":1,"targetperc":[237.5],"kpidescription":["contribution&nbspof&nbspexternal&nbsprevenue"],"kpiname":["revcontrubionkpi"],"valuetoprint":[0.0011217599587192],"valuenow":[19],"valuecompare":[1693767],"target":["8"],"kpiunits":["pounds"],"percentcompare":[0.0011217599587192]}]) onmouseover=toplevellabel({"numberselected":1,"description":["contribution&nbspof&nbspexternal&nbsprevenue"],"groupdescription":"ancillary&nbspservice&nbspperformance"}) onmouseout=clearne...

localization - Get the language of user in android -

http://web.archiveorange.com/archive/v/fwvde0wn3xcvimtadw6x it seems navigator.language property "en" in webview on androids. then, best way language of user? in native java code , pour webview javascript? or other better way? the solution found problem set user agent through webview's settings: websettings settings = wv.getsettings(); settings.setjavascriptenabled(true); settings.setuseragentstring(locale.getdefault().getlanguage()); in webcontent retrieve through: var userlang = navigator.useragent; this should used webview displaying local content.

php explode select multi choose -

i want divide these html serval several part. 1 <h2> or <h3> <p> , <span> 1 part. tried explode array('<h2>','<h3>') , caused warning . explode not support multi choose. so how perfectly? thanks. $text=<<<eot <h2>title1</h2> <p>something</p> <span>something</span> <h3>title2</h3> <p>something</p> <p>something</p> <p>something</p> <h2>title3</h2> <span>something</span> <h2>title4</h2> <span>something</span> <p>something</p> <p>something</p> eot; foreach ($text $result) { $arr = explode(array('<h2>','<h3>'),$result); reset($arr); foreach($arr $line){ echo $line.'<hr />'; } } warning: invalid argument supplied foreach() on line 23; my expected output is: <h2>title1</h2> <p...

.net - Is calling Marshal.ReleaseComObject necessary if the process is terminating? -

i have console application automates windows application through com interop. automates application open file, take screen shot , exits. i wondering if there ill effects if didn't call marshall.releasecomobject on limited number of com objects getting instantiated? seems cleaner call release method clean objects necessary in case? is necessary? not. if don't, can guarantee @ point come , bite you. whenever i'm using unwrapped com object, wrap in try...finally block , perform releasecomobject in finally.

datetime - JavaScript code to display Twitter created_at as xxxx ago -

i need js code take created_at value twitter feed , display xxxx ago. i can find examples of creating xxxx ago bit not examples of getting created_at bit correct format js. does have in 1 function i'm after? example format tue apr 07 22:52:51 +0000 2009 cannot use new date(date.parse("tue apr 07 22:52:51 +0000 2009")) gives invalid date error in ie. using moment.js without plugin custom format need use parse awkward twitter date properly: var tweetdate = 'mon dec 02 23:45:49 +0000 2013'; moment(tweetdate, 'dd mmm dd hh:mm:ss zz yyyy', 'en');

sql server - Writing AutoIncrement for primary key in CodeFirst -

i using codefirst in project. 1 of things learning how can design tables first writing classes. question - how can classify primary key [key] id, auto increment field. when record created (or row in table) primary key auto generated. how do in codefirst while writing class definition. help. public class newtable { //looking [autoincrement][key] id field etc... [key] public int id { get; set; } [required(errormessage = "title required")] [displayname("title")] public string title { get; set; } } a string auto increment? that's not gonna work. use int instead, , pk identity column default. don't need [key] attribute either; ef infer because property called id .

intel - CPU/Processor error rate in calculations -

does intel or amd publish specifications rate @ failures in calculations can expected on cpus? suspect age , temperature dependent, surely there must kind of numbers available? i'm not interested in manufacturing errors. i'm interested in spontaneous errors due physical phenomena not related design error. whether error originates in cpu or other chip on system of interest (for example momentary voltage failure processor result in errors). i'm curious, net searching isn't yielding want. want rough ideas of left program running x hours how many spontaneous errors expect have. i'm not sure if best stackexchange site ask, perhaps electronics instead? the number zero. if calculation errors , cpu's temperature witin boundaries defined specification, have defect cpu must replaced.

MVVM Binding - creating a control in a View, how bind to property in ViewModel? -

we add tabcontrols our application @ runtime. each tabcontrol given viewmodel datacontext. add tabcontrols sending message main app view; message contains viewmodel used datacontext. from main app viewmodel, add tabitems tab controls sending message main app view create tabitem , add specified tabcontrol. i'd bind properties of tabitem properties of tabcontrol's viewmodel; needs done programmaticaly, of course. since tabcontrol , tabitem don't know viewmodels (only datacontext), how specify properties of viewmodel bind tabitem properties too? thanks advice... messenger.default.register<addtabcontrolmessage>(this, m => { tabcontrol tc = new tabcontrol(); tc.datacontext = m.viewmodel; // etc. } ); you can cast datacontext type of viewmodel , access properties way. tc.someproperty = ((myviewmodel)datacontext).somevmproperty;

c# - 400 error from webservice -

can explain me why im getting http 400 error when trying post webservice? my service contract :: [servicecontract] public interface ifldtwholesaleservice { [operationcontract] [webinvoke(method = "post", responseformat = webmessageformat.xml, bodystyle = webmessagebodystyle.wrapped, uritemplate = "mac")] string mac(string input); my call; private void posttowebsite() { httpwebrequest req = (httpwebrequest)httpwebrequest.create(txturl.text); req.method = "post"; req.mediatype = "text/xml"; string input = "dfwa"; req.contentlength = asciiencoding.utf8.getbytecount(input); streamwriter writer = new streamwriter(req.getrequeststream()); writer.write(input); writer.close(); var rsp = req.getresponse().getresponsestream(); txtout.text = new streamreader(rsp).readtoend(); } my server config file ...