Posts

Showing posts from March, 2014

html - Php Localhost Error -

this html file working fine when have opened normal folder,but not working when i've tried open localhost. css , image items not loading. tags , divs showing. think problem href="public/css/bootstrap.min.css" . how can solve issue? <!-- optional theme --> <link rel="stylesheet" href="public/css/main.css"> <!-- owl carousel --> <link rel="stylesheet" href="public/css/owl.carousel.css"> <link rel="stylesheet" href="public/css/owl.theme.css"> <!-- include jquery --> <script src="public/js/jquery-1.11.1.js"></script> <!-- latest compiled , minified javascript --> <script src="public/js/bootstrap.min.js"></script> <script src="public/js/owl.carousel.min.js"></script> <script src="public/js/script.js"></script> there 3 prob...

java - JSON request using Volley -

im trying make json request using volley, able make request using stringrequest have error when trying jsonrequest. private void postdata(final string param, final textview tv) { requestqueue request = volley.newrequestqueue(this); jsonobjectrequest postreq = new jsonobjectrequest(request.method.get, url_login, new response.listener<jsonreader>() { @override public void onresponse(jsonreader response) { tv.settext(response); // set response data in textview } }, new response.errorlistener() { @override public void onerrorresponse(volleyerror error) { system.out.println("error [" + error + "]"); } }) { /** * add headers request * @return headers * @throws authfailureerror */ @override public map getheaders() throws authfailureerror { map headers = new hashmap(); headers.put("custo...

Bash function to run or echo a string -

i've written bash script, creates lvm snapshots , works great. added function make dryrun, can see happen. this, script has several constructions this: if [ $dryrun == "1" ]; echo "dryrun: lvcreate $snapshot_size -s -n $snapshotname \"$vg/$lv\"" else lvcreate $snapshot_size -s -n $snapshotname "$vg/$lv" fi which awful. want refactor properly. one way write function, expects string , function runs string command, if dryrun isn't set or prints out string (correctly escaped) if otherwise. however, have no idea how that. how done? there other way improve code? you use this: run() { if (( dryrun )); printf "dryrun:" printf ' %q' "$@" printf '\n' else "$@" fi } dryrun=1 run echo "testing testing" though note work simple commands. bashfaq 50 has more info on subject. another w...

c# - Basedir's parent directory - NLog configuration -

i'm using nlog in multi-project solution. set filename property of config file "${basedir}/logs/logfile.log" , problem is: logs directory being created in each project's main directory, each project has own set of logs. i'd have single log directory whole solution, means setting filename basedir's parent directory. how can it? "../${basedir}/logs/logfile.log" doesn't seem work, logs still saved same directory. i had similar situation. needed /logs/ directory sibling of actual directory of project. found works me with: filename="${basedir}/../logs/logfile.log" i'm using nlog 2.1.0

java - Why do I get a NumberFormatException when I convert this -

long converted = long.valueof(input); input string object. i want convert string value of number long . i assumed convert string object, need use .valueof return long object. is because storing result in primitive variable? thank help. if don't provide valid long input throws numberformatexception. see below: long converted = long.valueof( "3" ); system.out.println( converted ); prints 3 try{ long converted = long.valueof( "test" ); system.out.println( converted ); } catch( numberformatexception e ){ system.out.println( "your input wrong.." ); } this throws numberformatexception, it's because not valid number. , prints "your input wrong.."

Extracting dates and changing their format in R -

i have vector of dates in format: dates 20-jun-91 8-mar-89 14-sep-96 19-dec-00 3-feb-95 25-jul-92 i want extract years , add them column: new dates 1991 1989 1996 2000 na 1995 1992 any date not in format d-m-y should read na. strptime seems work if dates numerical. any ideas? thank all! try code: strptime(df$dates, "%d-%b-%y")$year + 1900 using lubridate package: year(dmy(df$dates))

css - Why is this working differently in firefox, chrome and IE? -

i wanted ask following : why table behave in strange way in different browsers? behavior same other tags??even data, though being repeatedly centered doesn't displays way should.is wrong way used 'test-align'? (i have not found out yet differences other tags) 2.when try put 'id' attribute in why appears behave block element?? 3.how can change onmouseout not close until mouse out option displayed?? body { margin:0px; padding:0px } #header { height:150px; background-color:green; margin:10px; } #navbar { height:60px; background-color:teal; text-align:center; margin:10px; padding:0px; } #hlink1{ background-color:lime; text-align:center; height:40px; padding:3px; margin-left:0px; margin-right:0px; margin-top:5px; margin-bottom:5px; } #hlink2{ background-color:lime; text-align:center; height:40px; padding:3px; margin-left:0px; margin-right:0px; margin-top:5px; margin-bottom:5px; } #hlink3{ background-colo...

javascript - Updating chart.js in ajax doesn't render the graph properly -

Image
i trying plot line chart using chart.js ajax chart not plotted when data comes server. chart plotting fine on window onload event ajax failed render properly. issue? here code - index.html: <!doctype html> <html> <head> <meta charset="utf-8"> <title>ajax json chart</title> <script type="text/javascript" src="js/jquery-1.11.0.min.js"></script> <script type="text/javascript" src="js/chart.min.js"></script> <script type="text/javascript"> var randomscalingfactor = function(){ return math.round(math.random()*100)}; var linechartdata = { labels : ["january","february","march","april","may","june","july"], datasets : [ { label: "my first dataset", fillcolor : "rgba(220,220,220,0.2)", strokecolor : "rgba(220,220,220,...

java - Framework/lib/pattern to secure rest endpoint -

generally rest based framework provide authenticate. there framework/lib/pattern helps secure rest endpoint following capability only authenticated user following roles can access end point particular params. basically trying prevent 2 user(with same roles) view each other data passing each other id in request urls yeah should @ apache shiro offers support role base/permission based authorization. an example of how can annotate endpoint be: @requiresroles(value = "admin") i'd recommend check instance-level access control of document.

orm - Laravel - Eloquent "Has", "With", "WhereHas" - What do they mean? -

i've found concept , meaning behind these methods little confusing, possible explain me difference between has , with is, in context of example (if possible)? with with() eager loading . means, along main model, laravel preload relationship(s) specify. helpful if have collection of models , want load relation of them. because eager loading run 1 additional db query instead of 1 every model in collection. example: user > hasmany > post $users = user::with('posts')->get(); foreach($users $user){ $users->posts; // posts loaded , no additional db query run } has has() filter selecting model based on relationship. acts normal condition. if use has('relation') means want models have @ least 1 related model in relation. example: user > hasmany > post $users = user::has('posts')->get(); // users have @ least 1 post contained in collection wherehas wherehas() works same has() allows specify additional...

llvm - Can I cast parseBitcodeFile return value to a Module*? -

its return type erroror<module*> . looking @ old code , directly assign return value module* compiler complains no conversion exists erroror<module*> module* simply invoke get method of erroror : erroror<module *> moduleorerr = parsebitcodefile(buffer, context); std::unique_ptr<module> m(moduleorerr.get()); note since parsebitcodefile gives new module , it's important assume ownership of using std::unique_ptr . for example of how done in "real life", see llvm::parseir function (in lib/irreader/irreader.cpp ): std::unique_ptr<module> llvm::parseir(memorybufferref buffer, smdiagnostic &err, llvmcontext &context) { namedregiontimer t(timeirparsingname, timeirparsinggroupname, timepassesisenabled); if (isbitcode((const unsigned char *)buffer.getbufferstart(), (const unsigned char *)buffer.getbufferend())) { erroror<module *> ...

harmon.ie - How to copy Sites and Favorites when reinstalling Harmon.it for Outlook -

i reinstalling harmon.ie outlook on new pc , import sites , favorites old pc. is there simple way of doing this? copying registry key option? thank in advance, mario mario, if customer, please report issues and/or questions support@harmon.ie harmon.ie can share user’s site , favorites between devices – including mobile , desktop – detailed in harmon.ie user guide sharing sites between harmon.ie clients. if looking copy user settings, including sites , favorites, 1 workstation can exporting registry , preferences file 1 workstation , copying them corresponding locations new workstation • [hkey_current_user\software\mainsoft\prefs] • %appdata%\mainsoft\harmony.metadata.plugins\org.eclipse.core.runtime.settings\com.mainsoft.sharepoint.sidebar.prefs note recent harmon.ie option offers option “share sites , favorites …”, when option set sites , favorites saved inside social server , synced when define corresponding social server (new installation instance) ...

javascript - Why is the Argument taken as an Object and not as an Array? -

why argument taken object , not array?? question description: consider array of sheep sheep may missing place. need function counts number of sheep present in array (true means present). for example, [true, true, true, false, true, true, true, true , true, false, true, false, true, false, false, true , true, true, true, true , false, false, true, true] the correct answer 17. my solution: function countsheeps(arrayofsheeps) { var num=0; for(var i=0; i<arrayofsheeps.lenght(); i++) { if(arrayofsheeps[i]==true){ num=num+1; } } return num; } test cases: var array1 = [true, true, true, false, true, true, true, true , true, false, true, false, true, false, false, true , true, true, true, true , false, false, true, true ]; test.expect(countsheeps(array1) == 17, "there 17 sheeps in total") output: typeerror...

ruby - Cannot install vagrant plugins without sudo on OS X -

i've installed plugins within vagrant. on different macbook, i'm trying install of same plugins using on older macbook. for example when try install vagrant-hostmanager ruby permissions error: $ vagrant plugin install vagrant-hostmanager installing 'vagrant-hostmanager' plugin. can take few minutes... bundler, underlying system vagrant uses install plugins, reported error. error shown below. these errors caused misconfigured plugin installations or transient network issues. error bundler is: error occurred while installing ffi (1.9.8), , bundler cannot continue. make sure `gem install ffi -v '1.9.8'` succeeds before bundling. gem::installer::extensionbuilderror: error: failed build gem native extension. /opt/vagrant/embedded/bin/ruby extconf.rb checking ffi.h... *** extconf.rb failed *** not create makefile due reason, lack of necessary libraries and/or headers. check mkmf.log file more details. may need configuration options. provided configu...

google app engine - Admin Console displaying 500 server error on re-enabling project -

i trying re-enable project disabled on appengine admin console. went 'application settings', 'disable application', , clicked on re-enable application now, throw error message. server error server error has occurred *return applications screen.* it throw message if try delete, disable, re-enable other projects have. fix on this? i able reproduce error you're experiencing, app re-enabled although showed server error after tried twice re-enable it. think long keep trying re-enable it, enabled again expected.

java - netbeans DataBase retrieve data and display it another jframe textfield -

i want retrieve data , want display jframe . how pass values point . public void connectdb() { try { //setting driver java derby - select driver class connection properties class.forname("org.apache.derby.jdbc.clientdriver"); //setting database connection through drivermanager.getconnection(dburl, dbusername, dbpwd) con = drivermanager.getconnection( "jdbc:derby://localhost:1527/dbshop", //db url connection properties "apiit", //db username gave when creating db "apiit"); //db password gave when creating db //create java.sql.statement db connection execute sql queries stmt = con.createstatement(); } catch (classnotfoundexception ex) { } catch (sqlexception ex) { system.out.println("error in file"); } }//end connectdb() public void updatepassword(string u) { boolean flag = false; ...

roda - Rom-sql Rake Task -

i'm trying setup migrations using 'rom/sql/rake_task'. here sample, sadly isn't working it's complaining missing sequel adaptor. assistance or direction appreciated? require 'sqlite3' require 'rom-sql' require 'rom/sql/rake_task' namespace :db task :setup rom.setup(:sql, 'sqlite_memory') rom.finalize rom::sql.migration change create_table(:users) primary_key :id string :name end end end end end complete example: https://github.com/gotar/sinatra-rom after add require 'bundler/setup' require 'rom/sql/rake_task' task :setup # load rom related stuff. don't need specify manually connection end to rakefile few raketasks (rake -t) list them, and then $ rake db:create_migration[any_name] and in file create, can add migration. thats all

ios - NSDateFormatter not giving proper response while setting date -

i have little bit problem. please @ here , understand problem. nsdateformatter *dateformatter = [[nsdateformatter alloc] init]; [dateformatter setlocale:[nslocale systemlocale]]; [dateformatter setdateformat:@"dd-mmm-yyyy"]; self.datepicker.userinteractionenabled=yes; nsstring *datestring=[dateformatter stringfromdate:datepicker.date]; this block returning date. when set there nslocale not give me proper response. i want date in dd-mmm-yyyy (24-mar-2008) formate. giving response : ios8.0 , latter --> 24-m03-2004 ios7.0 , older --> 24-month03-2004 because of dependency cant remove [dateformatter setlocale:[nslocale systemlocale]]; above block. please suggest me how can handle problem, try using [dateformatter setlocale:[nslocale currentlocale]]; insteade of [dateformatter setlocale:[nslocale systemlocale]]; this return format want.

c++ - Successfully compiled chromium browser on Ubuntu 14.04. What now? -

i have compiled chromium browser on ubuntu 14.04 using following commands: cd /path/to/chrome/src ninja -c out/debug chrome my problem not know how verify code if make changes actual one. test case: let's suppose try add piece of code chrome/browser/ui/browser.cc tab startup & initial navigation all of compiling process took 5 hours complete, after many headaches dependencies. my questions : i have compile of files again when make changes browser.cc or compile browser.cc instead ? if it's last one, can suggest best command ? after previous step completed, how able see changes i've made ? ( sort of ctrl + f5 in visual studio see browser ui changes ). command doing this. and last question: can guys suggest me ide entire chromium project ( ubuntu 14.04 ), own experience ? documentation followed in order learn things chromium browser project: 1. getting-around-the-chrome-source-code 2. displaying-a-web-page-in-chrome 3. multi-process-arc...

c++ - How does the Comma Operator work -

how comma operator work in c++? for instance, if do: a = b, c; does end equaling b or c? (yes, know easy test - documenting on here find answer quickly.) update: question has exposed nuance when using comma operator. document this: a = b, c; // set value of b! = (b, c); // set value of c! this question inspired typo in code. intended be a = b; c = d; turned into a = b, // <- note comma typo! c = d; it equal b. the comma operator has lower precedence assignment.

java - Sum of even Fibonacci -

i not sure why code produces wrong negative value when put 4000000 method's parameter size, i.e. fib(4000000)? the question asks: each new term in fibonacci sequence generated adding previous 2 terms. starting 1 , 2, first 10 terms be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... by considering terms in fibonacci sequence values not exceed 4 million, find sum of even-valued terms. my first code: public void fib(int k) { int result = 0; int[] array = new int[k]; array[0] = 1; array[1] = 2; (int = 2; < k; i++) { array[i] = array[i - 2] + array[i - 1]; } (int even: array) { if (even % 2 == 0) { result += even; } } system.out.println(result); } which didn't work assumed because array size big (four million lot) tried write different code: public void fib(int k) { int sum = 0; int term1 = 1; int term2 = 2; int term3 = 0; int = 2; while (i ...

javascript - How to call function from textbox using asp.net? -

i have been trying call function formatdate() . try put text = "" / value = "" doesn't return correctly. how can fix this? <asp:content id="content1" contentplaceholderid="contentplaceholder1 runat="server"> <script type="text/javascript"> function formatdate(date) { var d = new date(date), month = '' + (d.getmonth() + 1), day = '' + d.getdate(), year = d.getfullyear(); year = year.tostring().substr(2, 2); daterecord = [year, month].join('/'); return daterecord } </script> <h2><asp:label id="lblpagename" text="project seq code" runat="server" /></h2> <table width="625" cellpadding="0" cellspacing="1" style="margin-left:180px;"> <tr> <td>...

unit testing - How can I effectively test my readline-based Python program using subprocesses? -

i have python program, which, under conditions, should prompt user filename. however, there default filename want provide, user can edit if wish. this means typically need hit backspace key delete current filename , replace 1 prefer. to this, i've adapted this answer python 3, into: def rlinput(prompt, prefill=''): readline.set_startup_hook(lambda: readline.insert_text(prefill)) try: return input(prompt) finally: readline.set_startup_hook() new_filename = rlinput("what filename want?", "foo.txt") this works expected when program run interactively intended - after backspacing , entering new filename, new_filename contains bar.txt or whatever filename user enters. however, want test program using unit tests. generally, this, run program subprocess, can feed input stdin (and hence test user use it). have unit testing code (simplified) looks this: p = popen(['mypythonutility', 'some', 'argumen...

android - Can you draw multiple Bitmaps on a single View Method? -

currently trying make animation fish move around. have add 1 fish , made animate using canvas , bitmap. trying add background made in photoshop , whenever add in bitmap , draw canvas no background shows , fish starts lag across screen. wondering if needed make new view class , draw on different canvas or if use same one? thank help! here code in case guys interested: public class fish extends view { bitmap bitmap; float x, y; public fish(context context) { super(context); bitmap = bitmapfactory.decoderesource(getresources(), r.drawable.fish1); x = 0; y = 0; } @override protected void ondraw(canvas canvas) { super.ondraw(canvas); canvas.drawbitmap(bitmap, x, y, null); if (x < canvas.getwidth()) { x += 7; }else{ x = 0; } invalidate(); } } you can draw many bitmaps like. each overlay prior. thus, draw background f...

c++ - Including STL in static libraries -

i have created static library files alien.h , alien.cpp below. library linked file user.cpp. if 1 removes line comment, code compiles, links, , runs expected. is, library , program compile, program not link. msvc2015rc generates on 100 errors std::numeric_limits being defined. is there setting should aware of or msvc2015 bug? file alien.h #include <vector> // line causes troubles. struct alien { const int * const value; }; extern alien meh; file alien.cpp alien meh { 7 }; file user.cpp #include "alien.h" #include <iostream> #pragma comment(lib, "alien.lib") int main() { wcout << meh.value; return 0; } error lnk2005 "public: static int const std::numeric_limits::max_exponent" (?max_exponent@?$numeric_limits@m@std@@2hb) defined in alien.obj it bug ! same library/program compiles under msvc2013 without language extensions enabled. in msvc2015, language extensions must enabled.

Android Image Picker Select multiple images from gallery with a maximum limit of 5 -

Image
i have app user needs able choose multiple pictures send them somewhere. however, can send 5 images @ time. need able limit number of images can pick gallery through image picker. to put in single sentence: i want limit number of images/photos user can select in default image selector gallery . here code using image picker: intent chooseintent = new intent(intent.action_pick, mediastore.images.media.external_content_uri); chooseintent.putextra(intent.extra_allow_multiple, true); startactivityforresult(chooseintent, 2); it keeps track of how many images selected @ top default: is there way set maximum limit? have user able select 5 images. it keeps track of how many images selected @ top default: on particular device, perhaps. please understand there thousands of android device models, , manufacturers set own ui replace of stock apps. not assume devices show count in action bar. is there way set maximum limit? have user able select 5 images. not vi...

sql - Retrieve records falling within a daily time range across a given month -

my table contains fields store ticket sale date/time price i need on how select tickets sold between 8:00 , 12:00 pm on day-to-day basis entire month, without including sales between 12:01 pm , 10:00 pm. simple way deal events in given hours of day use datepart select * tickettable datepart(hh, saledatetime) between 8 , 11

delphi - How to draw string in GDI+ Graphics.DrawString that honors the underline chars when I use ampersand? -

i'm using gdi+ draw string not act windows drawtext when comes honoring & in front of char. draws & , not underlines next char. maybe there option turn on/off? please help. it difficult provide complete answer when cannot see code using critique problem might lie, or implementation of gdi+ api using. the best can provide references relevant documentation underlying gdi+ api's involved. first: drawstring , used draw text. second: stringformat object passed drawstring control aspects of rendering of supplied string. finally: hotkeyprefix enumeration used in stringformat object indicates how hot key prefixes (ampersands) handled. in case looking hotkeyprefixshow behaviour. (the current behaviour describe hotkeyprefixnone )

java - JPA pagination for different methods -

is possible implement pagination other method except findall(pageable) ? example, if have own method findbynameorage : public interface jpapersondao extends jparepository<person, long> { list<person> findbynameorage(string name, int age); } yes possible . page<person> findbynameorage(string name, int age,pageable pageable);

javascript - Toggling between two divs using Polymer -

i ran issue using polymer toggle through 2 divs, problem have is, want use polymer standard of toggling use: hidden?="{{toggleme}}" attribute on div , bind make function toggling or show/hide this: <div hidden?="{{divone}}">test</div> <div hidden?="{{divtwo}}">test2</div> <a on-tap="{{change}}">toggle</a> <script> polymer('componentname',{ change: function(){ this.divone = !this.divone; this.divtwo = !this.divtwo; } }) </script> this above show both , hide both together, want 1 displayed , other hidden, switching between 2 while starting 1 hidden , other active, , swapping states there. i tried no luck can't or use '!' on left hand side: !this.divone = this.divone; this.divtwo = !this.divtwo; thanks reading this.divone = !(this.divtwo = this.divone);

Scala Slick 3 Playframework -

kind of stuck trying port old php application scala, want: have nodes (model) this: id | parent_id now given node case class node(id: option[long], parentid: option[long]) private def filterquery(id: long): query[nodes, node, seq] = nodes.filter(_.id === id) override def find(id: long): future[option[node]] = { try db.run(filterquery(id).result.headoption) db.close } i want parents recursively, like: private def getallparents(node: node): list[node] = node.parentid match { case l:long => list(node) + getallparents(find(l)) case none => list(node) } of course doesn't work. the syntax not right. need add node list , call it's parent the recursive call wouldn't work because expects node gets future[option[node]], not sure how resolve either :( i remember doing haskell few years , functional style (huge) bit rusty. edit: see need have list parameter well... argh, i'm stuck -.- first, don't need include list parameter...

javascript - How to make lebel Invisible / Visible based on the Input given in the Search TextBox? -

Image
i'm searching names using text box auto fillable. when enter name other list of auto fillable one's, need display label dynamically "please enter valid name" that. if remove wrong entry in test box, label should invisible. <asp:textbox id="tbname" caption="enter name" runat="server"></asp:textbox> <asp:requiredfieldvalidator runat="server" id="uirequiredfieldvalidatorname" controltovalidate="tbname" /> <asp:button id="uibuttongo" runat="server" text="search" /> <asp:label id="uilabelsearch" runat="server"></asp:label> </p> please let me know possible ways one. thanks you should try in javascript. handle onchange event , check textbox value against auto fillable values. in code add tbname.properties.add("onchange","validatormethod(this);...

sql - MySQL checking a range of characters with char_length() not giving results -

select firstname , lastname , phone , balance customers balance > 0 , phone != '' , char_length(phone) > 10 , char_length(phone) < 11; this gives not results if select firstname , lastname , phone , balance access_ayyaz_test.customers balance > 0 , phone != '' , char_length(phone) > 10; or select firstname , lastname , phone , balance customers balance > 0 , phone != '' , char_length(phone) < 11; they give results on own not together. how can check range then? the queries select firstname , lastname , phone , balance access_ayyaz_test.customers balance > 0 , phone != '' , char_length(phone) > 10; and select firstname , lastname , phone , balance customers balance > 0 , phone != '' , char_length(phone) ...

ios - how to get the result in template matching code? -

i beginner computer vision .i working on project find match between 2 images using matchtemplate in ios.the problem facing finding way determine whether 2 images matching or not although matchtemplate working well.i thought of taking percentage of result matrix did not know how , not find way.also minmaxloc did not work me . if can me or give me idea really appreciate cause on desperate point now. here code: ` uiimage* image1 = [uiimage imagenamed:@"1.png"]; uiimage* image2 = [uiimage imagenamed:@"image002.png"]; // convert uiimage* cv::mat uiimagetomat(image1, matimage1); uiimagetomat(image2, matimage2); matimage1.resize(100 , 180); matimage2.resize(100 , 180); if (!matimage1.empty()) { // convert image grayscale //we can use bgra2gray : blue , green , red , alpha(opacity) cv::cvtcolor(matimage1, grayimage1, cv::color_bgra2gray ); cv::cvtcolor(matimage2, grayimage2, cv::color_bgra2gray); } /// create result matrix int result_col...

assembly - GCC incorrectly inlining function with asm block -

in process of porting code watcom gcc noticed incorrectly generated function, , couldn't figure out why happens. here minimal example: #include <stdio.h> bool installexceptionhandler(int exceptionno, void (*handler)()) { bool result; asm volatile ( "mov ax, 0x203 \n" "mov cx, cs \n" "int 0x31 \n" "sbb eax, eax \n" "not eax \n" : "=eax" (result) : "ebx" (exceptionno), "edx" (handler) : "cc", "cx" ); return result; } void exception13handler(){} main() { if (!installexceptionhandler(13, exception13handler)) { printf("success!"); return 0; } else { printf("failure."); return 1; } } at line 63 function installexceptionhandler() inlined, remains of asm block. code set input registers edx , eb...

Using Gradle, how can I print how long each task took to execute? -

right now, 1 of gradle targets run frequently, output looks this: :dataplanner:clean :common:clean :server:clean :simulator:clean :util:clean :util:compilejava :util:processresources up-to-date :util:classes :util:compiletestjava :util:processtestresources :util:testclasses :util:test :util:jar :common:compilejava :common:processresources up-to-date :common:classes :common:compiletestjava :common:processtestresources how more this? :dataplanner:clean took 2secs :common:clean took 2 secs :server:clean took 3 secs :simulator:clean took 4 secs :util:clean took 1 sec ... if it's not possible every task print duration upon completion, printing timestamp acceptable alternative. any ideas? modifying 1 of proposed solutions didn't work me, 1 did: gradle.taskgraph.beforetask { task task -> task.ext.setproperty("starttime", new java.util.date()) } gradle.taskgraph.aftertask { task task, taskstate state -> int secs = ( new java.util.date().gettime...

How do I programmatically build up the following Quotation Expression in F#? -

i have need access .net dictionary within quotation expression. following simplified version: let mutable dict:dictionary<string, float> = dictionary() dict.add("first", 1.0) dict.add("second", 2.0) let qe2 = <@ dict.["second"] @> the output of qe2 follows: val qe2 : quotations.expr<float> = propertyget (some (propertyget (none, dict, [])), item, [value ("second")]) all fine when can directly create quotation expression directly quoted code above. how achieve same thing building qe2 programmatically? i know need somehow use quotations.expr.propertyget twice in nested fashion don't know how obtain neccesary propertyinfo , methodinfo objects go doing that. the key know let dict declaration compiled property on static module class. here working sample. module quotationstest open microsoft.fsharp.quotations open system open system.collections.generic open system.reflection let mutable dict:d...

extjs - Ext.js - text fields losing focus while typing & become hidden by keyboard -

i made web app using ext.js & sencha cmd. works in desktop view & works in mobile view.... except text fields in form panel. when view on iphone & focus on text field, keyboard appears & page slides up, bringing field view. however, once type 1 letter, slides down & text fields covered keyboard, preventing user seeing typing. jumps & down stays down until focus on field. can find on line says shouldn't problem ios devices me. suggestions?

javascript - Generating a unique value for a header on each $http call -

i have large angularjs application , logging purposes, being tasked adding custom header of our http requests app contain a unique id each request. more valuable our api calls, of i'm aiming requests (getting templates, styles, etc.) i using provider decorator patch each of methods exposed $httpprovider (implementation based on this post ), attempt call id method each time 1 of $http methods runs, , add appropriate header: module.config([ '$provide', function ($provide) { $provide.decorator('$http', [ '$delegate', function adduniqueidheader($http) { var httpmethods = ['get', 'post', 'put', 'patch', 'delete']; /** * patched http factory function adds request id each time called. * @param {string} method - valid http method. * @return {function} function sets various request properties. */ function httpwithheader(method) { ...

ruby - Fetching employee signatures using Oauth2 without asking the user -

i administer google apps account. need retrieve email signatures employees in our domain in order display them in application we're working on. need programmatically on our servers, without interaction our employees. our codebase in ruby. i've gotten working using clientlogin ("google.com/accounts/clientlogin") our google apps administrator email address , password , parsing out token response , using make call " https://apps-apis.google.com/a/feeds/emailsettings/2.0/# {domain}/#{username}/signature". however, modern, non-deprecated way, read means using oauth2. problem i'm having can't find guide states how this. i've read python examples , code, have manual step enter url in browser , click button. also, aren't using python, it's not entirely straight forward port these examples on in first place because assume you're using other python libraries. is there clear explanation somewhere of how obtain authentication token goog...

python - How do I make grid axes invisible for a pandas dataframe hist()? -

here want do, histogram plots of columns of dataframe without grid axes. below code works, preferably i'd more elegant solution (such passing argument hist) %matplotlib inline import numpy np import pandas pd import matplotlib.pyplot plt x = np.asarray([50]*25+[30]*10) x2 = np.asarray([90]*10+[20]*25) x3 = np.asarray([10]*15+[70]*20) df = pd.dataframe(np.vstack([x, x2, x3]).t) def plot_hists(df, nbins=10, figsize=(8, 8), disable_axis_labels = true): plt.close('all') grid_of_ax_hists = df.hist(bins=nbins, figsize=figsize) if disable_axis_labels: row in grid_of_ax_hists: ax in row: ax.xaxis.set_visible(false) ax.yaxis.set_visible(false) plt.show() df.hist() plt.subplots() plot_hists(df, nbins=10, figsize=(8, 8), disable_axis_labels = true) even thread kinda old, i'd add working solution because i've had same issue. at least in pandas 0.18 df.hist() takes possible plot...

c++ - Docker Remote API JSON schema definition -

i have program communicates docker dameon remotely using rest api. receives information images, containers, repositories in json format. want translate rest api output json format c++ structures. json format takes form of key, value pair key string, value string, number, array, etc. i know if there standard schema definition docker json objects? thanks. first of all, there's official remote api documentation . however, since contains "only" example requests , no authoritative schema definitions, it's not you're looking for. there not seem be official json schema docker remote api. however, api responses directly generated corresponding go structs can find in single file in source code repository . for example, consider definition of container response type: // "/containers/json" type port struct { ip string privateport int publicport int type string } type container struct { id s...

amazon ec2 - AWS EC2 scp from private subnet instance to bastion -

i using jump server (bastion) connect private ec2 instance. connection successful, not able scp jar file private ec2 instance jump server location. command: [ec2-user@ip-xxx-xx-xx-x3 ~]$ scp x.jar ec2-user@xx.xxx .xx.xx5:/home/user result: "ssh: connect host xx.xxx.xx.xx5 port 22: connection timed out would highly appreciate input/suggestions fix this. do security group rules allow traffic bastion private instance, or bastion private? assume description you're copying private bastion? if rules 1 way have tried running reverse scp. so: scp ec2-user@ip-xxx:/path/to/file.jar ./file.jar

java - Cannot find dataSource, even though the dataSource is defined in context.xml -

i have following bean declared 1 particular dao method use different data source rest of project. @bean(name="kingsdatasource") public datasource kingsdatasource(){ jndidatasourcelookup jndi = new jndidatasourcelookup(); jndi.setresourceref(true); return jndi.getdatasource("datasource/kings"); here's use of bean. @resource(name="kingsdatasource") private datasource ds; here's context.xml (omitting user , password, have been verified correct, , have been throwing different error if wrong anyway.) have played putting in context.xml of server, having in 1 place , not other, , having in both places. <resource name="datasource/kings" auth="container" type="com.mysql.jdbc.jdbc2.optional.mysqldatasource" factory="org.apache.naming.factory.beanfactory" url="jdbc:mysql://kings/db_netlogs" /> the error name not found exception - caused by: ja...

javascript - How do I return the response from an asynchronous call? -

i have function foo makes ajax request. how can return response foo ? i tried return value success callback assigning response local variable inside function , return one, none of ways return response. function foo() { var result; $.ajax({ url: '...', success: function(response) { result = response; // return response; // <- tried 1 } }); return result; } var result = foo(); // ends being `undefined`. -> more general explanation of async behavior different examples, please see why variable unaltered after modify inside of function? - asynchronous code reference -> if understand problem, skip possible solutions below. the problem the a in ajax stands asynchronous . means sending request (or rather receiving response) taken out of normal execution flow. in example, $.ajax returns , next statement, return result; , executed before function passed success callback ca...