Posts

Showing posts from May, 2013

What is a good way to build sub views with logic in ASP.NET MVC 3 -

we're building business application using microsoft asp.net mvc 3. views becoming complex seems reasonable divide them 2 or more separate views, separate controllers , models. (reuse reason wanting build separate views.) which method recommend achieving such separation in asp.net mvc? partial views seems obvious answer, see it, partial views "out of box" has little support separate controllers. the best solution we've found far this, using html.renderaction("<view initialization action method>") method explained here: http://www.primaryobjects.com/cms/article129.aspx this post mentions renderaction method: asp .net mvc correct usercontrol architecture do see weaknesses approach? recommend better, easier ways of achieving this? take "post detail" view. composite view displays both "post summary" , "post comments". taking partial approach, you'd end with: public class postdetailmodel { p...

optimization - Profiling and Optimizing a game android -

i'm making first android game going 3d arcade-ish game using opengl es. i've been working on quite long time, optimizing engine flexibility future. anyways i'm done games features , pretty stuff, laggs on phones aren't debug phone. game has pretty high-quality graphics mobile game little lagg expected, difference in performance between running game on nexus s , running on mytouch 4g huge. game isn't playable on lower-end phones lg optimus(the game runs, choppy play comfortably). on nexus s if ever choppy movement(i've implemented frame-rate independent movement in game) on mytouch 4g lot more common, although game still playable....but annoying i come desktop game-development background, , optimization has never been subject of interest me before. can recommend me speed game? i've tried optimizing code as possibly could, , performance has improved significantly, there seem things i've missed or overlooking. huge game full engine , lots , lots o...

Fluent Nhibernate foreign key constraint -

i have problem fluent nhibernate mapping. say have 2 entities b this: public class { public virtual guid id { get; private set; } public virtual b reftob { get; set; } } public class b { public virtual guid id { get; private set; } } how should map them, forbid me delete b when it's referenced a. so, when i'm going say: b b = new b(); a = new a(); a.reftob = b; session.save(b); session.save(a); (...) session.delete(b); //should throw kind of exception states //"cannot remove b used a" first need figure out kind of relationship have. go link useful information on one-to-one relationship mapping - if want: http://brunoreis.com/tech/fluent-nhibernate-hasone-how-implement-one-to-one-relationship/

visual c++ - How do I swap an MFC CString? -

ok, i'm sold on copy-and-swap idiom , think know how implement it. however, or codebase uses mfc's cstring class string , ain't gonna change. since swap must (should???) nothrow, cannot do std::swap(this->my_cstring, rhs.my_cstring); since create temporary cstring object may throw. (plus inefficient.) so i'm left? should add try-catch? should allow (well, extremely rare) out of memory condition raise exception , make swap fail? looking @ cstrings implementation, doesn't seem there's member or function allows swapping ... self-answer: after looking cstring more closely, appears due fact cstring reference counted string implementation, swapping via std::swap "99%" exception safe because happens reference count increments , decrements. it's "99%" safe, when cstring object islocked , copy.

javascript - How would I get a certain part of a string? -

here's example string: survey_questions_attributes_1317784471568_answers_attributes i want 1317784471568 out of string. but part text. example, may need string called new_questions same spot in string. the constant here survey_questions_attributes_ precede chunk want , _answers_attributes follow it. id = str.match(/_questions_attributes_(.+)_answers_attributes/)[1];

java - Oracle Hyperion MDM Web Service API and .NET interop -

we have oracle hyperion master data management (aka data relationship management) installed along it's web service api, ear file deployed on weblogic. built-in server side security policy has been attached web service. have .net client needs speak web service endpoint, not sure how set client side security policy defined oracle. versions used - drm: 11.1.2.1; weblogic: 10.3.4 i'm looking pointers (& sample code if possible) on how can achieve this. thanks. i got solution http://download.oracle.com/docs/cd/e17904_01/web.1111/e16098.pdf . section 5 in document speaks of how export certificate wls , import same .net client app along w/ other config specified in document. hope helps.

java - What is the purpose of 'Class.forName("MY_JDBC_DRIVER")'? -

i understand class loading useful load class @ runtime class name. however while using jdbc in our project know driver going use , driver manager string hard coded. my question is: why loading driver using class.forname("jdbc_driver") here? why can't go ahead adding driver in class path? since know driver jar going use. i believe class.forname(jdbc_driver) load driver drivermanager . reason? edit 1: the drivermanager api doc states that as part of its(drivermanager) initialization, drivermanager class attempt load driver classes referenced in "jdbc.drivers" system property. applications no longer need explictly load jdbc drivers using class.forname() . existing programs load jdbc drivers using class.forname() continue work without modification. then when use other oracle driver; need change driver name string in system property? first of: modern jdbc drivers , current jdk (at least java 6) call class.forname() no longe...

Parsing XML with Android -

i'm developing android 2.2 application. i have following xml file on res/xml: <?xml version="1.0" encoding="iso-8859-1"?> <data> <turo> <name>rodo</name> <latitude>37.212123</latitude> <longitude>0.1231231</longitude> </turo> </data> i'm getting crazy because can't find example see how can parse file. i have following class store data retrieved: public class turo{ private string name; private location location; public string getname(){ return name; } public void setname(string name){ this.name = name; } public turo(string name){ setname(name); } public void setlocation(location location) { this.location = location; } public location getlocation() { return location; } } this method parse (it's incompleted): public vector<turo> getturosfromxml(...

web services - How to use RESTful webservices in Matlab -

i have data provider provides web-based restful interface. i'm trying data matlab. interface relatively simple, i'm still looking out there has experience this? service not natively provide soap/wsdl, matlab can use easily. vendor has "adapter" that can install on machine (basically appache/tomcat installation sort of "plugin") act intermediary provide services, lots of reasons, difficult set in company. if restful interface returns json, looks it's easy installing little plugin: http://www.mathworks.com/matlabcentral/fileexchange/20565 and ((almost) direct readme of plugin): google_search = 'http://ajax.googleapis.com/....'; matlab_results = parse_json(urlread(google_search)); i guess that's nice thing restful interfaces on soap or whatever don't need excessive machinery deal it. i'm sure if interface isn't returning json similar can parse.

iphone - How to declare instance variables and methods not visible or usable outside of the class instance? -

i've looked through bunch of posts on subject. maybe didn't run across "the one" , point me in direction. question simple , has simple answer. if have 2 ivars, say, "public_ivar" , "private_ivar", where/how should declare them public public , private not exposed in way looking @ header file? same question in case of "public_method" , "private_method". i clean header files (in other languages) expose methods , ivars want else see. should able publish header file , not run danger of accessing not supposed to. how do in objective-c. for example, let's decide need use ivar keep track of data, counter or somthing that, between various class methods need access information. if ivar declared conventionally in header under @interface existence publicly advertised , usable creating instance of class. ideal scenario ivar not visible @ outside of class implementation. you can declare instance variables or dec...

jboss6.x - Upgrading Hibernate library in JBOSS 6 -

iam developing java ee 6 application jboss 6. in jboss 6 hibernate version 3.6.0 . how can replace 3.6.3 ??? you should able find the current hibernate jars under common/lib. make backup of directory first, remove hibernate jars them, , replace them more current version.

Use Standard Camera Button on a Camera Overlay (iPhone) -

i using overlay on camera views in app. problem is, want use standard camera button - long oval button tap take picture. is there way add oval camera button overlay? reduce overlay view size doesn't hide camera button toolbar.

How can I optimize or limit the CPU usage a zip process (DotNetZip) in c#? -

good day guys i have app use archive folder using dotnetzip library. notice when goes actual "zipping" process, uses 100% of cpu. app used in conjunction (a tcp chat application) need use less cpu possible. is there way can safely limit cpu? i've tried lowering priority doesn't make difference. thing have right setting affinity 1 core uses 50%. of course work on multi-core computers. lowering priority want, not forcing process use arbitrary amount of cpu 50%. this means process use unused processing capacity of cpu, , other more important processes still able function if zip process wasn't running @ all. i should think low priority process using 100% of cpu because nothing else is. once other process(es) , running , try again, notice zip process not use 100%.

java - Bundles within a Bundle -

i'm trying implement client-sever model using osgi. server application osgi framework running in computer , client applications connect console remotely , send commands via java socket , receive proper responses. each client application consists of several modules. have 2 approaches: 1- each module bundle installed on framework , client applications receive services them. solution has problem. if wanted each client have special update method (e.g. bundle should updated in of them in others should not updated), how can manage type of updates? 2- each client application bundle of bundles. concern how can manage update action in way when update client application updates inner bundles too? your question decidedly generic , not possible provide detailed answer in reasonable space , time. try cover ideas , suggestions though. updating distinct bundles on distinct clients non-issue. programmatic viewpoint, have many choices (i rather suggest read osgi in action tour ...

HTTP, HTTPS, Shared SSL, and SEO -

i looking around @ of features current web host offers, , wondering few things. if can answer part of this, appreciate can provide. i have domain, mydomian.com, , host offers shared ssl can use https using address https://mydomain.myhost.com . ssl certificate *.myhost.com. i don't know lot ssl, i'm assuming means data between site users , domain on myhost.com encrypted. curious if meant if else on same host me somehow intercepted data site able view it, since have https://theirdomain.myhost.com address, uses same ssl certificate? may have no idea @ all, , pretty guess. if https used on login page, after logging in other pages viewed on http, security issue? is there way show web form via http bots google, have real users redirected https version? ideal if done via .htaccess. have rewrite rules redirect pages https, rest http. if visitor visits contact form https version automatically, automatically switches http pages don't contain forms. so, via htaccess, there...

css - Javascript IDE-style web app AJAX -

i impressed extjs samples/demos border layout examples. feasible using extjs or other frameworks/libraries build viable web app dynamically creates (say 10) new panels; how eclipse builds , docks new split panels?. these container panels contain tabbed widgets , panels need maximizable/minimizable , closed if last tab member closed. (again how eclipse closes it’s non-editor views). i assume css styles have programatically added dom elements make container panels think use style sheets member layout(members document content or have own widgets); i suspect performance poor , there many problems in faithfully rendering members style sheets. i have no interest in writing ide in js interested in knowing limits of approach creating ‘reasonably’ extensible app. i want provide additional context question. currently have desktop app in java swing allows create panels dynamically , has features outlined , works follows. consider simple explorer panel on left , editor panel on...

android - Button Highlight -

i have keypad have created app. problem is, have implement button highlight user slides finger through keys. have tried several ways, none works. default when user clicks on new button, android highlights me, when try move next button form current button, touch event not working. how achieve this. use gesturedetector ontouchevent solve problem. , use canvas highlight specific location .this done based on values return motionevent.

objective c - iOS CGRectOffset and Core Data Issues -

i know doesn't make sense, i'm getting strange error in iphone app building using core data , calling cgrectoffset. app delegate's didfinishlaunchingwithoptions method looks this: - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { // setup managed object context nsmanagedobjectcontext *context = [self managedobjectcontext]; if (!context) { // - exit } //load database form plist nsstring *plistpath = [[nsbundle mainbundle] pathforresource:@"tjournals" oftype:@"plist"]; nsmutablearray *plistjournals = [nsmutablearray arraywithcontentsoffile:plistpath]; //create bunch of journals (nsdictionary *journal in plistjournals) { [tjournal journalwithdictionary:journal inmanagedobjectcontext:context]; } nserror *error = nil; [context save:&error]; // ------ create view controller ------ // scrolling list journallistvc *jvc = [[journallistvc alloc] init]; // adjust status bar...

wpf - Can a value converter execute on different thread? -

if binding.isasync = true, why doesn't valueconverter execute on same "supposingly non-ui" thread? is there any way make execute on thread? the documentation isasync suggests property accessors called asynchronously. no mention of converters made can find. i'm not entirely sure whether because it's technically not possible call converter on bg thread, or perhaps overlooked. seems me should possible. as workaround, can move heavy logic being performed converter property, or perhaps separate property altogether?

jQuery replace with -

i have following html tag: <a class="save action_btn" onclick="return false;">save</a> and code: $(".save").live('click', function() { $.post("update.php", {uid: my_uid, save: "yes", mid: "<?php echo $mid; ?>"}, function(){ $(this).replacewith('<a class="action_btn x saved" onclick="return false;">saved</a>'); } ); }); however, why not changing html tag? it's cause erasing element 'itself'. need small delay, this: $(".save").live('click', function() { var $btn = $(this); $.post("update.php", {uid: my_uid, save: "yes", mid: "<?php echo $mid; ?>"}, function(){ settimeout(function(){ $btn.replacewith(...

design patterns - Is it okay to break LSP for the sake of binding? -

something tells me might lynched asking this. , sorry long winded description in advance. i'm working on of corner case in silverlight 4 project. i'm building custom form builder. a form may have several fields may of different types (text, integer, email etc...). now, of these types extend field class might have additional properties length in case of text field. i have ability add , remove fields collection of fieldviewmodels in formfieldsmanagementviewmodel . it's pretty standard stuff far. now,... in order user set properties against field objects have usercontrol has dependency properties of type datatemplate , represent ui want dipsplay when particular type of field selected. , clarify, usercontrol has singlelinetexttemplate property shown when singlelinetextfieldviewmodel selected when emailfieldviewmodel selected, emailfieldtemplate shown. both singlelinetextfieldviewmodel , emailfieldviewmodel inherit fieldviewmodel . my issue arises wh...

asp.net mvc 3 - Master page to Layout in MVC3 -

i have user master page of mvc2 application in vs 2008 in mvc3 2010. cananyone me on this you cannot have webforms master page ( .master file) razor view ( .cshtml file). if want use webforms master page need use webforms view ( .aspx file). put site.master file in ~/views/shared folder of asp.net mvc 3 application , add webforms view implementing (for example ~/views/home/index.aspx ).

sql server 2005 - deleting rows from multiple tables at a time with a single query in sqlserver2005? -

i wanna delete 2 rows 2 tables foreign key related how can delete 2 rows 2 tables @ time using single delete statement. can body me posting example? look: deleting records multiple tables @ time single query in sqlserver2005

video play in full screen android simulator -

i playing video.3gp in android app.but video not fit on full screen.i using linear layout code is: <videoview android:id="@+id/myvideo" android:layout_gravity="center" android:layout_height="fill_parent" android:fitssystemwindows="true" android:layout_width="fill_parent"> </videoview> what doing wrong? try tutorial: http://www.hrupin.com/2011/09/19/sample-streaming-video-mediaplayer-or-how-to-stream-video-from-url-in-android hope you!

Camera Capture with WIA, C# and Win 7 -

i try take picture webcam wia 2.0, c#, .net 4.0 on windows 7. tried many different samples, nothing works. exception: "comexception unhandled" exception hresult: 0x80210015 ". code wia_s_no_device_available . checked, if wia-service running , if cam shows in scanners , camera. have no idea whats wrong here! can help? exception thrown on line: device d = class1.showselectdevice(wiadevicetype.cameradevicetype, true, false);: here code string deviceid; const string wiaformatbmp = "{b96b3cab-0728-11d3-9d7b-0000f81ef32e}"; const string wiaformatpng = "{b96b3caf-0728-11d3-9d7b-0000f81ef32e}"; const string wiaformatgif = "{b96b3cb0-0728-11d3-9d7b-0000f81ef32e}"; const string wiaformatjpeg = "{b96b3cae-0728-11d3-9d7b-0000f81ef32e}"; const string wiaformattiff = "{b96b3cb1-0728-11d3-9d7b-0000f81ef32e}"; class wia_dps_document_handling_select { public const uint feeder = 0x0000...

Free software for SADT diagrams drawing -

do know open source, or free software drawing sadt diagrams? you can try out ramus they offer educational version, free non-commercial purposes.

c - where have example of context switching -

assume function pointer pointed passed pthread_create , after thread run, change address of function pointer static function b a i not understand how 1 thread switch bwetween 2 functions , b push , pop save context of function when interrupt thread of it any example show context switching it's hard tell you're asking here... i'll give shot. to address first paragraph, think you're asking happen when pass function pointer (which points function a() ) pthread_create() , modify function pointer point different function (function b() ). answer modifying function pointer has no effect on running thread; since passed copy of function pointer pthread_create() , running thread not detect modify function pointer later on. i believe you're after else, though: how thread context switch implemented? let's assume moment you're doing cooperative multitasking, i.e. running thread explicitly needs yield cpu calling yield() function. here's pseudoc...

performance - c++ stringstream is too slow, how to speed up? -

possible duplicate: fastest way read numerical values text file in c++ (double in case) #include <ctime> #include <cstdlib> #include <string> #include <sstream> #include <iostream> #include <limits> using namespace std; static const double nan_d = numeric_limits<double>::quiet_nan(); void die(const char *msg, const char *info) { cerr << "** error: " << msg << " \"" << info << '\"'; exit(1); } double str2dou1(const string &str) { if (str.empty() || str[0]=='?') return nan_d; const char *c_str = str.c_str(); char *err; double x = strtod(c_str, &err); if (*err != 0) die("unrecognized numeric data", c_str); return x; } static istringstream string_to_type_stream; double str2dou2(const string &str) { if (str.empty() || str[0]=='?') return nan_d; string_to_type_stream.clear(); stri...

How to restore default perspective settings in Eclipse IDE -

i playing around perspectives, such customizing perspective ,i've closed many windows, , menu not visible . , restore perspective original state. how do this? there no keyboard shortcut restoring perspective directly afaik. open window menu (where reset perspective resides), try alt-w. if not work, guess eclipse has hung reason. shortcut might want try f10 (should open main menu).

javascript - Are there any frameworks for doing realtime models in node.js? -

i know of https://github.com/andyet/capsule , https://github.com/codeparty/racer are there more?? https://github.com/logicalparadox/backbone.iobind this connects backbone models node server using socket.io

Magento 1.5.1 - How can I add the customer's billing email address to success.phtml -

i've added following code magento 1.5.1 order confirmation page (success.phtml): <?php $_order_id = mage::getsingleton('checkout/session')->getlastorderid(); // here oreder id $_order->load($_order_id); $customer = mage::getsingleton('customer/session')->getcustomer(); $email = $customer->getemail(); // email address of customer. ?> email confirmation sent to: <?php echo $email ?> unfortunately email variable empty/null. does know how efficiently data? obtaining first , last name bonus. keep in mind guest checkout allowed, may not have customer record in cases. in case, need billing email address assosicated order (guest checkout or not.) thanks! if got order object maybe can use: $order->getbillingaddress()->getemail(); i think method better because can use guest customers too.

textview - Overlay text over imageview in framelayout programmatically - Android -

i trying implement textview on image in framelayout @ center , bottom of layout seen here: http://developer.android.com/resources/articles/layout-tricks-merge.html <framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <imageview android:layout_width="fill_parent" android:layout_height="fill_parent" android:scaletype="center" android:src="@drawable/golden_gate" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginbottom="20dip" android:layout_gravity="center_horizontal|bottom" android:padding="12dip" android:background="#aa000000" android:textcolor="#ffffffff" android:text="golden gate" /> </framelayout> ...

hash - Search by hashing mysql columns -

i have query compares values of many columns , returns result. have add column compare, text field , not indexed. thinking instead of doing this, lets add column called hash, hash of these columns , can compare against hash produced code these same columns. 1) want know result in performance enhancement , how beneficial this? 2) mysql provide function hash combination of columns , store results can hash existing columns without having write separate code this. 3) hash go for, md5 or sha? 4) idea @ all? i have few million records , few more millions expected generated within months, hashing these produce unique results each record? thanks, harsha 1) result in performance enhancement although suspect reinventing manually has been implemented in indexing engines of db... recommend use built-in index mechanisms... 2) yes - has md5 , sha / sha1 sql functions hash strings, need convert/cast whatever values want hash string... 3) depends on data - guess sha ch...

Google Maps language parameter not working -

i have following code: <img src="http://maps.google.com/maps/api/staticmap?center=<?php echo $capital['capital']['name']; ?>&zoom=4&size=400x250&sensor=false&style=feature:administrative.locality|element:labels|visibility:off&language=en&markers=size:small|<?php echo $capital['capital']['name']; ?>" alt="<?php echo $capital['capital']['name']; ?>"> and language parameter not working. labels displayed each in local language. tried changing language no luck. why isn't map displayed in language request? thank you! the documentation says (emphasize mine): language (optional) defines language use display of labels on map tiles. note parameter only supported country tiles ; if specific language requested not supported tile set, default language tileset used. so tiles not available in english?

python - How to remove duplicates in strings within list? -

i have list of string in each string duplicate need remove. f.e.: lst = ('word1 2 36 2 2' ' word2 96 5 5 5 14' 'word3 45 6 45 45') etc. i need: lst = ('word1 2 36' 'word2 96 5 14' 'word3 45 6') generally: create dictionary each key wordn in key, convert item 2 through n of list set iterate through dictionary, building new list each key , set's contents

Oracle ODBC - missing drivers? -

i installed odac 11.2 release 3 , oracle developer tools visual studio (11.2.0.2.1) from http://www.oracle.com/technetwork/topics/dotnet/utilsoft-086879.html but still not see oracle driver in odbc manager... please help. i checked odbc drivers in registry, , found sql there... maybe downloaded wrong thing? please point me in right direction. call "c:\windows\syswow64\odbcad32.exe" start/run box or command prompt, drivers more appear. i´ve been through similar problems oracle instant client (basic , odbc) 32-bit driver not appearing @ odbc admin window. able configure data source oracle 11g express calling "c:\windows\syswow64\odbcad32.exe" way. regards.

oop - Chess board and piece design in java -

i'm working on assignment. chess design(ai, gui not required), have piece class. piece class has 2 variables: color , name. far have "move method" in class. ` public void move(piece piece,int x,int y) { int a=0; int b=0; for(int i=0;i<board.grid.length;i++) { for(int r=0;r<board.grid[i].length;r++) { if(board.grid[i][r]==piece) a=i; b=r; if(board.getisnull(x, y)){ board.grid[a][b]=null; board.grid[x][y]=piece; } } } board.grid[u][t]=null; } ` in code, want find index old index of piece want move, moving setting old index null not working. can see name on screen not color. also, old index not set null. how it? started think using object(piece) array how? just small hint: //finds piece equal name , color of our piece.so if(board.grid[i][y].equals(name) || piece.color.equals(color)) this doesn't fit together, since check "equal name or equal color". think want change to: if(board.grid[i]...

javascript - break jquery $('<div>') into separate opening and closing tags -

i have several blocks like: <div class="first">...</div> <div class="second">...</div> <div class="third">..</div> i want wrap 3 blocks div. there way split $('</div>') in 2 parts: <div> , </div> insertbefore() opening <div> , insertafter() closing </div> achieve html can't modify in situation could use ' wrapall() '? $('div').wrapall('<div class="new" />');

user controls - How do you show the flex handCursor in firefox 4? -

hey guys, i'm having problem handcursor component in flex , firefox 4. i've followed code here create handcursor, won't render hand on either demo or flex docs. has found way show handcursor in ff4? if not, what's best way handle creating similar paradigm? edit : here's code used on both demo site above, , in test case i've drawn locally. works in ff4. <?xml version="1.0" encoding="utf-8"?> <mx:application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalalign="middle" backgroundcolor="white"> <mx:applicationcontrolbar dock="true"> <mx:form stylename="plain"> <mx:formitem label="usehandcursor:"> <mx:checkbox id="checkbox1" selected="true" /> </mx:formitem> <mx:formitem label="buttonmode:...

asp.net - Programmatically login in dotnetnuke -

hey guys, using dotnetnuke cms, reason want manually login user site, able login problem is, if enter invalid password, still dotnetnuke log me in. using below code. userinfo objuser = new userinfo(); objuser.username = login1.username; usermembership objmembership = new usermembership(objuser); objmembership.username = login1.username; objmembership.password = login1.password; objuser.membership = objmembership; //usercreatestatus result = usercontroller.createuser(ref objuser); usercontroller.userlogin(0, objuser, request.servervariables["server_name"], this.request.userhostaddress, true); you can use var loginstatus = userloginstatus.login_failure; var login=usercontroller.userlogin(0, username, password, “”, “”, “”, ref loginstatus, false); return request.createresponse(httpstatuscode.ok, “logged in successfully”); for more details can refer following link - https://vivekkumar11432.wordpress.com/2016/03/29/passw...

tree - fetching webpage through java -

i need fetch given web page, , convert html tag xml tag, , these xml tag need build tree. how can ?? please show me link or tutorial based on these, btw using java language. thanks. httpclient data. htmlcleaner turn xml. both have tutorials.

cocoa - Save nsdate to disk -

i've looked @ timeintervalsincereferencedate function of nsdate . can use function store interval disk , return nsdate same value original? i'm wary reference or interval vary between machines , come differently on computer? nsdate can archived nsdata instance , nsdata can written / read disk. // create , store nsdate * date = [nsdate date]; nsdata * datedata = [nskeyedarchiver archiveddatawithrootobject:date]; [datedata writetofile:@"/some/path/to/file.dat" atomically:no]; // bring nsdata * restoreddatedata = [nsdata datawithcontentsoffile:@"/some/path/to/file.dat"]; nsdate * restoreddate = [nskeyedunarchiver unarchiveobjectwithdata:restoreddatedata]; no error checking done. better that. ;-)

php - CSS issue in Firefox -

Image
i've created mini content management system workers of small company. management system works ckeditor. ssmall group of users create new page ckeditor (it's wyswyg) , submit data db. now problem is, there css issue. take @ page http://smiths-heimann.az/?page=171 , here results the result google chrome 14 opera 11 ie 9 and firefox 7 how fix problem on firefox? there hundreds of page problem in mysql db table. there anyway find , fix wrong css code in db table php function? how fix error in ckedior 3.6? add css property background-repeat: no-repeat; in css concerning li

osx - Automator bash unix script, read input files to move if single file or detect if multiple archive and then move archive -

i have droplet made automator, moves files when drop them on application icon folder. now script looks this: for f in "$@" cp "$f" "volumes/testdrive/testfolder/$(basename "$f")" done i wondering if possible command detect if multiple files input script , archive them zip function , move same folder, , if single file dropped regular copy of file specified folder. use conditional, (syntax might way off): if [ $# > 1 ] zip $@ > /path/to/location/foo.zip # line might need researched else cp $@ /path/to/location/`basename $@` fi you wouldn't want loop, because it'd go through rigmarole of creating zip archive each file in selection. if doing moving each one, sure, use loop, you're taking them , zipping them

cuda - Improving kernel performance by increasing occupancy? -

here output of compute visual profiler kernel on gt 440: kernel details: grid size: [100 1 1], block size: [256 1 1] register ratio: 0.84375 ( 27648 / 32768 ) [35 registers per thread] shared memory ratio: 0.336914 ( 16560 / 49152 ) [5520 bytes per block] active blocks per sm: 3 (maximum active blocks per sm: 8) active threads per sm: 768 (maximum active threads per sm: 1536) potential occupancy: 0.5 ( 24 / 48 ) occupancy limiting factor: registers please, pay attention bullets marked bold. kernel execution time 121195 us . i reduced number of registers per thread moving local variables shared memory. compute visual profiler output became: kernel details: grid size: [100 1 1], block size: [256 1 1] register ratio: 1 ( 32768 / 32768 ) [30 registers per thread] shared memory ratio: 0.451823 ( 22208 / 49152 ) [5552 bytes per block] active blocks per sm: 4 (maximum active blocks per sm: 8) active threads per sm: 1024 (maximum active threads per sm: 1536) potential...

What is wrong with this javascript and php code -

i've been trying debug hour: <script type="text/javascript"> function initialize() { alert('test'); var latlngarr = new array(); var titlearr = new array(); <?php echo "latlngarr.length=".$response->total.";"; echo "titlearr.length=".$response->total.";"; ($i=0;$i<$response->total;$i++){ echo "latlngarr[".$i."] = new google.maps.latlng(".$response->businesses[$i]->location->coordinate->latitude.",".$response->businesses[$i]->location->coordinate->longitude.");"; echo "titlearr[".$i."] = \"".$response->businesses[$i]->name."\";"; } ?> var myoptions = { zoom: 10, center: latlngarr[0], maptypeid: google.maps.maptypeid.roadmap }; var map = ne...

objective c - Google + API Iphone sample code -

i need integrate google + , +1 sharing in iphone application. looking sample code can help. please me out of this. thanks, divya there nice library written google objective c. main library project @ this address . you can find complete xcode project show how use library here . edit 1 here can find information in order write own +1 button. remember: +1 button can bu used web content.

php - How do I fade one <div> out with jQuery and fade another <div> in? -

i building portfolio , want create gallery display projects. have selection of 7 divs containing content form tabbed navigation-esque section of website. other tabbed navigations, 1 div containing content active @ 1 time. however, unlike other tabbed navigations, 1 controlled php. if content (currently set file_exists function mysql controlled) available, div written navigation , appropriate link displayed. if not, link hidden , div not written. files required based on $_get call, , files required vary depending on string inside $_get variable. each tab has unique id. (since no javascript expert), have "reset" option sets style of named divs "hidden" style, before bringing chosen div "visible" state. what want do, if possible, this: i want go #div1 #div2. divs 1, 2, 4 , 6 (for example) active. click link tells page display #div2 (the function says hide divs , display #div2, hiding of other divs separate function, called within function)....

.net - Embedded a Lua interactive prompt window in C# -

i tried provide script features in c# app. after searches, lua , luainterface looks reasonable way it. embedding lua vm in c# code, can load lua script , process methods defined in c# class without problems. however, wonder there way not execute lua script file in c# program, have lua interactive prompt in program? can type commands , see returns immediately. any hint should start work on helpful! best regards lua's debug module contains basic interactive console: debug.debug() (the lua manual suggests this module should used debugging ). if doesn't meet needs, it's easy enough implement 1 yourself. if write in lua itself, absolute bare bones console be: while true io.write("> ") loadstring(io.read())() end that'll crash on either syntax or runtime error. less minimal version, captures (and ignores) errors: while true io.write("> ") local line = io.read() if not line break end -- qu...

JavaScript won't work if placed inside the body of a web page? -

i'm new javascript , i've learned javascript can place between <head></head> or <body></body> sections, have been working in project , works fine inside head not body section of page. examples: working fine this: <!doctype html> <html lang="en"> <head> <title>example page</title> <script> function yetanotheralert(texttoalert) { alert(texttoalert); } yetanotheralert("hello world"); and not working way: <!doctype html> <html lang="en"> <head> <title>example page</title> </head> <body> <script> function yetanotheralert(texttoalert) { alert(texttoalert); } yetanotheralert("hello world"); </script> </body> </html> your code snippet didn't show closing tag. double check if close script block correctly. it's better specify type of scripting la...

internet explorer - Why does JavaScript only work after opening developer tools in IE once? -

ie9 bug - javascript works after opening developer tools once. our site offers free pdf downloads users, , has simple "enter password download" function. however, doesn't work @ in internet explorer. you can see in example . the download pass "makeuseof". in other browser, works fine. in ie, both buttons nothing. the curious thing i've found if open , close developer toolbar f12, starts work. we've tried compatibility mode , such, nothing makes difference. how make work in internet explorer? it sounds might have debugging code in javascript. the experience you're describing typical of code contain console.log() or of other console functionality. the console object activated when dev toolbar opened. prior that, calling console object result in being reported undefined . after toolbar has been opened, console exist (even if toolbar subsequently closed), console calls work. there few solutions this: the obvious 1 go t...

javascript - window.URL.revokeObjectURL() doesn't release memory immediately (or not at all)? -

i'm making html interface upload images on server drag & drop , multiple selection files. want display pictures before sending them server. first try use filereader have had problems in this post . change way , decided use blob:url ebidel recommands in post, window.url.createobjecturl() , window.url.revokeobjecturl() release memory. but now, i've got problem, wich similar this one . want client upload 200 images @ time if wants. browser crashed , ram used high! thought maybe images displayed @ same time, , set system waiting queue of files using array, in order treat 10 files @ time. problem still occurs. on google chrome, if check chrome://blob-internals/ files (which released window.url.revokeobjecturl() ) released approximatively after 8 seconds delay. on firefox i'm not sure seems if files not released (i check on about:memory -> images that) is code bad, or problem independent of me? there solution force navigators release immediatelly memory? if ...

java - List of Implementors? -

i have classes implement same java interface, allows fetching sqlite contentvalues associated particular implementor, , these classes grouped lists in various classes throughout application. have been hoping use generic list insert methods handle of these lists, ideally in manner of: public void dosomething(list<? implements interface) { ... } yet generics/interfaces not function way. now, do: public void dosomething(list<? extends superclass) { ... } if made class abstract (and set default methods throw runtimeexceptions force override sub-classes) accomplish same thing, uglier. this not "mission critical" i'm working on, i'm curious if there smoother ways accomplish tasks. public void dosomething(list<? extends interface> list) { ... } with generics use extends interfaces

c++ - How to have a derived class use the base implemention to satisfy an interface -

i have following 2 interfaces, not part of inheritance hierarchy. have 2 concrete classes, 1 derives other. class icar { public: virtual void drive() = 0; }; class ifastcar { public: virtual void drive() = 0; virtual void drivefast() = 0; }; class car : public virtual icar { public: void drive() {}; }; class fastcar : public car, public virtual ifastcar { public: void drivefast() {}; }; int main() { fastcar fc; fc.drive(); fc.drivefast(); return 0; } when compile following error: error: cannot declare variable `fc' of type `fastcar' error: because following virtual functions abstract: error: virtual void ifastcar::drive() my program work if write function in fastcar delegate drive() base class void drive() { car::drive(); } is possible have fastcar compile without writing methods delegate base class? note: icar , ifastcar created 2 different teams , in 2 different projects. teams have agreed on common ...