Posts

Showing posts from September, 2010

javascript - Convert timestamp to date using Angular 2 pipes -

i'm trying convert timestamp date format using angular 2 pipes, code follows: {{load.loaddate | date}} where loaddate attribute of load class, of type number. i weird results, example timestamp 1468251287 (which matches 11/7/2016) displayed "jan 18, 1970" . i know how can fix issue. as mentioned @perry need provide date in milliseconds. angular 2 reference date have: expression date object or number (milliseconds since utc epoch) or iso string so can be: {{load.loaddate * 1000 | date}}

java - Wicket JQuery AbstractFormDialog does not render RadioChoice of Enumeration -

i have dialog box form. form contains radio choice consisting of enum types. when dialog opens, single circle gets displayed. expected 3 circles names of enums. what's error in code? public class mynewdialog extends abstractformdialog { public mynewdialog( string id ) { super( id, "dialog title" ); form = new form( "dialogform" ); this.add( form ); radiochoice<gender> genders = new radiochoice<gender>( "list", getgenderlist(), new enumchoicerenderer<gender>( ) ); genders.setsuffix( " - " ); genders.setrequired( true ); form.add( genders ); } private list<gender> getgenderlist() { return arrays.aslist<gender>( gender.values() ); } //--- enum class "gender" public enum gender { male, female, family }; //--- html markup in file "mynewdialog.html" <html xmlns:wicket="org.apache.wicket"><body><wicket:panel> <form wicket:...

Golang: multidimensional string array instead of maps -

in project need read value global variable using maps (global variable) var url = make(map[string]string) and error "concurrent writes" assign value in function (cant assign global gives error non-declarative statement). url["test"] = "http://google.com" in php through multidimensioanl array , read value. there way use multidimensional array or maps in go assign , read in function? any appreciated. the concurrent writes error happens when go runtime detects concurrent writes map different goroutines. feature added in go1.6: https://blog.golang.org/go1.6 the runtime has added lightweight, best-effort detection of concurrent misuse of maps. always, if 1 goroutine writing map, no other goroutine should reading or writing map concurrently. if runtime detects condition, prints diagnosis , crashes program. best way find out more problem run under race detector, more reliably identify race , give more detail. you can initiali...

maximo anywhere - MaximoAnwhere-7.6 Android Apps Development -

Image
we developing maximoanwhere-7.6 android application using maximoanwhere server source code while trying login android environment can't able login , there no error. remove server code android environment , tried recreate , login successfully. want know below issues, how re-generate apps features plugin eg: map,barcode scanner ...etc while accesing workorder detail view workorder list view, there no response , keep on loading only. while checking logs android logcat getting following error, uncaught typeerror: win.doc.getcsscanvascontext not function note : getting above error of few screens. thanks the error "uncaught typeerror: win.doc.getcsscanvascontext not function" has been addressed in fix ibm. can find article on stackoverflow related same thing. can provide fix work around this. alleviate never-ending loading screen.

laravel - Stop PHP from rounding my numbers -

Image
i've created invoice creator keeps rounding numbers. how stop this? you see @ stukprijs = 206,61 , total 206 total needs 206,61 well. my code: public function makepdf(request $request){ $data = $request->all(); $data['totaal1'] = $data['stukprijs1'] * $data['aantal1']; i sent values form field post. the app build in laravel. you need both elements in multiplication floats if don't want php force round on result. $data['totaal1'] = floatval($data['stukprijs1']) * floatval($data['aantal1']);

how to covert Sql Query to linq -

anyone please convert following sql query linq select personrank, amount, (select sum(p2.amount) @personrank p2 p2.personrank <= p1.personrank) @personrank p1 order personrank try this var result = db.personrank(i => new { personrank = i.personrank, amount = i.amount, personranksum = (db.personrank .where(t => t.personrank <= i.personrank) .sum(t => t.amount) ) }).orderby(i => i.personrank);

android - Cordova Opening External URL with no Cache -

i have working web application trying open using cordova container, works fine far problem facing have clear cache of mobile application whenever there update on server. is there anyways can disable caching permanently view latest state of application.

javascript - return an object that show which element was clicked -

edit fact use closures , function important. gatherdata() , votesection() i want click div called submitbutton should tell me users have done. have 3 sections. voting section, review section, , type of voting section. point right i'm trying set first voting section. when click submitbutton should object looks {vote:down} or {vote:up} have 2 buttons in voting section. function gatherdata(){ var submitbutton = ".submitbutton"; var result = {} function votesection(){ $(".upbutton").click(function(){ // result.vote = "up" // console.log(result) ; $(this).data("clicked", true); $(this).siblings(".downbutton").data("clicked",false) }) $(".downbutton").click(function(){ $(this).data("clicked", true); $(this).siblings(".upbutton").data("clicked",false) // res...

uitableview - can't disable cell based on background color swift -

i making app uses different colored cells separate cells different categories, have function allows user tap on cells add checkmarks , select them. colored cells disabled when user taps on them don't add checkmark cell , select it. checkmark function: override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cellidentifier = "instrumenttablecell" let cell: instrumenttablecell! = tableview.dequeuereusablecellwithidentifier(identifier) as? instrumenttablecell checked = array(count:recipies.count, repeatedvalue:false) cell.configuratethecell(recipies[indexpath.row]) if !checked[indexpath.row] { cell.accessorytype = .none } else if checked[indexpath.row] { cell.accessorytype = .checkmark } return cell } try cell.userinteractionenabled = false .

matrix - Strassen Multiplication Algorithm StackOverFlow Error -

i working on implementing straussen's multiplication. below method multiplying them in divide , conquer approach. public static double[][] multiply(double[][] a, double[][] b) { int n = a.length; double[][] r = new double[n][n]; /** base case **/ //if (n == 1){ // r[0][0] = a[0][0] * b[0][0]; // } //else{ double[][] a11 = new double [n/2][n/2]; double[][] a12 = new double [n/2][n/2]; double[][] a21 = new double [n/2][n/2]; double[][] a22 = new double [n/2][n/2]; double[][] b11 = new double [n/2][n/2]; double[][] b12 = new double [n/2][n/2]; double[][] b21 = new double [n/2][n/2]; double[][] b22 = new double [n/2][n/2]; /** dividing matrix 4 halves **/ split(a, a11, 0 , 0); split(a, a12, 0 , n/2); split(a, a21, n/2, 0); split(a, a22,...

c# - cannot access property within the same class -

i'm having trouble understanding why part of code can't resolve part. i have class contains 2 properties. second property relies on first, keeps throwing error: cannot resolve symbol 'yearlyemployees' public class financials { public static ienumerable<salaryentity> yearlyemployees = factorymanagement(12345); //cannot resolve symbol 'yearlyemployees' public static ienumerable<companyentity> yearlygroup(ilist<yearlyemployees> allexempt) { } } i'm sure there's easy answer, can't find it. thanks! yearlyemployees variable name, not class name. try: public static ienumerable<companyentity> yearlygroup(ilist<salaryentity> allexempt)

Text doesnt appear in the input with iOS -

actually i'm working on responsive form , when i'm trying write ipad can acces input when write letters wont appear , have read lot people having more or less bug didn't find how fix ? <form id="formulaire" name="form1" method="get"> <input type="text" name="nom" size="1" id="l1" class="case" maxlength="1" style="text-align:center;border-color: #72978d;text-transform: capitalize;" /> <input type="text" name="nom" size="1" id="l2" class="case" maxlength="1"style="text-align:center;border-color: #72978d;text-transform: capitalize;"/> <input type="text" name="nom" size="1" id="l3" class="case"maxlength="0"style="text-align:center;border-color: #3d4142;background-color:#3d4142;pointer-events:none;text-tran...

google app engine - Objectify optionally load referenced attributes -

i have useraccount has list of followings. list of followings saved own entity. don't need following list and, thus, don't use @load. however, have situation load multiple useraccounts followings. so, need this: ofyservice.ofy().load().type(useraccount.class).limit(200).loadreference("followerref").list(); example useraccount: @entity @cache public class useraccount { @id private string email; @index private string nickname; private ref<userfollowing> followingref; } i believe objectify provides way after in form of load groups . rightly pointed out using @load annotation automatically retrieve useraccounts 's followingref don't want happen cases. in order load list of useraccount followingref first have apply following simple modifications entity: @entity public class useraccount { public static class {} @id long id; @load(everything.class) ref<userfollowing> followingref; } you can foll...

c# - MVC Razor Grid Losing Checkbox on Paging -

maybe has more scripting in dynamic htmlattribute dictionary, have gridmvc object paging , can store checkstate of checkbox outside object, when page (let's 1 6, go 1, it's not saving state of checkbox. i've got idea i'm trying working can't syntax correct yet. any ideas? <div> @html.grid(model.resulttable).columns(columns => { columns.add().encoded(false).sanitized(false).setwidth(30). rendervalueas(o => html.checkbox("checkrow" + model.resulttable.indexof(o), false, new { @onclick = "javascript:togglerowselect(" + model.resulttable.indexof(o) + ");", @(viewbag.selectedtxforreturn.tostring().contains(o.transaction_no.tostring()) ? "checked" : "")) })); //other columns redacted simplicity = work }).withpaging(10) </div> so line that's causing error is: @(viewbag.selectedtxforreturn.tostring().contains(...

javascript - Cross Site Scripting: Is restricting the use of < and > tags an effective way to reduce Cross Site Scripting? -

if want prevent xss, restricting input of special characters such < , > in text entry forms best way prevent it? i mean, prevent entry of html tags such <script> , <img> etc. , block xss. would agree? no. best way prevent ensure information output onto page appropriately encoded. some possible examples of why angle brackets (and other special character blocking) insufficient: https://security.stackexchange.com/questions/36629/cross-site-scripting-without-special-chars

javascript - how do i make the ball collide and bounce off my paddle -

im uni student having make kind of breakout clone in html. have ball bounce off rectangles ive drawn , paddle. problem im still new html , cant seem find solution works code have work off of. taking time read. var canvas = document.getelementbyid("pong"); var ctx = canvas.getcontext("2d"); var ball = { x: canvas.width / 2, //pixels y: canvas.height / 2, //pixels xspeed: 50, //pixels per second (you can cahnge this) yspeed: 40, //pixels per second (you can change this) radius: 10 //pixels } var paddle = { x: 100, //pixels y: canvas.height / 2, //pixels xspeed: 10, //pixels per second (you can increase this) yspeed: 10, //pixels per second (you can increase this) halfwidth: 10, //pixels halfheight: 40 //pixels } // todo: add data top, bottom, left , right rectangles var topwall = { x:0, y:0, width:800, height:10, area:800...

c++ - Multiple Inheritance from two derived classes with templates and constructors -

i'm following example here , using templates , calling constructor of 1 of derived classes. following code works without templates when included not sure why following error: : error: no matching function call ‘absinit<double>::absinit()’ notabstotal(int x) : absinit(x) {}; ^ here code: #include <iostream> using namespace std; template<typename t> class absbase { virtual void init() = 0; virtual void work() = 0; }; template<typename t> class absinit : public virtual absbase<t> { public: int n; absinit(int x) { n = x; } void init() { } }; template<typename t> class abswork : public virtual absbase<t> { void work() { } }; template<typename t> class notabstotal : public absinit<t>, public abswork<t> { public: t y; notabstotal(int x) : absinit(x) {}; }; // nothing, both should defined int main() { notabstotal<doub...

javascript - Directive is rendering HTML before a variable is given a value -

i running django 1.9 , angularjs 1.5. my django view looks this: #hello_world_view.py def hello_world(request): t = get_template('hello-world.html') return httpresponse(t.render()) the html file looks this: <-- loading javascript files above --> <helloworld><helloworld> the angularjs controller has promise retrieving data django rest api. looks this helloworld.controller('helloworldcontroller', function($scope, $helloworldservice1, $helloworldservice2) { promise.all([$hwservice1, $hwservice2]).then(function(response) { $scope.service1 = response[0]; $scope.service2 = response[1]; }); }); the directive looks this: // helloworld defined app. helloworld.directive('helloworlddirective', function() { return { restrict:'e', link: function($scope, $elements, $attributes) { $scope.$watch('somevariable', function(data) { ...

vectorise rows of a dataframe, apply vector function, return to original dataframe r -

given following df: a=c('a','b','c') b=c(1,2,5) c=c(2,3,4) d=c(2,1,6) df=data.frame(a,b,c,d) b c d 1 1 2 2 2 b 2 3 1 3 c 5 4 6 i'd apply function takes vector (and returns vector) cummax row row columns in position b d . then, i'd have output in df, either vector in new column of df, or replacing original data. i'd avoid writing for loop iterate every row, pull out content of cells vector, thing , put back. is there more efficient way? i've given apply family functions go, i'm struggling first way vectorise content of columns row , right output. the final output (imagining i've applied cummax() function). b c d 1 1 2 2 2 b 2 3 3 3 c 5 5 6 or b c d output 1 1 2 2 (1,2,2) 2 b 2 3 1 (2,3,3) 3 c 5 4 6 (5,5,6) where output vector. seems simple apply problem want cbind df: > cbind(df, apply(df[ , 4:2] # work columns in reverse order , 1, # row-by-row ...

scala - Spark joining DataFrames and aggregation -

this sort of contrived example, captures trying using spark/scala pet types val pets = array(row(1,"cat"),row(2,"dog")) val petsrdd = sc.parallelize(pets) val petschema = structtype(array(structfield("id",integertype),structfield("type",stringtype))) val petsdf = sqlcontext.createdataframe(petsrdd,petschema) pet names val petnames = array(row(1,1,"tigger","m"),row(2,1,"winston","m"),row(3,1,"snowball","f"),row(4,2,"spot","m"),row(5,2,"barf","m"),row(6,2,"snoppy","m")) val petnamesrdd = sc.parallelize(petnames) val petnameschema = structtype(array(structfield("id",integertype),structfield("pet_id",integertype),structfield("name",stringtype),structfield("gender",stringtype))) val petnamesdf = sqlcontext.createdataframe(petnamesrdd,petnameschema) from here can join dataframes .....

indexing - Examples of Python Objects That Have An __index__() method? -

what examples of python objects have __index__() method other int ? for example, hex documentation state: if x not python int object, has define __index__() method returns integer. this self-learning. mostly, these types mathematical libraries numpy or sympy . these libraries have own integer types (for reason), __index__ , special integers can used list indices or passed hex normal integers. in [9]: import sympy in [10]: x = sympy.integer(1) in [11]: x # looks regular 1, it's not. out[11]: 1 in [12]: x/2 # object has special behavior makes sense sympy... out[12]: 1/2 in [13]: [1, 2, 3][x] # can still use things indexing. out[13]: 2

Increase size of number field in html -

i trying increase box fit required placeholder text. if change input type "number" "text" works want use "number" can specify range. <form action="program3.php" method="post"> <p>distance (in miles): <input style="height:200px;font-size:14pt;"> <input type="number" name="distance" required size="100" min="300" max="600" required placeholder="enter number between 300 & 600"> set width css: <input type="number" name="distance" required style="width:20em" min="300" max="600" required placeholder="enter number between 300 & 600">

vb.net - handled is not a member of Eventargs -

i inherited vb.net code , newbie vb.net programmer old programming skills. this problem exists in many places after calling dialog box. after processing dialog, if enter key pressed on dialog instead of clicking ok, enter key logic processed on main form. undesirable , need display form. it looks "e.handled = true" may way clear key results, produces "handled not member of eventargs" error. can please recommend best way handle situation? thank you, brian private sub mnuabout_click(byval sender system.object, byval e system.eventargs) handles mnuabout.click try 'get menu off of screen cleanly application.doevents() dlgabout.showdialog() **e.handled = true** catch ex exception call moderrorhandler.errorprocedure(ex.gettype.name, me.name, ex.message, exceptionclassname(ex), exceptionmethodname(ex), exceptionlinenumber(ex)) end try end sub

android - Adding event with reminders to calendar using intent -

i've transferred data new activity -> hotellistadapter.java hotelpage.java i set log sure data have been transferred successfully. log working , show variables value , textview , imageview not display data (or variables )... this logcat: 07-25 20:57:33.214 4041-4041/ir.homa i/log: 2130903040 07-25 20:57:33.214 4041-4041/ir.homa i/log: هما - بندرعباس 07-25 20:57:33.214 4041-4041/ir.homa i/log: 187 07-25 20:57:33.214 4041-4041/ir.homa i/log: 0 this hotellistadapter.java : package ir.homa; import android.content.context; import android.content.intent; import android.support.v7.widget.popupmenu; import android.support.v7.widget.recyclerview; import android.view.layoutinflater; import android.view.menuinflater; import android.view.menuitem; import android.view.view; import android.view.viewgroup; import android.widget.imageview; import android.widget.relativelayout; import android.widget.textview; import andr...

sqlite - Can the LIKE statement be optimized to not do full table scans? -

i want subtree table tree path. the path column stores strings like: foo/ foo/bar/ foo/bar/baz/ if try select records start path: explain query plan select * f path "foo/%" it tells me table scanned, though path column indexed :( is there way make use index , not scan table? i found way achieve want closure table, it's harder maintain , writes extremely slow... to able use index in sqlite, the table column must have text affinity , i.e., have type of text or varchar or that; and the index must declared collate nocase (either directly, or because column has been declared collate nocase): > create table f(path text); > create index fi on f(path collate nocase); > explain query plan select * f path 'foo/%'; 0|0|0|search table f using covering index fi (path>? , path<?) the second restriction removed case_sensitive_like pragma , change behaviour of like. alternatively, 1 use case-sensitive comparison, replacing like...

java - is it an anti-pattern to use more than one method for sending information in a RESTful POST -

this so answer thoroughly goes through possible methods of passing , accessing parameters in restful post method. is anti-pattern use more 1 method? for instance consider following method passes json object in content body of post http method , uses path parameter anti-pattern? @post @path("/modifyperson/{idx}") @consumes(mediatype.application_json) public response modifyperson(person newperson, @pathparam("idx") int i) { // ... } i create richer class (e.g. personwithidx ) combines both person , idx integer parameter , pass instead no need resort path parameters. thing above code buys me obviates need create class. sound? is anti-pattern use more 1 method? no. for instance consider following method passes json object in content body of post http method , uses path parameter anti-pattern? no. if have large number of resources share same backing implementation, using uritemplate identify how messages consume particular http...

hadoop - SequenceFile as text CLI with custom class -

i have hdfs file in sequencefile format. key text , value custom serializable class (say) mycustomclass . want read file via hadoop fs -text command fails hadoop not know mycustomclass definition is. i tried hdfs dfs - text command got same response back. using hadoop2. is there way can specify class (through jar example, -cp myjar.jar option)? hadoop fs -libjars my-lib.jar -text output-dir/part-r-* this read in sequence file key/value pairs , call tostring() on both objects, tab separating them when outputting stdout. -libjars specifies hadoop can find custom key / value classes how-to-parse-customwritable-from-text-in-hadoop

mysql - how do I check whether user exists in db or not -

in rails application, have relationship setup such has user has_many :contacts , contacts of user stored in contacts when user.contacts contacts of current_user wanted check how many of user contacts registered meaning existing in users table. have solution in mind comparing of each contact of user db(users table). process time consuming looking more optimized way. assuming contact model has email attribute , user has email attribute. find number of users registered emails contacts of current_user , do: contact_emails = current_user.contacts.pluck("contacts.email") no_of_users_registered = user.where(email: contact_emails).count

c# - change BorderBrush on Focus of TextBox in XAML -

issue i have been trying change borderbrush of textbox on focus couple of days , not want work. i have written code people have suggested border seems change on 'right-click' of textbox , not on focus? here code have written: <textbox text="{binding serverurl, updatesourcetrigger=propertychanged}" padding="2" borderthickness="2" verticalalignment="stretch" grid.row="1" fontfamily="sans serif" foreground="#858585" fontsize="10px" fontweight="medium"> <textbox.resources> <style targettype="{x:type border}"> <setter property="cornerradius" value="2"/> </style> </textbox.resources> <textbox.style> <style targettype="{x:type textbox}"> <style.triggers> ...

active directory - How to Enable Inherent Permission of an OU to All Users via Powershell -

Image
some of members in ou have inheritance disabled. how can in powershell? gui window if helps trying ask... to automate button on screenshot, here's code, from there : function set-inheritance { param($objectpath) $acl = get-acl -path "ad:\$objectpath" if( $acl.areaccessrulesprotected ){ $acl.setaccessruleprotection( $false, $true ) set-acl -aclobject $acl -path "ad:\$objectpath" write-host "modified "$objectpath } #end if } #end function set-inheritance

tvos - How to edit video's info in Apple TV? -

Image
i try add basic information in videos under info box, don't know how add or update it? anyone knows how it? tvjs you can set metadata properties directly on mediaitem object instantiate. var mediaitem = new mediaitem("video", videourl); mediaitem.title = "my title"; mediaitem.subtitle = "my subtitle"; mediaitem.artworkimageurl = someurl; mediaitem.description = "my description"; for more information see here , here . avkit swift you should add externalmetadata avplayeritem . can add these 2 helper functions apple has provided in wwdc session: func metadataitem(identifier : string, value : protocol<nscopying, nsobjectprotocol>?) -> avmetadataitem? { if let actualvalue = value { let item = avmutablemetadataitem() item.value = actualvalue item.identifier = identifier item.extendedlanguagetag = "und" // undefined (wildcard) lan...

jquery - Long AJAX request in Rails returns `ERR_EMPTY_RESPONSE` on Nginx and Passenger -

i have rails 3 application kicks off ajax request html partial expensive, calculated values. speeds actual page load , allows expensive partial load happen after main page has loaded. this works fine under situations, taking anywhere 5 seconds 45 seconds complete. ajax request gets completed , partial gets plopped page expected. however, on of larger accounts have more data takes upwards of 70 or 80 seconds complete. in development no problem. takes while, when finishes, partial gets loaded onto page. in staging , cloned version of production minimal infrastructure (no haproxy load balancer , single, shared server both web , db), works fine. in production request not complete , instead returns err_empty_response . however, smaller accounts have less data, work fine. it's these larger accounts error returned. i have tried nailing down issue can't seem working. some things have tried without success: increase keepalive_timeout in nginx config. scale serve...

icons - Logo not appearing on splash screen of progressive web -

in these demos, there logos on splash screens. https://addyosmani.com/blog/getting-started-with-progressive-web-apps/ i don't know doing wrong in manifest - have icon not showing on splash screen. my manifest looks this: { "short_name": "weather service", "name": "weather service", "icons": [ { "src": "logo.png", "sizes": "144x144", "type": "image/png" } ], "start_url": "index.html", "display": "standalone", "orientation": "portrait", "background_color": "#fafafa", "theme_color": "#512da8" } do need more 1 image appear on splash screen? pwa recommend alway put icon @ 192px minimum if want ensure icon displayed consider 48dp minimum image size display, if take maximum density display supported (4x) 48 * 4...

How to use a custom icon in a dolphin smalltalk treeview? -

in dolphin smalltalk treeview i'd use custom icon, depending on state of item displayed, (differente state, different icon) how can ? i cannot understand how use "my" icon. i've create class "connection", instance variable "connected" , 2 class methods "connectedicon , unconnectedicon returns icon images. instance function "icon" returns 1 or other image based on connection state. i can add instances of class tree view , see name of connections. how show icons ? i tried sustitute getimageblock of presenter view following expression [:obj | obj icon] doesn't work. (nothing seems happen). this made in presenter initialize : initialize super initialize. treepresenter view getimageblock: [:obj | obj icon] what's wrong ? best regards maurizio when editing treeview, 1 of properties getimageblock. default not block object understands message #'value:' (the class iconiclistabstract). can repl...

php - Extract url with .swf in the end from string -

i want extract url ending .swf using php. example test test test http://website.com/example.swf i want url .swf i used function preg_replace() preg_replace('!http://[^?#]+\.(?:swf|swf)!ui','', $content); but extract url + words after url thanks.. after clarification on need think you. preg_match_all('#(?p<url>https?://[^\s]+\.swf) (?p<description>[^\n]+)#uid', $content, $results); $data = []; foreach($results['url'] $key => $value) { $data[] = [ 'url' => $value, 'description' => $results['description'][$key] ]; } // here can put code saving data want. // if need replace content urls <object> tag: $content = preg_replace('#(https?://[^\s]+\.swf)#uid', '<object src="$1"></object>', $content);

amazon web services - Is it possible to stub a file upload using the Ruby AWS SDK? -

going off found in aws developers guide , looking @ api docs looks should able stub upload_file natively. following not work , upload_file returns true client = aws::s3::client.new(stub_responses: true) client.stub_responses(:upload_file, false) resource = aws::s3::resource.new(client: client) obj = resource.bucket('foo').object('bar') obj.upload_file(tempfile.new('tmp')) #=> `true` when want `false` the api refers first argument of stub_responses operation_name . examples use operation named list_buckets , head_bucket cannot find list of operations acceptable. reading docs wrong or setting example wrong? workaround as work around i'm using rspec stub method. assuming same object in obj , above example needs following test pass allow(obj).to receive(:upload_file).and_return(false) after quick @ api docs pointed, best guess stub_response stubbing method calls go directly on client instance of aws::s3::client class. how...

c - How to ensure that floating-point variables entered with 2 decimal places retain their exact value -

is there way ensure floating-point variable entered user, having 2 decimal places after decimal point, retains exact value, rather losing precision? this example case: want round float 50 numbers after radix point, this before rounding = 0.70999997854232788085937500000000000000000000000000 to this: after rounding = 0.71000000000000000000000000000000000000000000000000 i became confused when wanted compare float number in condition this: == program start== input : 0.71 /* program logic */ if (input == 0.71) { printf("true !"); } else { printf("false !"); } output : false ! ==program end== the output false ! , false ! because true value of user's input 0.70999997854232788085937500000000000000000000000000 , , not 0.71000000000000000000000000000000000000000000000000 is there way round float value that? read potential inaccuracies floating point here: why floating point numbers inaccurate? and followe...

MDL grid on Desktop and Horizontal Scroller on Mobile -

i've started looking mdl ( https://getmdl.io ) , after reading article ( https://www.nngroup.com/articles/horizontal-scrolling/ ) decided it's bad idea use horizontal scrolling on desktop. what i'd achieve display grid on desktop cards overflow naturally, on mobile change display cards on single line , become horizontal scroller see in many mobile apps (e.g. google play movies). if not possible, please explain how can achieve horizontal scrolling on mobile. thanks in advance

range - excel vlookup lookup_range cell contains a formula -

i have straightforward formula in excel 2010 follows: =vlookup(d597,'sheet1'!$aa$3:$ac$5000,3,false) the problem lookup_range, d597 in case, contains formula, not text or numbers (it reference sheet , cell). the lookup returning #n/a . know value in named range, column aa, , value want in column 3. is there way use vlookup, or function, accomplish straightforward lookup? with friend, master joe, able pull value underlying d597 in above vlookup formula. solution: vlookup(value(trim(d597)),'sheet1'!$aa$3:$ac$5000,3,false)

c# - Read in all Groupchats from Skype -

i wondering if knows how can read in groupchats of currentuser using skype4com. codes reading in friends: foreach (skype4comlib.user myfriends in skype.friends) { listbox3.items.add(myfriends.handle); } and tried groups: foreach (skype4comlib.group chat in skype.groups) { listbox3.items.add(chat.tostring()); } but printed out: system.__com any ideas?

Is there anyway to escape strings consistently in Google Earth kml files? -

when creating kml content google earth, noticed discrepancy in how tries escape characters prevent javascript code execution. if characters inside <name></name> tags escaped twice html character codes e.g. " <script></script> " &#38;#60;script&#38;#62;&#38;#60;/script&#38;#62; display correctly <script></script> in side bar, in label placemarker, display &#60;script&#62;&#60;/script&#62; . preferable text escaped display same in both places. examples files , google earth representations have been added post. the first image shows string has been unescaped , can see in sidebar cuts off text in tag displays entire tag correctly in main window. can see javascript in tag has been executed in window. attached file unescaped.kml file opened in screen shot. link first image kml file used: <?xml version="1.0" encoding="utf-8"?> <!--the name of placemark escaped on ...

excel - Automatically copy data into a master sheet from multiple sheets in the same workbook -

i've searched topics answer following , have found several variations not quite i'm looking for. i'm brand new vba please excuse complete lack of knowledge , thank in advance provided. what have excel spreadsheet consists of 7 tabs. 6 tabs have data added them on daily basis , master tab having copy , paste daily updates to. so in need of ability type new data 6 data capture tabs , them automatically pull through onto next available row on master tab. have same column headings , need continuous method there hundreds of data entries on year. headings cell a1 ax1 first row need b2 ax2 , on. can code me? thank you p

Trying to exec Python script using PHP -

i'm trying exec python script using php, python seems dont work when exec php. i tryied code test $cmdresult = shell_exec("ls & /usr/local/bin/python2.7 --version & echo done"); returned: done license example.py when exec on console (shell): [root@local folder]# /usr/local/bin/python2.7 --version python 2.7.6 anyone have idea whats problem? aditional info: [root@local folder]# ls -all /usr/local/bin/py* -rwxr-xr-x 1 root apache 84 jul 21 21:53 /usr/local/bin/pydoc lrwxrwxrwx 1 root root 24 jul 21 21:43 /usr/local/bin/python -> /usr/local/bin/python2.7 -rwxrwxrwx 1 root apache 4669791 jul 21 21:53 /usr/local/bin/python2.7 -rwxr-xr-x 1 root apache 1674 jul 21 21:53 /usr/local/bin/python2.7-config in shell command try using && so: ls && /usr/local/bin/python2.7 --version && echo done so code read $cmdresult = shell_exec("ls && /usr/local/bin/python2.7 --version && ech...

functional programming - Array of literal Objects without duplicates in ES6 using Set -

the code array without repeated items has become elegant since es6 : [...new set(array)]; that's it! however, removing duplicates if array has elements primitive data type (string, boolean, number, ...). what set of object literals? how make work without getting duplicates, using syntax close syntax used above ? var array=["aaa","bbb","aaa","cc","aaa","bbb"]; var out=[...new set(array)]; console.log(out) //----literal object array=[{n:"j",last:"b"},{n:"j",last:"b"}]; out=[...new set(array)]; console.log(out) the code above produces set 2 elements, yet want have 1 in case. i use serialize/de-serialize methodology achieve this: [...new set(array.map( //-- serialize: (e) => `${e.n}:${e.last}` ))].map( //-- de-serialize: (e) => ({ n: `${e.split(':')[0]}`, last: `${e.split(':')[1]}` }) ) however, looking es6 ...

apache - Archiva Remote repository issue -

i trying add remote repository on archiva. however, keep getting this error in logs: error org.apache.cxf.jaxrs.utils.jaxrsutils [] - no message body writer has been found class org.apache.archiva.rest.services.archivaresterror , contenttype: text/plain i tried adding content type header text/plain did not work i've hit same problem after adding new remote repository archiva. from analysis conclude error thrown repositories don't expose index. example: when adding http://download.oracle.com/maven , oracle's maven repository receive artifacts, throw error you've added remote repository. trying access url via browser results in 404. however, direct queries this answered properly. so, guess archiva's inability cope such repositories.

javascript - Form Event Handling Pattern -

i using backend ideal send ajax post request rather using default action on forms. with in mind, need extract final fields selected in form. i have various text fields, radio buttons, checkboxes, etc. i've struggled gaining understanding of event delegation , event propagation. i'm not entirely sure if topic should worried trying achieve. i know can write code grabs of information in form placing id on each field , have function extract each value on id such as: function example(){ var field0 = $('#field0').val(); var field1 = $('#field1').parent().hasclass('active') // ... , more } i've used pattern while , don't feel efficient. i have 2 pattern idea, still not sure if "common practice" since not concerned data in each field until form submitted, run loop on of input based fields on form , extract contents, instead of assigning id each individual input field. i can listen changes on form (i not sure ho...

facebook - Providing "login_hint" on server side Azure Mobile App -

i using azure mobileserviceclient authenticate mobile app. want enable secure logout function, involves deleting cookies created web component. otherwise selecting "login" logged in if there's unexpired cookie lurking around. deleting cookies working great. unfortunately, means user returning same provider on same device has provide username again (clearly, don't want store password). i found out how make work google. (google openid doc) provide dictionary of parameters loginasync method. dictionary contains key "login_hint" , user's email address (which, btw, has valid work). this doesn't seem work facebook, microsoft or twitter accounts , don't know why. read document said "login_hint" or "username" supported convention, none of seems work. anyone have experience (even different approach) can share? tia. in order implement idp provided solutions that, need move client-flow authentication. clien...

java - Why isn't my PrintWriter writing out to by ByteArrayOutputStream? -

i have httpservletresponsewrapper overrides getoutputstream() simple bytearrayoutputstream . whenever pass wrapped response, nothing ever gets written bytearrayoutputstream . what doing wrong? the wrapper private static class responsewrapper extends httpservletresponsewrapper { private bytearrayoutputstream responsebytes; public responsewrapper(httpservletresponse response) { super(response); responsebytes = new bytearrayoutputstream(); } public byte[] getbytes() { return responsebytes.tobytearray(); } @override public servletoutputstream getoutputstream() { return new servletoutputstream() { private writelistener writelistener; @override public boolean isready() { return true; } @override public void setwritelistener(writelistener writelistener) { this.writelistener = writelistener; } @override public void write(int b) throws ioexception { ...