Posts

Showing posts from May, 2011

sql - Duplicate column name... but only if database is case insensitive -

i'm trying query view on database has case sensitive collation linked server connection. else note view i'm trying query wrapper 3 indexed views. the error i'm getting is: duplicate column names not allowed in result sets obtained through openquery , openrowset. column name "extprice" duplicate. in view have extprice extprice . when query view server directly, don't have issues... when try use query via linked server, above error. is collation issue? how use view via linked server , still have query understand view case sensitive? i apologize in advance if stupid question. yes, result of case-sensitive collation on server views located. and it's why grouse having case-sensitive collations @ server level directly (instead of using collations @ column-level) pointed out here: http://www.sqlmag.com/blog/practical-sql-server-45/tsql/collation-sql-server-139576 only, in trying wrap brain around how you'd cram collate c...

Revit families and filtering elements -

i need filter selected elements family. we have timber beam family , need modify selected elements part of timber family. i've looked online can't find shows me how it. i'm new revit. //get instaces if family objects filteredelementcollector familyinstancecollector = new filteredelementcollector(doc); familyinstancecollector.ofclass(typeof(familyinstance)) .wherepasses(new familysymbolfilter(new elementid(140519))); messagebox.show(familyinstancecollector.count<element>().tostring()); foreach (element element in familyinstancecollector) messagebox.show(element.name); i'm not sure if creating new elementid work, , i"m not sure if can predict elementid across projects anyhow? best way filter search family symbol looking first, use result find instances. check out .chm file comes in sdk, here's sample it: // creates familyinstance filter elements family instances of given family symbol in document // find family symbols ...

java - How to extract text from forms marked with enctype:multipart/form-data(JSF 2.0) -

i have jsf page has h:form has textfields , imageupload gadget primefaces my question is: how can text fields , assign them variable.(the objective separate uploaded image/s text) -what should do? -do need filter, that? -is there easy way achieve primefaces fileupload tool? this not trivial primefaces 2.2.1. pf 2 file upload handling bit epic fail. under covers it's not trivial upload files ajax. xmlhttprequest object doesn't support multipart/form-data requests. lot of "ajaxified" (to have feeling of asynchronous progress) file upload solutions based on hidden iframe or -as in case of pf- using flash. pf 2 1 based on flash , not combinable regular text inputs in order submit data in 1 go. in pf 3 file upload component has been greatly revised . using "simple" file upload mode problem should solved. however, pf 3 still in beta/alpha stage. need lot of unit tests on webapp see if doesn't break on pf 3. if pf 3 not option, best ...

iphone - NSOperationQueue out of range exception -

i have strange error pop recently. nsoperationqueue says has 1 object in cannot access nsoperation object inside it. if ([[queue operations] count] > 0) op = [queue.operations objectatindex:0]; but reason ends in following exception: index 0 beyond bounds empty array' i understand error message surprised since checking queue count before asking object itself. any ideas please? remember operations able run on separate threads , are. nsoperationqueue has own method getting count called operationcount , provides word of caution: the value returned method reflects instantaneous number of objects in queue , changes operations completed. result, time use returned value, actual number of operations may different. should therefore use value approximate guidance , should not rely on object enumerations or other precise calculations. what running concurrency issue. 1 thing consider copy operations array. nsarray *ops = [queue.o...

Making a php query that filters words in a MySQL column -

i'm new both php , mysql, forgive me if simple or common question, looked on , couldn't find answer. basically, i'm building quick search real estate page can type in address , search results bring (and similar results if type in broad "90th street") right query looks this. ($quicksearch value typed in.) $query = "select * mlssales (id = '$quicksearch') or (concat_ws(' ',streetnum, streetname) '%$quicksearch%'); now search works me, problem of listings in streetname column contain words "west" or "east" or that. if searches "west 90th street", "300 west 90th street", "300 west 90th", ect. search works. if type "300 90th street" won't results. how can make search more lenient without making lenient bring in bad results. what you'd need fulltext search, or manipulate search text make more wildcarded. your query boils down to ... '%300 90...

c++ - How can boost::bind call private methods? -

boost::bind extremely handy in number of situations. 1 of them dispatch/post method call io_service make call later, when can. in such situations, boost::bind behaves 1 might candidly expect: #include <boost/asio.hpp> #include <boost/bind.hpp> boost::asio::io_service ioservice; class { public: a() { // ioservice call b, private, how? ioservice.post(boost::bind(&a::b, this)); } private: void b() {} }; void main() { a::a(); boost::asio::io_service::work work(ioservice); ioservice.run(); } however, far know boost creates functor (a class operator()()) able call given method on given object. should class have access private b? guess not. what missing here ? you can call member function via pointer-to-member-function, regardless of accessibility. if function private, members , friends can create pointer it, can use pointer once created.

python - How to configue apache and mode_wsgi for local django development on windows -

the team work has outgrown django development server running django applications within our local development environments. environment (server 2008 vm) mix of .net applications backed off of iis7 coupled several django applications. we have need being able have our local development environments run applications concurrently ease of development , testing. have decided move towards full instance of apache running alongside iis more closely resemble our production , testing environments (the difference of course being linux / windows host of apache). we have configured mod_wsgi , apache run locally seems not quite have either python or django path configured correctly @ runtime our applications complaining views not exist error's like: could not import reporting.views. error was: dll load failed: specified module not found. the django exception location showing: exception location: c:\python27\lib\site-packages\django\core\urlresolvers.py in _get_callback, line...

objective c - App works on iphone simulator,iphone device, ipad simulator but not ipad device -

so made app, , runs on possible platforms except ipad device. understand if ran on ipad device , not iphone device since processor better on ipad, has me stumped. worked fine on ipad simulator. can think of reason why be? there few details give explanation. possibility is: when run app in 2 different devices, iphone , ipad, nib files different. app delegate different if use xcode templates universal apps. means possible code executed different in 2 devices. so imagine in ipad app delegate / view controller you're allocating - @ launch - lot of memory (scroll view many large images example). app not crash in simulator (it uses mac memory). app not crash in iphone (different code). @ end crash in ipad only. other possibilities: you're going short in memory soon. ipad 1 has less memory iphone 4g. other possibility: watchdog timer kills app @ launch. happens on ipad 1 because you're loading few large images , takes lot of time, enough killed watchdog. ot...

linux - how to protect my process from being killed? -

we have mission-critical server program on top of linux , dont't want others terminate accidentally. if terminates or crashes, want restart. so plan write program, program b. want program b , server program protect each other. if our server program exits, program b restart it. if program b terminates, server program start again. don't have mechanism let program b , server program notified when peer exits. you can use init babysit process, , since init terminates on reboot, don't need "program b". add end of /etc/inittab: x:3:respawn:/path/to/my/program for information on syntax , other options can found in man inittab

iphone - Chipmunk Physics: cpSpaceShapeQuery -

how cpspaceshapequery function work? can not find doc it. andrea yeah... never got around documenting that... sorry. create body , shape (neither needs added space) , use query other query functions. this code snippet makes copy of body , shape on stack , simulates out it's first predicted collision point drawing path goes. cpbody body = *(originalbody); cppolyshape shape = *((cppolyshape *)originalshape); shape.shape.body = &body; cpfloat dt = 1.0f/60.0f; cpvect gravity = space->gravity; int count = 0; for(int i=0; i<300; i++){ cpbodyupdateposition(&body, dt); cpbodyupdatevelocity(&body, gravity, 1.0f, dt); if(cpspaceshapequery(space, (cpshape *)&shape, null, null)){ quads[count%maxquads] = quad(body.p, body.rot, cgrectmake(0, 2*32, 64, 64), tsize); count++; break; } if(i%10==0){ quads[count%maxquads] = quad(body.p, body.rot, rect, tsize); count++; } }

vb.net - combobox error:'Cannot bind to the new value member. Parameter name: value' -

i have 3 combobox bind diffrent table. , got such error in title. bellow codes: mycommand = new sqlcommand("select (firstname +' '+ lastname) fullname tblvisitor", myconnection) myadapter = new sqldataadapter(mycommand) myadapter.fill(mydataset, "tblvisitor") cbovisitor.datasource = mydataset.tables(0) cbovisitor.displaymember = "fullname" cbovisitor.valuemember = "visitorid" 'my combobox mycommand = new sqlcommand("select bookcode tblbook", myconnection) myadapter = new sqldataadapter(mycommand) myadapter.fill(mydataset, "tblbook") cbobookcode.datasource = mydataset.tables(1) cbobookcode.displaymember = "bookcode" cbobookcode.valuemember = "bookcode" 'where bookcode pk-column of tblbook 'my combobox mycommand = new sqlcommand("select (firstname +' '+ lastname) stafffullname tblstaff", myconnection) myadapter = new s...

javascript - How to kill zombie cookies -

i'm not sure if question related this one or not. ie9 deletes cookie after closing browser (expected) chrome 12, firefox 5, , opera 11 not. (during testing of example below, each browser closed after clicking "delete account." reopened after short period of time , in ie9 cookies still there.) use case: cookie expires 1 year after last visit user. account deletion should remove cookie. question: (1/2) why ie9 right (expected) thing , others not? (2/2) how can ensure browsers destroy cookie? example: login.html <!doctype html> <html> <head> <title>create cookie example</title> <script> function setcookie() { var expdate = new date(); expdate.setdate(expdate.getdate() + 365); document.cookie = "fakecookie=" + escape("fake value") + "; expires=" + expdate.togmtstring(); } ...

iphone - mergeChangesFromContextDidSaveNotification deleting records -

i trying update records in coredata on background thread. creating nsmanagedobjectcontext's each thread per documentation. registering notifications when data saved. however, mergechangesfromcontextdidsavenotification deleting entries instead of updating them. //notification callback - (void)_managedobjectcontextdidsave:(nsnotification *)notification { dispatch_async(dispatch_get_main_queue(), ^{ [self.managedobjectcontext mergechangesfromcontextdidsavenotification:notification]; }); } //per thread managed object context - (nsmanagedobjectcontext *)managedobjectcontext { if ([[[nsthread currentthread] threaddictionary] objectforkey:gvcontrollermanagedobjectcontextkey] == nil) { nspersistentstorecoordinator *coordinator = self._persistentstorecoordinator; if (coordinator != nil) { nsmanagedobjectcontext *managedobjectcontext = [[nsmanagedobjectcontext alloc] init]; [managedobjectcontext setpersistentstorecoordinato...

optional/null-able OUT parameter in C# -

i have method has several overrides. in 1 of more expanded overrides, want return out parameter not in simpler overrides. example: public bool ispossible(string param1, int param2) public bool ispossible(string param1, int param2, out bool param3) the way achieving this, so: public bool ispossible(string param1, int param2) { bool temp; return ispossible(param1, param2, out temp); } is there better way achieve this? can (or should i) use null-able out parameter? that looks fine me. out cannot optional technical reasons (it needs point valid instance).

Why is my web-app rendered differently in IIS vs in cassini -

i have created stock web app in vs2010. in cassini web-app rendered normally, in iis no styles shown. using iis 7 in win7 probably security issue folder css stored in. easiest way debug (imo) using fiddler or firebug , seeing happening request css files.

How do I create a join in Fluent Nhibernate on two non-key properties whose names do not match? -

i have 2 tables in legacy database purchases id int(pk) name varchar(50) masteraccount char(10) buyeraccount char(10) masteraccounts id int(pk) name varchar(50) masteraccountnumber char(10) accountnumber char(10) i have object maps 1:1 purchases table. want add "name" column masteraccounts table purchases object property. how tell fluent nhibernate perform join when 2 columns want join on: are not defined foreign keys in database do not have same name in each table it might helpful see sql want generate. select purchases.*, ma.name purchases left join masteraccounts ma on ma.masteraccountnumber = purchases.masteraccount , ma.accountnumber = purchases.buyeraccount assuming masteraccount field in purchases matches masteraccountnumber in masteraccounts ...create view in sql table format trying map: create view [dbo].[v_purchasemasteraccountname] select dbo.purchases.id, dbo.purchases.name, dbo.purchases.masteraccount, dbo.pu...

.net - SSRS regenerate the report -

i'm accessing reports ssrs server using url access. generate report links dynamically in web app , working fine. except reports not refreshed automatically. think server serves subsequent request cache. reports refreshed when different report generated(diferent db values report). this how i'm accessing them. http://seivmedevrs01.ctc.seic.com/reportserver?%2fims%2fdublin%2fkii%2fdev%2fkeyinvestorinformation&rc:toolbar=false&id=13 i wonder if there parameter tells server allways add parameter url: rs:clearsession=true giving url of: http://seivmedevrs01.ctc.seic.com/reportserver?%2fims%2fdublin%2fkii%2fdev%2fkeyinvestorinformation&rc:toolbar=false&id=13&rs:clearsession=true source

java - Generate HTML Pages with JasperReports on Tomcat -

i have class, reporter.java, uses jasperreports generate html report. have simple test.java calls reporter.report() , html file generated @ specified file location (i have set c:/ path points tomcat project). now, run tomcat server html page calls generatestatus.jsp calls reporter.report() , exception thrown. jun 30, 2011 3:02:08 pm org.apache.catalina.core.standardwrappervalve invoke severe: servlet.service() servlet [jsp] in context path [/oats] threw exception [javax.servlet.servletexception: java.lang.noclassdeffounderror: net/sf/jasperreports/engine/jaspercompilemanager] root cause java.lang.classnotfoundexception: net.sf.jasperreports.engine.jaspercompilemanager @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1676) @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1521) @ com.home.oats.reporter.report(reporter.java:22) @ org.apache.jsp.generatestatus_jsp._jspservice(generatestatus_jsp.java:58) @ org.apa...

visual studio - Project References in Custom VS Project Template -

i working on creating custom visual studio template multiple project types. able add reference across projects in solution. e.g. mvvm solution view, model , viewmodels each in own projects. i'd have view have reference viewmodel project , viewmodel project have reference model project. only documentation can find on msdn calls named assemblies referenced. http://msdn.microsoft.com/en-us/library/ms185290.aspx i able partially there, modifying .cproj file using of system parameters, heavily dependent on naming conventions etc. instance can have model project referenced in viewmodel project because concatenation of $safeprojectname$ , "model" makes correct assembly name. cant reference of vm in v, nor can add references testing projects. <itemgroup> <projectreference include="..\$safeprojectname$model\$safeprojectname$model.csproj"> <project>{30c01e8b-96ae-45b4-a7b5-8f7bdca4bdab}</project> <na...

android - ResourceNotFoundException using Spinner -

i create customized popup dialog contains spinner. dialog needs launched adapter class, below code: dialog dialog = new dialog(mcontext); dialog.setcontentview(r.layout.mypopup); spinner spinner = (spinner)dialog.findviewbyid(r.id.spinner); arrayadapter<string> arrayadapter = new arrayadapter<string>(mcontext, 0); arrayadapter.add("addsomestrings"); spinner.setadapter(arrayadapter); dialog.show(); this code executed fine, sometime after "show()", see exception: resources$notfoundexception. last item in callstack resources.loadxmlresourceparser. if don't assign spinner using findviewbyid, instead assign via spinner = new spinner(dialog.getcontext()), don't error (but of course cannot see dialog). mypopup layout contains: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/layout_root" android:orientation="horizontal" android:lay...

ado.net - How to I get a DbCommand from an Entity Framework IQueryable -

when using linq sql, can use datacontext.getcommand method dbcommand instance iqueryable. i'm using entity framework (code-first, shouldn't matter) , want dbcommand iqueryable generated against dbcontext. is possible? if how? i'm not aware of method retrieve dbcommand linq-to-entities query can try convert query objectquery<t> , call commandtext property.

PHP custom exception message -

i'm trying display custom error message if method doesnt' exist method() or getmethod() : public function __call($name, $args = array()){ $getter = "get{$name}"; try { echo call_user_func_array(array(&$this, $getter), $args); } catch (exception $e) { trigger_error($e->getfile.' on line '.$e->getline.': method '.$name.' not defined.', e_user_error) } } but doesn't work. "connection closed remote server" message in browser :| you use method_exists function: if(!method_exists($this, $name)) { // trigger_error(...); } if wanted data such invalid method called from, can use debug_backtrace : class x { public function __call($name, $a) { $backtrace = debug_backtrace(); $backtrace = $backtrace[1]; // $backtrace['file'] // $backtrace['line'] // $backtrace['function'] // $backtrace['class'] ...

asp.net mvc - Why or Why NOT to use Sharepoint 2010 as a CMS -

can please list pros , cons of using sharepoint cms? site has bunch of systems integration , real time data access. believe developing site in asp.net mvc3 able have tighter systems integration, loose coupling, , greater control on presentation layer. any pros , cons great. thanks.

c - Use an array of pointers to structs, or just an array of structs? -

i'm working on fft algorithm in c microcontroller, , having trouble deciding on whether have real , imaginary parts of input data stored in array of structs, or use pointers array of structs. i'm facing conflicting requirements that code has run in tiny amount of memory, , yet fast possible. believe array of pointers structs have larger memory overhead, there's line in code following: for (uint8_t = 0; < record_size; i++) { uint8_t decimatevalue = fft_decimate(i); fftdata[i]->realpart = ffttempdata[decimatevalue]->realpart; fftdata[i]->impart = ffttempdata[decimatevalue]->impart; } i'm thinking if use array of pointers structs in above example compiled code faster reshuffling pointers, rather copying data between 2 data structures array-of-structures implementation would. i'm willing sacrifice memory if above section of code runs fast possible. advice. every time access data through array of pointers, have 2 memory acc...

javascript - Google spreadsheet with hyperlinks via JSON -

i'm using json-in-script put content google spreadsheet on web page. spreadsheet has hyperlinks on of text in cells. json doesn't seem getting other plain text of spreadsheet, , no markup hyperlinks. how hyperlinks? can json? this src of i'm importing: http://spreadsheets.google.com/feeds/cells/0aipg92xowkcndhhtbnzxqkllweuzujbec3nkqxppdnc/1/public/values?alt=json-in-script&callback=cellentries&min-row=2&min-col=1&max-col=7 this link spreadsheet (see how items in col1 linked?) https://spreadsheets.google.com/spreadsheet/pub?hl=en_us&hl=en_us&key=0aipg92xowkcndhhtbnzxqkllweuzujbec3nkqxppdnc&output=html can advise me how hyperlinks? thanks! you'll want post-processing, checking if value matches url. if does, create own tag it. use 1 of these: http://www.google.com/search?q=url+regex also, know can embed google spreadsheets directly in webpage? i'm guessing you're not doing because use iframe, , want actu...

seo - Are HTML meta tags enough? -

i have webpage download page free application ( http://dragonfli.es ). because of minimalist design, there's no text in page. wondering if html meta tags sort of seo or have put text in there? in page have number of elements empty: <div class="window"> <div class="image_reel" style = "border: 1px #707070 solid; "> <a href="#"><img src="reel_1.png" alt="" /></a> <a href="#"><img src="reel_2.png" alt="" /></a> <a href="#"><img src="reel_3.png" alt="" /></a> <a href="#"><img src="reel_4.png" alt="" /></a> </div> </div> <div class="paging"> <a href="#" rel="1">1</a> <a href="#" rel="2">2</a> ...

php - Checksums in REST API responses -

is idea send checksum content of response? , if so, common way calculate checksum? example: http/1.1 200 ok date: thu, 30 jun 2011 21:32:20 gmt server: apache connection: close content-type: application/json 22 {test:1} the underlying protocol http tcp has checksum mechanism, think useless. if still need kind of thing calculate sha1 signature of body content , include custom header in response, like http/1.1 200 ok date: thu, 30 jun 2011 21:32:20 gmt server: apache connection: close content-type: application/json x-checksum: 40325305549f7a09edb51ff8df9528ffd8434ac6

php - noob: display err_msg on page -

i have form populates database, , i'm having trouble error handling. want errors show in small pop window on same pg. <form id="form1" name="form1" method="post" action="mailform.php" onsubmit="mm_validateform('name','','r','business name','','r','email address','','r','how selling product','','r','where did hear us','','r');return document.mm_returnvalue"> <div style="color:#ff0000; text-align:center;"><?php if(!empty($_get['err_msg'])){echo $_get['err_msg'];} ?></div> <fieldset> <legend>contact form</legend> <p class="first"> <label for="name">first name</label> <input type="text" name="first name" id="first...

Python - concatenate a string to itself, multiple times -

i want join strings my_string = "i good." such should printing same my_string 3 times, in my_string*3 space in between each full sentence. how do it? str.join(' ',my_string*3) ? i know basic question, want know this. thank in advance, sammed you're pretty close. try this: >>> my_string = "i good." >>> " ".join([my_string]*3) 'i good. good. good.' you need [my_string]*3 instead of my_string*3 because want list containing string 3 times (that can joined) instead of having single big string containing message 3 times. also, " ".join(a) shorthand str.join(" ", a) .

asp.net - Will the ActiveDirectoryMembershipProvider traverse a one-way domain trust (in SharePoint)? -

we implementing sharepoint in environment multiple separate domain forests used authenticate users using claims based authentication. various domains have one-way trust single domain act "root" authentication requests. have tested trust , work, , our claims authentication configuration appears working well, when logging in sharepoint using forms authentication can authenticate users exist explicitly in root domain . trusted domain users not authenticate, nor enumerate when using getallusers() method of active directory membership provider. we've boiled configuration down as possible this: connection string: <add name="adconnstring" connectionstring="ldap://therootdomain.org" /> membership provider: <add name="adprovider" enablesearchmethods="true" type="system.web.security.activedirectorymembershipprovider, system.web, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3...

iphone - Memory Management with UIPopoverController -

i wanted double check doing correct memory management. correct? have correct amount of releases. in .h file: uitableview *_sortordertableview; @property (nonatomic, retain) uitableview *sortordertableview; in .m file: in dealloc [_sortordertableview release]; my code presents popover this: - (ibaction)sortbuttonorderpressed:(id)sender { uiviewcontroller *sortordercontroller = [[uiviewcontroller alloc] init]; self.sortordertableview = [[uitableview alloc] initwithframe:cgrectmake(0, 0, 200, 100)]; self.sortordertableview.backgroundcolor = [uicolor colorwithpatternimage:[uiimage imagenamed:@"app_background.png"]]; self.sortordertableview.bounces = no; self.sortordertableview.scrollenabled = no; sortordercontroller.view = self.sortordertableview; sortordercontroller.contentsizeforviewinpopover = cgsizemake(200, 100); self.sortordertableview.delegate = self; self.sortordertableview.datasource = self; self.sortpopover = [[uipopove...

javascript - How "click" function controls two image state -

i have music player in site, here code: <!-- player --> <div id="player"> <div class="playericon"><img src="../img/musicicon.gif" alt="" width="21" height="19" border="0"></div> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="30" height="30" id="player1"> <param name=movie value="audioplay.swf?playerid=1"> <param name=quality value=high> <param name=wmode value="transparent"> <param name="allowscriptaccess" value="always" /> <embed wmode="transparent" src="audioplay.swf?playerid=1" quality=high width="30" height="30" name="player1...

Calculate offset/skew/rotation of similar images in C++ -

i have multiple images taken simultaneously pointing @ same direction same starting location. however, there still slight offset because these cameras not in exact same place when picture taking. i'm looking way calculate optimal translation/shear/skew/rotation needed apply match 1 image overlay (almost) perfectly. the images in .raw format reading in 16 bits @ time. i have been suggested (by employer not programmer [i'm intern btw]) take portion of source image (not @ edges) , brute-force search same-sized portion high correlation in data values. i'm hoping there less-wasteful algorithm. here short code want (i use opencv 2.2): suppose have 2 images: srcimage,dstimage, , want align them the code simple. use basis algorithm. code: // detect special points on each image can corresponded ptr<featuredetector> detector = new surffeaturedetector(2000); // detector features vector<keypoint> srcfeatures; // detected key points on fir...

ruby - Rails 3 cookies won't stay permanent -

i've upgraded rails 3.0.7 (from rails 2) , i've found cookies no longer working. before able set expiration date , well. i'm aware of new cookies.permanent way of doing things doesn't seem work either (and understanding old way should work anyways). here's code, it's straight forward: cookies[:remember_me_id] = { :value => user.id.to_s, :expires => 365.days.from_now } cookies[:remember_me_code] = { :value => digest::sha256.hexdigest(user.cookie_code), :expires => 365.days.from_now } just 100% clear, i've tried well: cookies.permanent[:remember_me_id] = user.id.to_s cookies.permanent[:remember_me_code] = digest:sha256.hexdigest(user.cookie_code) the cookies created problem set expire when browser closes. i've checked in firefox , ie. in firefox when go view cookie says expiration when browser closes. not want @ all. is there simple i'm missing here? new rails 3 setting must put in place make cookies persist? i'...

php - jQuery to database - registration form with validation -

Image
i find tutorial in 9lessons.com : http://www.9lessons.info/2011/01/gravity-registration-form-with-jquery.html it's registration form validation. i want send data db. // submit button action $('#submit').click(function() { var email=$("#email").val(); var username=$("#username").val(); var password=$("#password").val(); if(ck_email.test(email) && ck_username.test(username) && ck_password.test(password) ) { $("#form").show().html("<h1>thank you!</h1>"); ///// if ok ///// show //// else //// error, try again } return false; }); how can ?? searched in internet in jquery tutorial , find codes ... this tutorial walk entire process: http://net.tutsplus.com/tutorials/javascript-ajax/submit-a-form-without-page-refresh-using-jquery/ it imp...

django - Ordering a Model -

i have following model -- class videocredit(models.model): video = models.foreignkey(videoinfo) profile = models.foreignkey('userprofile', blank=true, null=true) normalized_name = models.charfield(max_length=100) i want order credits whether have profile, , noramlized_name, example -- # following entries id video profile normalized_name 1 terminator terry gilliam terry gilliam 2 terminator james cameron james cameron 3 dracula null bela lugosi # order as: [james cameron, terry gilliam, bela lugosi] i tried doing ordering=['-profile_full_name', 'normalized_name'] , order profile first, in reverse alphabetical order. if did profile_full_name instead, return without profile (a null field), @ beginning. how this? thank you. update: got down this, working nicely: recent_activity=[] object in recentactivity.objects.select_related.all()[:50]: if object.ev...

code signing - Is there a way to sign an MSI file so that Norton Internet Security recognizes it? -

norton internet security doesn't recognize msi file being signed. signed , certificate issued comodo. ie9's smartscreen filter recognizes being signed norton file insight says "unavailable." think bug on norton's part until fix it, rather not have msi flagged possible threat. i can't seem past symantec's tech support's auto emails resolve , whitelisting file no because post update it's square one. ideas? so, seems bug norton file insight. it's unable check msi files digital certificates. can read in symantec forum here: http://community.norton.com/t5/norton-internet-security-norton/bug-with-file-insight-not-detecting-digital-signature/m-p/491390/highlight/false#m164254 . 1 of staff members admitted issue fixed in 2012. but, come on, detecting digital certificate not difficult , it's such basic part of checking malware. malware digitally signed , in rare case it's signed, never digitally signed certificate trusted autho...

bash - extract fields to variable -

i want extract fields line variables: aaa bbb ccc 'aaa' => $a, 'bbb' => $b, 'ccc' => $c. how in bash? i don't want pipeline processing, need extract them variables or array. you can do: read b c <<<"aaa bbb ccc" output $ echo "a=[$a] b=[$b] c=[$c]" a=[aaa] b=[bbb] c=[ccc] as per bash manual: here strings variant of here documents, format is: <<<word word expanded , supplied command on standard input.

embed my special font in an html web page -

i found many answers on how embed font in web page asking recent , efficient 1 use methods old , not display correctly please advise have commercial font want embed inside web page , displayed in new major browsers (we can ignore ie 6) thanks alot http://www.fontsquirrel.com/ , set. http://www.fontsquirrel.com/fontface/generator just download kit or generate own, open sample page included in kit , see how it's done.

Can I copy/paste my .NET websites to Windows Azure? -

i'm hosting websites on windows 2008 servers through old-school hosting company. i'd switch windows azure in hope it'll better service. is easy copying .net websites , databases across or not work , might have re-coded? have websites, database , rest services (rest talking mobile apps). would amazon cloud easier switch? quite few people have asked similar questions in past - check out questions/answers like: how of challenge port asp.net application azure? running .net app on azure windows azure - transfering .net web application azure search - https://stackoverflow.com/search?q=%5bazure%5d+port+site for typical asp.net sql server application, won't have change - there possible problems/challenges in things session management , local file storage. if rely on lot of local machine customisation - e.g. if absolutely need access persistent disk drive, 1 alternative consider use x-drive - see, example, how umbraco , dnn have been ported - ht...

Different version of the same iPhone app for 10 different users -

is below requirement possible? how make 10 different version of same iphone app 10 different users? yes, it's possible. make bundle ids unique, , upload app 10 different times. the real question is: why want to?

opengl - does glMapBuffer copy data? -

i new opengl. question is: glmapbuffer behind scenes? allocate new host memory, copies gl object data , and returns pointer? is gauranteed receive same pointer subsequent calls method? ofcourse releasing in between. like often, answer "it depends". in situations glmapbuffer indeed allocate memory through malloc , copy data there use , glunmapbuffer releases it. however common way implement glmapbuffer , through memory mapping. if don't know is, take @ documentation of syscalls mmap (*nix systems linux, macos x) or createfilemap . happens there kind of interesting: modern operating systems manage running processes' address space in virtual memory. everytime "memory" accessed os' memory management uses accessed address index translation table, redirect operation system ram, swap space, etc. (of course details quite involved, memory management 1 of more difficult things in kernel understand). driver can install own access handler. proces...

compatibility - difference between Nokia's MeeGo 1.2 "Harmattan" and intel Meego? -

Image
nokia has announced nokia n9 meego 1.2 "harmattan. forums saying differed intel meego. true? maemo? is maemo same meego harmattan? can download sdk develop applications simulator? intel meego sdk (intel note book, tablets) enough? guide please? nokia has announced nokia n9 meego 1.2 "harmattan. forums saying differed intel meego. true? they have different package managers. nokia's meego deb -based, intel's meego rpm -based. nokia's meego 1.2 harmattan api = intel's meego 1.2 core api + nokia specific apis so, main part of api including qt 4.7.2 , qt mobility 1.2 compatible. see binary compatibility report between meego 1.2 core , meego 1.2 harmattan on x86 generated abi-compliance-checker tool. from nokia glossary : meego 1.2 harmattan api the official name harmattan api. recommended set of apis in harmattan platform used application development. meego 1.2 harmattan api consists of meego api , nokia specifi...

gwt - How stable is stableId? -

the javadoc entityproxy.stableid() says: "an id returned proxy newly created requestcontext.create object.equals(object) returned later proxies persisted object." does mean stable id valid object across different request contexts? across different request factory instances? suppose i'm asking scope of stable id? the entityproxyid object has global scope , suitable long-term use map key or member of set . entityproxyid objects can used across different instances , types of requestfactory (assuming proxy type reachable requestfactory in question). requestfactory.gethistorytoken() , getproxyid methods can create string representation of entityproxyid suitable client-side persistence. the 1 exception global scope of entityproxyid id of newly-created entityproxy has not yet been persisted on server. "ephemeral" id usable requestfactory newly-created proxy object derived. once proxy has been sent server , server has provided non-null...

php - Playing MP3 songs without disclosing the path of the file -

i developing shopping cart in php sell songs in mp3 format. product display provide visitors/users listen song 1 time only. if use players jw player play song. player disclose file path in source code of web page , can download file directly. what looking play song visitors not know path of song file. how can avoid ? please advice. thanks you asking drm system. such thing not exist. rationale: alice wants send message (mp3 file) bob alice not want eve message (mp3 file) bob , eve same person this drm trying solve. can try hide fact end user. luck that... (in above example can replace "alice" "server", "bob" "site visitor" , "eve" "an user wants download file without paying it".) if accept can't have drm system, there're more possibilities: send fragment of file user until have payed it destroy/watermark sample file (e.g. @ 15 seconds playback, mp3 file contains recording "this ...

vim - Move to the beginning of line while in Insert mode -

i know can use either: home in insert mode esc + i exit insert mode , enter again, going beginning of line. but neither satisfies me. in first case have tilt head hit home , because can't blindly hit it. in second case left arm has leave home row hit esc , annoying too. any thoughts? ctrl + o whilst in insert mode puts in command mode 1 key press only. therefore ctrl + o shift + i should accomplish you're looking for.

ruby on rails - Overiding request.forgery_whitelisted? -

when method called in 1 of rails controllers check if ip address of user on trusted list, , if override request.forgery_whitelisted? method true csrf protection isn't enforced. a blog post have read seems suggest declaring following in controller action achieve still throws csrf protection error. if request.remote_ip = "127.0.0.1" def request.forgery_whitelisted?; true; end end is there somewhere else needs happen in order override method enough take effect? either of following should work: override/monkey-patch 'verify_authenticity_token' method in applicationcontroller: def verify_authenticity_token super unless request.remote_ip = '127.0.0.1' # todo: replace actual white-listing logic end monkey-patch 'forgery_whitelisted?' method: module actiondispatch class request def forgery_whitelisted? super if remote_ip == '127.0.0.1' # todo: replace actual white-listing logic end end end ...

.net - Redirecting keydown by hook in C#? -

i want write application hotkey helpers games, example, in warcraft 3, use numpad keys reason. possible send "numpad 1 key pressed" message os pressing "x" key? i've been trying using hooks couldn't figure out. hope clear. i've used class hooks: global system hooks in .net . simply code this: globalkeyboardhook hook = new globalkeyboardhook(); // global hook private void btnhook_click(object sender, eventargs e) { hook.hook(); // set hook hook.hookedkeys.add(keys.x); // hook x key // removed other hooks purify code, 6 hooks total. hook.keydown += new keyeventhandler(hook_keydown); // add eventhandler program.hookactive = true; // inform program hook active. guncelle(); // update form components (buttons enabling/disabling according hook status etc.) } private void hook_keydown(object sender, keyeventargs e) { keyeventargs k = new keyeventargs(keys.noname); switch (e.keycode) { case keys.x: ...

erlang - Escript: setting code path relative to script directory -

when try set relative code path in escript -pz this #!/usr/bin/env escript %% -*- erlang -*- %%! -pz ../dir-of-some-beams the path interpreted relative directory run escript from, renders useless setting path relative script location. my current "workaround" using absolute path annoying since part of repository , don't want location dependent. so how can set code path relative directory escript located in? just found out myself: at beginning of main add code this: true = code:add_pathz(filename:dirname(escript:script_name()) ++ "/../dir-of-some-beams"), i recommend testing true whith these code functions, because easy type code:add_pathsz wants list of strings , returns ok , if pass string -- doesn't set code path single directory (which pretty annoying behaviour btw).

android - highlight previous selected item when user come back from another activity -

activity1 has listview . clicking 1 item (let's item 3) start activity2 . activity2 have button once clicked bring user activity1 . want achieve highlight item 3 when user activity1 user have sense continue. (may need set focus item 3 well.) edit: following code works. public void onresume() { super.onresume(); //lastselectedposition saved in onitemclicklistener lv.setselection(lastselectedposition); lv.requestfocusfromtouch(); } well pretty simple. save clicked item position of list field when list clicked launch new activity. afterwards in onresume() method use mylist.setselection(savedposition); as highlighting, focus works kinda bad if have bit more complex rows(buttons,checkboxes etc) , other ui elements beside list can take away focus. believe best way achieve set background of particullar item onresume highlighted 1 , override onscroll listener change background default when list scrolled. indeed workaround work in 100% of cases ...

Android newbie: switch between landscape mode and portrait mode -

i followed android developrs tutorial create simple tab layout. fine tutorial, got tab layout working. in default portrait mode, tabs located on top of screen, when change landscape mode, tabs on top makes screen looks odd, so, locate tabs on left side of screen vertically when emulator change landscape mode. i not sure correct way it? mean correct way define different tabs layout portrait mode , landscape mode. can give suggestions? create 2 layout files 1 portrait , 1 landscape. place these layout-port , layout-land respectively. you'll have handle screen orientation if u want save state of screen

Uploading file of 1 gb using jquery or javascript -

in application developed in asp.net, client wants upload files of 1 gb. please tell me trick how can achieve through it. this application watching video online administrator upload movies videos file. how can upload files large 1 gb www.uploadify.com uploadify jquery plugin integrates fully-customizable multiple file upload utility on website. uses mixture of javascript, actionscript, , server-side language dynamically create instance on dom element on page.

A query about using DOJO showMessage -

when showmessage shown . have written small program please tell me why showmessage not shown , if shown shown ?? <html> <head> <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dijit/themes/claro/claro.css"/> <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js" djconfig="parseonload: true"> </script> <script> dojo.require("dijit.form.datetextbox"); </script> <script> function callme() { if(dijit.byid("fromdate_out").isvalid()) showmessage("selected date fine."); else showmessage("not valid"); } </script> </head> <body class="claro"> <div dojotype="dijit.form.datetextbox" require="true" id="fromdate_out" placeholder="from date" onchange="dijit.byid('fromdate').co...

eclipse - How can I change the background color of the Mylyn task view? -

is there way change background color of mylyn task view? i've changed 'default' editor colors dark background under preferences->general->text editors. works views (some require custom changes), mylyn tasks stays black on white. have @ bug 257001 discusses feature.

php - htaccess redirects unexpectedly to folder -

i have strange me problem. i'm developing zend framework application , have file structure: / /application/ /public/ /public/.htaccess /public/index.php /public/js/ /public/style/ /public/profile/ /.htaccess my domain point folder / when enter address example.com/profile/ goes controller profile , good. when enter address example.com/profile server redirects me to: example.com/public/profile/ i have solution whenever request: example.com/profile/ or example.com/profile the same page rendered second version gives me redirect , don't know why. the /.htaccess file is: rewriteengine on rewriterule ^(.*)$ public/$1 [l] the role of file route traffic / /public without redirects. the /public/.htaccess file is: rewriteengine on rewritecond %{request_filename} -s [or] rewritecond %{request_filename} -l rewriterule ^.*$ - [nc,l] rewriterule ^.*$ index.php [nc,l] can me this? thanks. i fixed this. here solution if have same problem: fix have set followin...

java - Is connection pooling with JDBC still improving performance nowadays? -

my application not using form of connection pooling, i'm working directly connections. application short, simple queries. log can see opens , closes connections, performing single select of 1 or few rows in between. these take typically ~100ms (including opening , closing connection). there countless articles , blog entries on how connection pooling improves application performance, seem rather old (5 or more years). does connection pooling still provide reasonable performance benefit or had become obsolete. i'm using sqlserver 2008 microsofts jdbc driver version 3.0, if matters. results/update: many things happened since have asked question (we switches jdbc driver , lots of other stuff). @ time did lots of refactorings , other stuff , @ apportunity added connection pooling application. connections pooling queries execute faster log timestamp granularity can measure (less 16ms believe). so in conclusion, yes connection pooling still worth effort if need connect/...

jsf - remove application name from URL -

my site uses jsf , url appears be, http://mysitename.com/wompower6/faces/home.xhtml i using prettyfaces, if use following in pretty-config.xml, can change name http://mysitename.com/ wompower6 /home <url-mapping id="home"> <pattern value="/home" /> <view-id value="/faces/home.xhtml" /> </url-mapping> my questions how can remove application name wompower6 , url becomes mysitename.com/home ? in web.xml, have <welcome-file>home.xhtml</welcome-file> , not seem work. when type, mysitename.com, not mapped home.xhtml. clue here? how can remove application name wompower6 , url becomes mysitename.com/home? this webapp <context> setting , configuration dependent on servletcontainer used. if you're example using tomcat, there 2 options make webapp root webapp. rename war file root.war , tomcat default deploy on context root. set path attribute of <context...