Posts

Showing posts from August, 2015

java - In Eclipse, my exported executable jar doesn't do anything ! (LWJGL) -

java beginner here. i made small java app in eclipse (on windows), using lwjgl lib , slick. when export executable .jar file, , run resulting .jar, doesn't anything. no errors, no nothing - doesn't seem run. following tutorial : http://www.cs.bsu.edu/homepages/pvg/misc/slick_eclipse_tutorial.php here's manifest.mf file looks : manifest-version: 1.0 main-class: simpletest class-path: lib/lwjgl.jar lib/slick.jar apps don't use lwjgl export fine. doing wrong ? i tried using jarsplice, didn't work, though might misusing it. pointers ? my best bet missed reference main-class in manifest -file. have @ this shows how set manifest -file correctly. have fun! edit: manifest-version: 1.0 main-class: simpletest class-path: lib/lwjgl.jar lib/slick.jar <-- new line without content --> edit 2: ok, able reproduce behavior. tried run exported jar via console i've got following exception: exception in thread "main" java.

php replace first occurrence of string from 0th position -

i want search , replace first word in php follows: $str="nothing inside"; replace 'nothing' 'something' search , replace without using substr output should be: 'something inside' use preg_replace() limit of 1: preg_replace('/nothing/', 'something', $str, 1); replace regular expression /nothing/ whatever string want search for. since regular expressions evaluated left-to-right, match first instance.

c# - Read data in string from begin to end -

<td valign="top" class="m92_h_bigimg"> <a href="#pagetop" onclick="drop1('hotelinfos');" title="hotelinformationen einblenden"><img border=0 src="http://i2.giatamedia.de/s.php?uid=168846&source=xml&size=320&vea=5vf&cid=2492&file=007399_8790757.jpg" name="bigpic"></a> </td> <td valign="top" class="m92_h_bigimg2"> <table border=0 cellpadding=0 cellspacing=0> <tr> <td valign="top" class="m92_h_para">hotel:</td> <td valign="top" class="m92_h_name"> melia tropical <br> <img src="/images/star.gif" height=13 width=13 alt="*"><img src="/images/star.gif" height=13 width=13 alt="*"><img src="/images/star.gif" height=13 wid

c# - How can I programmatically update log4net configuration file? -

i have log4net config in applications' app.config file, such: ... <section name="log4net" type="log4net.config.log4netconfigurationsectionhandler, log4net"/> </configsections> <log4net> <appender name="rollinglogfileappender" type="log4net.appender.rollingfileappender"> <file value="logs\service.log"/> <appendtofile value="true"/> <rollingstyle value="date"/> <datepattern value="yyyymmdd"/> <layout type="log4net.layout.patternlayout"> <conversionpattern value="%date [%thread] %-5level %logger - %message%newline"/> </layout> </appender> <appender name="consoleappender" type="log4net.appender.consoleappender"> <layout type="log4net.layout.patternlayout"> <conversionpattern value="%da

java - Error creating SharedPreferences - couldn't create directory for SharedPreferences file -

i getting following error when trying create shared preferences file service: "couldn't create directory sharedpreferences file /dbdata/databases/dimappers.android.pub/shared_prefs/pubstore2.xml" i using samsung galaxy s i9000 test , have read else problems specific phone. however, swear working @ point in normal activity (though admittedly can't work more...) editor editor = getsharedpreferences(constants.savedataname, mode_private).edit(); editor.putstring(constants.savedataname, xmlstring); editor.commit(); if call string s = getsharedpreferences(constants.savedataname, mode_private).getstring(constants.savedataname, ""); immeditately after calling commit able it, if restart app isn't able find it. it appeared phone (samsung galaxy s i9000), worked (albeit still showing error) running same code on phone didn't show error message.

c# - Expression Encoder SDK - How to add audio track on a video -

i use on this. i'd overlay audio.mp3 file (or other format matter) onto video. i'm using free version of expression encoder 4, , video outputs wmv. thing is, don't know how add audio file video mediaitem. tried this, didn't add audio on result: mediaitem videotrack = new mediaitem(@"path\to\videofile.wmv"); videotrack.outputformat = new windowsmediaoutputformat(); videotrack.outputformat.videoprofile = new advancedvc1videoprofile(); mediaitem audiotrack = new mediaitem(@"path\to\audio.mp3"); videotrack.outputformat.audioprofile = audiotrack.sourceaudioprofile; job.mediaitems.add(videotrack); job.encode(); and when didn't work (perhaps because profile alone metadata, , not audio file itself), tried overlay audio way overlay image onto video, doing this: mediaitem videotrack = new mediaitem(@"path\to\videofile.wmv"); string overlayfilename = @"path\to\audio.mp3"; videotrack.overlayfilename = overlayfilename; job.medi

selected - PHP Preselect check boxes from a String -

i have string $eventdays holds information regarding days selected. the format of data is: monday = mo tuesday = tu wedneday = thursday = th friday = fr saturday = sa sunday = su mo,tu,we,th,fr,sa,su so if example tuesday , friday selected, string be: tu,fr if monday, wednesday, , saturday selected be: mo,we,sa note: combination of days can selected. i wondering how information, , preselect checkboxes. checkboxes are: <input type="checkbox" name="days[]" value="mo" />monday<br /> <input type="checkbox" name="days[]" value="tu" />tuesday<br /> <input type="checkbox" name="days[]" value="we" />wednesday<br /> <input type="checkbox" name="days[]" value="th" />thursday<br /> <input type="checkbox" name="days[]" value="fr" />friday<br /> <input type="c

c# - asp.net page lifecycle issue -

i have user control "header" label display amount of item in basket. this: protected void page_load(object sender, eventargs e) { lblbasketcount.text = session["basketitemscount"]!=null?session["basketitemscount"].tostring():"0"; } then have page has method: public void btnadditemtoshoppingcart_click(object sender, eventargs ) { session["basketitemscount"] = (from b in db.cartitems b.crt_id == cartid select b).sum(p => p.item_quantity); } the problem in page life cycle additem method fired after control had page_load event. label refresh after reload of page. edit: header control declared in master page: <%@ register tagprefix="asp" tagname="footer" src="~/controls/footer.ascx" %> <asp:header id="header" runat="server" /> and located in controls folder. i'm using wap in namespace sitename.controls.header don't use page_load

c# - User control keeps stretching once dropped on form -

Image
this may winforms newb mistake, i've created user control has 1 component on - telerik dropdownlist control. when drop on form looks correct. however, run form control stretches off form. the dropdownlist on user control has anchor property set top/left/right/bottom. before: after: what heck doing wrong here? edit: bit more info: if close designer , open up, changes sizes. code doesn't appear cause problem. in fact, commented out of code (besides initializecomponent() call) , still see problem. control still works - when run form populated data i'm expecting. it's stretched. i can "work around" issue setting width of dropdownlist 35 pixels less size want be, when resizes it's correct width, shouldn't have to. you on right track. looks though anchoring way off page. try removing anchor right starters see effect has. if doesn't work, perhaps try different combinations of anchoring see effect has on control. make sure

java - Can a wicket AjaxSubmitLink behave like a ResourceLink onSubmit()? -

i have wicket form multiple components , button in bottom validate user input , generate file download upon successful validation. i using ajaxsubmitlink display user feedback when onerror() called puzzled on how have onsubmit() behave resourcelink. thanks help! you need approach described @ https://cwiki.apache.org/confluence/display/wicket/ajax+update+and+file+download+in+one+blow because cannot return bytes in ajax response.

toggleclass - Jquery Slidetoggle: Why does it reload my page? -

i'm having strange issue 2 slidetoggles. #bannerchoice slide works fine, #search slide, should, when open, overlap #bannerchoice, never opens more partway. instead, forces page reload. here's code: function bannerchoice() { $('#bannerchoice').slidetoggle(function() { if($('#bannerchoice').is(':visible')) { $('html').css({overflow:"hidden",height:"100%"}); } else { $('html').css({overflow:"auto",height:"2171px"}); } }); } function toggleform() { $('#search').slidetoggle(350); return false; } and <div id="bannerchoice"> <div id="bctext">select banner graphic:<br/></div> <div id="bcimages"> <form action="#" method="post"> <input type="hidden" name="setbanner&quo

forms - get checkbox group values -

this has driven me bananas. it's simple , easy , yet can't figure out what's wrong it. i want checkbox value populated in controller (for testing purposes). here form. <a href='#' name='submitform'>submit form</a> //i have jquery attached tag , submit form when user clicks echo form_open('test/show'); echo form_checkbox('checkbox[]','value1'); echo form_checkbox('checkbox[]','value2'); echo form_checkbox('checkbox[]','value3'); echo form_checkbox('checkbox[]','value4'); echo "<input type='text' name='text1' value='ddd'>"; echo form_close(); //my controller test public function show(){ $data1=$this->input->post('text1'); //i can text1 value input box $data2=$this->input->post('checkbox'); //it keeps giving me undefined index 'checkbox' $data3=$_post['checkbox']; //sam

python - How to make dictionary from list -

my list: list = ['name1', 'option1.1 value1.1', 'option1.2 value1.2', 'name2', 'option2.1 value2.1', 'option2.2 value2.2', 'option2.3 value2.3'] and want create dictionary this: dict = {'name1':{'option1.1':'value1.1', 'option1.2':'value1.2'}, 'name2':{'option2.1': 'value2.1', 'option2.2':'value2.2', 'option2.3':'value2.3'} i don't know how big list (numbers of names, options , values). idea? with list , dict comprehension: id=[b[0] b in enumerate(lst) if 'name' in b[1]]+[none] d={lst[id[i]]:dict(map(str.split,lst[id[i]+1:id[i+1]])) in range(len(id)-1)} your original list here named lst this perhaps not readable answer @sr22222 , perhaps it's faster, , matter of taste.

String performacne: PHP vs MySQL -

this question has answer here: doing calculations in mysql vs php 5 answers are there performance concerns of note when using mysql's concat() function in select query? faster/slower/negligible simple select, , format strings view using php after result set database returned? or more complicated sql query multiple calls concat() returns string formatted view better approach? ie this: select concat(lastname, ', ', firstname) people; faster/slower/no difference this: <?php $query = 'select lastname, firstname people'; ... $name = $data['lastname'] . ', ' . $data['firstname']; //or $name = sprintf("%s, %s", $data['lastname'], $data['firstname']); ?> you're better off in cases doing filtering , data massaging sql engine versus on web server.

c# - Adding description to dynamically generated methods in Reflection.Emit -

i have used reflection.emit dynamically generate types , methods. works fine, want include descriptive information method others can use more easily. normall including above method: /// <summary> /// descriptive information /// </summary> /// <param name="paramname1">paramname1 description</param> /// <param name="paramname2">paramname2 description</param> /// <param name="gltypefieldreference"></param> /// <returns>information return type</returns> is possible include information reflection.emit, , if so, how? no, because not part of il metadata. instead, compiler writes optional .xml file goes alongside dll, , typebuilder etc doesn't handle in way. of course write xml file separately - schema should available somewhere.

memory - iphone: -[CFString release]: message sent to deallocated instance -

an app i'm working on keeps crashing when run on iphone not on simulator (although warning shown when run without symbolic malloc_error_break, app keeps working on sim) i'm not manually releasing string, instead, use: [[[nsstring / nsmutablestring alloc] init] autorelease]; (which time other apps , have never given me problem) now when set malloc_error_break breakpoint get: 2012-03-07 17:04:06.072 columns[15487:f803] *** -[cfstring release]: message sent deallocated instance 0x68c8210 with xcode4 jumping to: int main(int argc, char *argv[]) { nsautoreleasepool * pool = [[nsautoreleasepool alloc] init]; int retval = uiapplicationmain(argc, argv, nil, @"appdelegate"); >>> thread 1 [pool release]; return retval; } i have nszombieenabled when run on simulator btw if can me on how debug on xcode 4 or point me tutorial online appreciated! regards david remove autorelease nsstring methods , add them in until cra

java - Android - Show Dialog from static class -

i have simple class want use show dialog message: public class utils { static void showmessage(context c, string dialogtitle, string messagetodisplay, int layoutresourceid, int imageresourceid ){ //create new dialog. dialog dialog = new dialog(c); //set view existing xml layout. dialog.setcontentview(layoutresourceid); dialog.settitle(dialogtitle); //set textbox text , icon dialog. textview text = (textview) dialog.findviewbyid(r.id.text); text.settext(messagetodisplay); imageview image = (imageview)dialog.findviewbyid(r.id.image); image.setimageresource(imageresourceid); //show dialog window. dialog.show(); } } and trying call activity, within onclicklistener event of button, so: private onclicklistener btnsubmitissueclick = new onclicklistener(){ public void onclick(view v){ //check valid summary & description. if(msummaryedittext.gettext().t

c# - Putting data in dataset into datatable? -

here snippet of code: string filepath = @"c:\drmf.xls"; filestream stream = file.open(filepath, filemode.open, fileaccess.read); iexceldatareader excelreader = excelreaderfactory.createbinaryreader(stream); excelreader.isfirstrowascolumnnames = true; dataset results = new dataset(); datatable testsheet = new datatable(); testsheet = results.tables.add("test"); results = excelreader.asdataset(); i had assumed once added datatable "test" dataset, data loaded dataset automatically load datatable "test". doesn't appear case. loading, instead, datatable called "sheet1" assume getting excel spreadsheet. so, question is, once have data in dataset, how can "test" datatable? try this: dataset results = new dataset(); results = excelreader.asdataset(); results.tables["sheet1"].tablename = "test"; this way, have data loaded , can change table name whatever want ,

javascript - Store & Restore Highlighted Selection -

i writing chrome extention need store , restore user's highlighted selection. stored information stored on server. wondering how this? i looked using range, unsure if right way since example below worked in firefox. i found example works in firefox :( i think technique on page work in chrome: there's no reason why shouldn't. when save selection , reload, see selection restore , disappear, suspect in page (possibly ads) destroying selection somehow. if can't work, try serializer module of rangy library, although it's overkill chrome. in general, using browser's selection , range apis way go. standardized , universally supported (with quirks , bugs, naturally) in current browsers.

Animations in flash to IOS -

i developing application presents different stories kids. these stories made ​​in flash. problem how add storys app. initially 1 of approaches create app in coco2d , make animations in language (converting animations in pictures). due possess many animations , sounds, process complicated thus, asked opinions on approach should solve problem. opinion help. thanks... if want change way solve problem, can try adore air let use flash on ios apps : an example on how this if want continue cocos2d, can find tutorials there project : good tutorials make project cocos2d if stories doesn't have interactive elements, can try convert stories in flash video files softwares (try enter in google).

.net - Why use ETW over EventLog and vice versa? -

why should use event tracing windows (etw) on standard .net eventlog class , , vice versa? knowing we'll using quite few performance counters impact decision? what know far: etw should perform better . etw more work integrate (e.g. .net event tracing windows ) by selecting 1 of standard channels in etw (e.g. application, system), same information available in event log. etw has many advantages. first, in .net 4.5, far simpler use. eventsource class in 4.5 dramatically simplifies creating events within code. however, without this, etw has huge advantages, though typically work differently, and, such, serve different purpose eventlog. eventlog designed logging. etw, on other hand, allows trace application's progress in context of system whole . when start collecting etw events, collect them on system basis, lets not trace application, see what's happening in relation system it's running. using tool perfview , can see how specific portions of

java - Multithreading not working as expected -

i trying test couple of things regards iterators being shared across multiple threads. wrote simple (and quite stupid) program supposed iterate through same map intwo different threads. here's code: final map<integer, integer> m = new hashmap<integer, integer>(); final random r = new random(); for(int = 0; i< 1000 ; i++){ m.put(r.nextint(10000), r.nextint(10000)); } thread t1 = new thread(new runnable(){ @override public void run() { // todo auto-generated method stub iterator<integer> = m.keyset().iterator(); it.next(); for(integer : m.keyset()){ system.out.println("t1 " + i); try { thread.sleep(r.nextint(100)); } catch (interruptedexception e) { // todo auto-generated catch block e.printstacktrace(); } } }

Downloading an excel file using Spreadsheet gem in rails app -

i using spreadsheet gem in rails app , want able download excel file generated spreadsheet. have following action in controller: def download_xls send_data spreadsheet_report("test", prospects::inquiry_column_order), :filename => "test.xls", :type => "application/vnd.ms-excel" end the spreadsheet_report method defined in same controller: def spreadsheet_report(excel_filename, inquiry_column_order) book = spreadsheet::workbook.new sheet1 = book.create_worksheet :name => array1[0] sheet2 = book.create_worksheet :name => array2[1] rownum = 0 column in inquiry_column_order sheet1.row(rownum).push column end book.write "#{excel_filename}.xls" end the "test.xls" file downloads fine, seems losing necessary formatting, 1 worksheet being created , having values on first row stretch on , on, such "@biff_version=1536". opening libreoffice calc don't know if causes issues able

commit - What is the convention for committing ugly code to a git repository? -

my current usage of git described "commit , often". attempt make each commit single logical unit (as discussed in good commit criteria ). however, i'm iterating design , wish save each stage. if come ugly functional, want commit checkpoint before cleaning things up. what experience in matter - has caused issues team? going beyond ugly code - acceptable locally commit broken code long don't push until bugs fixed? the common convention use feature branch (or set of branches) live in repository - , perhaps somewhere online github or gitorious. you can rebase , rewrite feature branch reasonable impunity until have ready submit upstream in whatever project-specific way want. allows build, , share, work-in-progress code without headache. along way, building series of commits, using interactive rebase (or other rewriting tools) turn set of clean, logical commits great way move checkpoints in time checkpoints in functionality - , works best if commit extre

multithreading - Performance hitches of some sort in a return or parameter (Java) -

i running complicated multithread java game, working exception of function. function, when called, approximately 0.01% of time, cause thread hitch of quarter of second. through series of debug lines , time measurements, it's absolutely down function (and 3 others it). the usage of function provide light level of nearby block within voxel engine game. run when section of world updated, can happen alongside rendering. please note: this function works accurately 100% of time intended function. this function causes thread hitch of approximately quarter second 0.01% of time. the variables not synchronized. the function never called more once @ time in program. all variables valid fields of larger, non-synchronized class. all variables integers. the array light[][][] byte[][][] . this method never called more once @ time, synchronized larger method on wide interval. i'm pretty sure external synchronization not issue. what part(s) of function may causing issue

Single sign on from SharePoint to another asp.net web application -

i have scenario want single sign on experience between sharepoint , asp.net website. both on same domain , both using windows authentication. both website have anonymous authentication turned off , windows authentication turned on. can please following scenario? user go sharepoint 2010 website login sharepoint entering windows username , password landing login page sharepoint 2010 contains iframed webpart go asp.net website on same domain (different port number) user should able access asp.net website without login my problem during step 4 user have enter windows credential again login asp.net website. how can resolve issue? thanks, sj windows authentication not automatically passed between applications. since choose iframe other site need separately login it. i find bit odd users dont automatically logged in, maybe dont have domain login on computers. however can automated bit impersonation, check thread http://forums.asp.net/t/304484.aspx

jython - get garmin gps coordinates into javascript variable -

i remove marker , create new marker in openlayers (javascript). can this, trick want place new marker @ current lat/lon position reported garmin etrex gps receiver. can new position receiver using gpsbabel , can in python using subprocess. way can think data javascript variable using string substitution in python cgi script. problem way fresh data gps receiver refresh page, causes map go away short time, current zoom level lost, , isn't clean way of doing this. i'm looking ideas of how can coordinates gps javascript variable. would jython work, getting coordinates python script javascript? i'm not familiar it, reading did today seemed suggest require operating on port 8080, not ideal since use python cgi script. maybe still possible. i've looked api's, garmin's offerings seemed tied website , quite overkill if want current coordinates. i looked @ gpsd, had trouble basic communication , further unable find anyway communicate daemon through tcp po

Cannot Pass values from plain HTML to ASP.NET page -

i'm using html file below (tv.html): <form action="myaspx.aspx?appid=5018" method="post" id="formsubscription" name="formsubscription"> <input type="checkbox" id="chckisconfirm" name="chckisconfirm"/> confirm <input type="submit" value="ok" /> </form> and trying "myaspx.aspx". , code behind is: protected void page_load(object sender, eventargs e) { if (!ispostback) { var r = httpcontext.current.request["chckisconfirm"]; //or namevaluecollection nvc = request.form; //or var = request.form.allkeys; } } but cannot pass value of "chckisconfirm". keys comes empty.. doing wrong? update: when check checkbox comes "on" other times null. thanks in advance that's default behavior checkboxe

C# : Modify a xml node -

i have xml file : <?xml version="1.0" encoding="utf-8"?> <reminders> <reminder> <title>alarm1</title> <description>desc1</description> <time>03/07/2012 10:11am</time> <snooze>1</snooze> <repeat>none</repeat> </reminder> </reminders> and want modify innertext alarm1 value wrote code duplicate entire node . xmldocument xml = new xmldocument(); xml.load("0.xml"); xmlnodelist elements = xml.selectnodes("//reminders"); foreach (xmlnode element in elements) { if (element.innertext == "alarm1") { xmlnode newvalue = xml.createelement("modified"); element.replacechild(newvalue, element); xml.save("0.xml"); } } and tried code : foreach (xmlelement element in

ios - Generate a pdf from opengles context in iphone/ipad -

hi noob @ pdf generation , displaying 3d bar charts in application in glview in side uiview. want generate pdf document uiview contains text view , glview. able generate pdf text gl view unable proceed.even tried possibility on net unable info regarding this.can me providing solution whether can possible or not.thanks in advance you can ask uiview give image (which might start) via like: - (uiimage *) imagerepresentation { // render myself (or more correctly, layer) image uigraphicsbeginimagecontext(self.bounds.size); cgcontextref context = uigraphicsgetcurrentcontext(); cgcontextsetshouldsmoothfonts(context, false); cgcontextsetshouldantialias(context, false); [self drawlayer:self.layer incontext:context]; [self.layer renderincontext:context]; uiimage *image = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); return image; } after that, might able pdf representation of it, or investigate calls cgpdfd

Where should I specify what Facebook permissions to request in iOS app with the new enhanced auth dialog? -

before new enhanced auth dialog, way ask permissions in ios app: nsarray *permissions = [[nsarray alloc] initwithobjects: @"user_likes", @"read_stream", nil]; [facebook authorize:permissions]; [permissions release]; what should if switch enhanced dialog? should choose permissions ask in facebook "edit app" page , pass "nil" instead of array? [facebook authorize:nil]; i tried specifying permissions in "edit app" page app's authentication dialog seems ignore them. still seems mention ones specified in code, inside "permissions" array. is there way have app use permissions specified in "app edit" page instead of having write them in code? do same way before; settings you're thinking of in developer app authenticated referrals (which causes links on facebook canvas app pop auth dialog when clicked instead of going app , having redirect auth dialog yourself)

Is there an Aztec barcode generator library for JavaScript? -

Image
i'm looking open source image generation script aztec (2d) barcodes: i can't seem find available scripts out there. there active-x control here can used in ie , image generator url here , these not useful should pure javascript solution running under webkit-based browsers can run in disconnected mode mobile apps. anyone have old code hanging around either written in javascript or can ported javascript? thanks. bwip-js runs in browser supports <canvas> – ie 9+, ff 2+, chrome, safari 3+, opera 9+, , android 2.1+. runs server-side in node. (if wanted downlevel ie support, try using <canvas> emulation layer .) aztec among 83 barcode formats can draw. here's demo of in action .

wicket framework -

i'm working on software , decided choose apache wicket framework, we're team , each 1 of uses different operating system. i wanted know if wicket compatible operating systems? erm,... wicket java library. if can use java on os can use wicket.

php - preg matching and replacing elements -

hi how do preg match on $string1 = "[%refund%]processed_by" $string2 = "[%refund%]date_sent" i want grab bits inside %% , remove [%item%] altogether. leaving "proccessed_by" or "date_sent" have had go below come bit stuck. $unprocessedstring = "[%refund%]date_sent" $match = preg_match('/^\[.+\]/', $unprocessedstring); $string = preg_replace('/^\[.+\]/', $unprocessedstring); echo $match; // should output refund echo $string; // should output date_sent your problem use of preg_match function. returns number of matches found. if pass variable third parameter, stores matches entire pattern , subpatterns in array. so can capture both of parts want in subpatterns preg_match , means don't need preg_replace : $unprocessedstring = "[%refund%]date_sent" preg_match('/^\[%(.+)%\](.+)/', $unprocessedstring, $matches); echo $matches[1]; // outputs 'refund' echo $matches[

ruby on rails - Hide user id in the url bar -

in rails application have load of users each have registered user id. if go in users index , click on users show page following example header. localhost:3000/users/3 now don't allows people skip through users in header. how go doing following shows user.username field instead e.g. localhost:3000/users/adamwest you can define to_param method on user model. class user ... def to_param name end ... end then every generated urls have name instead of id user identifier. sid = user.new :name => 'sid' user_path(sid) #=> "/users/sid" of course, in controller, have find user name. class userscontroller ... def show @user = user.find_by_name(params[:id]) end ... end i suggest take @ friendly_id gem. friendlyid “swiss army bulldozer” of slugging , permalink plugins activerecord. allows create pretty url’s , work human-friendly strings if numeric ids activerecord models.

python - Check if two unordered lists are equal -

this question has answer here: how efficiently compare 2 unordered lists (not sets) in python? 9 answers i'm looking easy (and quick) way determine if 2 unordered lists contain same elements: for example: ['one', 'two', 'three'] == ['one', 'two', 'three'] : true ['one', 'two', 'three'] == ['one', 'three', 'two'] : true ['one', 'two', 'three'] == ['one', 'two', 'three', 'three'] : false ['one', 'two', 'three'] == ['one', 'two', 'three', 'four'] : false ['one', 'two', 'three'] == ['one', 'two', 'four'] : false ['one', 'two', 'three'] == ['one'] : false i'm hoping wi

delphi - How to convert bitmaps to video? -

Image
my application creates images fractals , love feeling of 'flying' around fractal. once saved 2000 bitmaps file , created avi using premiere. experience rather frustrating though succeeded in creating movie. spectacular. of course want create video application. don't care niftyness of codec, compression or whatever. want have video can replay on systems. in past have tried never succeeded. triggered question alas not ffmpeg running. update i decided adapt question , put bounty it. have seen several solutions attractive (because it's simple) seems me taviwrite. tried taviwriter did not succeed. in procedure taviwriter.write; function call around line 370 avierr := avisavev(s, // pchar(filename), nil, // file handler nil, // callback nstreams, // number of streams streams, compoptions); // compress options

Command for loading jQuery on Google Chrome inspector? -

i remember seeing there specific command put on google chrome's inspector console load jquery , allow execute jquery commands. however, cannot remember command was, , searching online brings me unrelated results. anyone knows command? thanks! edit: years later had realized asking $$ function in console. however, not jquery provides similar selector option, shorthand document.queryselectorall . answers here address adding jquery real, of functionality. you mean, script load jquery in arbitrary page? have constructed following cross-browser bookmarklet purpose: javascript:if(!window.jquery||confirm('overwrite\x20current\x20version?\x20v'+jquery.fn.jquery))(function(d,s){s=d.createelement('script');s.src='https://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.js';(d.head||d.documentelement).appendchild(s)})(document); it detects whether jquery exists. if does, confirmation dialog appears, in current version shown, can decide whether

ios - How Do I Dismiss My Login View For Good? -

so far have gotten login view appear @ at start of app using method in viewdidappear in first view controller, once username , password gets approved web service, 1st view controller appears split second , goes login view. am forgetting something??? did coding in login view, , 1st view. coding 1st : - (void)viewdidappear:(bool)animated { [super viewdidappear:animated]; uistoryboard *storyboard = [uistoryboard storyboardwithname:@"mainstoryboard" bundle:nil]; uiviewcontroller *vc = [storyboard instantiateviewcontrollerwithidentifier:@"loginviewcontroller"]; [vc setmodalpresentationstyle:uimodalpresentationfullscreen]; [self presentmodalviewcontroller:vc animated:yes]; [self dismissmodalviewcontrolleranimated:yes]; } heres coding in loginview - (void)parser:(nsxmlparser *)parser didendelement:(nsstring *)elementname namespaceuri:(nsstring *)namespaceuri qualifiedname:(nsstring *)qname { nsmutablestring *yes =[[nsm

jquery - Changing Width/Gutters? -

i'm trying create thumbnail gallery rows of 3 items , i'm not able control width (192px) or gutters (10px) of items. heres code <script> $(function(){ var $container = $('.isosort'), filters = {}; $container.isotope({ layoutmode : 'fitrows', animationengine : 'best-available', masonry: { columnwidth: 192, gutterwidth: 10 } }); // filter buttons $('#options li ul li a').click(function(){ var $this = $(this); // don't proceed if selected if ( $this.hasclass('selected') ) { return; } var $optionset = $this.parents('.option-set'); // change selected class $optionset.find('.selected').removeclass('selected'); $this.addclass('selected'); // store filter value in object // i.e. filters.color = 'red' var group = $optionset.attr('data-fi

facebook - Is it possible to get the number of users messaged by the send dialog -

i'm wondering if possible retrieve number of people/friends messaged user when use 'send dialog' send specific friends messages (just number ok). i've been looking through documentation send dialog doesn't seem have information regarding this.(https://developers.facebook.com/docs/reference/dialogs/send/). an alternative can think of @ stage use graph api, i'd need know messageid of message user sent. yes can count first :you should know when user sent message check link below here sample test : http://www.fbrell.com/saved/d002a25a351e6b01b0526b2606b48750 <script> fb.ui({ method: 'send', name: 'people argue win', link: 'http://www.nytimes.com/2011/06/15/arts/people-argue-just-to-win-scholars-assert.html', }, function(response) { if (response) { alert('message sent.'); } else { alert('not sent');

angularjs - Uncaught TypeError: Cannot call method 'put' of undefined -

i facing issue when trying store data in angular controller page using $cookiestore . there additional configurations have left out ? function fblogin($cookiestore){ $cookiestore.put("userid",'12345'); validateuser(userid); alert(userid); } you're not defining userid anywhere javascript. you're setting cookie value userid=12345 , calling validateuser unknown variable, userid has undefined value.