Posts

Showing posts from June, 2015

cross browser - Safari Won't Show BG on the body without a html background color set -

maybe out there can fill me in on whether i've encountered odd edge case safari bug or there missed in css. basically, landing page of site ( http://www.seanmichael.me/test/kodiak/ ) not showing set background (it's showing white background) in safari (6.0.5). surprised because have used similar full-page background images type of css , never encountered issue. code set on body element seen below: body { background: url("img/landing-bg.jpg") #2c5277 no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } i linted css , had no errors, spent substantial time messing around css in dev tools find solution. oddly enough, edit fixed issue setting background-color property on html element. i'm happy works, still confused why might happen. please let me know if have explanation. thank you, sean after having same issue occur on client site,

ios - How can I turn my UINavigationBar into UINavigationController (for use with this library)? -

i using mrprogress library. takes a uinavigationcontroller argument. however, in viewcontroller (which presented modal), create uinavigationbar myself. // create navigation bar navigationbar = uinavigationbar(frame: cgrectmake(0, 0, self.view.frame.size.width, 44 + statusbarheight())) navigationbar.backgroundcolor = uicolor.whitecolor() navigationbar.delegate = self; // create navigation item title let navigationitem = uinavigationitem() navigationitem.title = "new conversation" navigationbar.titletextattributes = [ nsforegroundcolorattributename: colors.logo0, nsfontattributename: fonts.title ] //back button let backbutton = uibutton(type: .custom) backbutton.addtarget(self, action: #selector(createsessionviewcontroller.backbuttonaction(_:)), forcontrolevents: uicontrolevents.touchupinside) backbutton.frame = cgrectmake(0, 0, 20, 20) let cross = uiimage(named: "cross.png") backb

dictionary - Classic ASP - Website localization -

i need add languages support existing classic asp website the "best" solution found encapsulate every text in function, create database table store, every page, translations , use dictionary object retrieve right value. example: <div>welcome xy website</div> <button class="btn green">login</button> becomes <div><%=tl("welcome xy website")%></div> <button class="btn" ><%=tl("login")%></button> then tl function should this function tl(strinput) dim strtargetlanguage, strpageurl,objdict,strtmp1,strtmp2 if strinput<>"" ' first check if customer has set language.. else uses browser language if request.cookies("culture")="" strtargetlanguage=lcase(left(request.servervariables("http_accept_language"),2)) else strtargetlanguage=lcase(left(request.cookies("cu

c# - ThreadPool.QueueUserWorkItem Vs new Thread -

i have following code: static void main(string[] args) { console.write("press enter start..."); console.readline(); console.writeline("scheduling work..."); (int = 0; < 1000; i++) { //threadpool.queueuserworkitem(_ => new thread(_ => { thread.sleep(1000); }).start(); } console.readline(); } according textbook c# 4.0 unleashed bart de smet (page 1466), using new thread should mean using many more threads if use threadpool.queueuserworkitem commented out in code. i've tried both, , seen in resource monitor "new thread", there 11 threads allocated, when use threadpool.queueuserworkitem, there 50. why getting opposite outcome of mentioned in book? also why if increase sleep time, many more threads allocated when using threadpool.queueuserworkitem? new thread() creates thread object; forgot call start() (which creates actual thread see in reso

Android.view.InflateException: Binary XML file line #1: Error inflating class menu -

i have been following udacity's "developing android apps" course , have stumbled upon problem. in tutorials, asked create xml file called forecastfragment.xml , below: <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context="com.example.android.sunshine.app.mainactivity" android:layout_width="match_parent" android:layout_height="match_parent"> <item android:id="@+id/action_refresh" android:title="@string/action_refresh" app:showasaction="never" /> </menu> and told inflate fragment class called forecastfragment.java , process happens on line: view rootview = inflater.inflate(r.layout.forecastfragment, container, false); my problem that, when try running app, error: 05-24 21:40:02.848 11

php - Laravel 5.2 Multi-Auth with API guard uses wrong table -

i'm trying multi-auth system working users can log in via normal web portal, separate database of entities (named "robots" example) can log in via api guard token driver. no matter do, setup have not directing authentication guard correct robot database , keeps trying authenticate these requests users via tokens (which fails, because users don't have tokens). can me find i've gone wrong? i've started putting middleware group in kernel.php: 'api' => [ 'throttle:60,1', 'auth:api', ], this uses settings in config/auth.php 'guards' => [ 'web' => [ 'driver' => 'session', 'provider' => 'users', ], 'api' => [ 'driver' => 'token', 'provider' => 'robots', ], ], 'providers' => [ 'users' => [ &

java - Do not clear form content upon POST -

Image
i using spring form tabs, each tab again has form. problems 1)after form submission, error messages displayed form content cleared should not happen 2)after form submission control goes default tab first tab in case. want control stay on current tab after transaction , not go default tab. this first time working using spring mvc, jsp, jquery. please let me know if have make changes. administrator.jsp below code manage users tab functionality. jquery: $(document).ready(function() { $('#btnmanage').click(function() { if($.trim($('#userid').val()) == ''){ $('#area5').html("user id required field."); }else if($.trim($('#region').val()) == 'none'){ $('#area5').html("region required field."); }else{ $('#manageuserform').submit(); } }); $('#btncancel5').click(function(e) {

mysql - Character encodings of strings in gradle -

so in gradle build, why java string "foo" acceptable mysql database utf-8 encoding, gstring "${somevalue}" not be? what's happening this: sql.withtransaction { def batchresult = sql.withbatch( 20, 'insert table(job_id, log_name, scenario_name, classification, value) values (?,?,?,?,?)'){ stmt -> rows.each { r -> def jobid = "${system.getenv('job_name')}:${system.getenv('build_number')}" def classifier = "{'observer_id':${r['observer_id']}, 'sensor_name':${r['sensor_name']}}" stmt.addbatch( jobid, "foo", project.scenariofilename, classifier, r['count(1)']) } } this fails because utf-8 encoded database rejects value of jobid (and project.scenariofilename , , classifier ), spewing escaped characters \xac unacceptable. but what's funny

Integrating Docker-Machine with Amazon EC2 -

i reading article shows me how can configure docker vm on top of amazon ec2 https://docs.docker.com/machine/drivers/aws/ i got step docker-machine create --driver amazonec2 aws01 but error error pre-create check: "unable find subnet in zone: us-east-1a" i googled , found thread https://github.com/docker/machine/issues/1771 but did find worked me. has been able create vm on top of aws using docker-machine? i solved myself. putting answer here first do aws configure this ask questions security id , key. should able information aws dashboard. aws ec2 describe-subnets this list bunch of subnet information. @ first 1 , make note of availabilityzone , subnet id docker-machine create --driver amazonec2 --amazonec2-subnet-id=xxxx --amazonec2-zone=c aws01 here enter subnet id noted step 2 , last character of availability zone (so if value us-east-1c enter c) now see running pre-create checks... creating machine... (aws01) launching inst

php - Sort by Today, Yesterday, and All posts before yesterday - Wordpress -

so here's code: <div id="content" role="main"> <?php while (have_posts()) : the_post(); ?> <div <?php post_class() ?> id="post-<?php the_id(); ?>"> <div class="page-content rich-content"> <?php // updated $args = array( 'view' => 'grid-mini', 'title' => __('recently added', 'dp'), 'post_type' => 'post', 'ignore_sticky_posts' => true, 'posts_per_page' => 999, 'orderby' => 'date', ); dp_section_box($args); ?> </div> </div><!--end .hentry--> <?php endwhile; ?> i sort query different sections. each secti

c# - Unity Input Field Lock previously typed characters after a time -

i've been messing around word game in unity c# , have come standstill regarding anti-cheat mechanic want implement. once first letter has been entered input field, start running 2 second timer. after 2 seconds, in player not submit or type letter, input field should lock typed letters in place on input field , letters typed after should typed after it. here's code have far: currtime = 0; hasinput = false; lockedstring = ""; void update(){ if(hasinput){ currtime += time.deltatime * 1; if(currtime >= 2){ //stores current string value of input field lockedstring = inputfield.text; } } } void oninputvaluechange(){ currtime = 0; hasinput = true; if(lockedstring != ""){ inputfield.text = lockedstring + inputfield.text; } } right i'm running oninputvaluechange() whenever input field's value changed. manage store string that's been entered far once timer hits 2

angular - How do you direct an ASP.NET MVC route to a static file? -

i have angular2 app (rc1) bootstrapped index.html. want setup asp.net core (rc2) route sends route requests pattern localhost/fs/* index.html file in wwwroot. thoughts? i know can mvc homecontroller , index view. but, hoping not need view controller. using mvc api controllers. best solution serve static file - use usestaticfiles in startup.cs . as need "redirect" several incoming urls 1 static file - think best decision write custom middleware check incoming requests , rewrite path when required. place middleware before usestaticfiles in startup.configure . work without mvc. of course custom middleware may redirect user /index.html file (send 301 / 302 http status code location http-header), , user make request index file, don't think need behavior.

batch file - close a windows bat and do some actions -

here question want close windows bat dos window directly, , when close action invoked, actions or bat should invoked, how can implement this? what doing : start bat, , bat start 2 processes, when dos bat closed,the 2 process should closed. users close dos window directly,don't use stop.bat provided, thinking possible catch user's close action , something!! thank !!!! well, have solved problem. main idea [ windows shutdown hook on java application run bat script ], answer has bug, if close bat or cmd forcibly,the action may not invoked, reason here jvm shutdown before java code action invoked. put action in native method.

reactjs - {this.props.children} and route params of Parent? -

let's routes this <router history={browserhistory> <route path="/" component={app}> <route path="project/:id" component={project}> <route path="info" component={projectinfo} /> <route path="details" component={projectdetails /> </route> </route> </router> i want fetch database project id, that's obvious. if in project component write {this.props.children} how pass on id projectinfo component can have information there. or not this? i use in project navigate child components how id them!!!!! you access id this.props.params.id. the route /project/1 return id of 1.

java - Get user object in the selected row when TableRowSorter is clicked -

i using table model handle data in table. in that, i use arraylist<myuserobject>datalist hold data of model. i'm retriving user object using following method in model: public myuserobject getmyuserobject(int rowindex) { return datalist.get(rowindex); } so when row of table got selected i'm able index of selected row listselectionlistener using datatable.getselectedrow() , using value i'm able retrieve user object model using above method. but when tablerowsorter used i'm unable actual value of user object in selected row. because when tablesorter clicked row index of data changed. in model remains unchanged. i'm unable correct user object regarding selected row. in other words, row order changes in table should reflected in model. should rearrange arraylist in model? or there other easy ways that? how can resolve problem? i'm able index of selected row then need convert index model row: int modelrow = table.convert

html - (mobile web development) how to make a circle with "border-radius:50%" when its width is percent 80% -

i used make circle "width:100px;height:100px;border-radius:50%" in pc; there wrong when same thing in mobile, because width in pc "px", width in mobile "percent", can't ensure width , mobile in mobile same; div{border:1px solid #ddd;border-radius:50%;width:80%;height:???} <div></div> just add padding-top same value width. div { border:1px solid #ddd; border-radius:50%; width:80%; height:auto; padding-top: 80%; /* value same width */ }

functional programming - Further optimizing Number to Roman Numeral function in F# -

i'm new f# , i'm curious if can still optimized further. not particularly sure if i've done correctly well. i'm curious particularly on last line looks long , hideous. i've searched on google, roman numeral number solutions show up, i'm having hard time comparing. type romandigit = | iv | v | ix let rec romannumeral number = let values = [ 9; 5; 4; 1 ] let capture number values = values |> seq.find ( fun x -> number >= x ) let toromandigit x = match x | 9 -> ix | 5 -> v | 4 -> iv | 1 -> match number | 0 -> [] | int -> seq.tolist ( seq.concat [ [ toromandigit ( capture number values ) ]; romannumeral ( number - ( capture number values ) ) ] ) thanks can problem. a shorter way of recursively finding largest digit representation can subtracted value (using list.find): let units = [1000, "m" 900, "cm"

javascript - Delay on Form setvalidity in AngularJS -

i using directive on setting form validity. works accordingly boolean value of custom validity not return right away , exact needs keypress. way i'm using 'element.blur' setting custom validity. here html code: <!doctype html> <html ng-app="myapp"> <head> <link rel="stylesheet" type="text/css" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/flick/jquery-ui.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script> <script type="text/javascript" src="https://code.jquery.com/ui/1.11.2/jquery-ui.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js"></script>

php - Mysql query - couldn't add single quotes within the another single quotes -

set @pid = "$memberid = getloggedid(); $ipid = $globals['mysql']->getone('select `pid` `profiles` `id` = '.$memberid.' limit 1'); if($ipid==1){ echo '<div id=# style=margin:10px 10px 0; overflow: hidden;><button class=bx-btn bx-btn-img onclick = window.open(inviteteacher.php,_self) > study private teacher </button></div>'; }"; here button displayed.but doesn't work. set @pid = $memberid = getloggedid(); $ipid = $globals['mysql']->getone("select `pid` `profiles` `id` = '$memberid' limit 1"); if($ipid==1){ echo '<div id="id" style="margin:10px 10px 0;" overflow: "hidden;"> <button class="bx-btn bx-btn-img" onclick = "window.open(inviteteacher.php,_self)"> study private teacher </button> </div>'; }

database - Passing variables through events c# -

sorry if looks kind of rookie :3 ... don't have experience on c#, code on c#, think it's flexible , friendly object-oriented language. so well. i'm trying pass variables through button clicks, in order able make insert database values obtained of button clicks. have several buttons recycle "product" value different string, in natural language approach that: if click "product" variable product gain name of button, following of click "quantity" button , give me quantity number, following program make insert db values. i'm doubtful of how recycle values depending on buttons clicked. in brief, code have following: private string product; private int quantity; private char prodchosen; private char quantitychosen; private void product_click(object sender, eventargs e) { prodchosen = 'y'; product = "beer"; } private void product2_click(object sender, eventargs e) {

sql - Create index to speedup join on (1) ids match and (2) dates within a range -

what index should create table b optimize join on (1) ids matching , (2) date falls within range. update: issue have hundreds of thousands of dates 25 portfolios... condition (2) work in cutting down size of resulting join... more specifically, imagine have table a: portfolio id | begin_date | end_date --------------------------------------------- 1 | 20150101 | 20150130 etc... and table b: portfolio_id | date | daily_ret ----------------------------------------------- 1 20150102 .00001 1 20150103 -.01023 etc... the query not totally suck is: select * tablea left join tableb b on (a.portfolio_id = b.portfolio_id) , (a.begin_date < b.date) , (b.date <= a.end_date) i think want kinda index like: create index tableb_idx on tableb (portfolio_id, date) but i'm total n00b sql indexes... imagine there's issu

c# - How do I plot the spectrum of a wav file using FFT? -

note: not duplicate, have specific requirements other related questions. to start with, want plot spectrum of audio file (.wav) audacity (similar: how draw frequency spectrum fourier transform ). so far able read , write wav files. problem don't know values need pass fft function. way using exocortex fft in c#. fft function requires me pass array of complex numbers right size (512, 1024, ... presume), optional integer parameter length, , fourier direction (forward/backward). specific questions: the complex (class) exocortex library has 2 values namely real , imaginary. have array of samples, should real , should imaginary? i have wav file, length should assumed variable. how pass fft function? should select size (512/1024/etc), divide the entire samples size, pass of fft? how know frequencies should listed down on x-axis? how plot fft'ed data? (i want x-axis frequency, , y-axis in decibels) if don't mean, try use audacity, import audio file, click analyze

android - How to use different layoutRes with Butterknife for BaseActivityClass and ActivityExtending it? -

i want use butterknife having keep drawer logic being created , maintined in baseactivityclass extended of other activities having different layoutids. tried providing layoutid via abstract method , inflating manually, butterknife failes error: caused by: java.lang.illegalstateexception: required view 'view' id 2131493000 field 'mview' not found. if view optional add '@nullable' annotation. base class @bind(r.id.leftdrawer) protected listview mleftdrawer; @bind(r.id.drawerlayout) protected drawerlayout mdrawerlayout; @bind(r.id.contentframe) protected framelayout mcontentframe; private actionbardrawertoggle drawertoggle; protected abstract @layoutres int getcontentlayout(); private intents mintents; private string[] moptionstitles = new string[]{ "menu item 1", "menu item 2", "menu item 3" }; @override protected void oncreate(@nullable bundle savedinstancestate) { super.oncreate(savedi

c# - UWP get shell icon for a file -

Image
most solutions here use system.drawing not available in uwp afaik. getthumbnailasync() job non-image files. image files scaled preview, regardless of passed arguments. i'd have shell file icon instead of tiny preview left of file name, here: any thoughts? thanks ps : have found hack: create 0 byte temp file same extension , make thumbnail of it. hope though there better solution... well here's helper metod uses dummy file approach (place in static class): public async static task<storageitemthumbnail> getfileicon(this storagefile file, uint size = 32) { storageitemthumbnail icontmb; var imgext = new[] { "bmp", "gif", "jpeg", "jpg", "png" }.firstordefault(ext => file.path.tolower().endswith(ext)); if (imgext != null) { var dummy = await applicationdata.current.temporaryfolder.createfileasync("dummy." + imgext, creationcollisionoption.replaceexisting); //may ove

plot - Matlab element-wise power - can't understand how it works -

Image
i have matched filter, want plot frequency response in matlab. the filter response is: h(f) = i tried to plot with: %freqency_response_of_wiener_filter f = linspace(-1e3,1e3,1e5); h = ((2*pi*f)^2+10^6)/(11*(2*pi*f)^2+10^6+10^4); plot(f,h); xlabel('f') ylabel('h(f)') which not working, giving me error of 'matrix dimensions must agree' kind. read 'element-wise power', seems fit need, , changed h to: h = ((2*pi*f).^2+10^6)/(11*(2*pi*f).^2+10^6+10^4); this indeed plot something, not want :) tried also h = ((2*pi)^2*f.^2+10^6)/(11*(2*pi)^2*f.^2+10^6+10^4); with no luck. way got working is: %freqency_response_of_wiener_filter f = linspace(-1e3,1e3,1e5); i=1:length(f) h(i) = ((2*pi*f(i))^2+10^6)/(11*(2*pi*f(i))^2+10^6+10^4); end plot(f,h); why 'element-wise power' not working me? more - differenece between regular operation 'element-wise operation'? because, example, on here: an introduction matlab , there's plot

javascript - Resize popup Window to min. height and width then dragging to below size should not possible -

i want fix popup windows size minimum height of 400 , width of 650, after dragging below size should not possible, used resizeto() function, still dragging possible, want lock popup window after mini. size, , more height , width , window should resize. 1 have answer using javascript??? here done::>> var newheight = $(window).height(); var newwidth = $(window).width(); /*newwidth < 650 ? window.innerwidth = 650 : $(window).height(); newheight < 400 ? window.innerheight = 400 : $(window).width()*/; if (newwidth < 633) { window.resizeto(650,newheight+72); } else if (newheight < 327) { window.resizeto(newwidth,400); } you need use jquery ui resizeable function. once check easy method task. best

javascript - QuickPay node.js REST api -

has worked on worked on quickpay rest api, went through internet find useful resource not enough. tested on postman , worked var _ = require('underscore'); var quickpay = require('quick-pay'); var version = { "accept-version": "v10", "authorization": "your basic authentication"}; var transaction_id ={}; function processcreatepayment(req, res, next) { var random_order_id = _.random(1000, 99999999999999999999); var parameters = { "currency": "inr", "order_id": random_order_id }; quickpay.post("payments/", version, parameters) .then(function(result) { console.log(result); res.send(result); transaction_id = result.id; console.log(transaction_id); }) .catch(function(err) { console.log(err.response); res.send(err.response); }); } use

javascript - Can i use sketch.js in mobile browser? -

can use sketch.js in mobile browser? developing system using coldfusion , sketch.js. had tested on desktop browser , run smoothly. when tested on mobile browser, last sketch of sketching unable sketch.js. want ask, sketch.js cannot function in mobile browser?tq. from sketch.js web site (at bottom) - http://intridea.github.io/sketch.js/ compatibility sketch.js has been tested on chrome (os x), firefox (os x), safari (os x), android browser (honeycomb 3.1). suffers significant performance degradation on mobile browsers due general html5 canvas performance issues.

How to download, use and keep updated PHP, Apache, MySQL on a machine running on Windows 10 Home operating system? -

i'm php developer profession. till working on ubuntu linux 14.04 lts 64-bit operating system , lamp stack . yesterday bought new lenovo laptop pre-installed windows 10 home single language operating system. then start development using php , mysql installed wampserver (64 bits & php 5.6.15 & php 7) 3 on new machine. after installation i'm facing many problems in running php , phpmyadmin without error. it's showing me php version 5.6.16 installed old one. actually, want install latest stable versions of following softwares before starting php development : php version 7.0.6 apache httpd 2.4.20 mysql version 5.7.12 phpmyadmin version 4.6.1 and whenever new stable version of above softwares become available should able upgrade same software used on ubuntu machine running regular system update. can please suggest me way achieve without hassle , trouble? can concentrate more on web development rather doing configuration settings. thanks.

javascript - Get details of Image selected from <apex:inputFile> Salesforce1 -

Image
i want details of uploaded image. to choose image, using following code in visualforce page: <div class="form-group"> <label class="lbl">image</label> <apex:inputfile value="{!att.body}" filename="{!att.name}" contenttype="{!att.contenttype}"/> </div> i want location info , created date of image. the below kind of exif data:

byte - Character Limit in filepath C# -

i have following piece of code uploads file , checks validity. first issue: if (radupload1.uploadedfiles.count == 0) { session[appconstants.error_message] = errorslist.geterrormessage( errorslist.err_p_date_file_valid); } else { if (radupload1.uploadedfiles.count > 0) { foreach (uploadedfile validfile in radupload1.uploadedfiles) { fileinfo fi = new fileinfo(validfile.filename); stream fs = validfile.inputstream; idbcontextualrecord pfile = statuscontext.createandaddrecordforinsert(partstoredfile.t_name); pfile[partstoredfile.c_partid] = _part[part.c_id]; string targetfolder = appsession.current.configparameters[appconstants.upload_file_path] + "\\partrec\\" + _part[part.c_id] + "\\" + pfile[partstoredfile.c_id]; long bytesonthestream = 0l; try { directoryinfo dir = new direct

In python how can i print only the first matching line from the log output? -

i have input line 1: [debug]... line 2: [debug]... line 2: [debug]... from want print first matching string meaning first matching line 1: [debug] , stop traversing. i have tried code below: for num1,line1 in enumerate(reversed(newline),curline): ustr1="[debug]" if ustr1 in line1: firstnum=num1 can me in this? your question not formatted well, cannot see object looking etc.... i'd assume it's way: input="1: [debug]....\n2: [debug]...\n3:...." # e.g.: print(input.split("\n")[0].strip("\r")) # first line. searching line containing string "ustr1", do: line in input.split("\n"): if ustr1 in line: print(line) break #as dont want more 1 line #furthermore, if need index of line, do: i,line in enumerate(input.split("\n")): pass #i = index, line = line hope understood right ;)

mysql - sqlite query from list of value -

this code working within ms sql server select distinct * (values ('1234'), ('5678'), ('8888')) table_staff_no(staff_no) staff_no not in ( select staff_no table_staff_no (staff_no in ('1234', '5678'. '8888')) how should go in sqlite? my table have value 1234, passing list (1234,5678,8888) check value not exist in table. the result should show 5678, 8888. translating query sqlite requires common table expression , available since sqlite 3.8.3: with table_staff_no(staff_no) ( values ('1234'), ('5678'), ('8888') ) select distinct * table_staff_no staff_no not in ( select staff_no table_staff_no staff_no in ('1234', '5678', '8888'));

android - how to set custom Y-labels in MPAndroid chart -

Image
i use mpandroid chart present values in time (the performance of users). code prepared chart data is: barchart chart = (barchart) rootview.findviewbyid(r.id.chart); arraylist<barentry> enteries = new arraylist<>(); arraylist<string> labels = new arraylist<>(); (int = 0; < data.length; i++) { enteries.add(new barentry(data[i].getvalue(), i)); labels.add(data[i].getname()); } bardataset dataset = new bardataset(enteries, ""); int[] clr = new int[]{color.red, color.red, color.red, color.rgb(0xff, 0xff, 0x00), color.blue, color.black}; dataset.setcolors(clr); chart.setdata(new bardata(labels, dataset)); chart.animatey(500); values in 'data' in 'seconds'. how can show values both in y-labels , above bars in hhhh:mm:ss format, i.e. 1:40 (1 minute , 40 seconds) instead of 100.

java - Why there is a local variable referencing value array in String#hashCode? -

what purpose of copying value reference val variable, oppose using directly? public int hashcode() { int h = hash; if (h == 0 && value.length > 0) { char val[] = value; // private final char value[]; (int = 0; < value.length; i++) { h = 31 * h + val[i]; } hash = h; } return h; } this performance optimization according martin buchholz copying locals produces smallest bytecode see also: in arrayblockingqueue, why copy final member field local final variable? +----------------------+----------------------------+------------------------------+ | h = 31 * h + val[i]; | h = 31 * h + value[i]; | hash = 31 * hash + value[i]; | +----------------------+----------------------------+------------------------------+ | linenumber 1471 l7 | linenumber 14 l6 | linenumber 13 l4 | | bipush 31 | bipush 31 | aload 0 | | il

c++ - SIMD vs OMP in vector multiplication -

in project have several vector multiplications, done on either double *a -vectors or float *a -vectors. in order accelerate that, wanted use either simd-operations or omp . getting fastest result, wrote benchmark program: #include <iostream> #include <memory> #include <vector> #include <omp.h> #include <immintrin.h> #include <stdlib.h> #include <chrono> #define size 32768 #define rounds 1e5 void multiply_singular(float *a, float *b, float *d) { for(int = 0; < size; i++) d[i] = a[i]*b[i]; } void multiply_omp(float *a, float *b, float *d) { #pragma omp parallel for(int = 0; < size; i++) d[i] = a[i]*b[i]; } void multiply_avx(float *a, float *b, float *d) { __m256 a_a, b_a, c_a; for(int = 0; < size/8; i++) { a_a = _mm256_loadu_ps(a+8*i); b_a = _mm256_loadu_ps(b+8*i); c_a = _mm256_mul_ps(a_a, b_a); _mm256_storeu_ps (d+i*8, c_a); } } void multiply_avx_omp(flo