Posts

Showing posts from March, 2014

java - Why more than one chromosome per solution (or genotype)? -

i trying started using jenetics java library genetic algorithms , there don't understand ga limited backgroud; as understand ga generates population of arrays of m elements, each array potential solution evaluated, once evaluated, potential solutions sorted , best chosen create new population, etc. find solution (genotype) in jenetics list of arrays each array understand potential solution, each array can have different lengths , don't understand why use structure instead of vector of genes. see page 6 of the manual , section 3.1.3. if possible know why this. hope have made question clear enough. the "array" of potential solutions (phenotpyes/genotypes) collected in population. genotype represents 1 possible solution. don't confused 2-dimensional structure of genotype, should give additional flexibility modeling more complicated problems. geneotype still represents 1 possible solution , 1 individual of population. a genotype classical binary

ios - How to change the starting cursor position inside UITextView -

i have uitextview become first responder on viewload. want change position of cursor of uitextview @ position in x first 2 line only. maybe use uitextkit ( a tutorial ). for example have rounded text can use like: uibezierpath* exclusionpath = [uibezierpath bezierpathwithovalinrect:yourtextview.bounds]; exclusionpath = [exclusionpath bezierpathbyreversingpath]; yourtextview.textcontainer.exclusionpaths = @[exclusionpath];

java - generate longest possible palindrome for a given string -

i've been trying generate longest possible palindrome included in given string, in java. but, ended in errors. let me provide sample input , output may . input: this sample string testing output: ttissaepeassitt it great if solve me this!! thank you!! you use recursive algorithm: public string findpalindrom(string input){ string palindrom = ""; for(int i=0; i<input.length(); i++){ char c = input.charat(i); // explore string beginning, char char for(int j=input.length()-1; j>i; j--){ // explore string end, char char if(input.charat(j)==c){ // found letter palindrom string newpalindrom = c + findpalindrom(input.substring(i+1, j)) + c; if(newpalindrom.length() > palindrom.length()) palindrom = newpalindrom; } } } if(palindrom.length()==0 && input.length()>0) palindrom += input.charat(0); // manage case palindrom possible single char.

java - Stop all threads in a custom thread pool (like shutting down) -

in java library thread pool implementations, shutting down pool means: -stop accepting new tasks -previously submitted tasks executed -all pool threads terminated regarding last point, how stop pool thread potentially try take new task, after has been stopped? my threads (in java pseudo code): public void run() { while(!isstopped) { task task = taskqueue.take(); //line1 task.run(); //line2 } } and have method stop: public synchronized void stop(){ isstopped = true; this.interrupt(); } in thread pool class, have method stop: public synchronized void shutdown(){ this.isshutdown = true; //to stop whole pool for(poolthread thread : threads) thread.stop(); } the point is, if thread reaches line 1, isstopped false, @ same moment set true pool class. how remember should stop thread again? calling interrupt suffice? send shutdown messages through task queue: static task stop = // special value public void run() { while (true) {

java - Adding subview from GUI to custom class using Netbeans -

i'm using netbeans , gui builder. i have form jframetest. created personpanel jpanel class. dragged-dropped jframetest created netbeans. jframetest used netbeans contains auto-generated code. what want add example jtable custom personpanel jpanel class , have jtable code inside. now, when i'm dragging swing subviews jtable inside custom class, code generated in jframetest class created netbeans. how can ?

java - Assigning a controller to a .fxml when loading it in an AnchorPane -

my scene made out of several anchorpanes. 1 of these anchorpanes dynamic , let change this: public void speelveldbegin(){ try { speelbord = fxmlloader.load(getclass().getresource("/view/beginview.fxml")); this.maincontainer.getchildren().setall(speelbord); } catch (ioexception e) { e.printstacktrace(); } this works well, assign controller in code rather having set in .fxml can give parameters controller instance. help appreciated.

httpwebrequest - CalDav sync-token expiry -

in previous question , asked syncing data davical server. ended concluding there bug on davical when querying caldav server invalid sync token, server should return error but, instead, returns whole set of events on server. so started looking alternative caldav server. use sabredav. followed handy tutorial here . on there says: caveats note server free 'forget' sync-tokens have been issued. in case may needed full-sync again. in case supplied sync-token not recognized server, http error emitted. sabredav emits 403. that looks promising : need ! so getting sync-token http://sabre.io/ns/sync/15 . i submit report query follows (maybe that's things wrong?!) string synctoken = "http://sabre.io/ns/sync/15"; string body = " <d:sync-collection xmlns:d=\"dav:\"> " + " <d:sync-token>" + synctoken + "</d:sync-token> " + " <d:sync-level>1<

xcode7 - Fixing NSURLConnection Deprecation from Swift 1.2 to 2.0 -

i have function written in swift 1.2, checks reachability of address or ip. here : func ishostconnected(hostaddress : string) -> bool { var response : nsurlresponse? let request = nsmutableurlrequest(url: nsurl(string: hostaddress)!) request.timeoutinterval = 3 let data = nsurlconnection.sendsynchronousrequest(request, returningresponse: &response, error: nil) return ((response as? nshttpurlresponse)!.statuscode == 200) } now since, nsurlconnection deprecated, per xcode suggestion tried writing using nsurlsession.datataskwithrequest , here : func ishostconnected(hostaddress : string) -> bool { let request = nsmutableurlrequest(url: nsurl(string: hostaddress.stringbyaddingpercentescapesusingencoding(nsutf8stringencoding)!)!) request.timeoutinterval = 3 let session = nsurlsession(configuration: nsurlsessionconfiguration.defaultsessionconfiguration(), delegate: nil, delegatequeue: nsoperationqueue.mainqueue()) var responsecode =

ios - How to make the customized UITableViewCell xib width to fit the device width -

Image
i creating uitabletableviewcell nib file. using width of 320 the cell width. found when run app in iphone 6 simulator, cell cannot occupy whole width of table view. if use iphone 5s, width fine. want know how adjust width of xib fit different iphone versions. did enable use auto layout , use size classes below first in both table view , table view cell .and tell me problem 1)after select both image , label , below 2) select image , below 3) select label following can check link below: ios - custom table cell not full width of uitableview

jboss - Is there any way of configuring Oracle ATG to load java class changes dynamically? -

i interested in setting development environment atg in changes on class take effect after build done, without restarting server , building again ear file. i have searched in product documentation thing saw can configure load dynamically configuration files section. is there other way of configuring environment better productivity? use jrebel . dynamic re-loading java classes, property files , other deployable assets. great productivity.

ios - UIAddressBook in UITableView with NSObjectClass -

i need make uitableview fetches address book contents in , uisearchbar searches address book contents. i need implementation project http://www.appcoda.com/search-bar-tutorial-ios7/ but problem here data static , want load address book's data in it. i have created contactdata nsobject class. in following method, creating object each contact. @ end, nsmutablearray named contactarr. -(void)loadcontacts{ abaddressbookref addressbookref = abaddressbookcreatewithoptions(null, null); if (abaddressbookgetauthorizationstatus() == kabauthorizationstatusnotdetermined) { abaddressbookrequestaccesswithcompletion(addressbookref, ^(bool granted, cferrorref error) { abaddressbookref addressbook = abaddressbookcreatewithoptions(null, null); //nslog(@"%@", addressbook); }); } else if (abaddressbookgetauthorizationstatus() == kabauthorizationstatusauthorized) { cferrorref *error = null; abaddressbookref addressbook = abaddressbookc

java - ADT not updated in eclipse -

Image
i using eclipse build android project, when open eclipse, error displayed: for solve problem, downloaded last version of adt (23.0.6) , install in eclipse folowing : help>install new software error displayed : the operation cannot completed. see details. details: cannot complete install because of conflicting dependency. software being installed: android development tools 23.0.6.1720515 (com.android.ide.eclipse.adt.feature.feature.group 23.0.6.1720515) software installed: android development tools 18.0.0.v201203301601-306762 (com.android.ide.eclipse.adt.feature.group 18.0.0.v201203301601-306762) 1 of following can installed @ once: adt xml overlay 18.0.0.v201203301601-306762 (overlay.com.android.ide.eclipse.adt.overlay 18.0.0.v201203301601-306762) adt xml overlay 23.0.6.1720515 (overlay.com.android.ide.eclipse.adt.overlay 23.0.6.1720515) cannot satisfy dependency: from: android development tools 23.0.6.1720515 (com.androi

Write to a file in C -

in c programming have learned file io , have run sample code is: #include <stdio.h> main() { file *fp; fp = fopen("e:\\tmp\bae.txt", "w+"); fprintf(fp, "this testing fprintf...\n"); fputs("this testing fputs...\n", fp); fclose(fp); return 0; } here code works fine , fputs() returns -1 means code works fine. have created directory tmp on e: drive, code doesn't create file bae.txt ..' can tell me why happening? instead of fp = fopen("e:\\tmp\bae.txt", "w+"); use fp = fopen("e:\\tmp\\bae.txt", "w+"); as \ has specific meaning in string.

android - Genymotion unable to load VirtualBox engine on Windows 10 -

i upgraded windows 10 build 10130 , reasons, genymotion doesn't seem working. says "unable load virtualbox engine." now did bit of research , solutions suggested delete host-only network virtual box settings. here's thing don't have networks listed there. , 1 found on network , sharing center cannot deleted. even clean install hasn't solved issue please help. step 1: run virtualbox administrator step 2: go file -> preferences -> network -> host networks step 3: add new 1 or edit old 1 (if not work, delete existed , create new one ): adapter tab: ipv4 address: 192.168.x.201 ipv4 network mask: 255.255.255.0 dhcp server tab: server address: 192.168.x.100 server mask: 255.255.255.0 lower address bound: 192.168.x.101 upper address bound: 192.168.x.199

hadoop - Non localization by Resourse Manager in YARN -

in definitive guide of hadoop mentioned that: "sometimes locality constraint cannot met, in case either no allocation made or, optionally, constraint can loosened. example, if specific node requested not possible start container on (because other containers running on it), yarn try start container on node in same rack, or, if that’s not possible, on node in cluster." i not able this, because if application manager needs container on particular node block resides , in case if rm not able create container on particular node requested due unavailability, may create container on node according above sentence, how serve purpose of localization?

python - Running Django migrations when deploying to Elastic Beanstalk -

i have django app set on elastic beanstalk , made change db have applied live db now. understand need set container command, , after checking db can see migration run, can't figure out how have more controls on migration. example, want migration run when necessary understanding, container run migration on every deploy assuming command still listed in config file. also, on occassion, given options during migration such as: any objects realted these content types foreign key deleted. sure want delete these content types? if you're unsure, answer 'no' how set container command respond yes during deployment phase? this current config file container_commands: 01_migrate: command: 'source /opt/python/run/venv/bin/actiate && python app/manage.py makemigrations' command: 'source /opt/python/run/venv/bin/activate && python app/manage.py migrate' is there way set these 2 commands run when necessary , respond yes/no options

asp.net mvc - Kendo Grid Date is null for 13/06/2015 all dates after 12 -

my grid: @(html.kendo().grid<ibatechnologies.iba.web.models.assettransactiondetailviewmod el>() .name("transactiongrid") .pageable() //.editable(editable=>editable.mode(grideditmode.inline)) .columns(colums => { colums.bound(p => p.assetcode).width(100); colums.bound(p => p.assetdesc).width(100); colums.bound(p => p.remark).width(100); colums.bound(p => p.currencycode).width(100); colums.bound(p => p.rate).width(100); colums.bound(p => p.currencyrate).width(100); colums.bound(p => p.lcyamount).width(100); colums.bound(p => p.documentdate).width(100); colums.command(command => { command.destroy(); }).width(100); }) .toolbar(toolbar => toolbar.create()) .editable(editable => editable.mode(grideditmode.incell)) .datasource(datasource => datasource .ajax() .pagesize(20) .serveroperation(false)

nginx - php header <!-- Core Error --> and file currupted -

i'm having issue since update php version 5.4.41. i'm running on nginx server php 5.4.41. i've made php code allow me retrieve file , download it. since updated php code file i'm trying download corrupted. upload txt file , see happening. ex: if upload text file test inside after download it, become <!--core error-->test here complete code <?php require_once("include.php"); if(!xml2php("customer")) { $smarty->assign('error_msg',"error in language file"); } //grab key url $key = $var['key']; if ($var['escape'] == 1) { if (isset($key)) { $q = "select * ".prfx."table_customer_backup customer_backup_key=".$db->qstr($key); if(!$rs = $db->execute($q)) { force_page('core', 'error&error_msg=mysql error: '.$db- >errormsg().'&menu=1&type=database'); exit; } else { $customer_backup_filename = $rs->field

html - Only one product is listing in php email even with multiple products in order -

i created php email send out after order has been placed. i'm not sure doing wrong because if have more 1 different type of product, email send first 1 added. transaction receipts sending authorize.net include of products order, not email. not getting errors , email sending fine. $to = $email; $subject = 'your example order'; $message = '<img src="'.$logoimage.'">'; $message = ' <html> <head> <title>example order</title> </head> <body> <p>thank ordering us!</p> <p>your order sent , start processing immediately.</p><br><br> <p>a charge of $'.$total_price.' taken '.$billtoname.'\'s account sent order. <p>your order contained:</p> <p> '.$prdqty.' - '.$prdsize.' - '.$prdname.'</p><br><br> <p>'. $authorrizeresponsetext.';</p><

MongoDB getmore on a collection is very slow -

i trying debug high cpu issue on mongodb instance. have 2 shard r3.large aws instances. there not many page faults compared ops count. system profile shows ton of getmore entries below. please me in finding out causing getmore slow. { "op" : "getmore", "ns" : "mydb.mycollection", "cursorid" : 74493486271, "ntoreturn" : 0, "keyupdates" : 0, "numyield" : 7, "lockstats" : { "timelockedmicros" : { "r" : numberlong(16140), "w" : numberlong(0) }, "timeacquiringmicros" : { "r" : numberlong(6458801), "w" : numberlong(294321) } }, "nreturned" : 120, "responselength" : 13100, "millis" : 6304, "exec

Android Studio not downloading sdk -

my android studio starts downloading android-sdk_r22.6.2-windows.zip file upon opening, don't know should put file android studio pick it. please me put file. these sdk tools, required develop , test apps. just download zip. extract wherever want. then, when open android studio, it'll ask sdk tools directory. point extracted zip file.

rust - Implementing Default on nested structures causes a stack overflow -

i found unusual behavior of std::default . if create nested structure default setters , try create highest level struct default parameters, causes stack overflow. this code compiles, when try run throws thread '<main>' has overflowed stack : use std::default; pub struct { x: i32 } impl default { fn default() -> { { ..default::default() } } } fn main() { let test = { ..default::default() }; } but if set defaults of inherited props, works: use std::default; pub struct { x: i32 } impl default { fn default() -> { { x: 0 } } } fn main() { let test = { ..default::default() }; } is known issue , should post rust issue tracker? compiler version rustc 1.2.0-nightly (0250ff9a5 2015-06-17) . of course causes stack overflow. to make clearer, let's change example little: pub struct { x: i32, y: i32, } impl default { fn default() -> { { x: 1, ..default::default() } }

c# - jni4net - java.lang.UnsatisfiedLinkError: net.sf.jni4net.Bridge.initDotNet()I -

i've found library , loved much... can't start using it... don't know i'm doing wrong, can me? i've read wiki , environment setup. , i'm trying simple hello world in java calling c#. but i'm receiving error: java.lang.unsatisfiedlinkerror: net.sf.jni4net.bridge.initdotnet()i here's folder setup in eclipse: https://cloud.githubusercontent.com/assets/6147142/8265327/e2419670-16cd-11e5-85bd-dae9ea275186.png here's main class: package testjni4net; import java.io.ioexception; import java.lang.string; import net.sf.jni4net.bridge; import system.*; import system.object; import system.io.textwriter; import system.collections.idictionary; import system.collections.ienumerator; public class teste1 { public static void main(string[] args) throws ioexception { // create bridge, default setup // lookup jni4net.n.dll next jni4net.j.jar bridge.setverbose(true); bridge.init(); // here go! conso

javascript - HTML How to get image to load with less quality -

so have image (png file) want scaled @ say, 90%, relative webpage. however, png file big, , when scaled, not take several seconds load, eats ram (my computer has given me warnings low on memory). not need picture quality in instance, how let image render less quality (to speed load time) while preserving scaling , not altering original file? ~ you scale image proportionally html , css browser still load whole image memory. need use photo editing software change resolution of image , image format jpeg, has better compression algorithm png image format. html : <div class="img_resz"> <img src="img.jpg"> </div> css : .img_resz img { width: 90%; }

cookies - Javascript Retina / HD display detection and blocking page render during reload -

my question pretty page reload rather retina detection. i'm using code below in head tag retina display : <script type="text/javascript"> if( document.cookie.indexof('device_pixel_ratio') == -1 && 'devicepixelratio' in window && window.devicepixelratio == 2 ){ var date = new date(); date.settime( date.gettime() + 3600000000 ); document.cookie = 'device_pixel_ratio=' + window.devicepixelratio; //if cookies not blocked, reload page if(document.cookie.indexof('device_pixel_ratio') != -1) { window.location.reload(true); } } </script> it's detecting visitor's screen type, storing cookie , reload if it's retina display. it's working without issue except one. reload function doesn't stop page rendering. because

android - How to return value with RxJava? -

let's consider situation. have class has 1 method returns value: public class foo() { observer<file> fileobserver; observable<file> fileobservable; subscription subscription; public file getmethatthing(string id) { // implement logic in observable<file> , return value // emitted in onnext(file) } } how return value received in onnext ? correct approach? thank you. you need better understanding of rxjava first, observable -> push model is. solution reference: public class foo { public static observable<file> getmethatthing(final string id) { return observable.defer(() => { try { return observable.just(getfile(id)); } catch (whateverexception e) { return observable.error(e); } }); } } //somewhere in app public void doingthings(){ ... // synchronous foo.getmethatthing(5) .subscribe(new onsubscribed<file>(){

python - Accessing MySQL from multiple views of a web site -

i writing web tool using python , pyramid. access mysql database using mysqldb , queries based on user input. created user account tool , granted read access on tables uses. it works fine when open page in single tab, if try loading in second tab page won't load until first search finished. there way around or trying use mysql incorrectly? what @alexivanov trying when you're starting pyramid app in console served using pyramid's built-in development server. server single-threaded , serves requests 1 after another, if have long request takes, say, 15 seconds - won't able use app in tab until long request finishes. sequential nature of built-in webserver awesome feature simplifies debugging. in production, pyramid app served "real" webserver, such apache or nginx. such webservers spawn multiple "workers", or use multiple threads allow them serve multiple concurrent requests. so suspect there's nothing wrong setup (provided didn&#

angularjs - Why is $timeout needed when dynamically nesting ng-form in Angular to ensure child form links with parent form? -

i cannot seem avoid need generate dynamic sub forms in application working on. sub form working expected , sub form shows $invalid=true when 1 or more of it's inputs invalid. parent form has $invalid=false. i have seen people achieve nested forms invalid sub forms invalidate parent form, can't seem dynamically without wrapping dynamic compiling of sub form in $timeout. see plunker here in above link have recreated scenario. have 3 forms. parent form, sub form created @ same time parent form, , dynamically created sub form. if clear bottom existing sub form's input, invalidate parent form (parent form turns red). if clear top dynamic form's input, not invalidate parent form (parent form remains green). it begin work if stick addform method in $timeout: // works! : when delete dynamic added sub form input // parent form becomes invalid //timeout(addform,0); // fails! : when delete dynamic added sub form input text // parent form not become invalid add

java - Creating a view of multiple Maps' entrySets -

i have iterable<map<? extends k, ? extends v>> , i'd provide view union of these maps' entry sets, i.e. set<map.entry<k, v>> . i can construct new set (the cast triggers unchecked warning, compiles): immutableset.builder<map.entry<k, v>> builder = immutableset.builder(); for(map<? extends k, ? extends v> map : chain) { for(map.entry<? extends k, ? extends v> e : map.entryset()) { builder.add((map.entry<k, v>) e); } } return builder.build(); however requires copying sets, , doesn't stay in-sync backing maps. i've tried things like: set<map.entry<k, v>> unionset = immutableset.of(); for(map<? extends k, ? extends v> map : chain) { unionset = sets.union((set<map.entry<k, v>>)map.entryset(), unionset); } return unionset; but fails compile, error: cannot cast set<map.entry<capture#27-of ? extends k, capture#28-of ? extends v>> set<map.entry<k,v&

osx - OS 10.10.3 Wifi issue -

since few days wifi connection dropping after 2min. have deactivate , activate wifi, working fine couple of minutes. other devices fin, on other networks (office) have same problem. tried from: techrepublic.com or discussions.apple.com still have same problem. no problem if use cable. maybe after 200pings router wifi gone. i didn't install thing last few days , i'm on osx 10.10.3 few months. hope can help. osx 10.10.3 - macbook air (13-inch, mid 2011) i recommend taking computer certified apple repair shop sound airport card (wireless card) broken. if not try booting in recovery mode , testing web browser within there (whilst connected wifi). if works can confirm software issue (problem our install of osx) , if not safe should take in repair / checkup. to boot in recovery mode; turn off computer start computer whilst holding down [command + r] keep holding until see apple logo appear wait load connect wireless router (top right) now try internet b

scala - Unit Testing a Play framework Controller -

i have written controller works browser package controllers import play.api._ import play.api.mvc._ class application extends controller { val productmap = map(1 -> "keyboard", 2 -> "mouse", 3 -> "monitor") def listproductsxml() = action { ok(views.xml.products(productmap)) } } the route defined get /listproducts.xml controllers.application.listproductsxml now writing unit test controller import controllers._ import play.api.test.fakerequest import play.api.test.helpers._ import org.specs2.mutable._ import play.api.test.withapplication class controllertest extends specification { "controllers.application" should { "respond xml /listproducts.xml requests" in new withapplication { val result = controllers.application.listproductsxml()(fakerequest()) status(result) must equalto(ok) contenttype(result) must besome("application/xml"

ruby - undefined method `authenticate' for nil:NilClass While Testing Custom OmniAuth Strategy in Rails With Devise -

i wrote custom omniauth strategy , trying write rspec tests around it, keep getting error: nomethoderror: undefined method `authenticate' nil:nilclass # ./controllers/application_controller.rb:58:in `block in <class:applicationcontroller>' # ./lib/omniauth/custom_strategy.rb:135:in `block in callback_phase' # ./lib/omniauth/custom_strategy.rb:119:in `callback_phase' # ./spec/lib/omniauth/custom_strategy_spec.rb:62:in `block (3 levels) in <top (required)>' after digging through devise code, found error originating in lib/devise/controllers/helpers.rb, current_user method gets defined in applicationcontroller: def current_#{mapping} @current_#{mapping} ||= warden.authenticate(:scope => :#{mapping}) end in case, warden defined as: def warden request.env['warden'] end so, in spec, since it's not controller spec, put in custom code create rack app (as seen here: https://github.com/mkdynamic/omniauth/blob/master/spec/o

html - DIVs positioned absolute dissapear in scrollable DIV -

i have scrollable div has lines of information (textarea's), divs, 1 of top of another. the scroll 300 x 400 px, can have lot of lines in (div elements). for each div line of information have small div lets user click on yes / no delete line of information. i hide of these "deletion" divs, show 1 of them, when user clicks on "delete" button particular line of information. problem comes because position nicely "deletion yes/no div" above each line of information, position:absolute . relative , fixed not work me because break nice alignment have in "outer" div holds this. for 1st visible eye entries (lines of information) "deletion" div each of them looks ok (with position:absolute), when scroll down div, don't show no more. main problem. how can deal problem ? i needed cast "nicely done delete div", kept position:absolute div, had set position:relative , that, styling. this way "outer&q

Scala: override a concrete member with an abstract one -

i'm trying override trait member abstract one, seems straightforward won't compile. here's boiled down example of i'm trying do: // not code: trait base { val x = new t {} trait t {} } // code: trait sub extends base { // compile error; see below override val x: t2 // compiles, doesn't force `impl` implement `x` // override val x: t2 = null trait t2 extends t { val someaddition: } } object impl extends sub { // should forced implement `x` of type `t2` } here's compiler error: error:(7, 7) overriding value x in trait sub of type sub.this.t2; value x in trait base of type sub.this.t has incompatible type; (note value x in trait sub of type sub.this.t2 abstract, , therefore overridden concrete value x in trait base of type sub.this.t) trait sub extends base { ^ a technique can think of use different name abstract member , getting concrete member call 1 instead. trait sub extends base { val y: t2 override

mapping - Temporary tiles cache for Mapserver -

i searching on google , stackoverflow see if have solution problem, didn't found same problems. so, i'm running debian machine mapserver installed on it. server run webserver displaying map data on browser. generation of map dynamic, based on layers definition in database built mapfile in php , based on generated php map shown user. data defined in database , shp files (both combined in single mapfile). it dynamic, mean user can enable/disable of layers or click inside polygon (select points on map) color selection (generate new mapfile based on selection , re-generate tiles). so execution of code selecting area coloring selected items somtimes take time user experience. for solution i'd use kind of temporary tiles cache, can used single user, , able delete it's content when user select items on map or enable/disable 1 of layers. p.s. did optimizations provided mapserver documentation. thanks help. it sounds me problem not going helped server-si

Backbone.js - Model's attribute is not getting passed to view correctly -

i new backbone , trying understand why "title" not getting passed view , printing correctly. if create model title properties passes view , prints fine. pointer appreciated. html: $(document).ready(function(){ //model var appointment = backbone.model.extend({ urlroot : '/services/backbone' // returns **{"title":"ms. kitty hairball treatment","cancelled":"false","id":"1"}** }); var appointment = new appointment(); appointment.fetch({ success: function(response) { console.log("successfully fetched : "+ response.attributes); // **prints undefine** } }); console.log(appointment.attributes); var appointmentview = backbone.view.extend({ render: function(){ $(this.el).html(this.model.get("title")); // **prints empty** return this; } }); //console.log(json.stringify(appointment.attributes)); //// initialize view model var appointmentview = new ap

linux - What does the ESTABLISHED indicator mean after running lsof -

Image
i ran command sudo lsof -i -n -p | grep tcp , wondering if more clarification on output. specifically, in image: why have ip:port pointing ip:port , @ label 'established'? confused on means exactly. established means tcp connection has completed 3-way handshake. (not sure though whether accept must have been called). see tcp state diagram . why have ip:port pointing ip:port , @ itself that mean have 2 tcp sockets open in process. likely, 1 listens on port 9092, , 1 connected port 57633 listening socket. port 57633 belongs ephemeral port range , i.e. range of ports os automatically assigns sockets call connect did not call bind assign specific port.

sql - Access query - add column with subquery counter -

i need add proper "needcounter" column code query in access. should count rows 1 "worksperweekcounter" shown in last, yellow column. or better 0 "worksperweekcounter-1" :) i find code wrong because "counter" not correspond "countermin" let's have table [works(roboczy)], , first 4 columns below [ http://i.stack.imgur.com/mto53.jpg][picture] shows. (sorry, reputation low show pictures) this access query code use (week2date function in vba code): select w.id_work, w.id_pracownika, w.vecka, w.rok, week2date(w.vecka,w.rok) datawk, c.countworksperweek worksperweekcounter, c.id_workmin id_workmin, (w.id_work- c.id_workmin) adddays, dcount([id_work],"[works(roboczy)]","id_work<=" & [id_work]) counter, c.countermin [works(roboczy)] w inner join ( select count(id_work) countworksperweek, id_pracownika, vecka, rok, min(id_work) id_workmin, min(dcount([id_work],"[works

php - Error with mysql_select_db -

i use linux debian local lamp server i tried make connection between database , php : <?php $tf_host = 'localhost' ; $tf_dbname = 'tinyforum' ; $tf_username = 'root'; $tf_password = '' ; $tf_handle = mysql_connect($tf_host , $tf_username , $tf_password); if (!$tf_handle) die('connection problem ..'); $tf_db_result = mysql_select_db($tf_dbname); if($tf_db_result) { mysql_close($tf_handle); die('selection problem'); } die('ok'); mysql_close($tf_handle); ?> the result : http://www.foxpic.com/v0hrsdgb.png pic of phpmyadmin: http://www.foxpic.com/v0alrhi6.png the place save php file : /var/www/html/ unless copied code incorrectly, check not going result in want. $tf_db_result = mysql_select_db($tf_dbname); if($tf_db_result) your selection seems fine either should change code to if(!$tf_db_result) //note ! or restructure code if($tf_db_result) { //do stuff want when connected } el

sql server - Grouping Totals With SQL Query -

here's situation: i have table has 2 data columns: number | value 0 | 11 0 | 10 0 | 12 1 | 10 1 | 10 1 | 11 2 | 11 . . . and on... i create query presents totals different numbers separately, end being so: number | total 0 | 33 1 | 31 2 | 11 . . . i've tried applying simple sum(value) query, can't seem right. any appreciated. select number , sum(value) "total" tablename group number

c# - Microsoft.Interop.Office.Word full style not applying -

Image
i trying produce edit word document using microsoft.interop.office.word , , using range.set_style(string style) method. i using method apply custom style in document called "req level 1." has different text size, bold, has font, , has numbering system. req level 1 have 1 number: 3 req level 2 have 2 numbers: 3.1 req level 3 have 3 numbers: 3.1.1 and on. my problem whenever apply styles, numbering lost. bold, proper size, , font correct, implying each style being set correctly, numbering not appear. thanks time. create req level 1 style style based on (no style) create req level 2 style style based on req level 1 click on multilevel list define new list style click on format numbering click on more button link level req level 1 click on level 2 , link req level 2 delete in number format box select dropdown include level , include number level 1 in number format box add fullstop , select 1, 2, 3,... number style level box rep

http - Determining origin of cookie which javascript or tracking pixel -

i need able determine , identify source of cookies. while many cookies come browser in http response of original page, others added browser via javascript or via assets being loaded on page using http (such tracking pixels or ajax calls). what way determine/identify source of each cookie? open development console in browser , save reference native document.cookie getter/setter. after this, override document.cookie getter/setter own function, can include console.log('creating cookie: ' + value), call native getter/setter within function. see following link code example: cookie monster

angularjs - RestAngular vs $http on calls that aren't strictly RESTful? -

is there point in using restangular if of calls don't end being usual restful all, id, put, post, delete, etc? i understand beauty of restful, wrong in not seeing advantage when end having other methods in controllers? (e.g. returning dto of multiple joined tables). obviously fact don't have type out full url still there, that's addressed "baseurl" constant when using $http. there benefit in can inject pre , post processors requests, part, find assumption correct there little benefit when dealing not strictly restful endpoints. i recommend $http requests reside in services , not in controllers.

javascript - Tampermonkey GM_xmlhttpRequest not work properly -

now i'll show script,that today not work (three months ago work,today don't work) // ==userscript== // @name fancy new userscript // @namespace http://*/* // @version 0.1 // @description enter useful // @author // @match https://www.facebook.com/ // @grant gm_xmlhttprequest // ==/userscript== var x=document.createelement('button'); x.style.width="30px"; x.style.height="30px"; x.style.position="fixed"; x.style.top="5px"; x.style.left="1250px"; x.style.zindex="388"; x.style.backgroundrepeat="no-repeat"; x.style.backgroundsize="30px 30px"; x.style.backgroundimage="url(http://www.iconarchive.com/download/i76816/wineass/ios7-redesign/weather.ico)"; console.log("start"); x.onclick=function(){ gm_xmlhttprequest({ method: "get", url: "http://www.3bmeteo.com/meteo/cosenza", onload: function(response) { pars

How do I compile mustache templates partials with gulp? -

i make prototypes of static html pages mustache/sass/compass-watch under ruby. setup slow, want move building gulp. managed have build sass, not mustache. doesn't see partials in mustache templates. file structure this: . ├── css ├── scss ├── index.html ├── gulpfile.js └── templates ├── index.mustache └── partials └── header.mustache where index.mustache is: {{> partials/head }} <body> {{> partials/header }} <div class="wrap"> {{> some_inner_partial }} <div class="content"> ... </div> </div> {{> partials/footer }} </body> </html> my gulpfile.js goes this: var gulp = require('gulp'); var sass = require('gulp-sass'); var sourcemaps = require('gulp-sourcemaps'); var mustache = require("gulp-mustache-plus"); // gulp sass task gulp.task('sass', function() { gulp.src('./scss/{,*/}

java - SHA hash does not seem to be working correctly -

i trying build simple password authenticator passwords have been hashed using sha-256 . i found couple calculators online ( http://onlinemd5.com/ ) hashed "password" "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8" i tried couple other passwords expected results. so tried implement straight forward set of code (or thought) string pswd="password"; string storedpswd="5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8"; //first byte[] arrays.equals(hashword(pswd),storedpswd.getbytes("utf-8") ); ... private byte[] hashword(string word) { try { return messagedigest.getinstance("sha-256").digest(word.getbytes("utf-8")); } catch (exception e) { throw new badcredentialsexception("could not hash supplied password", e); } } i tried without success. return storedpswd.touppercase().equals(digestutils.sha256hex(password)); the apac

string - How to remove all characters before a specific character in Python? -

i'd remove characters before designated character or set of characters (for example): intro = "<>i'm tom." now i'd remove <> before i'm (or more specifically, i ). suggestions? use re.sub . match chars upto i replace matched chars i . re.sub(r'.*i', 'i', stri)

php - Laravel 5.1 : Error on install new -

when running laravel new blog or name, following error: crafting application... php fatal error: uncaught typeexception: argument 2 passed guzzlehttp\adapter\streamadapter::createresponseobject() must of type array, null given, called in c:\users\felix\appdata\roaming\composer\vendor\guzzlehttp\guzzle\src\adapter\streamadapter.php on line 67 , defined in c:\users\felix\appdata\roaming\composer\vendor\guzzlehttp\guzzle\src\adapter\streamadapter.php:71 stack trace: #0 c:\users\felix\appdata\roaming\composer\vendor\guzzlehttp\guzzle\src\adapter\streamadapter.php(67): guzzlehttp\adapter\streamadapter->createresponseobject(object(guzzlehttp\message\request), null, object(guzzlehttp\adapter\transaction), object(guzzlehttp\stream\stream)) #1 c:\users\felix\appdata\roaming\composer\vendor\guzzlehttp\guzzle\src\adapter\streamadapter.php(52): guzzlehttp\adapter\streamadapter->createresponse(object(guzzlehttp\adapter\transaction)) #2 c:\users\felix\appdata\roaming\composer\vendor\gu

Running node.js on google cloud, but error running with docker -

i tried following document run node.js app on google cloud: https://cloud.google.com/nodejs/getting-started/hello-world node.js running fine, if run gcloud preview app run app.yaml get.... file "/users/me/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 83, in <module> _run_file(__file__, globals()) file "/users/me/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 79, in _run_file execfile(_paths.script_file(script_name), globals_) file "/users/me/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 1020, in <module> main() file "/users/me/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 1013, in main dev_server.start(options) file "/users/me/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 810, in start self.

file - Centos: Merge directories while removing a common subdirectory in all subs -

very weird , specific question know save me big headache. is possible merge directories while removing specific sub in each sub keeping files? example i have /first/1/files/1.jpg, 2.jpg, 3.jpg /first/2/files/1.jpg, 2.jpg, 3.jpg i have /second/1/3.jpg, 4.jpg, 5.jpg /second/2/3.jpg, 4.jpg, 5.jpg i want merge /first /second while removing inbetween /files/ directory in /first keeping jpgs. on top of that, don't want 3.jpg overwritten in /second/ if timestamps don't matter like: find /second -name '*.jpg' -exec touch + fdir in /first/*/files; sdir=${fdir%/files}; sdir=${sdir#/tmp/first}; sdir=/tmp/second${sdir}; cp -u "$fdir/"* "$sdir/"; done though that's not i'd call solution. you manually testing existing files while looping , copying this: for ffile in /first/*/files/*.jpg; # expand variable , delete '/files' sfile=${ffile/\/files} # expand variable , remove '/first