Posts

Showing posts from January, 2014

python - Populate wx.StaticText controls with dictionary key:value pairs -

i have wxpython gui application contains 13 pairs of statictext controls able set labels problematically. in terms of regression analysis, each pair of statictext controls represents independent variable , coefficient. these key:value pairs stored in python dictionary, allowing me use dictionary comprehension of work. right now, struggling display contents of python dictionary inside of gui. thoughts? i happy concatenating key:value pair inside 1 statictext control label, think less messy. i'm sure there lots of different ways this. use listctrl or better yet, objectlistview. went ahead , created example using statictext controls: import wx ######################################################################## class mypanel(wx.panel): """""" #---------------------------------------------------------------------- def __init__(self, parent): """constructor""" wx.panel.__in...

PHP : Post get method, need some advice -

i new php , need understand how post method useful code. scenario is, have 3 webpages, 1st webpage html form , using post method here take firstname , last name form , enter in sql query(for e.g. $_post[firstname] ) on 2nd webpage generates data me , printing data. now need pass same parameters 3rd page generates graph based on firstname , lastname entered in 1st html form? how can persist these values on 3rd php page? referencing url page 3 on page , believe not sufficient, tried google search , found out post useful need expert advice. thanks you can use this: 1st page (page1.php) <form action="page2.php" method="post"> <input type="text" name="firstname" value="" /> <input type="text" name="lastname" value="" /> <input type="submit" value="submit" /> </form> 2nd (page2.php) retrieve , validate $_post['firstname...

css - Twitter Bootstrap Navigation Bar Fixed -

Image
what must change make navigation bar fixed when screen size under 940px? don't want make responsive. if resize browser windows under 940px see scroolbar-x (bottom-scrollbar) appear, when scroll right, navigation bar position still fixed, , menu won't appear. maybe picture explain problem. this can't done in css alone. the example give (twitter) has navbar fixed position , fixed size @ screen sizes. fixed position means scrollbars not affect position of navbar, , why can't use x-scrollbar see part of navbar which, once it's less 940px wide, hidden 'under' right border of browser window. so have choose, either have fixed position , fixed size navbar present @ top no matter how far user scrolls down , accept under small enough screen won't able scroll horizontally see all, or have fixed position , fluid size navbar adjusts width accommodate different screen sizes, mitigate need scroll horizontally in first place, if let grow verti...

hierarchical namespaces in custom python modules -

tried searching site, cannot find answer problem: lets have module, named mymodule.py contains: def a(): return 3 def b(): return 4 + a() then following works: import mymodule print(mymodule.b()) however, when try defining module contents dynamically: import imp my_code = ''' def a(): return 3 def b(): return 4 + a() ''' mymodule = imp.new_module('mymodule') exec(my_code, globals(), mymodule.__dict__) print(mymodule.b()) then fails in function b(): traceback (most recent call last): file "", line 13, in <module> file "", line 6, in b nameerror: global name 'a' not defined i need way preserve hierarchical namespace searching in modules, seems fail unless module resides on disk. any clues whats difference? thanks, rob. you're close. need tell exec work in different namespace (see note @ bottom python 3.x): exec my_code in mymodule.__dict__ full example: imp...

amazon ec2 - Join performance on AWS elastic map reduce running hive -

i running simple join query select count(*) t1 join t2 on t1.sno=t2.sno table t1 , t2 both have 20 million records each , column sno of string data type. the table data imported in hdfs amazon s3 in rcfile format. query took 109s 15 amazon large instances takes 42sec on sql server 16 gb ram , 16 cpu cores. am missing anything? can't understand why getting slow performance on amazon? some questions tune hadoop performance: what io utilization on instances? maybe large instances not right balance of cpu / disk / memory job. how files stored? single file, or many small files? hadoop isn't hot many small files, if they're combinable how many reducers did run? want have 0.9*totalreducecapacity ideal how skewed data? if there many records same key go same reducer, , you'll have o(n*n) upper bound in reducer if you're not careful. sql-server might fine 40mm records, wait till have 2bn records , see how does. break. i'd see hive more cle...

php - facebook extended access token login -

i have following code: $facebook = new facebook(array( 'appid' => id, 'secret' => secret, 'cookie' => true)); $fb_uid = $facebook->getuser(); if($fb_uid) { // check if person fb_uid facebook id in database, // if log them in. if not, register them. $fb_user = $facebook->api('/' . $fb_uid); email address using $fb_user['email'] , facebook_id , store in database means log them in future sometimes $fb_uid returns false though person logged in using facebook ... think because access token expires. how can change code incorporate extended access token log in user site? offline access token deprecated, need use extended access token. your cookie expiring. instead of using cookie , screen-scraping, use oauth. see example here: http://eggie5.com/20-getting-started-w-facebook-api

python - What is the easiest/correct why to change the width of django_tables2 table -

i want table rendered django-tables2 drawn on whole screen. i'm using included paleblue css. class pooltable(tables.table): class meta: model = simple attrs = {'class': 'paleblue','width':'100%'} is possible easy in code , if how? if can't in code, must change in css or html or other place? this more of css question. here how did easy way: chang width on 100% class pooltable(tables.table): class meta: model = simple attrs = {'class': 'paleblue','width':'200%'} this change size of table not pagination. if wont change size have change in css. did find easiest remove borders pagination.

c# - linq group by condition followed by a date group -

i trying group data without luck. i have list of data public class transactionsviewmodel { public string businessname { get; set; } public string description { get; set; } public int transactiontypeid { get; set; } public string transactiontype { get; set; } [display(name = "transaction amount")] public decimal transactionamount { get; set; } [display(name = "transaction date")] public datetime transactiondatetime { get; set; } } i wanting grouping on created couple of classes like public class businesstransaction { public string name { get; set; } public list<transaction> transactions { get; set; } } public class transaction { public decimal transactionamount { get; set; } public string description { get; set; } public datetime transactiondate { get; set; } public string transactiontype { get; set; } } so can group businessname simple var data = c in transactions ...

iphone - How To convert int into NSDate format? -

i have taken 2 values 140 & 200 , if add 140+200 = 340 want output of 340 days nsdate format nscalendar *calendar = [[[nscalendar alloc] initwithcalendaridentifier:nsgregoriancalendar] autorelease]; nsdatecomponents *components = [[[nsdatecomponents alloc] init] autorelease]; [components setday:340]; nsdate *date = [calendar datefromcomponents:components]; gives date 340s day of year 0... long ago.

types - Implementation of datatypes in PHP -

i wanted know data type implementation in php need few resources(books websites , ...). want not data types php support or how use them, it's implementation , how these things done php. want know how stored in memory , detail things it(i know php pretty good). great if lead me can find information. here couple of articles on data types in php php rocks , dummies . interesting aside when comes data types in php type hinting force data type used function parameter.

Check if bluetooth is enabled using an Android application -

i want check if bluetooth enabled in device using android application. used .isenabled method. there error. found out (by commenting lines) error in .isenabled method. can pls me figure out? final bluetoothadapter bluetooth = bluetoothadapter.getdefaultadapter(); submitbutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { string status = "bluetooth"; if(bluetooth != null) { if (bluetooth.isenabled()) { string mydeviceaddress = bluetooth.getaddress(); string mydevicename = bluetooth.getname(); status = ("address "+ mydeviceaddress + " name" + mydevicename); toast.maketext(getapplicationcontext(), "" + status + "", toast.length_long).show(); } else { status = ("bluetooth not enabled"); toast.maketext(getapplicationcontext(), "" +...

xamarin.ios - Draggable Arrow with UIView -

Image
i'm trying create draggable arrow can moved in direction on both sides(as in picture) is there possibility something? i've tried this: its uiview 2 subviews(blue , green). you add gesture recognizer containing view, , based on event, alter views.

shell process java synchronization -

i want run shell script java program. shell script invokes system library needs big file resource. my java program calls script every word in document. if call script again , again using runtime.exec() time taken high since resource loading takes lot of time. to overcome thought of writing shell script follows (to make run continuously in background ): count=0 while count -lt 10 ; read word //execute command on line done i need retrieve output of command in java program , process further. how should code i/o operations achieving task? i have tried writing words in process's output stream , reading output process's input stream. not work , throws broken pipe exception. try { parseresult = runtime.getruntime().exec(parsecommand); parsingresultsreader = new bufferedreader(new inputstreamreader (parseresult.getinputstream())); errorreader = new bufferedreader(new inputstreamreader (parseresult.geterrorstream())); parseresultswriter ...

performance - What is the runtime difference of using the string initialization in java? -

i need know difference of initializing string in java when using runtime. for exmaple: string declare = null; otherwise: string declare = ""; i declared 2 type of declaration of string. 1 best runtime declaration. a string object. if initialize null, telling compiler aware wasn't initialized, , there should no warnings when first try use variable. aside that, pointing reference null, of course. if initialize string empty string, however, following happens: there's string object allocated the compiler put string literal in string pool any other string initialize "" point same inmutable string pool so, question is, how handle nulls or empty strings in code? that's should guide decision

objective c - Sorting NSMutablearray by NSString as a date -

i have array, filled out string objects. inside each object name of object , string, seperated " - ", ex. "object1 - 26.05.2012 ". sort array date in string, , not name, descending possible? as @vladimir pointed out, better separate name , string each other , sort date. nsmutablearray *newarray = [[nsmutablearray alloc] init]; nsdateformatter *formatter = [[nsdateformatter alloc] init]; [formatter setdateformat:@"dd.mm.yyyy"]; (nsstring *str in yourarray) { nsrange rangefordash = [str rangeofstring:@"-"]; nsstring *objectstr = [str substringtoindex:rangefordash.location]; nsstring *datestr = [str substringfromindex:rangefordash.location+1]; nsdate *date = [formatter datefromstring:datestr]; nsdictionary *dic = [nsdictionary dictionarywithobjectsandkeys:objectstr, @"object", date, @"date", nil]; [newarray addobject:dic]; } nssortdescriptor *sortdesc = [[nssortdescriptor alloc] initwithkey:...

php - How To Fetch 26 Rows of MySQL Data, But Display It Only First 25 -

i have simple task using php dealing pagination. idea simple, want mysql_fetch_array of sql query : select name, email, cellphone users username = '$username' limit $x, 26; if query has 26 rows, means have show 'next page' button. but, want show user first 25 rows of it. the 26th row indicator whether 'next page' button should shown or not. currently, i'm using while display rows, how 'stop' while after 25 times loop? while($rowsql = mysql_fetch_array($sql)) { echo "bla-bla-blah"; } this should trick: $count = 1; while($rowsql = mysql_fetch_array($sql)) { if ($count == 25) { last; } echo "bla-bla-blah"; $count++; }

wpf - Silverlight: Copy/Paste Context Menu with TextBox (Text Highlighting Issue) -

i have created textbox control: public class mytextbox : textbox which normal textbox , have added behavior have written: public class textboxcutcopypastebehavior : behavior<textbox> everything works fine , dandy: right-clicking display contextmenu cut, copy, paste options. however , textbox text ceases highlighted @ point, since textbox has lost focus. what best way make selected text remain highlighted, after contextmenu appears , textbox loses focus? thank of help! you should still able access selectedtext property of textbox private void copymenuitem_click(object sender, routedeventargs e) { string texttocopy = mytextbox.selectedtext; // }

Android TabsAdapter with ActionbarSherlock -

Image
i using actionbarsherlock sherlocklistfragment implements loadermanager.loadercallbacks . in applicationactivity oncreate method using setcontentview(r.layout.application); to set layout -- works great. i initializing actionbar so actionbar bar = getsupportactionbar(); bar.setnavigationmode(actionbar.navigation_mode_tabs); bar.setdisplayoptions(0, actionbar.display_show_title); bar.setdisplayhomeasupenabled(false); bar.setdisplayshowtitleenabled(true); // users event list bar.addtab(bar.newtab() .settag("event_list") .settext(getstring(r.string.list_events_header)) .settablistener(new tablistener<eventlistfragment>( this, getstring(r.string.list_events_header), eventlistfragment.class, null))); within applicationactivity, have asynctask takes couple of seconds load on initial open, , when manually refreshed against api - means need make sure update listview on fragment instantiated above, in onpostexecute method, here how that...

netbeans - How to quickly create editor fold? -

when editing gui class i've found editor fold. // <editor-fold defaultstate="collapsed" desc="generated code"> ... // </editor-fold> i've started using own purposes, it's couple of words write. i'm looking faster way. type 'fcom' , press 'tab'. more shortcuts here

sql - how to count visits on a period of time php -

how can count number of visits on page period of time in php , sql right have field called number of visits every page. number not tell time of visits. not mind opening new column counting visits month. how can that? why doing that? monthly report showing me website pages improved more other. ideas? codes? everything welcomed if it's quick tracking, include counter script each page. here's crude illustration in php: <?php $datafile = 'pick_a_filename.txt'; if(file_exists($datafile)) { $count = file_get_contents($datafile); $count++; $fp = fopen($datafile, 'w'); fwrite($fp, $count); fclose($fp); } else { $count = 1; $fp = fopen($datafile, 'w'); fwrite($fp, $count); fclose($fp); } ?> and check created file every month, or add script appends contents statistic file every month. if there's lots of traffic, include lock_ex , random delay b...

Javascript GetElementById from a different file -

i have webpage href linking second page. second page has swf. want a tag in first webpage able getelementbyid , swf object. possible? edit: need do: have main page 2 frames aligned vertically. second frame loads different pages based on button clicks. 1 such page swf. when 1 button clicked want page redirect swf page , send parameters swf why need getelementbyid you pass parameters html documents. choices are: add request parameter , evaluate in page (javascript has access url , can parse it. drawback (possible) - server side sees parameter ) add information anchor - javascript on target page can evaluate , whatever necessary. server not see this, , search engines not evaluate ( )

jquery - changing z-index and get a scrollbar -

i tried lot of things, first in css jquery can't z-index correct. text should go on image on right side of , not under it. if check z-index in source it's correct still text on back. $(document).ready(function() { var entries = $('.entrie').length; $('.entrie').each(function(index){ //console.log(index); var newindex = entries-index; console.log(newindex); $(this).css('z-index', newindex); }); }); here's jsfiddle: http://jsfiddle.net/ejmqg/ 2nd (less important), when make window small text goes under image, how can prevent this? want scrollbars when gets small. give both elements applying z-index position:relative; . z-index doesn't work on doesn't have position.

excel - Double-click autofill - dynamic based on adjacent cell -

Image
i need do: i using normal auto-fill function in excel (double click dot on side of cell) copy contents sub cells, in case clicking dot in cell a1 this: i need script repeat process down entire column, until there no more values in adjacent cell. presumably you're looking for: option explicit sub fillintheblanks() dim startcell range, endcell range set startcell = activecell set endcell = activesheet.cells(activesheet.usedrange.rows.count + 1, startcell.offset(0, 1).column).end(xlup) dim currenttext string dim long = startcell.row endcell.row if not isempty(activesheet.cells(i, startcell.row)) currenttext = activesheet.cells(i, startcell.row).text else activesheet.cells(i, startcell.row).value = currenttext end if next end sub that code perform following: if want what's in screenshot, you'll need this: option explicit sub fillintheblanks() dim startcell range, en...

javascript - Getting all selected checkboxes' corresponding values in an array -

please have @ following code: $("#savebutton").click(function(){ $this = $("#tabledata").find("input:checked").parent().parent(); tea = $this.find(".teacls").text(); $.ajax({ type: "post", url: "chkselectedvalues.php", data: "tea=" + tea, success: function(msg){ $("#thefield").html(msg); } }); }); now if multiple checkboxes selected, tea , flower end concatenating text s fields. if 2 checkboxes selected , 1 contains word some , other 1 contains word text , tea variable gets value: sometext . want tea array containing these values (in case some , text ) since need pass them in ajax request , want catch in chkselectedvalues.php structure: <table #tabledata> <tr> <td .teacls></td> <td> checkbox here</td> </tr> <...

actionscript 3 - addChild communicate with inner movieClips -

i have problems as3. have movieclip , have added stage addchild(gamelevelselect); . the thing have other movieclips inside not addchild in addchild(gamelevelselect); on stage. gave symbol instance name of stagethumb_01 , not work. how can fix that? this code: gamelevelselect.getchildbyname("stagethumb_01").addeventlistener(mouseevent.click, load_level01); function load_level01(e:mouseevent):void { trace("blam") gamelevelselect.getchildbyname("stagethumb_01").getchildbyname("stars").gotoandplay(2); } ................................................. gametitle.addeventlistener(event.enter_frame, load_levelselection); function load_levelselection(event:event):void { if(movieclip(gametitle).currentframe == 22){ removechild(gametitle); addchild(gamelevelselect); addchild(thumblevel01); thumblevel01.getchildbyname("stars").gotoandplay(1); gamelevelselect.gotoandplay(1); ...

android - Creating start stop service button -

i want create single button serves both functions of starting , stopping service. also want make sure if user quits application , again comes according whether service running or not, want show appropriate text on button. so in short, thing can know if service running or not ? you can check if service running or not below code. rest of question logic based once find service running or not. private boolean ismyservicerunning() { activitymanager manager = (activitymanager) getsystemservice(activity_service); (runningserviceinfo service : manager.getrunningservices(integer.max_value)) { if ("com.example.myservice".equals(service.service.getclassname())) { return true; } } return false; } i refer this answer check it

gpu - CUDA shared memory addressing -

i understand when declare shared memory array in kernel, same sized array declared threads. code like __shared__ int s[5]; will create 20 byte array in each thread. way understand addressing shared memory is universal across threads. so, if address subscript 10 follows s[10] = 1900; it exact same memory location across threads. won't case different threads access different shared memory address subscript 10. correct? compiler of course throws warnings subscript out of range. actually create 20-byte array per block , not per thread. every thread within block able access these 20 bytes. if need have n bytes per thread, , block m threads, you'll need create n*m buffer per block. in case, if there 128 threads, have had __shared__ int array[5*128]; and array[10] have been valid address thread within block.

PhoneGap/Cordova: childBrowser plugin giving strange URL (iOS) -

i having great deal of difficulty getting childbrowser plugin work currently when click link nothing on ios simulator , when click using browser web page not found error web address looking like: file://myapp/www/%c3%a2%e2%82%ac%c2%9d#ᅢᄁ¬ツᆲᅡン i stuck ideas on whats going on , causing this, advice appreciated. my code is: <script type="text/javascript" charset="utf-8" src="js/childbrowser.js"></script> <script> function ondeviceready() { childbrowser = childbrowser.install(); var root = this; cb = window.plugins.childbrowser; if(cb != null) { cb.onlocationchange = function(loc){ root.locchanged(loc); }; cb.onclose = function(){root.onclosebrowser(); }; cb.onopenexternal = function(){root.onopenexternal(); }; //cb.showwebpage(“http://google.com”); ...

java - JTable Nimbus Look and Feel - how to make it clear which cell has focus -

Image
when editing data in jtable (nimbus l & f), user tabs cell cell, not obvious cell has focus. how can make clearer cell has focus? know there number of properties can set modify nimbus - know property want? the screen shot below has 1 property set other default: uimanager.put("table.showgrid", true); you have @ renderer concept , by defaul works nimbus , feel , some issue jbuttons components (jcheckbox e.i.) , few times answered or solved on forum import java.awt.borderlayout; import java.awt.color; import java.awt.component; import java.awt.font; import java.awt.graphics; import java.util.arraylist; import java.util.list; import java.util.regex.pattern; import javax.swing.icon; import javax.swing.jcomponent; import javax.swing.jframe; import javax.swing.jscrollpane; import javax.swing.jtable; import javax.swing.rowsorter.sortkey; import javax.swing.sortorder; import javax.swing.swingutilities; import javax.swing.uimanager; import javax.swing.tab...

qt - QML Repeater: parent/child vs ownership -

can clarify qml repeater docs mean firstly saying “items instantiated repeater inserted, in order, as children of repeater's parent .”, and “note: a repeater item owns items instantiates . removing or dynamically destroying item created repeater results in unpredictable behavior.”? aren't child/parent relationship , ownership same visual objects in qml? object parent (ownership) , visual parent not same in qtquick. object parent set @ creation time , never changed. visual parent can changed @ time via 'parent' property. the repeater creates delegates , sets ownership , visual parent parent. in other words, repeater owns delegates, leaves visual presentation parent (in cases, positioner). the qt 5 documentation being improved in area. here snippet (the qt 5 doc snapshot hasn't been updated - source): there 2 separate kinds of parenting in qml application uses qt quick. first kind ownership-parent (also known qobject pare...

java - Using primitive types with ClassLoader -

i've got piece of code used turn string representations delivered class.getcanonicalname() corresponding instances of class . can done using classloader.loadclass("classname") . however, fails on primitive types throwing classnotfoundexception . solution came across this: private class<?> stringtoclass(string classname) throws classnotfoundexception { if("int".equals(classname)) { return int.class; } else if("short".equals(classname)) { return short.class; } else if("long".equals(classname)) { return long.class; } else if("float".equals(classname)) { return float.class; } else if("double".equals(classname)) { return double.class; } else if("boolean".equals(classname)) { return boolean.class; } return classloader.getsystemclassloader().loadclass(classname); } that seems very nasty me, there clean approach this? ...

opencl - clBuildProgram yields AccessViolationException when building this specific kernel -

this part of sort of parallel reduction/extremum kernel. have reduced minimum code still gets clbuildprogram crashing (note crashes, , doesn't return error code): edit : seems happens when local_value declared global instead of local . edit2 / solution : problem there infinite loop. should have written remaining_items >>= 1 instead of remaining_items >> 1 . has been said in answers, nvidia compiler seems not robust when comes compile/optimization errors. kernel void testkernel(local float *local_value) { size_t thread_id = get_local_id(0); int remaining_items = 1024; while (remaining_items > 1) { // throw away right half of threads remaining_items >> 1; // <-- spotted bug if (thread_id > remaining_items) { return; } // greater value in right half of memory space int right_index = thread_id + remaining_items; float right_value = local_value[right_in...

javascript - Cant get the JSON output to loop -

i want loop true elements, in case class "widget", , there id , title(later on more stuff), store json in localstorage(must string stringify data), data localstorage , loop results. goes until want loop it(json output valid), wont work, , have been working on more day hope see doing wrong. (yes have looked on web) i still noob @ if there better ways store , loop let me know. // html <div class="widget" id="w1"> <h2>some text</h2> </div> ... ... ... // setting data var storestr = ''; storestr += '{"widget":['; $('.widget').each(function(){ storestr += '{'; storestr += '"id": "'+$(this).attr('id')+'",'; storestr += '"title": "'+$(this).children('h2').text()+'"'; storestr += '},'; }); storestr += ']}'; ...

php - YII - Webservice returns WSDL when I request from SOA Client addon -

when post soap body yii websevice soa client firefox add on, returns wsdl , not calling respective method. how invoke respective method? what problem? see generated wsdl file : base url of methods exposed service found in " location " attribute @ file end (e.g. wsdl:service > wsdl:port > soap:address ). sample : [...] <wsdl:service name="serviceproviderservice"> <wsdl:port name="serviceproviderport" binding="tns:serviceproviderbinding"> <soap:address location="http://localhost/website/service/soap/ws/1"/> </wsdl:port> </wsdl:service> [...] the url provided has " /ws/1 " (or " ?ws=1 ", depending on application settings) appended controller route exposing web service. see cwebserviceaction class reference : cwebserviceaction serves 2 purposes. on 1 hand, displays wsdl content specifying web service apis. on other hand, invokes requested web service api....

html5 - double buffering SVG in HTML -

i wonder better way simulate double buffering possibly complex svg. i'm reloading modified svg, , i'd rid of load delay. thinking of using 2 overlapped divs , toggle visibility after onload. there better alternative? edit now have implemented 2 svg instances in divs overlapped, style display toggling (block/none). worked in ff (nice, smooth morphing, initial display resulted in reduced area), chrome refuses me screenctm transform need syncing shapes position. guess problems (partial area render in ff, no render in chrome) related. i'm experimenting visibility:hidden instead. edit toggling visibility give acceptable results. far. edit i've found problem, make me here again helping hand: i'm using boostrap non svg related ui, , toolbar behaves strange: when switched visibility on 2^ div (initially hidden), no event arrives toolbar. switching again 1^, events ok. i found using position:absolute or position:fixed same (for events problem, of course),...

c++ - GCC 4.6 and missing variadic-templates expansions -

i'm using code create multiple functions wrappers using variadic templates: // compile g++ -std=c++0x $(pkg-config sigc++-2.0 --cflags --libs) test.cpp -o test #include <iostream> #include <type_traits> #include <sigc++/sigc++.h> template <typename r, typename g, typename... ts> class funcwrapper { public: funcwrapper(g object, std::string const& name, sigc::slot<r, ts...> function) {}; }; int main() { funcwrapper<void, int, int, bool, char> tst(0, "test", [] (int a, bool b, char c) {}); return exit_success; } this code correctly compiles clang++, not g++ due known issue: test.cpp:9:73: sorry, unimplemented: cannot expand ‘ts ...’ fixed-length argument list i know gcc-4.7 should handle correctly, can't upgrade now... i'd have workaround make ts... unpack correctly. i've tested suggested here in questions this one , don't seem solve issue here. you can workaround bug with: templa...

iphone - How to navigate to a UITableView position by the cell it's title using indexing -

i'm using uitableview filled around 200 cells containing title, subtitle , thumbnail image. want have selection method within contact app apple can select character alphabet. i'm @ point i've drawn selection interface (a,b,c etc), , via it's delegate i'm retrieving respective index , title (i.e: = 1, b = 2, c = 3 etc.). now want navigate first cell, first character of cell it's title starting selected index character. contacts app. can give me direction how implement such functionality. - (nsinteger)tableview:(uitableview *)tableview sectionforsectionindextitle:(nsstring *)title atindex:(nsinteger)index i filled sectionindex means of - (nsarray *)sectionindextitlesfortableview:(uitableview *)tableview { if(searching) return nil; nsmutablearray *temparray = [[nsmutablearray alloc] init]; [temparray addobject:@"a"]; [temparray addobject:@"b"]; [temparray addobject:@"c"]; [temparray ad...

WPF printing multiple elements in the visual tree of a window -

i have wpf window contains 3 items controls, along 3 buttons. there way using printvisual() can print 2 of items controls, , no buttons? my first thought dynamically create stackpanel , add controls wanted print it, can't without detaching them first , seems problematic. i use printvisual because it's simple. (unfortunately can't spend time on application). ***please forgive lack of source code supplied, i'm relatively new wpf , form grotesquely over-coded. guess i'm curious if there simple solution out there. thanks. if concern printing part of page. place 2 items controls want print inside grid element. give name <grid x:name="printgrid"> .... </grid> then can call printdialog.printvisual like printdialog printdialog = new printdialog(); printdialog.printvisual(printgrid,"the description"); if cannot manage group controls own grid manually creating container in code , adding existing named items...

factory bot - Undefined method `FactoryGirl' -- upgrading from 2.0.2 to 3.4.2 -

i'm in process of upgrading factory_girl (2.0.2 3.4.2) , factory_girl_rails (1.1.0 -> 3.4.0) , i'm having issues rspec tests seeing factory girl. i think i've altered factories deal new syntax, , have removed require statements bringing in multiple copies of same files. server starts up, know factories.rb file correctly getting parsed. now when run rspec tests, i'm getting error: nomethoderror: undefined method `factorygirl' # it 'can created' course = factorygirl(:course) …. end with factory girl 3.4.2, need explicitly use create method. course = factorygirl.create(:course)

opengl - GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT returns 0 -

i'm testing library on other machines. unfortunately, anisotropic filtering causing problems. on machine (nvidia geforce 580m gtx) works fine , expected. on test machine however, it's failing because when querying gl_max_texture_max_anisotropy_ext, 0. unaware possible reading the spec. . it's (fairly) new laptop ati mobility radeon hd 4250 should support extension. any ideas why gl_max_texture_max_anisotropy_ext return 0? thanks,

playframework 2.0 - Overzealous @Constraints.Required enforcement on update in Play 2.0 -

i'm trying make play stop complaining when updates don't specify required fields in json requests. required fields have values don't want change, shouldn't have specify them again. stripped down model: @entity public class run extends model { public enum status { running, ok, warnings, errors, failed, certified }; @id public long id; @constraints.required @manytoone(cascade = cascadetype.refresh) public task task; @jodadatetime @type(type="org.joda.time.contrib.hibernate.persistentdatetime") public datetime started; @jodadatetime @type(type="org.joda.time.contrib.hibernate.persistentdatetime") public datetime completed; @enumerated(enumtype.string) @column(columndefinition="enum('ok','warnings','errors','running','failed','certified')") public status result; } based on 1 of sample applications initial controller action ...

javascript - Connect 2 images with a line in HTML. Django template -

i'm working on project requires sort of timeline 3 major events. i represent each of events checkmark image. (and depending on whether these events occured correctly, checkmark appears in green yellow or red). these images generated dynamically using django template language. now want connect these 3 images using line or arrow first second , second third. it should this: click here see image now quick , dirty way add grey bars images , float 5 images together. raise resolution-scaling issues. is there way draw line dynamically in way? please help! edit: have use ie 7 etc, cannot use html5. also, custom python-graphics plugins overkill believe. either of pil or pycairo can let draw those. create separate view use in img , , have return png data.

python - List of function of subset of a list -

so i've got list, say, l = [0,1,2,3]; apply function (with 2 arguments) each of values of sublists [0,1], [1,2], [2,3] , in turn produce list of new values. i.e. [f(0,1), f(1,2), f(2,3)] i've looked on , cannot seem find answer. any appreciated, thanks, dave edit: i'm using python. result = [f(*args) args in zip(l, l[1:])] or: result = map(f, l[:-1], l[1:]) a lazy version using itertools functions generate results on demand: it = starmap(f, izip(l, islice(l, 1, none))) or: it = imap(f, l, islice(l, 1, none)) or if l arbitrary iterable: a, b = tee(l) = imap(f, a, islice(b, 1, none))

How to disable "detect_unicode" setting from php.ini? (trying to install Composer) -

i've been trying install composer on machine (os x 10.6) no success far. as per composer docs, executed in terminal: curl -s http://getcomposer.org/installer | php#!/usr/bin/env php and output: the detect_unicode setting must disabled. add following end of php.ini : detect_unicode = off of course, in php.ini: detect_unicode = off, located @ /etc/php.ini.default php -info tells me php.ini file being loaded /etc/ (output is: configuration file (php.ini) path => /etc) but, outputs: detect_unicode => on => on why php.ini.default not loading settings , how disable effecively detect_unicode? most no ini file @ being loaded, don't know if /etc/php.ini.default seen or not php. same said in can't set/find detect_unicode off - should run php -i | grep ini , check file loaded, edit it. if none loaded, make sure put php.ini file configuration file path value, in case /etc/php.ini seems.

drawtext - Display text in a MFC application -

i need display text in mfc application. have sample text "display text in mfc application". let's assume client window in intend draw text small(horizontally) in 1 line text can fit "display text in". words "mfc application" not displayed. question is, how ensure these words displayed in next line, instead of being clipped off?i'm using drawtext function display text. thanks. by default, drawtext api behaves need, unless dt_singleline format specified. provide correct lprect parameter. http://msdn.microsoft.com/en-us/library/windows/desktop/dd162498%28v=vs.85%29.aspx mfc cdc::drawtext method has same behavior. use getclientrect function window rectangle, , pass rectangle drawtext method.

java - Associating timer with tables -

i new timer's , don't know them .my problem creating 2 tables dynamically, , when ever table create timer 10 mins assigned it. i.e. user has fill table in 10 mins else table destroyed. tried making small demo in print stuff code : final timer mytimers = new timer(); timer mytimers1 = new timer(); mytimers1 = new timer(); final long delay1 = 5*1000; // mytimers = new timer(); mytimers.schedule(new timertask() { long current1 = system.currenttimemillis(); long check = current1; @override public void run() { long current = system.currenttimemillis(); system.out.println(current); system.out.println("\n"); if((current1 + delay1)<current) { system.out.println("mytimmer stop"); mytimers.cancel(); } } }, 100, 1000); mytimers1.schedule(new timertask() { @override public void run() { long current = system.currenttimemillis(); ...

How to load a javascript chart on the 2nd, 3rd etc. page in JQuery mobile? -

i quite new jquery mobile , i've been spending days figure out apparently simple question. here's problem: using charting javascript library amcharts. far, good... trying create simple page in jqmobile let's 2 links new pages. want when click link, amchart should display in div specific name. (amcharts displays chart in div calling chart.write('nameofthediv'); so thought event handler bound $('#container').bind('click', function(){...} should able include relevant javascript... somehow though...it doesn't work. here's link can see mean: http://www.noten-werkstatt.de/jqm_amcharts/ and here code index.html , relevant custom-scripting.js. thank in advance! regards, lisa index.html <!doctype html> <html> <head> <meta charset="utf-8"> <title>jquery mobile , amcharts</title> <link href="amcharts/style.css" rel="stylesheet" type="text/css"> ...