Posts

Showing posts from May, 2014

webdriver - Unable to use until method -

i trying wait element in selenium webdriver , following happens i create wait: webdriverwait delay = new webdriverwait(driver, 5); and use it: delay.until(expectedconditions.visibilityofelementlocated(by.id("someid"))); but intellij idea keeps marking until() red , saying "cannot resolve method until()". need help, please. change wait.until(expectedconditions.visibilityofelementlocated(by.id("someid"))); to delay.until(expectedconditions.visibilityofelementlocated(by.id("someid"))); also refer selenium documentation, has example on explicit wait- http://docs.seleniumhq.org/docs/04_webdriver_advanced.jsp#explicit-and-implicit-waits

session - How to retain values in textboxes even after navigating to another page in a jquery mobile application -

there jquery mobile application working on targets android, ios, windows , blackberry platforms. using jquery mobile 1.3.1 jquery 1.9 wrapped in phonegap. the requirement :- have html page 2 input fields, number field , button. on "click" of button have navigate page "back" button in it. when page navigates first page, have retain values user entered on first page. what's happening when navigate back, values user entered not retained i.e "state" of page not retained. is there way possibly retain values/state of page without using session storage ? i think localstorage might solve problem you. heres nice tuorial

Guide for replacing Enterprise Lib 4.1 Caching with Azure Caching -

we have current implementation of caching uses enterprise library 4.1 caching block. website hosted on premise. but soon, web site hosted in azure doesn't support sticky session. result need refactor caching pattern , replace azure dedicated caching. i've not used azure caching before read few articles on msdn. i've not seen guide on how replace ent. lib caching azure caching. could please me steps needed replace enterprise lib caching azure dedicated caching.

matlab - Extracting the coordinates associated with voxels from a text file and store in a .mat file -

i have text file formatted follows: fileversion: 1 timepoint: 1 nrofrois: 3 roi: 1 nrofvoxels: 7 43 22 5 766 45 22 5 837 42 23 5 961 43 23 5 878 44 23 5 760 43 24 5 889 43 25 5 929 avgvalue: 860.000000 roi: 2 nrofvoxels: 7 20 21 5 668 22 21 5 727 23 21 5 748 24 21 5 727 23 22 5 810 23 23 5 868 24 23 5 764 avgvalue: 759.000000 i have extract coordinates (only first 3 columns) of voxels associated every roi , save them in different .mat file, respectively. example, after extracting coordinates of roi: 1, should have coordinates (first 3 colums) in .mat file (and roi 2 in different .mat file): 43 22 5 45 22 5 42 23 5 43 23 5 44 23 5 43 24 5 43 25 5 can please me achieve using matlab? open file , read line-by-line. here matlab code, read coordinates associated roi 1: filename = 'test.ert'; fid = fopen(filename); r_lines = 9; k = 1:r_l

dojo - OnDemandGrid not Loading in IE -

i using ondemandgrid jsonrest store.when hitting xhtml page directly ie ,the grid not loading.i getting script error below line : 0 char : 0 error : script error code : 0 url : http://localhost:8080/sample/dgridsample.xhtml if use ctlr+f5 grid loading.below javascipt code require([ "dgrid/ondemandgrid", "dojo/store/jsonrest", "dojo/dom", "dojo/dom-style", "dojo/_base/declare", "dgrid/extensions/columnresizer" ], function (ondemandgrid,jsonrest,dom,domstyle,declare,columnresizer) { jsonstore = new jsonrest({target: url,idproperty: "srno"}); grid = new(declare([ondemandgrid,columnresizer]))({ store: jsonstore, columns: layout, minrowsperpage : 40,

caching - How to send cache-control: no-cache from mobile? -

we're using varnish caching our pages, , configured differentiate user-agent versions of pages. mobiles have different version of page desktop browser. from desktop browser, it's easy send "cache-control: no-cache" ctrl+f5 shortcut. enforce varnish refresh page in cache. but how same thing mobile, how not have ctrl key ?? many etienne as know, 3 options available on different browsers: slide down settings -> refresh settings -> privacy -> clear cache (all/for site only) if 1 , 2 doesn't make click clear cache manually update: ok check safari , chrome at site : seems cannot send pragma: no-cache , browser, programmatically via meta tags, there no way it

scala - Create an object with vals that represent fields names on a case class -

i'm getting familiar scala macros. how can following (or possible): case class foo(name:string) //'keys' macro implementation val fookeys = keys[foo] //returns object fookeys{ val name = "name" } println(fookeys.name) // "name" i don't mind if definition local - long type defined , available.

html - Datatables not rendering on my table in MVC project -

i want improve , feel of tables , jquery datatables looks great doing can not work out why not rendering on table. have registered plugin correctly on bundle config. followed tutorial , ensured in correct place, no effect. here generated code browser. have put alert in javascript calls datatable() , being called. the head , body of document in different file _layout.cshtml index page table is. not should effect anything. <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title></title> <link href="/favicon.ico" rel="shortcut icon" type="image/x-icon" /> <meta name="viewport" content="width=device-width" /> <link href="/content/site.css" rel="stylesheet"/> <script src="/scripts/modernizr-2.5.3.js"></script> <script src="/conten

android - Save image to phone loaded from gallery -

i'm trying save image loaded gallery phone memory(local path). can guide me this? this how image gallery. imageview profilepicture; private uri imageuri; string picturepath; @override public void oncreate(bundle savedinstancestate) { profilepicture = (imageview) findviewbyid(r.id.profile_picture); profilepicture.setontouchlistener(new ontouchlistener() { @override public boolean ontouch(view arg0, motionevent arg1) { switch (arg1.getaction()) { case motionevent.action_down: { break; } case motionevent.action_up:{ uploadimage(); break; } } return true; } }); } uploadimage() intent galleryintent = new intent(intent.action_pick, android.provider.mediastore.images.media.external_content_uri); startactivityforresult(galleryintent, 1); @over

android - Alternative to showCase library for app user-tutorials? -

background i've found nice library showing tutorial user specific items on screen, called " showcase view library " . the problem the library quite buggy , puts textural items outside screen (for example when device rotated) . the question is there alternative library, or way fix it? the similar library i've found " supertooltips " . give https://github.com/deano2390/materialshowcaseview try, original showcaseview library deprecated.

processing - What is the filename of last saved frame using saveFrame() -

in processing, can save frame using saveframe('output-####.png') . save frame, name output-0001.png , , place in sketch folder. filename different because follows sequence, replacing #### next number in sequence. however, saveframe returns void. wish returned string of filename, doesn't. how can find out name of frame saved saveframe(...) you can wrap function tell framecount @ point: void draw() { println(saveframeandgetfilename("output-####.png")); } string saveframeandgetfilename(string filename) { saveframe(filename); string [] parts = filename.split("####"); //getting pedantic here... return parts[0] + framecount + parts[1]; } or more simply: void draw() { saveframe("output-####.png"); println("output-" + framecount + ".png"); } edit: fixed give actual filename

kendo mobile - Background for all iOS listviews -

i have been trying change background color listview elements in kendo-ui mobile application without luck, have tried: .km-list>li { background: transparent; } .km-root .km-ios .km-list>li { background: transparent; } .km-root .km-ios .km-content .km-list>li { background: transparent; } i appreciate help! thanks! try using kendo ui mobile themebuilder , may help.

html - Define rule for set of child elements -

as example, want labels , input fields within class have similar rules. css .specialbox input, label{ background-color: green; } when use previous code, apply rules input field within specialbox , all labels because ruleset applies each of comma separated items: .specialbox input label i can modify selector clarify both items individually .specialbox input, .specialbox label{ background-color: green; } in case desired result, @ expense of being concise here's fiddle demonstrate is there way apply set of rules children of particular selector, or forced repeat parent element selector? i believe there way sass or less , i'd prefer straight css for input , label elements, have repeat selector. if want children, can use wildcard: .specialbox * apply style of children.

ibm mq - Read mq queue errors in .bat file -

i using amqsput write message queue in batch file. call "c:\folderdir\code\mqfile\amqsput" queue qmgr < file the code works fine. want capture errors , echo appropriate response message. ex - if queue full, mq return error code , message. want capture message , code , print on screen. errorlevel doesnt capture mq error codes. capture output using for /f loop. @echo off /f "delims=" %%a in ('call "c:\folderdir\code\mqfile\amqsput" queue qmgr ^< file 2^>^&1') echo(%%a pause 2>&1 redirecting stderr stdout , for /f loop capturing stdout. example / proof of concept test.bat @echo off /f "delims=" %%a in ('call test2.bat ^< test.txt 2^>^&1') echo(test = %%a pause exit /b 0 test2.bat @echo off set /p "test=" echo(%test% echo error 1>&2 exit /b 0 test.txt hello output c:\users\user\desktop>test.bat test = hello test = error press key continue .

jquery - keyup not working on Chrome on Android -

i using bootstrap typeahead. it depends on jquery code work: el.on('keyup', dosomething() ) on chrome on windows works fine. on chrome on android doesn't. keyup event never fired. element bound has focus. this appears recent development. chrome 28.0.1500.64 android 4.1.2 sgp321 build/10.1.1.a.1.307 thanks --justin wyllie i came across same problem earlier today. how can android chrome not support these key events! assume you've found workaround now, here's fix came now. function newkeyupdown(originalfunction, eventtype) { return function() { if ("ontouchstart" in document.documentelement) { // if it's touch device, or test here android chrome var $element = $(this), $input = null; if (/input/i.test($element.prop('tagname'))) $input = $element; else if ($('input', $element).size() > 0) $input = $($('input', $element).ge

java - How to tell main thread that part of thread job is done -

is true notify works after thread finished? in code below can't notification until comment while (true). how tell main thread part of thread job done? public class threadmain { public thread reader; private class serialreader implements runnable { public void run() { while (true) { try { thread.sleep(3000); synchronized(this) { system.out.println("notifying"); notify(); system.out.println("notifying done"); } } catch (exception e) { system.out.println(e); } } } } threadmain() { reader = new thread(new serialreader()); } public static void main(string [] args) { threadmain d= new threadmain(); d.reader.start(); sy

Private/protected accessors to attributes in Rails 4 -

supose have following class: class foo < activerecord::base belongs_to :bar end in rails console can this: foo = foo.new foo.bar_id = 3 but can violates encapsulation principle. think better idea do: foo = foo.new foo.bar = bar.find(3); and bar_id should private/protected. has nothing mass assignment , strong parameters security issue too. is there way set private attributes? is there way make rails activerecord attributes private? class mymodel < activerecord::base private def my_private_attribute self[:my_private_attribute] end def my_private_attribute=(val) write_attribute :my_private_attribute, val end end

date - Opening hours in PHP -

i had client wanted online pizza shop, , didn't want customers place orders after opening hours - of course. made little simple script that, thought might share wants in future. <?php date_default_timezone_set('europe/stockholm'); // timezone $weekday = date(l); // today //print $weekday; // debug //print date("h:i"); // debug // set open , closing time each day of week if ($weekday == "friday") { $open_from = "11:00"; $opten_to = "21:45"; } elseif ($weekday == "saturday" || $weekday == "sunday") { $open_from = "12:00"; $open_to = "21:45"; } else { $open_from = "11:00"; $open_to = "20:45"; } // check if current time before or after opening hours if (date("h:i") < $open_from || date("h:i") > $open_to ) { print "closed!&q

Angularjs $http.post, passing array to PHP -

Image
i using service update db table. myapp.factory('creategal', function ($http, $q) { return { creategal: function () { var deferred = $q.defer(); var newgalleryarray = {}; newgalleryarray.galleryname = 'new image gallery'; newgalleryarray.client = 245; $http.post('/beta/images/create', {newgalleryarray: newgalleryarray}).success(function(data) { console.log(data); deferred.resolve(data); }); return deferred.promise; } }; }); php public function create() { print_r($_post); } the array returning empty. passing array incorrectly? chrome dev thanks it's been while since i've used php, doesn't $_post contain request paramaters? $http.post sends data through json payload, not request parameters. so, you'll need use json_decode

gwt maven plugin - GWT Custom Library Dependency issues -

i have created library of widgets export jar , reuse in several other projects. in library, depend on few other jars in war/web-inf/lib. problem when use library in project dependencies of library not carried on have add jars classpath , inherit them in project well. there has got better way handle dependencies, need use maven or there practice works? yes, if don't want manually manage dependencies have use dependency management system. 3 big ones maven, ivy, , gradle. have included links below can read them. quick search reveal pros/cons of each community , information alternative dependency management systems. there quite few out there. apache maven apache ivy gradle

How to do thIs diagram with force-directed graph in D3.js? -

Image
i made diagram viz.js. the dot code simple: <script type="text/vnd.graphviz" id="mydiagram"> digraph g { graph [ fontname = "arial", fontsize = 18, label = "digest email flow chart", size = "4,4" ]; node [ shape = ellipse, sides = 4, distortion = "0.0", orientation = "0.0", skew = "0.0", bgcolor = lightgray, style = filled, fontname = "arial" ]; "email notification" [shape=ellipse, shape = "mrecord" label="digest email\n(scheduled)"]; "sentiment analysis" [shape=ellipse, shape = "mrecord" label="sentiment analysis\n(triggered)"]; "google news" [shape=ellipse, shape = "mrecord" label="google news\n(scheduled)"]; "dilbert daily comics" [shape=ellipse, shape = "mrecord" label="dilbert daily comics\n(schedul

Reading CSV file using numpy in python 2.7 -

i have csv file of following format: x1 y1 z1 x2 y2 z2 cost 1 2 3 4 4 5 60 ...etc in excel. however, in wordpad, represented so: x1,y1,z1,x2,y2,z2,cost 1,2,3,4,4,5,60 basically, delimiter ','. trying read csv file using numpy, using genfromtxt. here code: import numpy np import csv stringio import stringio open ('1250_12.csv','rb') csvfile: data = np.genfromtxt(csvfile, dtype = none, delimiter = ',') print data although there no errors, program prints out [['x1' 'y1' 'z1' ..., 'y2' 'z2' 'cost'] ['5720.44' '3070.94' '2642.19' ..., '3061.01' '2576.29' '102.12'] ['5720.44' '3070.94' '2642.19' ..., '3023.6' '2597.81' '110.4'] ..., ['5748.56' '3102' '2631.75' ..., '3215.74' '2657.41' '148.58'] ['

c# - Handling errors during Entity Framework database operations -

i want handle errors such foreign-key violations during entity framework database operations. so, when user updates, inserts, or deletes record using framework, want catch sql errors , show them cleaner, readable error message. currently, without error handling, application left in broken state , error message pops long, specific stacktrace. i have had trouble finding clean solution problem. appreciated! also, i'm using entity framework, in combination silverlight , wcf data services. the common solution write try/catch in code. or use generic repository pattern suggested in following link - http://social.msdn.microsoft.com/forums/en-us/bf1f6e46-28d8-427f-a259-00f85b403238/entity-framework-centralized-exception-handling

Fitting jQuery mobile dialog to height and width of page, especially during orientation change -

is possible fit jquery mobile dialog height , width of page, during orientation change on tablet? i've tried wrapping div inside dialog , setting height , width percentages, has not worked reason. setting div static width , height works fine, looks bad on orientation change.

Android 4.1+ (Javascript browser): how to disable zooming/scaling on rotation? -

here meta tag: <meta name="viewport" content="initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,width=device-width,height=device-height,target-densitydpi=device-dpi,user-scalable=no" /> it works disable user zooming/scaling when in landscape mode. however, when starting in portrait mode, or when user rotates @ least once, zooming re-enabled. i tried this, (1) orientationchange event doesn't fire when starting in portrait mode , (2) doesn't anyway. addevent (window, 'orientationchange', function (evt) { var viewportmeta = document.queryselector('meta[name="viewport"]') if (viewportmeta) { viewportmeta.content = "initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,width=device-width,height=device-height,target-densitydpi=device-dpi,user-scalable=no" } }) how can disable zooming/scaling entirely on android browsers 4.1 , up? note: issue samsung's default android browser. this migh

c++ - How to assert/test when uninitialised memory is passed to function -

i have situation part of code has been found passed uninitialized memory @ times. looking way in assert when case occurs when running debug-heap. function thrown in places in tracking bugs: void foo( char* data, int databytes ) { assert( !hasuninitialiseddata(data,databytes) ); //, ... } i have seen there tools valgrind , run on windows there drmemory. these run external application don't find issue when occurs developer. more importantly these throw thousands of reports qt , other irrelevant functions making things impossible. i think idea have function search 0xbaadfood within array there whole series of potential hex values , these change per platform. these hex values may valid when integers stored not sure if there more information can obtained form debug-heap. i interested potential there crt function, library, visual-studio breakpoint, or other helper function doing sort of check. 'feels' there should 1 somewhere already, couldn't find yet if

c++ - Boost Asio pattern with GUI and worker thread -

i implement boost asio pattern using thread gui , worker thread socket io. the worker thread use boost::asio::io_service manage socket client. operations on sockets performed worker thread only. the gui thread needs send , receive messages worker thread. i can't figure how implement pattern using boost asio. i've implemented socket communication in standard asio way (i call io_service.run() worker thread , use async_read_some / async_send ). don't need strands because io_service.run() called worker thread only. now i'm trying add cross thread message queue. how can implement it? should run io_service gui thread too? or should use strands post post messages gui thread worker thread (without calling io_service.run() or io_service.poll_one() gui thread), , use operating system's gui message loop post messages worker thread gui thread? if need call io_service.run() or io_service.poll_one() gui thread too, need use strands on socket opera

Running java jar outside eclipse requiring files in bin dir -

i'm developing using eclipse , i'm using api requires files in /bin directory (which path mean in java don't know). exported app jar , put required files in same directory jar file, when run app using terminal, app not able locate files. i'm unable understand paths issue. i'm running app command: java -jar app.jar i changed terminal directory directory contains jar file , tried with: java -cp . -jar app.jar that didn't work. edit: error application not able locate required files. in eclipse had put files in /bin dir in order api locate them. here's full exception: exception in thread "main" java.io.ioexception: failed find resource /cmu/arktweetnlp/50mpaths2 @ cmu.arktweetnlp.util.basicfileio.getresourcereader(basicfileio.java:233) @ cmu.arktweetnlp.impl.features.wordclusterpaths.<init>(wordclusterpaths.java:29) @ cmu.arktweetnlp.impl.features.featureextractor.initializefeatureextractors(featureextractor.java:1

c# - Executing IDatabaseInitializer -

i've implemented own database initializer inherited dropdatabaseifmodelchanges<>() so: public class mydatabaseinitializer : dropdatabaseifmodelchanges<mydatabasecontext>() i use in global.asax file , do: protect void application_start() { // normal app start stuff database.setinitializer(new mydatabaseinitializer()); // create ninject kernel , set dependencyresolver here } now sets initializer want execute void initializedatabase(tcontext context); drops , creates database. it when gets line executing database request such as: _repository.mytable.tolist() note, i'm using repository pattern , ninject. however wish execute drop create on application start! how that? okay, nailed it. my idatabaseinitializer implementation looks this: public class mydatabaseinitializer : dropdatabaseifmodelchanges<mydatabasecontext>() { public mydatabaseinitializer() : base () { var context = new mydatabasecon

iphone - How to edit the Info.plist file in build folder -

i'm creating live audio streaming app using titanium studio (version 3.1.1). need enable background audio playback iphone. background audio works in android emulator not in iphone sinulator (when click home button, audio fades away , stop). created audioplayer , set audiosessionmode. ti.app.player = ti.media.createaudioplayer({ url :'http://broadcast.infomaniak.net/radionova-high.mp3', allowbackground :true }); titanium.media.audiosessionmode = ti.media.audio_session_mode_playback; when add , save following lines info.plist file , run project, file reloads , remove these lines. how correctly edit file? or there way background audio in iphone? <key>uibackgroundmodes</key> <array> <string>audio</string> </array> you add section tiapp.xml. here blog post on topic. http://bencoding.com/2012/07/15/using-titanium-ios-specific-configurations/

wso2 esb bam server profile namespace -

how can achieve namespace handling under bam server profile stream definition (from wso2 esb admin console) instead of doing under mediation flow using xpath expression? suspecting can lead performance problem when input payload large have add more property mediators extract values payload. namespace facility not yet supported bam mediator. property mediator alternative. hope implement feature in bam mediator future.

salesforce - how to use Ifram widh CKEditor Rich Text Field? -

use iframe in vf in src there ckeditor use through php not display ckeditor when put url in vf this how replace salesforce rich text editor

asp.net mvc - Silverlight web deploy dont change application -

i have deployed asp mvc web application hosts silver light out of browser application. client need go specific site , install app on computer. working ok noticed have got old version of silver light app , each deploy don't change anything. can issue? each deploy via web deploy , deletes files prior publishing still silver light app don't change.

c# - conditional EditorBrowsable by web.config AppSettings -

i have project a used reference in project b . project a has class method should either visible or not depending on condition specified in project b . method visible if in web.config appsettings of project b there key "displaymethod" value "true". this more of version control. don't want create separate dll new version of project a. i'd single dll able support both old , new version. way developer of project b can switch version in web.config, rebuild project , go. restrictions i don't have control on project b. can ask developer of project b simple modification web.config modification. i have no idea projects using project a. project open source project , can used anybody, potentially in thousands of projects. by "method visible" mean same functionality following code do: [editorbrowsable(editorbrowsablestate.never)] public string somemethod(string s) { return "hello " + s; } research far: i've seen t

zend framework - ZF2 get another navigation in global.php -

this navigation in global.php 'navigation' => array( 'default' => array( 'loja' => array( 'label' => 'loja', 'route' => 'loja', 'params' => array('action'=>'index'), 'pages' => array( 'estoque' => array( 'label' => 'estoque', 'params' => array('action'=>'index'), 'action'=>'index', 'id' => 'estoque', 'route' => 'estoque', )),

perl - Crop image using GD library -

i using gd library in perl script allows me draw true-type-font text. because don't know exact size @ beginning, set my $i = new gd::image(3000, 3000); and draw text my $black = $i->colorallocate(0, 0, 0); @b = $i->stringft($black, './ttf/cour.ttf', 12, 0, 0, 0, "\n$text"); where @b contains crop data. i wish execute (incorrect syntax): $i->crop(0, 0, $b[2], $b[3]); ...but there no such crop function available. how can crop image? there known work-around? typically use the "copy" methods of gd move selected data 1 image new image. or if need compute width , height of strings drawn gd , check out gd::text .

Java generic method type casting -

why happened? 1 line in code works while other similar line doesn't. automatic type cast happen in conditions? have tried assign gt.echov() object , works well; when assign string, same error come out again. public class genemethodtest { public static void main(string... args) { genemethodtest gt = new genemethodtest(); gt.<string>echov(); //this line works gt.<string>echov().getclass();//this line leads type cast exception } public <t> t echov() { t t=(t)(new object()); return t; } } gt.<string>echov().getclass(); produces equivalent of following sequence of operations: // inside echov object t = new object(); // note not string! object returnvalue = t; // in main string stacktemp = (string) returnvalue; // operation fails stacktemp.getclass(); what "

python - Being able to have multiple items in Django -

i'm making system keeps track of orders customer orders looking @ products, purchase date, price, etc. if want able allow user to, say, purchase more 1 product...(i.e. 5, 20, 323523). how can allow user add more products? here's code have: class purchaseorder(models.model): product = models.charfield(max_length=256) vendor = models.charfield(max_length=256) dollar_amount = models.floatfield() purchase_date = models.datefield() notes = models.textfield( null=true, blank= true) i want where when i'm @ add page: http://i.imgur.com/u1pu1gp.png i can add more 1. foreign key relationship? how go implementing that? yeah, tutorial says 'also note “add another” link next “poll.” every object foreignkey relationship gets free.'. and personally, add foreign key user. solution here says by: from django.contrib.auth.models import user ... user = models.foreignkey(user) that way, know products belong users.

Troubleshooting MySQL with Entity Framework -

when connect mysql using workbench works fine. when connect mysql using java works fine. when connect mysql using entity framework designer (e.g. update models database) works fine. but when run project "no connection made because target machine actively refused it". the entity framework designer using same connection string application. else problem? edit: when connect mysql using entity framework in console application works fine. when connect mysql using entity framework in console application in debug mode works fine. when connect mysql using entity framework in unit test project works fine. when connect mysql using entity framework in unit test project in debug mode doesn't work. is debug mode , release mode configurations same? ie 1 running in x86 , other in x64?

algorithm - Finding Contiguous Areas of Bits in 2D Bit Array -

Image
the problem i have bit array represents 2-dimensional "map" of "tiles". image provides graphical example of bits in bit array: i need determine how many contiguous "areas" of bits exist in array. in example above, there 2 such contiguous "areas", illustrated here: tiles must located directly n, s, e or w of tile considered "contiguous". diagonally-touching tiles not count. what i've got far because these bit arrays can become relatively large (several mb in size), have intentionally avoided using sort of recursion in algorithm. the pseudo-code follows: let s source data array let c array of identical length source data used track "checked" bits foreach index in s if c[i] continue else set c[i] if s[i] extract_area(s, c, i) extract_area(s, c, i): let t target data array storing bits of area we're extracting let f stack of tiles search next

fadein - how to fade out one div and fade in another div at same time using Jquery -

i have 3 divs, newdivforwraping1,#newdivforwraping5,#newdivforwraping9 . i want fadein newdivforwraping1 div , fade out #newdivforwraping5,#newdivforwraping9 and after fade out newdivforwraping1,#newdivforwraping9 , fadein #newdivforwraping5 , fadein #newdivforwraping9` and fadeout #newdivforwraping1,#newdivforwraping9 . at point on screen, have div seen. that <div1>--fade in <div2>--fade out <div3>--fade out <div2>--fade in <div3>--fade out <div1>--fade out <div3>--fade in <div1>-fade out <div2> -- fade out kindly notice whatever div appears on screen, on same location on screen. have set timer using setinterval repeat process when user hover mouse on it, want pause (if not possible, stop). , resume when mouse not hovering on it. have my code here , see current partially working solution here. helping out.. try it (function () { var = 1; var timer=setinterval(function () { if(i>3) {i=1

c# - LINQ to SQL will not generate sargable query -

i'm using linq sql (not entity framework), system.data.linq.datacontext library, hitting sql server 2005 database , using .net framework 4. the table dbo.dogs has column "active" of type char(1) null. if writing straight sql query be: select * dbo.dogs active = 'a'; the linq query this: from d in mydatacontext.dogs d.active == 'a' select d; the sql gets generated above linq query converts active field unicode. means cannot use index on dbo.dogs.active column, slowing query significantly: select [t0].name, [t0].active [dbo].[dog] [t0] unicode([t0].[active]) = @p1 is there can stop linq sql inserting unicode() call (and losing benefit of index on dogs.active)? tried wrapping parameters using entityfunctions.asnonunicode() method, did no (it inserted convert() nvarchar instead of unicode() in generated sql), eg: ...where d.active.tostring() == entityfunctions.asnonunicode('a'.tostring()); you can little hack (as require

php - mysql select js variable -

hey wanna know if possible? $result = mysql_query("select * posted_events month_ = ".echo"months";." ); obviously syntax wrong (because doesn't work), want select data database equal variable happen js variable in js file. know can't assign js variable php, unless use ajax, when use ajax, returns empty string first, runs php , gives me value of variable, php script ran. wondering if echo variable. i'm not using submit or hidden post method because isn't necessary in i'm trying create. need find way php recognize variable , make query. please me. thank lot. my js: var date = new date(); var month = date.getmonth(); var day = date.getday(); var monthdate = date.getdate(); var monthnow= date.getmonth(); var monthnow2; var current = 1; var first_date = new date(date.getfullyear(), date.getmonth(), 1); var start_day = first_date.getday(); var start_day2; var first_date2; var weekday; var day_selected; var day_

ssis - C# code is failing - trying to get excel cell A3 value -

i running code value fro cell a3 , giving me error . i using ssis excel cell a3 , want show on message box later on going store in variable. error: system.reflection.targetinvocationexception: exception has been thrown target of invocation. ---> system.invalidoperationexception: executereader requires open , available connection. connection's current state closed. @ system.data.oledb.oledbconnection.checkstateopen(string method) @ system.data.oledb.oledbcommand.validateconnection(string method) @ system.data.oledb.oledbcommand.validateconnectionandtransaction(string method) @ system.data.oledb.oledbcommand.executereaderinternal(commandbehavior behavior, string method) @ system.data.oledb.oledbcommand.executereader(commandbehavior behavior) @ system.data.oledb.oledbcommand.executereader() @ st_863f36c5697844e3916f1142373f3d3a.csproj.scriptmain.main() --- end of inner exception stack trace --- @ system.runtimemethodhandle._invokemethodfast(object

menu - add class to root of branch in HMENU -

hello have structure of site this site a -> site a1 -> site a2 -> site a3 site b -> site b1 now in hmenu when i'm on site or site b have on class "active" has diffrent background. want keep class when i'm in site a1, a2, a3 (make active site a) , when i'm on b1 want make active site b how can ? did mean "site" or talking regular pages , subpages? if latter, should go different menu item states. no, cur, act, ifsub, actifsub , described here: http://docs.typo3.org/typo3cms/typoscriptreference/menuobjects/commonitemstates/index.html

C# Converting or Parsing a Variable to DateTime -

i need write short piece of code take variable , convert datetime type. unfortunately keeps saying fine in build when run it, gives me error because not seeing variable, string. datetime datevalue = (convert.todatetime("@deliverydate")); you've misunderstood how variables work. in c#, variables need referenced identifier in code. c# not support string substitution of variables might find in language php . assuming you've define variable in code, , populated value database: … string deliverydate = (string)command.executescalar(); you can convert datetime this: datetime datevalue = convert.todatetime(deliverydate);

c# - When typing in dropdownlist, make Windows search for more than 1 character? -

this may bit confusing explain, have combobox set dropdownlist style. default, typing while object has focus searches item beginning whatever user typed. example, in combobox 1, 2, , 3, typing 1 select 1. if have combobox a1, a2, a3 however, typing a1 not combined 1 string, rather search , search 1. know how change behavior in cleanest fashion. what i'm trying have combobox fractions such 1/8, 1/16, , on, accessed typing "1/8". however, search function takes 1 character @ time. if need suggestion, can use code block: var peopleautocomplete = context.people .select(c => new { c.firstname, c.surname }) .toarray(); list<string> peopleautocompletestring = new list<string>(); foreach (var item in peopleautocomplete) { peopleautocompletestring.add(item.surname + " " + item.firstname); } autocompletestringcollection collec

ruby - What is Camping::Server.start invoking in /bin/camping? -

i'm studying how camping web framework works right now, , don't understand camping::server.start @ line 10 in /bin/camping doing. i expected call start method in /lib/camping/server.rb @ line 131, , put simple puts 'hello' statement @ beginning of method, expecting statement invoked when ran /bin/camping . however, never saw puts statement called, can assume it's not start method getting called. i feel i'm missing obvious here. here link camping github page , relevant sections of code: github: https://github.com/camping/camping from /bin/camping : #!/usr/bin/env ruby $:.unshift file.dirname(__file__) + "/../lib" require 'camping' require 'camping/server' begin camping::server.start rescue optionparser::parseerror => ex puts "did error" stderr.puts "!! #{ex.message}" puts "** use `#{file.basename($0)} --help` more details..." exit 1 end from /lib/server.rb : def

How to get a time widget in django forms? -

i know can have date widget in django. birth_year = forms.datefield(widget=selectdatewidget(years=birth_year_choices)) is there similar selecting time in django? you're looking datetime field. birth_time=forms.datetime() for more info: https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.datetimefield

ios - FBSession.activeSession.permissions does not appear to accurately depict the valid granted permissions -

i observing following.... i authenticate user via following (note in completion block nslogging permissions) nsarray *permissions = [[nsarray alloc] initwithobjects: @"email", @"publish_actions", nil]; [fbsession openactivesessionwithpublishpermissions:permissions defaultaudience:fbsessiondefaultaudiencefriends allowloginui:allowloginui completionhandler:^(fbsession *session, fbsessionstate state, nserror *error) { nslog(@"permissions %@",fbsession.activesession.permissions); }]; as user start app , proceed login w/ fb. i presented screen reads "app access public profile, friend list , email address." , select "ok" i presented screen reads "app post friends on behalf" , select "skip". 3) completion block code spi

google app engine - GAE Datastore read/write latency in non-production app versions -

being awawre of fact datastore shared among app versions on google appengine, have created separate version of app use special purposes. i have noticed, however, that, despite fact version executing same code production version, responds client requests slower production; requests result in deadlineexceedederror . a typical error can observe in logs looks this: ... friend.put() file "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/db/__init__.py", line 1070, in put return datastore.put(self._entity, **kwargs) file "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/datastore.py", line 579, in put return putasync(entities, **kwargs).get_result() file "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 612, in get_result return self.__get_result_hook(self) file "/base/data/home/runtimes/python27/python27_lib/ve

Apache SNI: multiple SSL certificates on one IP address -

today i'm trying configure apache run 2 domains each own ssl certificate. have read supported sni long apache configured recent version of openssl. verified is: [notice] apache/2.2.22 (ubuntu) php/5.3.10-1ubuntu3.7 suhosin-patch mod_ssl/2.2.22 openssl/1.0.1 configured -- resuming normal operations i thought had set second domain , certificate, when try visit second domain in chrome following error: you attempted reach example2.com, instead reached server identifying example1.com. this post seems closest issue: hosting multiple ssl certs on apache but can tell server configured correctly (clearly not!) i have following directives in conf file example2.com servername example2.com sslengine on sslcertificatefile /etc/apache2/ssl/example2.com.crt sslcertificatekeyfile /etc/apache2/ssl/example2.com.key it looks right me. why apache serving example1's cert when visit example2? turns out domain 1 configured <virtualhost *:443> i use webmin, re

Disable PHP script execution limit -

set_time_limit(0) reset counter 0, need call every 30 seconds or in order script continue running without breaking in error. is there way disable time limit stuff, without having call function repeatedly? setting limit 0 disables entirely. setting non-zero resets countdown value. e.g. while(true) { set_time_limit(30); sleep(29); } will run (virtually) indefinitely, because limit keeps getting reset 30, 1 second before expire.

javascript - How do sites bypass a browsers 'block popup / under' settings -

when visiting sites close browser find load of popups sitting behind usual online casinos , 'mackeeper'. how these bypassing browsers popup settings ? thought might opening pages in new window using javascript automate , target="_blank" in new window, thought target="_blank" opens webpage in new tab opposed new page hidden behind current page using.. ideas ? they open popup on click event document. browsers allow popups user initiated events (like button clicks). if use 2 monitors , browse on non main monitor can catch pesky popunders before load.

javascript - Backbone.js - Filtering a large JSON file -

i building backbone application display list of contacts. have followed tutorials online, , followed model of loading entire list of contacts memory in 1 go, filtering results user enters values textbox. there 10 - 12 attributes of each contact , data needs filtered 3 of them. example: name, location , zipcode the problem when data set gets large. if run application json file containing 5000 users becomes prohibitively slow. techniques can employ around problem? need sort json data? else can do? i hope question not vague , have explained situation sufficiently.

image upload from url with php oop -

i using code bellow upload images wp directory. tried modified code can download images directly url didnt have luck. my code bellow: <?php class imguploader { var $exts = array( ".png", ".gif", ".png", ".jpg", ".jpeg" ); //all extensions allowed uploaded var $maxsize = 9999999; //if set "0" (no quotes), there no limit var $uploadtarget = "../wp-content/uploads/"; //make sure have '/' @ end var $filename = ""; //this automatically set. not need worry var $tmpname = ""; //this automatically set. not need worry public function startupload() { $this->filename = $_files['uploaded']['name']; $this->tmpname = $_files['uploaded']['tmp_name']; if( !$this->iswritable() ) { die( "sorry, must chmod upload target 777!" ); } if( !$this-&