Posts

Showing posts from August, 2014

php - Search for variable content in array list -

php - Search for variable content in array list - i have 4 strings numbers this: $num1 = 0; $num2 = 3; $num3 = 3; $num4 = 0; then higher number: $higher = max($num1, $num2, $num3, $num4); so "$higher = 3" then create array owner of number , number this: $arr = array("user1" => $num1, "user2" => $num2, "user3" => $num3, "user4" => $num4); now issue: i search array $arr value $higher (3 in case) , "user2" , "user3" return. how can that? thanks lot. you can utilize array_search search array value , associated key. $key = array_search($higher,$arr); php

date - print string between two patterns but the first pattern is a range -

date - print string between two patterns but the first pattern is a range - i have file containing dates in format mmddyyyy . the file cotents below: 05192014 10212014 10222014 11232014 12242014 now wanted print dates have month 10 or 11 , year 2014, or can dates between months ranging 01 11. for single month , year command working fine: cat filename | sed -n '/10/,/2014/p' the above command prints: 10212014 10222014 all good! but if wanted dates having month either 10 or 11 did below: cat filename | sed -n '/1[0-1]/,/2014/p' but above command prints dates. there way out. can set range in first pattern. also, should able dates when specify months in range example: print dates month greater equal 01 , less equal 11 , year 2014. then output should be: 05192014 10212014 10222014 11232014 i guess want this: $ sed -n '/^1[01].*2014$/p' file 10212014 10222014 11232014 ^1[01].*2014$ means: strings starting 1 ...

Table with many columns ios swift -

Table with many columns ios swift - in app need table many columns (i utilize swift). search in google, can't find can useful. this example on objective c: can give me docs, tutorials or else, can help me create table that? i think web-view, native ios? how that? thanks! you dont need custom controls (they objective c here) that. simple tableview customcells , header section. you utilize autolayout calculated needed height each cell. split them in labels , set constraints prototype cell. read more here: http://www.weheartswift.com/how-to-make-a-simple-table-view-with-ios-8-and-swift/ sections (its objective c, should able read code , transform swift) http://www.ioscreator.com/tutorials/customizing-headers-footers-table-view-ios7 custom table view layout http://www.ioscreator.com/tutorials/prototype-cells-tableview-tutorial-ios8-swift ios swift

c# - Manually instantiate a Controller in MVC 6 alpha4 -

c# - Manually instantiate a Controller in MVC 6 alpha4 - i doing experimentation mvc 6 alpha 4. trying activate controller manually , returning instead of homecontroller doesn't work. help please.. so far have created own controller mill code. public class mycontrollerfactory : icontrollerfactory { public object createcontroller(actioncontext actioncontext) { var actiondescriptor = actioncontext.actiondescriptor microsoft.aspnet.mvc.reflectedactiondescriptor; type controllertype = type.gettype("hello.controllers.mycontroller"); var controller = _typeactivator.createinstance(_serviceprovider, controllertype); actioncontext.controller = controller; _controlleractivator.activate(controller, actioncontext); homecoming controller; } } i have debugged code. constructor of mycontroller gets called , mycontroller beingness returned createcontroller method error. debugger never reaches iactionresult index() . here error ...

Is it possible to decompile a Jenkins plugin? -

Is it possible to decompile a Jenkins plugin? - i have jenkins plugin file (.hpi file) , need way "decompile" see contents. possible? how decompile whole jar file? you're going have rough time... i'd advise source. jenkins jenkins-plugins

javascript - calling one function in an .html into another .html -

javascript - calling one function in an .html into another .html - this question has reply here: calling parent window function iframe 8 answers hi want phone call function 1 .html file .html file parent.html <html> <body> <script> function alertfunction() { alert("i alert box!"); } </script> <iframe src="childfile.html" width="80%" height="80%"></iframe> </body> </html> child.html <button type="button" onclick="alertfunction()">button</button> so when nail parent .html page frame open button in frame......and when click button should phone call functiona , show alert in parent.html file onclick="parent.alertfunction()" window.parent can job. javascript html html5 iframe

ios - xcode run on load ibaction -

ios - xcode run on load ibaction - i'm trying have yespic show on load. i'm new xcode. lots of asp classic experience. when viewcontroller appears there no image. if press yespic, image show. want show image on load. i'm lost 4 days. - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. } -(ibaction) yespic; { uiimage *img =[uiimage imagenamed:@"eggplant.png"]; [imageview setimage:img]; // can utilize show if have paid something. } -(ibaction) nopic; { uiimage *img =nil; [imageview setimage:img]; } - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. uiimage *img =[uiimage imagenamed:@"eggplant.png"]; [imageview setimage:img]; } - (ibaction) yespic { } - (ibaction) nopic { uiimage *img =nil; [imageview setimage:img]; } ios xcode ibaction

java - BufferedImage rotate and set with AffineTransform -

java - BufferedImage rotate and set with AffineTransform - i want rotate , set bufferedimage.rotate operation working code. how can set left margin , top margin graphics g = combined.getgraphics(); graphics2d g2d = (graphics2d) g; affinetransform @ = new affinetransform(); at.translate(overlay.getwidth() / 2, overlay.getheight() / 2); double d = math.pi/2; at.rotate(d); at.translate(-overlay.getwidth()/2, -overlay.getheight()/2); g2d.drawimage(image, 0, 0, null); g2d.drawimage(overlay, at, null); java

javascript - Sort array of strings by portion of each string -

javascript - Sort array of strings by portion of each string - i need sort array of strings portion of each string. here list: [ "5,758,zumba,13:00:00", "3,541,vinyasa level 2/3,10:30:00", "3,559,mat pilates,18:30:00" ] how can sort sec value? order need is 541, 559, 758 you can utilize custom sort function: class="snippet-code-js lang-js prettyprint-override"> var array = ["5,758,zumba,13:00:00","3,541,vinyasa level 2/3,10:30:00","3,559,mat pilates,18:30:00"]; array.sort(function(a, b) { var c = a.split(',')[1]; var d = b.split(',')[1]; if (c < d) { homecoming -1; } if (c > d) { homecoming 1; } homecoming 0; }); console.log(array); javascript arrays sorting

java - Why version number in maven dependency is skipped at times? -

java - Why version number in maven dependency is skipped at times? - i new maven's capabilities.. have seen in pom.xml dependencies put, @ times, groupid , artifact id mentioned , version skipped. why this? illustration below dependency springsource website http://spring.io/guides/gs/authenticating-ldap/ <dependencies> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-web</artifactid> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-security</artifactid> </dependency> <dependency> <groupid>org.springframework.security</groupid> <artifactid>spring-security-ldap</artifactid> <version>3.2.4.release</version> </dependency> <dependency> <groupid>org.apache.dire...

bokeh - How to show matplotlib charts in browser (html)? -

bokeh - How to show matplotlib charts in browser (html)? - i need open bar charts in matplotlib in browser-like firefox- shouldn't utilize bokeh in project. suggestions? ipython %matplotlib inline demonstrated here matplotlib bokeh

python - Remove whitespace in print function -

python - Remove whitespace in print function - this question has reply here: how print variables without spaces between values 4 answers i have code print "/*!",your_name.upper(),"*/"; where your_name info user inputs. how can edit code above tell scheme remove whitespace? update: if print code, i'll /*! your_name */ i want remove whitspaces between /*! your_name */ the spaces inserted print statement when pass in multiple expressions separated commas. don't utilize commas, build one string, pass in 1 expression: print "/*!" + your_name.upper() + "*/" or utilize string formatting str.format() : print "/*!{0}*/".format(your_name.upper()) or older string formatting operation: print "/*!%s*/" % your_name.upper() or utilize print() function, setting separat...

Can you help me with Perl assignment? -

Can you help me with Perl assignment? - i have assignment in perl , need little help here. i've been trying solve while couldn't, help me it? here question: write programme creates 3 different variables, names of animals assigned them (one animal per variable). display 3 animals user. have random number generator pick 1 of 3 animals, , inquire user guess animal chosen. allow user know whether guessed correctly or not. that part don't know "have random number generator pick 1 of 3 animals". here code far: #!/user/bin/perl #assignment1.pl utilize warnings; $a1 = "cat"; $a2 = "dog"; $a3 = "lion"; print "you have 3 animals: $a1 , $a2 , $a3"; $num = 1 + int( rand(3) ); # i'm not sure of print "\nchoose animal has been chosen?\n"; print "answer: "; $ans = <stdin>; chomp $ans; if ( $ans eq $num ) { print "\nyour guess correct!\n"; } else { print "...

php - How to check field value from database -

php - How to check field value from database - i taking 3 inputs user: username, firstname, email. i want check if username nowadays in database should check corresponding firstname , email. , if 3 right print message. html code: <html> <body> username: <input type="text" name="username"/> firstname: <input type="text" name="name"/> email: <input type="text" name="email"/> </body> </html> php code: if(isset($_post['submit'])) { $usrnm=$_post['username']; $name=$_post['name']; $email=$_post['email']; $user_name = "root"; $password = ""; $database = "show_your_talent"; $server = "127.0.0.1"; $db_handle = mysql_connect($server, $user_name, $password); $db_found = mysql_...

java - Algorithm to find k (k<100) largest differences (by absolute value) from an array of maximum 100 integers -

java - Algorithm to find k (k<100) largest differences (by absolute value) from an array of maximum 100 integers - if have array of integers in random order (the length n < 100), , asked find k integers (where k < n), when grouped in array have largest sum of two-consecutive-term differences absolute value (which i'll refer sum), algorithm fastest task? e.g: array 3 1 2 4 3 has sum equal to: |(3-1)| + |(1-2)| + |(2-4)| + |(4-3)| = 6. java algorithm

php - Magento doesn't show telephone number of guest checkout user (onepage checkout) -

php - Magento doesn't show telephone number of guest checkout user (onepage checkout) - magento won't save telephone numbers invitee customers in onepage checkout. telephone number mandatory field on onepage checkout form shown in image but in adminpanel in order details doesn't show telephone number shown in next image i did managed solve issue year ago , don't remember how did it. google no help @ to the lowest degree me in case. thanks php magento magento-1.9 onepage-checkout

c++ - Is it possible to create a win32 messaging window that won't be found by enumerating? -

c++ - Is it possible to create a win32 messaging window that won't be found by enumerating? - i'm trying enumerate win32 windows using next code: enumchildwindows(getdesktopwindow(), windowmanager::enumchildwindows, reinterpret_cast<lparam>(this)); bool callback windowmanager::enumchildwindows(hwnd hwnd, lparam lparam) { windowmanager* manager = reinterpret_cast<windowmanager*>(lparam); // // stuff kid window handle (hwnd) // // homecoming true go on enumeration, false stop. homecoming true; } so basically, top window calling getdesktopwindow( void ) function winapi , enumerate kid windows calling enumchildwindows( __in_opt hwnd hwndparent, __in wndenumproc lpenumfunc, __in lparam lparam) function 1 time again winapi. simply, question is, can missing win32 window approach? hide win32 window such approach can't enumerate it? thanks in advance. for way (via enumchildwindow...

Using F# type providers on top of a DataTable -

Using F# type providers on top of a DataTable - i spending important amount of time trying understand big chunks of info behind api returns datatables given queries. here f# type providers create life easier. there easy way build sequence of typed object given datatable object. one way around dump datatable content xml via writexml , load xmlprovider approach bit clunky. there couple of type providers working databases directly. see sql info access section here: http://fsharp.org/guides/data-access/index.html my favorite 1 http://fsprojects.github.io/fsharp.data.sqlclient/ datatable f# type-providers

apache - Why does changing default file under sites-available also changes the default under sites-enabled in nginx? -

apache - Why does changing default file under sites-available also changes the default under sites-enabled in nginx? - so, in nginx have default file under /etc/nginx/sites-enabled /etc/nginx/sites-available. if create alter in one, reflects in other. why so? don't want know how prepare (but answering help), looking why , how gets reflected in both places. the files in "sites-enabled" symbolic links files in "sites-available". means don't have own "content", point other files. apache tomcat nginx proxy reverse-proxy

sql - How to write the query that returns records where some column value appears more than once? -

sql - How to write the query that returns records where some column value appears more than once? - i have table has column statuses. need write query returns records column value appears more once? something this: select * table1 count(statusid = 6) > 1 you can write query following: select * table1 statusid in ( select statusid (select statusid,count(*) cnt table1 statusid=6 grouping statusid having count(*) > 1) tbl ) sql sql-server count

recursion - Typed Racket: Natural Numbers -

recursion - Typed Racket: Natural Numbers - i have solve problem unique definition of natural numbers: (define-type nat (u 'zero succ)) (define-struct succ ([prev : nat]) #:transparent) so basically, 0 = 'zero, 1 = (succ 'zero), 2 = (succ (succ 'zero)).... etc. using form, without converting them integers, have write recursive functions add, subtract, , multiply natural numbers. add together function i've tried this (: nat+ : nat nat -> nat) (define (nat+ n m) (match '(n m) ['('zero 'zero) 'zero] ['((succ p) 'zero) n] ['('zero (succ p)) m] ['((succ p) (succ t)) (nat+ p (succ m))])) but error p: unbound identifier in module in: p. does have advice writing type of recursive function. the problem utilize of quoting. when quote list, '(n m) , doesn't mean "a list containing whatever n , whatever m - means list containing literal symbols n , m...

How to get Google Apps Primary and Secondary domain sites -

How to get Google Apps Primary and Secondary domain sites - the below given code gives me list of sites on primary domain, how can list of sites on domain including secondary domains? function listsites() { var domain = usermanager.getdomain(); var page_length=200; sheet = spreadsheetapp.getactivesheet(); var sites = sitesapp.getallsites(domain,0,page_length); for(var i=0; sites.length != 0; i+=page_length){ (var j=0; j<sites.length; j++) { sheet.appendrow([sites[j].geturl()]); } sites = sitesapp.getallsites(domain, i, page_length); } }; the issue here you're calling sites on primary domain. the function 'get sites' takes input of domain, , returns sites domain input. in sample code, variable 'domain' returning domain user running application, won't list sites not on same domain user running application. instead, if phone call function using of domains on apps account, list of sites. a simple illus...

rails select from association using join -

rails select from association using join - i have 3 models: company, event, event_space company has many events event belongs event space now want events company event_space has virtual attribute set true c = comapny.first c.events.joins(:event_space).where("event_space.virtual = true") i'm doing wrong because have activerecord::statementinvalid: sqlite3::sqlexception: no such column: event_space.virtual: select "events".* "events" inner bring together "event_spaces" on "event_spaces"."id" = "events"."event_space_id" "events"."company_id" = 2 , (event_space.virtual = true) you can modify where clause follows right: c.events.joins(:event_space).where(event_spaces: {virtual: true}) ruby-on-rails

android - Reset TouchImageView zoom in ViewPager -

android - Reset TouchImageView zoom in ViewPager - i have activity fullscreen browsing of images (something gallery). in activity have viewpager offscreen limit 6. utilize touchimageview images. problem is, when first zoom image , swipe photo, want see not zoomed photo when homecoming it. touchimageview has resetzoom() function, how can offscreen page view fragmentstatepageadapter or viewpager? here's code of activity: public class imageslidesactivity extends fragmentactivity implements viewpager.onpagechangelistener { final int page_limit = 6; final int page_margin = 8; long userid; long deviceid; string key; string[] mattachments; imageslidesadapter madaper; viewpager mpager; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); requestwindowfeature(window.feature_action_bar_overlay); setcontentview(r.layout.activity_image_slides); actionbar actionbar = getactionbar(); actionbar.setdisplayhomeasupenabl...

Creating a POSIXct date in R from date and time parts -

Creating a POSIXct date in R from date and time parts - how create posixct date date , time parts below date<-as.date("2014-01-01") hour<-5 minute<-15 second<-59 millisecond<-695 date hr min sec millisecond output should posixct object 2014-01-01 05:15:59.695 r

Convert Java Pattern to Javascript Pattern -

Convert Java Pattern to Javascript Pattern - i have next java pattern. ^[ -~&&[^"'<>\\]]*$ basically space ~ character (from ascii table) excluding double quotes, single quotes, angular brackets , backslash. i convert javascript pattern, appreciate help. the way can think of negative lookahead: var pattern = /^(?:(?!["'<>\\])[ -~])*$/; the negative lookahead (?!["'<>\\]) cause match fail if matches 1 of characters don't want. if want maintain same pattern both languages, 1 should work in java too. edit — breaking down: the leading ^ , trailing $ mean overall pattern has match entire test string. (that's same java version.) the outer (?: ) grouping called "non-capturing" group. ordinary grouping made plain parentheses work too, trying in habit of using non-capturing groups when don't need capture part. not issue either way. point of need grouping next 2 parts * operator ca...

html5 - What's it called? -

html5 - What's it called? - so tasked this: it's timekeeping web application employees of our company. thing don't know reddish part called. yes have seen in blogs , news sites news gets slided up(or down). don't know what's called can't sample codes of it. so, i'm asking: it? do means coffin? http://fat.github.io/coffin/ coffin ui component built on top of skeleton framework. aims provide simple, collapsible left shelf. coffin responsive , automatically collapses in mobile views - allowing swipe away , toggle nagivation in , out of view. behaves similar facebook/path's navigation ui. html5 css3 asp-classic

Intent.FLAG_ACTIVITY_FORWARD_RESULT Live Example In Android -

Intent.FLAG_ACTIVITY_FORWARD_RESULT Live Example In Android - can 1 tell me the working of intent.flag_activity_forward_result live example now doing creating 3 activity a,b,c so when launching application activity , starting activity b startactivityforresult(activity b) , there in b activity starting activity c intent.flag_activity_forward_result , finishing b activity,so there in activity c when finished activity c gives result activity in onactivityresult(). so want know purpose of using flag or different , if wrong please allow me know. and please seek give reply example. the solution on stackoverflow .i hope may understand logic . i suggest go solution flag activity @stackoverflow. android

Need explanation on this regex -

Need explanation on this regex - i have regex used split string: ,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$) e.g. string "field1","field2","item1,item2,item3","hello,""john""" the 1 thing understand is splitting string on , after not sure. if can explain regex please. if can dissect simplest possible level, appreciate it. this regex matching comma , only if outside double quotes counting number of quotes after literal , . explanation: , -> match literal comma (?=...) -> positive lookahead [^"]*" -> match before " followed literal " [^"]*"[^"]*" -> match pair of above (?:[^"]*"[^"]*")* -> match 0 or more of pairs (0, 2, 4, 6 sets) [^"]*$ -> followed non-quote till end of string example input: "field1,field2","field3","item1,item2,item3" first match , before...

wordpress plugin - Edited title: Woocommerce create order status that doesn't mark order as uneditable -

wordpress plugin - Edited title: Woocommerce create order status that doesn't mark order as uneditable - i have created new custom order status in woocommerce install "awaiting shipping calculation", client has products complex , shipping must worked out manually invoice sent. i followed guide has created custom order status, whenever order has status, order no longer editable i want new custom status still leave order editable. edit have changed of details above whole question makes more sense: turns out taking wrong approach, there function is_editable() in file abstract-wc-order.php https://github.com/woothemes/woocommerce/blob/master/includes/abstracts/abstract-wc-order.php#l2469 /** * checks if order can edited, utilize on edit order screen * * @access public * @return bool */ public function is_editable() { if ( ! isset( $this->editable ) ) { $this->editable = in_array( $this->get_status(), array( 'pending', ...

multithreading - How to avoid ordering issues for concurrent requests from the same user? -

multithreading - How to avoid ordering issues for concurrent requests from the same user? - suppose have scheme processes requests concurrently having end result storing field in database. suppose next scenario appears, id request id, user user made call, val value beingness stored in database , t time: client server database | id=1, user=x, val=100, t=1 | | |----------------------------> | | | id=2, user=x, val=50, t=2 | | |----------------------------> | id=2, user=x, val=50, t=3 | | |---------------------------->| | | id=1, user=x, val=100, t=4 | | |---------------------------->| the problem same user makes 2 requests @ same time, due out-of-order execution of tasks in server, lastly request processed first ...

How to change the ragged right CR/LF position in .txt file (ie using UltraEdit) before importing in SQL Server? -

How to change the ragged right CR/LF position in .txt file (ie using UltraEdit) before importing in SQL Server? - i provided ragged right unix text file cr/lf position of lines appears set @ 100. provided column layout document takes file out position 150. there way alter cr/lf position 150? if import sql server using format provided, since linefeed @ 100, sql server grabs first 50 characters of next line. i can offer 2 solutions. using column mode move caret column 151 according status bar in first line of file. there 150 characters left of caret position. click in menu column on menu item column mode turn on mode. click in menu column on menu item insert/fill columns, come in single character # , execute command. you see character # on lines inserted @ column 151. click in menu column on menu item delete columns, come in 1 , execute command. click in menu column on menu item column mode turn off mode. now lines in file have 150 characters. might want go end of fi...

silverlight - Access Last-Modified HTTP response header on Windows Phone 8.0 -

silverlight - Access Last-Modified HTTP response header on Windows Phone 8.0 - i trying create head request , read last-modified header response. far i've been using httpclient of async server communication, worked fine, reason httpresponsemessage.headers doesn't seem contain last-modified response header, though server homecoming it. how access last-modified response header in windows phone 8.0? if you're looking last-modified of file you're downloading take at class="lang-c# prettyprint-override"> httpclient hc = new httpclient(); var reponse = await hc.getasync("http://www.chubosaurus.com/dogecoin_wp8.jpg"); then @ class="lang-c# prettyprint-override"> reponse.content.headers.lastmodified silverlight windows-phone-8 http-headers

java - Find filename from local repository with sbt -

java - Find filename from local repository with sbt - in sbt, add together task start jvm aspectj agent weaver. declare dependency librarydependencies ++= seq("org.aspectj" % "aspectjweaver" % aspectjversion.value % "test") and utilize local downloaded version (like ~/.m2/.../aspecjweaver....jar) start forked jvm. this: javaoptions "-javaagent:"+localfilefromartifact how can retrieve local file name library dependencies ? many thanks java scala sbt aspectj

java - How to get exact bitmap file size? -

java - How to get exact bitmap file size? - i'm trying right width , height of bitmap file via hex info. i've got width , height specified in header, need adjust width due padding , calculate size of file in bytes. the formula i'm using right is (width * height * colordepth)/8 + 54 first of all, formula correct, , second, how adjust width padding? calculating total size of bmp file not simple. formula provided leads me believe looking specific bmp file type : a simple bitmapinfoheader (v3 bmp); no compression ( bi_rgb ). this gives header size of 54 bytes. in bmp file, each rows of pixels rounded multiple of 4 bytes (the row padded). hence obtain real size of bmp need calculate row size padding, multiply image height , add together header size. to calculate row size padding (in bytes) utilize formula : ceiling(width * bpp / 32) * 32 / 8 . to calculate total size (in bytes) of bmp can utilize : (height * ceiling(width * bpp / 32) * 32) / 8 ...

What is the idiomatic way to express countable infinity in Coq? -

What is the idiomatic way to express countable infinity in Coq? - suppose wish assert countably infinite number of distinct x : x 's exist. first guess follow definition of countable infinity literally, such : definition aleph_null ( x : type ) := exists ( r : nat -> x -> prop ), ( forall ( n : nat ), exists ( x : x ), r n x ) /\ ( forall ( x : x ), exists ( n : nat ), r n x ) /\ ( forall ( n : nat ) ( x y : x ), r n x -> r n y -> x = y ) /\ ( forall ( n m : nat ) ( x : x ), r n x -> r m x -> n = m ). but seems bit unwieldy utilize in actual proofs, , doesn't create utilize of libraries. thought create shorter using existing definition of bijectivity, definitions can find functions, not binary relations. is there better, idiomatic way express countable infinity in coq? the best selection much depend on particular application have in mind. using functions easiest alternative cases. since mentioned library support, ssreflect library h...

gridviewcolumn - WPF GridViewColumnHeader disable the dragging of columns between unmovable columns -

gridviewcolumn - WPF GridViewColumnHeader disable the dragging of columns between unmovable columns - i have listview view of gridview i.e.: <listview> <listview.view> <gridview /> </listview.view> </listview> with example: the 2 columns reddish text have style applied ishittestvisible property set false - prevents user moving 2 columns. it possible, , should be, user drag other 3 columns amongst themselves. unfortunately, scenario, user can move 1 of 3 moveable columns before either first or sec unmovable columns, moving column should not movable, here: my aim maintain unmovable columns whilst allowing movable columns moved amongst themselves. the amount of unmovable columns variable, possible gridview has no fixed columns whatsoever, possible however, there may 2 - shown here - or more (for larger tables). the question hence be, how can hinder user moving columns before column cannot moved? thank time! ...

java - libgdx optimal Height and Width -

java - libgdx optimal Height and Width - does matter height , width utilize game? in game have few polygons, connected images have painted, when have width , height 800x480 have paint images small, causes them blurry. also, don't understand how behaves on different sized phone screens.., images have painted streched, or remain small, on big tablets? question optimal width , height have on libgdx game? this part of code, maybe help understand mean width = gdx.graphics.getwidth(); height = gdx.graphics.getheight(); photographic camera = new orthographiccamera(); camera.settoortho(false, 800, 480 ); what happen if alter these values? best alter them to? i reading on tutorial of sorts, didn't talk part. do have complicated painted images decent on devices? edit: this how implement cloud game: public class anotherscreen implements screen{ polygon cloudpoly; texture cloud; @override public void render(float delta) { batch.setpr...

php - Modify code to pass a post id as a parameter in order to create a breadcrumb via AJAX in Wordpress -

php - Modify code to pass a post id as a parameter in order to create a breadcrumb via AJAX in Wordpress - i have function utilize create breadcrumb on wordpress site: function the_breadcrumb() { $delimiter = '>'; $currentbefore = '<li><a>'; $currentafter = '</a></li>'; if ( !is_home() && !is_front_page() || is_paged() ) { echo '<nav class="breadcrumb"><ul>'; global $post; if ( is_page() && !$post->post_parent ) { echo $currentbefore; the_title(); echo $currentafter; } elseif ( is_page() && $post->post_parent ) { $parent_id = $post->post_parent; $breadcrumbs = array(); while ($parent_id) { $page = get_page($parent_id); $breadcrumbs[] = '<li><a href="' . get_permalink($page->id) . '...

neo4j - Create multiple nodes and relationships with parameters -

neo4j - Create multiple nodes and relationships with parameters - i want create attachments email. have email info array following: email: {name: 'auniquestring'} attachments: [ {label: 1, filename: 'a.jpg'}, {label: 2, filename: 'b.jpg'}, {label: 3, filename: 'c.jpg'}, ] if had come in 1 attachment, should work: match (n:email {name: "auniquestring"}) create (a:attachment {filename: 'a.jpg'}) create (n)-[r:attachment {label: '1'}]->(a) how create attachment nodes @ 1 time , connect them email node (with single query)? if pass them in parameters can do: params: { email: {name: 'auniquestring'} attachments: [ {label: 1, filename: 'a.jpg'}, {label: 2, filename: 'b.jpg'}, {label: 3, filename: 'c.jpg'}, ]} create (n:email {name: {email}}) foreach (att in {attachments} | create (a:attachment {filename: att.filename}) create (n)-[:attachment {...

ruby - Nokogiri Scraping -

ruby - Nokogiri Scraping - i'd scrap title of each video , links. doc = nokogiri::html(open('http://www.stream2u.me/')) doc.css('.lshpanel').each |link| binding.pry puts link.elements[1].text puts "links are: " ## cant figure out how links... end can please help! been working on hr , cant figure out. you can locate links css method , iterate on collection pull href attributes. example: require 'nokogiri' require 'open-uri' doc = nokogiri::html(open('http://www.stream2u.me/')) doc.css('.lshpanel').each |d| puts d.css('.lshevent').text d.css('a').each { |el| puts el['href'] } end ruby nokogiri

php - foreach loop doesn't continue to execute -

php - foreach loop doesn't continue to execute - i have code removes xml tags expired , list other tags, if 1 tag expired delete , stop foreach loop execution without listing other tags. if reload page after code finished removing expired tag list other tags without problem. how can create go on list other tags? php code: $xml_file = simplexml_load_file("xml_file.xml"); foreach ($xml_file $item) { $current_date = time(); $article_date = (int)$item->date; $item_number = (int)str_replace("a" , "" ,$item->getname()); if ($current_date >= $article_date + 100000) { if ($item->children()->getname() == "a") { $dom = dom_import_simplexml($item); $dom->parentnode-...

RMI cllient reconnect gives java.rmi.NoSuchObjectException: no such object in table -

RMI cllient reconnect gives java.rmi.NoSuchObjectException: no such object in table - ill seek explain setting. setting: run 1 "server"(note: not rmi server) up. when run 1 client, client creates rmi host so: string bindlocation = "//localhost/ntn"; seek { registry = locateregistry.createregistry(1099); naming.bind(bindlocation, ntn); } grab (malformedurlexception | alreadyboundexception e) {} and server starts acting rmi client so: seek { name = "//localhost/ntn"; ntni = null; ntni = (nodetonodeinterface) naming.lookup(name); ntni.serveranswer(k); k++; } catch(exception e) { system.err.println("fileserver exception: "+ e.getmessage()); e.printstacktrace(); } this works. after client has received "server answer" unbinds so: ...

ember.js - Extending an Ember model with a custom variable -

ember.js - Extending an Ember model with a custom variable - my ember app has section model. has 'name' field , i've extended 'summary_of_changes' field. when effort length of name field good. attempts length of 'summary_of_changes' field generating error (see below) , driving me crazy. this works: # coffeescript app.sectioneditcontroller = ember.objectcontroller. isreadytosave: (-> @get('model.name').length > 3 ).property('model.name'), but (almost identical code) doesn't app.sectioneditcontroller = ember.objectcontroller. editmode: true, isreadytosave: (-> @get('model.summary_of_changes').length > 3 ).property('model.summary_of_changes'), ..and produces next error. ‘uncaught typeerror: cannot read property 'length' of undefined’ by way of farther background, store rails api , have model 'section' of business plan.the model contains: name, detail...

ruby - How is this method solving my factorial? -

ruby - How is this method solving my factorial? - i'm working on ruby challenge , had write method calculate factorial of number. came across solution below, don't understand how works, section in else statement: def factorial(number) if number <= 1 1 else number * factorial(number - 1) end end lets run factorial(5) how else statement iterating through 5*4*3*2*1 in number * factorial(number - 1) statement? know seems should obvious, it's not me. appreciate help in advance. this concept known recursion. factorial(5) evaluates to 5 * factorial(4) factorial(4) evaluates to 4 * factorial(3) factorial(3) evaluates to 3 * factorial(2) factorial(2) evaluates to 2 * factorial(1) factorial(1) evaluates 1 because 1 <= 1 substituting values appropriately results in 5 * factorial(4) 5 * 4 * factorial(3) 5 * 4 * 3 * factorial(2) 5 * 4 * 3 * 2 * factorial(1) 5 * 4 * 3 * 2 * 1 ruby factorial

How to pass C# method as a callback to CLI/C++ function? -

How to pass C# method as a callback to CLI/C++ function? - i have such method in c++/cli: void foo(onengineclosecallback callback); with such callback definition: typedef void (*onengineclosecallback)( int, string ^ errormessage); the c++/cli compiles. c# code looks this: static void oncallback( int code, string errormessage) { system.diagnostics.debug.writeline(errormessage); } and call: foo(oncallback); // error "foo not supported language" (error: cs0570). so how can pass callback cli/c++? if neither of going post reply i'll because don't answered questions without answers... you must declare public delegate, not function pointer. basic how-to article here. hans passant how to: define , utilize delegates (c++/cli) c# callback c++-cli

objective c - IOS 7 screenshot tweak -

objective c - IOS 7 screenshot tweak - i'm trying create screenshot tweak ios 7 able save blank image. code: uiview *screenshotview = [[uiscreen mainscreen] snapshotviewafterscreenupdates:no]; uigraphicsbeginimagecontext(screenshotview.bounds.size); [[screenshotview layer] renderincontext:uigraphicsgetcurrentcontext()]; uiimage *image = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); [uiimagejpegrepresentation(image, 1.0) writetofile:fname atomically:yes]; does have solution? thank you it appears should not utilize snapshotviewafterscreenupdates render images (see raywenderlich forum) drawviewhierarchyinrect instead: uigraphicsbeginimagecontextwithoptions(self.view.bounds.size, no, 0.0f); [self.view drawviewhierarchyinrect:self.view.frame afterscreenupdates:no]; uiimage *snapshotimage = uigraphicsgetimagefromcurrentimagecontext(); ios objective-c uiview uiimagejpegrepresentation

c - Makefile doesn't clean object files -

c - Makefile doesn't clean object files - here makefile: objs = main.o hashfunction.o input.o list.o list_inverted_index.o memory.o operations.o sort.o source = main.c hashfunction.c input.c list.c list_inverted_index.c memory.c operations.c sort.c header = hashfunction.h input.h list.h list_inverted_index.h memory.h operations.h sort.h out = myexe cc = gcc flags = -g -c -wall # -g alternative enables debugging mode # -c flag generates object code separate files all: $(objs) $(cc) -g $(objs) -o $(out) # create/compile individual files >>separately<< main.o: main.c $(cc) $(flags) main.c hashfunction.o: hashfunction.c $(cc) $(flags) hashfunction.c input.o: input.c $(cc) $(flags) input.c list.o: list.c $(cc) $(flags) list.c list_inverted_index.o: list_inverted_index.c $(cc) $(flags) list_inverted_index.c memory.o: memory.c $(cc) $(flags) memory.c operations.o: operations.c $(cc...

python - How to add a temporary .docx file to a zip archive in django -

python - How to add a temporary .docx file to a zip archive in django - here code downloading zip file, containing .docx file, def reportsdlserien(request): selected_sem = request.post.get("semester","ss 2016") docx_title="report_in_%s.docx" % selected_sem.replace(' ','_') document = document() f = io.bytesio() zip_title="archive_in_%s.zip" % selected_sem.replace(' ','_') zip_arch = zipfile( f, 'a' ) document.add_heading("report in "+selected_sem, 0) document.add_paragraph(date.today().strftime('%d %b %y')) document.save(docx_title) zip_arch.write(docx_title) zip_arch.close() response = httpresponse( f.getvalue(), content_type='application/zip' ) response['content-disposition'] = 'attachment; filename=' + zip_title homecoming response the problem is, creates .docx file, dont...

Send JSon data from javascript to php -

Send JSon data from javascript to php - i'm trying post array in javascript php session variable using json. searched lot, there 3 ways post; html form posting request, ajax , cookies. want post posting request, in script convert array json object no problem. tried send php page this; $('#firstconfirmbutton').click(function(){ var json_text = json.stringify(ordersarray, null); alert(json_text.tostring()); request= new xmlhttprequestobject(); request.open("post", "test.php", true); request.setrequestheader("content-type", "application/json"); request.send(json_text); }); in test.php tried array using file_get_contents('php://input') did not work. when seek echo son_text, shows "firstconfirmbutton=" instead of array content. should do? <?php require("includes/db.php"); require("includes/functions.php"); session_start(); if (isset($_post...

php - Member Function Error. Any explanation how to solve -

php - Member Function Error. Any explanation how to solve - i'm trying display info if user not logged in , i'm getting next error: (fatal error: phone call fellow member function fetch() on non-object in /home/a6150953/public_html/php/classes/class.user.php on line 58) help class.users.php <?php class user { public $db; public $error; public function __construct($con){ $this->db = $con; } /*** login process ***/ public function check_login($username='', $password=''){ // validate email real 1 if(filter_var($username,filter_validate_email) !== false) { $password = md5($password); $sql = "select uid users (uemail='$username' or uname='$username') , upass = '$password'"; $result = $this->db->fetch($sql); if ($result !== 0) { ...

intervals - How to prove greedy algorithm optimality -

intervals - How to prove greedy algorithm optimality - let s set of intervals (containing n number of intervals) of natural numbers might overlap , n list of numbers (containing n number of numbers). i want find smallest subset (let's phone call p) of s such each number in our list n, there exists @ to the lowest degree 1 interval in p contains it. intervals in p allowed overlap. trivial example: s = {[1..4], [2..7], [3..5], [8..15], [9..13]} n = [1, 4, 5] // p = {[1..4], [2..7]} i found solution problem shown below n = mergesort (n) upper, lower = infinity, -1 p = empty set each q in n if (q>=lower , q<=upper)=false max_interval = [-infinity, infinity] each r in s if q in r if r.rightendpoint > max_interval.rightendpoint max_interval = r p.append(max_interval) lower = max_interval.leftendpoint upper = max_interval.rightendpoint s....

jQuery build in logic change -

jQuery build in logic change - i new jquery help me one? have function executes on value change. used on building search. need fire function not on value alter , whenever value equal specific one. logic in words:"hide ids, if select[id] has value or value changed - if else constrution" can help me rebuild fires on both cases? think mashup between .change , .val functions might help here. <script> jquery(document).ready(function ($) { $("#other_field_id").hide(); $("#some_field_id").hide(); $("select[id=what_to_show]").change(function(){ var myvalue = $("select[id=what_to_show]").val(); if (myvalue == 'other-value'){ $("#other_field_id").show(); } else if (myvalue == 'some-value'){ $("#some_field_id").show(); ...

bluetooth - IOS App got rejected because require alarm feature require aforementioned mode -

bluetooth - IOS App got rejected because require alarm feature require aforementioned mode - my ios app works connect hardware device using bluetooth. myapp <------> hardware devices when button of hardware devices pressed, send bluetooth message myapp play alarm in audio. enabled background modes (audio , airplay). myapp needs running on background can play alarm sound when alarm bluetooth message received. however, submitted myapp got rejected. message shown below : "thank message. not appropriate apps utilize background sound mode alarm functionality. appropriate either include features require aforementioned mode or remove app. forwards reviewing revised app." i wondering aforementioned mode. , cannot remove sound feature. please help. thanks. ios bluetooth mode

c# - Creating master view in Windows Phone application -

c# - Creating master view in Windows Phone application - i creating masterview within views navigate have created simple xaml page , added transitionframe within navigating other pages within frame. when application start , navigates masterview crashes next error: error: {system.windows.markup.xamlparseexception: cannot create instance of type 'microsoft.phone.controls.transitionframe' [line: 32 position: 22] ---> system.invalidoperationexception: operation not valid due current state of object. @ microsoft.phone.controls.phoneapplicationframe..ctor() @ microsoft.phone.controls.transitionframe..ctor() --- end of inner exception stack trace --- @ system.windows.application.loadcomponent(object component, uri resourcelocator) @ view.masterview.initializecomponent() @ view.masterview..ctor()} xaml: <grid x:name="layoutroot" background="transparent"> <grid.rowdefinitions> <rowdefinition hei...

haskell - Is there a way to `fromIntegral . fromEnum` that works with all Integers? -

haskell - Is there a way to `fromIntegral . fromEnum` that works with all Integers? - > (fromintegral . fromenum) true 1 good. > (fromintegral . fromenum) (10000 :: int) 10000 good. λ (fromintegral . fromenum) 100000000000000000000 7766279631452241920 not good. i'm doing bit banging data.bits , looking general way combine fields represented bool , int , integer . integer fields may large. update the overall thing i'm trying looks this: fromexchange :: exchange -> integer fromexchange e = foldr combinebits 0 collectbits combinebits = ((.|.) . ($ e)) collectbits = [ (`shiftl` 127) . tobits . docommand , (`shiftl` 126) . tobits . readcomplete , (`shiftl` 116) . fromintegral . destid , (`shiftl` 64) . address , payload , (`shiftl` 108) . fromintegral . mask , (`shiftl` 104) . fromintegral . fromcommand . command ] tobits :: enum => -> integer tobits = fromintegral . f...

c++ - Does SSE FP unit detect 0.0 operands? -

c++ - Does SSE FP unit detect 0.0 operands? - according previous question thought optimize algorithm removing calculations when coefficient m_a, m_b 1.0 or 0.0. tried optimize algorithm , got curious results can´t explain. first analyzer run 100k samples. parameter values read file (!): b0=1.0 b1=-1.480838022915731 b2=1.0 a0=1.0 a1=-1.784147570544337 a2=0.854309980957510 second analyzer run same 100k samples. parameter values read file (!): b0=1.0 b1=-1.480838022915731 b2=1.0 a0=1.0 a1=-1.784147570544337 a2=0.0 <--- a2 different ! within figures numbers on left side (grey background) represent needed cpu cycles. visible sec run parameter a2=0.0 lot faster. i checked difference between debug , release code. release code faster (as expected). debug , release code have same unusual behaviour when parameter a2 modified. then checked asm code. noticed sse instructions used. valid because compiled /arch:sse2. hence disabled sse. resulting code doesn´t uti...

jsf - Select one many doesn't appear correctly -

jsf - Select one many doesn't appear correctly - i developing primefaces web page. problem have when seek utilize select 1 menu primefaces, menu appears color of button when clicked shows menu. <p:selectonemenu id="nombre" value="#{actividad.nombre} style="width:150px"> <f:selectitem itemlabel="nombre" itemvalue="" noselectionoption="true" /> <f:selectitems value="#{actividad.a}" /> </p:selectonemenu> if alter appears correctly want utilize 1 primefaces create interface good. suggestions on why happens, give thanks you!! give right doctype page. your page should have required tags ( <head>, <body> etc) validate output html , see if validateable. (note not primefaces components output validateable code) check on multiple browsers , see happening. jsf primefaces selectonemenu

java - Swing frames overlapping after certain button is clicked -

java - Swing frames overlapping after certain button is clicked - after doing log in page , clicking log in button, sec frame comes on top of log in page can still see components hiding below. why isn't gone after clicking on log in button? here's code: public void showlogin(){ setlayout(new borderlayout()); setvisible(true); setsize(400,200); setdefaultcloseoperation(javax.swing.windowconstants.exit_on_close); loginpanel.setlayout(new gridlayout(2,2,4,4)); loginpanel.add(label1); loginpanel.add(username); loginpanel.add(label2); loginpanel.add(password); add(loginpanel, borderlayout.center); add(loginbut, borderlayout.south); loginbut.addactionlistener(this); } public void showadminform(){ setlayout(new borderlayout()); setvisible(true); setsize(400,300); setdefaultcloseoperation(javax.swing.windowconstants.exit_on_close); label3.settext("logged in as: " + username.gettext()); add(l...

c - Scanf always returning 0.000000 -

c - Scanf always returning 0.000000 - i'm trying create simple programme calculate body mass index, scanf(s) homecoming 0.00000, no matter try. searched everywhere, tried many things, everyone. #include <stdio.h> #include <stdlib.h> int main() { float height; float initialheight; float weight; float bmi; float nothing; printf("what's weight? "); scanf("%lf", &weight); printf("%f", &weight); printf("what's height? "); scanf("%lf", &initialheight); printf("%f", &initialheight); height = (initialheight * initialheight); printf("%f", &height); bmi = (weight / height); printf("your bmi "); printf("%f", &bmi); scanf("%f", nothing); //just maintain programme open homecoming 0; } well have alter 2 things. first, alter printf("%f", &w...

How to use spring dependency injection in our web service -

How to use spring dependency injection in our web service - we have web service trying reimplement using spring di. here how works: on each request web service receives in controller, based off page name, instantiate handler list of tasks can handle request. interface handler { list<task> gettasklist(); } class controller { //inject handler handler handler; processrequest(){ handler.gettasklist() -> execute } } we have 5-6 such handler , want corresponding handler injected controller based on request pagename. whats best way go this? how inject different handler on fly? thanks 1- create handlers in configuration (or annotate service implementations): @bean public handler handler1() { // homecoming handler 1 } @bean public handler handler2() { // homecoming handler 2 } 2a- inject applicationcontext controller. retrieve required service based on request mapping. class controller { @autowired pri...