Posts

Showing posts from February, 2013

cocoa touch - Getting touches at launch on iOS -

on mac, 1 can location of mouse "outside event stream" (ie, if you've not subscribed delegate methods mouseup: et al) calling [nsevent mouselocation] . is there way on ios current touch events without listening touchesbegan: ? i ask because there @ least 1 situation in touchesbegan not called: at app launch, if touch in progress, touchesbegan never called . in fact, neither of touch-related uievent methods called near can tell (nor uiapplication's / uiwindow's sendevent: , apparently). i vary behavior of app based on whether touch in progress @ launch. is there way detect in-progress touch @ app launch ? this cannot done. simple reason: touch events don't belong app. each touch belongs ui element (or responder). know, element gets began, moved, ended, cancelled messages. this true within programmed app: events regarding one touch delivered same object. after all, how object know event, , how should first object finish expected behavior

database - PDO PHP Multiple Rows update doesn't update -

for record list script i've made form should updating 20 rows @ once, possible change whole list @ one. values retrieved $_post , should updated in database pdo. when click submit-button, nothing happends. doesn't give error, , doens't update value in database. maybe u can help? lots of in advance. axel the script: <?php if ($_server['request_method'] == 'post') { $dw = $_post['dw']; $vw = $_post['vw']; $aw = $_post['aw']; $titel = $_post['titel']; $artiest = $_post['artiest']; $a = count($dw); $conn = new pdo('mysql:host=localhost;dbname=#dbnamr', '#dbuser', '#dbpass'); try { $set_details = "update `top20` set `vw` = :vw, `aw` = :aw, `titel` = :titel, `artiest` = :artiest `dw` = :dw"; $sth = $conn->prepare($set_details); $i = 0; while($i < $a) {

jQuery Ajax form submit error handling -

i have following code: var url = "save.php"; // script handle form input. $.ajax({ type: "post", url: url, data: $("#frmsurvey").serialize(), // serializes form's elements. success: function(){ alert('success'); }, error: function(){ alert( "request failed: " ); } }); now, works fine when submitting data db - however, when deliberately change save.php file data isn't submitted, still success alert. code save file below: $proc = mysqli_prepare($link, "update tresults set ip = ?, browser = ?, q1 = ?, q2 = ?, q3 = ?, q4 = ?, q5 = ?, q6 = ?, q7 = ?, q8 = ?, q9 = ?, q10 = ?, q11 = ?, q12 = ?, q13 = ?, q14 = ?, q15 = ?, q16 = ?, q17 = ?, q18 = ?, q19 = ?, q20 = ?, q21 = ?, q22 = ?, q23 = ?, q24 = ?, q25 = ?, q26 = ?, q27 = ?, q28 = ?, q29 = ?, q30 = ?, q31 = ?, q32 = ?, q33 = ?, q34 = ?, q35 = ?, q36 = ?, q37 = ?, q38 =

python - Retrieve location data using BeautifulSoup -

i'd location information infobox on following wiki . here i've tried: r = requests.get('https://en.wikipedia.org/wiki/alabama_department_of_youth_services_schools', proxies = proxies) html_source = r.text soup = beautifulsoup(html_source) school_d['name'] = soup.find('h1', 'firstheading').get_text() print soup.find('th', text=re.compile("location")).find_next_sibling() output: none guessing i'm unable access <td> element because it's not sibling?? any advice? >>> table = soup.find("table", class_ = "infobox") >>> name = table.find("th").text >>> country = table.find("th",text="country").parent.find("td").text >>> table = soup.find("table", class_ = "infobox") >>> name = table.find("th").text >>> country = table.find("th",text="country

Wordpress: How can I group posts without using categories or tags? -

i'm creating dynamic dictionary wordpress la http://urbandictionary.com/ . functionality want emulate having multiple definitions single word. need each of these definitions able rated user (currently using wp-postratings, i'm open other plugin). idea users determine accurate definition of word via post ratings system. currently have each definition individual post same title, e.g., definition #1 "dog" , definition #2 "dog" separate posts title "dog." here's i'm running trouble: don't want user aware of structural distinction between different definitions. in other words, don't want there 2 separate pages—i want user think, intents , purposes, there singular page contains of word's definitions. this similar categories do, obviously, i'm categorizing words content. i'm looking more explicit connection between posts. (i prefer not have 500+ categories.) would easier input secondary definitions custom field valu

php - Session variables not carrying over -

i'm trying write log in script set session variable , redirect user page. session variables displays fine on page it's set, on next page not display @ all. have stripped down home page echo session variable. login.php: session_start(); if(isset($_post['process_login'])){ include('php/db.php'); $query = mysql_query("select users.username, users.password users") or die (mysql_error()); while ($result = mysql_fetch_array($query)){ if (strtoupper($_post['username']) != $result['username'] || md5($_post['password']) != $result['password']){ echo "<center><font color=red>incorrect username or password</font><center>"; } else{ $_session['username'] = $_post['username']; #echo $_ses

C++ What is the std::for_each() function parameter type? -

here couple of snippets first successful use of std::for_each() construct: struct add_to_memory { void operator()(const boost::tuple<const string&, const string&> &t ) { m_map.insert(make_pair(t.get<0>(),t.get<1>())); } add_to_memory(memorybank &m) : m_map(m) {}; private: memorybank &m_map; }; void memorize(block &block) { block.get_record_types(record_type_set); boost_foreach(d_recordtype_set::value_type rec_type, record_type_set) { md_zip_range zipper = block.make_field_value_zip_range(rec_type); std::for_each(zipper.first, zipper.second, add_to_memory(memory_bank)); } } i want change "memorize" function accepts additional parameter - function or functor or whatever add_to_memory() is. can't figure out type use in signature. void scan_block_and_apply_function( block&, ..?.. ); i'm using [ read: "stuck with"] g++ 4.4, it's safe haven't

.net - How to programatically update group policy with C#? i.e. gpupdate /force -

i have several local accounts created @ install time c#. there group policy in turn grants permissions these new accounts. the problem trying solve how go getting group policy pushed new accounts. without group policy applied application not function. opening cmd prompt , running gpupdate /force fixes it, need more seamless transition between install time , run time. that should trick: private void updategrouppolicy() { fileinfo execfile = new fileinfo("gpupdate.exe"); process proc = new process(); proc.startinfo.windowstyle = processwindowstyle.hidden; proc.startinfo.filename = execfile.name; proc.startinfo.arguments = "/force"; proc.start(); //wait gpupdate finish while (!proc.hasexited) { application.doevents(); thread.sleep(100); } messagebox.show("update procedure has finished"); }

autohotkey - accesible, but out of tabstop sequence -

is there way edit control accesible, out of tabstop sequence? eg have gui, add, text, &a gui, add, edit, -tabstop readonly i cannot tab (which good) cannot use alt-a reach nor can reach mouse clicking it. problem user cannot scroll , peruse contents. if 1 changes - + 1 can reach tabs , alt-a. not want in tabstop sequence. "gui styles" page of autohotkey help/manual these appear relevant styles edit command... how can have control reachable, outside tab sequence? if turn alt-a hotkey, how requested result gui, add, text, ,&a gui, add, edit, -tabstop readonly vmyedit, content gui, add, edit gui, show return !a:: guicontrol,focus, myedit return

collections - Castor Hashtable polymorphism -

good day i attempting use castor construct hashtable has multiple implementations of abstract class. here parent "config" <class name="com.config"> <map-to xml="config" /> <field name="rulesmap" collection="hashtable"> <bind-xml auto-naming="derivebyclass" > <class name="org.exolab.castor.mapping.mapitem"> <field name="key" type="java.lang.string"> <bind-xml name="name" node="attribute" /> </field> <field name="value" type=com.rule"> </field> </class> </bind-xml> </field> </class> 'com.rule' abstract class , @ end of day xml struct looks this <config> <rule-impl1 name="ruletype1instance1" rulefield=&quo

uitableview - Display UIImageView contained in UITableViewCell fullscreen with animation when tapped -

i've uiimageview inside custom uitableviewcell , want display fullscreen when tap on it. i've attached uitapgesturerecognizer uiimageview , image resizes. problem have right image moves inside cell contained in, should in fact move out of it. i'd put black background behind image. any ideas on how achieve that? i culprit either cell, or cells content view clipstobounds enabled. setting [cell setclipstobounds:no]; should solve problem. however, if you're willing take new approach this, may beneficial instead of growing cells imageview, add new image above tableview in same location cell's image view , grow that. way wouldn't have undesirable behavior being able scroll image view away because table still scrollable.

python - How can I show a PyQt modal dialog and get data out of its controls once its closed? -

for built-in dialog qinputdialog, i've read can this: text, ok = qtgui.qinputdialog.gettext(self, 'input dialog', 'enter name:') how can emulate behavior using dialog design myself in qt designer? instance, do: my_date, my_time, ok = mycustomdatetimedialog.get_date_time(self) here simple class can use prompt date: class datedialog(qdialog): def __init__(self, parent = none): super(datedialog, self).__init__(parent) layout = qvboxlayout(self) # nice widget editing date self.datetime = qdatetimeedit(self) self.datetime.setcalendarpopup(true) self.datetime.setdatetime(qdatetime.currentdatetime()) layout.addwidget(self.datetime) # ok , cancel buttons buttons = qdialogbuttonbox( qdialogbuttonbox.ok | qdialogbuttonbox.cancel, qt.horizontal, self) buttons.accepted.connect(self.accept) buttons.rejected.connect(self.reject) layou

excel - Dynamic Frozen Panes Titles -

so in excel have been asked change excel file incorporate dynamic titles above frozen pane. idea header says january since first month, when user scrolls february data title should change february. i have tried start writing macro , closest making frozen pane header drop down, searching contents of header cell , making first cell in column below header contains actual month being shown , i'm having trouble getting work; can't debug syntax. great! think if can dropdown selection basis of search makes first instance of search criteria in column below active cell , scroll located below frozen pane. range("e1").select dim selekt variant selekt = range("e1").select selection.copy (selekt) cells.find(what:=selekt, after:=abc, lookin:=xlformulas, _ lookat:=xlpart, searchorder:=xlbyrows, searchdirection:=xlnext, _ matchcase:=false, searchformat:=false).activate have @ window.visiblerange . still have event fire, though.

java - UnsatisfiedLinkError after install, cannot run PLAY -

i stuck in beginning step. install jdk , play, added necessary directories in path variable. when run play command, unsatisfiedlinkerror mentioned below. please let me know how fix this. running windows 8 x64 , path directory is c:\isanthosh\dev.tools\play-2.1.3\;c:\program files\java\jdk1.7.0_25\jre\bin;c:\program files\java\jdk1.7.0_25\bin;c:\program files\java\jre7\bin; error: java.lang.unsatisfiedlinkerror: c:\users\santhosh\appdata\local\temp\jline_0_12_2.dll: access denied @ java.lang.classloader$nativelibrary.load(native method) @ java.lang.classloader.loadlibrary1(unknown source) @ java.lang.classloader.loadlibrary0(unknown source) @ java.lang.classloader.loadlibrary(unknown source) @ java.lang.runtime.load0(unknown source) @ java.lang.system.load(unknown source) @ jline.windowsterminal.initializeterminal(windowsterminal.java:240) @ jline.terminal.setupterminal(terminal.java:75) @ jline.terminal.getterminal(terminal.jav

ios - Adding multiple pages to a scrollview with interface builder -

i have been combing web on how add custom views uiscrollview interface builder have not found single clear example on how done. want create views using interface builder , display each of views within scroll view pages. of examples work images, increments, , programmatically creating colored views pages in scrollview. know how create pages scrollview using interface builder? if so, willing share example on how this? you need use uipageviewcontroller project. creates want. here clear example in form of tutorial requested may at: http://www.appcoda.com/uipageviewcontroller-tutorial-intro/ and here link doc's apple http://developer.apple.com/library/ios/documentation/uikit/reference/uipageviewcontrollerclassreferenceclassref/uipageviewcontrollerclassreference.html

java - JDBC Connection connected but no query result to the resultset -

i trying project has major problem. created table test2 attribute cid. added user cid using these command line in sql command line: create table test2(cid varchar(20)); insert test2 values('hello'); select cid test2; then result cid ----------------------- hello my question when tried use jdbc eclipe server, rs.next() false (rs resultset). have 'hello' inside table test2. here code, if me out this, appreciate it: public boolean connect(string username, string password) { string connecturl = "jdbc:oracle:thin:@dbhost.xxx.xx.xxx.ca:1522:ug"; try { con = drivermanager.getconnection(connecturl,username,password); system.out.println("\nconnected oracle!"); resultset rs; try { statement stmt = con.createstatement(); rs = stmt.executequery("select cid test2"); system.out.println("here"); while(rs.next())

Can I override a less-css function based on a class? -

for example html tag has class ie9 . want define default function , override definition when ie9 class exists: .word-break(){ word-break: break-word; } .ie9 { .word-break(){ word-break: break-all; } } div > p { .word-break(); } this not work intended. nothing happens in ie9. you need put selector inside mixin: .word-break() { .ie9 & { word-break: break-all; } } the & represents selector you're invoking mixin inside of. if write .ie9 { , generate div > p .ie9 , not want. putting & last moves original selector later.

mysql - Get column with same name from multiple tables using PHP -

ok, here have right now: $stuff = mysql_query("select * table1, table2") or die(mysql_error()); if ($info = mysql_fetch_array($stuff)) { $table1id = $info['table1.id']; $table2id = $info['table2.id']; } my problem not work. nothing. , when this: $stuff = mysql_query("select * table1, table2") or die(mysql_error()); if ($info = mysql_fetch_array($stuff)) { $table1id = $info['id']; $table2id = $info['id']; } it same id (of course). how id of first table , second table when have same name? mysql_fetch_array gives list using both names , numeric values, names going 'id' both, first 1 lost unless use alias rename them in sql. have numeric index, use $info[0] , $info[1] using alias instead: $query = "select table1.id id1, table2.id id2 table1, table2"; and use $info['id1'] , $info['id2'] (notice: mysql_*-functions deprecated)

java - Including Google Play Services to Android Studio project -

i've been trying include latest google play services library android studio project in order use push messages , maps api. since there plenty of tutorials on how include library on eclipse , cli , there no instructions on how include latest library on android studio. i've been searching on many sites , 1 of answers looked fitting looked this one , since other ones appear document older version, still appears i'm missing something. i've tried include lib same way included facebook library project (which oddly better documented android studio googleplay is) still looks i'm missing something. to so, i've copied whole folder <android-sdk>\extras\google\google_play_services\libproject\google-play-services_lib <project-path>\libraries\google-play-services_lib then in studio, tried add copied folder in module > add > import module, said in facebook documentation or in link provided. must forgetting gradle file, checking module property

java - I need help not using brute force when using JFrames and DrawWindows -

Image
i making basic hangman game , first time using jframes , drawwindows in java. here confusion lies: //this initializes window , panel global variables: jframe window = new jframe("let's play hangman!"); drawwindow panel = new drawwindow(); //this sets window , adds panel it: public hangmantwo() { window.setdefaultcloseoperation(jframe.exit_on_close); window.setbackground(color.white); window.setsize(500, 500); window.add(panel); window.setvisible(true); } //this next parts draws head onto window: public class drawwindow extends jpanel { public void paintcomponent(graphics g) { super.paintcomponent(g); g.setcolor(color.black); g.drawrect(50, 50, 75, 400); g.setcolor(color.lightgray); g.fillrect(50, 50, 75, 400); g.drawrect(100, 50, 150, 50); g.fillrect(100, 50, 250, 50); //draws noose , head g.setcolor(color.black); g.fillrect(250, 100, 1, 75); g.drawoval(220, 175, 60, 60); g.fillov

php - Mysqli LIKE statement not working -

i'm getting these weird errors, , i've been , down code, commenting , rewriting, , googling things. perhaps guys see i'm not seeing: $mysqli = new mysqli('host','login','passwd','db'); if($mysqli->connect_errno > 0){ die('cannot connect: '. $mysqli->connect_error); } // see if there 1 term or multiple terms if (count($search) == 1) { // if 1 term, search $like = $search[0]; $stmt = "select gsa_committees.id, gsa_committees.committee, gsa_committees.appointer, gsa_committees.representatives, gsa_committees.contact, gsa_committees.category, gsa_committees.attachments, gsa_committees.labels, gsa_committee_reports.committee, gsa_committee_reports.title, gsa_committee_reports.author, gsa_committee_reports.link, gsa_funds.id, gsa_funds.fund, g

git - Gitlab: Unable to clone by http (cloning by ssh works well) -

i'm running gitlab 5.4 , tried git clone http server. found out doesn't work though cloning ssh works well. here error: git clone http://myservername/gitlab/myrepo.git cloning '<repo>'... remote: not found fatal: repository 'http://<myservername>/gitlab/<repo>.git/' not found and here production.log output (no errors produced) started "/gitlab/<repo>.git/info/refs?service=git-upload-pack" xx.xx.xx.xx @ 2013-08-13 02:24:46 +0000 more info of issue here... gitlabhq issue#4766 i guess firewall maybe? web server should running. what on requesting url browser?

jquery - each function order by class number -

i have function, search class step1, step2, step3.... $(this).find('[class*="step"]').each(function(){ } i want run function ordering class number, like: <div class="myclass"> <div class="step4">..</div> <div class="step1">..</div> <div class="step3">..</div> <div class="step2">..</div> </div now first run, step1 step2 step3 , on i tried code: var i=1; $(this).find('.step'+i).each(function(){ i++; } is above code oky?? cuz running each function on single selector you need loop for(var = 1; <= 4; i++){ var step = $('.step' + i); //do step }

c++ - Undefined reference to 'boost::system::generic_category()'? -

it seems unable see obvious. wanted use boost library features project , know getting these nice errors of sudden: linking cxx executable atfor cmakefiles/atfor.dir/stdafx.cc.o: in function __static_initialization_and_destruction_0(int, int)': stdafx.cc:(.text+0x3c): undefined reference to boost::system::generic_category()' stdafx.cc:(.text+0x48): undefined reference boost::system::generic_category()' stdafx.cc:(.text+0x54): undefined reference to boost::system::system_category()' cmakefiles/atfor.dir/main.cc.o: in function __static_initialization_and_destruction_0(int, int)': main.cc:(.text+0x29d): undefined reference to boost::system::generic_category()' main.cc:(.text+0x2a9): undefined reference boost::system::generic_category()' main.cc:(.text+0x2b5): undefined reference to boost::system::system_category()' collect2: error: ld returned 1 exit status here find cmakelists.txt, headers, , main: http://pastie.org/8231509 c

ruby on rails - How get the error of ActiveRecord::Base.connection.execute? -

begin activerecord::base.transaction // ... sanitized_sql = "insert pinfo ..." activerecord::base.connection.execute(sanitized_sql) end rescue // how can error? end in webrick console, error ( 1967-07-16?00:00:00 ) shown as: execute (0.0ms) odbc::error: 22008 (241) [unixodbc][freetds][sql server]syntax error converting datetime character string.: insert pinfo (birthdate) values ('1967-07-16?00:00:00') execute (0.8ms) if @@trancount > 0 rollback transaction how can above error message ( odbc::error: 22008 (241) ... ) raised activerecord::base.connection.execute in rescue ? begin activerecord::base.transaction // ... sanitized_sql = "insert pinfo ..." activerecord::base.connection.execute(sanitized_sql) end rescue exception => exc logger.error("message log file #{exc.message}") flash[:notice] = "store error message #{exec.message}"

haskell - Customizing repsonse headers in Wai middleware -

i'm using wai-middleware-static serve custom pages server. however, saw server getting requests favicon.ico , etc. on every page load, , every single 1 of web fonts, decided check cache settings on response headers , found there none. wai-middleware-static returns middleware value, think callback function provided middleware run on every request. there way modify add in response header tell browser cache result? multiple middlewares can chained normal function composition, e.g.: middleware1 . middleware2 so if had middleware added cache settings response, should set. basic structure may is: addcachesettings :: middleware addcachesettings innerapp request = innerresponse <- innerapp request return $ myhelper innerresponse myhelper :: response -> response myhelper = error "your logic here"

mysqli - PHP - redirecting to other page if there are no results -

i redirect user other page if there no results. what meant is, passing variables via url , using on second page , if the variables empty able redirect page. however when user changes variable id in url index.php?product-tit/=how+to+deal+with%20&%20item-id-pr=15 to index.php?product-tit/=how+to+%20&%20item-id-pr= nothing displayed on page there way can redirect other page in above condition? $title = urldecode($_get['product-tit/']); $id = $_get['item-id-pr']; $mydb = new mysqli('localhost', 'root', '', 'database'); if(empty($title) && empty($_get['item-id-pr'])){ header('location: products.php'); } else{ $stmt = $mydb->prepare("select * products title = ? , id = ? limit 1 "); $stmt->bind_param('ss', $title, $id); $stmt->execute(); ?> <div> <?php $result = $stmt->get_result(); while ($row = $result->fetch_assoc()) { echo wordwrap($row['pri

c# - Parallel.For performance -

this code microsoft article http://msdn.microsoft.com/en-us/library/dd460703.aspx , small changes: const int size = 10000000; int[] nums = new int[size]; parallel.for(0, size, => {nums[i] = 1;}); long total = 0; parallel.for<long>( 0, size, () => 0, (j, loop, subtotal) => { return subtotal + nums[j]; }, (x) => interlocked.add(ref total, x) ); if (total != size) { console.writeline("error"); } non-parallel loop version is: (int = 0; < size; ++i) { total += nums[i]; } when measure loop execution time using stopwatch class, see parallel version slower 10-20%. testing done on windows 7 64 bit, intel i5-2400 cpu, 4 cores, 4 gb ram. of course, in release configuration. in real program trying compute image histogram, , parallel version runs 10 times sl

No Inhouse option in member center - IOS distribution -

Image
there's no in-house option while creating distribution profile. idea why? i create certificate using in-house , ad-hoc options. not able create distribution profile in house distribution

compiler construction - Why do I have to specify data type each time in C? -

as can see code snippet below, have declared 1 char variable , 1 int variable. when code gets compiled, must identify data types of variables str , i . why need tell again during scanning variable it's string or integer variable specifying %s or %d scanf ? isn't compiler mature enough identify when declared variables? #include <stdio.h> int main () { char str [80]; int i; printf ("enter family name: "); scanf ("%s",str); printf ("enter age: "); scanf ("%d",&i); return 0; } because there's no portable way variable argument functions scanf , printf know types of variable arguments, not how many arguments passed. see c faq: how can discover how many arguments function called with? this reason there must @ least 1 fixed argument determine number, , maybe types, of variable arguments. , argument (the standard calls parmn , see c11( iso/iec 9899:201x ) §7.16 variable arguments ) pla

python - OrderedDictionary.popitem() unable to iterate over all values? -

i try iterate on ordered dictionary in last in first out order. while standard dictionary works fine, first solution ordereddict reacts strange. seems, while popitem() returns 1 key/value pair (but somehow sequentially, since can't replace kv_pair 2 variables), iteration finished then. see no easy way proceed next key/value pair. while found 2 working alternatives (shown below), both of them lack elegance of normal dictionary approach. from found in online help, impossible decide, assume have wrong expectations. there more elgant approach? from collections import ordereddict normaldict = {"0": "a0.csf", "1":"b1.csf", "2":"c2.csf"} k, v in normaldict.iteritems(): print k,":",v d = ordereddict() d["0"] = "a0.csf" d["1"] = "b1.csf" d["2"] = "c2.csf" print d, "****" kv_pair in d.popitem(): print kv_pair print "++++&quo

visual studio - When I declare Random inside my loop in C#, it gives me nonrandom numbers - declaring it outside my loop gives me random numbers. Why? -

this question has answer here: random number generator generating 1 random number 9 answers i'm creating deck of cards. when try shuffle, getting weirdness. the constructor before calling program goes through following loop (pseudo code,inclusive)- for in (0,13): j in (0,3): new card(i,j) this simplified form,anyway. card number , suit generated. problem code (c#): private void shuffle() { list<card> newlist = new list<card>(); while (cards.count > 0) { random r = new random(); int next = r.next(0,cards.count); console.writeline(next); card cur = cards.elementat(next); newlist.add(cur); cards.remove(cur); } this.cards = newlist; } this gives me semi-predictable output - i.e. following: 18 18 18 17 17 17 16 16 15 15 15 14 14 14 13 13 13 12 12 12 11 11 11 10 10 1

Sencha Touch - How to hide custom button when touch back button? -

i create custom button in navigation view in homepanel.my project have 3 viewport.when push navigation view , push button custom button hide.but when push navigation view , push showsearchcategory view navigation view , when push button showsearchcategory view in navigation view isn't hide custom button. where code wrong? my controller ext.define('catalog.controller.main', { extend: 'ext.app.controller', config: { refs: { homepanel: 'homepanel', but: 'homepanel #category', categorybutton: 'button[action=categories]', list:'list', homepanellist: 'homepanel #applist', navigationlist: 'navigation #catlist', navigation: 'navigation', showsearchcategorylist: 'showsearchcategory list' }, control: { homepanellist:{ itemtap: 'showapp'

python - Problems with finding QWebElements by tag in PySide -

i using qgraphicswebview , trying iterate on qwebelements. @ first tried : frame = self.page().mainframe() doc = frame.documentelement() h = frame.findfirstelement("head") b = frame.findfirstelement("body") elements = h.findall("link") d in elements : print d.tagname() so see thought but, later on find there's elements in qwebelementcollection, not in list. please me iterating on dom tree. a qwebelement 's findall method returns qwebelementcollection , can converted qlist instance it's tolist() method. iterate on list of matched elements, use: body_element = frame.findfirstelement("body") el in body_element.findall("div").tolist(): print el.tagname()

java - Difference between @GeneratedValue and @GenericGenerator -

sometimes find them together, alone... other times seem same. what's difference? here 3 examples. of different? why can't use @generatedvalue of them? example 1 @id @generatedvalue(generator="increment") @genericgenerator(name="increment", strategy = "increment") long id; example 2 @id @generatedvalue(strategy=generationtype.sequence) private int userid; example 3 @elementcollection @jointable(name="address", joincolumns=@joincolumn(name="user_id") ) @genericgenerator(name="hilo-gen", strategy="hilo") @collectionid(columns = @column(name="address_id"), generator = "hilo-gen", type = @type(type="long")) collection<addr> listofaddresses = new arraylist<addr>(); when using orm necessary generate primary key value. the @generatedvalue annotation denotes value column, must annotated @id generated. elements strategy , generator on ann

How to style a custom TreeCell with CSS in ScalaFX? -

i want change background colour of custom treecell using css, setting style property on tree cell doesn't work. can style tree alternate yellow , grey cells css file looks this: .tree-cell:disabled { -fx-padding: 3 3 3 3; -fx-background-color: white; } .tree-cell:selected { -fx-background-color: blue; } .tree-cell:even { -fx-background-color: yellow; } .tree-cell:odd { -fx-background-color: grey; } .tree-cell:drag-over { -fx-background-color: plum; } and change fill style of text event handler looks this: ondragentered = (event: dragevent) => { val db = event.getdragboard if (db.hascontent(customformat)) { textfill = color.deepskyblue style() = "tree-cell:drag-over" } event.consume() } but style of tree cells doesn't change. i found answer own question. css file looks this: .tree-cell:disabled { -fx-padding: 3 3 3 3; -fx-background-color: white; } .tree-cell:selected {

Rotation of object (using its images) on button click using javascript/jquery -

i using jquery plugin showing rotation of object using objects images(images captured every angle).rotation working fine on mouse click.the thing want make rotation possible of buttons(i.e.,left ,right,top,down buttons) .on clicking left button images must show rotation clockwise or left direction , vice-versa.can me please i have try following code : $(function(){ $('#image').reel({ frames: 20, frame: 14, footage: 10, rows: 13, row: 8, cw: true, inversed: false, speed: 0, images: 'drilbit/drilbit_normal_###.png', cursor: 'move', preloader: 3, draggable: true, wheelable: true, throwable: true, //steppable:true, }); }); in reel plugin documentation described in this (annotated source code) process. triggering stepright , stepleft events on reel object performs adequate

java - Prefuse - is it possible to translate keys used in legend? -

i'm using prefuse library java. everything seems working fine, application won't used in english language. i need translate used keys , words (for example in legend or search) other language (slovak example). i'm using prefuse.data.graph , prefuse.data.tree. thanks in advance i able find solution... actually, looking in wrong sources. legends , panels needed translated part of owl2prefuse.jar using. there keys hardcoded in sources.

javascript - How can I send a data to an iframe from main page when I working another iframe? -

this question has answer here: how communicate between iframe , parent site? 4 answers i have question data transfer on iframes can seen in picture below http://img703.imageshack.us/img703/143/qcvf.jpg my main page has 2 iframe. how can send data textbox iframe_b main page when working iframe_a? thanks. you can try set iframe's src hash, , detect hashchange within iframe. $(window) bind hashchange how check part hash changed? if want set data iframe in script directly, remember, not sure, if src of iframe different host, cannot, security reason.

r - Regression with indicator -

i have dataset 1 dependent variable y, , 2 independent x(continuous) , z(indicator 0 or 1). model fit is y = a*1(z==0) + b*x*1(z==1), in other words, if z==0 estimate should intercept, otherwise estimate should intercept plus b*x part. the thing have come in 2 steps, ie first take mean of y z==0 (this estimate of intercept), , subtract value rest of ys , run simple regression estimate slope. i (almost) sure work, ideally estimates in one-liner in r using lm or similar. there way achieve this? in advace! you can define new variable 0 if z 0, , equal x otherwise: y ~ ifelse(z, x, 0)

c# - How to use substring and how to break down one variable into two variables? -

i have been struggling solve problem when used substring. c# : string sinput = "vegetable lasgane { receipt: cheese sauce etc...}"; what want : remove "{", "receipt:" , "}" using substring then break down sinput new 2 variables such as: from : string sinput = "vegetable lasgane { receipt: cheese sauce etc...}"; to: string smeal = "vegetable lasgane"; string sreceipt= "cheese sauce etc..."; how in c#? code example apprecaited. thanks!! just use string.substring , string.indexof methods this; string sinput = "vegetable lasgane { receipt: cheese sauce etc...}"; string smeal = sinput.substring(0, sinput.indexof('{')); console.writeline(smeal); //vegetable lasgane string sreceipt = sinput.replace('{', ' ').replace('}', ' '); sreceipt = sreceipt.substring(sreceipt.indexof(':') + 1).trim(); console.writeline(sreceipt); //chee

webview - LinkedIn Follow Button - viewport change on android 2.2 & 2.3 when button is loaded -

i have problem linkedin follow button. developing responsive website mobile devices. using meta android browsers: <meta content='true' name='handheldfriendly' /> <meta name="format-detection" content="telephone=no" /> <meta name="viewport" content="initial-scale=1, width = device-width, height = 0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" /> on old android devices (2.2 & 2.3) (on ipad, galaxy tab, iphone , new android devices ok) when content , javascripts loaded seems ok. after load following srcipts: <script src="//platform.linkedin.com/in.js" type="text/javascript">lang: en_us</script> <script type="in/followcompany" data-id="myid" data-counter="right"></script> white space of around 200x200px emerges right of follow button , device.vieport().width changes causing webview scrollable. funny thing if place bu

Python search and copy files in directory -

i'm new python please excuse ignorance. i looking create way of searching 1 text file list of files conform search criteria. using results search through/recurse directory files, , copy them 1 master folder. essentially have text file has loads of file names, have managed search through file , retrieve files ending '.mov', , print/output result text file. there may dozens of files. how can use results recursively search through directory , copy files new location. or, going in totally wrong way? many thanks! import os, shutil # first, create list , populate files # want find (1 file per row in myfiles.txt) files_to_find = [] open('myfiles.txt') fh: row in fh: files_to_find.append(row.strip) # recursively traverse through each folder # , match each file against our list of files find. root, dirs, files in os.walk('c:\\'): _file in files: if _file in files_to_find: # if find it, notify , copy it c:\n

sql - Updating a table with a groupwise maximum MYSQL? -

i had table duplicate user_ids many 1 relationship tasks , payment. i used groupwise maximum on tasks return rows had highest task completion percentage. update new table highest payment completion stats same table. for example: id date taskid payid task_completion pay_value 4722 2007-11-08 16:20:14 2 3 7.14 0 4722 2007-11-08 16:20:14 3 3 0.00 0 4722 2007-11-08 16:20:14 5 3 0.00 0 4722 2007-11-08 16:20:14 2 6 7.14 40 4722 2007-11-08 16:20:14 3 6 0.00 40 4722 2007-11-08 16:20:14 5 6 0.00 40 4724 2007-11-20 15:32:40 4 7 25.71 105 4726 2008-01-28 11:44:50 7 8 7.14 52 4726 2008-01-28 11:44:50 8 8 34.29 52 4726 2008-01-28 11:44:50 10 8 65.71 52 4726 2008-01-28 11:44:50 7 9 7.14 24 4726 2008-0

ios - UIAlertview not accepting string as message -

i have response webservice uialertview giving strange error i have printed respnse , below called 2013-08-13 15:40:27.463 ipad qld[1459:907] result { msg = "form has been sent successfully."; status = success; } 2013-08-13 15:40:27.465 ipad qld[1459:907] -[__nsdictionarym isequaltostring:]: unrecognized selector sent instance 0x1f1168e0 2013-08-13 15:40:27.467 ipad qld[1459:907] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[__nsdictionarym isequaltostring:]: unrecognized selector sent instance 0x1f1168e0' *** first throw call stack: (0x32dad2a3 0x3ac1197f 0x32db0e07 0x32daf531 0x32d06f68 0x34bb9375 0x34d05c95 0x34d05741 0x6a25b 0x32cfe037 0x336ae2cb 0xa013f 0x9fe35 0x8d1e7 0x336e86fd 0x336281f9 0x33628115 0x32a8a45f 0x32a89b43 0x32ab1fcb 0x32cf374d 0x32ab242b 0x32a1603d 0x32d82683 0x32d81f7f 0x32d80cb7 0x32cf3ebd 0x32cf3d49 0x368aa2eb 0x34c09301 0x43a85 0x3b048b20) libc++abi.dylib: terminate called throwin

How to use CallFuncND in cocos2d for android -

i want call method thrice different parameters , need have delay between calling them,inorder want use cccallfuncnd ,but unable implement in code, please me giving simple example of how call cccallfuncnd . my code : this.runaction(cccallfuncnd.action(this, "shift_sec", "1")); public void shift_sec(string v) { system.out.println("coming method. : "+v); } i illustrate example: cccallfuncnd.action(this, "hitcallback", data) here this--> target i.e sender "hitcallback"-------> string being called. data -----------> object send public void hitcallback(object sender,object data){ ccsprite hitspotsprite = (ccsprite)data; hitspotsprite.removefromparentandcleanup(true); hitspotsprite = null; } in case shift_sec(string v){} being modified shift_sec(object sender,object data){}