Posts

Showing posts from February, 2011

How to deploy webapp or war file in tomcat that is running in docker container -

i have created docker container , tomcat running in container. how can deploy webapp or war file in tomcat running in docker container. first create dockerfile: from library/tomcat run rm -rf /usr/local/tomcat/webapps/* add ./relative/path_to_war.war /usr/local/tomcat/webapps/root.war then build docker image $ docker build -t user/image_name . and run docker container. $ docker run --name container_name -p 80:8080 -d user/image_name after webapp should responding on docker host's ip on default http 80 port. you might need link database container webapp, see more on docker documentation

javascript - how to upload file through activeadmin modal window -

i want upload file using modal window,but activeadmin modal module doesn't support . so changed source file of activeadmin, actualy /app/assets/javascripts/active_admin/lib/modal_dialog.js.coffee activeadmin.modal_dialog = (message, inputs, callback)-> html = """<form id="dialog_confirm" title="#{message}"><ul>""" name, type of inputs if /^(datepicker|checkbox|text)$/.test type wrapper = 'input' else if type 'textarea' wrapper = 'textarea' else if $.isarray type [wrapper, elem, opts, type] = ['select', 'option', type, ''] else throw new error "unsupported input type: {#{name}: #{type}}" i add change code if /^(datepicker|checkbox|text)$/.test type if /^(datepicker|checkbox|text|file)$/.test type then can show file form, can't params ,can 1 help? here's code: $('a.upload').click (eve

ios - How to create top and bottom corner radius different on WatchKit? -

i need set corner radius 6 on top of wkinterfacegroup , set 0 on bottom. there tips or ? thanks example : http://imgur.com/adasbny since many elements (images e. g.) can't given border radius in watchos, should use groups images element. in order achieve 2 different border sizes, try using 2 groups 2 different border sizes overlap themselves, 1 side of border isn't visible because it's overlapped other group.

debugging - Using console to access Meteor Template.name.helpers functions -

in meteor application, suppose have following template: template.templatename.helpers({ helper1: function () { alert("helper function called") } } how call helper1 function browser console? edit: 1 solution: template.templatename.__helpers[" helper1"]() is there more orthodox way?

html - On Edge Browser, how to change input placeholder text color using CSS? -

on edge browser, couldn't able change input placeholder color. :-ms-input-placeholder not working works fine on ie 10 & ie 11 . input:-ms-input-placeholder { font-style:italic; color: red; background-color: yellow; } is there anyway make work using css? from caniuse.com ::-webkit-input-placeholder (chrome/safari/opera) :-ms-input-placeholder ie. ::-ms-input-placeholder edge (also supports webkit prefix) note double colon syntax

html5 - HTML 5 - Do I need to declare DOCTYPE on includes and pages with decorator -

i'm using struts 2 , working through pages make them html 5 compliant. all pages using single decorator jsp declared in decorators.xml the decorator.jsp includes first line: <!doctype html> do need declare first line on pages (specified in struts.xml ) <!doctype html> on these? if yes, need same <s:include /> ed pages? the doctype declaration should first line of html document rendered result. can place space characters, comments, or bom character before doctype . see conformant documents in html syntax . pages decorated in head or body of document doctype should before these tags , before tag. place doctype on every page @ first line, either included or manual, , use page decorator. doctype declaration should rendered once per html document, shouldn't include every page <s:include/> -ed in main page.

angularjs - "show more" directive for angular material autocomplete in md-menu-class -

i using angular material autocomplete show results.everything coming perfect except want show results in set of 10 in dropdown , have "show more" kind of utility after last result in dropdown handle event next 10 results. has tried hook directive in md-menu-class template achieve same. here in md-autocomplete code in jade md-autocomplete(md-selected-item="selecteditem",md-search-text-change="textchange()", md-selected-item-change = "itemchange(item)", md-search-text="searchtext",md-items="item in getautosuggest(searchtext)",md-item-text="item.fields.input[0]",md-min-length="3",md-floating-label="search",hide-sm,show-gt-sm) md-item-template span(md-highlight-text="searchtext",md-highlight-flags="^i"){{item.fields.virgininput[0]}} in {{item.fields.location[0]}} in {{item.fields.identifier[0]}}

html - Icon in footer not positioning correctly -

i have footer want position icon @ right side inside it. icon 36 pixel in width , height. it's inside div container padding of 7 pixel. from calculations icon should vertically centered, it's not. i want icon have same padding on top, bottom , right side. doing wrong? jsfiddle html: <div data-role="header" class="pageheader"></div> <div data-role="footer" class="pagefooter"> <div class="info-icon"> <a class="info-anchor" href="#" style="text-decoration: none; text-shadow: none; color: #ffffff;"> <img class="info-img" src="https://storage.googleapis.com/material-icons/external-assets/v1/icons/svg/ic_info_outline_black_36px.svg"> </a> </div> </div> css: .info-icon { z-index: 200; position: absolute; padding: 7px; margin: 0; display: inline-block; r

php - Laravel Get all child node count with condition -

i using laravel5.1 in application. in have 1 table name users , schema of user table follow. id name parane_id node 1 abc 0 2 xyz 1 l 3 dfs 1 r 4 gjk 2 l 5 dsg 3 l 6 faf 4 r 7 kes 2 r i want count of user left side on user 1 (i.e 2,4,6,7) count 4. same if want right side of 2 return 7 count 1. how can possible using laravel eloquent . any appreciated. you want count tree nodes on condition in case left children of node. define children user . create function traverse children tree , counting. class user extends model { public function children() { return $this->hasmany('app\user', 'parent_id'); } public function countchildren($node = null) { $query = $this->

c# - Join two separate list into single list in MVC -

i have 2 separate ienumerable lists having dynamic values: first list ienumerable<string> subheadid having data [0]->1 [1]->4 second list ienumerable<string> subheadid having data like [0]->100 [1]->233 i want join these 2 lists single list having data like [0]->1,100 [1]->4,233 how can join lists. please guide. thanks the proper way achieve using zip() extension method: var firstlist = new list<string>() { "1", "4" }; var secondlist = new list<string>() { "100", "233" }; var combined = firstlist.zip(secondlist, (f, s) => f + ", " + s ).tolist(); it's important notice here that: if happen have 2 collections unequal number of elements, zip method continue shortest index both elements exist. no errors occur if 2 collections uneven.

c# - SonarLint intent clarification -

i searching extension integrate vs sonar, in order avoid waiting sonar run have feedback on code. live feedback valuable in addition shared feedback through sonar ui (providing shared ruleset, history, tendance, analysis...). i had seen plugins eclipse & intellij in last years, running sonar analysis (based on shared ruleset), leveraging incremental analysis also... lately, found vssonarextension seems pretty same thing (incremental & preview analysis) c# projects in visual studio. found official sonarlint (recently renamed sonarqube c#), , can't catch how works. seems disconnected sonarqube server , reimplement rules implemented on server (through c# plugin), wrong ? can clarify ? sonarlint visual studio based on new .net compiler framework (roslyn), shipped within visual studio 2015. extension working on individual developer machines, , (at moment) not connected sonarqube server. to share set of common rules between developer machines, can save , comm

ios - UIImagePicker Controller swift -

snapshotting view has not been rendered results in empty snapshot. ensure view has been rendered @ least once before snapshotting or snapshot after screen updates i'm getting warning when used uiimagepickercontroller take photo camera.and couldn't set image image view please follow code , apply in project according relevant place func opencamera() { if(uiimagepickercontroller .issourcetypeavailable(uiimagepickercontrollersourcetype.camera)) { picker!.sourcetype = uiimagepickercontrollersourcetype.camera self .presentviewcontroller(picker!, animated: true, completion: nil) } else { let alertwarning = uialertview(title:"warning", message: "you don't have camera", delegate:nil, cancelbuttontitle:"ok", otherbuttontitles:"") alertwarning.show() } } func opengallary() { picker!.sourcetype = uiimagepickercontrollersourcetype.photolibrary self.presentview

php - htaccess site/category/name/page error -

i have url in site pagination, this: http://localhost/category/food/1 category = call category.php food = 1 category, may have name 1 = page number the problem is, maybe have page number, maybe not. if don't have page number want send page 1 php. i tried: rewriterule ^category/(.*) /category.php?categoria=$1 rewriterule ^category/(.*)/(.*) /category.php?categoria=$1&id=$1 to sum up, want access page in 2 different ways: http://localhost/category/food - in case send 1 php or http://localhost/category/food/1 what wrong in code not working? have rules this: options -multiviews rewriteengine on rewriterule ^category/([\w-]+)/(\d+)/?$ category.php?categoria=$1&id=$2 [l,qsa,nc] rewriterule ^category/([\w-]+)/?$ category.php?categoria=$1&id=1 [l,qsa,nc] avoid using .* matches in regex.

Serialization exception in HazelCast 3.5 with Scala -

i using hazelcast 3.5 scala have case class abc trying store object of class in hazelcast client gives me serialization exception here class @serialversionuid(1) case class abc( id : int ,name : string , subjectcode : mutablelist[int]) extends serialable when run client code gives me following exception 18:33:43.274 [hz._hzinstance_1_dev.partition-operation.thread-1] error c.h.map.impl.operation.putoperation - [192.168.15.20]:5701 [dev] [3.5] java.lang.classnotfoundexception: scala.collection.mutable.mutablelist com.hazelcast.nio.serialization.hazelcastserializationexception: java.lang.classnotfoundexception: scala.collection.mutable.mutablelist @ com.hazelcast.nio.serialization.defaultserializers$objectserializer.read(defaultserializers.java:201) ~[hazelcast-3.5.jar:3.5] @ com.hazelcast.nio.serialization.streamserializeradapter.read(streamserializeradapter.java:41) ~[hazelcast-3.5.jar:3.5] @ com.hazelcast.nio.serialization.serializationserviceimpl.toobj

android json post data not being displayed/recieved in php -

i trying send data android app displayed in php page. according logs put in place, data send , has correct values on php page, displays empty array: array() this php file: <?php if ($_server['request_method'] == 'post') { echo "post made"; } $json_received = $_post["json"]; $json_test = $_post["test"]; $json = file_get_contents('php://input'); $obj = json_decode($json_test); $obj1 = json_decode($json_received); $obj2 = json_decode($json); echo $obj1; echo $obj; echo $json; echo $json_test; echo $json_received; print_r($_post); ?> java code: public class confirmfragmenttab extends fragment implements onitemclicklistener, onitemlongclicklistener { public static final string arg_item_id = "sales_list"; listview salelistview; arraylist<salesreciepts> salesreciept; saleslistadapter saleslistadapter; productsdbhelper db, dp; activity activity; context context; button push; priva

c++ - std::unique_ptr pimpl in dll generates C4251 with visual studio -

this not breaking issue clean code warnings getting on nerves. i have been using c++11 version of pimpl idiom hide class implementation library usual way. // dll header class frameworkimpl; class export_api framework { framework(const framework&) = delete; framework& operator=(const framework&) = delete; framework(framework&&) = delete; framework& operator=(framework&&) = delete; public: framework(); ~framework(); private: std::unique_ptr<frameworkimpl> impl_; }; // application implementation int main() { std::unique_ptr<framework> test = std::make_unique<framework>(); } everything fine, keep getting warning: warning c4251: 'framework::impl_': class 'std::unique_ptr<frameworkimpl,std::default_delete<_ty>>' needs have dll-interface used clients of class 'framework' so tried have add: template class export_api std::unique_ptr<frameworkimpl>; be

delphi - Setting up a WH_CALLWNDPROC hook prevents WM_HELP propagation in deep hierarchies -

when pressing f1 key, win32 api first sends appropriate key message sends wm_help message control has focus. not process it, gets sent parenting chain way form reacts message. in delphi (xe7) happens because of calls callwindowproc inside vcl.controls.twincontrol.defaulthandler while works fine in pretty locations inside applications, there 1 place wm_help never reaches top form. trying reproduce it, came test application may find here: http://obones.free.fr/wm_help.zip after having built application , started it, place focus inside in sublevel or level 1 edits , press f1. see wm_help caught form. now, if same inside in sublevel2 or level 15 edits see nothing logged, form never sees wm_help tracing in vcl found out deep levels, calls callwindowproc inside vcl.controls.twincontrol.defaulthandler returns on 1 of controls in hierarchy, preventing form ever receiving message. however, couldn't figure out why win32 api code thinks should not propagate message a

java - Print List of string Multithreaded -

i have list should print values on multithread based on thread count. public class launcher { public static void main(string[] args) { list<string> tests = arrays.aslist("a", "b", "c", "d"); final int thread_count = 2; (int = 0; < thread_count; i++) new demo(tests.get(i)); }} public class demo implements runnable { thread t; string tests; demo(string tests) { t = new thread(this); this.tests = tests; t.start(); } @override public void run() { system.out.println("started "+tests); try { thread.sleep(5000); } catch (interruptedexception e) { // todo auto-generated catch block e.printstacktrace(); } system.out.println("stop"); }} it prints started a started b stop stop but want print started a started b stop stop started c started d stop stop you cannot start c and d because set final int thread_cou

Arduino, Python, Serial and Unpacking Values: "ValueError: need more than 1 value to unpack" -

this first question , relatively new python, kindly bear me. guidance problem appreciated! i have pulse oximeter used particular arduino shield produce 2 simple signals: pulse rate , oxygen saturation content. see arduino code: #include <pinchangeint.h> #include <ehealth.h> int cont = 0; void setup() { serial.begin(115200); ehealth.initpulsioximeter(); //attach inttruptions using pulsioximeter. pcintport::attachinterrupt(6, readpulsioximeter, rising); } void loop() { //bpm serial.print(ehealth.getbpm()); serial.print(","); //sp02 serial.print(ehealth.getoxygensaturation()); //new line serial.print('\n'); delay(500); } //========================================================================= void readpulsioximeter(){ cont ++; if (cont == 50) { //get of 1 50 measures reduce latency ehealth.readpulsioximeter(); cont = 0; } } so output serial monitor, in other words when pyserial readl

Java Sockets TCP send and receive -

i tried many examples , none worked expect. need? send packet through ip , port. wait until server response , close socket. example: [client] send: "hi server" [client] wait [server] send: "hi client" [client] receive response [client] close socket i need tcp client, server side solved. tried: http://www.careerbless.com/samplecodes/java/beginners/socket/socketbasic1.php my code public class sendpacket { public void send() throws exception{ socket socket = null; objectoutputstream oos = null; objectinputstream ois = null; socket = new socket(ip, port); oos = new objectoutputstream(socket.getoutputstream()); string msg = "dspsyssts"; oos.write(msg.getbytes()); oos.flush(); //read server response message ois = new objectinputstream(socket.getinputstream()); string message = (string) ois.readobject(); runwincmd runcmd = new runwincmd()

plotly - ggplotly - R, labeling trace names -

i'm new plotly , not able find relevant documentation on how name traces meaningful label appears in plot rendered ggplotly . here ggplotly site shows number of examples. needed show meaningful label on hover instead of value followed trace0, trace1, etc. for example, in first plot, how can labels appear shows: proportion: value total bill: value ideally, directly in r rather through web interface. in advance. you can edit of plotly figure properties after ggplot2 conversion before send plotly. here example changes legend entry names manually. i'll repeat here: df <- data.frame(x=c(1, 2, 3, 4), y=c(1, 5, 3, 5), group=c('a', 'a', 'b', 'b')) g <- ggplot(data=df, aes(x=x, y=y, colour=group)) + geom_point() # intermediate step `ggplotly` calls p <- plotly_build(g) # manually change legend entry names, "trace0", "trace1" in case p$data[[1]]$name <- 'group a' p$data[[2]]$name &l

swift - Is it possible to set a struct as target for NSTimer -

i trying set scheduledtimerwithtimeinterval inside struct keep getting error cannot invoke scheduledtimerwithtimeinterval argument list of type . when change struct class works fine. my question possible set struct target of nstimer ? api says should of type anyobject struct mytimer{ init() { let timer = nstimer.scheduledtimerwithtimeinterval(1, target: self, selector: selector("timer"), userinfo: nil, repeats: true) } } and class mytimer{ init() { let timer = nstimer.scheduledtimerwithtimeinterval(1, target: self, selector: selector("timer"), userinfo: nil, repeats: true) } } edit: seems class target of scheduledtimer has inherit nsobject first. struct never that.

excel - VBA: Why when I paste cells in a email using VBA does it remove some conditional formatting? -

what want able copy , paste cells spread sheet email conditional formatting applied. example, have following cells: b c 1 name: sales: percentage 2 dave grohl 3 80% 3 kurt cobain 6 40% 4 pat smear 7 66% 5 freddie mercury 2 25% 6 roger taylor 8 95% 7 brian may 1 74% 8 taylor hawkins 0 32% 9 noel gallagher 9 63% 10 michael jackson 8 30% 11 whitney houston 2 82% and there conditional formatting on column b ( sales ) > 5 green , <= 5 red , conditional formatting on column c ( percentage ) >50% green , <= 50% red, happens keeps values removes of formatting, e.g. removes chosen font on data not headings , removes color of sales column not percentage column. the code using follows: sub e

.net - Managed class types as type of type parameter T (Error C2670) -

i want create generic function returning collection of type observablecollection<t>^ . callers pass managed class type type parameter t . here 1 of tries of generic function, after explanations of other classes used: generic<class t> t:canimal, gcnew() observablecollection<t>^ getitems(animaltype animaltype, int count) { observablecollection<t>^ animals = gcnew observablecollection<t>(); (int = 0; < count; i++) { if (animaltype == dog) { cdog^ dog = gcnew cdog(i, count - i); //canimal^ dog = gcnew cdog(i, count - i); //t dog = gcnew cdog(i, count - i); //t^ dog = gcnew cdog(i, count - i); animals->add(dog); } //else if (animaltype == cat) { ... } //... } return animals; } because tried 1632 ways make function work can't tell why i've im

regex - Cywgin Sed match not working when "/" in string -

testline="this test line: asia/pacific australia" expr="asia\/pacific australia" this works: echo "$testline" | sed 's/asia\/pacific australia/test/g' this not: echo "$testline" | sed 's/$expr/test/g' i've tried using multiple "escapes", using different quote marks, using -r , -re sed switches. nothing seems work. please advise if has working solution. please can advise , provide cygwin output here, many thanks! first change variable as expr="asia/pacific australia" this should work then echo "$testline" | sed 's_'"$expr"'_test_g' note sed delimiters can choose other chars well, here _

IS reading from buffer quicker than reading from a file in python -

i have fpga board , write vhdl code can images (in binary) serial port , save them in sdram on board. fpga display images on monitor via vga cable. my problem filling sdram take long(about 10 minutes 115200 baud rate). on computer wrote python code send image(in binary) fpga via serial port. code read binary file saved in hard disk , send them fpga. question if use buffer save images insted of binary file, better result? if so, can me how that, please? if not, can suggest me solution, please? in advans, unless compressing before download, , decompressing image after download, problem 115,200 baud transfer rate, not speed of reading file. at standard n/8/1 line encoding, each byte requires 10 bits transfer, transferring 1150 bytes per second. in 10 minutes, transfer 1150 * 60 * 10 = 6,912,000 bytes. @ 3 bytes per pixel (for r, g, , b), 2,304,600 pixels, happens number of pixels in 1920 1200 image. the answer (a) increase baud rate; and/or (b) compress image (using s

amazon web services - Dynamodb query - OR condition in KeyConditionExpression -

i have dynamodb table "feed_guid" global secondary index. want query set of feed_guid in table. since "feed_guid" not primary keys, cant use getbatchitem. when tried following method, got error "invalid operator used in keyconditionexpression: or". $options = array( 'tablename' => 'feed', 'indexname' => 'guidindex', 'keyconditionexpression' => 'feed_guid = :v_guid1 or feed_guid = :v_guid2', 'expressionattributevalues' => array ( ':v_guid1' => array('s' => '8a8106e48bdbe81bf88d611f4b2104b5'), ':v_guid2' => array('s' => '19cab76242a6d85717de64fe4f8acbd4') ), 'select' => 'all_attributes', ); $response = $dynamodbclient->query($options); you c

Can google persistent ip ptr resolve to internal address? -

amazon has dns option vpc allows resolve elastic ip ptr external , internal addresses depending on query source. dig @8.8.8.8 ec2-54-194-175-41.eu-west-1.compute.amazonaws.com. +short 54.194.175.41 dig @10.0.0.2 ec2-54-194-175-41.eu-west-1.compute.amazonaws.com. +short 10.0.1.253 google compute engine (gce) ip addresses have ptr 95.141.251.24.bc.googleusercontent.com. not resolve internal ip addresses inside google network. gce has metadata server acts dns , resolves c.project.internal records not elegant above solution amazon. is there similar elastic ptr gce? google doesn't provide sort of split-horizon dns service today; you're describing not different ptr addresses, different records public dns , instance dns. google decided useful able refer other instances name when within network, undesirable information leak when exposed public internet. (internal - nice name, private ip address; external - generic name, public ip address.)

html - PHP registration form: Make the inputs with red borders if there is an error -

i'm making registration form php , i'd something: if user has not completed form correctly, want, in addition error message, make inputs (where there error) red borders. my registration form (html part): <?php if(!empty($errors)): ?> <div class="flash-message error"> <h3>you have not completed form correctly. error(s) come(s) following thing(s):</h3> <ol> <?php foreach($errors $error): ?> <li> <p><?= $error; ?></p> </li> <?php endforeach; ?> </ol> </div> <?php endif; ?> <h1 class="page-heading"><?php echo $title; ?></h1> <form action="" method="post"> <ul> <li> <label for="nickname">nickname:</label> <input id="nickname" name="nickname" type="text"> <p

ruby on rails - When I update my Avatar picture, it changes all users picture -

i seem making error in code. i've been looking @ 2 of past projects , in 1 have pictures table associate picture_id user on different project wasn't required , forgot how did it. advice in code improvement , reason of error appreciated, thank in advance. schema create_table "users", force: true |t| t.string "first_name" t.string "last_name" t.string "email" t.string "password_digest" t.string "user_name" t.date "birthdate" t.integer "zip_code" t.string "gender" t.datetime "created_at" t.datetime "updated_at" t.string "avatar_file_name" t.string "avatar_content_type" t.integer "avatar_file_size" t.datetime "avatar_updated_at" t.integer "user_id" t.integer "profile_id" t.string "background_file_name"

linux - Handle corrupted SPI data using STM32F1 MCU -

i'm developing application custom board stm32f1 mcu needs able recover unexpected data corruption. the data flow follows: master device (a linux machine) sends request slave parses message , gets ready send reply. master reads reply. exchange fast (@18mhz) , implemented this: if (::ioctl(_fd, spi_ioc_message(2), &transaction) < 0) { warn("message not sent"); return false; } the delay between these 2 messages ~50us. message length fixed. on stm side use dma-driven spi driver implemented in way i'm going write below. i'm using spi2 clocked off apb1@36mhz (hse@24 mhz; ahb@72mhz; apb1@36mhz). after spi configured read message (fixed length!) issuing dma request on rxneie (cr2->rxdmaen). after message processed answer getting transmitted via dma1 (cr2->txdmaen). everything works charm until interfere somehow. scenario i'm trying recover unplugging sclk line while transferring. i'm struggling recover this. i'm going l

javascript - IE9 - jQuery - "SCRIPT11: The operation attempted to access data outside the valid range" -

i'm using simple jquery plugin creates unique fingerprint each user can track/recognize users coming specific referral url. it works fine everywhere except internet explorer 9 (yes, works in ie7 & ie8, though web page looks goofy). the error i'm receiving is: script11: operation attempted access data outside valid range the code below (error occurs on line 21, column 7). i'm go through , comment out each of entities see if it's 1 of them in particular that's causing error. thanks! ( function($) { // calling `jquery.fingerprint()` return md5 hash, i.e. said // fingerprint. $.fingerprint = function() { // function, `_raw()`, uses several browser details // available js here build string, namely... // // * user agent // * screen size // * color depth // * timezone offset // * sessionstorage support // * localstorage support // * list of installed plugins (we're using names, // descript

regex - How to find the next unbalanced brace? -

the regex below captures last balanced } . now, regex able capture next unbalanced } ? in other words, how can can ... {three {four}} five} $str instead of ... {three {four}} ? my $str = "one 2 {three {four}} five} six"; if ( $str =~ / ( .*? { (?> [^{}] | (?-1) )+ } ) /sx ) { print "$1\n"; } so want match [noncurlies [block noncurlies [...]]] "}" where block is "{" [noncurlies [block noncurlies [...]]] "}" as grammar: start : text "}" text : noncurly* ( block noncurly* )* block : "{" text "}" noncurly : /[^{}]/ as regex (5.10+): / ^ ( ( [^{}]* (?: \{ (?-1) \} [^{}]* )* ) \} ) /x as regex (5.10+): / ^ ( (?&text) \} ) (?(define) (?<text>

c# - Close upcoming Debug Assertion -

i testing debug dlls nunit , annoying every testrun large amount of debug assertions come up. so have written tool polling new debug assertion. tool iterating windows every x milliseconds , checks if title 1 of collection of possible debug assertion window titles. in pseudo code looks this: void main() { var thread = new thread(threadmethod); thread.start(); } private void threadmethod() { while(true) { foreach(var title in possiblewindowtitles) { intptr windowhandle = findwindowhandle(title); if(windowhandle != intptr.zero) { settoforeground(windowhandle); sendkeys.sendwait("%i); } } } } the codeline sendkeys.sendwait("%i") sends keycombination of alt + i window, keycombination "continue" button. my question is: there better option? like: an event when new window comes up a better method of closing window (the clos

html - PHP drop down menu script doesn't update database -

this question has answer here: why shouldn't use mysql_* functions in php? 13 answers the following script supposed update database, environment column selected value drop down menu. right now, last host getting value of 0. doing wrong? seems not able track hosts , value selected. while($row = mysql_fetch_array($result)){ $host = $row['host']; $environment = $row['environment']; echo "<tr><td>" . $host . "</td> <td><select name='id[".$host."]'><option value='null'>select any</option> <option value='dev/qa/test'>dev/qa/test</option> <option value='prod/stage'>prod/stage</option> </select></td>

sql - Getting the value of no grouping column -

i know basics in sql programming , know how apply tricks in sql server in order result set, don't know tricks in oracle. i have these columns: col1 col2 col3 and wrote query select col1, max(col3) mx3 mytable group col1 and need value of col2 in same row found max value of col3, know trick solve problem? a couple of different ways this: in both cases i'm treating initial query either common table expression or inline view , joining base table added column. trick here inner join eliminates records not in max query. select a.*, mytable inner join (select col1 , max( col3 ) mx3 mytable group col1) b on a.col1=b.col1 , b.mx3 = a.col3 or with cte (select col1 , max( col3 ) mx3 mytable group col1) select a.* mytable inner join cte on a.col1 = b.col1 , a.col3= cte.mx3

mysql - Creating a polygonal spatial data frame from a feature geometry attribute -

i have data frame pulled mysql database has feature geometry attribute. example, here's 1 record's value geom attribute: 'polygon((-113.583914 33.786816,-113.58412 33.787018,-113.58412 33.786816,-113.583914 33.786816))' all features in table polygons. i have been searching cannot find clean way create spatial data frame these coordinate strings.

javascript - I want to use JsArray with the Webix component DataTable -

i want use jsarray webix component datatable. have 1 problem. when use jsarray format can’t update data in webix datagrid. unfortunately, can see beginning of data. check sample understand issue: var array1 = [ [1,"marie","oslo"],[2,"john","los angeles"],[3,"kate","london"] ]; var array2 = [ [4,"martin","manchester"],[5,"joana","lisbon"],[6,"ronaldo","barcelona"],[7,"matthew","portland"] ]; webix.ui({ view:"button", label:"test new data", click: function() { new_data() } }); webix.ui({ view:"datatable", id: "mytable", columns:[ {id:"data0", header:"id" }, {id:"data1", header:"name" }, {id:"data2", header:"city" } ],

ruby - dashing rufus scheduler updating two different values -

i'm using dashing display information taken jira bug tracking system. using plugin: https://gist.github.com/christiangalsterer/1b24f2b42aa39ba63a92 i have ruby script gets number of jira issues based on filter, each filter in list. gets pushed 3 number widgets each displaying different filter. require 'jira' last_issues = hash.new(6) jira_filters.each |filter_data_id, filter| scheduler.every '5s', :first_in => 0 |job| last_number_issues = last_issues['filter_data_id'] client = jira::client.new(jira_options) current_number_issues = client.issue.jql("filter in (\"# {filter[:filter]}\")").size last_issues['filter_data_id'] = current_number_issues send_event(filter_data_id, { current: current_number_issues, last: last_issues['filter_data_id']}) end end the problem have wish schedule part gets "last_number_issues" every 2 hours, rest of every 10 minutes can work out whe

html - Paypal button shows empty shopping cart -

why give me empty shopping cart ? single item works fine. any ideas anyone, if helps (or doesnt) paypal support not either. <form action="https://www.sandbox.paypal.com/cgi-bin/webscr"> <input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="business" value="xxxx.xxxx@xxxx.net"> <input type="hidden" name="lc" value="us"> <input type="hidden" name="item_name" value="my shopping cart"> <input type="hidden" name="currency_code" value="gbp" /> <input type="hidden" name="display" value="1" /> <input type="hidden" name="upload" value="1" /> <input type="hidden" name="amount_1" value="12.00" /> <input type="hidden" na

how to manage complicated array with javascript -

i have: return data: array ( 0 => 'test' )array ( 0 => 'test drink', 1 => 'chi' ) i want split return data 2 arrays: $arrfood , has 1 element: 'test' $arrdrink , has 2 elements: 'test drink' , 'chi' . how can done? i understand want create 2 arrays given return 2 arrays, can this: function array(arr, arr2){ $arrfood = arr; $arrdrink = arr2; } this link can show little more arrays: https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/array

visual studio 2012 - How can I update a nullable column to be not nullable, in SQL Server using DACPAC -

i'm trying update database maintained , deployed using database project ( .sqlproj ) in visual studio 2012. easier sql server management studio, in case have deploy using dacpac. what correct way change column not nullable, using dacpac , without risking data loss? a nullable column added table. need publish update sets column not null , sets default. because there rows in table, update fails. there setting 'allow data loss' isn't option , update should not result in data loss. here's simple example shows problem: create table [dbo].[hello] ( [id] int identity(100,1) not null primary key, [hellostring] nvarchar(50) null , [language] nchar(2) not null ) now publish database , add rows, @ least 1 row should have null hellostring. change table definition be: create table [dbo].[hello] ( [id] int identity(100,1) not null primary key, [hellostring] nvarchar(50) not null default 'hello' , [language] nchar(2) not null )

android - Where can i find the default group indicator (expandlistview, little arrow)? -

i want change group indicators color in order need make own group indicator. can link me file default group indicator can change color black white :) gimp :). cant find deafault group indicator :/. you can find android resources in sdk check $android_sdk_home/platforms/android-xx/data/res

.htaccess - How can I delete the Index file in htaccess? -

rewriteengine on rewritecond %{script_filename} !-d rewriterule ^([^\.]+)$ $1.html [nc,l] but when i'm in page menu , click "home" i'm redirecting www.page.com/index. i want like: www.page.com you can write rule index.html file rewriterule ^index.html$ http://%{http_host}/ [r=301,l]

javascript - Replicate Google Maps Overlay Panel / Legend -

the google maps javascript api has nice legend / panel updates middle point of map based on click / touch events. in documentation go detail on how create such styled legend / overlay. **please see example trying replicate before down vote question, thanks! here link panel trying replicate: https://developers.google.com/maps/documentation/javascript/ (top right 'base maps' panel) is way it? printing every line content.push? seems dirty. var legend = document.createelement('div'); legend.id = 'legend'; var content = []; content.push('<h3>butterflies*</h3>'); content.push('<p><div class="color red"></div>battus</p>'); content.push('<p><div class="color yellow"></div>speyeria</p>'); content.push('<p><div class="color green"></div>papilio</p>'); content.push('<p><d

javascript - Writing JSON data to a file incorrectly -

i'm reading information api returns text in json format. want take text , write file. when writes \ in front of looks . [{ \"elementa":\"valuea" ... }] here's i've tried var info = [] request('someapi', function(err, res, body) { if (err) { return console.log('error:', err); } if (res.statuscode != 200) { return console.log('invalid:' + res.statuscode); } info = json.stringify(body); fs.writefile('public/file', info); }); also file i'm trying write .js if makes difference. desired output : [{ "elementa": "value ...}] as data trying write formed json, don't have json.stringify , can write is, this fs.writefile('public/file', body, callbackfunction); note: fs.writefile async function. need pass callback function well, invoked when actual writing completed.

ecmascript 6 - Is it possible to destructure an object and generate a new object in a single statement? -

this question has answer here: create subset object, consisting of of properties of existing object [duplicate] 1 answer const {name, slug, description, parent} = cat; const sanecat = {name, slug, description, parent}; in first expression, define 4 constants destructuring messy object. in second expression, combine them new object. in single step without duplicating list of interesting fields, because first expression doesn't define object, seems impossible. really? close clojurian win! i have tried following without success. ecmascript compiler fair game, don't have option of using clojurescript. const sanecat = {name, slug, description, parent} = cat; // name not defined const {...sanecat} = {name, slug, description} = cat; // name not defined const sanecat = ({name, slug, description, parent} = cat); // name not defined const sanecat = ({name, slug,