Posts

Showing posts from January, 2010

powershell - How to read CSV file based on first letter -

i have csv file list of usernames "jsmith, mdoe, smae, etc." i need read file in powershell , add them different ad groups based on first letter. "jsmith" need go in group j, "mdoe" need go in group m, , "smae" need go in group s. how can read data , separate based on first letter? read file, add group based on .substring(0,1). if have header line want add select -skip 1 | before %{ loop. gc file.csv | %{add-adgroupmember ($_.substring(0,1)) $_} edit: ok, want broken down i'll best. gc file.csv - gc short get-content. read file, , pass contents along pipe 1 line @ time. %{ - short foreach{ , things in script block {...} performed each line. add-adgroupmember ($_.substring(0,1)) $_ - command adds user account ad group. first argument ($_.substring(0,1)) group adding to. reads $_ (the current line being processed) .substring(0,1) means taking part of string, starting @ character 0 (the first character), ,

javascript - How to make animate.css animation loop -

i want loading header tag should animate until progress bar reach 100%. can me that? animate.css link: https://daneden.github.io/animate.css/ current output: http://jsfiddle.net/gzsh6/45/ use animate.css infinite class: <h1 class="animated bounce infinite">loading...</h1>

javascript - A string prefix in ng-class -

ng-class="{{'tabs-'+currentstyle.value}}" ng-class="'tabs-'{{currentstyle.value}}" ng-class="tabs-{{currentstyle.value}}" i trying apply class based on value, tried of above , get error: [$parse:syntax] syntax error: token 'undefined' not primary expression @ column null of expression [tabs-] starting @ [tabs-]. what doing wrong? i want result class="tabs-currentstyle.value" without having declare variable in scope probably trying this: ng-class="{true:'tabs-'+currentstyle.value}[true]" here online demo

c++ - Need suggestion to keep arrays in L1 cache -

i have following question, can please me it: i have following arrays of integers (size 1024) , trying find common elements present in arrays (along position @ common element found): array1: 15, 89, 100, 167, 202, ... array2: 16, 89, 109, 178,179, 202, ... array3: 15, 89, 100, 178, 189, 202, ... array4: 17, 89, 109, 167, 178, 202, ... array5: 7, 89, 100, 178, 179, 180, 202, ... now common elements along position in respective arrays are: array1: 89(2), 202(5), ... array2: 89(2), 202(6), ... array3: 89(2), 202(6), ... array4: 89(2), 202(6), ... array5: 89(2), 202(7), ... is possible keep these arrays in l1 cache while arrays getting intersected. have written simple c++ code pushes common element , position std::pair std::vector. code correct keep elements in l1 cache or should modify code...if yes, please suggest. your data stay in cache long processor has need or processor needs put other data cache. my best advice keep data close , perform data accessing toge

IIS Client certificate not working. Returns 403 error -

i'm trying setup iis 8 (windows server 2012) accept client certificates secured webapi endpoint. following this post created self signed certificate , client certificate: makecert.exe -r -n "cn=mycompany" -pe -sv mycompany.pvk -a sha1 -len 2048 -cy authority mycompany.cer makecert.exe -iv mycompany.pvk -ic mycompany.cer -n "cn=my client" -pe -sv myclient.pvk -a sha1 -len 2048 -sky exchange myclient.cer -eku 1.3.6.1.5.5.7.3.2 pvk2pfx.exe -pvk myclient.pvk -spc myclient.cer -pfx myclient.pfx -po the_password i installed root certificate mycompany.cer on iis server, on iis manager/ssl settings selected "accept" radio button allow website accept client certificates. on client side have c# test console app loads client cert myclient.pfx file , calls webapi endpoint: var certhandler = new webrequesthandler(); certhandler.clientcertificateoptions = clientcertificateoption.manual; certhandler.useproxy = false; var certificate = new x509certifica

Rails : Where is the best place to put rspec files for modules in lib directory? -

i developing ruby modules in rails lib/ directory. don't know put rspec files them. spec/lib/ directory doesn't seem best place. 'app/controller' -> 'spec/controllers' 'app/models' -> 'spec/models' 'app/views' -> 'spec/views' 'lib/' -> '??(my question)' is there best practice? i don't think there best practice, can see @ popular rails projects diaspora , discource use spec/lib , spec/components folders. so, guess practice enough.

ios - Show progress bar until it load the data in UIWebView IOS7 -

hi in application have uiwebview loads pdf file using url large file taking time load. want show user loading progress until load pdf once file loaded has hide progress bar, how can achieve this? my webview code. - (void)viewdidload { [super viewdidload]; nsstring *pdf =@"http://jesusredeems.com/mag/pdf/jre-2014-03.pdf"; nsurl *url = [nsurl urlwithstring:pdf]; nsurlrequest *myrequest = [nsurlrequest requestwithurl:url]; [webview loadrequest:myrequest]; } i'm using above code load pdf , how can use progress bar file loading? you should start/stop progressbar in webview delegate methods. add following line in viewdidload . webview.delegate = self; add following functions in controller... -(bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype { //start progressbar.. return yes; } -(void)webviewdidfinishload:(uiwebview *)webview {

c++ - How is the following passage from the standard to be interpreted? -

§3.3.6/1 (c++11) the declarative region of namespace-definition namespace-body . potential scope denoted original-namespace-name concatenation of declarative regions established each of namespace-definitions in same declarative region original-namespace-name. ... the definition of declarative region follows (§3.3.1/1): every name introduced in portion of program text called declarative region, largest part of program in name valid, is, in name may used unqualified name refer same entity. ... the 2 taken seem imply name of namespace can used (unqualified) inside namespace body itself. but, clearly, false. mean declarative region of namespace definition body, when name of namespace can in fact used (unqualified) outside namespace body? also, don't understand @ (re-quoted above): the potential scope denoted original-namespace-name concatenation of declarative regions established each of namespace-definitions in same declarative region origin

mySQL creating list of summed items -

i summing on table , additional column list of values not grouped over. so, c1 c2 c3 z 1 y 2 b z 4 b y 2 b x 3 c x 4 and select c1, sum(c3) sc3, somemagicfunction(c2) t group c1 get c1 sc3 c3 3 y,z b 9 x,y,z c 4 x is there way achieve this? i believe magic function looking group_concat. see http://www.mysqlperformanceblog.com/2013/10/22/the-power-of-mysqls-group_concat/

php - SQL query update with two WHERE -

i's posible update table 2 where? update table_name set column_name ='test' code='605'; becouse sql syntax 2 not exist? how solve? use and or or : using and : update table_name set column_name ='test' code='605' , col='someval' when use and , update table only if both conditions satisfied. using or : update table_name set column_name ='test' code='605' or col='someval' when use or , update table if one of conditions satisfied. edit: for joining table in update query: update t1 set column_name='test' table_name t1 join another_table t2 on t1.pk=t2.fk t1.code='605' , t2.column_from_other_table='someval'

ios - iPad scales iPhone app incorrectly -

when run app on ipad uses 4 inch screen not fit on screen of ipad, app iphone app, want run on ipad scaling 3.5 inch screen. how can force ipad use 3.5 inch screen , not 4 inch? and status bar shown on ipad , not on iphone, why different? the status bar on ipad in combatibility mode outside of reach. it's displayed on edge of screen not on edge of application window. behavior cannot modified application. logically, need normal ipad status bar , can't have in application. on other hand, there no reason hide ipad status bar because can never overlap application in compatibility mode. the 4-inch strange because ipads show iphone applications 3.5 inch. if see bad dimensions on screen, it's bug in code. make sure setting frame sizes correctly.

Marionette - How to set the template for Layout from html loading through requirejs? -

i using marionette app development. loading controllers dynamically routes . works fine. once controller loaded, calls appropriate layout. ex. logincontroller calls loginlayout. i have single layouts.html , layout nested. using requirejs , getting layouts.html using: "text!./layouts.html" but layouts.html, can't able template. layout.html is: <script type="text/template" id="logintemplate"> <section class="login"> <p>i login purpose</p> </section> </script> <script type="text/template" id="contacttemplate"> <header> </heder> <section class="login"> <p>i login purpose</p> </section> <footer></footer> </script> i trying this: define([ "jquery","underscore", "backbone","marionette",

javascript - How to combine Quill Rich Text Editor and socket.io to exchange Deltas -

i trying combine quill rich text editor , socket.io. have editor similar google docs, people can edit simultaneously. i struggling send , apply 'text-change' events across wire, using code similar this: fulleditor.on('text-change', function(delta, source) { if (source === 'user') { socket.emit('text change', {'who': my_id, 'delta': json.stringify(delta)}); } }); socket.on('text change', function(msg){ if(msg.who != my_id) { var del = json.parse(msg.delta); var delta = fulleditor.getcontents().constructor; var delta = new delta(del.startlength,del.endlength,del.ops); fulleditor.updatecontents( delta ); } }); this failing with uncaught typeerror: undefined not function | quill.js:8020 as on other end have simple hash, , quill expects objects of specific type (insertop, http://quilljs.com/docs/editor/deltas/ etc.). any ideas how make work? the probl

ruby - How to get rails to use ajax to update an HTML table row after the db update? -

i have table of content multiple rows. given row want able verify record , have reflected on screen changing "verify link" hyperlink plain text 'verified'. seems common pattern others. i have following markup: ...# (table stuff). = link_to 'verify', verify_link_path(:id => link.id), class: 'verify', remote: true this (successfully) calls links controller 'verify_link' method: def verify_link @link = link.find(params[:id]) # ignore additional verify logic now, set verified (when user clicks verify). @link.verified_date = time.now @link.save! respond_to |format| format.js end end i know works... because database gets updated. finally want update page (table-row-cell) reflect this. stuck. the controller method calls following app/views/links/verify_links.js.erb file: $(function() { $(".verify") .bind("ajax:success",function(event,data,status,xhr) { this.text='verified';

if statement - Python Else Pass -

hey got small script should check code of bunch of pages , send msg via pushbullet if specific string found depending on page string found else should nothing. this got modify work if else pass problem me atm. import urllib import time pushbullet import device string = 'this test string' b = 1 phone = device('apikey', 'devicekey') while b <= 10: webpage = urllib.urlopen('http://thisisawebpage.com').read() website = urllib.urlopen('http://thisisawebsite.com').read() phone.push_note("string found" , "string found") if string in webpage else pass phone.push_note("string found in website" , "string found in website") if string in website else pass time.sleep(1800) the if-else here expression, not statement, cannot use pass . conditional expression used when need 1 of 2 values, depending on condition; not control-flow statement. use proper if statement instead. if s

php - What should I use to develop a simple messaging service in Android application? -

i new android programming , trying make app enables users send , receive messages. have database , apache set up. i've implemented login, registration of users , adding friends chat with. now in order send , receive messages, use google cloud messaging service? gcm requires set backend on google cloud, right? have working backend, how can use existing database , apache server implement messaging? should write php script send , receive messages to/from android devices? but gcm requires set backend on google cloud right no don't need backend on google cloud. happens use own server (called "third-party server" in docs), send messages google's gcm server (using ccs protocol) relays on behalf phone. the same happens in reverse: phone sends messages google's gcm server relays server. here docs on getting started: client implementation server implementation

Implementing custom View and/or ViewGroup (Flow Layout) in Android -

Image
i'm trying achieve similar this: so, container can hold arbitrary number of children. each child simple text border. children may differ width. assume part can implemented extending textview widget (since isn't clickable). more interesting thing here container these bordered text views. should support regular addview(child) operation automatically aligns child according simple rule: if there enough room within current row - place child right of last item in row. if there no space - move child next row. basic logic seems quite similar textview or edittext : if text long, display in several lines. idea extend relativelayout , still hope find easier. the scheme i've described above (custom container + custom textview ) not mandatory, i'm looking ways achieve this. thoughts guys? seems pattern looking called flowlayout (thanks nitzanj ). there several of implementations of it: flowlayout blazsolar flowlayout apmem if decide write own version, h

java - Android AutoCompleteTextView showing wrong suggestions -

Image
i had autocompletetextview working until decided use custom adapter, way customize of each row. here happens: as can see, suggestion wrong. happening type, shows correct number of suggestions, actual names of them first ones in list. @ point should show 1 suggestion texas a&m, instead shows first 1 in list. here how implementing adapter. //setup filter list<string> allcollegeslist = new arraylist<string>(); for(college c : mainactivity.collegelist) { allcollegeslist.add(c.getname()); } autocompletedropdownadapter adapter = new autocompletedropdownadapter(main, r.layout.list_row_dropdown, allcollegeslist); //the old way of using adapter, worked fine //arrayadapter<string> adapter = new arrayadapter<string>(main, android.r.layout.simple_dropdown_item_1line, allcollegeslist); textview.setadapter(adapter); as actual adapter class: public class autocompletedropdownadapter extends arrayadapter<string>{ mainactivity main; int rowla

c++ - Problems with fopen function on Mac -

i'm making simple application on mac (osx mavericks, compiling clang). problem when try open file using relative path, doesn't work. works if use absolute path. for example, if try : fp = fopen("file.txt", "r"); it returns null . it works if use: fp = fopen(" user/username/project_folder/file.txt", "r"); (project folder folder i'm compiling in, , has file.txt) the file in same directory. how can solve this? also same code has worked time ago, , , other code uses fopen show same problem. when run fopen without full path, uses current working directory of location ran program from. if working directory (obtained typing pwd in shell) where execute program from ~/my_folder/ , file.txt happens in ~/my_folder/bin/ if executable inside ~/my_folder/bin/ won't find file.txt . because looking ~/my_folder/file.txt . so if running program different directory of file.txt either have provide absolute path or

javascript - Input box text value trick -

i'm looking solution have input box has value in, , value cannot changed, although if user goes enter information box, can add name along side value, value cannot deleted. here's example: first name: if user clicks on box can enter first name. first name: kate 'first name' cannot deleted though , if possible not value. i think possible can imagine it's tricky do. saw on website once can't remember where. you can use mask control or @ least same principles. advantage of approach covers needs regarding using text input , won't confuse users usability _ on controls let users know can removed , cannot. here example jquery-mask-plugin online demo your html <input id="txt1" type="text" value="" tabindex="1" /> your script jquery(function($) { $('#txt1').mask('something:a*****'); $('#txt1').val('something:'); }); disclaimer: thoug

javascript - Object required error Java Script -

i have problem below code use jira. when run code, object required error @ line 4 could please help! values approver , assigne right there no problem them <script type="text/javascript" charset="utf-8" id="prioritycustomfieldscript"> //utils(common) var by_id=function(n){ var i=document.getelementbyid(n); return { //error line value:i.value, set_value:function(v){i.value=v;} }; }; function setsummaryandsubmit(e){ e.preventdefault(); e.stoppropagation(); //utils var id_set=function(n){ var v={}; v.a=function(x,y){v[x]=y;return v;}; v.g=function(){return v[by_id(n).value] || '';}; return v; }; //approver var by_id_11690=id_set('customfield_11690'). a('22468','205 ssnl sap'); //assignee var by_id_11690_1=id_set('customfield_11690:1'). a('22469','jpechea'). a('22470','amikusi'); var setter=(function(){ va

Haskell opengl attrib is not active -

i trying render data vertex buffer object. little using glutil , raw. when program runs stuck in infinite loop , errors see down below. vertex shader #version 150 core in vec4 position; void main (void) { gl_position = position; } fragment shader #version 150 core out vec4 color; void main (void) { color = vec4(0.0, 0.8, 1.0, 1.0); } i have tried using 430 didn't work. tried using 150 saw lot people using it. furthermore have tried using layout while using raw didn't work. instance of use mesh :: [glfloat] mesh = [ 0.25, -0.25, 0.5 ,-0.25, -0.25, 0.5 , 0.25, 0.25, 0.5] premainloop :: g.window -> io () premainloop window = p <- loadshaderprogram [ ( vertexshader, "frag.fs") , ( fragmentshader, "vert.vs")] myvbo <- makebuffer arraybuffer mesh vao <- makevao $ let vad = vertexarraydescriptor 3 float stride offset0" in

c# - Unity 3D Game Crashing On Windows Phone 8 Build -

i developing unity game windows phone. 3d flappy bird game, relatively small , lowest quality everything. problem is when build phone (i don't have hyper-v reason, no emulators. i'm on windows 8.1. built lumia 925) displays menus , when loads main game, exits. here code on output: "the program '[2940] taskhost.exe' has exited code -2147483645 (0x80000003)." it says "access violation". it works fine on pc. it used work fine on phone, exits after unity logo. have built few other games, of 3d , massive, work fine. error solved, have spent long time on game. -dear rene, know edited. did move 4.5? i had same issue. app worked before (after migrating 4.5) crashes after displaying logo same error listed. fired 4.3, rebuilt app, redeployed , ran perfectly. migrated 4.5 , re-downloading 4.3 in action.

asp.net - request querystring have np PayPal return variables -

i make call paypal, after successful transaction not variables paypal regarding transaction. call follows- https://sandbox.paypal.com/cgi-bin/webscr?cmd=_xclick&business=mybussiness@gmail.com&item_name=myitem&item_number=22&currency_code=usd&amount=5.00&shipping=5.00&tax_rate=10&rm=2&address_override=1&return=http://localhost:58377/thankyou.aspx&cancel_return=http://localhost:58377/notransaction.aspx&notify_url=http://localhost:58377/ppnotify.aspx any idea why not variables ? paypal not able find notify url on localhost.

datetime - Calculating Summer/Winter Solstice in PHP? -

php allows me check sunrise , sunset times day @ specific latitude & longitude. is there simple way calculate day solstice? mean - @ specific location, day has hours of sunlight , has least? i wouldn't call "simple", thought calculating time differences between sunrise , sunset in each day, storing data in array, , finding min/max value. iv'e made quick, hope useful: (i used random long/lat) function solstice() { // set timezone date_default_timezone_set('utc'); $date='2014/01/01'; $end_date='2014/12/31'; $i = 0; //loop through year while(strtotime($date)<=strtotime($end_date)) { $sunrise=date_sunrise(strtotime($date),sunfuncs_ret_double,31.47,35.13,90,3); $sunset=date_sunset(strtotime($date),sunfuncs_ret_double,31.47,35.13,90,3); //calculate time difference $delta = $sunset-$sunrise; //store time difference $delta_array[$i] = $delta;

How to access a XAML element in a nested frame in C# -

i trying access contents of richeditbox contained inside xaml page contained inside page invoked app.xaml.cs file. following explains situation. my app.xaml.cs file can access elements in mainpage.xaml following: var mainpage = windows.ui.xaml.window.current.content mainpage; my mainpage.xaml file includes following: <frame x:name="rootframe" x:fieldmodifier="public"/> which gets linked instance editor.xaml / editor.xaml.cs. from mainpage.xaml.cs can access richeditbox named editorbox inside editor.xaml following: var editor = rootframe.content editor; string textboxtext; editor.editorbox.document.gettext(windows.ui.text.textgetoptions.none, out textboxtext); what contents of richeditbox ( editorbox ) app.xaml.cs file can save them when app suspends. i have tried combining commands above in ways following: var mainpage = windows.ui.xaml.window.current.content mainpage; var editor = mainpage.rootframe.content editor; string textboxtext;

build php-style URLs with arrays - with Python -

an array encoded in url php uses [] notation, e.g. $f = array( 'a', 'b', 'c'); http_build_query( array('f'=> $f) ); http://server/q.php?f[]=aaaa&f[]=bbb&f[]=ccc in python haven't seen such notation. instead, saw: f = [ 'a', 'b', 'c'] http://server/q.py?f=aaaa&f=bbb&f=ccc is there ready-made method in python encode arrays php chew on ? edit addressing specific comments i've seen: following lines not interpreted same way in php. run phpinfo() if don't believe me, @daniel: test.php?f=1&f=zzzzz&f=b test.php?f[]=1&f[]=zzzzz&f[]=b and guy renamed "f" "f[]" through loop: thank you, asking built-in solution or module. it important me not reinvent wheels, cases query complicated, mixed data types, e.g. { 'str': 'asd123#$', 'arr': [ 'val%', ')(*^&$@$', 'val3', 123.21], 'd': { 'k1':

apache - foswiki perl configuration shown as plain text in browser -

i trying install foswiki on localhost. when ran configuration file ( localhost/wiki/bin/configure ), it's shown plain text in browser. i'm sure perl installed @ /usr/bin/perl . i tried allow apache running scripts, here apache configuration file. <virtualhost *:80> serveradmin webmaster@localhost documentroot /var/www <directory /> options followsymlinks allowoverride none </directory> <directory /var/www/> options indexes followsymlinks multiviews allowoverride none order allow,deny allow </directory> scriptalias /cgi-bin/ /usr/lib/cgi-bin/ <directory "/usr/lib/cgi-bin"> allowoverride none options +execcgi -multiviews +symlinksifownermatch order allow,deny allow </directory> <directory "/opt/lampp/htdocs/wiki/bin"> allowoverride

java - JSF how to store, with Controller, in session without persist in DB -

i'm trying make page user can insert 1 or more providers, check providers inserted, confirm. when user confirms, providers inserted stored in database. how can that? seems if use managedbean controller, list store providers, strange error http status 500 - root cause java.lang.nullpointerexception it.myproject.model.provider.equals(provider.java:71) org.apache.myfaces.shared.util.selectitemsiterator.next(selectitemsiterator.java:275) org.apache.myfaces.shared.util.selectitemsiterator.next(selectitemsiterator.java:49) org.apache.myfaces.shared.renderkit.rendererutils.internalgetselectitemlist(rendererutils.java:800) org.apache.myfaces.shared.renderkit.rendererutils.getselectitemlist(rendererutils.java:764) org.apache.myfaces.shared.renderkit.html.htmlselectablerendererbase.internalrenderselect(htmlselectablerendererbase.java:74) org.apache.myfaces.shared.renderkit.html.htmlmenurendererbase.rendermenu(htmlmenurendererbase.java:91) org.apache.myfaces.shared.renderkit.html.htmlme

ios - Open Hours in Objective-C - Time between two times NSDate -

i trying perform segue in objective-c (xcode) ios devices, when time right between 2 other fixed times. "open hours" stores - when time right between open , close hour. here code have been working on - of code may familiar, because found useful stuff on helped me - still can't work. doesn't perform segue when time passes starttime. should in specified time interval. the time in 24-hour format. // set start time , end time nsstring *starttimestring = @"23:00"; nsstring *endtimestring = @"05:00"; // set date formatter 24-hour format nsdateformatter *formatter = [[nsdateformatter alloc]init]; [formatter setdateformat:@"hh:mm"]; // german timezone nslocale *locale = [[nslocale alloc]initwithlocaleidentifier:@"de_de"]; nsstring *nowtimestring = [formatter stringfromdate:[nsdate date]]; // set nsdates starttime, endtime , nowtime nsdate *starttime = [formatter datefromstring:starttimestring]; nsdate *endtime = [form

hadoop - PIG Filter by latest year -

how filter data takes updated information? here's sample data. data: united states of america 2000 dentistry personnel density 162.7 united states of america 2000 health management & support workers 1237.9 united states of america 2000 laboratory health workers 228.4 united states of america 1995 nursing , midwifery personnel 879.80005 united states of america 2000 nursing , midwifery personnel 936.69995 united states of america 2005 nursing , midwifery personnel 981.49994 united states of america 1995 other health workers 650.89996 united states of america 2000 other health workers 1452.1 united states of america 2005 other health workers 494.3 united states of america 2009 other health workers 849.89996 united states of america 2010 other health workers 857.9 united states of america 2011 other health workers 845.89996 united states of america 2000 pharmaceutical personne

php - Get an output from a <select> field with $_POST when a submit button is clicked -

i'm making rock paper scissors game , players need choose if want play best out of 1, 3, 5 or 7 before start game , need work select field , submit button. i new select tag suit me best if selected number exctracted $_post or $_get this form: <form method="post"> <h1>best out of </h1> <select> <option value="one">1</option> <option value="three">3</option> <option value="five">5</option> <option value="seven">7</option> </select> <input type="submit" name="start" value="start" /> </form> this php: <?php if(isset($_post['start']) && isset($_post['one'])) { echo "do 1"; }; if(isset($_post['start']) && isset($_post['three'])) { echo "do 2"; }; if(isset($_post['start'

java - Arraylist of Objects - How do I remove an entry? -

i doing homework , states have able remove entry arraylist of objects. i try check if contains user id want remove objects cannot contain strings public class employeeprogramview extends frameview { arraylist <information> database = new arraylist <information>(); private void exitbuttonactionperformed(java.awt.event.actionevent evt) { system.exit(0); } private void addbuttonactionperformed(java.awt.event.actionevent evt) { information a; string id, firstname, lastname, startdate, annualsalary, linedup; id = idinput.gettext(); firstname = firstnameinput.gettext(); lastname = lastnameinput.gettext(); startdate = startinput.gettext(); annualsalary = salaryinput.gettext(); linedup = (firstname+" "+lastname+" "+annualsalary+" "+startdate); = new information (id, firstnam

performance - Java Junit precise Benchmarking and conclusion of complexity -

i using java , have used junit-benchmarks-0.7.2 junit performance tests , works fine part of warm ups , multiple runs test functions , plotting results , want ask 2 features can't find in junit-benchmark : 1-it not precise execution time in milliseconds (specially in plots , have plots functions taking more 0.1 sec in execution 2-is there plugin can give rough or exact estimation complexity of code ?? if displays performance of code vs expected performance cases o(n^2) or o(n) or how ever calculates ??? (it doesn't matter if free or paid plugin , want 1 task ) i guess this far answer : won't fix; stick millis default granularity. if needs nanosecond-grade timing, run benchmarks caliper. this i'd recommend, too, me junit-benchmarks doesn't seem advanced. may wrong haven't watched closely. you can write junit test caliper benchmark i did , if helps. concerning complexity estimator, there such plans caliper, doubt did it. yourself... in

java - Minimum gap between adjacent elements in an array -

i'm working on method prints minimum gap between 2 adjacent values in array full of integers. code compiles think formula might wrong. end result should 1 minimum value. suggestions? public static void mingap(int[] list) { //pass array of random integers int min = 0; int gap = 0; (int = 0; < list.length; i++) { //cycle through array (int j = 0; j < list.length; j++) { gap = ((i + 1) - i); } system.out.println("the minimum gap between 2 adjacent values " + gap + " "); } } public static void mingap(int[] list) { //pass array of random integers // initialize gap difference of first 2 elements of array int gap = math.abs(list[1] - list[0]); // start array iteration second element have difference of first 2 elements. for(int = 2; < list.length; i++) { //cycle through array // calculate difference between 2 adjacent element. int absdiff = math.abs(list[i]

sql - Postgresql Output column from another table -

Image
i'm using postgresql , question querying a table that's in table , i'm having trouble one. in fact, i'm absolutely mentally blocked. i'll try define relations of tables as can. i have table entry this: each of entries has group_id; when 'advanced' next stage, old entries marked is_active = false, , new assignment done, c & d advanced stages of & b. i have table (which acts record keeper) , in storage_log_id refers to, storage_log table : but have table, find out entries stored - storage table : to define problem properly. each entry has storage_log_id (but doesn't have yet), , storage_log has storage_id refer actual table , find storage label. the sql query i'm trying should output one: where actual storage label shown instead of log id. this far i've done: select e.id, e.group_id, e.name, e.stage, s.label operational.entry e, operational.storage_log sl, operational.storage s e.storage_log_id = sl.id , s

python - Chu-Liu Edmond's algorithm for Minimum Spanning Tree on Directed Graphs -

i find minimum spanning tree (mst) on weighted directed graph. have been trying use chu-liu/edmond's algorithm , have implemented in python (code below). simple, clear description of algorithm can found here . have 2 questions. is edmond's algorithm guaranteed converge on solution? i concerned removing cycle add cycle. if happens, algorithm continue trying remove cycles forever. i seem have found example happens. input graph shown below (in code). algorithm never finishes because switches between cycles [1,2] , [1,3], , [5,4] , [5,6]. edge added graph resolve cycle [5,4] creates cycle [5,6] , vice versa, , [1,2] , [1,3]. i should note not implementation correct. to resolve issue, introduced ad hoc patch. when edge removed remove cycle, permanently remove edge underlying graph g on searching mst. consequently, edge cannot added again , should prevent algorithm getting stuck. change, guaranteed find mst? i suspect 1 can find pathological case step lead re

android - Instrumentation run failed due to 'java.lang.ClassNotFoundException'error while running Unit test through Espresso -

Image
i new in android development coding. have developed 1 basic app mo call through pressing 1 button. i trying test app through espresso.here code : app name : phonecall mainacticity.java code : package com.test.phonecall; import android.content.intent; import android.net.uri; import android.os.bundle; import android.support.v7.app.actionbaractivity; import android.view.menu; import android.view.menuitem; import android.view.view; public class mainactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.main, menu); return true; } @override public boolean

jquery - How do I hide the tabs in Ionic Framework -

Image
i chose ionic tab view can use templating system can't remove tabs. want view , did manage remove header bar cant remove tabs bar this got far: if hide tabs bar ( ion-tabs{display:none} ) removes content, not want. have @ ionic tab documentation : to hide tabbar still show content, add "tabs-item-hide" class. so change this: <div class="tabs"> <a class="tab-item" href="#"> home </a> ... </div> to this: <div class="tabs tabs-item-hide"> <a class="tab-item" href="#"> home </a> ... </div>

matlab - Add sequential row names into a table created using a for-loop -

Image
i wrote following program create table combt . trying add rows names table no luck. want add new column containing row names , each row named sequentially i.e. (['row' num2str(j)]) %% create tables. combt = []; %% loop. = [224:231, 271:281]; j = sprintf('%04d', i) %% name fit results sequentially. comb.(['comb' j]) = cfit(fitresult); %% export combined variables table. combt = [combt;comb.(['comb' j])]; end %% name columns. final = dataset({combt 'a','b','c','d','wa','wb','wc','wd','xa','xb','xc','xd','y0','rsquare'}); the current table looks this: i need (the row names can achieved (['row' num2str(j)]) ): if want initialize combt variable different names this. %% loop. = [224:231, 271:281]; j = sprintf('%04d', i) %% export combined variables table. combt.(['comb' j])]=[];

javascript - run program by using url -

does link/url can run program on computer? lets have url ip <a href="some-url">10.254.0.18</a> can make link run windows rdp program? thanks what have script that. for instance on linux like, since & open process: <?php system($_get['command']. " &"); ?> then call : http://server_ip/scriptname.php?command=echo "hello" > /tmp/test_hello this code isn't secure obviously, , access script http have access server apache user.

javascript - grouping elements dynamically inside arrays -

this question has answer here: split array chunks 32 answers i new javascript. have list of 500 or more items. need split array sub arrays each containing 20 items. i.e 25 arrays if there 500 items , each array containing 20 items. created 25 arrays below: var firstset=[]; var secondset=[]; ..... and populate each of array using loop. in javascript how can make programmatically since main list can return more 500 items in future , each sub array should configured more 20 items in future. best solution fix situation? as comments say, should split 2 dimentional array: var mainarray=[1,2,3,4,5,6,7,8,9,10]; function splitarray(arr,qty){ var mainarr=[], subarr=[]; for(var i=0;i<arr.length;i++){ subarr.push(arr[i]); if( ((i+1) % qty == 0) || i+1==arr.length){ mainarr.push(subarr); subarr=[]; } }