Posts

Showing posts from August, 2010

javascript - safari doesn't (dynamically) refresh $.html() content -

i have following piece of code $('#charactersremaining').html(123-countchars(this.value)); works in browsers except safari. in safari, if click content in div area ( of id=charactersremaining), refreshes, doesn't refresh automatically/dynamically any way force safari refresh? $().html('new content'); update: have used following 'hack' (for safari). still interested know if have missed technical detail $('#x').html('new'); $('#x').hide(); $('#x').fadein(); // or use .show(); finally, found issue. had image nearby (may floating/layering on text). safari didn't redraw underlying text (or quirk). anyway moved image around , works in safari too

How can I combine the LOCATE() and SUBSTR() functions in MySQL to create a new column? -

i have database table following layout, containing 100.000 entries: id | url 1 | http://www.foo.com/zedfe.htm 2 | www.foo.com/tezqz.htm?q=eee 3 | foo.com/zeefg.htm 4 | http://www.foo.com/lkeio etc. i want have third column 5-character code of every url, see not every url formatted in same way. in php, this: $id = substr($url, strpos($url,'foo.com/') + 8, 5); can done in mysql, using locate() , substr() functions? another think more common point of view string operations legitimate part of sql , using them purpose describe quite appropriate. here's basic list - you'll find familiar - use concat because there's no equivalent operator. http://dev.mysql.com/doc/refman/5.5/en/string-functions.html i found many examples when googled "mysql sql parse url". 1 interesting sample: substring_index(substring_index(substring_index(trim(leading "https://" trim(leading "http://" trim(url))), "/", 1), "...

matlab: cut out certain rows from data into new matrix -

i have few raw_data file similar below... each.dat file has different number of rows ...however, in each raw_data file, first 2 rows , last 2 rows moved angle_data.dat file...so after programming through matlab code, each raw_data file create 2 new files: 1 angle_data file , final_data file...(final_data file remaining data raw_data file)... raw_data1.dat a b 0.0 1.2222 3.1111 c u 0.0 2.333 12.999 g t 3.4 2.3 5.666 r p 2.5 44.3 6.777 r q 8.222 5.999 0.344 after programming through matlab code, result below: angle_data1.dat a b 0.0 1.2222 3.1111 c u 0.0 2.333 12.999 r p 2.5 44.3 6.777 r q 8.222 5.999 0.344 final_data1.dat g t 3.4 2.3 5.666 something following should work: angledata=rawdata(1:2;end-1:end); finaldata=rawdata(3:end-2); i might have swapped rows , columns there, that's idea. don't have copy of matlab on machine test it. edit: in case: angledata=rawdata(:,1:2;:,end-1:end); finaldata=rawdata(:,3:end-2); though.. if h...

iphone - UITableView inside UIScrollView – Table Cell is not selectable -

like said in title, have problem uitableview in app subview of uiscrollview . in uiscrollview have several images, labels, etc. , @ bottom uitableview set. can fill table view values etc., when try select cell touch, nothing happens. see uitableview, must scroll down little bit in uiscrollview. maybe issue? how solve problem? thanks! when have kind of thing use put content on top of uitableview in uiview , set view tableheaderview of tableview. example: uiview * vwheader = [[uiview alloc] initwithframe:cgrectmake(0, 0, 320, 100)]; // set content of header // ... _tblview.tableheaderview = vwheader; this way, header part of table scrolling , won't need scrollview. can same tablefooterview .

Exact `svn export` equivalent command for git? -

there no exact svn export equivalent command git? really? beware: not duplicate question. is, know , have tested these commands: git clone --depth 1 <- still downloads .git folder. git checkout-init <- doesn't work remote repo, works working copy (so need clone first). git archive <- perfect solution, because has --remote argument, has 2 possible formats: tar or zip, need untar/unzip after downloading, , need pipe (|), i'm on windows!! (not *n?x) git clone --bare <- still don't know heck is, it's not need. please enlighten me there real svn export replacement in git? at hostings github can make exact svn export . example: svn export https://github.com/gnome/banshee/branches/master even partial! (some subpart of repository) example: svn export https://github.com/liferay/liferay-portal/branches/6.1.x/tools for own repository should create github repository , add remote: git remote add github https://github.com/<...

extjs4 - Extjs 4 Loading a view from controller 2 -

continuing question here: extjs 4 mvc loading view controller how load created view viewport? here did: this.getviewportcontent().insert(ext.widget('templatecategorycreate')); where getviewportcontent() returns wanted add view to, not work. error was: uncaught typeerror: cannot call method 'substring' of undefined and answer simple as: this.getviewportcontent().add(ext.widget('templatecategorycreate')); can't believe had debug whole extjs trace this...

iphone - how to return multiple values from a method -

i have -(cllocationcoordinate2d) method, want return multiple locations method (those locations using in method) method looks this, -(cllocationcoordinate2d) addresslocation{ - -------- ---------- return location; } is possible return multiple locations (i mean return location1 , return location2 . . ..) ?? please me thanks add location objects array , return array instead. e.g. -(nsarray*) addresslocation{ ... // set locations nsarray *array = [nsarray arraywithobjects:location1, location2, nil]; ... // additional processing , return array. }

c++ - Can't create modal dialog from MFC DLL -

i'm trying launch modal dialog dll loaded mfc application. i'm using vs2010 , both exe , dll use mfc in static library. i call domodal() in dll launch dialog, parent being cwnd* pointing main window mfc app. dialog resource in dll. this leads mfc library function cwnd::createdlgindirect , has debug check: #ifdef _debug if ( afxgetapp()->iskindof( runtime_class( colecontrolmodule ) ) ) { trace(traceappmsg, 0, "warning: creating dialog within colecontrolmodule application not supported scenario.\n"); } #endif afxgetapp() returns null code in debug check fails. if compile in release, dialog appears, doesn't seem work (all fields empty though set defaults, button's don't appear). i've tried adding afx_manage_state(afxgetstaticmodulestate()); top of function launches dialog, , doesn't make difference. what missing? edit: here's code use call dialog. hmodule oldresmod = afxgetresourcehandle(); afx_man...

c# - WPF TreeView Scrolled to Bottom automatically? -

wpf default treeview scrolled bottom of node automatically need show top view of tree view. how that? also not scroll viewer walking down visual tree. this code rough. key getting treeviewitem.bringintoview() item top, first scroll treeview bottom rather top. this, need access scrollviewer inside treeview's control template first. lots of messing around imo, should have been provided in framework outset. your item control in case, should treeviewitem trying top. uxtree control treeview. item.isselected = true; scrollviewer scroller = (scrollviewer)this.findvisualchildelement(this.uxtree, typeof(scrollviewer)); scroller.scrolltobottom(); item.bringintoview(); private frameworkelement findvisualchildelement(dependencyobject element, type childtype) { int count = visualtreehelper.getchildrencount(element); (int = 0; < count; i++) { var dependencyobject = visualtreehelper.getchild(element, i); var fe = (frameworkelement)dependencyobj...

c# - Backslashes not working properly in my web service -

i have simple line of code in web service: instance = @"\instancenamehere"; yet output same. \\instancenamehere if remove @ , use 2 slashes, same result. i've never seen before , google-fu has failed me. wrote simple app , result correct. why acting in web service? it's escaping slash in debugger know it's slash , not escape sequence \t . if debugger did not this, how distinguish string \t from string <tab> in debugger since latter represented in escape sequence \t ? therefor former shown as \\t and latter as \t write stream or console , you'll see has 1 slash, or instance.length , compare count of characters. you'll see 17 on console, whereas \\instancenamehere has eighteen characters.

java - io handling in tomcat -

i noticed major difference in processing time between 2 servlets in same tomcat , 2 separate tomcats on same host. servlets communicate using http. tomcat or java have mechanism optimizes http communication when in same tomcat or jvm. i'm trying confirm observation not related host i'm running on. it difference between blocking , non-blocking i/o. tomcat uses multi-thread model: have pool of threads processing requests , queue incoming requests. server assigns thread incoming request processing, performs task, sends response, , returns thread pool. queue handles requests up. non-blocking io, employed netty, different. perhaps 2 requests being queued when processed same tomcat.

flex4 - AIR application - unable to open encrypted database using coldfusion.air.SyncManager -

i have air application (written in flex 4.1.0.16076) copies data unencrypted database encrypted database , tries open encrypted database using coldfusion.air.syncmanager's opensession method (coldfusion-air integration library version 9.0.1). once encrypted database created, application distributed encrypted database. use com.adobe.air.crypto.encryptionkeygenerator generate encryption key. use same password, first encrypt database , try open it. database generated when try open it, following error: sqlerror: 'error #3125: unable open database file.', details:'an encryption key cannot specified when database not encrypted.', operation:'open', detailid:'1011' i'm passing encryption key opensession method. what doing wrong? please help! dilip in experience, air, db must created encrypted db. unencrypted db cannot later encrypted. trying do?

python - How can I subclass a modelform (extend with extra fields from the model)? -

i have model , form: class mymodel(models.model): field_foo = models.charfield(_("foo"), max_length=50) field_bar = models.integerfield(_("bar")) class myformone(forms.modelform): class meta: model=mymodel fields = ('field_foo', ) widgets = {'field_foo': forms.textinput(attrs={'size': 10, 'maxlength': 50}),} i have form myformtwo subclass form including field field_bar . point not have repeat widget declaration field_foo in second form (dry principle), , not have repeat list of fields myformone (in reality there more 1 field in simple example above). how should define myformtwo ? you shouldn't have explicitly declare entire widget, modify attrs different. or if have custom widgets in real code, either create custom model field class uses widget default, if it's general condition, in form class works "automagically". if it's form specific (not model sp...

java - Where is "this" pointing at? -

i know piece of code below far perfect want do. problem can't understand object "this" keyword pointing at. public class browser extends jfilechooser{ public file browser_creation(){ int r; jfilechooser browser1 = new jfilechooser(); r = browser1.showopendialog(this); if (r == browser.approve_option) { return browser1.getselectedfile(); } else { return null; } } } this points current instance of browser. in other words, referring object being executed in. here more information java tutorials: http://download.oracle.com/javase/tutorial/java/javaoo/thiskey.html

html - Add content before and after a class - jQuery -

how add div starter " <div class='abc'> " <img src="bla.jpg" class="xyz"/> , end " </div> " dom be: <div class='abc'> <img src="bla.jpg" class="xyz"/> </div> i tried using jquery code: $('img.xyz').before("<div class='abc'>").after("</div>"); but gives me dom as: <div class='abc'></div> <img src="bla.jpg" class="xyz"/> $('img.xyz').wrap('<div class="abc" />'); http://api.jquery.com/wrap

C# & SQL Server: move array directly into SQL Server -

is somehow possible move 2 dimensional array directly database (sql server) without transforming sql statement? i know there kind of direct connection in vb6.0, can not remember how done then, nor if still possible. in vb6, avoid explicit insert statements creating recordset, inserting rows , calling .update . "direct connection" if command mode adcmdtabledirect . in ado.net, can so, there many ways, such linq sql or entity framework. if want plain low-level vanilla vb6-like style, that'd dataadapter.update method . using (system.data.sqlclient.sqlconnection c = new system.data.sqlclient.sqlconnection("data source=...")) { using (system.data.sqlclient.sqldataadapter = new system.data.sqlclient.sqldataadapter("select * atable;", c)) { using (system.data.sqlclient.sqlcommandbuilder b = new system.data.sqlclient.sqlcommandbuilder(a)) { using (datatable t = new datatable("atable")) ...

html email - Controlling the behavior of the Browsers Back Button -

we created e-newsletter client includes lots of story links banner adds. majority of users reading newsletter in ms outlook. client thinks users confused when click on link newsletter , opens in browser , user can't hit browser's button in order newsletter. what options? possible control browsers button takes user? guess not security reasons. if have newsletter links go through our main site , redirect desired page (story or ad), can in such way button work , won't result in user being redirected redirect page? is there better approach? overall, , forward buttons step user through history , security reasons, there little can that. but ... you have amount of control on history. in particular, page 1 can "go page 2", , once user on page 2, button return user page 1 or page 1 can "replace me in history page 2"; once user on page 2, button return user whatever before page 1, if anything. way orwell redirect pages right out of memory...

android - show the text of an EditText into a TextView -

describing functionality of application: have put in relative layout textview, edittext , button. trying is: when user writes in edittext , push button, content of edittext appeared in textview(just chat-virtual chat). works perfectly, when edittext empty,and button pushed, empty line appeared in textview(and don't want to..). although i've tried solve using if empty line still appearing in textview. greatfull, if help!!! in advance! here code: package teiath.android.appliacation; import android.app.activity; import android.os.bundle; import android.text.method.scrollingmovementmethod; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.textview; public class m_chat extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); /**code scroll bars in...

templates - Templated C++ Object Files -

lets have 2 .cpp files, file1.cpp , file2.cpp, use std::vector<int> . suppose file1.cpp has int main(void) . if compiled both file1.o , file2.o, , linked 2 object files elf binary can execute. compiling on 32-bit ubuntu linux machine. my question regards how compiler , linker put symbols std::vector: when linker makes final binary, there code duplication? linker have 1 set of "templated" code code in f1.o uses std::vector , set of std::vector code code comprises f2.o? i tried myself (i used g++ -g ) , looked @ final executable disassembly, , found labels generated vector constructor , other methods apparently random, although code f1.o appeared have called same constructor code f2.o. not sure, however. if linker prevent code duplication, how it? must "know" templates are? prevent code duplication regarding multiple uses of same templated code across multiple object files? it knows templates through name mangling . type of object encode...

asp.net mvc 3 - Orchard CMS rendering parts outside of admin section -

i working on module following instructions here http://orchardproject.net/docs/creating-a-module-with-a-simple-text-editor.ashx the 1 change want is, rendering product creation outside of admin module. created homecontroller this public class homecontroller : controller { public homecontroller(icontentmanager cm) { contentmanager = cm; } private icontentmanager contentmanager { get; set; } public actionresult index() { return content("this index"); } [themed] public actionresult create() { var product = contentmanager.new("product"); var model = contentmanager.buildeditor(product); return view((object) model); } and file routes.cs in root folder public class routes : irouteprovider { public void getroutes(icollection<routedescriptor> routes) { foreach (var routedescriptor in getroutes()) routes.add(routedescriptor); } public ienu...

C# Use object's property rather than reference for List.Contains() -

i have like: public class myclass { public string type { get; set; } public int value { get; set; } } and have: list<myclass> mylist = new list<myclass>() // ... populate mylist if (mylist.contains("testtype")) { // } in above code, want mylist.contains() match on type property rather myclass object reference. how achieve this? use icomparable or icompare interface, override myclass.equals() , or sufficient override string cast of myclass? edit: after doing tests overriding equals() , string cast of myclass , implementing icompare , icomparable , have found none of these methods work. actually, seems work if override myclass cast of string, mylist.contains((myclass)"testtype") . think scrum meister's answer better :) you can use any extension method: if (mylist.any(x => x.type == "testtype")) { // }

asp.net mvc - MVC 3.0 Missing Compiler Required Error -

i have mvc 3.0 .net 4.0 razor application periodically giving me runtime error: cs0656: missing compiler required member 'microsoft.csharp.runtimebinder.binder.invokemember' i can temporarily fix error deleting dlls bin directory -microsoft.scripting.core.dll -microsoft.scripting.extensionattribute.dll these re-added when re-compile , @ random intervals error. these scripting dlls seem exist because reference facebook dll , project references .net 3.5 project. should these dlls exist in bin directory of 4.0 project @ all? by way, i've not upgraded project previous version of .net , i'm not using mono other people have reported. im thinking of starting blank new project , copying stuff it, still have issue if need re-add same references. else have better idea? thanks! this due using older version of facebook.dll in case maybe if receive error when referencing facebook.

c++ - vector hold memory even swap with an another empty vector -

i make tiny experiment, code following : vector<char> *p = new vector<char>[1024]; (size_t = 0; < 1024; i++) { (*p++).resize(1024 * 1024);//alloc 1 g memory } sleep(5); cout << "start clear" << endl; (size_t = 0; < 1024; i++) { vector<char> tmp; tmp.swap(*p++); } delete [] p; cout << "clear over!" << endl; sleep (5); //here, memory still 1g, why ? thank much. in implementations, memory isn't returned os immediately, rather put "free list", acquiring memory os way more expensive walking such free list. that's why still see 1gig of memory, wherever check that. also, in code, don't see reset p after reserving vectors, swap empty vector uninitialized memory doesn't belong you.

python - Use django sorl-thumbnail with django form-utils -

how implement sorl thumbnailing in django form utils? so form utils documentation says imagewidget: (thumbnails available if sorl-thumbnail installed; otherwise full-size image displayed). however, can't seem implement it. tried using sorl's imagefield in models, breaks form-utils' imagewidget , can't head around using in template when have in template this: <li class="field_upload"> {{ form.image.errors }} <label for="id_image" class="top">{{ form.image.label }}</label> {{ form.image }} </li> form utils has option says: imagewidget accepts keyword argument, template. string defining how image thumbnail , file input widget rendered relative each other. template string should contain variable interpolation markers %(input)s , %(image)s. default value %(input)s %(image)s which in code looks this: pic = forms.imagefield( widget=imagewidget(template='%(...

How to upload files directly to S3 using PHP and with progress bar -

there similar questions none have answers in how upload files directly s3 using php progress bar. possible adding progress bar without using flash? note: referring uploading client browser directly s3. i've done in our project. can't upload directly s3 using ajax because of standard cross domain security policies; instead, need use either regular form post or flash. you'll need send security policy , signature in relatively complex process, explained in s3 docs .

facebook - FBML document.getElementById(‘’).setTextValue issue -

i added fbml application fan page can't make js work ... though read fbjs best practices ... guess missing something. here current code : <form action="" method="post" target="_blank"> <input type="text" name="email" id="emailinput" onclick="document.getelementbyid(‘emailinput’).settextvalue(‘hi!’);" value="votre adresse email" alt="entrez votre email" /> <input type="hidden" name="place" value="facebook" /> <br/> <input type="submit" name="submit" class="submitinput" value="" alt="valider" /> </form> the onclick event seems not work can't answers research on internet ... any welcome ;) cheers guys. gotye. use firebug or chrome tools verify id emailinput, , facebook fbml parser didn't append prefix id. fbml pages have been deprecated better off...

c++ - QSyntaxHighlighter highlight part of match with QRegExp -

i needed match string following: xxx but both "1." , "xxx" highlighted , , i'm using following regex: qregexp ("^\s+(\d+\.)?\s+\b[a-z]{2,}\b") how can highlight xxx in case ? many ! your regex should like: qregexp ("^\s+(\d+\.)?\s+(\b[a-z]{2,}\b)") so can capture xxx in regex. then, retrieve matches using capturedtexts() . string you're after should last index since first item entire string matches, second 1 number , dot if found or string xxx. if number present, xxx in third string. having that, can find index of substring inside original 1 setup highlighting.

git commit best practices -

i using git manage c++ project. when working on projects, find hard organize changes commits when changing things related many places. for example, may change class interface in .h file, affect corresponding .cpp file, , other files using it. not sure whether reasonable put stuff 1 big commit. intuitively, think commits should modular, each 1 of them corresponds functional update/change, collaborators pick things accordingly. seems inevitable include lots of files , changes make functional change work. searching did not yield me suggestion or tips. hence wonder if give me best practices when doing commits. ps. i've been using git while , know how interactively add/rebase/split/amend/... asking philosophy part. update: advices. maybe should learned practicing. keep problem open time see if there more suggestions. i tend commit propose: commit logically connected change set. commits can one-liner change in files (for example add/change copyright notice in sou...

Copying Conditional formatting in Excel using VB.net? -

i have column 'a' in worksheet 'two' , column 'b' in worksheet 'one' ! i want copy conditional formatting of column in 2 column b in 1 ! basically, want copy column in 2 column b in 1 except data ! please !! i have : sheeta & sheetb object objects in code using vb.net i newbie in vb.net - please ! here's bit of push: oexcel = createobject("excel.application") book = oexcel.workbooks.open("c:\users\jonathan\documents\test2.xlsx") sheet = book.worksheets(1) sourcerange = sheet.range("a1:a" & sheet.range("a1").end(excel.xldirection.xldown).row) destrange = sheet.range("d1:d" & sheet.range("d1").end(excel.xldirection.xldown).row) the meat of part, take format conditions 1 range , add other. assumes there 1 criterion formatting. more 1 require step on of them (i think there 3) using sourcerange.formatconditions(i) in loop 1 source...

MySQL dynamic search query procedure -

the mysql query should return 1) true along comma(,) separated list of station_name table station station_name like input specified buy user. for ex: input = a, output= (agra,ajmer,amritsar,ambala) . input = am, output= (amritsar, ambala) 2) false , when no such station exists 3) error . detailed procedure appreciated, new mysql. in advance.. :) you don't need procedure, select returns 1 row on success or no rows on failure: select group_concat(station_name) station station_name ? where ? placeholder user entered search. group_concat mysql-specific feature. if must use procedure, this: create procedure stationsearch (in likewhat varchar(255), out rslt text) begin select group_concat(distinct station_name order station_name) rslt station station_name likewhat; end used this: call stationsearch('am%',@rslt); select @rslt;

python - PyCharm: How to skip over closing braces / brackets / parentheses? -

i can't auto-indentations work unless use automatic closing of braces, et al (which don't like), , see no option allowing 1 skip over/out. eclipse has configuration option this, , visual studio doesn't auto-close default, rather formats code block after manually entering closing brace (which rather prefer). surely there's apart going way on "end" key? press ctrl-shift-enter close missing braces on current line (if any), add missing colon (if missing) , put caret correctly indented position on next line.

matlab - Plotting and saving a plot in a loop after the entire loop is done -

i need keep updating plot within loop because doing linear regression each segment in space. can fine , display correct plot. don't seem able save final plot file. code looks like: for = 1:slabs %.....some looped results here, shortened brevity..... p = polyfit(collectcoord, collecttemp, 1); t2 = floor(min(collectcoord)) : 0.1 : ceil(max(collectcoord)); y2 = polyval(p,t2); h = plot(collectcoord, collecttemp, 'o', t2, y2); xlabel('x-coordinate') ylabel('temperature') axis([-8 8 50 800]) hold on end filename = [folder 'plot' num2str(stepcount) '.jpg']; saveas(h, filename); what doing wrong here, or there better way of saving plot? you're calling saveas() on handle line plotted. need supply figure handle: f = figure(); stuff; saveas(f, 'file.jpg'); or saveas(gcf(), 'file.jpg');

c# - Mongo DB - fastest way to retrieve 5 Million records from a collection -

i using mongodb in our project , i'm learning how things work i have created collection 5 million records. when fire query db.productdetails.find() on console takes time display data. also when use following code in c# var products = db.getcollection("productdetails").findall().documents.tolist(); the system throws outofmemoryexception after time.. is there other faster or more optimized way achieve ? never try fetch entries @ same time. use filters or few rows @ time. read question: mongodb - paging

How to Refresh a Div by Jquery? -

i need refresh div in page jquery <? if($post['id']) :?> <script> refresh script </scriptt> <?php ednif;?> <div class="refresh-div"> <span> dynamic content </span> </div> i'm still not entirely sure looking for, based on comments on question, want this: $(".refresh-div").load("somescript.php"); that simplest form the jquery load function, loads whatever returned somescript.php element class="refresh-div" , replacing whatever there before. you can more load function if necessary (like pass in data, , callback function), more information suggest reading load section in jquery api .

c# - Parse HTML Page, include all css styles -

i want send complete html page email , want include css styles email. there library creates me 1 html page css styles correctly included. (conside can import css files have opened , included.) any appreciated. the closest came having send control without includes, , built server control, read css files ( , js files ) , write them out. entire page, might have more difficulty. i not believe there this. if can read entire page code, doing find , replaces may easiest answer. find csss tag, replace inner contents values file in tag.

javascript - Jquery ui Sortable trigger the Toggle event -

i have simple list make sortable jquery ui. the content off 1 (or more) of items 2 divs, 1 title , other content. title binded toggle event hides or shows content. the problem comes when drag item toogle event, happens triggered , contents hide or show. there way prevent this? here sample of problem: http://jsfiddle.net/epaulk/lz7nm/24/ drag item in red thanks! edgar i figure out, if have same problem: i'm not 100% clear why, apparently "fadeto" somehow reset element, , triggers other event. i hope help.

java - How can I change Swingworker to AsyncTask in Android? -

how can change swingworker asynctask in android? my code follows. private void showweather() { // todo auto-generated method stub swingworker worker = new swingworker<weatherinfo,object>() { public weatherinfo doinbackground() { yahooweather yahooweather = new yahooweather(); return yahooweather.getweatherinfo(); } public void done() { try { weatherinfo winfo = get(); // weatherinfo result background thread updategui(winfo); } catch(exception e){} } }; worker.execute(); } you should using asynctask instead

asp.net - ModalPopupExtender only show on Selected index changed event, not on clicking DropDownList? -

i said in last question , in 1 too, username reflects experience! i have page 2 listviews, 1 of has number of controls in insertitem template. one of these controls in particuilar ddl , have modal popup extender hooked it. want trigger mpe when particular value(not index) selected. here now! dropdownlist expensetypeddl = (dropdownlist) expenses.insertitem.findcontrol("expensetypeddl"); int expensetype = (int32.parse(expensetypeddl.selectedvalue.tostring())); if (expensetype == 1) { ajaxcontroltoolkit.modalpopupextender mpemiles = (ajaxcontroltoolkit.modalpopupextender)expenses.insertitem. findcontrol("mpemiles"); mpemiles.show(); } above contents of ddl selectedindexchanged event. ddl based on expense types, want target particular value (db primary key) , display modal popup user can enter mileage other stuff after. here mpe <cc1:modalpopupextender id ="mpemiles" targetcontrolid ="expensetypeddl...

oauth - Facebook Graph API problem -

i've got trouble facebook authentication. when i'm logged, function getuser() returns 0 here's code : $fb_params = array( 'appid' => app_id, 'secret' => secret_id ); $fb = new facebook($fb_params); echo $fb->getuser(); // uid someone's got idea? ps : 'i can no long access $fb->api('/me') , says requires access_token , think it's linked authentication issue...' thanks you not authenticating user, application. result, facebook api can't show /me page or respond getuser() call since doesn't know user trying access api on behalf of (ie. "who /me?"). able access publically-accessible information. you need user authenticate application through oauth2, store access_token returned, , include in future calls (eg. wirqjcey1.3600.1309525200.0-509450630|ed6sar">https://graph.facebook.com/me?access_token=2227470867|2.aqb-_ wirqjcey1 .3600.1309525200.0-509450630|ed6sar...). ...

android - How to manage oriantation in landscap and portrait using fragment -

Image
i crate 1 example in android 3.0 , use fragment in it.when change mode landscape portrait or viseversa give me error following when comment fragment calling part works smoothly per changes. create layout-land folder , put may xml file changes. does 1 have hint or solution or example match this? this fragment: <fragment class="com.organisemee.fragment.tasklistfragment" android:id="@+id/tasklistfrag" android:layout_width="match_parent" android:layout_height="match_parent" /> and error: 07-01 12:38:33.363: error/androidruntime(641): java.lang.runtimeexception: unable start activity componentinfo{com.organisemee/com.organisemee.organisemeelist}: android.view.inflateexception: binary xml file line #167: error inflating class fragment 07-01 12:38:33.363: error/androidruntime(641): @ android.app.activitythread.performlaunchactivity(activitythread.java:1736) 07-01 12:38:33.363: err...

object - How can I achieve this in php? -

i make object, not need create time.... example, have user object, , user created db, so, when user login, can read user object information db... each user make requests, need create new user object again....even make singleton object...it still can "keep" object....but want save communication between php , db...is there way keep object instead of query db time? thank you. put in $_session ? make sense, if read question right

html5 - Is use of HTML 5 section id="contacts" semantically correct in place of div id="contacts"? -

is use section id="contacts" semantically correct in place of div id="contacts "? on webpage need add multiple contacts info of company. use div id="contacts if want use html 5 tag as possible appropriate use section id="contacts" in case. or no benefit use section element here. for example wrap multiple address this <p> <b>address 1:</b><br> 9900 corporate campus dr., suite 3000<br> louisville, ky 40223 <br> <b>phone:</b> (502) 657-6033<br> <b>fax: </b>(425) 936-7329<br> </p> <p> <b>address 2:</b><br> 9900 corporate campus dr., suite 3000<br> louisville, ky 40223 <br> <b>phone:</b> (502) 657-6033<br> <b>fax: </b>(425) 936-7329<br> the address element must not used represent arbitrary addresses (e.g. postal addresses), unless addresses in fact relevant contact inf...

jQuery equivalent of YAHOO.util.Connect.asyncRequest('POST', requestUrl, callback, "jsonSlapInfo=" + value) -

please tell me jquery ui equivalent of yui, yahoo.util.connect.asyncrequest('post', requesturl, callback, "jsonslapinfo=" + value). new jquery , yui . first must tell jquery ui ui design script based on jquery core. false need yui equivalent jquery ui. you must search jquery equivalent. here want: $.ajax , 1 more simple: $.post

Grails Command object @PostConstruct or something? -

i want initialize command field injected service. so need execute command's method after has been initialized, before params assigned fields. how can it? ok, can service bean hand in constructor. better way? had no luck @postconstruct or initializingbean - looks command not bean, right? grails 1.3.5 you're right command not bean. instantiate command instance service method , initialization there , return instance controller. call controller's binddata returned instance this: // controller code def myservice // injected def action = { def command = myserivce.createcommandinstance() binddata(command, params) } // service code class myservice { def createcommandinstance() { def cmd = new mycommand() dosomeinitializationwithcommand(cmd) return cmd } }

php - XML charactor encoding issues with accents -

i have had problem few times while working on projects , know if there's elegant solution. problem pulling tweets via xml twitter , uploading them db when output them screen these characters: "moved dusseldorf.â��" or tambiã©n and if have russian characters lots of ugly boxes in place. what correct native accents show under 1 encoding. thought possible utf-8. what using php, mysql after reading in xml file doing following cleanse data: $data = trim($data); $data = htmlentities($data); $data = mysql_real_escape_string($data); my database collation is: utf8_general_ci web page character set is: charset=utf-8 i think have html entities appreciate solution works across board on projects. thanks in advance. replace line: $data = htmlentities($data); with this: $data = htmlentities($data, null, "utf-8"); that way, htmlentities() leave valid utf-8 characters alone. more information see the documentat...

c# - speech-to-text disable windows auto handler and write what i say -

i've started using .net speech-to-text library (speechrecognizer) while googling , searching site found code sample: var c = new choices(); (var = 0; <= 100; i++) c.add(i.tostring()); var gb = new grammarbuilder(c); var g = new grammar(gb); rec.unloadallgrammars(); rec.loadgrammar(g); rec.enabled = true; which helped me start. changed these 2 lines for (var = 0; <= 100; i++) c.add(i.tostring()); to need c.add("open"); c.add("close"); but, when 'close', speech recognizer of windows closes application! in addition, there better way recognize speech create own dictionary? user like: "write note myself" , user speak , i'll write. sorry asking 2 questions @ same question, both seem relevant 1 problem. you using shared speech recognizer (speechrecognizer). when instantiate speechrecognizer recognizer can shared other applications , typically used building applications control windows , applications runni...

php - Run apache benchmark on session links . (I want to access some pages which are in session.) -

i want run apache benchmark listed after userid logged in. how can pass session ab command ? for example, x user logged in though browser , redirected home profile page. profile page has many links, shown user logged in. how can access these links using "ab" command. ab -n10 -c2 -p post_data.txt https://integration.crossroads.net/index.php (i posted data using ab, worked fine me) . in order should create session using browser, after that, assuming you're using standard techniques (i.e. sessions , session cookies) you'll able grab cookie sent app containing session id, like phpsessid=isldkdkkd8989s9f8 which can found using firebug or browser cookies inspector. having information can pass ab command -c option , apache benchmark act logged user ab -n10 -c2 -p post_data.txt -c phpsessid=isldkdkkd8989s9f8 https://integration.crossroads.net/index.php p.s. jaitsu said should accept right answers questions.

imageview - Appcelerator. Change image in image view on click -

titanium sdk version: 1.7.0 iphone sdk version: 4.2 i developing ios app , got image acts button in row in table , when click image view want change image image. for example if click image view displays picture1.png want show picture2.png after click. how can this? i tried e.source.image = "picture2.png"; did not work. solved using: e.source.image = '../images/picture2.png';

jpa - EclipseLink Descriptor Customizer & History Policy and JSF. How to insert user principals in history? -

in jsf web application, use eclipselink descriptor customizer and history policy to populate history table in database. corresponding jpa entity class annotated @customizer(beans.historylesionhcustomizer.class) the history table has same fields source table, plus 2 fields (start_date & end_date) specify start , end of operation on row. working. need populate field in history table. field called user , should populated user principals , , allow me trace user performed cud (create/update/delete) operation. thought history policy allow me add field indicating corresponding name in database , indicate object value must inserted. not case, or may not able figure how can done. in other words, along start_date , end_date, want populate user field : facescontext.getcurrentinstance().getexternalcontext().getremoteuser(); package beans; /** * whenever there change on record or insert, change traced. * @author mediterran * */ import javax.faces.context.fac...

dom - Undefined error using javascript objects -

i newbie javascript objects , have problem. trying make image gallery keep getting error this.current, this.size & this.initial undefined, , therefore, script cannot work. please me resolve error. following full script. function gallery() { this.image = new array(10); this.initial = 1; this.current = 0; this.size = 10; this.frame_height = 400; this.frame_width = 600; this.initialize=function() { if(document.images) { var count = 1; for(count=1;count<=this.size;count++) { this.image[count] = new image(); this.image[count].src = 'images/'+count+'.jpg'; } } divimg.id = "divimg"; divimg.setattribute("width",this.frame_width); divimg.setattribute("align","center"); divimg.setattribute("margin","0px auto"); divbtn.id = ...

c# - MEF ExportFactory<T> - Any way to pass a parameter value prior to creating an export? -

factory.createexport() create's exportlifetimecontext<t> is there way pass in parameter creates parameter. found example code wasn't looking for, had called dependency , i'm wondering if that's right direction at? update: the link's answer has it, though i'm not sure if that's "foo" or actual object. custom 'exportfactory'

osx - How to tell OS X not to "wait" during a bash script? -

i've set script: #!/bin/bash /applications/namechanger.app/contents/macos/namechanger "$@" osascript -e "delay 1" -e "tell application \"namechanger\" activate" i'm using pass file names namechanager. without second line loads namechanger unfocused. thought should use delay , activate applescript focused. unfortunately script "waiting" namechanger run , exit before executing applescript bit. how can change that? alternatively can use open command launch namechanger. should automatically bring namechanger foreground: #!/bin/bash open /applications/namechanger.app --args "$@"

android - Strange artifacts when rendering lots of bitmaps -

i'm writing simple 2d game engine , rendering various objects locked surfacevew calling canvas.drawbitmap (all same source bitmap not 1:1 source destination scaling). everything appears work expected until there lot of calls per frame drawbitmap. when happens see stall (100ms or so) accompanied effect looks if several frames of rendering have occurred together, i.e. objects drawn twice @ 2 screen locations or pair of objects moving @ same speed appear momentarily closer or further apart. the application structured follows (simplified sake of example); initialisegameobjects(); while(quit==false) { processgamelogic(); // update object positions canvas c = surface_holder.lockcanvas(); if (c != null) { drawgameobjects(c); // draw objects surface_holder.unlockcanvasandpost(c); } } as understand it, canvas holder draw requests executed when post issued. presumably there limit number of requests can hold , i'm wondering if i'm exceeding limit (i'm drawing ...

How do I match latin unicode characters in ColdFusion or Java regex? -

i'm looking coldfusion or java regex (to use in replace function) match numbers [0-9], letters [a-z], include none ascii portuguese letters (unicode latin, ç , ã ). some this: str = rereplacenocase(str, "match none number/letter keep unicode latin chars", "", "all"); input string: "informação 123 ?:#$%" desired outcome: "informação 123" i know can match letters , numbers [a-z][0-9] , doesn't match letters such ç , ã . try alphanumeric character class: \w , should match letters, digits, , underscores. also can use special named class \p{l} (i don't know, java regex parser support it). in c# task can done using following code: var input = "informação 123 ?:#$%"; var result = regex.replace(input, @"[^\p{l}\s0-9]", string.empty); regex [^\p{l}\s0-9] means: character not in class (all letters, white space, digits). thereby matches in example ?:#$% , can replace these characte...

r - Transform a matrix txt file in spectra data for ChemoSpec package -

i want use chemospec mass spectra of 60'000 datapoint. i have them in 1 txt file matrix (x + 90 samples = 91 columns; 60'000 rows). how may adapt file spectra data without exporting again each single file in csv format (which quite long in r given size of data)? the typical (and only?) way import data chemospec way of getmanycsv() function, question indicates requires 1 csv file each sample. creating 90 csv files 91 columns - 60,000 rows file described, may slow , tedious in r, done standalone application, whether existing utility or ad-hoc script. an r-only solution create new method, getonebigcsv() , adapted getmanycsv() . after all, the logic of getmanycsv() relatively straight forward. don't expect such solution sizzling fast, should, in case, compare time takes run getmanycsv() , avoid having create , manage many files, hence overall faster , less messy.

jquery - zend framework: select field with same name -

in product form have select field knowledges, in other words : knowledge requested install product. time however, there 2 different knowledges requested. did jquery, clone select field in form. select fields have same id/name after clone. tried using array notifications name [], zf not accept this. how may solve problem? regards andrea here form class bm_form_audproducts extends zend_form { public function init(){ /* * addelementprefixpath() method apply decorator form elements. * however, addelementprefixpath() method work when have created elements using form object. * if instantiating element directly, use addprefixpath() on each of element */ $this->addprefixpath('bm_form_decorator', 'bm/form/decorator', 'decorator'); $this->setname('frmaudproduct')->setmethod('post')->setaction(''); $category = new application_model_productcategory(); $category = $category->sele...

javascript - onload not getting called for object element -

i have object element in html blank data attribute set later upon ajax response. want event when dom object content document ready. if use onload on object element works in firefox , opera not work in webkit based browser. how can have onload event trigger in browsers the html looks this <object id="myobj" data="" /> the javascript works in ff not in webkit is e = doc.getelementbyid("myobj") e.onload = function(){} e.data="http://myurl" in theory onload strictly body element . if browsers allow other elements more power them it's not required. also: semicolon key broken?

Python: Are `hash` values for built-in numeric types, strings standardised? -

i came question while pondering ordering of set , frozenset , dict . python doesn't guarantee ordering, , ordering coupled hash value @ level. hash value value of numeric or string built-in type standardized? in other words, hash((a,b,c,d,e,f,g)) have determined value, if a , b , c , d , e , f , g numeric values or str ? the hash values strings , integers absolutely not standardized. change new implementation of python, including between 2.6.1 , 2.6.2, or between mac , pc implementation of same version, etc. more importantly, though, stable hash values doesn't imply repeatable iteration order. cannot depend on ordering of values in set, ever . within 1 process, 2 sets can equal , not return values in same order. can happen if 1 set has had many additions , deletions, other has not: >>> = set() >>> in range(1000000): a.add(str(i)) ... >>> in range(6, 1000000): a.remove(str(i)) ... >>> b = set() >>> in range(...

Help me out with my sloppy HTML/PHP -

this might sound silly question how make code seem...neater? echo "<h3><font face='helvetica'><font size='4'><b><font color='b80000'>$title</font></font></font></b> <font color='a0a0a0'>$category &nbsp;</font><font color='a0a0a0'><a href='profile.php?id=$userid'>$user</a></font> <font face='helvetica'><font size='3'><br>&nbsp;$desc</font></font><br> <h3><font color='101010'> &nbsp;$city,$state&nbsp;$zip&nbsp;<font color='a0a0a0'>$date</font> </font></h3>"; ?> there's nothing wrong code looks sloppy - wondering if me out making neat , tidy don't use <font> - move rules css, can style <h3> element. also! not computers have helvetica, may want change "helve...

Does a rel=canonical link remove all SEO value from the page? -

here'y story: have website local company publishes quality content on-site blog. we're expanding new geographic region, , i'm in process of building website targeting new region. i'd include blog on new website, pull in content/posts our existing blog. want added seo benefit of having fresh, relevant content that's updated on website. however, of course need add rel=canonical link original blog in order ensure don't duplicate content penalties posting same content across 2 separate domains. my question whether adding rel=canonical link eliminate seo value of content being posted new website? i'm not talking blog post show in serps, understand point of rel=canonical tag provide attribution primary source of content. i'm more concerned whether using rel=canonical on content eliminate secondary seo benefit of having relevant, updated content on website, due google being "blind" duplicate content. in cases answer on question ...

php - noob: display err_msg on page (pt. 2) -

i posted yesterday, apologize if responded , frustrated @ seeing again! form isn't working @ now, , i'd appreciate in solving problem. i have form sends data database, , requires validation. yesterday @ least validating correctly, today can't hook action page correctly. here 2 pages: page w/ form: <?php session_start(); $form_field = array( 'first_name' => '', 'last_name' => '', 'business_name' => '', 'phone_number' => '', 'web_address' => '', 'email_address' => '', 'how_selling_product' => '', ...