Posts

Showing posts from June, 2014

javascript - AngularJS modules vs CommonJS/ECMA6 modules -

i've joined ongoing web project frontend written in angular 1 mvc framework , using webpack build system , i'm feeling neo in matrix 2 in stack of nested matrices. the project split separate .js files, each annotated module in either commonjs style (with require , module.exports ) or ecma6 style (with import s , export s). webpack transpiles ecma6 ecma5 babel , creates single bundle them. within commonjs modules reside angularjs modules. living inside commonjs, angular task of dependency injection of own angular's requirejs-esque module system. i'm feeling same job of dependency management done twice. is true, when angular written, angular developers had in mind multi-module angular projects should've been concatenated e.g. grunt concat single bundle , served client, angular $injector responsible dependency management? so, our webpack build over-complication on top of that? example project: file model.module.js : import angular "angular&

python - ScatterPlotItem crashs with 7000 or more points -

i use pyqt5.5.1, python 3.4 (windows 32 & 64 bits), numpy, pyqtgraph (tested develop git branch & lastest official version) here part of code use display scatterplot self.widget1 = pg.graphicslayoutwidget(); self.widget1.hide(); self.p1 = self.widget1.addplot() n = 7300 s1 = pg.scatterplotitem(size=10, pen=pg.mkpen(none), brush=pg.mkbrush(0, 0, 255, 120)) pos = np.random.normal(size=(2,n), scale=1e-5) s1.setdata(pos[0], pos[1]) self.p1.additem(s1) self.widget1.show(); with n = 7, or 73, 730 scatterplot works. but n = 7300 , more, crashs python. i have trace, before crash: qpaintdevice: cannot destroy paint device being painted r6025 - pure virtual function call could me find workaround or fix ? thanks

javascript - How do i make an automated traffic light? -

this question has answer here: how automate javascript/html traffic light sequence using setinterval? 2 answers var red = "#ff0000"; var yellow = "#ffff00"; var green = "#00ff00"; var dark_red = "#380000"; var dark_yellow = "#383800"; var dark_green = "#003800"; var x_all = 150; var y_red = 100; var y_yellow = y_red + 150; var y_green = y_yellow + 150; var trafficlightsstatemachine; function trafficlightsstatemachine() { this.state = 0; this.statemachine = new array(); this.statemachine[0] = function () { drawcircles(dark_red, yellow, dark_green); }; this.statemachine[1] = function () { drawcircles(red, dark_yellow, dark_green); }; this.statemachine[2] = function () { drawcircles(red, yellow, dark_green); }; this.statemachine[3] = function () { drawcircles(dark_red, dark_yell

android - ExpandableListView not working properly -

i implementing app expandablelistview , fragment , viewpager , collapsingtoolbarlayout . but have problem. expandablelistview has wrong behavior. remaining items below cut. , when click on item below top item displayed behind tablayout. what error in code? thank you main.xml <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:fitssystemwindows="true" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/themeoverlay.appcompat.dark.actionbar" android:fitssystemwindows="true"> <

ios - how to set up something like a collectionview in a tableview? -

Image
here visual example of achieve. my initial idea use uicollectionview custom cells, didn't work out , trying out collectionview within collectionview worse. so tried collectionview in tableview , kind of worked tableviewcell's dynamic height proved gigantic issue super difficult me solve have begun learn swift , ios developing. please :( edit: note "shopping mall 1" section meant sticky header of sort. similar (the turquoise header): credits: https://github.com/jamztang/csstickyheaderflowlayout but using https://github.com/petec-blog/collectionviewstickyheaders example clearer , closer needed. you play around code below idea (xcode 7.2 (7c68)) delete storyboard, launchscreen, clean properties main story board , launchscreen in info.plist , replace appdelegate.swift following content import uikit @uiapplicationmain class appdelegate: uiresponder, uiapplicationdelegate { var window: uiwindow? func application(application: uiapplica

Creating file using PHP imagepng function in Openshift -

i use imagepng() save image using php. work fine in hosting, can't make work in openshift redhat. imagepng($rimg, 'myimg.png'); i tried save directory , give permissions ( chmod 777 ) directory didn't help. tried add prefix of dirname(__file__) path didn't work , can't create image file. know file has not been created because searched in server , didn't find anything. there way create image file using imagepng() in openshift?

Android Button default state -

why button's default behaviour state_activated="false"? using selector never reaches last row, stays on second line: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@color/colorprimary" android:state_enabled="false"/> <item android:drawable="@color/colorprimarydark" android:state_activated="false"/> <item android:drawable="@color/coloraccent"/> let's selector shared amongst buttons , layouts pose button, in layout's case, setactivated(false) needed change background. the default state of activated false views. easiest way understand why consider case of tabs on viewpager. the activated tab 1 represents visible page - doesn't make sense multiple tabs activated @ same time. i mentioned in blog post activated described "selected" didn't know terms android used.

ios - Sending push from 2 apps that use the same Parse App ID -

can use same parse app 2 different swift apps , have specific users pushing messages each other? do need 2nd push (p12) certificate on either parse or apple dev site? or can both apps use same 1 somehow? my scenario restaurant ios app , customer ios app. need customers send push message restaurant app every new order. need restaurant manager send push message customers order updates side. users (restaurant owner + customers) reside on same parse app.

php - codeigniter nusoap client error: wsdl error: XML error parsing WSDL Mismatched tag -

this controller. class cteam extends my_controller { //this server public function server(){ if($this->uri->rsegment(3) == "wsdl") { $_server['query_string'] = "wsdl"; } else { $_server['query_string'] = ""; } //$ns= site_url()."cteam/cteam/server/wsdl"; $ns= site_url()."cteam/cteam/wsdl"; $endpoint = site_url()."cteam/cteam/server/wsdl"; $this->load->library("nusoap_library"); //load library here $this->load->library('xmlrpc'); $this->nusoap_server = new soap_server(); $this->nusoap_server->configurewsdl('sever','urn:'.$ns,$endpoint); $this->nusoap_server->wsdl->schematargetnamespace='urn:'.$ns; $input_array = array ('count&

php - Javascript form submit preventDefault not working when form is retrieved with AJAX -

i have form, submit javascript , preventdefault. works fine. however, when retrieve form ajax call other data db, form not submit javascript anymore, tries refresh entire page normal action="" , method="post". seems due ajax call, preventdefault somehow disabled? ajax call form , other data db: <a href="#" onclick="return false" onmousedown="javascript:loadnames('<?php echo $postid;?>');">load names</a> <div id="form-container"></div> <!-- empty, contains form upon ajax call above--> the ajax retrieved html form submit javascript: <div id="form-container"> <!--let user add name db not contained in db list below--> <form method="post" action="" id="addnameform"> <input name="name" id="name" type="text" value=""/> <input type="submit" name="add-name-sub

javascript - Adding new rows to table when moving between pages -

i'm trying create small html project people can make reservations cinema choosing movie , seats , then, clicking pay button new page shown summing reservation ,and once save button clicked, reservation should displayed new row in reservations table. so i'm having difficulties adding new rows table page whenever button (actually link new page) clicked in previous page. here's table part of orders page (nested inside div body of course): <table style="border:1px solid black; width:1000px;" id="table"> <tr bgcolor=#262673 id="tr1" > <td align=center style="color:white; font-size:30px;"><b>movie name</b> </td> <td align=center style="color:white; font-size:30px"><b>number of seats</b> </td> <td align=center style="color:white; font-size:30px"><b>credit card type </b></td> </tr&

c# - GKLocalPlayer.LocalPlayer null on some simulators -

i'm having issue integrating game center monogame game. what have: void initgamecenter() { gamecentermanager = new gamecentermanager(); setauthenticatehandler(); } void setauthenticatehandler() { gklocalplayer.localplayer.authenticatehandler = (ui, error) => { if (ui != null) { controller.presentviewcontroller(ui, true, null); } else if (gklocalplayer.localplayer.authenticated) { currentleaderboard = gamecentermanager.reloadleaderboard(leaderboardid); } else { var alert = new uialertview("game center account required", "need login game center!", null, "retry", null); alert.clicked += (sender, e) => { //gklocalplayer.localplayer.authenticated(); }; alert.show(); } }; } on simul

i want to submit image(file) with other form element just using php and jquery not ajax -

my html here <body> <form id="myform" method="post" action="formprocessing.php" enctype="multipart/form-data"> <input type="text" name="first_name" id="first_name" value=""><b/> <input type="text" name="last_name" id="last_name" value=""><br /> profile image: <input name="image" id="image" type="file" /><br /> <input type="submit" name="formsubmit" id="formsubmit" onclick="return false" value="submit"> </form> <div id="result"></div> </body> ****my jquery code bellow here**** $(document).ready(function(){ $('#formsubmit').click(function(){ var name = $('#first_name').val(); var lastname = $('#last_name').val(); var files = $('#imag

php - Unable to expand navigation of wordpress website when the browser size is reduced -

Image
i looking in verefly.com . have developed website online theme , have made necessary changes .my issue navigation menu when browser reduced original size , not expand . should ideally , performing until days ago . the normal website looks : the website looks different when browser reduced in size : in above picture see navigation menu , plus sign no longer clickable . neither expand . not able understand can change work again . i appreciate .* * tried check if secondary menu had issue , nothing evident * mmm.. see. try remove or turn off script below. may resolve problem. jquery(document).ready(function(){ jwplayer("mediaplayer_vid_5").setup({ "autostart" : "true", "controlbar" : "bottom", "file" : "http://www.youtube.com/watch?v=pgocetmgle0&feature=youtube_gdata_player", "flashplayer" : "http://verefly.com/wp-content/plugins/cool-v

javascript - Null Reference Exception for target in a script on a newly instantiated object -

what i'm trying spawn enemy , create marker/blip on minimap spawned enemy. nullreferenceexception @ line blipctrl:29. the blips on minimap have target gameobject position reflects position of blip on minimap. when enemy instantiated set have unique name. i'm having trouble writing function sets target of blip gameobject unique name blip gets it's position , rotation from. spawner.js public var enemy : rigidbody ; private var spawnvalues : vector3 = vector3(50, 1, 50); public var enemycount : int ; public var enemyid : int; static var enemiesarray = new array(); public var blipcontroller : blipctrl; var spawnposition : vector3; var spawnrotation : quaternion; function start () { var blipcontroller = getcomponent("blipctrl"); spawnwaves(); } function setname () { enemy.name = "enemy#" + enemyid++; } function spawnwaves() { for(var = 0; < enemycount; i++) { var spawnposition : vector3 = new vector3(random.range(-50

How to print all exceptions thrown by some Scala program? -

are scala exceptions stored in global exceptions table or similar kind of structure , if there way access other catch?i mean if need print exceptions thrown scala program best way so? thanks there no table exceptions stored far know. can add unhandled exception catcher given thread, same way in java: import java.lang.thread.uncaughtexceptionhandler import java.security.invalidkeyexception thread.setdefaultuncaughtexceptionhandler(new uncaughtexceptionhandler { override def uncaughtexception(t: thread, e: throwable): unit = { println(e) println(e.getstacktrace.mkstring("\r\n")) } }) but exception should unhandled in thread work. , if 1 unhandled exception happened - no other exceptions can thrown - not sure mean all exceptions

asp.net mvc - how to display values from database into the layout page in mvc -

here trying make dynamic , editable layout page in mvc.in layout page have logo( presently hard coded). implementing function user can change logo uploading own logo. the path of logo stored in database. example if logo : <img alt="" src="~/images/w_logo.png" style="border-style: none;" width="115px" height="60px" /> i want : <img alt="" src="@item.logo" style="border-style: none;" width="115px" height="60px" /> where 'logo' parameter pass in model. or <img alt="" src="@viewdata["logopath']" style="border-style: none;" width="115px" height="60px" /> also if using controller store value how can make runs everytime application starts. example controller: public actionresult layoutchange() { --recover path database-- viewdata["logopath"]=path database; return view(); --

jquery zoomer rebind after image source changed by javascript -

i made small image gallery 1 big image along few small ones under neath. there zoomer attached big image , when click on small image replaces big image zoomer shows old image instead of new one jquery jquery(document).ready(function($){ //fire on dom ready $('#myimage').addpowerzoom() }) javascript function movimg(img){ var bimg = document.getelementbyid('myimage'); bimg.src=img.src; $(document).trigger("ready"); } html <img id="myimage" src="img/abc.jpg" alt="" /> <image src="thumbnails/xyz.jpg" onclick="movimg(this);" width="73px" style="cursor: pointer;" /> where wrong or what's right way it? thanks try call $('#myimage').addpowerzoom(); instead of $(document).trigger("ready"); this worked me. looks slight delay happens when change source of image breaks powerzoom. idea call addpowerzoo

html - Make the text as wide as the sibling image -

thats codepen: http://codepen.io/helloworld/pen/bemola?editors=1100 i want text below image not go further right border of image. instead text should line-break. how can that? <div style="background:orange;"> <img src="https://encrypted-tbn1.gstatic.com/images?q=tbn:and9gcrmvfchgvt3ywcj6yaxrkgnru6vrazaibtfsap_mazinj5gqmu1cq" />text below should stop @ image right border , line-break <h2>sie haben ihre anfrage erfolgreich storniert!</h2> <p> lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. @ vero eos et accusam et justo duo dolores et ea rebum. stet clita kasd gubergren, no sea takimata sanctus est lorem ipsum dolor sit amet. lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. @ vero eos et accusam et justo duo do

javascript - Ext.Create and this.callParent -

how can use ext.create , this.callparent together? if use following code errors retrieving data ajax store. items: [ { xtype: 'combo', initcomponent: function() { ... this.callparent(arguments); } } ] any suggestions? the callparent docs say: call "parent" method of current method. method overridden derivation or override (see ext.define). in other words, callparent within ext.define or ext.override ; not when override method in config. what important understand initcomponent not meant overridden config. should extend combo class , override initcomponent there.

c# - bytes to human readable string -

Image
i using following code convert bytes human readable file size. it's not giving accurate result. public static class filesizehelper { static readonly string[] sizesuffixes = { "bytes", "kb", "mb", "gb", "tb", "pb", "eb", "zb", "yb" }; public static string gethumanreadablefilesize(int64 value) { if (value < 0) { return "-" + gethumanreadablefilesize(-value); } if (value == 0) { return "0.0 bytes"; } int mag = (int)math.log(value, 1024); decimal adjustedsize = (decimal)value / (1l << (mag * 10)); return string.format("{0:n2} {1}", adjustedsize, sizesuffixes[mag]); } } usage: filesizehelper.gethumanreadablefilesize(63861073920); it returns 59.48 gb if convert same bytes using google converter gives 63.8gb . idea wrong in code? goolge screenshot: @rené vogt , @bashis explanation. wor

python - What files does Coveralls select? -

i'm running travis , coveralls run integration tests. appears coveralls giving me higher rating should; have written tests handful of source files in repository, , files checked coverage (hence 95% coverage..). appears if files not have tests specified not checked. how coveralls select files check? perhaps repository bit unusual, in contains several python scripts each have own entry point. testing 1 entry point, leaving rest of code untouched (and not imported). my travis.yml file executes nose2 , runs tests 1 entry point.

unit testing - Run ExUnit.Case functions serially using Agent -

i know that, default, exunit.case synchronous (according docs http://elixir-lang.org/docs/stable/ex_unit/exunit.case.html ). read issue ( https://github.com/elixir-lang/elixir/issues/3580 ) , seems test functions inside case run serially. when run simple test case without global state cases indeed run serially. but when use global state agent order of execution depends on luck. same call mix test --trace the order of execution change. here test suite: defmodule serialtest use exunit.case test "1" agent.update(:card_id, fn nil -> 1 end) assert true end test "2" res = agent.get(:card_id, fn res -> res end) assert res == 1 end test "3" agent.update(:card_id, fn id -> 3 end) assert true end test "4" res = agent.get(:card_id, fn res -> res end) assert res == 3 end end sometimes passes not. how can have execution order of functions conform declaration order in file defin

ios - displaying image in table view which is saved in document directory -

i have saved image in document directory following code , after image there in documentary directory uiimage *image =[[uiimage alloc ]init ]; image = [uiimage imagenamed:@"placeholder.png"]; nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsstring* path = [documentsdirectory stringbyappendingpathcomponent:[nsstring stringwithstring: @"placeholder.png"] ]; nsdata* data = uiimagepngrepresentation(image); [data writetofile:path atomically:yes]; now want display image in table view in table view images getting displayed facebook url thats why using following code nsstring *path = [[_arrayfortable valueforkey:@"url"] objectatindex:[indexpath row]]; nsurl *url = [nsurl urlwithstring:path]; asyncimageview *imageview = [[[asyncimageview alloc] init] autorelease]; imageview.frame = cgrectmake(0, -5, 45, 45); imageview.imageurl=u

sql server 2008 - Query for only one client entry a day -

i have table definition this: create table [dbo].[contact] ( clientnumber [numeric] (20, 0) null, contactdate [date] null, name [text] null, additionalinformation [text] null ) this table filled information single month. each client may have multiple entries single day. meaning there might entries this: 42 2015-12-09 felix called today 42 2015-12-09 fexclicx ... my goal client results table condition there should 1 entry day per client number. not care of (here) 2 entries displayed, top 1 . so far tried achive distinct: select distinct clientnumber, contactdate, * contact unfortunately not limit results show client entry specific date once. still appear. how achive getting entries 1 entry 1 client per day? i suggest edit table, has id column ( set primary key). if so, can use query i've posted. i don't know how desire information group by, can't aggregate text columns. create table [dbo].[#contact] ( id int i

How to align text in center using jspdf -

how align text in center using jspdf. var doc = new jspdf(); doc.text(40, 250, 'hi how you'); if using latest version (1.1.135) api has changed text function. reads as: api.text = function(text, x, y, flags, angle, align); if don't need use flags or angle though, can use: var doc = new jspdf(); doc.text('hi how you', 40, 250, 'center'); keep in mind center call uses x parameter center of text string, , not left border when rendering left aligned. link source edit: alternately can calculate proper x offset use text function so: var text = "hi how you", xoffset = (doc.internal.pagesize.width / 2) - (doc.getstringunitwidth(text) * doc.internal.getfontsize() / 2); doc.text(text, xoffset, 250);

php - Htaccess rewrite rule from repertory load sub domain urls -

i trying 2 website. main 1 on www.personal.com there wordpress blog hosted on server loaded on blog.personal.com i want mask urls main site /blog/ architecture , load (with transparency) same sub domain urls example : www.personal.com/blog/my-first-article load blog.personal.com/my-first-article keeping url in browser (the url in browser ne change) : www.personal.com/blog/my-first-article last difficulty , .htaccess file used others websites host, not want theses rules others domain personal.com rule should 1 domain name. does know how to ? solved, right thing was, in apache vhost configuration : rewriteengine on rewritecond %{http_host} ^www\.personal\.com$ rewritecond %{request_uri} ^/blog/ rewriterule ^blog/(.*)$ http://blog.personal.com/$1 [p,qsa] proxypass /blog/ http://blog.personal.com/ rewritecond %{http_referer} ^http://www\.personal\.com/blog/ [nc] rewritecond %{request_uri} ^(/[^/]+/) rewritecond %{request_uri} \.(jpg|png|css|js

How to change jquery jtable edit modal form input box fields by textarea fields -

i have been working on jquery jtable api's , works fine when click edit button icon edit modal form pop , fields inside modal form input boxes content inside jtable paragraph , quite difficult edit in smaller text box. can me how change default edit modal form input box text area length of text can seen , edited in text area. this api reference type . have add type option field. example- about: { title: 'about person', type: 'textarea' }, for example given here .

java - Why I cant' use nested classes/Objects? -

i stuff while coding: getnamedjdbctemplate().update(sql, new mapsqlparametersource() { { addvalue("a", obj.geta()); addvalue("b", obj.getb()); addvalue("c", obj.getc()); } }); or this getjdbcoperations().queryforobject(sql, new object[] { id}, new rowmapper<obj>(){ @override public obj maprow(resultset rs, int rownum) throws sqlexception { // todo auto-generated method stub return null; }}); i use lot off inner classes java methods. for sure, if use code more once place on different class can reuse it... problem team mates don't this, , nobody able give me proper reason of why not... they talk lot memory leaks , garbage collection(gc) believe stuff past. i'm using java6 , spring 3. apps deployed on tomcat 6 server. there couple disadvantages can think using double brace initialization , anonymous classes in gener

three.js - Get the new camera position with onmousemove event on a sphere object and transforming it onto 2D map location -

i have made sphere object camera.position(0,0,1) , using orbit controls(camera). when drag mouse on sphere either of sides how can new camera positions , transform them onto 2-d map ? have searched not find relevant sources if can help, great-full. your camera position stored vector3 in camera.position, can add face direction controls.target. camera.position vector can calculate position on 2d map x , z position of camera.

Visual Studio - disable reversed cursor to select line -

Image
i hope okay ask on so, i'm not sure. apologize if shouldn't here. i reinstalled visual studio professional 2015 yesterday due few issues having. new installation, line numbers have wide section mouse reverses direction , select entire line if clicked. don't recall area being wide on of previous installations of vs2015; know there in first place. there way disable this? this area happens, boxed in green. it's wider line numbers fill (only 147 lines in file). there 2 "margins" available in visual studio 2015: selection , indicator available under tools > options > text editor > general > display . turning these off remove some, not of "extra space" , feature of highlighting entire line still there. if want turn them off because space bothersome, keep in mind not able see breakpoints unless "highlight current line" checked.

ms access - vb.net:Program can't save to database -

developing database software using vb.net program fails save database. if microsoft.visualbasic.right(application.startuppath, 1) = "\" sconnstring = "provider=microsoft.ace.oledb.12.0;data source=" & application.startuppath & "\database2.accdb" else sconnstring = "provider=microsoft.ace.oledb.12.0;data source=" & application.startuppath & "\database2.accdb" end if conn = new oledbconnection(sconnstring) conn.open() cmd.connection = conn cmd.commandtype = commandtype.text cmd.commandtext = "insert personaldata (title, full name,department,unit,phone no,email,gender,marital status,birthday,spouse birthday,wedding anniversary,educational qualification,no of kids,work experience) values (@title, @full name,@department,@unit,@phone no,@email,@gender,@marital status,@birthday,@spouse birthday,@wedding anniversary,@educational qualification,@no of kids,@work experience)" cmd.parameters.add("@title

json object not returning value in typeahead -

i'm trying return specific data json returns nothing. i took example http://jsfiddle.net/fresh/1hrk0qso/ works when using example url. url: 'https://cdn.rawgit.com/twitter/typeahead.js/gh-pages/data/countries.json', it works when localhost url: '../json/countries.json', but, when change countries.json file include multiple fields(see json below), not return anything. json: [ {"cities_id":"1","city":"attignat","postal_code":"01340"}, {"cities_id":"2","city":"beaupont","postal_code":"01270"}, {"cities_id":"3","city":"b\u00e9ny","postal_code":"01370"} ] js (modified return 'city' in replace 'name' json file): var countries = new bloodhound({ datumtokenizer: bloodhound.tokenizers.obj.whitespace('city'), querytokenizer: bloodhound.tokenizer

jquery - Add Leaflet GeoJSON layers from GeoServer to an Array using a Javascript loop -

i'm trying add geojson layers array using loop, , showing them on map. my goal have variable this: scenario_json[1] = layer1, scenario_json[2] = layer2, etc... myurl = [ "http://localhost:8080/geoserver/jonquiere_local/ows?service=wfs&version=1.0.0&request=getfeature&typename=jonquiere_local:buildings_phase1&maxfeatures=400&maxfeatures=400&outputformat=json&format_options=callback:getjson", "http://localhost:8080/geoserver/jonquiere_local/ows?service=wfs&version=1.0.0&request=getfeature&typename=jonquiere_local:buildings_phase2&maxfeatures=400&outputformat=json&format_options=callback:getjson", "http://localhost:8080/geoserver/jonquiere_local/ows?service=wfs&version=1.0.0&request=getfeature&typename=jonquiere_local:buildings_phase3&maxfeatures=400&outputformat=json&format_options=callback:getjson" ]; $.getscript('src/leaflet.js'); for(i=0;i<

mysql - SQL - Percentiles -

i have 1 table: country(id, city, freg, counts, date) i want calculate 90th percentile of counts in specific interval of dates ($min , $max). i've did same average (code below): select avg(counts) country date>= @min , date < @max ; how can calculate 90th percentile instead of average? finally, group_concat for... select substring_index( substring_index( group_concat(ct.ctdivol order ct.ctdivol separator ','),',',90/100 * count(*) + 1 ),',',-1 ) `90th percentile` ct join exam e on e.examid = ct.examid , e.date between @min , @max e.modality = 'ct';

apache kafka - Spark Streaming job behaves like a batch -

i'm trying run spark streaming job read messages kafka. testing insert kafka couple of gigabytes of messages , launch streaming job (python). from spark import sparkcontext, sparkconf pyspark.streaming import streamingcontext conf = sparkconf() conf.setmaster("spark://master1:7077,master2:7077,master3:7077") sc = sparkcontext(conf=conf) ssc = streamingcontext(sc, 1) pyspark.streaming.kafka import kafkautils directkafkastream = kafkautils.createdirectstream(ssc, ["test_topic"], {"metadata.broker.list": "kafka1:9092,kafka2:9092,kafka3:9092", "auto.offset.reset": "smallest"}) directkafkastream.count().pprint() ssc.start() ssc.awaittermination() i expect job update me every second messages counted far (streaming). job counts messages in queue (whatever time takes) , after messages counted, see update (batch). please, tell me have missed here. update : expecting see: -------------------------------------------

RSpec stub environment helper -

i've got lib/require/environment_helpers.rb file contains helper methods. there more methods, it's not wrapped in module. def development? rails.env.development? end def test? rails.env.test? end i'm trying stub these methods out , not having luck. i've tried: before :each allow(rails.env).to receive(:production?) { false } end before :each allow(rails).to receive(:production?) { false } end before :each allow(serviceundertest).to receive(:production?) { false } end trying stub these methods you can stub this before :each rails_env = double(:rails_env, development?: false) expect(rails).to receive(:env).and_return(rails_env) expect(rails_env).to receive(:development?).and_return(false) end

ruby on rails 4 - Cocoon, Bootstrap_Form_For and PostgreSQL updating all fields but boolean check box -

i using cocoon gem bootstrap_form_for in rails 4 application. working , have no problem creating , updating of fields except when try change set boolean field. below find code, , appreciated. products_controller: def update respond_to |format| if @product.update(product_params) format.html { redirect_to @product, notice: 'product updated.' } format.json { render :show, status: :ok, location: @product } else format.html { render :edit } format.json { render json: @product.errors, status: :unprocessable_entity } end end end categories_controller: def create @category = category.new(category_params) respond_to |format| if @category.save format.html { redirect_to hq_company_settings_path(:anchor => "productstab"), notice: 'category created.' } format.js { redirect_to hq_company_settings_path(:anchor => "productstab") } else format.html { redirect_to hq

angularjs - Using text input as filter option -

i struggle usage of filter. have input field want use filter option. the array looks this: $scope.examples=[ { name:'dolly', place:'roof', description:'dolly friend of mike.' }, { name:'mike', place:'cellar', decription:'mike doesn't roof.' },]; $scope.search=""; the input: <input ng-model="search" type="text" placeholder="type here"> and ng-repeat: <tr ng-repeat="something in examples |filter:search"> {{something.name}} </tr> now, if type in "dolly", shows me dolly quite planned. if type in "mike" output dolly , mike , because used word mike in description dolly. same typing in "roof". tried use <ng-repeat="something in examples |filter:{name:'search'}"> but in case don't work , there no output. want restrict filter 'name' only. maybe have suggesti

c# - Autocomplete Text Box With Active Directory Users -

hi there trying create textbox when user types list of users specific name: example: if started type jane.doe, , had typed in ja list come users active directory start ja. need figure out how can users list each time user types. pretty have ajax side done. getting list of users updated each time. my current idea: [httppost] public actionresult remotedata(string query) { list<string> lstadusers = new list<string>(); using (var context = new principalcontext(contexttype.domain, null, "ldappath")) { using (var searcher = new principalsearcher(new userprincipal(context))) { foreach (var result in searcher.findall()) { directoryentry de = result.getunderlyingobject() directoryentry; string userswithname; if (!string.isnullorempty((string)de.properties["samaccountname"].value)) {

xml - represent half hour time increment in javascript if else if -

i have built simple stock feed uses xml , javascript. aded in conditional based on time before market open shows previous close, while open shows ask price, when closed, shows last price. works, if time interval whole number. need time intervals 9:30 4:30 (16:30) when try augment time half hour errors. here code, how display time intervals 9:30 , 16:30? var time = new date().gethours(); var data; if (time < 10) { data = x[0].getelementsbytagname("previousclose")[0].childnodes[0].nodevalue;} else if (time < 16) { data = x[0].getelementsbytagname("ask")[0].childnodes[0].nodevalue;} else {data = x[0].getelementsbytagname("lastprice")[0].childnodes[0].nodevalue;} just use minutes hours var date = new date(); var hours = date.gethours(); var mins = date.getminutes(); var data; if (hours < 9 || ( hours < 10 && minutes < 30 ) ) { data = x[0].getelementsbytagname("previousclose")[0].childnodes[0

SharePoint 2010 People Picker on 2013 sites -

i have code generate custom form on 2010, generate form control based on field type. used same code in 2013 getting 2010 people picker field including resolve , search options. there not auto complete options also. there ay specific property need set convert field 2013 type field. note: oob form working expected 2013 pp field shows. use sharepoint:clientpeoplepicker instead sharepoint:formfield complete solution : solution

Excel VBA Crashing -

my company computer upgraded office 2010 office 2013. had several workbooks large macros outputting various reports. after upgrade having problems. biggest issue excel crashing ("microsoft excel has stopped working."), on code ran fine in 2010. i tried copying sheets , code new workbook, , reassigning buttons correct macros in new workbook. runs fine, when try edit code, starts crashing excel again. code compiles fine, without errors. changed options "notify before state loss" , "break on errors", still cannot prevent crash. i have vba opens spreadsheet data, before read data code looks column headers. array escarray has column headers stored in position 0 (zero) , when finds matching column header, replaces column name column number, can pull data correct column (in case columns shift don't have change code). below code checks make sure column names found , replaced number. if array position not have number value (representing column

c++ - Programmer thought process: determining a maximum number of bytes to read when using ReadFile with the Windows API -

i need call readfile function of windows api: bool winapi readfile( _in_ handle hfile, _out_ lpvoid lpbuffer, _in_ dword nnumberofbytestoread, _out_opt_ lpdword lpnumberofbytesread, _inout_opt_ lpoverlapped lpoverlapped ); the argument i'm interested in 3rd one: nnumberofbytestoread [in] the maximum number of bytes read. i'm not interested in "magic number" put there process seasoned programmer takes determine number put there, preferably in numbered steps. also keep in mind writing program in assembler i'm more interested in thought process perspective. https://msdn.microsoft.com/en-us/library/windows/desktop/aa365467%28v=vs.85%29.aspx this requires plenty of insight both windows , hardware. but, in general, here possible directions: is write buffered or unbuffered? if unbuffered, may not able choose size, have follow strict rules both size , alignment of buffer. i

Parsing Complex PDF document with C# -

Image
see attached k-1 document. have attempted use numerous tweaks itextsharp library haven't had success in loading data correctly. ideally parse out document similar how humans read them, 1 textbox @ time, reading contents. var reader = new pdfreader(file, encoding.ascii.getbytes(password)); string[] lines; var strategy = new locationtextextractionstrategy(); string currentpagetext = pdftextextractor.gettextfrompage(reader, 1, strategy); lines = currentpagetext.split(new string[] {"\r\n", "\n"}, stringsplitoptions.none); i tried playing annotation parsing didn't have luck. i'm newbie , looking @ wrong place. can guide me in right direction? thanks lot. the first question if form electronic or scanned one? latter make data extraction harder should involve ocr too. in case have electronic pdf , if have similar forms why don't use following strategy: store coordinates of each "box&

android - Contextual bar above toolbar -

Image
i want contextual bar replace toolbar. looks that: i tried solution: toolbar , contextual actionbar appcompat-v7 still not work.. idea? and why status bar transparent? it's not, when contextual bar not shown

Using Selenium Commands on HTML content stored in a local varialble -

this may sound odd possible use webdriver commands on static variable holds html source? (eg: findelementbyid) this want do: set firefox webdriver open website url save html pagesource "static local variable" quit webdriver now - want able findelements , texts within locally stored pagesource. (preferably using selenium commands) any and/or suggestion appreciated. thanks. basically no , falls down @ (5). firefoxdriver needs communicate actual firefox browser using webdriver protocol . selenium can't work string. it's not clear use case is, things copy html temporary file, generate file: url it, load htmlunit or phantomjs drivers , re-run tests in-memory. surely plain old regular expressions, or html parser jsoup , better options post-processing html?