Posts

javascript - Why jQuery Select box change event is now working? -

i working on product filters user select select box according his/her preference not getting selected value user in jquery. html code:- <select name="product_filter" id="product_filter"> <option value="price_low_first">price : low high</option> <option value="price_high_first">price : high low</option> <option value="latest">latest</option> <option value="popular">most popular</option> </select> jquery code: $(function () { $("#product_filter").change(function () { alert("hi") var selectedtext = $(this).find("option:selected").text(); var selectedvalue = $(this).val(); alert("selected text: " + selectedtext + " value: " + selectedvalue); }); }); hi believe code perfect. once please check jquery.min.js ...

sql - MySQL - Finding Empty relations -

i trying work out how full list of team leaders , team members our tables. including team leaders have no team. we have basic data structure have table person contains our basic person object. people extend table in details table. one of extended pieces of information have team_leader status. have 2 relevant details define this: detail_isteamleader , detail_teamleader . first boolean , defines short list of team leaders. second defines persons team leader (ideally subset). _person table_ person_id person_name _detail table_ detail_id detail_person_id detail_isteamleader detail_teamleader i can team leaders have team using following query: select tl.person_id tlref, tl.person_name tlname, per.person_id perref, per.person_name pername detail left outer join person per on detail.person = per.person_id left outer join person tl on detail_teamleader = tl.person_id order tlname, psname however, fails team_leaders detail.isteamleader true not occur in detail_teamleader...

tcl - array allowed not allowed -

i have script "proc backup". have each directory many words allowed or not allowed. thought integrade array. not ahead ... or there simpler? bind pubm - "*fertig*" backup proc backup {nick host handle channel text} { set name[lindex [split [stripcodes bcru $text]] 2] set dir[lindex [split [stripcodes bcru $text]] 4] if {[catch {exec sh backup.sh $dir $name} error]} { putlog $error } putnow "privmsg $channel :backup $name done"; } array set allowed { "dir1" "to rar" "dir2" "backupserver1 " "dir3" "2016 2017" } array set not_allowed { "dir1" "test crap" "dir2" "old backupserver2 jpg zip" "dir3" "2015 2014 2013 2012 2011 2010 209 19" } edit : line irc: ( lindex 2 , 4) run backup.sh when word in name is word0 word1 ...

date - Java 8 - Trying to convert String to LocalDateTime -

this question has answer here: java string date conversion 13 answers i trying convert below string localdatetime , somehow not working. val formatter = datetimeformatter.ofpattern("yyyy-mm-dd hh:mm:ss.sss"); val datetime = localdatetime.parse("2016-09-21 13:43:27.000", formatter); it seems there problem in pattern. you have problem pattern, should use 'h' hours(0-23). type formatter , datetime wrong. work correctly: datetimeformatter formatter = datetimeformatter.ofpattern("yyyy-mm-dd hh:mm:ss.sss"); localdatetime datetime = localdatetime.parse("2016-09-21 13:43:27.000", formatter);

html - Flexbox grid: two equal length rows, top row split into two columns -

Image
i'm trying make layout following image using css flexbox. but i'm not familiar flexbox can me make this? here i'm trying: .row.flex { display: flex; } .row [class=^"col-"] { width: 200px; height: 100%; } <div class="row flex"> <div class="col-xs-12 col-sm-6"> </div> <div class="col-xs-12 col-sm-6"> </div> <div class="col-xs-12 col-sm-12"> </div> </div> thanks :) option 1 set flex container wrap . make each flex item take 50% of space. adjust margins calc . the third item, forced wrap, gets flex-grow: 1 , consumes remaining space. .row.flex { display: flex; flex-wrap: wrap; } .row [class^="col-"] { flex: 0 0 calc(50% - 10px); height: 100px; margin: 5px; background-color: lightgreen; } .row [class^="col-"]:last-child { fle...

core data - NSBatchDeleteRequest with NSPredicate in swift -

how delete rows coredata using nsbatchdeleterequest nspredicate. i want delete records older 30 days. i dont want data in memory , compare , delete, want use nsbatchdeleterequest, in nsbatchupdaterequest. here code far have written let date = nsdate(); let yesterday = date.datebyaddingtimeinterval(-24*60*60); let predicate = nspredicate(format: "date > %@", yesterday); let fetchrequest = nsfetchrequest(entityname: "notification"); let batchdelete = nsbatchdeleterequest(fetchrequest: fetchrequest) please give answers in swift this simple example. possible rich using of nspredicate filter request. let calendar = nscalendar.currentcalendar() let thirtydaysago = calendar.datebyaddingunit(.day, value: -30, todate: nsdate(), options: []) let fetchrequest = nsfetchrequest(entityname: "notification") fetchrequest.predicate = nspredicate(format: "(date >= %@)", thirtydaysago) let deleterequest = nsbatchdeletere...

c - Android and JNI real time clock -

i got problem mini android application , use of real time clock signals in c (jni) function. it seems android ui doesn't real time signals timers instanced in c function. in following poc , timer trigger signal 5 times per second , if signal triggered while ui updating, application crashes. if don't start timer => no crash if don't put on ui => no crash i wrote little poc evidence behaviour. java part call jni function , put button on screen. public class mainactivity extends appcompatactivity { button bt; static { system.loadlibrary("testtimer-jni"); } /* jni ingresso */ public native void jnistarttimer(); @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); jnistarttimer(); /* load button */ bt = new button(getbasecontext()); setcontentview(bt); } } and main.c file content. timer instanced , starte...

html - Bootstrap/CSS: Clearfix affects even/odd index -

i'm using clearfix prevent bootstrap grid breaking when use columns of different heights. however, once clearfix div added document, columns appear after in source behave if have different even/odd index do. i have created relevant demo . can see, removing clearfix div, makes colors of divs change if index has changed. do know may causing , can correct it? if @ nth-of-type definition specifies the :nth-last-of-type(an+b) pseudo-class notation represents element has an+b-1 siblings same expanded element name after in document tree, 0 or positive integer value of n, , has parent element. see :nth-child() pseudo-class syntax of argument. the key thing here states: the same expanded element name so taking quite literally, css selector targets specific element , odd , matched on specific element name , not elements matched using specific selector. this why replacing div with span work never matched different element.

java - "String cannot be converted to int" -

this question has answer here: how convert string int in java? 31 answers i have textfile temperatures 12 months. when try find average temperature, error "string cannot converted int" line temp[counter] = sc.nextline(); someone sees what's wrong? scanner sc = new scanner(new file("temperatur.txt")); int[] temp = new int [12]; int counter = 0; while (sc.hasnextline()) { temp[counter] = sc.nextline(); counter++; } int sum = 0; for(int = 0; < temp.length; i++) { sum += temp[i]; } double snitt = (sum / temp.length); system.out.println("the average temperature " + snitt); you need convert sc.nextline int scanner sc = new scanner(new file("temperatur.txt")); int[] temp = new int [12]; int counter = 0; while (sc.hasnextline()) { string line = sc.nextline(); ...

symfony - Symfony2 Doctrine use wrong alias in SQL, login fails with "Authentication request could not be processed [...]" -

i trying make own user bundle, , struggling @ login phase, error message : authentication request not processed due system problem. i'm kinda new symfony , doing best learn many aspects possible, please forgive me if took wrong path in defining stuff. structure i have 2 bundles, 1 app called scoreboardbundle, , 1 dedicated authenticating mechanic called pulsahr\userbundle. intend make bundle reusable in of projects. user entity want use scoreboardbundle\entity\user, , inherits pulsahr\userbundle\entity\user, implements userinterface, \serializable. log info i looked dev.log, , found intriguing line : [2016-09-22 14:16:19] security.info: authentication request failed. {"exception":"[object] (symfony\component\security\core\exception\authenticationserviceexception(code: 0): exception occurred while executing 'select t1.id id_2, t1.username username_3, t1.password password_4, t1.roles roles_5, t1.email email_6, t1.config config_7, t1.name name_...

DRm support for html5 player -

i trying run angular js application on mobile device html5 player video playback. i know whether html5 supports drm default or there way support drm in html5. regards, raj dugar html5 supports drm through encrypted media extensions (eme) mechanism, in turn relies on media source extensions (mse) mechanism. essentially, drm system provides content decryption module (cdm) built or added browser , accessed html5/javascript via eme decrypt , possibly playback encrypted media. not browser support cdms - in general chrome supports widevine cdm, ms edge supports playready cdm , safari supports fairplay cdm. firefox supports adobe primetime , widevine cdm, although momentum seems latter. you can read more eme here: https://www.html5rocks.com/en/tutorials/eme/basics/ and spec here: https://www.w3.org/tr/2016/cr-encrypted-media-20160705/

html - Regex scrape of the same form_id name but different values -

i know using either regex or xpath how can scrape form id value html page has same form_id names example below, scrape value 2nd form_id name advice best way achieve using regex or xpath? thanks <input type="hidden" name="form_id" value="search_block_form" /> i scrape value form_id below: "webform_client_form_" <input type="hidden" name="form_id" value="webform_client_form_" /> targeting second input xpath: (//input[@name='form_id']/@value)[2] using utilities work on dom structure preferable choice here.

row - apply() vs. sweep() in R -

i writing notes compare apply() , sweep() , discovered following strange differences. in order generate same result, sweep() needs margin = 1 while apply wants margin = 2. argument specifying matrix uppercase x in apply() lowercase in sweep(). my.matrix <- matrix(seq(1,9,1), nrow=3) row.sums <- rowsums(my.matrix) apply.matrix <- apply(x = my.matrix, margin = 2, fun = function (x) x/row.sums) sweep.matrix <- sweep(x = my.matrix, margin = 1, stats = rowsums(my.matrix), fun="/") apply.matrix - sweep.matrix ##yup same matrix isn't sweep() "apply-type" function? r quirk or have lost mind? note apply , if each call ‘fun’ returns vector of length ‘n’, ‘apply’ returns array of dimension ‘c(n, dim(x)[margin])’ if ‘n > 1’ in example, margin can (and should) set 1 in both cases; returned value apply should transposed. easiest see if original matrix not square: my.matrix <- matrix(seq(1,12,1), nrow=4) apply.matrix <- t(app...

jquery - DataTables numbers_length = 3 change pagination buttons -

Image
by setting numbers_length property 3, able produced this is there way can 3 page numbers (previous, current , next) : solution you can use our plug-in simple numbers - no ellipses . $(document).ready(function() { $('#example').datatable({ 'pagingtype': 'simple_numbers_no_ellipses' }); }); however plug-in shows "previous" , "next" buttons. overcome use modified code below. $.fn.datatable.ext.pager.numbers_no_ellipses = function(page, pages){ var numbers = []; var buttons = $.fn.datatable.ext.pager.numbers_length; var half = math.floor( buttons / 2 ); var _range = function ( len, start ){ var end; if ( typeof start === "undefined" ){ start = 0; end = len; } else { end = start; start = len; } var out = []; ( var = start ; < end; i++ ){ out.push(i); } return out; }; if ( pages <= buttons ) {...

c# - Visual Studio 2015 Xamarin.Android - limit fling in Image Gallery to just one item per fling -

when swipe gallery, multiple images go right left, depending on swipe speed. can please tell me how limit swipe 1 image @ time, no matter how fast swipe? [activity(label = "app3", mainlauncher = true, icon = "@drawable/icon")] public class mainactivity : activity { protected override void oncreate(bundle bundle) { base.oncreate(bundle); // set our view "main" layout resource setcontentview (resource.layout.main); gallery gallery = (gallery)findviewbyid<gallery>(resource.id.gallery); gallery.adapter = new imageadapter(this); gallery.itemclick += delegate (object sender, android.widget.adapterview.itemclickeventargs args) { toast.maketext(this, args.position.tostring(), toastlength.short).show(); }; } } try override gallery onfling() method , don't call superclass onfling() method. in way...

rest - RESTful API and real life example -

we have web application (angularjs , web api) has quite simple functionality - displays list of jobs , allows users select , cancel selected jobs. we trying follow restful approach our api, that's gets confusing. getting jobs easy - simple get: /jobs how shall cancel selected jobs? bearing in mind operation on jobs need implement. easiest , logical approach (to me) send list of selected jobs ids api (server) , necessary procedures. that's not restful way. if following restful approach seams need send patch request jobs , json similar this: patch: /jobs [ { "op": "replace", "path": "/jobs/123", "status": "cancelled" }, { "op": "replace", "path": "/jobs/321", "status": "cancelled" }, ] that require generating json on client, mapping model on server, parsing "path" property job id , ac...

javascript - Unable to read properly from JSON file with php -

i trying read json file php array , echo array's content, can fetch info ajax in javascript , convert array in javascript array of json objects. here how json file looks like. [["{\"id\":1474541876849,\"name\":\"d\",\"price\":\"12\"}"],["{\"id\":1474541880521,\"name\":\"dd\",\"price\":\"12\"}"],["{\"id\":1474541897705,\"name\":\"dddgg\",\"price\":\"124\"}"],["{\"id\":1474541901141,\"name\":\"faf\",\"price\":\"124\"}"],["{\"id\":1474543958238,\"name\":\"tset\",\"price\":\"6\"}"]] here php : <?php $string = file_get_contents("products.json"); $json_a = json_decode($string, true); $arr = array(); foreach ($json_a $key) { array_push($arr,$key[0]); } foreach (...

elasticsearch - Multiline logstash "next" not grouping -

short: having troubles multiline. tag "multiline" on log doesn't put them together. explanation: logs receive september 22nd 2016, 13:43:52.738 [0m[[31merror[0m] [0mtotal time: 368 s, completed 2016-09-22 13:43:52[0m september 22nd 2016, 13:43:51.738 [0m[[0minfo[0m] [0m[36msuites: completed 29, aborted 0[0m[0m september 22nd 2016, 13:43:51.738 [0m[[31merror[0m] [0mfailed: total 100, failed 4, errors 0, passed 96[0m september 22nd 2016, 13:43:51.737 [0m[[0minfo[0m] [0m[36mrun completed in 1 minute, 24 seconds.[0m[0m september 22nd 2016, 13:43:51.737 [0m[[0minfo[0m] [0mscalatest[0m the line " total time: %{number} s " repeated multiple time , i'm interested in these total time coming after " total, failed, error " line. between first , second line none or several logs. my configuration is: grok { #1 match => {"message" => "\[.m\[\u001b\[3.m%{notspace:level}\u001b\[0m\] \u001b\[0m%{notspace:status}: ...

exception - SocketTimeoutException - "timeout" "read timed out" -

i writing tests run okhttp/retrofit requests against mockwebserver. among other things i'm testing timeouts . here noticed, of timeout tests do not produce same kind of exception time : while exception thrown sockettimeoutexception , exception message differs between 2 possibilities. get "timeout" , sometimes "read timed out" . there seems no clear pattern (it's same test produces 1 or other of these exception messages). i assume different constellations/causes lead differing messages... can explain me difference between these 2 cases? here corresponding stack traces: "read timed out" caused by: java.net.sockettimeoutexception: read timed out @ java.net.socketinputstream.socketread0(native method) @ java.net.socketinputstream.socketread(socketinputstream.java:116) @ java.net.socketinputstream.read(socketinputstream.java:170) @ java.net.socketinputstream.read(socketinputstream.java:141) @ okio.okio$2.read(...

c# - How to get value of string created in resources Xamarin.android -

i developing android application in xamarin studios , want make text of button underlined. created string in strings.xml following <string name="advanced_search"><u>advanced search</u></string> i succesfully able reference string in xml file desginer, want access in code set button's text. tried following doesn't work: advancedsearchbutton.text = resource.string.advanced_search.tostring(); when try reference string integer value string, want text string holds. how can access string in xamarin using c#? you need use resources.getstring : advancedsearchbutton.text = resources.getstring(resource.string.advanced_search); this assuming code contained within activity , otherwise need have reference android context .