Posts

Showing posts from February, 2013

Google Script - onFormSubmit - Automate an email confirmatio -

any appreciated. situation: created google form employer (attendance form) , automated email 3 different people on data submitted on form. first person submitting form - email confirmation data submitted. hr department - gets email same data submitted, subject line users name. the employees manager - gets notification stating person late or absent. this have far... please help... here link form attendance form function onformsubmitreply(e) { var useremail = e.values[3]; mailapp.sendemail(useremail, "attendance form", "thanks submitting attendance form. \n\nyour form submission " + "will reviewed our managment. \n\nemployer,|hr department", {name:"hr department"}); } function onformsubmitreply(e) { var username = e.values[1]; var optsituation = e.values[2]; var emailrecipients = "example@gmail.com"; mailapp.sendemail(emailrecipients, username +"submitted attendance...

python - Grab following index from tuple: 2 try/except or 1 if/elif -

couldn't find information on try vs. if when you're checking more 1 thing. have tuple of strings, , want grab index , store index follows it. there 2 cases. mylist = ('a', 'b') or mylist = ('y', 'z') i want @ a or y , depending on exists, , grab index follows. currently, i'm doing this: item['index'] = none try: item['index'] = mylist[mylist.index('a') + 1] except valueerror: pass try: item['index'] = mylist[mylist.index('y') + 1] except valueerror: pass after reading using try vs if in python , think may better/more efficient write way, since half time, raise exception, ( valueerror ), more expensive if/else, if i'm understanding correctly: if 'a' in mylist: item['index'] = mylist[mylist.index('a') + 1] elif 'y' in mylist: item['index'] = mylist[mylist.index('y') + 1] else: item['index'] = none ...

spatial - How to fit model with semivariogram using gstat in R? -

Image
i have csv file file contains atmospheric pm10 concentration data of 1 march,12.00 pm. please, download. want draw semivariogram using gstat package in r. tried write these code in r. these data, cant fit model. library(sp) library(gstat) seoul3112<-read.csv("seoul3112.csv") seoul3112<-na.omit(seoul3112) g<-gstat(id="pm10",formula=pm10~lon+lat,location=~lon+lat, data=seoul3112) seoul3112.var<-variogram(g,width=0.04,cutoff=0.6) seoul3112.var plot(seoul3112.var, col="black", pch=16,cex=1.3, xlab="distance",ylab="semivariance", main="omnidirectional variogram seoul 3112") model.3112<- fit.variogram(seoul3112.var,vgm(700,"gau",0.5,200), fit.method = 2) plot(seoul3112.var,model=model.3112, col="black", pch=16,cex=1.3, xlab="distance",ylab="semivariance", main="omnidirectional var...

javascript - Handling collection changes in React -

we're rolling out our own mutable collection class use within react list component. since actual contents rendered managed separately collection (which inject in component via props ), we're faced 2 design doubts: whether collection object should held in state or, instead, kept in props or instance property of component (given can handle own state); what idiom triggering rendering on collection changes be. we've been brainstorming best way this. collection's mutation methods return promise resolves collection itself; if keep collection in state , idea done() promise (in coffeescript)? @state.collection_object.add_an_item('foo').done( (mutated_collection_object) => @setstate(collection_object: mutated_collection_object) ) i'd insight on approaches you've taken/seen far. holding collection in state can messy pretty quickly, props feel it's worse. have considered holding collection outside component entirely? i've gon...

javascript - Animate SVG property such as fill color without third-party library -

how can make fill color of svg circle animate once given start (opaque black) given end (transparent/none). should triggered javascript function , animation one-shot lasting few hundred milliseconds. how can dom/css without having draw in third-party library such snap.svg? so when callback invoked set fill: black transition on period of 200ms fill: none try <animate> function. here's demo doesn't have external library. you can trigger animation so answer

php - Sort multidimensional array by keys - fails on duplicates -

this question has answer here: sort multi-dimensional array specific key 5 answers i have function sortby() use sort multidimensional arrays particular key. here sample array: array ( [0] => array ( [id] => 4 [type] => 1 [game] => 1 [platform] => 0 [totalpot] => 7550 ) [1] => array ( [id] => 5 [type] => 0 [game] => 2 [platform] => 0 [totalpot] => 7500 ) ) here function function sortby($arr, $field='id', $order=1) { $a = array(); if ( !is_array($arr) ) return false; foreach($arr $subarr) { $a[$subarr[$field]] = $subarr; } if ( $order == 1 ) sort($a); else rsort($a); return $a; } in case, calling sortby($array, 'totalpot'); work fine, because 2 values totalpot diffe...

Laravel Composer package won't install -

i'm trying install zizaco in laravel. ( https://github.com/zizaco/entrust ) when add "zizaco/entrust": "dev-laravel-5" require , exec composer update in cmd it's saying nothing install or update. this entire composer.json file : { "name": "classpreloader/classpreloader", "description": "helps class loading performance generating single php file containing of autoloaded files specific use case", "keywords": ["autoload", "class", "preload"], "license": "mit", "authors": [ { "name": "michael dowling", "email": "mtdowling@gmail.com" }, { "name": "graham campbell", "email": "graham@alt-three.com" } ], "require":{ "php": ">=5.5...

GWT upload - Uploading single file twice -

i working on gwt screen has requirement of browsing gwt file once submitting server many times. in gwt upload after clicking on submit. or submitting using singleuploader.submit() method. file browsed fileinputtype cleared. can suggest method upload single file many times using gwt-upload? not sure if possible. try use https://developer.mozilla.org/en/docs/web/api/xmlhttprequest/using_xmlhttprequest , create (using native javascript) 2 instances of xmlhttprequest , try send them both. anticipated problem here input element on page receive incoming events result of upload process (loadstart, progress, etc). in doubt can handle 2 parallel flows of events successfully. another way try send upload requests consequently, have generate second form submit. not trivial, , browsers not support on high level.

java - JAX-RS JAXB Jackson not using @XmlRootElement name -

i developing restful application jax-rs , jaxb. want send following entity json client: @xmlrootelement(name = "user") @xmlaccessortype(xmlaccesstype.field) public class userdto implements serializable { private static final long serialversionuid = 1l; private long id; private string username; private string firstname; private string lastname; // getter & setter } the method in webservice defined follows: @post @path("users/{id}") @produces({ mediatype.application_json, mediatype.application_xml }) public useraccountdto login(@pathparam("id") long id) { useraccountdto useraccount = loaduseraccount(id); return useraccount; } first problem was, root node not send via json. therefore have added following class: @provider @produces(mediatype.application_json) public class skedflexcontextresolver implements contextresolver<objectmapper> { private objectmapper objectmapper; public skedflexcontext...

html - How can I set border and padding to the table rows? -

i add divisions , padding between rows, i've noticed row borders displayed border-collapse: collapse , removes padding <tr> element. https://jsfiddle.net/c8ht9aso/ <table style="border: 1px solid red; border-collapse: collapse; padding: 20px"> <tr> <td>header</td> </tr> <tr style="border-top:1px solid blue; vertical-align: top; padding: 20px"> <td>cell</td> </tr> <tr style="border-top:1px solid green; vertical-align: top; padding: 20px"> <td>another cell</td> </tr> </table> so remove border-collapse: collapse , can see padding, not horizontal lines between rows: https://jsfiddle.net/0mecu52u/ <table style="border: 1px solid red; padding: 20px"> <tr> <td>header</td> </tr> <tr style="border-top:1px solid blue; vertical-align: top; paddi...

Magento Layered Navigation Filters using Simple Configurable -

i have configurable product simple products associated it. ex. shoe attributes size , width on simple. when filter width , size, shows configurable though simple product size , width don't exist. i've seen asked before here in numerous forms no solutions. know how fix functionality? i'm amazed how not built out of box. https://magento.stackexchange.com/questions/18001/shop-by-layered-navigation-configurable-products-not-filtering-correctly magento - layered navigation, configurable products, multiple filters active issue you have customize core file copying in local/mage directory. suppose have variations size & color. open file app\code\core\mage\catalog\model\layer.php after following code:- $collection ->addattributetoselect( mage::getsingleton('catalog/config')->getproductattributes() ) ->addminimalprice() ->addfinalprice() ->addtaxpercents() ->addurlrewrite($this->getcurrentcategory()-...

linux - Call 2 shell from a shell father and not exit if a shell child contain an "exit command" -

hi have 3 shell script: first.sh #! /bin/ksh echo "prova" . ./second.sh echo "ho lanciato il secondo" . ./third.sh echo "ho lanciato il terzo" second.sh is: #! /bin/ksh echo "sono nel secondo script" exit 9 i can't edit second.sh. how ignore exit 9 , continue third.sh? thanks don't use . ./second.sh ; instead, run ./second.sh .

java - Spring-Data-Mongo 1.7: org.springframework.data.mongodb.LazyLoadingException Unable to lazily resolve DBRef -

i using spring-data-mongo 1.7 last 6 months in our project @dbref lazy loading technique. mongo version 2.6 . every thing works fine, today got org.springframework.data.mongodb.lazyloadingexception: unable lazily resolve dbref! exception, when fetch data using lazy loading. not able figure out actual problem is, because there no changes in our code. i encountered similar problem today. fortunately upgrading spring data mongo , mongo driver newest version fixed problem.

sql - SQLite index benchmark -

the problem i have following schema in sqlite db: table: dispatches rowid: primary key identifier: string route: integer slot: integer the common query is: select * dispatches route = 1 order slot asc while attempting optimize indexes used tried 4 approaches: no indexes index route composite index route , slot separate index route , slot for each case i'm inserting n=10000 records. route either 0 or 1 (random) , slot random number between 0 , n-1. shockingly, when results ran , approaches ordered speed, i'm getting same order. in other words, fastest 1 table no indexes . sqlite details here explain query plan outputs (edited): scan table dispatches use temp b-tree order by search table dispatch_index_routes using index index_dispatch_index_routes_on_route (route=?) use temp b-tree order by search table dispatch_index_composites using index index_dispatch_index_composites_on_route_and_slot (route=?) search table dispatch_index_separate...

Getting readable information from Amazon sdk ruby -

maybe me issue while working amazon sdk ruby. when trying retrieve information commands "get_bucket_login" or "get_bucket_location" response is: <seahorse::client::response:....> according documentation, these requests should return strings. missing? found same issue? seahorse part of core of sdk: https://github.com/aws/aws-sdk-ruby/tree/master/aws-sdk-core/lib/seahorse the clients of services modeled use base of this. now question: "empty" response in not conform client base used to. === get_bucket_location === the way bucket location following: resp = s3.get_bucket_location(bucket: "mybucketname") puts resp.data.location_constraint empty string means standard, per documentation here: http://docs.aws.amazon.com/amazons3/latest/api/restbucketgetlocation.html the code monkey patches in here: https://github.com/aws/aws-sdk-ruby/blob/53712d3e4583c982837fb3a301fa2c67226a05ff/aws-sdk-core/lib/aws-sdk-core...

cq5 - caching of personalized content pages in AEM 6.1 -

we on aem 6.1 , have personalized content on home page of our website based on user profile attributes. section of page personalized using out of box teaser functionality can browse campaigns. when home page gets loaded, believe makes ajax call load personalized content campaigns. need confirm when loads page, content cached in dispatcher, , section of page comes campaigns, gets cached in /content/campaigns directory. if true every personalized page pulled cq publisher first time , other times served dispatcher. in overall, home page content cached in 2 places. 1 /content/homepage(regular content) , personalized content in /content/campaigns in dispatcher. , when home page request comes again, cq collate content above 2 dispatcher locations , show final page content on home page. can please confirm this? yes , ootb teaser component loads campaigns via javascript. hence page can cached , still load right campaigns. if check source of page has teaser component , you'll...

json.net - Parsing JSON properties with spaces into objects -

i'm working third party system returns json. i'm trying work out how deserialise following json; {"getresponse": { "results": { "result 1": {"row": [{name:somename}] } } i'm using newtonsoft json library. know how can parse .net objects? to parse json objects using jsonconvert.deserializeobject<t> can make class structure this: public class rootobject { public getresponse getresponse { get; set; } } public class getresponse { public results results { get; set; } } public class results { [jsonproperty("result 1")] public result1 result1 { get; set; } } public class result1 { [jsonproperty("row")] public list<row> rows { get; set; } } public class row { public string name { get; set; } } then deserialize this: string json = @" { ""getresponse"": { ""results"": { ...

java - How to send a notification to android wear every minute -

i tried making app sends custom notification android wear, part worked wanted implement service app send notification every minute. missing something,can guys me please? lot! error points "this", new android programming, don't know how solve this. public class mainactivity extends activity { public class notifservice extends service { scheduledexecutorservice scheduler = executors.newsinglethreadscheduledexecutor(); public ibinder onbind(intent arg0) { return null; } public void onstart(intent intent, int startid) { super.onstart(intent, startid); final intent intent1 = new intent(this, notifservice.class); scheduler.schedulewithfixeddelay(new runnable() { @override public void run() { setcontentview(r.layout.activity_main); //create pendingintent pendingintent pendingintent = pendingintent.getactivity(this, 0, intent1, pendingintent.flag_upda...

java - Measure how long mouse was held for? -

i'm working on game involves holding on button. want able depending on how long button pressed display image ie: x = seconds button held for if 3.1 seconds > x > 2.9 seconds then display image 1 if x < 2.9 or x > 3.1 then display image 2 how program using mouse listener? thank you. you can use below code snippet resolve problem - double starttime, endtime, holdtime; boolean flag = false; @override public final void mousepressed(final mouseevent e) { starttime = system.nanotime(); flag = true; } @override public final void mousereleased(final mouseevent e) { if(flag) { endtime = system.nanotime(); flag = false; } holdtime = (endtime - starttime) / math.pow(10,9); } the holdtime give time in seconds mouse tapped.

SQL Server How to insert current results into table -

Image
i have run lengthy query results useful. unfortunately did not insert results table, displayed in results view there way store current results table temp table? data exists.. possible like: select * #tempresults currentresults where currentresults points to... current results you can try save results tab separated file. click in little blank square on top left of results. select results see. after right click on same little square , select copy headers . this copy results in clipboard using tabs columns delimiter , new line symbol (\r\n) rows delimiter. paste new file. can use import data menu insert results in table (new 1 or existing one): select flat file source data source in import wizard, choose file made. sure set proper datatype each column importing in advanced menu on left. otherwise errors/warnings during import:

SAS 9.3 Table Properties (Description) -

i've been looking way value/change table's description through program/code instead of ui. table description on general tab of table properties. i've found shows how through ui nothing through code. possible? that's dataset label. can added few ways, anywhere write dataset, or proc datasets. proc datasets lib=work; modify want(label="want label"); quit; or data class(label="class dataset"); set sashelp.class; run;

Invoke external function from jsni in GWT -

i have function defined in .js file, included in main .html file code: <script type="text/javascript" language="javascript" src="js/script.js"></script> i have jsni method invokes function defined in js file: public native void addjsmodule(string name) /*-{ addnewsection(name); }-*/; when invoke java method, exception: com.google.gwt.event.shared.umbrellaexception: exception caught: exception caught: (referenceerror) @client.registros.home.registyhome::addjsmodule(ljava/lang/string;)([string: 'acercade']): addnewsection not defined thanks!! gwt code runs (by default) in hidden iframe, script not available. there's $wnd variable referencing window object of enclosing browsing context (where script has been loaded). therefore have prefix function $wnd reference function defined in outer browsing context: public native void addjsmodule(string name) /*-{ $wnd.addnewsection(name); }-*/; ...

jsf - Eclipse Web Service auto generator is not injecting @Inject annotation -

my project web dynamic project using jsf 2.2 cdi in tomcat 7.0. cdi working beans, when try use @inject web service class returning null. @named public class schooldataws { @inject private schooldatadao dao; public schooldataws() { system.out.println(dao); } public string save(string json) { string result = (dao != null ? dao.tostring() : "null"); return result; } } to generate wsdl using eclipse resource new -> other -> web service. service implementation set start service , client type set no client. setting style , use document/literal. i have the webcontent/web-inf/bean.xml <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"> </beans> ...

ios - Swift keyboard won't dismiss by touchesBegan -

i using override func touchesbegan(touches: set<nsobject>, withevent event: uievent) { self.view.endediting(true) } in order dismiss keyboard when user taps somewhere, won't work. , don't errors my vc built up: view > visual effect view > view > scroll view > uibutton (it covers screen , works exit/back button prev vc) > designable view (here login form is) in interface builder, drag tap gesture recognizer on view want dismiss keyboard after tap gesture or can add gesture code : -(void)viewdidload { [super viewdidload]; uitapgesturerecognizer *gesturerecognizer = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(tappedoutside:)]; gesturerecognizer.cancelstouchesinview = no; [scrollview addgesturerecognizer:gesturerecognizer]; } add ibaction tap gesture recognizer example - (ibaction)tappedoutside:(id)sender; in implementation file add : -(ibaction)tappedoutside:(id)sender { ...

flash - Need code for 2 step solution -

i not coder please bear me. have flash movie want play website intro. it's few seconds long , have put frames inside stop of sorts. a) need redirect code go main index page no biggie think, b) if have visited page before, want them able bypass flash page , go right main site. not need code, need know put it...in flash video, on page houses video? time in advance carmine i creating resources in cs6

javascript - array object manipulation to create new object -

var actual = [ {"country":"uk","month":"jan","sr":"john p","ac":"24","pr":"2","tr":1240}, {"country":"austria","month":"jan","sr":"brad p","ac":"64","pr":"12","tr":1700}, {"country":"italy","month":"jan","sr":"gim p","ac":"21","pr":"5","tr":900}, {"country":"uk","month":"feb","sr":"john p","ac":"14","pr":"4","tr":540}, {"country":"austria","month":"feb","sr":"brad p","ac":"24","pr":"12","tr":1700}, {"country":"italy...

asp.net mvc - MVC5 EditorTemplates for DataTypes Cached Locally? -

i have datatype i've made editortemplates for. double? //example of double @model double? @{ string name, id; if (viewdata.modelmetadata.containertype.name.contains("viewmodel")) { name = viewdata.modelmetadata.propertyname; id = viewdata.modelmetadata.propertyname; } else { name = viewdata.modelmetadata.containertype.name + "." + viewdata.modelmetadata.propertynam id = viewdata.modelmetadata.containertype.name + "_" + viewdata.modelmetadata.propertyname; } } <div class="input-group"> <span class="input-group-addon" style="background-color:beige">$</span> <input type="number" value="@model" min="0" step="0.01" data-number-to-fixed="2" data-number-stepfactor="100" class="form-control currency" style="width:247px" id="@id" name="@...

sorting - change column position in a text linux file -

i'm looking solution change position of column in linux. in particular case 1st position last position. qty | sender | recipient | email subject sender | recipient | email subject | qty if have file following content: 4 | 1 | 2 | first subject 5 | 1 | 4 | other interesting subject i have following output: one | 2 | first subject | 4 1 | 4 | other interesting subject | 5 delimiter "|". not important if have "|" @ beginning or @ end of each row. thank you! this kind of thing classic work sed: sed 's/\(^[^|]*\)|\(.*$\)/\2 | \1/' yourfile.txt >newfile.txt to save changes directly in same file: sed -i 's/\(^[^|]*\)|\(.*$\)/\2 | \1/' yourfile.txt ^[^|]* --> beginning of line until first vertical bar. .*$ --> remaining characters until end of line. \( \) --> save these parts , recover later \{number} \2 | \1 --> recover saved part new order. to know more sed here .

Using import.io on a php page -

hi trying run import io api on php page , no data detected. possible obtain data here or similar web pages? thanks yes, can create api php page. have created api website, without issue. https://import.io/data/mine/?id=628e1406-9674-4196-b2e2-43a5f49262f4 you can paginate nicely website, url pattern consistent , not need cookies. http://www.charityperformance.com/charity-search.php?start=20&cat=&search= http://www.charityperformance.com/charity-search.php?start=40&cat=&search= if chat specific issue or website, suggest contacting support@import.io further help. thanks, meg

wordpress - Contact form submissions into Podio -

i working wordpress-website different kinds of contact forms (contact form 7) generates alot of different enquiries. today these submissions sent via mail working @ company. potential lead not contacted. i looking solution gathers submission 1 place, labels them , offer possiblity write comment. my idea send submissions podio. have not used podio myself, seems easy , can generate "tasks" sending mail specific workspace-mailadress. described here: https://help.podio.com/hc/en-us/articles/201019558-overview-of-tasks but seems it's not possible set specific label direcly when generate task via mail. label "unanswered" set default, or something. does podio offer apps or want, better? podio can want: you can use podio create webform dedicated particular 'app' design. when set 'app' can specify 'category' type field can have "unanswered" default value. if don't want use podio webforms, then, say, can add r...

php - Symfony QueryBuilder returning MongoDB cursor instead of objects array -

i trying build custom querying function returning mongodb documents corresponding filters. have created function specific repository document user : namespace loganalyzer\corebundle\repository; use doctrine\odm\mongodb\documentrepository; class userrepository extends documentrepository { public function getusertemp($clauses = null) { /* create query */ $query = $this -> createquerybuilder(); /* add clauses */ if($clauses) { if(isset($clauses['id'])) $query -> field('id') -> equals($clauses['id']); if(isset($clauses['firstname'])) $query -> field('firstname') -> equals($clauses['firstname']); if(isset($clauses['lastname'])) $query -> field('lastname') -> equals($clauses['lastname']); if(isset($clauses['email'])) $que...

ruby on rails - Invalid timezone -

just wondering why happens: 1.9.3-p327 :001 > time.now.zone => "yekt" 1.9.3-p327 :002 > time.now.in_time_zone("yekt") argumenterror: invalid timezone: yekt yekt - timezone of city(yekaterinburg). what hell going on? i'm setting project , trying fix tests, can't fix behavior. or can emulate current timezone(without changing code ideally)? these available timezones. { "international date line west"=>"pacific/midway", "midway island"=>"pacific/midway", "american samoa"=>"pacific/pago_pago", "hawaii"=>"pacific/honolulu", "alaska"=>"america/juneau", "pacific time (us & canada)"=>"america/los_angeles", "tijuana"=>"america/tijuana", "mountain time (us & canada)"=>"america/denver", "arizona"=>"america/phoenix", ...

javascript - How to push 2044 zipcodes in bingmaps without the error An expression is too long or complex to compile? -

i trying make polygons of dutch (4044)zipcodes in bingmaps. each zipcode has 10 1000 coordinates. tried following code , works 200 zipcodes: var polygoncolor = new microsoft.maps.color(100, 255, 0, 0); var pc1011 = new array ( new microsoft.maps.location(52.372203,4.913825), new microsoft.maps.location(52.375787,4.912745), new microsoft.maps.location(52.37605,4.911752)); var polygon1011 = new microsoft.maps.polygon(pc1011 , { fillcolor: polygoncolor, strokecolor: polygoncolor }); map.entities.push(polygon1011); i have tried this, love see work: var mymappings = [ { pc: "1011", coor: new array( new microsoft.maps.location(52.365669,4.901578), new microsoft.maps.location(52.372203,4.913825), new microsoft.maps.location(52.378387,4.905391) )}, { pc: "1012", coor: new array( new microsoft.maps.location(52.381136,4.89783), new microsoft.maps.location(52.372203,4.913825), new micro...

mysql - Do sqlite triggers work on the whole db or only the changed rows -

i need convert sqlite triggers mysql triggers. i've converted following sqlite trigger create trigger arpinsert after insert on arp begin update arp set timeout = datetime('now', '60 seconds') rowid = new.rowid , new.mac != '00:00:00:00:00:00'; update arp set timeout = datetime('now') rowid = new.rowid , new.mac = '00:00:00:00:00:00'; end; into following mysql trigger delimiter // create trigger arpbeforeinsert before insert on arp each row begin if new.mac != '00:00:00:00:00:00' set new.timeout = date_add(now(), interval 60 second); else set new.timeout = now(); end if; end;// delimiter ; i know mysql trigger triggers on effected rows. same true sqlite trigger? if removed where rowid = new.rowid sqlite trigger update on whole table? the sqlite documentation says: at time sqlite supports ea...

How do I create a column which automatically resolves tickets in phabricator? -

i trying create column in phabricator automatically resolves tickets (i.e. 'released' column). know can manually batch update tickets resolve them know if possible automatically. thanks! i assume column, mean column on projects workboard? in case, no, it's not possible change state of task moving column. however, it's feature that's requested , that's being worked on, see support workboard column triggers activate when task dropped column

elasticsearch - What's the good architecture for ELK? -

i trying use elk build log analysis system. see lot of architecture use elk in different way. 1 of them logstash->redis->logstash->elasticseach->kibana the first logstash used collecting logs, second logstash used filter logs. i not clear redis, have use it? why not using kafka? the redis between 2 logstash instances buffer, there in case elasticsearch or logstash indexer goes down. depending on you're processing logstash, may not need it. if you're reading log files, logstash (the shipper) stop sending logs when logstash (the indexer) overwhelmed. way, distributed cache (in log files!). if you're using one-time events (e.g. traps or syslogs network devices), buffer redis or rabbitmq important store them until logstash (indexer) available.

jquery - .addClass('disabled') doesn't work -

i having trouble disabling button. trying disable button unless typing words in input. following code. $('.btn.btn-default').click(function(){ var post = $('input:text').val(); $('<li>').text(post).prependto('.posts'); $('input:text').val(""); $('.count').text('100'); $('.btn.btn-default').addclass('disabled'); }); $('input:text').keyup(function(){ var postlength = (this).val().length; var charactersleft = 100 - postlength; $('.count').text(charactersleft); if (charactersleft < 0){ $('.btn.btn-default').addclass('disabled'); } else if (charactersleft == 100){ $('.btn.btn-default').addclass('disabled'); } else{ $('.btn.btn-default').removeclass('disabled'); } }); $('.btn.btn-default').addclass('disabled'); }; the following h...

How to change project url in django -

i want deploy project in base url www.example.com/project_name . how can achieve this? can deploy www.example.com , need deploy in first way. edit : i'm using gunicorn production , running following command gunicorn project_name.wsgi:application --timeout 600 --workers 10 --log-level=debug --reload --bind=0.0.0.0:9090 nginx entry is: location /project_name { proxy_pass http://192.168.0.101:9090; proxy_set_header host $http_host; proxy_set_header remote_addr $remote_addr; } i solved problem setting script_name in nginx directives. location /project_name { proxy_pass http://192.168.0.101:9090; proxy_set_header host $http_host; proxy_set_header script_name /project_name; proxy_set_header path_info /project_name; proxy_set_header remote_addr $remote_addr; }

vba - Excel Macro needed which can check the downloads folder and delete all the files except the latest downloaded file -

Image
i want make excel file following steps: delete excel files downloads folder except 1 latest downloaded file. make copy of excel file names "data.xls" , system makes "beep" sound repeat above mentioned 2 steps every 15 minutes i can in visual basic unable implement in excel macro... please help.. promotion depends on :-) set reference microsoft scripting runtime. images below shows classes available in object browser. use file-related tasks in vba. did research & microsoft scripting runtime standard on windows should have it

php - Deleted The Catalog Price Rule Accidently In Magento Without Inactive -

Image
i new magento. have created rule of 10 % discount 3 categories mistakenly deleted rule instead of inactivity of rule. made of 10% discount , applied same category see there 20 % discount. first rule have deleted still persist on products. kindly show me path if possible. burhan, issue stems how magento applies rules, when rule applied these rules discounts indexed , if existing rule mistakenly deleted still active until click "apply rules" rule dashboard. in top right hand corner see button called "apply rules" click , rebuild indexes. save , apply within rule not reset past rules. try , let me know happens.

.net - dnvm install Mono -

i've trying build docker image installs mono , runs .net app. i'm following standard guidelines on how build docker image asp .net 5, want use mono native host instead (so can leverage non-coreclr dlls). however, out of gate, fails: d:\>dnvm install mono410 downloading dnx-clr-win-x86.mono410 https://www.nuget.org/api/v2 unable download package: remote server returned error: (400) bad request. @ c:\users\user.dnx\bin\dnvm.ps1:560 char:13 + throw "unable download package: {0}" -f $global:downloaddata.erro ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : operationstopped: (unable downl...0) bad request.:string) [], runtimeexception + fullyqualifiederrorid : unable download package: remote server returned error: (400) bad request. d:\>dnvm install mono402 downloading dnx-clr-win-x86.mono402 https://www.nuget.org/api/v2 unable download package: remote server returned erro...

Close Bootstrap modal with jQuery or Javascript on windows resize -

how can close bootstrap modal if browser windows width less 700px? have tried jquery this: $(window).resize(function() { if ($(window).width() < 700) { $("#modal").hide( 0, function() {}); $("body").removeclass("modal-open"); $(".modal-backdrop").hide( 0, function() {}); } }); i have content of modal in 50% of page , when window less 700px content moves modal. working great if resize windows method above have problems , have press button open modal twice. if dont resize windows , close modal x works great have find way close modal when windows resized. i believe should try $('#modal').modal('hide'); instead of $('#modal').hide();

objective c - Compare RGB of two images in IOS -

in app need compare rgb of 2 images same or not. using code... -(cgfloat)compareimage:(uiimage *)imgpre capturedimage:(uiimage *)imgcaptured { int colordiff; cfdataref pixeldata = cgdataprovidercopydata(cgimagegetdataprovider(imgpre.cgimage)); int mywidth = (int )cgimagegetwidth(imgpre.cgimage)/2; int myheight =(int )cgimagegetheight(imgpre.cgimage)/2; const uint8 *pixels = cfdatagetbyteptr(pixeldata); int bytesperpixel_ = 4; int pixelstartindex = (mywidth + myheight) * bytesperpixel_; uint8 alphaval = pixels[pixelstartindex]; uint8 redval = pixels[pixelstartindex + 1]; uint8 greenval = pixels[pixelstartindex + 2]; uint8 blueval = pixels[pixelstartindex + 3]; uicolor *color = [uicolor colorwithred:(redval/255.0f) green:(greenval/255.0f) blue:(blueval/255.0f) alpha:(alphaval/255.0f)]; nslog(@"color of image=%@",color); nslog(@"color of r=%hhu/g=%hhu/b=%hhu",redval,greenval,blueval); cfdataref pixeldatacaptured = cgdataprovidercopydata(cgimagegetdatapro...

node.js - How to be confident that a websocket is secured -

this may sound absurd question , is. right use websocket-node may switch ws soon. answers both implementations welcome. i open listener on port 8080 , wait connection request. after accepting request want confident connection secured (as in: use wss:// , reject simple ws:// ). the trivial code taken documentation is: wsserver.on('request', function(request) { // todo: produce single bit ssl_is_active = ?; if (!ssl_is_active) { request.reject(); // ws protocol used, want wss! return; } // ... proceed process request (authentication , on) } as simple may sound i've not found documentation this. do have stick ssl port (443) or can still choose port, e.g. using: wss://localhost:8080/test is there way test protocol , suffice, e.g. along lines: request.protocol === "wss" -or- request.uri.indexof("wss://") === 0 it looks i'm missing because it's not possible i'm 1 problem :d any appreciated both implem...