Posts

Showing posts from May, 2015

jquery - Chosen Multiselect dropdownlist loading issue -

i using ‘choosen-select’ multiselect dropdown list. i facing problem dropdown list, while page loading list displayed in enlarge form(all items visible , no effect of chosen library)for moment , regain desired feel , shape of dropdown list. please find attached image of before , after page load. attachment have wrapped script in $(document).ready() function? this should ensure none of scripts run until page has been loaded. its possible .chosen() running before page has loaded initial elements first. more info here $(document).ready(function() { //following code used generate 2000 items in select element //in order try , replicate issue. var counter = 2000; for( var i=1; <= counter; i++ ) { $(".chosen-select").append("<option> item " + + "</option>"); } //initialise jquery chosen library on select element $(".chosen-select").chosen(); }); <!-- links external

valgrind - Callgrind - QCachegrind output: Does "self" represents the cost of a function per call? -

Image
i confused how interpret "self" slot in qcachegrind. per call cost of function or total cost of function when called x times x represented slot "called"? (please see image below) is 0.003 cost of function when called once? or need divide 2 ("called" slot) function cost per call? incl. total cost of function on line, including cost of functions called directly or indirectly function. self cost of function itself. see http://www.valgrind.org/docs/manual/cl-manual.html#cl-manual.use (in particular section 6.1.1. functionality) more details. wiki

java - MongoDB $lookup query returning empty field -

there 2 collections in database, projects , tasks . each project can have number of tasks associated it. trying create mongodb query in java return task , embed project linked it, code have completed far returns empty array (i have named something appears [] below). unfortunately have not found many examples on how use $lookup in java. changes need perform on code something field comes project ? should using $lookup or aggregation operator? the java method using mongo-java-driver version 3.5.0: public static string readtask() { mongoclient mongoclient = new mongoclient(); mongodatabase database = mongoclient.getdatabase("exampledatabase"); bson lookup = new document("$lookup", new document("from", "project") .append("localfield", "project._id") .append("foreignfield", "_id") .append("as", "s

angular2 forms - Search filter in data table in Angular 2 -

i displaying json data in table has 3 columns , under each of these column have search text box user can search name , phone, age.below code. import { pipe, pipetransform } '@angular/core'; @pipe({ name: 'namefilter', pure: false }) export class namefilterpipe implements pipetransform { transform(items: any[], searchterm: any): any[] { if (!searchterm) return items; return items.filter(function(item){ if(item.fullnme == null){ return null; }else { return item.fullnme.tolowercase().includes(searchterm.tolowercase()); } }) } } below html code <td class="input-cell"> <input type="text" class="form-control form-textbox input-text" id="lender_name" [(ngmodel)]="searchterm" style="

c# Winforms - How to change a vertical MenuStrip navigation to be more user friendly? (intuitive) -

Image
i have vertical menustrip similar one: vertical menustrip example (layoutstyle = verticalstackwithoverflow, dock = left) , need change way arrow keys work inside menu because act menustrip horizontal (right , left arrow keys navigate between items) , need acts vertical menu (up , down arrow keys navigate between items). it's ok if don't give me exact way @ least need change arrow keys events if possible. if want recreate situation create mdi form , use properties mentioned, notice navigation doesn't feel natural "parent" items. i hope can me , other people might have same problem, thank you! wiki

javascript - Modular dependency blocks for multiple applications in a NodeJS package.json -

i have multiple applications in main nodejs application(each having own server , dependencies). server.js - app1.js - app2.js - app3.js i want install selected npm packages corresponding app on server code cloned. possible create package.json file can have custom app1dependencies , app2dependencies , app3dependencies apart dependencies can install using npm install --app1dependencies when want run server.js & app1.js . wiki

css - text-overflow ellipsis on flex child not working -

this question has answer here: prevent child element overflowing parent in flexbox [duplicate] 1 answer why doesn't flex item shrink past content size? 1 answer ellipsis not working in flex container 1 answer flexbox, min-height , ie11 2 answers i have container flex . want middle child take entire space set flex: 1 . far good. the next level middle child has 2 child want set flex (if lost me, skip snippet) , first child set ellipsis styles. now, ellipsis stops working. if click on button, see short text; any ideas? function toggle() { var el = document.queryselector('.el'

mysql - Efficient way to find maximum value on 80+ tables -

i have 80 tables , want filter has highest price among 80 tables. plan on using query: select id (select id, price t1 price = (select max(price) t1) union select id, price t2 price = (select max(price) t2) union select id, price t3 price = (select max(price) t3) ) m order price desc limit 1 but find inefficient. there other way? in advanced i think lot faster. select id, price t1 union select id, price t2 union select id, price t3 order price desc limit 1 wiki

c# - Triangle button android click / hovered -

Image
i have created triangular button in android. works well. want change fill color / stroke color when button hovered / pressed (like in default button). i try invalidate view when hovered property changed , change color in ondraw method without success. this code: public enum triangularbuttondirection { = 0, down = 1 } class triangularbutton : button { public triangularbutton(intptr javareference, jnihandleownership transfer) : base(javareference, transfer) { this.initialize(null); } public triangularbutton(context context) : base(context) { this.initialize(null); } public triangularbutton(context context, iattributeset attrs) : base(context, attrs) { this.initialize(attrs); } public triangularbutton(context context, iattributeset attrs, int defstyleattr) : base(context, attrs, defstyleattr) { this.initialize(attrs); } public triangularbutton(context context, iattributeset attrs, in

javascript - Swiper and bootstap collapse refresh -

who faced such problem in swiper. inside slide, there bootsrap collapse. if options autoheight: true, height not recalculated. tried observer option, not work smoothly. thought of way through settimeout update swiper every second, seems costly operation. please tell me more optimal way how deal such problem. default not work var swiper = $('.swiper-container').swiper({ autoheight: true, nextbutton: '.swiper-button-next', prevbutton: '.swiper-button-prev' }); * { box-sizing: border-box; } body { margin: 50px; } .parent { background-color: #ccc; padding: 20px; } .swiper-slide { padding: 0 50px; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/swiper/3.4.2/js/swiper.jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta/js/boo

c# - What happens when quartz sheduler becomes out of scope? -

what happens when quartz sheduler becomes out of scope? garbage collector kills or keep running? samle code: namespace quartz_test { public class simplejob : ijob { public void execute(ijobexecutioncontext context) { console.writeline("hello there"); } } class program { static void scheduletask() { // construct scheduler factory ischedulerfactory schedfact = new stdschedulerfactory(); // scheduler ischeduler scheduler = schedfact.getscheduler(); scheduler.start(); ijobdetail job = jobbuilder.create<simplejob>() .withidentity("myjob", "group1") .build(); itrigger trigger = triggerbuilder.create() .withsimpleschedule(x => x.withintervalinseconds(10).withrepeatcount(3)) .build(); scheduler.schedulejob(job, trigger);

javascript - JQuery - on('click') doesn't work with map area -

i'm writing code .html() has html map area (it's workaround enable/disable map area) i can work live event (works on click on image) doesn't work map area. can't found hint this, researched , test several ways no-result. my var html: var mapimage = '<map name="image-map"><area target="" href="#" alt="" title="" id="s" coords="55,109,130,220" shape="rect"><area target="" href="#" alt="" title="" id="b" coords="135,108,205,222" shape="rect"><area href="#" target="" alt="" title="" id="w" coords="213,109,296,223" shape="rect"><area href="#" target="" alt="" title="" id="n" coords="303,91,387,225" shape="rect"><area href="#" targe

node.js - Images uploaded with Node server cannot be found by Angular 2 -

i have app in angular 2, decided add real server, node js, upload documents , other things. browser => angular [localhost:4200/api/documents] => node [localhost:3000/documents] this how start them using scripts in package.json "scripts": { "server-start": "gulp", "client-start": "ng serve --verbose --proxy-config server.conf.json", "start": "npm-run-all -p client-start server-start" } so, when run npm start starts 2 parallel processes - node js using gulp , angular using ng serve. angular front end, urls start /api redirected node. here how it's done server.config.js { "/api": { "target": "http://localhost:3000", "secure": false } } node js receives stream angular image , saves in angular assets folder, uploaded image should available in angular, when try open uploaded image in browser returns me 404, not found. in case, part

python 3.x - Flatten a unserialized nested json data having multilevel dictionary nesting at large -

i have data structure 1 mentioned below nested in terms of dictionaries : { 'list':{ '5':{ 'set_profile_type':'static', 'status_name_now':'off', 'name':'btテザリング', 'status_code_now':'off', 'status_name_init':'off', 'status_list':{ '0':{}, '1':{} }, 'guide':'some utf text', 'choice_type':'select', 'get_profile':'bttethering_getonoff', 'status_key_name':'onoff' }, '4':{ 'set_profile_type':'static', 'status_name_now':'off', 'name':'wifiテザリング', 'status_code_now':'off', 'status_name_init':'off', 'status_list':{ '0':{}, '1':{} }, 'guide':'utf text', 'choice_type':'select', 'get_profile':'portablehotspot_getonoff', 'status_key_name':'onoff

jquery - JavaScript function syntax error in Internet Explorer 10 + 11 -

i'm using script display/hide divs. works in browsers except internet explorer 10+11. syntax error in line: const show = () => ". the code this: function cycle(info) { let = 0, blocks = object.keys(info); const show = () => $("#" + blocks[i % blocks.length]) .fadein(300) .delay(info[blocks[i++ % blocks.length]]) .fadeout(300, show); show(); } //run cycle({ block2: 7000, block3: 3000 }); jsfiddle here . can fixed works in ie10+11 too? here working example (tested on ie 11) function cycle(info) { let = 0, blocks = object.keys(info); const show = function() { $("#" + blocks[i % blocks.length]) .fadein(300) .delay(info[blocks[i++ % blocks.length]]) .fadeout(300, show); } show(); } cycle({ block2: 7000, block3: 3000 }); #block2, #block3 { display: none; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.

database - converting mssql stored procedure to mysql -

i wanted convert mssql stored procedure mysql stored procedure tried online nothing seems works. begin --declare @fromdatetime varchar(20), @todatetime varchar(20); select @fromdatetime = '2016-05-18 00:00:00', @todatetime = '2017-05-07 18:00:00'; hourstable (name) ( select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9 union select 10 union select 11 union select 12 union select 13 union select 14 union select 15 union select 16 union select 17 union select 18 union select 19 union select 20 union select 21 union select 22 union select 23 union select 24 ), datatable(hh,sessiones) ( select datepart(hour,convert(datetime2,acctstarttime)),count(*) dbo.radac_1_purpleit acctstarttime >=@fromdatetime , acctstarttime<=@todatetime group datepart(hour,convert(datetime2,acctstarttime)) ) select convert(varchar(20),hourstable.name) name,isnull(dat

python - Put a list to 0 each 30 seconds -

i created list filled zeros, writting ones in cases of list goal put list 0 every 30 seconds , don't know how (i newbie in python). i found parts of code on internet , assembled them. reading sip prints, when received "sip/2.0 200 ok", means terminal active , put 'one' in case 25 if it's ip adress 192.168.1.25. mobile can not registered after being registered few times ago, put list 0 every 30 seconds. to @ given interval of time, can use timing functions. import time time.sleep(30) will pause execution of code 30 seconds. note blocking, cannot during time (at least not in same thread, , multithreading/multiprocessing things ge lot more difficult). put 0 list (in case is, want do) 30 seconds do: import time list_of_values = [] while true: time.sleep(30) list_of_values.append(0) wiki

VBA ServerXMLHTTP code works in Windows 7 but fails in Windows 10 -

using vba in microsoft access, sending xml server response string. works fine in windows 7. recently, users have upgraded windows 10, , no longers works (all users on office 16). specific error is: -2147012867 - connection server not established. the error occurs on xsite.send line here code: dim xsite serverxmlhttp60 set xsite = new serverxmlhttp60 on error resume next xsite.settimeouts 0, 60000, 30000, 600000 xsite.open "post", pserverurl & func, false aerr = array(err.number, err.description) on error goto 0 if 0 = aerr(0) 'no error creating link xsite.setrequestheader "content-type", "application/x-www-form-urlencoded" 'set request header base64-encoded username/password xsite.setrequestheader "authorization", "basic " & encodebase64(username & ":" & password) on error resume next xsite.send "xmldata=" & urlencode(xmldata) aerr = array(err.number

html - Dropdown Menu Smooth Transition & Sizing Issue -

so have 3 issues dropdown menu have in navbar site working on. i dropdown appear in more smooth fashion, when add webkit-transitions classes in css, effect not take place. my other issue dropdown items smaller parent; want dropdown items match width of .dropdown class item. finally, when adjust menu mobile devices, dropdown class still displays blank space. surely there way make blank space disappear well. .navbar { border-radius: 25px; list-style-type: none; margin: 0; padding: 0; overflow: hidden; background-color: #66cc66; text-align: center; } .navbar li { display: inline-block; } .navbar li { display: block; color: white; text-align: center; padding: 14px 16px; text-decoration: none; transition: 0.2s; z-index: 1; } .navbar li a:hover { -webkit-transition-duration: 0.4s; transition-duration: 0.4s; background-color: #339966; } .dropdown { position: relative; text-align: center; } .dr

php - Joomla Virtuemart search -

i trying edit joomla search. public_html/templates/template/html/com_search/ when search founds product, want set same view in category view. and trying understand this->tutorial: https://docs.virtuemart.net/tutorials/templating-layouts/199-sublayouts.html code exaple turorial: echo shopfunctionsf::rendervmsublayout('prices',array('product'=>$this->product,'currency'=>$this->currency)); if want same layout price have pass 2 variables function rendervmsublayout in class shopfunctionsf: $this->product $this->currency all variables product/currency/title/addtocart on /components/com_virtuemart/sublayouts/products.php set $viewdata. i trying find how vm constructs variable $viewdata without luck. maybe virtuemart expert can guide how can construct same var $viewdata if got array of products ids. wiki

memory management - what are the good ways to deploy and manage python script on production server? -

i've written lot of python scripts. want run on computer running non-stop crawling, analyzing data , update sql database. open command prompt , run scripts: python [script directory] but many scripts have open many cmd , every script call python interpreter, end huge mess using lot of memory. should manage these scripts. you haven't specified os server is, assuming it's linux server should research process management tool such supervisord or systemd . these tools designed run , monitor program automatically, , restart if crashes. if you're using ubuntu 16.04 comes systemd out of box, find supervisord easier configure , use simple tasks. these programs won't memory consumption issues however. sure can place caps on memory use process, that's not going if stops program working. you're best re-evaluate code , ways reduce memory footprint or use server more ram. edit: you've added os windows 10, makes above irrelevant. can use windo

excel - How can I find minimum and maximum value of date for ID 1 and 5 using python pandas? -

here, shown in image want find minimum , maximum value of date id 1 , 5. id 1 minimum date 2016-01-27 17:13:19 , maximum 2016-03-28 00:56:43. same id 5. please click see image you can use aggregate, consider df date id 0 2016-3-28 00:56:43 1 1 2017-3-28 00:56:43 1 2 2005-3-28 00:56:43 1 3 2010-3-28 00:56:43 1 4 2002-3-28 00:56:43 1 5 2017-3-29 00:56:43 1 6 2004-3-28 00:56:43 5 7 2002-3-21 00:56:43 5 8 2015-3-28 00:56:43 5 9 2017-4-28 00:56:43 5 10 2009-3-28 00:56:43 5 11 2007-3-28 00:56:43 5 you can min , max date each id using df.groupby('id').date.agg(['min', 'max']).reset_index() you get id min max 0 1 2002-3-28 00:56:43 2017-3-29 00:56:43 1 5 2002-3-21 00:56:43 2017-4-28 00:56:43 wiki

java - TLS with self-signed cert with tomcat server - could not load PEM client certificate -

i want use tls rest api i'm planning create self-signed cert , provide public key clients of restapi. my restapi deployed on tomcat catalina container ( tomcat version 8.0.42 ). and test steps below, server side 1) created self signed cert using openssl openssl genrsa -out restapi.key 2048 openssl req -new -key restapi.key -out restapi.csr openssl x509 -req -days 24855 -in restapi.csr -signkey restapi.key -out restapi.cert 2) created pkcs#12 bundle openssl pkcs12 -export -in restapi.cert -inkey restapi.key -out restapi.p12 -name restapi 3) configured tomcat have tls enabled (with keystoretype "pkcs12" ), , started tomcat <connector port="8443" protocol="org.apache.coyote.http11.http11nioprotocol" maxthreads="150" sslenabled="true" sche

cordova - Log file path errror in webpack -

i on development on application desktop , mobile, 1 hand have webpack poject, other electron project, , projects integrated other cordova. so begin development each day had init electron , webpack project individually , manually self avoiding write file inits me both projects , reload project if not errors present in last compilation of webpack. but have problem when webpack see errors in file, didn't filepath logged, me in plugin write how access error filepath. someone can me? thanks, on resolving error 1 day. wiki

java - How to check if images in an android app are current? -

i in middle of writing android app while teaching myself java @ same time , project bit cumbersome first time app. note: not newbie programming, know several languages exception of java , writing code mobile devices. said , done, don't want have force users have update app every time there new image. is there way, assuming there is, check on startup if images date , if not download new ones drawable resource folder use in app? i have searched , found ways remotely fetch items nothing updating app images. example: splash screen image, or background image etc. thanks time , apologize if not conform stackoverflow form of asking question. shawn mulligan based on knowledges, there no way why you're asking for. resources static contents , there no way modify or update them programatically. to achieve kind of feature describe, should through distant server, local cache of images on disc, associate download date. won't able use them in exact same way can

c - Multiple sockets or larger packets for high frequency data streams? -

im working on application uses nodejs communicate (as client) socket exposed server (written in c ). server sends data sensors , client plots it. suppose have 100 plots , 100 sensors. should open 100 sockets 100 different ports or should create sort of virtual channel inside socket sending larger packets? as stands send 100 bytes @ 50hz each byte dummy sensor data ( uint8 ). further down road move uint32 accommodate sensor data output, still transmitting @ 50hz. mean each packet 400 bytes @ 50hz. in short: multiple sockets or virtual data channels inside packet? wiki

javascript - set position of text labels on a Sunburst chart with d3.js -

i facing problem trying position text inside wedges of sunburst chart based on d3.js. text elements seem not positioned desired on zooming.. some cases working cases looks image1 & image2 function click(d) { var total = d.dx; // fade out text elements text.transition().attr("opacity", 0); path.transition() .duration(duration) .attrtween("d", arctween(d)) .each("end", function(e, i) { // check if animated element's data e lies within visible angle span given in d if (e.x >= d.x && e.x < (d.x + d.dx)) { // selection of associated text element var arctext = d3.select(this.parentnode).select("text") // fade in text element , recalculate positions

c - Why is the use of "declared data types" encouraged and "processor-dependent data types" discouraged? -

i found note in software development plan: use of declared types encouraged. use of processor dependent types such char , int , , long discouraged. what point of statement? why use of declared types encouraged? example of declared type in context bool instead of bool . data types int , long , etc. have size platform dependent. result 1 can discourage usage of types, platform independence... read more in: integer size in c depends on what? "c variable type sizes machine dependent." true? signed & unsigned numbers ; wiki

apache spark - How to handle multiple bindings of log4j in a Scala project? -

i working on spark project. want import library elastic4s . in sbt config file, use: val elastic4sversion = "5.4.5" librarydependencies ++= seq( "com.sksamuel.elastic4s" %% "elastic4s-core" % elastic4sversion, // tcp client "com.sksamuel.elastic4s" %% "elastic4s-tcp" % elastic4sversion, // http client "com.sksamuel.elastic4s" %% "elastic4s-http" % elastic4sversion).map(_.force()) //exclusion librarydependencies ~= { _.map(_.exclude("org.slf4j", "slf4j-log4j12")) } when without exclusion of log4j , when excute: val client = httpclient(elasticsearchclienturi("localhost", 9200)) error occurs: slf4j: class path contains multiple slf4j bindings. slf4j: found binding in [jar:file:/home/junlang/spark-2.2.0/myspark/assembly/target/scala-2.11/jars/slf4j-

java - Android : Rectangle Progress Bar with Curved Edges -

i developing android app in have implement sos button, square shaped button rounded corners. want implement progress bar in it's boundary when press button 4 seconds, sos can activated. unable create square progress bar round edges . here implementation till now, using path. if have better implementation please help. mainactiivty.java button = (button) findviewbyid(r.id.activity_main_button1); relativelayout = (relativelayout) findviewbyid(r.id.main_container); final v v = new v(this); relativelayout.addview(v); button.setonlongclicklistener(new view.onlongclicklistener() { @override public boolean onlongclick(view view) { new countdowntimer(6000, 58) { @override public void ontick(long millisuntilfinished) { //this done every 1000 milliseconds ( 1 seconds ) int progress = (int)(6000 - millisuntilfinished) / 58; v.setprogress(progress);

osx - How can I find private iOS API usage in my app? -

my app rejected app store using private api "lsapplicationworkspace", can't find in source code. how can find library using it? i'm using xamarin.ios on macos. what need search through every library app uses until find offending api string. in case searching lsapplicationworkspace. here terminal command find every dll in folder , execute ' strings ' on it. first option copies results clipboard, second option writes text file. build app. open terminal. cd output directory (i.e. iphone/debug). run command below search results offending call. command find . -type f -iname '*.dll' -exec strings {} \; | pbcopy or find . -type f -iname '*.dll' -exec strings {} \; > output.txt wiki

c - clrscr() not working, getch() working. Why? -

i'm making small c program asks key , executes code in switch statement. #include <stdio.h> #include <conio.h> int main(int argc, char const *argv[]){ /* code */ printf("hello, press a, b or c continue"); char key = getch(); switch (key){ case 'a': clrscr(); //some code break; case 'b': //many lines of code break; case 'c': clrscr(); //many lines of code break; default: printf("ok saliendo\n"); break; } printf("bye"); } getch() working properly, clrscr() not, if included <conio.h> . why? conio.h dead! some background: conio.h defines api once created control (text!) screen of ibm pc. wrapper around ms-dos functions, didn't have write own assembly creating int 21h call them. exact api of conio.h never standardized , varies implementation implementation. i a

javascript - How to append @if and @foreach inside a class using onclick function in jQuery -

i want add if , foreach statement inside class whenever user select item dropdown box. tags should added inside is: @if($article->tags) @foreach($article->tags $articletag) @if($articletag->tag == $(this).text()) $(this).text() text user clicks on dropdownbox. purpose of these if , foreach filter table based on filtername($this.text()) whenever user choose item dropdownbox. how do it? html content before javascript runs: <div class="content"> @if($articles) @foreach($articles $article) <div class="row article art-content"> <div class="col-xs-12 col-md-6 hidden-xs hidden-sm"> <a href="{{ url('article/'.$article->category->slug.'/'.$article->slug) }}"> <img src="{{ url('image').'/'.$article->featured_image }}?w=460&h=267&fit=crop" alt="" class="img-respo