Posts

Showing posts from July, 2014

javascript - Dynamically changing which button is pressed with "enter" -

i have form 2 buttons , text inputs. default if press enter "click" first button. i'd make if type in either of text boxes, if press enter second button 1 clicked. in simplified example below, pressing enter default "click" log in using facebook button. happen if entered in email or password text inputs. i'd if entered in either email or password inputs, pressing enter "click" login email/password button. <form> <button class="login-facebook">log in facebook</button> <input type="text" class="email" placeholder="email"><br> <input type="password" class="password" placeholder="password"><br> <button class="login-password">log in email/password</button> </form> goal like: $('.email').add('.password').on('change', function() { $('.login-password').

What is the correct why to get EclipseLink JPA query.getResultList() results in the cache? -

when use eclipselink jpa query.getresultlist() doesn't store results in cache when call merge first call select update each object. what's correct query results in cache? i'm thinking query call entitymanager find each result - seems wrong. can't call find first don't know object id. basically want cache data in-memory (in cache) , have updates quick possible. thanks eclipselink caches every object returned getresultlist() in shared (l2) cache default. if not getting caching, have mis-configured something. please include code, configuration, , sql log. are using spring? (see http://www.eclipse.org/forums/index.php/t/200321/ ) ensure have not disabled shared cache, or configured refreshing. how many object reading, , how long query merge? if reading lot of objects, may need increase cache size (default 100), or change cache type. see, http://wiki.eclipse.org/eclipselink/userguide/jpa/basic_jpa_development/caching

java - Maven build doesn't include hibernate cfg.xml or hbm.xml files -

i'm building , executable-jar jar doesn't include cfg or hbm hibernate files. pom file contains following: <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-jar-plugin</artifactid> <version>2.3.2</version> <configuration> <archive> <manifest> <addclasspath>true</addclasspath> <mainclass>com.mycompany.myproject.mymainclass</mainclass> </manifest> </archive> </configuration> </plugin> </plugins> </build> i'm using following build it: mvn clean package shade:shade i errors hibernate cfg , hbm files cannot found. any ideas? i've burned many btus on already. in advance. put files in src/mai

c# - Change originating IP - circumventing caching of connections -

i need call same api many times, different ip's based on parameters. i've implemented code in question: how change originating ip in httpwebrequest this worked when needed specify single ip api calling, need use several ips based on requirements, , method no longer seems work. api url seems cached , subsequent calls use ip, instead of specific 1 wish set on every call. i need method let me choose source ip each request. adding: if split application 2 separate apps, each 1 using own source ip, brute force approach force work? in other words, caching performed per process? (i assume so). using httpwebrequest.connectiongroupname should able around servicepoint connection reuse. var hr = (httpwebrequest)webrequest.create("http://google.com?"); hr.connectiongroupname = hr.requesturi.tostring(); //different connection pool per url. might better make random. hr.getresponse(); alternatively can force close group using servicepoint.closeconnectiongr

coffeescript - CouchDB complex keys problems - only first two part of array are taken for the range -

somethings wrong couchdb complex query processing. i have map function emits complex key consisted of 6 params this: emit([doc.profileid, doc.beamid, doc.name, doc.beambeanchid, "true", attachname], {beamdocid:doc._id, attachname:attachname}) my query parameters (coffescript) this: params = startkey:[ profileid, beamid, nameprefix, beambeanchid, hasattach, attachnameprefix] endkey:[ profileid or "\ufff0", beamid or "\ufff0", nameprefixend or "\ufff0", beambeanchid or "\ufff0", hasattachend, attachnameprefixend or "\ufff0"] the problem 2 first working properly, rest not filtering @ all. instance when set nameprefixend value not null it's not reducing result. i tried keys emmited objects , arrays. same story, first 2 working. third ignored. when change order instance beamid nameprefixend still first 2 working properly. any ideas what's wrong? there limits on number of parameters in couchdb

database - phpmyadmin export as gzip, bzip and zip gives network error -

i try export database via phpmyadmin, can export without compression when choose sort of copression such gzip, bzip or zip ends network error (chrome), source file not read (firefox). i changed zlib.output_compression = off on in php.ini on localhost , fixed problem

nullpointerexception - NPE while running unit test in scalatest -

i'm getting nullpointerexception don't understand. subclass(false, org.scalatest.suite) arguments: java.lang.nullpointerexception @ org.scalatest.tools.scalatestframework$runconfig$.decreaselatch(scalatestframework.scala:176) @ org.scalatest.tools.scalatestframework$scalatestrunner.run(scalatestframework.scala:336) @ org.scalatools.testing.runner2.run(runner2.java:16) @ sbt.testrunner.delegaterun(testframework.scala:57) @ sbt.testrunner.run(testframework.scala:51) @ sbt.testrunner.runtest$1(testframework.scala:71) @ sbt.testrunner.run(testframework.scala:80) @ sbt.testframework$$anonfun$6$$anonfun$apply$8$$anonfun$7$$anonfun$apply$9.apply(testframework.scala:178) @ sbt.testframework$$anonfun$6$$anonfun$apply$8$$anonfun$7$$anonfun$apply$9.apply(testframework.scala:178) @ sbt.testframework$.sbt$testframework$$withcontextloader(testframework.scala:190) @ sbt.testframework$$anonfun$6$$anonfun$apply$8$$anonfun$7.apply(testframework.scala:178) @ sbt.testframework$$anonfun$6$

Jquery mobile ajax calls not working in blackberry -

my app working fine on android, there still 1 problem unable figureout, in blackberry phonegap related functions working ajax calls (which calls a file on webserver data feeds) not working @ on blackberry, shows loading state never loads , same feature works beautifully on android any ? thank

javascript - Button set on Disabled but still I can click on it -

this haml code have: %a.btn.btn-primary.personlistbtn{href:patients_path, :target => "_blank", :disabled => 'disabled'} person list and how looks on inspect element: <a class="btn btn-primary personlistbtn" disabled="disabled" href="/patients" target="_blank">person list</a> so have set disabled , , how looks disabled because color lighter other normal buttons still if click on it, working. have onclick code javascript part: $('.personlistbtn').click(function(e) { e.preventdefault(); window.open("http://localhost:3000/patients?provider="+provider_id+"&"+"therapeutic_class="+thera_class); }); is js culprit? or how should fix this? you creating link (the %a ) , giving link button class. disabled attribute styling button doesn't disable links. need link or can use button?

What's the proper syntax to set a Powershell filter variable based on multiple values? -

i have powershell script processes files in directory based on selection criteria. 1 run, need act on html files, i'm using following code. $bkppath = "\\filepath" $selectionfilter = "*.htm*" $srcfiles = get-childitem $bkppath -filter $selectionfilter foreach($doc in $srcfiles) { do-stuff } for run, need act on that's not related to html in directory, want exclude *.htm* , *.js , *.ico , *.xml . i've not been able find proper syntax applying multiple values selectionfilter variable. i need this: $selectionfilter = !("*.htm*" or ".js" or "*.xml" or "*.ico") or $srcfiles = get-childitem $bkppath -filter !("*.htm*" or ".js" or "*.xml" or "*.ico") both of give me syntax error. i've not been able find on msdn covers how handle multiple values this. can please point me in right direction? while -exclude *.ico, *.js, *xml correct syntax e

windows - Java add line to specific part of text file -

comments below answering question, way me ask new question... okay. program writing info on .txt file. writing info end of text file so: t/1/15/12 o/1/12/3 o/2/15/8 ... (lots of lines this.. different numbers) o/1/16/4 then.. when add line using: bufferedwriter fw = new bufferedwriter(new filewriter(new file("c://users/mini/desktop/eclipse/japda/map/" +numbers.map +".txt"), true)); fw.newline(); fw.write(rightpanel.mode.charat(0) +"/" +id +"/" +numbers.middlex +"/" +numbers.middley); fw.close(); it adds line want end of text file.. write line specific part of text files.. know number of line want write it.. (it calculated depending on other lines..) :d there way it? or best way edit 1 specific line in middle of text file? to achieve require, need use randomaccessfile. steps: first create randomaccessfile then: create variable called linestart set 0 (beginning of file) rea

javascript - jQuery .fadeOut() blocking div under -

i checking example of slideshow , found strange behavior. i using code image under not show until above 1 done fading out. why? expected image #above fade out image #under . (note #above has z-index:10; ) <div id="current_image"> <img width="370" id="above" src="... <img width="370" id="under" src="... </div> jquery $(document).ready(function () { $(".small_image").click(function () { event.preventdefault(); var image = $(this).prop("rel"); var above = $('#above'); var under = $('#under'); under.prop('src', image); above.fadeout(1000, function () { above.prop('src', under.prop('src')).css('display', 'block'); }); }); }); fiddle the problem 2 images in #current_image div not on top of 1 another, 1 image vertically above other

powershell - Script to move folders with specific names and characters -

i looking write script move existing folders "-" hyphen in name parent folder part of same name. example: i move c:\12345-01 c:\12345\ c:\12345\12345-01. the problem number of characters before hyphen not same, 3-6 characters before hyphen. have found couple of snipets here , elsewhere close, won't work specify number of characters in file name for each objfile in objfolder.files strname = left(objfile.name, 3) this work if filenames 3 characters. does makes sense? cd 'c:\directory\of\folder\where\number\files\located' gci | ? {$_.psiscontainer -eq $true} | % { ` $file = $_.name $loc = $file.indexof('-') $folder = $file.substring(0,$loc) new-item -path . -itemtype directory -name $folder -erroraction silentlycontinue move-item $file $folder }

Deploying Custom Cartridges on Openshift Origin -

i have created new custom cartridge, in have packaged rpm using tito , installed using yum. cartridge being copied spec file /usr/libexec/openshift/cartridges directory, however, when log origin home site , try create application cartridge not show up. went digging in ruby scripts , found there script named cartridge_cache.rb seems caching cartridges finds within /usr/libexec/openshift/cartridges directory. have tried origin reload cache include new cartridge removing cache files within /var/www/openshift/broker/cache directory restarting broker, have had no success. there somewhere need hardcode cart name global variable or ? basically, know how custom cart show on webpage creating new application. update : ran slide deck had 1 slide on how install cartridge. however, still have had no success, here have tried since previous post: moved cartridge directory /usr/libexec/openshift/cartridges /usr/libexec/openshift/catridges/v2 ran command oo-admin-cartridge -a install -s /u

Python's Logical Operator AND -

i'm little confused results i'm getting logical operators in python. i'm beginner , studying use of few books, don't explain in detail i'd like. here own code: five = 5 2 = 2 print 5 , 2 >> 2 it seems outputting 2 variable. five = 5 2 = 2 0 = 0 print 5 , 2 , 0 so, added variable integer. printed , got following output: >> 0 what going on python in background? why isn't output 7 or 5, 2. python boolean operators return last value evaluated, not true/false. docs have explanation of this: the expression x , y first evaluates x ; if x false , value returned; otherwise, y evaluated , resulting value returned.

c# - Set Combo Box in Datagridview Column -

i have datagridview (dgvtable) 2 columns. first column contains combo boxes preset data database. second column text. trying set selection of combo boxes in first column based on information in second. i simplified code bit need with: string data = "match variable"; foreach (datagridviewrow row in dgvtable.rows) { if (match.equals(row.cells[1].value.tostring())) //checking see if second column value matches data { row.cells[0].value = "help"; //if second column value == data set combobox selected value "help" } } the combo boxes doesn't show value edit: started new project , made datagridview , added columncombobox. did set value of combobox successfully. difference trying change datagridview combobox value in separate window. change anything? dropdownlist ddl = (dropdownlist)e.row.findcontrol("ddlname"); ddl.selectedvalue = "help";

mysql - PHP encoding issues -

i uploaded new site, , having strangest issue. have ajax/php search box displays search results user typing. reason on live site search results aren't encoded properly. @ times displays correctly, 2 seconds later results this: ���ak� �� �a<��l��&c-�f�2j�m����v��_ �]v��x���x�q���(|È©Îœo����-x������q�ÊŽ�(n��(�����s�8�u�� �}¸�l���:(�j��n����c����:��u�x�óž‘™=���9se-�j�{����� r�՞b1ؑ�ov�*[nzp"t5�(�h�� mh���mg��̆1z�����"�p��g�9e�dd_r�����8n%���.j^������g7��c8�hs��}�qa�$ i uploaded site different web host during development , did not have issue. i've tried utf8_encode() doesn't help. else on site looks fine, it's search results. suggestions appreciated. you may need add following between head tags. <meta http-equiv="content-type" content="text/html; charset=utf-8">

sqlite3 - Novice: Sqlite from php -

i new php , wish read data sqlite database. i have got hello world work correctly following 2 scripts failed execute without error: <?php echo sqlite_libversion(); ?> <?php print_r(sqlite3::version()); ?> the first script gives error: fatal error: call undefined function sqlite_libversion() the server on have website has following php configuration. http://php.binerorockar.se/ where shows: pdo_sqlite: pdo driver sqlite 3.x enabled do have sqlite3 support? how can test support? there several ways access sqlite php. in examples, using sqlite , sqlite3 extensions php. have neither of these extensions installed in php system. you have sqlite driver pdo installed. generic api sqlite , other databases. syntax sqlite software version. // connect in-memory sqlite database $db = new pdo("sqlite::memory"); echo $db->query("select sqlite_version()")->fetchcolumn(); to use sqlite specific api functions, need u

VbScript to strip space of string? -

say have string = grilled cheese how echo string without space between grilled cheese out changing string? also if had string variables have space, full name. can show first letter of string: wscript.echo left(strusername, 1) echo example g but how show name after space (= cheese). keep in mind name after space may change "cheesy" example wscript.echo mid(strusername,null) not work thanks! the replace function can used remove characters string. if echo return value without assigning variable, original string remain unchanged: >>> str = "grilled cheese" >>> wscript.echo replace(str, " ", "") grilledcheese >>> wscript.echo str grilled cheese another option split , join functions: >>> str = "grilled cheese" >>> wscript.echo join(split(str, " "), "") grilledcheese >>> wscript.echo str grilled cheese split allow echo particu

java - PlayFramework - Error when deploying to Heroku (pgsql 'user' table) -

i have been writing application using play (great framework, can't fault it). however, i'm getting weird error when pushing app heroku. 2013-08-12t15:52:17.641129+00:00 app[web.1]: [←[31merror←[0m] play - error: synt ax error @ or near "user" 2013-08-12t15:52:17.744588+00:00 app[web.1]: position: 14 [error:0, sqlstate:4 2601] that's seems going wrong. weird aspect of error fact don't have tables or references 'user' in sql-related code (evolutions, models , database). issue being cached? thanks in advance, adil edit i seem have fixed error: i deleted evolution scripts, reason filled data didn't need (e.g sql scripts create 'user table') i updated references user table (even class names) 'appuser' (this changeable). i ran sql queries on pgsql database directly, creating tables manually. i disabled evolutions plugin , removed jdbc username , password when committing heroku. postgresql has default "

How to write dynamic cumulative multiple in R -

suppose have vector x as: x <- c(x1, x2, x3, ..., xn) i want write function automatically result series this: y <- c(x1, x1*x2, x1*x2*x3, ..., x1*x2*x3*...*xn) can tell me how in r? have @ ?cumprod : cumprod(1:10) # [1] 1 2 6 24 120 720 5040 40320 362880 3628800

ios - Using a CollectionView to add a tile effect when the user types -

i have test application have made part of workflow. trying achieve fancy way of showing user typing word styled game. at moment approach there easier/better route. have uitextfield not shown user , keyboard shown on viewdidload . trying have happen each time letter pressed on keyboard new tile showing letter capitalised added screen area above i.e. 'w', letter mean tile added i.e. 'i' next previous... i have setup uicollectionview , custom cell label in, all. vc datasource of uicollectionview . uitextfield has delegate set self (the vc). i cannot work out how have tiles (cells) created each letter. #pragma mark - #pragma mark - key board delegate methods -(bool)textfield:(uitextfield *)textfield shouldchangecharactersinrange:(nsrange)range replacementstring:(nsstring *)string { nslog(@"%s",__pretty_function__); nsstring *lastlettertyped = [textfield.text substringfromindex:[textfield.text length] - 1]; [self.wordarray addobject:lastlette

javascript - Best DOMContentLoaded fallback -

what best way fallback of domcontentloaded not supported < ie9? document.addeventlistener('domcontentloaded',function(){/*code here*/}) from mdn : internet explorer 8 supports readystatechange event, can used detect dom ready. in earlier version of internet explorer, state can detected regularily trying execute document.documentelement.doscroll("left") , snippet throw error until dom ready.

mysql - Auto incrementing a non-unique id upon creation using SQLAlchemy -

my primary goal make implementing revision histories , journaling easier. i found myself wondering if it's possible, using flask-sqlalchemy (or straight sql), auto incremented non-unique integer mysql. i found stack overflow post close want question focused on primary key. example, if table had these columns, revision_id = db.column(db.integer, nullable=false) post_id = db.column(db.integer, nullable=false) __table_args__ = ( primarykeyconstraint('post_id', 'revision_id'), ) would possible create new post has revision_id of 1 , post_id of max(post_id) + 1 without problem of 2 users attempting create post @ same time , creating same post_id? the advantage of system makes post history (and differencing) simple. whenever wants modify post i'd use same post_id original , increment revision_id (which, i'm typing out, has same problem). update: sylvain leroux put me on right track how solve problem. needed set both tables primary key in sqla

bash - imagemagick convert individual frame delay in gif -

i have directory full of images want turn gif. each file name follows pattern: <zero_padded_index>_<delay_in_milliseconds>.gif example: 00001_1432.gif i can create gif animation imagemagick: convert -loop 0 -delay 10 *.gif out.gif the problem is, want each frame have different delay based on second digit in it's name. convert -delay 0 -loop 0 *.gif output.gif gif in *.gif; name=${gif%.gif} index=$(echo ${name%-*} | sed 's/0*//') delay=${name#*-} # 1. convert milliseconds w/e imagemagick -delay uses. # 2. update frame @ correct index. done; do incrementally build gif? or go , change them after fact? imagemagick chops not par. so if approaching problem i'd following ( if understand correctly ) given following files: [root@dev7 ~]# ls -lta so/ total 728 drwxr-xr-x 2 root root 4096 aug 13 18:35 . dr-xr-x---. 17 root root 4096 aug 13 18:35 .. -rw-r--r-- 1 root root 18933 aug 13 18:23 00007_1432.gif -

ruby on rails - Why are all of my file field inputs disabled on iPad -

in rails 4 app have form 2 file field inputs upload s3: <form accept-charset="utf-8" action="/projects" class="new_project" enctype="multipart/form-data" id="new_project" method="post"> <input id="project_videos_attributes_0_poster" name="project[videos_attributes][0][poster]" type="file"> .... <input class="js-s3_file_field" data-acl="public-read" id="project_gifts_attributes_0_file" name="project[gifts_attributes][0][file]" type="file"> </form> the first file field uses carrierwave, , other hooked s3_file_field gem direct upload s3, both disabled when page viewed on ipad. no other platform/vendor has issue. it's seen when inputs presented in isolation too. i'm wondering if turbolinks has ipad specific issues. rails ujs culprit? it's worth, here's code s3_file_field gem uses hijack second

regex - Using perl, how to convert sql block in logs to proper sql? -

i have hugh log file sql debugs. want change them proper sql. for example in logs: **** debug fri aug 09 13:05:13 pdt 2013 1376078713845 /atg/web/viewmapping/viewmappingrepository executeupdate2: [++sqlinsert++] **** debug fri aug 09 13:05:13 pdt 2013 1376078713845 /atg/web/viewmapping/viewmappingrepository insert vmap_pv2pvad_rel(view_id,name,attr_id) **** debug fri aug 09 13:05:13 pdt 2013 1376078713845 /atg/web/viewmapping/viewmappingrepository values(?,?,?) **** debug fri aug 09 13:05:13 pdt 2013 1376078713845 /atg/web/viewmapping/viewmappingrepository -- parameters -- **** debug fri aug 09 13:05:13 pdt 2013 1376078713845 /atg/web/viewmapping/viewmappingrepository p[1] = {pd} ampvpuroleallmembers (java.lang.string) **** debug fri aug 09 13:05:13 pdt 2013 1376078713845 /atg/web/viewmapping/viewmappingrepository p[2] = {pd} synthcategorydefinition (java.lang.string) **** debug fri

java - NinePatch rendering issue on TextButton background (libgdx) -

Image
i'm testing out using stage main menu simple button using ninepatch button background. the code set looks this: ninepatch textbutton setup ninepatch btnnormal9 = ninepatchhelper.processninepatchfile("data/button_normal.9.png"); ninepatchdrawable btnnormal9drawable = new ninepatchdrawable(btnnormal9); textbuttonstyle style = new textbuttonstyle(btnnormal9drawable, btnnormal9drawable, btnnormal9drawable); style.font = new bitmapfont(); style.fontcolor = new color(1, 1, 1, 1); button = new textbutton("start game", style); button.setsize(200, 100); button.setposition(0, 0); stage.addactor(button); in resize function i'm doing now: resize code @override public void resize(int width, int height) { camera.viewportwidth = width; camera.viewportheight = height; camera.update(); } regardless of size of window (which size of camera viewport), button should @ (0,0) on screen , 200 pixels 100 pixels. the ninepatch image ("data/b

ruby - A blank in the URI works in production but fails in development -

i have following code works in production: redirect_to "/mycontroller/index.html#&panel1-2?error=invalid member id and/or date of birth" in development(using webrick), getting following error message: error uri::invalidurierror: bad uri(is not uri?): http://localhost:3000/mycontroller/index.html#&panel1-2?error=invalid member id and/or date of birth but if copy , paste supposedly bad uri in browser address bar, works! i have tried various combinations of error message text, , spaces between words causing it. can make work using uri.escape or other technique escape spaces, have change hundreds of such occurrences in code working fine. thanks taking time help. as shown below, uri invalid. can't have unescaped spaces in uri. 1.9.3p194 :001 > require 'uri' => true 1.9.3p194 :002 > uri.parse('http

extjs4 - ExtJS 4.2 - Bind Grid to FieldSet - FieldSet is Not Updating - MVC -

Image
i have grid populates service call (soap/xml) store. grid populates fine; however, when select item in grid, trying bind value fieldset. when selecting item in grid, debug , see model selected item has been updated properly, when loadrecord, fieldset not update. not errors, fieldset not updating. here sample code. trying minimize as possible because using mvc , application starting large. phonecallsmodel.js - ext.define('dg.model.phonecallsmodel', { extend: 'ext.data.model', fields: [ {name: 'employeessn'}, {name: 'callrsn'}, {name: 'calldt'}, {name: 'calltype'}, {name: 'callfor'}, {name: 'callername'}, {name: 'callnotedesc'} ] }); phonecallsstore.js - ext.define('dg.store.phonecallsstore', { extend: 'ext.data.store', config: { storeid: 'phonecallsstore', model: 'dg.model.phonecall

python - When I use VIM via terminal, I keep getting duplicate files with a ~ appended to the end. What are these? -

this question has answer here: why vim save files ~ extension? 8 answers for example, i'll use vim code python script , save file. when navigate directory saved in , use ls command, comes: test_file.py test_file.py~ are these backup files? yes, files end tilde ( ~ ) backups of files right before edited it. these backups handy if experience crash. if want save them in directory, can add .vimrc: set backupdir=~/vim_tmp,. set directory=~/vim_tmp,. where ~/vim_tmp directory want store backup files.

.htaccess Rewrite index.php back to directory where index.php is located -

i have directory of localhost/testing/pages/index.php how redirect user localhost/testing/pages/ whenever enter localhost/testing/pages/index.php index.php extension? i have tried use this: rewriteengine on rewrite %{request_filename} !-f rewriterule ^([^\.]+)$ $1.php [nc] but not work. thanks! try: rewritecond %{the_request} ^[a-z]{3,9}\ /(.*)index\.php rewriterule ^ /%1 [l,r=301]

Add optional part in python regular expression -

i want add optional part python expression: myexp = re.compile("(.*)_(\d+)\.(\w+)") so if string abc_34.txt, result.group(2) 34 if string abc_2034.txt, results.group(2) still 34 i tried myexp = re.compile("(.*)_[20](\d+)\.(\w+)") but results.groups(2) 034 case of abc_2034.txt thanks f.j. but want expand solution , add suffix. so if put abc_203422.txt, results.group(2) still 34 i tried "(.*)_(?:20)?(\d+)(?:22)?.(\w+)") 3422 instead of 34 myexp = re.compile("(.*)_(?:20)?(\d+)\.(\w+)") the ?: @ beginning of group containing 20 makes non-capturing group, ? after group makes optional. (?:20)? means "optionally match 20 ".

objective c - Safely remove NSView that contains cocoa bindings -

i have inspector pane in app contains bunch of controls. these controls bound model objects through nsarraycontroller . depending on type of object selected displaying different set of inspectors (just how ib works). inspector controller observes array controller's selection , can load required set of inspectors when selection changes. the problem old set of inspectors isn't removed apparently. through inspector controller doesn't hold strong reference them , removed superview, still stick around , log binding errors console: [<circle 0x102107df0> valueforundefinedkey:]: class not key value coding-compliant key width. my guess nsarraycontroller holds strong reference controls because of bindings. possible? manually have remove binding before removing control superview? how implement inspector pane this? edit: documentation says neither receiver, nor anobserver, retained. so guess bindings should removed automatically when removing control, shoul

ruby - Windows or Unix commands from within rails -

i need run windows or unix tools/commands within rails controller. e.g. need run usp.exe in windows , pipe output file called usb_results.csv using following command : usp32.v.0.22.win/usp.exe -livesys -csv -separator '|' > usb_results.csv the command works when run command directly command prompt in windows, not work within rails. tried system command follows not work: system ("public/forensic_tools/usb_parser/usp32.v.0.22.win/usp.exe -livesys -csv -separator '|' > usb_results.csv")

jquery ui radio button validation works in Firefox, but errors in IE. . -

i have page uses jquery ui style radio buttons. when user selects one, jquery identify 1 selected , change ground color of corresponding div down below (ultimately, call .load fill div contents of dynamic page on site, now, coloring div fine). it works peferctly in firefox, in internet explorer (or internet exploder call it), complains 'radio1' undefined. <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>jquery ui button - checkboxes</title> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <link rel="stylesheet" href="/resources/demos/style.css" /> <script> $(document).ready(fu

mysql - Strange behavior with mysqli::query -

i experiencing strange behavior mysqli::query function. attempting execute query , finding result evaluates true, when query ought returning false . if($result = $mysqli-> query("select id,name,password xxx name ='$name' , password ='$password' limit 1")) { // end here } i new mysqli shouldn't query return false on empty result set? as query syntactically correct , dbms operates correctly - return result. 0 rows result set still result. in case need check if 0 - incorrect credentials, 1 - correct

c# - Setting a post-authentication View for Windows Authentication -

i have mvc4 intranet application (using default template). using windows authentication login system, however, want able capture details user first time register site. use cases first time user authenticates using ad login (currently working). presented 'enter details' view. second time user authenticates using ad login. taken straight home screen. cheers, dave create custom authorizeattribute this: public class myauthorizeattribute : authorizeattribute { private unitofwork _unitofwork = new unitofwork(); protected override bool authorizecore(httpcontextbase httpcontext) { var isauthorized = false; var username = httpcontext.user.identity.name; // code find user in database... var user = _unitofwork.userrepository.find(username); if(user != null) { // check if there details user in database if(user.hasdetails) { isauthorized = true; }

obfuscation - Is there a way to combine a python project codebase that spans across different files into one file? -

the reason want want use tool pyobfuscate obfuscate python code. but pyobfuscate can obfuscate 1 file. i've answered direct question separately, let me offer different solution suspect you're trying do: instead of shipping obfuscated source, ship bytecode files. these .pyc files created, cached, , used automatically, can create them manually using compileall module in standard library. a .pyc file .py file missing can imported fine. it's not human-readable as-is. can of course decompiled python source, result is… same result running obfuscater on original source. so, it's better you're trying do, , whole lot easier. you can't compile top-level script way, that's easy work around. write one-liner wrapper script nothing import real top-level script. if have if __name__ == '__main__': code in there, you'll need move function, , wrapper becomes two-liner imports module , calls function… but that's hard gets.) alternativ

ruby - Incrementing an instance variable in the before :each clause of a MiniTest -

i'm writing ruby wrapper web-based api , each request requires unique transaction id sent along request. i have written test shell using minitest::spec , the transaction id not incrementing between each test. the test shell, leaving out tedious details, follows: describe "should expected responses server" before :all # random number between 1 , maxint - 100 @txid = 1 + securerandom.random_number(2 ** ([42].pack('i').size * 8 - 2) - 102) @username = securerandom.urlsafe_base64(20).downcase end before :each # increment txid @txid += 1 puts "new txid #{@txid}" end "should blah blah" # test uses @txid end "should blah blah blah" # different test uses incremented @txid end end the puts line in there shows @txid not incrementing between each test. a few more tests demonstrate assignment of value instance variable within body of test has no effect on value of variable. is e

which Uncrustify setting replaces blank lines with indenting spaces? -

Image
i've done number of read-thrus of my uncrustify settings page on past couple days haven't found setting. perhaps second pair of eyes knows missing. in source code, blank lines within functions getting replaced indenting spaces. for example (the 2 blank lines there returns): int foo() { return 1; } turns into: int foo() { ____ return 1; ____ } (well, " _ " see there blank spaces) which uncrustify setting controls behavior? i had same problem, , figured out. it's not uncrustify doing this, it's xcode. if run uncrustify outside of xcode, not insert blank tab/spaces on blank line (and if there remove them). discovering this, found out it's xcode preference "automatically indent based on syntax" setting when enabled (and it's enabled default), insert spaces on blank lines after uncrustify runs. to answer question, never figured out uncrustify setting removes blank spaces, can tell you, default un

c# - Modelling a nullable foreign key Entity Framework -

take following pseudocode database table foo { fooid int not null, name varchar not null } table bar { barid int not null, name varchar not null } table waa { waaid int not null, name varchar not null } table link { linkid int not null, fooid int null, barid int null, waaid int null, description varchar not null } the purpose of link table allow me link entities in single table, without having multiple foo_bar_link , foo_waa_link etc. tables. i moddeling db in entityframework v5. such, want able specify 1 many relationship between foo , link , can links associated given foo. problem entityframework designer lets one-many relationships exist foreign key not null. want foo have navigation property associations gets of association entities fooid = foo.fooid . note, using designer. ef not designed support unusual models yours. way know insert "empty" meaning rows example id equals -1 . in business logics or

c - Typedef struct pointers -

i want pass pointer struct function edit struct. this not work: typedef struct{ unsigned char x; unsigned char y; float z; }c_typedef; c_typedef *ptr_struct; //this part change work. void print_typedef(c_typedef *report, unsigned char x_data) { report->x = x_data; printf("x equal %d", report->x); } int main(void) { print_typedef(ptr_struct,0x23); getchar(); } now if change part declare pointer still not work. not work: c_typedef x_struct; c_typedef *ptr_struct; ptr_struct = &x_struct; but if change this, work!! c_typedef x_struct; c_typedef *ptr_struct = &x_struct; my question why don't first 2 work? bugging me. the problem of first version is, didn't allocate memory ptr_struct points to, leads segmentation fault. fixed in: c_typedef x_struct; c_typedef *ptr_struct = &x_struct; that's why third version works. what's wrong second version? because can't assign global variable

eclipse - Check war file before deploy / conditional deploy -

when using cargo deploy remote server check cargo or maven generated war have it's properties files filtered expected. some phase in between should test property file war against strings , deploy or stop deployment. there's built in on cargo achieve this? not sure properties files you're referring therefore assume refer typical java *.properties files. anyway, believe should use: maven-enforcer-plugin , it's goal: enforce common way in maven enforce condition (the plugin uses term: rule ) fulfilled. i think have more options here. option 1 maybe check prio packaging war using: maven-property-plugin - goal: read-project-properties ( http://mojo.codehaus.org/properties-maven-plugin/usage.html ) <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>properties-maven-plugin</artifactid> <version>1.0-alpha-2</version> <executions> <execution> <phase&

c++ - How to get which QradioButton invoke the SLOT -

i create several qradiobutton , connect same slot. in slot, want know qradiobutton invoke slot , related action. found there way using qobject_cast , qobject::sender(), seems not work. here code: header file: class dialoginput : public qdialog { q_object public: dialoginput(qwidget *parent = 0); qradiobutton *radio1; qradiobutton *radio2; qradiobutton *radio3; private slots: void settext_2(); private: qlabel *label_0_0; qlabel *label_1; }; main file: dialoginput::dialoginput(qwidget *parent): qdialog(parent){ label_0_0 = new qlabel("label_1:"); label_1 = new qlabel; qwidget *window = new qwidget; qvboxlayout *windowlayout = new qvboxlayout; qgroupbox *box = new qgroupbox("display type"); radio1 = new qradiobutton("3"); radio2 = new qradiobutton("5"); radio3 = new qradiobutton("9"); qvboxlayout *radiolayout = new qvboxlayout; connect(radio1,signal(

how to make smooth css transition -

how can css transition example in here (the dropdown example), far i've managed change text , background color, not whole transition effect thing (where rectangle rolls when hovered , rolls smoothly when un-hovered), idea how can achieve it? here's code: a.menulink { text-decoration: none; color: #000000; background-color: rgb(235,235,185); -webkit-transition: color .25s linear; transition: color .25s linear; transition: background-color .15s linear .1; } a.menulink:hover { text-decoration: none; color: #ffffff; background-color: rgb(255,24,24); -webkit-transition: color .25s linear, background-color .15s linear .1s; transition: color .25s linear, background-color .15s linear .1s; } thank before see demo <a href="#" class="linkhover"> <span hover-title="link hover">link hover</span> </a> .linkhover { display: inline-block; overflow: hidden; perspective: 400px; -webkit-perspective: 40

javascript - Button value set in editable div when click on -

i using button tag <button value="1">1</button> basically want when button pressed, value of button set editable div. <div contenteditable='true'; >value button</div> is possible client side script? try below code: ( edit modified user has subsequently indicated use create calculator) we doing following: assign onclick function button. called whenever button clicked. an id added both button tag , div tag access them using getelementbyid method in javascript. this.value pass value of button clicked function. inside javascript, value of button , set innerhtml of required div . note: since += used, take current contents of div , append button's value (like, if 1 pressed followed 2, div have 12 content). html <button value="1" id='btn1' onclick='setbtnvalue(this.value);'>1</button> <button value="2" id='btn2' onclick='setbtnvalue(this.valu

How Can One Javascript Enclosure Internal Function Call Another Internal Function -

how can func2 call func1 within same javascript enclosure? possible? var x = (function() { return { func1: function func1() {}, func2: function func2() { var y = func1(); // doesn't work! does? } } }()); define func1 before return, assign reference func1 property of return object. var x = (function() { function func1() {} return { func1: func1, func2: function func2() { var y = func1(); } } }());

Android: pass object without serialization -

i'm using library usb communication written else. i'm using 1 activity find correct usb device , make appropriate driver object , want use driver in activity (the why of bit complicated). unfortunately, driver object doesn't implement parcelable or serializable i'm not sure how this. have 2 questions 1) options there passing driver object between activities? 2) if succeed in question 1, run problems because receiving activity hasn't been given explicit permission use usb object? apart options below (and other options, such web storage - discussed here , or json options ), there no way send data 1 activity another. should either reconsider how doing trying do, or consider using different driver . if code open source or open licensed, may consider hacking in serializable or parcelable extracting source , modifying fit needs. more on decompiling android source available here . there several methods can use sharing content between 2 activities

google spreadsheet - How to convert datetime interval to hours? -

i have spreadsheet: b c d e 1 08/13/2013 02:10 4 2 08/13/2013 02:19 10 00:09:00 160 in d2 , have formula : =if(b2="";"";to_date(concatenate(a2;" ";b2))-to_date(concatenate(a1;" ";b1))) in e2 have formula : =if(d2="";"";(c2-c1)/d2) but e2 outputs wrong result, 160. want 40 (=10-4/0.15). 0.15 value in d2 converted hours. how can that? do not quite understand you're trying calculate, information explains, following formula can help: =if(d2 = "", "", round((c2-c1)/(d2*24), 0))

screenshot - Best way to capture websites in batch? -

i have list of urls , capture related sites display in standard view port given resolution (say 1024x768). does know of tool/web service/script that? any standard php methods or libraries build on alternatively? to give idea intend use these images for: should feed website, own little place collect domain names going waste. web service: browshot php library . tools: phantomjs

How to convert from hex to signed integers in Perl? -

this question has answer here: converting hexadecimal numbers in strings negative numbers, in perl 2 answers hi folks new perl. have hex chanel data(24 bits) 'fe284b' , '018263' want it's equivalent signed integers '-120757' , '98915' respectively. please me how in perl. use hex() function convert hex string numeric equivalent. if value should have been negative, make so. $hex = 'fe284b'; $value = hex($hex); $value -= 0x1000000 if $value >= 0x800000; print $value; output: -120757

Xaml Inherited StaticResource Styles -

i using style resources buttons. wondering better do. <stackpanel grid.row="1"> <button content="create event" click="createevent_click" style="{staticresource navigationbutton}" /> <button content="search event" click="searchevent_click" style="{staticresource navigationbutton}" /> <button content="my events" click="myevents_click" style="{staticresource navigationbutton}" /> </stackpanel> so, if have many buttons need write style="{staticresource navigationbutton}" or choose one: <stackpanel grid.row="1"> <stackpanel.resources> <style targettype="button" basedon="{staticresource navigationbutton}" /> </stackpanel.resources> <button content="create event" click="createevent_click" /> <button content="search event&