Posts

Showing posts from August, 2013

What is the difference between OnChanges and DoCheck in Angular 2? -

difference between them seems confusing me. difference between them , when called ngonchanges() ( onchanges ) called when value bound input has changed can run custom code when input has changed. ngdocheck() ( docheck ) called when change detection runs can implement custom change detection action.

how to pull employees of company from a linkedin API using PHP? -

i trying pull employees of company using api php. please suggest approaches. i have tried below search in linkedin https://www.linkedin.com/vsearch/p?f_cc=17599&trk=extra_biz_employees_deg_connected by using linkedin apis can search. developer url https://developer.linkedin.com/ api docs https://developer.linkedin.com/docs

How to remove this line from visual studio? -

Image
how hide ruler in visual studio 2013? i tried disable productivity power tools (column guides option) it's still there. thank you. it visual assist option. so uncheck on : vassistx > visual assist x options > advanced > display indicator after column.

php - Header function not redirecting? -

please have php code(below) creates , inserts user database after validating user inputs. storing users input in array. problem creates user , inserts database not redirect. here's code $validation = new validate(); if($validation->passed()) { //if success, insert(create) user try { $user = new user(); $salt = crypt::salt(32); $user->insert(array( 'username' => accept::get('username'), 'password' => crypt::make(accept::get('password'), $salt), 'salt' => $salt, 'name' => accept::get('name') )); //after creation, redirect user header('location : index.php'); exit(); } catch(exception $e) { //otherwise display errors die("error : can not register user ".$e->getmessage()); } this code creates user in database, not redirect. don't understand why. 1) make sure not echo/output before header() function not blank space 2) write t

regex - How to get youtube video id from URL with java -

i try id of youtube video url. here's example of such url: https://www.youtube.com/watch?v=iz6ar-watyy how can id of video? this video_adapter public class videoadapter extends recyclerview.adapter<videoadapter.myviewholder> { private list<video> videolist; private context context; string videourl; intent intent; public class myviewholder extends recyclerview.viewholder { public textview title; public imageview image, videonextarrowimage; public textview desc; public textview videourl; public myviewholder(view view) { super(view); title = (textview) view.findviewbyid(r.id.video_title); image = (imageview) view.findviewbyid(r.id.video_imageview); desc = (textview) view.findviewbyid(r.id.video_desc); videourl = (textview) view.findviewbyid(r.id.video_url); videonextarrowimage = (imageview) view.findviewbyid(r.id.video_nextarrow); view.setonclicklistener(new view.onclicklistener() {

c - PRINTF in Keil uvision5 -

i working first time stm32 nucleo l476rg board x-nucleo idb05a1 expansion board developing bluetooth low energy applications. develop keil uvision5. in uvision5 succesfully built sensordemo example stm32cubeexpansion package, loaded code flash memory of board , started debug session/run code. in code example lot of printf statements used. can see output of those? i tried things here or here but didn't work. can me out or has easier solution? or there easier or better environment developping stm32 bluetooth low energy boards? thanks in adavance!

asp.net - How to create a global variable in C#? -

i need use global variable in .net project. however, cannot handle between 2 methods.. my code: string str; protected void page_load(object sender, eventargs e) { if (!page.ispostback) { str = "i string"; showstring(); } } void showstring() { asplabel.text = str; //error } question update: i not consider use showstring(str) because variable used many methods.. example, have click event need use it. protected void btn_click(object sender, eventargs e) { exporttoexcel(str); } therefore, need create in global! the answer don't global variables (you can't). closest global having in class static , has static member - think wrong approach of cases. static classes/members make code more coupled , reduces testability pick when decide so. do instead: (pass parameter) protected void page_load(object sender, eventargs e) { if (!page.ispostback) { string str = "i string"; showstring(str

ruby on rails - Unable to get the Item details from Amazon production API -

i using the gem item details. able except, item description, please suggest how can item description.please see screenshot want get. have selected description. find configurations gemfile gem 'amazon_product', '~> 3.0', '>= 3.0.1' services/amazon_service.rb class amazonservice def initialize(params) @itempage = params[:itempage] @keyword = params[:keyword] @book_id = params[:book_id] $req = amazonproduct['us'] $req.configure |c| c.key = env['aws_access_key_id'] c.secret = env['aws_secret_key'] c.tag = env['associate_tag'] end end def itemlookup`enter code here` $req << { :operation => 'itemlookup', :search_index => 'books', :keywords => 'book', :idtype => 'isbn', :itemid => @book_id, :response_group => [

unity3d - Unity2d: return to previous application on button click -

is there way of returning previous game application when close unity/close game application on button press. have scene button in it, if player press button, bring them new level (scene 1). want save scene (scene 2) using playerprefs keep tabs on if close game application, or close unity , re-open , play application (regardless of scene in) game should automatically bring me scene 2. possible return previous application (even if close application or game) on button click? if button clicked on, , exit out of application , or game, re open , play game should automatically bring me scene exited out of (scene 2) when ever application quit event called, save current scene player preference. using unityengine.scenemanagement; void quitgame() { scene currentscene = scenemanager.getactivescene(); playerprefs.setstring("lastscenename",currentscene.name); application.quit(); } above code save name of current scene @ time of application quit. now when

android - Image flickering while scrolling in RecyclerView -

Image
i'm trying display list of songs found on device requesting data directly mediastore. i'm using recyclerview , adapter uses cursoradapter data mediastore. when adapter's onbindviewholder called, request passed bindview function of cursoradapter visual elements set. public class listrecycleradapter3 extends recyclerview.adapter<listrecycleradapter3.songviewholder> { // patch: because recyclerview.adapter in current form doesn't natively support // cursors, "wrap" cursoradapter teh job // public mediastorehelper mediastorehelper; customcursoradapter mcursoradapter; context mcontext; public class songviewholder extends recyclerview.viewholder { public textview textitemtitle; public textview textitemsub; public imageview imgart; public int position; public string album_id; public string path_art; public string path_file; public songviewholder(view v)

r - Strange ggplot colour palette in reference key -

i attempting plot density of new migrant gp registrations onto local authority area map; plot has worked reasonable extent except have no idea has happened colour palette. suspect has become confused presence of decimals in fill value. if click on picture note colour key circular beginning end. does know might have happened here, how avoid in future , resolve on occasion better key? result of current ggplot install.packages("rgdal") library(rgdal) install.packages("maptools") library(maptools) install.packages("rgeos") library(rgeos) myshape2 <- readshapespatial("infuse_dist_lyr_2011.shp") plot(myshape) plot(myshape2) install.packages("ggplot2") library(ggplot2) str(myshape2) myshape2frame <- fortify(myshape2, region="name") install.packages("gpclib", type = "source") pathrtools <- paste(c("c:\\rtools\\bin", "c:\\rtools\\mingw_64\\bin",

Wirecloud FIWARE Lab NGSI HTTP proxy is alive -

i'm creating wirecloud mashup using ngsi-source operator. until days ago worked yesterday ngsi proxy http://ngsiproxy.lab.fiware.org seems not alive. there issues service. thanks answers. update ngsiproxy.lab.fiware.org , running again :). no, ngsi proxy not working. have reported technical team have not received yet answer don't have estimation when fixed. we have deployed temporal instance of ngsi proxy @ following url: https://mashup.lab.fiware.org:8443 this instance removed once restored service @ https://ngsiproxy.lab.fiware.org sorry inconvenience.

swift - How can I add a little white tick to SSRadioButton -

Image
the following code. want add little white tick middle when clicked button. how can programming not using image... import foundation import uikit @ibdesignable class ssradiobutton: uibutton { private var circlelayer = cashapelayer() private var fillcirclelayer = cashapelayer() override var selected: bool { didset { togglebuton() } } /** color of radio button circle. default value uicolor red. */ @ibinspectable var circlecolor: uicolor = uicolor.redcolor() { didset { circlelayer.strokecolor = circlecolor.cgcolor self.togglebuton() } } /** radius of radiobutton circle. */ @ibinspectable var circleradius: cgfloat = 5.0 @ibinspectable var cornerradius: cgfloat { { return layer.cornerradius } set { layer.cornerradius = newvalue layer.maskstobounds = newvalue > 0 } } private func circleframe() -> cgrect { var circleframe = cgrect(x: 0, y: 0, width: 2*circleradius, height: 2*circleradius)

Maven execute a goal on build fail / FindBugs -

i have integrated findbugs plugin fail build in case of bugs. using brilliant answer configured findbugs generate html reports (xml version barely readable). problem have failonerror property set true , means build fail in case of bug. ..... <configuration> ..... <failonerror>true</failonerror> </configuration> and no html report generated. i read maven build lifecycle , there no such thing "execute on fail" (like finally block in java). so, there possible workarounds? , shouldn't out-of box maven feature? special @spacetrucker workaround suggestion . here configuration ended with: <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>findbugs-maven-plugin</artifactid> <version>3.0.4</version> <configuration> <effort>max</effort> <threshold>low</threshold> <findbugsxmloutputdirectory>${pro

java - How can create HQL Query like Laravel? -

my laravel eloquent following: module::select(['a', 'b']) ->whereraw("or ='one' or = 'five' or ='ten'") ->distinct() ->orderby('a', 'asc') ->get(); how can convert hibernate? you can use tosql() method sql query. for example db::table('users')->tosql(); returns query select * users then have translate sql hql, using manual .

android - Is it possible to force GLSurfaceView portrait while other view change orientation with the device orientation? -

we development video related android app. , need support both portrait , landscape mode. because ui veriy complex, want ui element rotate. , because draw local preview on surface view using opengl , , become complex if glsurfaceview rotate. so want lock glsurfaceview orientation while keep overall ui change change orientation when rotate device. have used similar solution on ios. we find solution force activity portrait instead of view in activity. possible that? , how can that?

java - How to retrieve TBs of data from HDFS using Rhdfs package? -

how retrieve tbs of data hdfs using rhdfs package because data stored on multiple machines , r runs on single machine. how much amount of data stored in r dataframe on single system. if so, how can huge data stored in single hardware, conflicts big data storage concept.

Scala and Spark UDF function -

i made simple udf convert or extract values time field in temptabl in spark. register function when call function using sql throws nullpointerexception. below function , process of executing it. using zeppelin. strangly working yesterday stopped working morning. function def convert( time:string ) : string = { val sdf = new java.text.simpledateformat("hh:mm") val time1 = sdf.parse(time) return sdf.format(time1) } register function sqlcontext.udf.register("convert",convert _) test function without sql -- works convert(12:12:12) -> returns 12:12 test function sql in zeppelin fails. %sql select convert(time) temptable limit 10 structure of temptable root |-- date: string (nullable = true) |-- time: string (nullable = true) |-- serverip: string (nullable = true) |-- request: string (nullable = true) |-- resource: string (nullable = true) |-- protocol: integer (nullable = true) |-- sourceip: string (nullable = true) part of stack

html - Easily merge multiple CSS classes to a single CSS file -

i using bootstrap html/css template more 40+ different css files. use 1 class css file , therefore there lot of excess css. there program or solutions allows me gather active classes 40+ css files , merge them in 1 single css file? try sass imports. http://thesassway.com/beginner/how-to-structure-a-sass-project you can use normal css in scss files, wouldn't need change anything. and if using bootstrap, there bootstrap version based on sass can modify without css: http://getbootstrap.com/getting-started/#download

c# - Move window of other process to another virtual desktop -

so implementing win-tab-like interface under windows 10. trying move window of other process virtual desktop. using api this question can move own application desktop. when moving other windows when calling movewindowtodesktop(intptr toplevelwindow, guid currentdesktop), got e_accessdenied return code. in this github project managed hook dll other process user can trigger function successfully. how can achieve this?

javascript - JS print - CSS text color not showing -

Image
i'm making invoice in html & css. goal after filling in, invoice gets printed. reason doesn't print css color of text. text black. other css styling works, font-family , font-size , font-weight ... this original in html & css : and printed : the printing done js: window.print(); does know why css color isn't working? edit: title placed in table id 'factuur' : <td id="factuurtitel">stukadoorwerken vanhees frank</td> the title has css: #factuurtitel { font-weight: bold; font-size: 30px; color: #194197; text-align: center; vertical-align: middle; font-family: 'carrois gothic sc', calibri, sans-serif; } i have @media print : @media print { body * { visibility: hidden; } #factuur, #factuur * { visibility: visible; } @page { margin: 0; } } i've tried adding #factuurtitel { color: #194197; } @media print . usually js

There is a sentence about "statement" that I can't understand in C Primer Plus by Stephen Prata -

this question has answer here: expression versus statement 18 answers there sentence "statement" can't understand in c primer plus stephen prata. in chapter 5, there section explains difference between statement , expression. author explains statement follows: statements statements primary building blocks of program. program series of statements necessary punctuation. statement complete instruction computer. in c, statements indicated semicolon @ end. therefore, legs = 4 is expression (which part of larger expression), but legs = 4; is statement. and author gives example: although statement (or, @ least, sensible statement) complete instruction, not complete instructions statements. consider following statement: x = 6 + (y = 5); in it, subexpression y = 5 complete instruction, part of state

How to assign initial value to a String in Android -

i don´t know have setup initial value of variable: mysharedpreferences.putstringvalue("hello", "400"); and don´t reset if changed every time open app. thank you!! the best way "set" default value on method instead of set on first start of app. mysharedpreferences.getstring("hello", "400"); on way android checks if there value set. if not, fallback default "400". take @ documentation: https://developer.android.com/reference/android/content/sharedpreferences.html#getstring(java.lang.string, java.lang.string)

angular - Is there any difference in overhead when using Observables as opposed to promises? -

i considering whether use observables or promises in new angular 2 app. told observables can promises can , more, curious how overhead observables require compared promises. has run benchmark tests? there reasons left use promises? whereas both observables , promises deal asynchronous processing, there differences: observables can canceled. promises can't. observables lazy , executed when callbacks subscribed them. promises executed when created. observables can handle several events whereas promises can resolved once. observables provide set of operators create asynchronous data flow (like map , flatmap , filter , ...)

Get ansible to read value from mysql and/or perl script -

there may better way need altogether. i'll give background first current (non-working) approach. the goal migrate bunch of servers 1 sles 11 sles 12 making use of ansible playbooks. problem newserver , oldserver supposed have same nfs mounted dir. has done @ beginning of playbook of other tasks can completed. name of dir being created can determined in 2 ways - on oldserver directly or mysql db query volume name on oldserver. newservers named migrate-(oldservername). tried prompt volumename in ansible, apply same name every server. goal recap: dir name must determined oldserver, created on new server. approach 1: i've created perl script ansible copy newserver , execute mysql query, , create dir itself. there 2 problems - 1) mysql-client needs installed on each server. unneccesary these servers , have uninstalled after query run. 2) copying files , remotely executing them seems bad approach in general. approach 2: create version of above except run on ansible control

javascript - Execution order bahaviour -

i'm writing function upon call should populate page tiles. data on tiles acquired remote db (hence ajax request). i'm using jquery 3.0 in code. here function: function populatedashboard() { var tileblueprint = '<div class="dashboard_tile">\ <div class="dashboard_tile_content">\ <table class="tile_table">\ <tr class="tile_title">\ <td>$title</td>\ </tr>\ <tr class="tile_data">\ <td>$value</td>\ </tr>\ </table>\ </div>\ </div>'; $.ajax({ url: 'http://' + appvar.serverurl + '/restapi/dashboard_getdata', type: 'post'

android - React-Native RTC view overlap -

i using video in rtcview , want show 1 small video on video. rtcview not overlapping each other. below code <rtcview streamurl={this.state.selfviewsrc} style={styles.selfview}/> { maphash(this.state.remotelist, function(remote, index) { return <rtcview key={index} streamurl={remote} style= {styles.remoteview}/> }) } css are- const styles = stylesheet.create({ selfview: { width: width, height: (platform.os === 'ios') ? height-80 : height/2+100, alignself: 'center', zindex: 0, }, remoteview: { position: 'absolute', zindex: 2, margintop: (platform.os === 'ios') ? -120 : 0, width: 120, height: 120, left: 0, borderwidth: .5, alignself: 'flex-start' }, i have solved problem issue order in selfview , remoteview creating, have created remote view first put them on self view. thanks everyone!

java - Spark-Submit through command line does not enforce UTF-8 encoding -

when run spark job ide using spark's java apis, output in desired encoding format (utf-8). if start 'spark-submit' method command line, output misses out on encoding. is there way can enforce encoding 'spark-submit' when used through command line interface. i using windows 10 os , eclipse ide. your appreciated. thank you. run spark job : spark-submit --class com.something.class --name "somename" --conf "spark.driver.extrajavaoptions=-dfile.encoding=utf-8"

javascript - How to convert Dec 2 1991 12:00AM to 12/02/1991 -

var str = "dec 02 1991 12:00"; var new_date = str.substring(0,str.length - 6); var dateofbirth = $filter('date')(new date(new_date), 'mm/dd/yyyy'); you don't need jquery this. you can parse date using 'date' constructor: new date("dec 02 1991 12:00") . then have date object in have methods month, day , year (see documentation ). here example trying achieve: var str = "dec 02 1991 12:00"; var date = new date(str); var month = date.getutcmonth(); var day = date.getutcday(); var year = date.getutcfullyear(); var dateofbirth = ((month < 10 ? "0" : "") + month) + "/" + ((day < 10 ? "0" : "") + day) + "/" + year;

ios - Laggy UITableViewController -

i have uitableviewcontroller 1000 row. each cell contains label fill attributed string. cell self sizing cell , estimation not correct in estimatedheightforrowatindexpath did not use (i don't no why estimation cause lag, use nssting.boundingrectwithsize estimation). have uislider seekbar in bottom of view, when seek middle of page main thread become busy cellforrowatindexpath , not show waiting progress bar hud progress. here cellforrowatindexpath : func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidentifier("aya cell") as! ayacell let detail = api.readingdetail[indexpath.row % api.readingdetail.count] cell.backgroundcolor = backgroundcolor switch detail { case .persian: let text = translations.suras[self.sura.index-1].ayas[indexpath.row / api.readingdetail.count].text var textbackground = uicolor.clearcolor()

javascript - SAPUI5: function hook when something is destroyed -

i have sapui5 panel can destroyed indirectly in various circumstances various reasons (e.g. in example, parent of parent destroyed). therefore, must use function hook coming control itself. i tried call exit function (base on this stack overflow question , this sapui5 documentation) var ograndparentpanel = new sap.m.panel(); var oparentpanel = new sap.m.panel(); var opanel = new sap.m.panel({ exit: function(){ alert("foobar!"); }}); oparentpanel.addcontent(opanel); ograndparentpanel.addcontent(oparentpanel); ograndparentpanel.destroy(); i want "foobar!" alert, not getting it. i think confusing lifecycle methods events. lifecycle methods defined within control , control can either implement them or not. events hooks bind own functionality to. if have panel calls event (that attach own logic to), subclass panel control. define new event in metadata , in onexit method, fire event. if interesting in doing when user closes brow

ruby - Nokogiri XML Parser with Bad Attribute Values -

i can't find documentation on difference between how nokogiri (or implication libxml) handles attribute values in xml vs. html. 1 of our projects still using defunct hpricot gem, because of it's lax acceptance of attributes. the crux of problem seems our xml input has both unquoted , missing attribute values. i'm not spec lawyer, gather of html variants allow these attribute patterns , xml not. if nokogiri (or libxml) going strict, shouldn't there option make less strict on attributes? if html parser not strip namespaces, maybe use that. we can't team has xmlish formats aren't fish or fowl in between. if fix @ source might that, in meantime have handle format is. this hack fix attributes before sending nokogiri: attr_re = /[^\s=>]+\s*(?:=(?:[^\s'">]+|\s*"[^"]*"|\s*'[^']*'))?/mo element_re = /(<\s*[:\w]+)((?:\s+#{attr_re})*)(\s*>)/mo nokogiri::xml( data.gsub(element_re) |m| open, close

java - Unable to load up Swagger-UI page for the RESTEasy Swagger Codegen example -

i followed small tutorial (if can called that) here generate server stubs petstore example api. followed readme instructions in generated files, says: to run server, please execute following: ``` mvn clean package jetty:run ``` can view swagger listing here: ``` http://localhost:8080/v2/swagger.json the first time did that, got build , compilation error. apparently pom.xml file missing both jetty plugin: <plugin> <groupid>org.eclipse.jetty</groupid> <artifactid>jetty-maven-plugin</artifactid> <version>9.2.9.v20150224</version> </plugin> as swagger-core dependency: <dependency> <groupid>io.swagger</groupid> <artifactid>swagger-core</artifactid> <version>1.5.9</version> </dependency> although mentioned under properties property follows: <properties> <swagger-core-version>1.5

Perl one liner is not working inside perl script -

i'm trying remove string @my.mail.com file - list.txt, using 1 liner perl script. (perl script kicked off windows server) r12355 test@my.mail.com r29555 test@my.mail.com r29555 trial@my.mail.com @my.mail.com r295721 xxx@my.mail.com r295722 yyyy@my.mail.com @my.mail.com r295140 test@my.mail.com r295145 test@my.mail.com @my.mail.com below options have tried while calling inside perl script: `perl -pi.bak -e 's/\s+\@my\.mail\.com\s+//g;' d:\\myfolder\\list.txt`; system("perl -pi.bak -e 's/\s+\@my\.mail\.com\s+//g;' d:\\myfolder\\list.txt"); system( q( perl -l -pi.bak -e 's/\s+\@my\.mail\.com\s+//g;' d:\\myfolder\\list.txt ) ); i'm expecting result r12355 test@my.mail.com r29555 test@my.mail.com r29555 trial@my.mail.com r295721 xxx@my.mail.com r295722 yyyy@my.mail.com r295140 test@my.mail.com r295145 test@my.mail.com not sure if i'm missing silly , inputs appreciated. in advance! there 2 problems

Threaded Comments, php, laravel -

this table newtheme_comment: id parent_id id_theme user text upvotes downvotes and controller: class comments extends controller { public function generatecomments($id){ $comments = newtheme_comment::where('id_theme', $id)->paginate(5); return view('comments', ['comments'=>$comments]); } id link general post(each posts have different section of comments), dynamically @ click of user, user redirected ('comments view') section of comments accordingly. so have array comments populated values table newtheme_comment, problem me consists of how can use values create threaded comments section. like in view(the problem makes comment section every parent_id equal 0 not looking for: @foreach ($comments $comment) {{-- comments threads --}} <div class="media"> <div class="media-left"> </div> <div class="media-body"> <p class="med

ssas - MDX: Query Data analysed -

in query used clause in year 2015 , quarter-[2013]&[quarter1], how possible, , getting result set 10 records. result set not displaying. with member [measures].[test] ( [measures].[programassessmentpatientcnt] + [measures].[assessmentpatientcnt] ) member [measures].[test1] ( [measures].[ccmpatientcnt] + [measures].[careteamcnt] + [measures].[ccmpatientcnt] ) select ( ( { [dimenrollstatus].[enrollmentstatus].[enrollmentstatus] } ), { [measures].[assessmentpatientcnt], [measures].[test], [measures].[test1] } ) on columns, subset ( nonempty ( { ( { [dimassessment].[assessmenttext].[assessmenttext] }, { [dimassessment].[questiontext].[questiontext] }, { [dimassessment].[answertext].[answertext] } ) }, { [measures].[assessmentpatientcnt], [measures].[test], [measures].[test1] } ), 0, 10 ) on rows [navigatecube] ( { ( { [dimmanagedpopulation].[managedpopulationname].&[1044]&[ltc lincoln centers] }, { [dimanchordate].[calende

amazon web services - How do I call a stored procedure in SQL Server with Data Pipeline in ShellCommandActivity (AWS Data Pipeline) -

i know can call mysql procedure script below, same possible sql server? mysql --host host_url --port port_number --user username --password password --execute="call stored_proc_name; i have sql server express, , need setup procedure run daily. it's on rds, , sql server express doesn't have task scheduler.. the following should work: download sql server jdbc driver . choose download tar.gz file , unzip it. among extracted files should file named sqljdbc.jar. upload s3. licensing reasons, aws not able distribute file. create data pipeline jdbcdatabase object refer sql database. set jdbcdriverjaruri s3 location. set driver class name "com.microsoft.sqlserver.jdbc.sqlserverdriver". invoke exec command data pipeline sqlactivity. sqlactivity refer jdbcdatabase object you've defined.

optimization - Optimizing MySQL query across multiple rows -

my current query looks this. i've been trying optimize got no luck far. goal difference in stat_value between current day , previous day every player , order it. current code works fine, feels unoptimized me. ? values filled in using java. select t1.stat_value - (select stat_value leaderheadsplayersdata_daily t2 t2.player_id = t1.player_id , t2.day = ? , t2.stat_type = ? limit 1 ) sum , (select name leaderheadsplayers leaderheadsplayers.player_id = t1.player_id limit 1 ) leaderheadsplayersdata_daily t1 day = ? , stat_type = ? order sum desc limit 100 table structure: this main table containing player id , username. create table if not exists `leaderheadsplayers` (player_id integer primary key auto_increment ,uuid varchar(36) not null unique ,name varchar(16) not null ,last_join datetime ) engine = innodb this table containing dail

java - XSSFWorkbook stays in memory -

Image
i using apache pio version 3.14 export data excel. problem uses lot of memory. visualvm noticed data in oldgen shoots ~80m ~400m 800k export file , stays there. if repeat operation on , on keeps growing. seems xssfworkbook never garbage collected , holds references cells/sheets excel file. tried using sxssfworkbook memory usage similar. there way reduce memory usage? or how can dispose xssfworkbook. tried closing workbook , making reference null, not help today saw same problem in our application. workbook cells lands in old generation , never deleted. analyze problem created application creates workbook 10 rows each row has 10 cells. then tried move code separate thread. still objects remain in memory workbook, sheet, rows , cells gone. here simplified code sample show how tested it. public static void main(string[] args) { runnable runnable = new runnable() { @override public void run() { workbook workbook = null; fi

Is there a way to manage the column/cell widths when exporting to Excel with django-import-export? -

i don't see in docs django-import-export. know if there way change width of columns in exported excel spreadsheet, column becomes wide enough fit data? (right splitting long piece of data between 2 narrow columns.) perhaps in resource customization?

jquery - Bootstrap prevent nav-dropdown closing on click -

i'm fighting pice of code time , of solutions find has't worked. i want prevent menu closing after clicking on 1 of links. code: <li class="nav-dropdown"> <a href="#" title="menu levels"> <i class="fa fa-fw fa-folder-open"></i> manage devices </a> <ul class="nav-sub"> <li> <a href="@url.action("addwizard", "device")" id="test"> <i class="fa fa-fw icon-plus"></i> add device </a> </li> <li> <a href="@url.action("removedevice", "device")" > <i class="fa fa-fw icon-close"></i> remove devic

java - basic Jersey webservice with maven jetty plugin -

i have been working restfull webservices provide jersey in combination maven jetty plugin @ previous job. personal project starting scratch myself , cant seem basic version going. have tried follow few tutorial either old or off topic. the recent example tried was: jersey 2 + spring 4 + jetty-maven-plugin so below configs make plug in run no matter url try gives me 404's pom: <?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <packaging>war</packaging> <groupid>foo</groupid> <artifactid>bar</artifactid> <version>1.0-snapshot</version> <properties> <jetty.version>9.

sql server - Clearing the cache (recompile) for a database in sqlserver without restarting it sqlserver -

is there way clear of cache specific database equivalent option(recompile) stored proc? i think closest thing is: dbcc dropcleanbuffers more on: msdn look @ remarks section closely: use dbcc dropcleanbuffers test queries cold buffer cache without shutting down , restarting server. drop clean buffers buffer pool, first use checkpoint produce cold buffer cache. forces dirty pages current database written disk , cleans buffers. after this, can issue dbcc dropcleanbuffers command remove buffers buffer pool. you use this: checkpoint; go dbcc dropcleanbuffers; go

ruby - Adding Possibly Nil Values -

i'm attempting write function in ruby sums parameters, however, if of parameters null, skip parameter , continue (unless values nil, in case return nil) def sum(*vals) sum = nil vals.each |val| value = eval(val) unless value.nil? sum.nil? ? sum = value : sum += value end end sum end the issue parameters being sent in such way evaluation might cause nil error (i.e. input '2-nil'). if happens don't want break, continue adding. so in other words, add parameters, , if there nil value or nil error in parameter, skip , continue adding. so i've come 2 possible solutions. delay evaluation of parameters shielding them quotes , eval-ing them within function can catch these errors , continue working through parameters. shielding rather messy , gets particularly messy nested quotes. wondering if there cleaner way delay evaluation of parameters? locally override/create addition, subtraction, etc methods nilclass, such errors in para

sql - Need help to make correct select query in DB2 -

i haven't done yet relevant course @ university can't sure query correct, works looks weird need review , feedback. i've following ip_table table mixed primary key: id + ip ---------------------------------- | id | date | ip | ---------------------------------- | 1 | 2016-10-01| 1.2.3.10 | ---------------------------------- | 2 | 2016-10-20| 1.2.3.20 | ---------------------------------- | 2 | 2016-10-25| 1.2.3.40 | ---------------------------------- | 3 | 2016-10-01| 1.2.3.10 | ---------------------------------- | 3 | 2016-10-25| 1.2.3.25 | ---------------------------------- i want rows data has maximum value among same ids, following: ---------------------------------- | id | date | ip | ---------------------------------- | 1 | 2016-10-01| 1.2.3.10 | ---------------------------------- | 2 | 2016-10-25| 1.2.3.40 | ---------------------------------- | 3 | 2016-10-25| 1.2.3.25 | ----

node.js - What are the possible causes for app deployed on heroku to get crashed? -

i have nodejs app.it builds crashes.the log says- 2016-07-28t11:41:39.150069+00:00 app[web.1]: @ function.module._load (module.js:314:12) 2016-07-28t11:41:39.150070+00:00 app[web.1]: @ startup (node.js:148:18) 2016-07-28t11:41:39.225296+00:00 heroku[web.1]: process exited status 1 2016-07-28t13:24:05.344533+00:00 heroku[router]: at=error code=h10 desc="app crashed" method=get path="/?hub.mode=subscribe&hub.challenge=432092788&hub.verify_token=fb_bot" host=fb-121071064.herokuapp.com request_id=77443caa-168e-4428-9f43-9611d8230b9e fwd="66.220.146.21" dyno= connect= service= status=503 bytes= 2016-07-28t13:36:37.043656+00:00 heroku[router]: at=error code=h10 desc="app crashed" method=get path="/favicon.ico" host=fb-121071064.herokuapp.com request_id=03ed313b-0930-4e12-8303-1af63446a429 fwd="103.204.168.142" dyno= connect= service= status=503 bytes= 2016-07-28t13:36:37.942331+