Posts

Showing posts from August, 2012

architecture - Never losing data techniques -

i'm curious techniques used build system ensuring no data lost of utmost priority. simplistic example, financial institution make sure when money transferred between accounts, once withdrawn 1 account without doubt put in other account. i'm not looking particular techniques database transactions, larger, more architecty concepts, how data saved if server goes down, or queue runs out of space, or whatever. if point me books or articles on i'd obliged. you should read automated teller machine , online transaction processing , , others topics data encryption, consider use https if thinking on web sites.

apache - Using Jetty to serve a web application -

i using jetty first time deploy gwt web app connecting restlet api , trying understand best way use it. i want make embeddable can update config during run-time (allowing me add new domain names etc). our web server runs apache serve php web app , our first time deploying gwt app , using jetty. is possible use jetty in parallel apache (both serving requests on port 80) , since embedding use apache before reaches jetty? apache receives request , forwards jetty? both server cannot run on same port. can run both on same machine. use separate port jetty. jetty receives request through own port , doesn't depend on other server.

c - fgets dont return NULL when no new line found -

well i'm using while loop: while(fgets(pclientrow, 1024 , f) != null) in other classes works ok, in 1 of them, when i'm reading file line line, won't out of loop when lines end, saw in debugger. why it? , working in class before , dont know why keep bringing empty lines untill it's crshing.. any idea? fgets in standard ansi c function, see documentation: here fgets read max. 1023 character next '\n' or eof. lines longer 1023 character or last line has no terminating newline.

c# - How to selenium.GetXpathCount for this element? -

ctl00_content_ctl00_chkproduct_0 ctl00_content_ctl00_chkproduct_1 ctl00_content_ctl00_chkproduct_2 ... ctl00_content_ctl00_chkproduct_19 ctl00_content_ctl00_chkproduct_20 what expression should use count 21 elements? i've used decimal count = selenium.getxpathcount("//*[@id='ctl00_content_ctl00_chkproduct_.*']"); decimal count = selenium.getxpathcount("//*[@id='ctl00_content_ctl00_chkproduct_[.*]']"); decimal count = selenium.getxpathcount("//*[@id='ctl00_content_ctl00_chkproduct_.']"); but none of them worked... please help. use: //*[starts-with(@id,'ctl00_content_ctl00_chkproduct_')]

java - maven-buildnumber-plugin svn revision available only when not using format -

while using maven-buildnumber-plugin 1.0 beta 4, seems can svn revision unless use <format> tag within configuration. once use <format> , <item>buildnumber</item> tag, auto-incrementing number, no longer corresponds svn revision , don't know how back. there way use svn revision number within <format> ? documentation isn't clear. the buildnumber-maven-plugin pretty darn quirky, why it's still beta. format items wish apply java message format , in cases, useful timestamps , literal strings. if don't need timestamp don't use format option when getting subversion revision number. if use format, indicated, it'll give build number increments 1 rather scm version number. if need timestamp or have other items deriving buildnumber plugin subversion revision, each 1 separate executions. here's example of how subverison revision number , build timestamp using 2 separate executions of plugin: <plugin> &l

facebook - Get status messages of a fanpage -

i wondering how latest status messages of fanpage. not of fans postet on fanpage. need way filter this. i tried sth this, doenst work. https://graph.facebook.com/123456790/feed?from.id=123456790 try ;-) $url = "/$pageid/posts?access_token=$accesstoken"; $result = $this->facebook->opengraph->api($url);

javascript - Resizing JQuery thickbox window dynamically -

i have thickbox pops when click on link. depending on user's browser size want thickbox constant 500px or width , height change dynamically depending on height of user's browser. possible? another option use jquery work out browser size , resize thickbox suit. not elegant css solution complete answer... here method done. // set displaywidth/height 90% of window var displaywidth = $(window).width() * 0.9; var displayheight = $(window).height() * 0.9; // animate thickbox window new size (with 50px padding $("#tb_window").animate({ marginleft: 0 - (displaywidth + 50) / 2, margintop: 0 - (displayheight + 50) / 2, height: displayheight + 50, width: displaywidth + 30 }, { duration: 800 }); $("#tb_ajaxcontent").animate({ height: displayheight, width: displaywidth }, { duration: 800 });

c# - WPF dragging within application throwing HRESULT E_FAIL from COM component -

i have few usercontrols in application need support dragging , dropping from, extracted code abstract class extending usercontrol (code below). when use in 1 control part of datatemplate in listbox, works fine. when use in control can drop target, following exception on dodragdrop line: comexception error hresult e_fail has been returned call com component this seems possibly related winforms interop, i'm not using winforms or com components - application pure wpf. if continue execution, drop happened successfully. if surround dodragdrop call try block empty catch block, seems work expected. don't want ship code sort of hack though. public abstract class draggableusercontrol : usercontrol { private point? lastmousedownpoint; protected override void onmouseleftbuttondown(mousebuttoneventargs e) { base.onmouseleftbuttondown(e); lastmousedownpoint = e.getposition(this); } protected override void onmousemove(system.windows.in

asp.net custom HttpHandler and URL routing -

i want handle requests application "http://example.com/whateverpath" custom httphandler return things depending of value of "whateverpath". so users accessing "http://example.com/path1" different response users accessing "http://example.com/path2", both request must handled in same httphandler. idea find "whateverpath" in database , depending of result, return response content. i hear url routing , have custom http handler working, can combine both technique need? i appreciate comment respect issue. cheers frank abel so have class implements ihttphandler called: myhandler , it's in namespace example , need make following entries in site's web.config in httphandlers section: <httphandlers> <add verb="*" path="*" type="example.myhandler"/> </httphandlers> since redirects urls web site/application handler have consider how serve static content (imgs, scr

django - deploying djangoappengine on google app engine -

http://www.allbuttonspressed.com/projects/djangoappengine i copied 4 folders said to: django-nonrel/django => /django djangotoolbox/djangotoolbox => /djangotoolbox django-dbindexer/dbindexer => /dbindexer djangoappengine => /djangoappengine and uploaded test app (just contents inside django-testapp) but massive error message when run it. saying "massive error message" not specific enough debugging help. assuming you're describing traceback, post it! (the error screen has "switch copy-and-paste view" that's handy this.)

objective c - How implement “shake to edit" in iphone program,the same as application icon in iphone -

how implement “shake edit" in iphone program,the same application icon in iphone. can implemented? uiresponder apis. see article: how use shake api in iphone sdk 3.0?

c# - rotating an image modifies the resolution and clarity -

consider code below rotate image. the problem resolution of image getting low , image getting unclear. how can avoid problem? private bitmap rotateimage(bitmap b, float angle) { //create new empty bitmap hold rotated image bitmap returnbitmap = new bitmap(b.width, b.height); //make graphics object empty bitmap graphics g = graphics.fromimage(returnbitmap); //move rotation point center of image g.translatetransform((float)this.width / 2, (float)this.height / 2); g.interpolationmode = system.drawing.drawing2d.interpolationmode.highqualitybilinear; //rotate g.rotatetransform(angle); g.interpolationmode = system.drawing.drawing2d.interpolationmode.highqualitybilinear; g.translatetransform(-(float)this.width / 2, -(float)this.height / 2); g.interpolationmode = system.drawing.drawing2d.interpolationmode.highqualitybilinear; //draw passed in image onto graphics object g.drawimage(b, new point(0, 0)); g.dispose(); return

css - Nesting HTML <span> inside rails form_for label tag? -

i want nest element inside form_for label tag. want can target specific portion of label css rules, in case make text red. quick reading, appear valid html, , fits design though idea not playing happily rails. the desired html output this: <label for="zip">zip code -<span class="required">required</span></label> my current code looks this: <%= form.label :zip, 'zip code -<span class="required">required</span>' %> the problem rails somehow escaping inner span tag appears text on page instead of html. see on page: zip code -<span class="required">required</span> rails3 automatically escapes strings. need call #html_safe on string you're putting in label. see http://yehudakatz.com/2010/02/01/safebuffers-and-rails-3-0/ details.

ios - Problem with "Presenting a controller modally within a nav controller within a tab bar controller" -

my app has 2 distincts modes. there's tab bar controller in app delegate. there 2 tabs, both using subclassed view controllers. 2 view controllers contain nav controller each. nav controllers have root view controller, , when changing screens, push , pop controllers of respective nav controller. has (normal) effect bottom tab bar visible, great , sound. this 1 time i'd present screen modally however, user can't else confirm or cancel page using 2 buttons, ie want hide bottom tab bar. case presenting view modally thought, view presented within nav controller bounds seems, bottom tab bar still visible, , causes confusion in navigation app. i'm not sure how it's possible modally presented view not hiding tab bar. of questions around here seem have problem other way around (wanting (incorrectly) present modal view , leave tab bar visible). these attempts: [self presentmodalviewcontroller:controller animated:yes]; // inside tab bar controller :-( [self.tabbarco

How do I write a decorator for my Django/Python view? -

here's view. basically, returns different responses based on whether it's logged in or not. @check_login() def home(request): if is_logged_in(request): return x else: return y here's decorator code. want check if request has headers, , if so, log him in. #decorator log user in if there headers def check_login(): def check_dec(func): if request.meta['username'] == "blah": login(request, user) return check_dec the problem is..i don't know how write proper decorator in case!!! arguments? functions? how? use @check_login instead of check_login() - otherwise decorator has return decorate doing home = check_login()(home) here's example decorator: def check_login(method): @functools.wraps(method) def wrapper(request, *args, **kwargs): if request.meta['username'] == "blah" login(request, user) # user come from?! return met

c# - Custom Security For ashx Handler -

in wcf web service have custom ashx handler. designed person can call web service , dynamic link download file. so, iis server serving page client calls web service. generates link. link can handed client machine (i.e. running web browser) , browser can open link. link ashx handler, , result file gets downloaded. for wcf service on using windows authentication because service not public, want allow anonymous authentication ashx handler because called number of client machines. any ideas? thanks. i'd recommend moving ashx handler , file download functionality separate application root can configure anonymous access. decoupling web service file download service let 2 live on different servers, potentially solving firewall issues may encounter later if download service needs accessed externally need keep web service private.

key value store - In Kyoto Cabinet Database using File Hash Database, how can avoid file size increasing? -

i using follow open: db.open("db.kch#tune_defrag=10000", db.owriter | db.ocreate) i putting , removing elements. @ end of execution, database "empty", count() function returns 0, because remove elements. why file size increase when repeat test? possible run "garbage collector" clean removed registers? if execute same test 100 times, have 500 mb size database, have 2 records. i tried put "tune_defrag=10000" think didn't work fine. obs.: register less 1k, don't understand why registers take space in disk. thanks help try this: db.kch#dfunit=8 that means kc runs defrag every 8 fragmentation detected, , 8 recommended mikio. available options listed here, use polish. http://fallabs.com/kyotocabinet/command.html

cleaner alphabet array in php -

i'm creating array of alphabet letters.. it's cluttering code , doesn't readability. php have cleaner way or function returns alphabet in array? array ('a','b','c','d','e','f','g'..........................................); you can use range function used create array containing range of elements: $alpha = range('a', 'z'); see it

flex - flex4 change custom btn icon -

i followed post here custom iconbutton using flex4 link text however, want change icon of buttom @ run time, create in actionscript : [bindable] [@embed('assets/1.png')] public var pic1:class; [bindable] [@embed('assets/2.png')] public var pic2:class; public function clicktochange() {custombtn1.setstyle("icon", pic2);} and .mxml <local:custombtn id="custombtn1" icon='{pic1}' width="80" height="80" click=clicktochange();/> but can't custombtn change pic1 pic2 when click it. hint part did wrong? thanks. simply: custombtn1.icon = pic2;

sql - How to delete rows in a Teradata table that are not in another table? -

what makes situation tricky don't have single column key, simple list of primary keys delete (for instance, "delete table key in ([list])"). have multiple columns primary key, , need join on of them. using know of other databases, thought might done as: delete table1 t1 left outer join table2 t2 on t2.key1 = t1.key1 , t2.key2 = t1.key2 t2.key1 null; but teradata (v12) responds error number 3706, saying "syntax error: joined tables not allowed in clause." found done by: delete table1 (key1, key2) not in ( select unique key1, key2 table2 );

.net - Enumerate all controls in the form -

private void enablecontrols(bool enable) { foreach (textbox t in page.form.controls.oftype<textbox>()) { t.readonly = !enable; } chksameascurrent.enabled = enable; } the above code runs fine in simple page not having master page, if run in contentpage can not enumerate textboxes , not control in form. try this. think should work. private void recursiveloopthroughcontrols(control root) { foreach (control control in root.controls) { recursiveloopthroughcontrols(control); //process control. } } call method using recursiveloopthroughcontrols(page)

.net - Revert chages in EntityCollection on click of cancel -

i have wpf window wherein grid bound entitycollection. herein add/delete record grid , click cancel button. how can revert chages made entitycollection. doesn't ef require call savchanges() before saved in database? don't need add cancel button rather save button.

linux - rsync is overwriting read-only files. How do I prevent this? -

i'm using rsync -avlz sync files between development server , production server. on production server have config files options specific server (e.g. passwords, port numbers, etc.) , don't want files overwritten when rsync. however, though files have 444 permissions, still being overwritten. can explain me why happening or point me in direction of how prevent it? seems me setting files read-only prevent rsync updating them. note: i'd prefer not have exclude files if don't have to. i'd love have server know not allow overwriting of read-only files. rsync not care "read-only", since you've told sync permissions well. keep local settings in separate file , include them main configuration.

could any one help explaining the difference between the system DSN and user DSN? -

i need create odbc connection universe database. created 1 in user dsn output not working well. 1 explain difference can understand? a system dsn available users on computer ('system wide'), whereas user dsn available 1 user.

Page not loading fully after firing a jQuery ajax request -

i facing strange issue where-in webpage not load after firing jquery ajax post request. have webpage gets html data server via web service. used jquery ajax method data. times although data received fully, status bar still shows progress bar , halts there. click on page somewhere, progress bar completes , full page shown. status bar shows loading image , halts. images hardly 1-2 kb , 2-3 on whole page. previously had set async: false removed no change. appreciated. update code: $.ajax({ type: "post", url: "webserverice/webmethod", contenttype: "application/json; charset=utf-8", data: {}, datatype: "json", success: function(response){ $("#mydivid").html(response.d); if(response.d !== '') { $('#lnk').click(function(){ alert('you clicked link'); }); } }, error: function(oerror) { alert(oerror.responsetex

Getting result from boost spirit grammar (phoenix push_back causes a compile error) -

i have following spirit grammar. trying create vector of ast node in struct myresult using standard push_back(at_c<0>(qi::_val), qi::_1) getting compile errors (see below). typedef vector<zls::astnode*> vector_astnode_t; struct myresult { vector_astnode_t turtle_commands; }; boost_fusion_adapt_struct ( myresult, (vector_astnode_t, turtle_commands) ); namespace spirit = boost::spirit; namespace qi = boost::spirit::qi; namespace ascii = boost::spirit::ascii; namespace phoenix = boost::phoenix; struct debugprint { string _name; debugprint( string n ) : _name(n) {} void operator()(int const& i, qi::unused_type, qi::unused_type) const { cout << _name << std::endl; } void operator()(qi::unused_type, qi::unused_type, qi::unused_type) const { cout << _name << std::endl; } // todo: more of these each type }; template <typename iterator> struct lsystem_parser : qi::grammar<

c++ - How to do memory profiling on Windows? -

possible duplicate: memory leak tool c++ under windows i used work on mac project , 1 thing enjoyed xcode profiler. found many bug running program various settings of profiler. notably, show me parts of program consumed memory, show me if leaked memory , show me when that. if working gui application, show me screenshots of doing when allocations/leaks/deallocations occurred. nowadays, working on windows/c++ project using visual studio , suspect project consume memory , possibly leak memory, too. using xcode, fire profiler , know what's happening. in visual studio however, can find no such thing (there awkward performance profiler, cpu time not concern here). so, how go searching leaks , code memory consumption? see application verifier , leakdiag, umdh, , debugging tools windows in general. all of free. for guide on how use them, see advanced windows debugging .

Server Application Unavailable? in asp.net? -

i uploaded, web application online when type url getting error.. server application unavailable. web application attempting access on web server unavailable. please hit "refresh" button in web browser retry request. can me thank you. i had same problem resolved it.see web config in version of .net application running. make new application pool application in same version , move application pool.hope work

java - Hibernate mapping error - Unknown entity -

i'm hibernate newbie , im receiving error when trying persist object - error -->unknown entity: org.apache.struts.register.model.event in hibernate.cfg.xml , define mapping as, <mapping class="org.apache.struts.register.model.event"/> my event class - package org.apache.struts.register.model; import org.hibernate.annotations.entity; import javax.persistence.generationtype; import javax.persistence.id; import javax.persistence.generatedvalue; import javax.persistence.table; @entity @table (name="event") public class event { @id @generatedvalue ( strategy = generationtype.auto) private int eventid; private string eventname; private string eventdescription; public string geteventname() { return eventname; } public void seteventname(string eventname) { this.eventname = eventname; } public string geteventdescription() { return eventdescription; } public void seteventdescription(string eventdescription) { thi

c# - WCF 4 close client proxy -

in old days (.net framework 3.5) need careful close wcf client proxies. in wcf 4 close not available client. available inside proxy. public class serviceproxy : system.servicemodel.clientbase<iservice>, iloginservice { } is closing client proxy no longer required? or how it? wcf proxy need closed explicitly , if using using() statement, have possibility of loosing original exception. can find details issue in following posts. from: http://geekswithblogs.net/sudheersblog/archive/2009/09/01/134430.aspx http://social.msdn.microsoft.com/forums/en-us/wcf/thread/b95b91c7-d498-446c-b38f-ef132989c154 http://geekswithblogs.net/marcel/archive/2007/05/01/112159.aspx it recommended best practice close proxy when client done using it, because closing proxy terminates session service , closes connection. alternatively, can use dispose() method of proxy close it. advantage of dispose() method can use using statement call in face of exceptions check http://g

regex - JavaScript RegExp: Different results: Built pattern using string & using regexp "literal"? -

is there differences between using regexp literals vs strings? http://jsfiddle.net/ymmrk/ string.prototype.lastindexof = function(pattern) { pattern = pattern + "(?![\s\s]*" + pattern + ")"; var match = this.match(pattern); return (match == null) ? -1 : match.index; } function indexoflastnewline(str) { var match = str.match(/\r?\n(?![\s\s]*(\r?\n))/); return (match == null) ? -1 : match.index; } var str = "hello 1\nhello 2\nhello 3\nhello4"; alert(str.lastindexof("(\r?\n)")); // returns 1st newline (7) alert(indexoflastnewline(str)); // returns correctly (23) update even if use regexp object, still same result http://jsfiddle.net/ymmrk/2/ you need escape \ in string version \\ , this: string.prototype.lastindexof = function(pattern) { pattern = pattern + "(?![\\s\\s]*" + pattern + ")"; var match = this.match(pattern); return (match == null) ? -1 : match.index; } fu

c - Two ways of implementing a linked list: which is better? -

i know 2 ways design generic linked list datastructure in c. , i'm wondering better. before asking question, i'll introduce both methods shortly: one method build functions around structure following: struct list_element { struct list_element *prev; struct list_element *next; void *data; }; obviously, data pointer points payload. list element struct outside payload. e.g. how glib has designed double linked list facility: http://library.gnome.org/devel/glib/2.26/glib-doubly-linked-lists.html another method way how it's done in linux kernel: http://isis.poly.edu/kulesh/stuff/src/klist/ . there no void pointer payload in list element struct. instead list element struct included in payload struct: struct list_element { struct list_element *prev; struct list_element *next; }; struct person { char name[20]; unsigned int age; struct list_element list_entry; }; a special macro used pointer payload struct given pointer list_entry, nam

foxpro - FOXCHKSUM algorithm -

who knows how function calculates checksum values? my goal rewrite foxpro application on .net, preserving old database, values in db calculated function. question closed. i didn't notice foxchksum has been internal function in project. -- but, anyway, thanx aswers! the foxpro checksum functions sys(2107) , sys(2007) use crc16 or crc32 calculate checksum values. possible foxchksum function wrapping these?

java - How to install jars in maven repository which is eclipse embedded? -

my objective install jar file in maven repository. below link came know how install in mvn. how install jars in maven but problem "i have maven embedded in eclipse. dont know run following command" mvn install:install-file -dfile=c:\lib\rest\wadlgenerator.jar \ -dgroupid=foo.in.shop.rest.wadl \ -dartifactid=wadlgenerator \ -dversion=1.0 \ -dpackaging=jar \ -dlocalrepositorypath=c:\maven\repositories\internal how identify maven installation directory eclipse embedded maven ? from eclipse can do: run -> run configurations -> maven build (double click) your goal install:install-file and should fill parameters' keys , values p. s. think more better have external maven installation in system

mysql - CI: Querying two tables in the model, explode -

i'm thinking days , don't come grasps (since i'm relativley new mvc , ci). i'm not sure whether issue mvc, mysql or arrays. situation: 2 mysql tables table data : id, title, list table values : id, name querying data table results in array following (excerpt): [4] => array ( [id] => 3 [title] => foo [list] => 1,2,3,4,6,14 ) [5] => array ( [id] => 4 [title] => bar [list] => 2,6,9,12 ) the field list contains comma separated values correspond ids of values table like [3] => array ( [id] => 12 [name] => 'value12' ) what try each row is: take list -values & explode array check result set values -table (via in_array() method) return name values of ids if include somehow main result set (e.g. 2-d

iphone - Horizontal UIScrollView inside a UITableViewCell -

i'm trying create exact same effect in appstore app viewing screenshots: inside uitableview, have custom subclasses of uitableviewcell's. 1 of them designed show previews of product, 4 images. want them show same way appstore presents screenshots of app : inside horizontal uiscrollview attached uipagecontrol. so add uiscrollview , uipagecontrol uitableviewcell, : @implementation phvolumepreviewcell - (id)init { if (self = [super initwithstyle:uitableviewcellstyledefault reuseidentifier:kvolumepreviewcellidentifier]) { [self setaccessorytype:uitableviewcellaccessorydisclosureindicator]; [self setselectionstyle:uitableviewcellseparatorstylenone]; previews = [[nsmutablearray alloc] initwithcapacity:4]; (int = 0; < 4; i++) { [previews addobject:@"dummy"]; } scrollview = [[uiscrollview alloc] initwithframe:cgrectzero]; [scrollview setpagingenabled:yes]; [scrollview setbackgroundcol

Wordpress Permalinks not working -

i moved site slichost amazon ec2. after moving made necessary settings wordpress. first page wordpress works fine, permalinks not working. can please let me know changes necessary make permalinks working. thanks check apache configuration , verify directory in store wordpress installation have following settings enabled (probably have more configuration options specific directory, these minimum required wordpress fancy permalinks): <directory var/www/> followsymlinks allowoverride </directory>

ios4 - ActivityIndicator not showing during NSXMLParsing -

i'm write simple app in 1 uiview (called via tabbar) rss-feed loaded url , parsed show feed-entrys in simple uitableview. within uiview created uiactivityindicatorview, connected uiactivityindicatorview in interface builder , set attribute "animating" , "hide when stopped". the nsxmlparser starts in viewdidappear , i'm calling [theactityindicator startanimating]; at beginning (before starting downloading feed-data , parsing it). my problem now, activityindicator not showing, seems view not displayed on device @ moment viewdidappear called. any hint me how can manage that? i have ibaction defined reload of feed-data , reparse it. after [ mytableview reloaddata]; called. @ action (startet via button in toolbar) activity indicator not displayed. i changed code use threading , works. long parser doing job, there seems no update gui. threading friend if stuck in same problem !

algorithm - Find the majority element in array -

the majority element element occurs more half of size of array. how find majority element in array in o(n) ? example input: {2,1,2,3,4,2,1,2,2} expected output: 2 the majority element (if exists) median. can find median in o(n) , check indeed valid majority element in o(n). more details implementation link

iphone - NSNotification stops method from working completely -

Image
i have method: - (void)reloadmessages:(nsnotification *)notification { nslog(@"recieved new messages messagesrootviewcontroller"); // need threads database... nsfetchrequest *thereq = [[nsfetchrequest alloc] init]; nsentitydescription *entity = [nsentitydescription entityforname:@"thread" inmanagedobjectcontext:managedobjectcontext]; [thereq setentity:entity]; threads = [[managedobjectcontext executefetchrequest:thereq error:nil] retain]; uialertview *alert = [[uialertview alloc] initwithtitle:@"new message" message:@"new message" delegate:nil cancelbuttontitle:@"thanks" otherbuttontitles:nil]; [alert show]; [alert release]; [self.tableview reloaddata]; } if call [self reloadmessages:nil] function works prescribed above. if called nsnotificationcenter notification: [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(reloadmessages:) name:@"newmessagesarri

ios - EAAccessory/EASession teardown during background -

using apple's eademo base i'm trying understand backgrounding's influence on eaaccessories. when receive connectnotification, accessory, check protocol , streams. streams set delegate, schedule on runloop, , open currently when go background tear down. out did , release objects. i teardown on diddisconnect. upon entry, don't didconnect walk connectedaccessory list , check appropriate devices. -=-=-=- the ea demo sets , tears down sessions on view don't see whether there background persistence. the ea demo code seems suggest can tear down , go in long device hasn't disconnected. the session , device seem state when ios device has slept or put app background , device stop acknowledging data or worse stop pulling data out of stream point stream fills up. question: when using backgrounding, should not tear down session/accessory active unless diddisconnect notification. assume session , accessory structures (and maybe streams) survive in bac

import - How the Eclipse implements importing project? -

how eclipse implements importing project , part of eclipse's codes works? ok, know ec has function:file->import ->exsit project ...i looking code of ec, cant find part of used implement loading work. in part of eclipse want learn more (in case example in import projects wizard ), can open plug-in spy using alt + shift + f1 . tell class , plug-in contributing functionality. can check out plug-in eclipse cvs .

parsing - How do I parse a text file in dictionary form and put it into a dictionary in python? -

i want take text file contains of form: {('q0','a'):('q0','a','r'), ('q0','b'):('q0','a','r'), ('q1',' '):('q1',' ','l')} and place real dictionary. i've been hacking away @ hours , have gotten far. think solution simple have found nothing useful on internet. appreciated. if file contains valid python code describing dictionary, use eval : >>> value = "{('q0','a'):('q0','a','r'),('q0','b'):('q0','a','r'),('q1',' '):('q1',' ','l')}" >>> value "{('q0','a'):('q0','a','r'),('q0','b'):('q0','a','r'),('q1',' '):('q1',' ','l')}" >>> d = eval(value) >>> type(d)

gravity - How to set item centered horizontally and vertically in android? -

how can how can make centered verrically , horizontally @ same time? android:gravity="center_horizontal" try this, set android:layout_gravity="center" https://developer.android.com/reference/android/widget/linearlayout.layoutparams.html#attr_android:layout_gravity

.Net 4.0 WCF Service failing when passing parameters -

i trying test wcf service using basichttpbinding endpoint wcf test client. can test methods don't pass parameters no issue, when need pass parameter following error: failed invoke service. possible causes: service offline or inaccessible; client-side configuration not match proxy; existing proxy invalid. refer stack trace more detail. can try recover starting new proxy, restoring default configuration, or refreshing service. an error occurred while executing command definition. see inner exception details. server stack trace: @ system.servicemodel.channels.servicechannel.throwiffaultunderstood(message reply, messagefault fault, string action, messageversion version, faultconverter faultconverter) @ system.servicemodel.channels.servicechannel.handlereply(proxyoperationruntime operation, proxyrpc& rpc) @ system.servicemodel.channels.servicechannel.call(string action, boolean oneway, proxyoperationruntime opera

python - Solving equation using bisection method -

is there bisection method can find online, python? for example, given these equations how can solve them using bisection method? x^3 = 9 3 * x^3 + x^2 = x + 5 cos^2x + 6 = x using scipy.optimize.bisect : import scipy.optimize optimize import numpy np def func(x): return np.cos(x)**2 + 6 - x # 0<=cos(x)**2<=1, root has between x=6 , x=7 print(optimize.bisect(func, 6, 7)) # 6.77609231632 optimize.bisect calls _zeros._bisect , implemented in c.

Uninstalling Oracle WebLogic plugin from Eclipse Galileo -

i believe installing eclipse plugin weblogic changes eclipse behavior based on experience ssl handshake errors due untrusted certs. trying uninstall oracle weblogic plugin galileo installation. here problem: see oracle weblogic plugins , features when click on help->installnewsoftware->already installed in tabs named "plug-ins" , "features". 2 tabs not have uninstall option/button @ bottom, not see listing oracle enterprise and/or weblogic plugin in 'installed software' tab. place can safely uninstall plugin instead of manually removing plugin , features eclipse corresponding folders. is there other entity managing downloads oracle? else trying same , finding similar problems? if have hints/pointers that'll great -- thanks. i deleted plugins , features oracle tools , weblogic included, corresponding eclipse folders, , started eclipse -clean. executing fine far.

how to fix User Defined Function scalar value performance issue in sql server 2005? -

user defined function used in stored procedure. user defined function returns scalar value. following logic used in user defined function create function [dbo].[udf_test] ( @code varchar(10), ) returns bit begin declare @bflag bit select @bflag = count(id) tbl1 code = @code if @bflag = 0 begin select @bflag = count(id) tbl2 ltrim(rtrim(code)) = @code end if @bflag = 0 begin select @bflag = count(id) tbl3 ltrim(rtrim(code)) = @code end if @bflag = 0 begin select @bflag = count(id) tbl4 ltrim(rtrim(code)) = @code end return @bflag which correct way improve performance in above user defined function? the best way of improving performance ditch udf entirely. one immediate thing occurs me ltrim(rtrim(code)) = @code is not sargable each call (i.e. every row returned in outer query) lead 4 table scans. if replace logic in udf case expre

asp.net - Elmah and network cards -

i using elmah in 1 of our production deployments , secure module local network , not expose public. aware of remote logging option can turned off , asp.net authorization, interested know if there support in elmah's configuration bind secondary nic/network card faces internal network ? there's nothing built-in elmah allow achieve here's might do: disable elmah.axd on public site , configure write errors data source (a file, sqlite database or sql server). configure intranet site have elmah.axd enabled , point same data source used public internet site. way use intranet site see errors. if have web server farm , multiple applications use centralized sql server database store application name additional column when navigate intranet elmah.axd have complete overview of errors occurring on public production servers.

ASP.NET 1.1 - "<%=" and "%>" tags being rendered in address bar -

i inherited asp.net 1.1 application written 8 years ago, app someone's first immersion in .net code mixture of code-behind server-side scattered throughout markup. the problem i'm having form label has action looks this: <form name="myform" id="myform" method="post" action="?id=<%= fooid %>" runat="server"> when save button hovered on see in status bar: ?id=<%= fooid %> as opposed to: ?id=123 if user clicks save button, address bar shows: http://servername/virtdir/pagename.aspx?id=<%= fooid %> which causes application throw exception. i've tried using: action="?id=<% response.write(fooid) %>" but still same problem. problem localized page, else can try? thanks, you can't put <%= runat=server tag - telling break server side code when is. try setting action programatically in codebehind.

asp.net datagrid sorting -

i have datagrid displaying data being returned stored procedure. works fine. problem want sorting. know there sorting functionality in grid, however, don't want go server , new set of data. want re-sort data being displayed. anyone have ideas on how done? thanks! update basically, couldn't not find easy solution issue. tried updating datagrid gridview control , (for particular issue) difficult. wound un-doing changes , adding grid had data wanted requirement. if else has issue recommend taking out of datagrid , writing in jquery. of written table had data wanted (and sortable using plug-in mentioned below) in 15 minutes compared hours spent trying jam square peg round hole. one thing can save current result set users session, provided isn't large. can use build in sorting capabilities of datagrid without dealing round trip database. you make trip server, trip web server , far faster trip involves database.

html - Distorted Page in Internet Explorer Where Perfect in Chrome -

i have website located @ http://maxflix.com/ . the website works perfect in chrome , in ie @ extent few pages of pages getting distorted in ie (please test "login" , "my account" page). i stuck problem , can't figure out solution. can me? appreciate. updated: links: chrome perfect http://i53.tinypic.com/r8cahi.png ie (correct pages) http://i51.tinypic.com/kd0bgi.png ie (error pages) http://i51.tinypic.com/kd0bgi.png validate html , css lists of errors need fixing. however, ie not modern browser , struggle getting work others.

getdate tsql question -

how write tsql calculates following: the current date , mid night such 2010-12-01 00:00:00.000 the current date , 6pm such 2010-12-01 18:00:00.000 thanks.. you can try following select dateadd(dd, datediff(dd, 0, getdate()), 0) datenotime, dateadd(hh, 18, dateadd(dd, datediff(dd, 0, getdate()), 0)) datenewtime

Restarting a setInterval() in Javascript/jQuery (without clearInterval) -

i'm working on ui tabs built using jquery. works except 1 issue - did setinterval runs function trigger("click") goes next tab after 5000 miliseconds. runs through each tab fine, issue if user manually clicks on tab, timer setinterval not restart @ 0. example if user start on tab1 @ 0 miliseconds , clicks on tab2 @ 2000 miliseconds, setinterval doesn't go 0, start @ 2000 , run 5000 miliseconds , subsequently goto tab3. understand why it's happening, wonder if there way restart setinterval timing without having clearinterval() , creating entirely new setinterval(). insight appreciated. update thanks replies - reason trying avoid using clearinterval because having issues of how write code in way clearinterval stop setinterval completely. code setup track whenever user has clicked tab. problem auto change function utilizes trigger('click'), runs clearinterval function wrote when tabs auto-change. seems run fine on own, once user starts clicking on tab

jQuery / javascript find values within a list -

i have peculiar issue i'm dealing with. i'll start off vague , if needs more detail can give background on project. i have selected id (selected checkbox): 161 and have many rows of ids so: ["161", "165", "573", "190", "150", "283"] // 1 ["160", "311", "793", "309", "301"] ["161", "165", "395", "306"] // 1 ["160", "311", "668", "191", "216", "301"] i need identify out of rows of ids above, ones have id has been selected. isn't difficult, can loop through each row of ids (looping through actual array) , thisidlist[i] == selectedid . problem i'm having when more 1 id has been selected: ["161", "306"] now need loop through rows , identify rows has both of selected ids. ["161", "165", "573", "19

android - It is possible to put a animate image on a item of a googlemap? (like a gif) -

i have android app googlemap view i have put animated icon representing gps position on map i know how normal png image, want use gif image, animated image how can it? edit: this xml animated: animation.xml <?xml version="1.0" encoding="utf-8"?> <animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false"> <item android:drawable="@drawable/miniicon" android:duration="200" /> <item android:drawable="@drawable/miniicon2" android:duration="200" /> <item android:drawable="@drawable/star" android:duration="200" /> </animation-list> this asign xml animated drawable //drawable2 = this.getresources().getdrawable(r.drawable.miniicon2); // icono del programa, para mi posicion gps drawable2 = this.getresources().getdrawable(r.layout.animation); // icono del programa, para mi posicion gps another a

domain driven design - NHibernate persist object changes for approval -

i building application allows users make changes objects, changes have approved before made permanent. using nhibernate. how handle sort of scenario using? there articles out there tackle issue? i thinking of having 2 tables each object. 1 current state , 1 proposed state. having generic changerequest object specify delete/insert/update , subject wants changed. but, don't believe nhibernate allow have 2 different mappings same object. the 2 options off top of head... each object have approved flag or approved date. (this encapsulated in common base class.) either need composite key including approval column (not recommended - composite keys pain) or each object have business key in addition pk. mean 1 table per entity metadata columns in each table determine approved. (you decide whether keep changes or latest.) the other option 2 separate tables each object. can using entity names, introduced in nh2.1. easiest show example. have 1 class definition: public cl

hash - Hashing passwords with MD5 or sha-256 C# -

i'm writing register form application still having problems being new c#. i looking encrypt/hash passwords md5 or sha-256, preferably sha-256. any examples? want able take information "string password;" , hash , store in variable "string hpassword;". ideas? don't use simple hash, or salted hash. use sort of key-strengthening technique bcrypt (with .net implementation here ) or pbkdf2 (with built-in implementation ). here's example using pbkdf2. to generate key password... string password = getpasswordfromuserinput(); // specify want randomly generate 20-byte salt using (var derivebytes = new rfc2898derivebytes(password, 20)) { byte[] salt = derivebytes.salt; byte[] key = derivebytes.getbytes(20); // derive 20-byte key // save salt , key database } and test if password valid... string password = getpasswordfromuserinput(); byte[] salt, key; // load salt , key database using (var derivebytes = new rfc2898derive

objective c - NSArray -initWithObjects: does not store objects -

i'm getting bizarre output contructor. not store of objects. debugged method , objects being stored initialized properly. use array set vc's on uitabbarcontroller , tab bar empty. here's code -(void)initbaritemswithallfeatures { /* issues */ uiimage *issuesimage = [uiimage imagenamed:@"issues_on.png"]; uitabbaritem *issuestabbaritem = [[uitabbaritem alloc]initwithtitle:nslocalizedstring(@"issuestabbartitle",@"") image:issuesimage tag:0]; [issuesimage release]; issuesnavigationcontroller.tabbaritem =issuestabbaritem; [issuestabbaritem release]; /* thumbs */ thumbsviewcontroller *thumbsviewcontroller = [[thumbsviewcontroller alloc]initwithnibname:@"thumbsviewcontroller" bundle:nil]; uiimage *thumbsimage = [uiimage imagenamed:@"thumbs_on.png"]; uitabbaritem *thumbstabbaritem = [[uitabbaritem alloc]initwithtitle:nslocalizedstring(@"thumbstabbart

msysgit - git --git-dir not working in windows -

in hook script git, trying run command this.. please refer to( git --git-dir not working expected ) git log --name-status --git-dir="c:\documents , settings\user\my documents\visual studio 2008\projects\cms\.git" --work-tree="c:\documents , settings\user\my documents\visual studio 2008\projects\cms" when run command getting following error. fatal: not git repository (or of parent directories): .git is there thing wrong in command using? since hook script , use posix paths , in bash session, not windows paths. git log --name-status --git-dir='/c/documents , settings/user/my documents/visual studio 2008/projects/cms/.git' --work-tree='/c/documents , settings/user/my documents/visual studio 2008/projects/cms' from dos session (as in "not hook), path might have looked like: git log --name-status --git-dir='c:/documents , settings/user/my documents/visual studio 2008/projects/cms/.git' --work-tree='c:/docume

ruby on rails 3 - Call back to Application Controller error - NameError (undefined local variable or method -

i'm upgrading application rails 2 3. use rights , role approach authentication worked fine under rails 2. in application controller (application.rb) have: class applicationcontroller < actioncontroller::base def check_authentication unless session[:user] session[:intended_resource] = request.request_uri session[:intended_action] = action_name session[:intended_controller] = controller_name redirect_to :controller => "sessions", :action => "new" return false end end def check_authorization user = user.find(session[:user]) unless user.roles.detect{|role| role.rights.detect{|right| right.action == action_name && right.controller == self.class.controller_path } } flash[:notice] = "you not authorized view page requested" request.env["http_referer"] ? (redirect_to :back) : (redirect_to :controller => "sess