Posts

Showing posts from February, 2014

composer - command not found while installed in my project -

i have installed composer in project , i'm trying install packages e.g. swifmailer... , says "command not found"? have tried both via composer.json , via composer require swiftmailer/swiftmailer how can make work?? thanks

java - Not able to build a JSON object correctly using JSONObject -

i have following program building json object. not sure how build array of arrays using following program. pom.xml <dependency> <groupid>com.googlecode.json-simple</groupid> <artifactid>json-simple</artifactid> <version>1.1.1</version> </dependency> jsonobjectconverter.java public class jsonobjectconverter { private static final string store_id = "tmsus"; public static void main(string[] args) { system.out.println(print1()); } private static string print1() { jsonobject body = new jsonobject(); jsonarray events1 = new jsonarray(); events1.add(100l); events1.add(200l); jsonarray events2 = new jsonarray(); events2.add(300l); events2.add(400l); jsonarray eventlogs = new jsonarray(); eventlogs.add(events1); eventlogs.add(events2); body.put("storeid", store_id); body.put("

node.js - NodeJS Global, JSdom, Unit test -

this simple question: when use create dom jsdom: const dom = (html = '<!doctype html><body></body></html>') => { const domobject = new jsdom(html); const { window } = domobject; const { document } = (domobject).window; global.window = window; global.document = document; global.navigator = { useragent: 'jsdom', language: 'en' }; } module.exports = dom; and use on test such: import test 'tape'; import dom 'dom'; // create global dom dom(); and yet when test have document, window , navigator undefined in tests. it's strange, missing something? or making assumption on it's behavior. should approach differently? if how? thanks! and how it's done! http://airbnb.io/enzyme/docs/guides/jsdom.html worked beautifully, curious.

python - Converting a pyearth model -

i've create model pyearth , , i'd convert object format can translated other representations (for example c++ function). one approach parse str output of model.summary() : $ print(model.summary()) earth model ------------------------------------- basis function pruned coefficient ------------------------------------- (intercept) no 1.78778 h(x0-0.245279) no 1.73016 h(0.245279-x0) no -2.6705 h(x0-1.22149) no 0.31407 h(1.22149-x0) yes none ------------------------------------- mse: 12.2425, gcv: 12.2427, rsq: 0.3090, grsq: 0.3090 but lead float precision loss, , seems it'd fragile piece of logic. is there better way? looks there function pyearth.export.export_sympy() converts model sympy expression.

How do I convert an array of arrays into a multi-dimensional array in Python? -

i have numpy array (of length x) of arrays, of of same length (y), has type "object" , has dimension (x,). "convert" array of dimension (x, y) type of elements of member arrays ("float"). the way can see "manually" like [x x in my_array] is there better idiom accomplishing "conversion"? for example have like: array([array([ 0., 0., 1., 0., 0., 0., 0., 0., 0., 0.]), array([ 0., 1., 0., 0., 0., 0., 0., 0., 0., 0.]), array([ 0., 0., 1., 0., 0., 0., 0., 0., 0., 0.]), ..., array([ 0., 0., 0., 0., 0., 0., 0., 0., 0., 1.]), array([ 0., 0., 0., 0., 0., 0., 0., 1., 0., 0.]), array([ 0., 0., 0., 0., 0., 0., 0., 0., 0., 1.])], dtype=object) which has shape (x,) rather (x, 10). you can concatenate arrays on new axis. example: in [1]: a=np.array([1,2,3],dtype=object) ...: b=np.array([4,5,6],dtype=object) to make array of array

c# - System.Web.Caching.Cache Behavior -

my web application caching list of objects avoid having fetch them database on , over. on 1 page, list fetched cache , additional objects added list , displayed in data bound control. these additional objects not meant cached, still somehow. when use cache.get() method, supposed return object reference or copy of object? system.web.caching.cache in-memory cache. means the object references returned cache.get() call. when modify reference after modifing same object still in cache. you need manually clone operation not modify original object.

amazon web services - AWS IAM Policy - allow from IP Addresses AND allow Firehose -

i'm trying set es instance allows access couple of ip addresses, in addition allowing kinesis firehose iam role deliver data instance. i'm having trouble combining 2 policies though. each 1 works on own. ip address policy in place, can view es kibana, can't deliver data firehose. likewise firehose policy, can deliver data not query es. can me see error in constructing access policy? here's policy on es instance: "statement": [ { "effect": "allow", "principal": { "aws": "arn:aws:iam::iiiiiiiiiiii:role/firehose_delivery_role" }, "action": "es:*", "resource": "arn:aws:es:us-west-2:iiiiiiiiiiii:domain/es-test/*" }, { "sid": "1", "effect": "allow", "principal": { "aws": "*" }, "action": "es:*&qu

f# - Unable to open .Net Core solution using VS 20017 Preview 2 -

i unable open following solution using vs 20017 preview 2. within solution explorer, fsharp projects displayed incompatible. i have following version installed: microsoft visual studio community 2017 preview (2) version 15.3.0 preview 6.0 visualstudio.15.preview/15.3.0-pre.6.0+26724.1 microsoft .net framework version 4.7.02046 installed version: community the solution file following: microsoft visual studio solution file, format version 12.00 # visual studio 15 visualstudioversion = 15.0.26124.0 minimumvisualstudioversion = 15.0.26124.0 project("{6ec3ee1d-3c4e-46dd-8f32-0cc8e7565705}") = "nikeza.server", "nikeza.server/nikeza.server.fsproj", "{a608adda-8c89-4eb3-a739-d2bf5da7ce9e}" endproject project("{6ec3ee1d-3c4e-46dd-8f32-0cc8e7565705}") = "video-youtube", "video-youtube\video-youtube.fsproj", "{30d28c83-97b8-4fa5-8d99-ec27e4cff0e3}" endproject global globalsection(solutionconfigurat

java - ERROR: el operador no existe: numeric = character varying -

i call next query by: resultobject = em.createnativequery(sql) .setparameter(1, codentidad) .setparameter(2, nrolote) .getresultlist() ; ( codentidad , nrolote integer) , gives next error: internal exception: org.postgresql.util.psqlexception: error: el operador no existe: numeric = character varying hint: ningún operador coincide con el nombre y el tipo de los argumentos. puede ser necesario agregar conversiones explícitas de tipos. position: 4539 error code: 0 but when copy result query , replace "?" numbers , execute query in pgadim, works correctly. select c.nro_ci, c.nombre_completo, c.nro_operacion, c.moneda, c.nro_lote, c.faja_inform, c.cod_entidad, sum(c.saldo_operacion) saldo_operacion, sum(c.mto_capital) mto_capital, sum(c.val_int_adelantado) val_int_adelantado, sum(c.int_dia_pago) int_dia_pago, sum(c.monto_a_pagar) monto_a_pagar (select p.nro_documento nro_ci, p.nom_completo nombre_completo, c.op

ng-click function in angularjs factory -

i change variable in angularjs (1.x) factory click event. after pause button should appear. please me: the link ng-click: <li ng-click='navplaymusic()'> <a class="glyphicon glyphicon-play music-control"></a> </li> <li ng-show="musiccontrol.playtitle === true" ng-click='navpausemusic()'> <a class="glyphicon glyphicon-pause music-control"></a> </li> edit: the controller: music.controller('musiccontroller', function($scope, $rootscope, $location, musiccontrol) { ... $scope.musiccontrol = musiccontrol; $scope.navplaymusic = function() { musiccontrol.playmusic(); } ... }); the factory: music.factory('musiccontrol', function () { return { playtitle: false, }; this.playmusic = function() { return { playtitle: true }; }; }); you can try this factory: music.factory('musiccontrol', function() { var _flags =

Submenus in php and mysql directory style database -

i've been trying make menu submenus on each main item , sub_sub_menus on each sub menu through php , mysql. feel i'm there i'm new php , mysql i've come here help. have been searching hours answer, i've found examples of dropdown menus none this. not sure how add sql database here try add if requested. my php code below far. $result = mysqli_query($link, 'select * library parent_id =' . $parent_id = 0); $subresult = mysqli_query($link, 'select * library parent_id >'. $parent_id); if(mysqli_num_rows($result) > 0) { echo '<ul class="nav list">'; while($row = mysqli_fetch_array($result)) { echo '<li class="nav-item">'. '<a href="#">'.$row['mainfolder'] .'</a>'. '<ul class="dropdown-content nav">'

Why does this particular cin.get() statement not work in C++ when I input a char? -

this question has answer here: can explain me how code works?(program ask user input again if numeric value expected , user enters other input) 2 answers why call cin.clear() , cin.ignore() after reading input? 3 answers my problem i'm trying make menu part of program. there conditional statements input, , else statement supposed input invalid, , wait input (so let user know entered invalid). this relevant snippet, , tried: void main_menu() { int opt; system("cls"); std::cout << "main menu" << std::endl; std::cout << "\n\nwhat do?" << std::endl; std::cout << "1) fight" << std::endl; std::cout << "2) store" << std::endl; std::cout << "

angular - Async Validator, where api returns a 404 in case of false. Angular4 -

import { component, oninit } '@angular/core'; import { formgroup, formcontrol, validators, formarray } '@angular/forms'; import { aservice } "app/a/services/a.service"; import { subscription } 'rxjs/subscription'; import { observable } "rxjs/rx"; @component({ selector: 'app-a', templateurl: './a.component.html', styleurls: ['./a.component.css']}) export class acomponent implements oninit { constructor(private aservice: aservice) {} ngoninit() { this.addeditaform = new formgroup({ 'name': new formcontrol(null, [validators.required],this.validatenameasyn) }); validatenameasync(control: formcontrol): promise<any> | observable<any> { return observable.timer(500).switchmap(() => { return this.aservice .nameexists(control.value) .map(result => (result ? { nameexists: true } : null)); }); } aservice nameexists(name: string) { let url =

Using PHP's mktime() on fixed date -

so understand how use mktime() create date based on current date/time: date("y-m-d h:i:s", mktime(date("h"), date("i"), date("s"), date("m"), date("d"), date("y")+1 this creates date 1 year now. but how if wanted find out date 1 year ahead of fixed date? e.g. date 1 year in future of date 2017-10-01 23:59:59 you should use datetime class. nevertheless, answer question: $time = strtotime('27-07-2017'); $date = date( 'y-m-d h:i:s', mktime( date('h', $time), date('i', $time), date('s', $time), date('m', $time), date('d', $time), date('y', $time)+1 ) );

handle Link_to_remote in rails 5 -

i want move rails 2 5 link_to_remote not supported rails 5: <%= link_to_remote "add", :url=>{:action=>'fee_submission',:batch=>@batch,s_id=>@stud_id} in controller: def fee_submission # ..some code.. render :update |page| page.replace_html "fee", :partial => "fees" end view _fees.html.erb: <html> code </html> how can above code implemented in rails 5? probably can use remote: true in parameters option link_to here link more detail <%= link_to "add", fee_submission_controller_path, remote: true %>

javascript - remain same clicked checkbox result when page refreshing while highlighting table record -

Image
the following code written accomplish 2 function 1. highlight table record when checkbox clicked 2. keep results same eventhough page refreshed code neither table record highlighted or nor page keep result same when refreshed. posted same question earlier also, people suggest me on localstorage . tried also. knowledge poor couldn't understand explanation given completely. highly appreciated have submit university assignment <style> #cb3.highlight .label {background-color:yellow;} #cb2.highlight .label {background-color:green;} #cb1.highlight .label {background-color:red;} } </style> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script> array.prototype.remove = function() { var what, = arguments, l = a.length, ax; while (l && this.length) { = a[--l]; while ((ax = this.

enumeration - increment number in reddit python bot reply -

i'm trying make bot increments number every time mentions string. far can increment once , every other reply stays @ same number. declared @ 2017, reply 2018 when finds string. know small i'm missing cant figure out. for comment in r.subreddit('test').comments(limit = 500): mentions = 2017 if "string" in comment.body , comment.id not in comments_replied_to , comment.author != r.user.me(): mentions +=1 print ("string found!") , comment.id comment.reply(" delayed until year" + str(mentions)) print("replied comment") you're declaring mentions inside body of loop, meaning set 2017 on every iteration. also, print ("string found!") , comment.id should print("string found!", comment.id) .

Can't integrate Paypal API to PHP: Fatal error: Allowed memory size of 134217728 byte -

i got error: fatal error: allowed memory size of 134217728 bytes exhausted (tried allocate 262144 bytes) in c:\xampp\htdocs\paypaltest\vendor\paypal\rest-api-sdk-php\lib\paypal\common\paypalmodel.php on line 281 i have start.php file : <?php require 'vendor/autoload.php'; define('site_url', 'http://localhost:8080/paypaltest'); $paypal = new paypal\rest\apicontext(new paypal\auth\oauthtokencredential('key', 'secret')); ?> and checkout.php file: <?php require 'app/start.php'; use paypal\api\payer; use paypal\api\item; use paypal\api\itemlist; use paypal\api\details; use paypal\api\amount; use paypal\api\transaction; use paypal\api\redirecturls; use paypal\api\payment; if(isset($_post['item']) && isset($_post['price'])) { $item = $_post['item']; $price = $_post['price']; $shipping_fee = 2.0; $total = $price + $shipping_fee; $payer = new paye

php - laravel 5.4 use where in blade template -

what correct syntax write code in laravel 5.4 @foreach($productchuck $product $product->category_id = 1) //some date section @endforeach all want display product has category_id of 1 thanks in advance the correct syntax be: @foreach($productchuck->where('category_id', 1) $product) .... @endforeach assuming $productchuck collection. see this more information.

system verilog - How to send data over AXI Stream using Xiling VIP IP -

i'm trying use axi stream verification ip cannot figure out how use in slave mode. how can data out of agent: import axi4stream_vip_v1_0_1_pkg::*; import axis_vip_master_pkg::*; import axis_vip_slave_pkg::*; module shift_register_vip(); logic aclk; logic aresetn; logic [63:0] in_tdata; logic in_tvalid; logic in_tready; logic [23:0] out_tdata; logic out_tvalid; logic out_tready; axis_vip_master vip_master(.aclk(aclk), .aresetn(aresetn), .m_axis_tdata(in_tdata), .m_axis_tvalid(in_tvalid), .m_axis_tready(in_tready)); shift_register dut(.aclk(aclk), .aresetn(aresetn), .s_axis_data(in_tdata), .s_axis_valid(in_tvalid), .s_axis_ready(in_tready), .m_axis_data(out_tdata), .m_axis_valid(out_tvalid), .m_axis_ready(out_tready)); axis_vip_slave vip_slave(.aclk(aclk), .aresetn(aresetn), .s_axis_tdata(out_tdata), .s_axis_tvalid(out_tvalid), .s_axis_tready(out_tready)); initial aclk = 1; #5ns aclk <= ~aclk;

ionic2 - How to reverse observable list in real time Angular 2 -

i have problem when want reverse observable list after adding new item i used way reverse during first start import { pipe, pipetransform } '@angular/core'; @pipe({ name: 'reverse' }) export class reversepipe implements pipetransform { transform (value) { if(!value)return; return value.reverse(); } } in html <div *ngfor="let msg of (msgslist | async) | reverse"> but after adding new item, list shown picture [ list after adding ] also checked link [ is possible reverse firebase list? ] same results

How to active scalastyle rules in sonarqube 5.4? -

i install scalastyle plugin https://github.com/ncredinburgh/sonar-scalastyle . rules 36 active how active scalastyle rules in sonarqube 5.4? scalastyle rules

How to check time from internet using bash or python? -

this question has answer here: ntp client in python 5 answers python getting date online? 5 answers this should simple task, after 2 hours of searching , reading documents failed find way check date , time internet using bash or python without installing ntplib. i looking equivalent of pythons now() or bash $ date, using ntp (or other way) correct date , time internet. methods find (such ntpd) meant correct system time, not purpose. easy way correct time in python import time import os try: import ntplib client = ntplib.ntpclient() response = client.request('pool.ntp.org') os.system('date ' + time.strftime('%m%d%h%m%y.%s',time.localtime(response.tx_time))) except: print('could not sync time server.') print('

javascript - Y axis ticks with wrong rotation -

Image
i have d3 graph in x axis ticks this: the code segment doing following vis.append("svg:g") .attr("class", "x axis") .style({ 'stroke': 'black', 'fill': 'none', 'stroke-width': '1px' }) .attr("transform", "translate(0," + (height - margin.bottom) + ")") .call(xaxis) .selectall("text") .attr("y", 0) .attr("x", 9) .attr("dy", "0.35em") .attr("transform", "rotate(120)") .style("text-anchor", "start"); the thing labels not readable. example, "august" should start "a", not "t" in image i've at

jquery - Expected ), but I couldn't understand the syntax issue here -

Image
anybody plz find out issue here... selectedpanelids=""; var panelids='@model.srpanellist'; var arrpanellist =panelids.split('|'); for(var = 0;i<(arrpanellist.length)-1;i++) { var id = arrpanellist[i].split('~'); if (id[1] != @model.objectid) { selectedpanelids = selectedpanelids + id[1] +',' ; } } showing expected ), couldn't understand issue. looks have syntax error. you have @model.objectid want wrap in quotes. so if statement like: if (id[1] != '@model.objectid') { // ...

c++ - macOS Clang C++17 filesystem header not found -

i need write program using (experimental) c++17 filesystem library clang on mac (macos 10.12.03) doesn't seem have filesystem header included. since i'm required use c++17 , cannot use alternatives boost library. when try compile sample program includes filesystem , iostream (and writes cout ) #include <filesystem> #include <iostream> using namespace std; int main(){ cout << "test" << endl; } i following error message: >clang test.cpp -std=c++1z test.cpp:2:10: fatal error: 'filesystem' file not found #include <filesystem> ^ 1 error generated. when try same using gcc 6.3 (installed via homebrew) get: >gcc-6 test.cpp -std=c++17 test.cpp:2:22: fatal error: filesystem: no such file or directory #include <filesystem> ^ compilation terminated. i tried using experimental/filesystem instead compiles using gcc seems try compile ios leading error seems related ios

ios - What is a good way to display a spinner at the bottom of a tableview when a user scrolls, but the tableview cells load slowly? -

Image
i have uitableview displays content. when user scrolls upward, cells below don't load immediately. creates area of white space @ bottom of table. display spinner in white space , have disappear when content done loading, i'm not sure how go doing this. way implement in swift? i new coding , ios, please forgive me if question vague or answer obvious. sample screenshot : i think it's helpful you.. func tableview(_ tableview: uitableview, willdisplay cell: uitableviewcell, forrowat indexpath: indexpath) { let lastsectionindex = tableview.numberofsections - 1 let lastrowindex = tableview.numberofrows(insection: lastsectionindex) - 1 if indexpath.section == lastsectionindex && indexpath.row == lastrowindex { // print("this last cell") let spinner = uiactivityindicatorview(activityindicatorstyle: .red) spinner.startanimating() spinner.frame = cgrect(x: cgfloat(0), y: cgfloat(0), width: tableview.b

oracle - SQL - Update last occurrence with select in clause -

in oracle, update on table last occurrence based on select in list, : update table t1 set t1.fielda = 0 t1.id in ( select t2.id, max(t2.timestamp) table t2 t2.id in (1111,2222,33333) group t2.id ); this query not works, received error "too many values". ideas? thanks i believe oracle supports multiple columns in, try: update table t1 set t1.fielda = 0 (t1.id,t1.timestamp) in ( select t2.id, max(t2.timestamp) table t2 t2.id in (1111,2222,33333) group t2.id ); essentially if you're providing subquery right side of in has result set 2 columns, have provide names of both columns in brackets on left side of in incidentally, i've never liked updating based on max value if requirement 1 row updated, 2 rows same max value both updated. kind of query better: update table set fielda=0 rowid in( select rowid ( select rowid, row_number() over(partition id order timestamp desc ) rown table ) rown=1) if, however, primary k

javascript - EJs to HTML, nodejs, webpack -

webpack config: { entry: { filename: "./test/output.ejs" }, module: { loaders: [ { test: /\.ejs$/, loader: 'ejs-loader' } ] }, output: { filename: "./test/output.html" } } my ejs content lorem ipsum text my output html created, content of not html code, begins this: /******/ (function(modules) { // webpackbootstrap /******/ // module cache /******/ var installedmodules = {}; /******/ /******/ // require function /******/ function __webpack_require__(moduleid) { how can return html code? i can't promise try instead npm install ejs-compiled-loader and change config module: { loaders: [ {test: /\.ejs$/, loader: 'ejs-compiled?htmlmin'} // enable here ] }, 'ejs-compiled-loader': { 'htmlmin': true, // or enable here 'htmlminoptions': { removecomments: true }

office365 - In an Office Add-in developed using Office.js for Office Online, where is the process hosting the office application? -

i have read entire vsto documentation start , skimmed on of office add-ins (office.js) documentation on msdn not found answer question. could please provide me answer , also, if possible, please point me page on msdn answers question? question in scenario client computer not have microsoft office installed, , using browser access office online, , loads office add-in written using office.js, in such scenario, computer hosts com objects , office process reside in? here understanding of elements involved in using office.js add-ins: there's open xml document has data. dead-meat. had loaded process. earlier, that process used unmanaged winword.exe (or excel.exe or powerpnt.exe or office application) process. now, office.js, when using office online, i.e. web client, unmanaged office process still has allocated in memory in computer ? basically, that's core of question. my guess has to, , process may run remotely on server. document may hosted remotely, isn'

python 3.x - Tensorflow reset or clear collection -

in tensorflow, find api tf.add_to_collcetion add value collection code bellow. def accuracy_rate(logits, labels): correct = tf.nn.in_top_k(logits, labels, 1) # return accuracy of true entries. accuracy = tf.reduce_mean(tf.cast(correct, tf.float32)) return accuracy tf.session() sess: logits, labels = ... accuracy = accuracy_rate(logits, labels) tf.add_to_collection('total_accuracy', sess.run(accuracy)) what can't find in api that, how can clear values i've stored in 1 collection? is tf.reset_default_graph looking for? https://www.tensorflow.org/api_docs/python/tf/reset_default_graph

codeigniter - modal popup in javascript -

i have checkbox, inside modal popup div.i want check box value when checkbox checked , want place value div outside modal popup box.please me find solution. please find code below <div class="container"> <div id="test"></div> <h2>modal popup</h2> <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#mymodal">open modal</button> <div class="modal fade" id="mymodal" role="dialog"> <div class="modal-body"> <input type="checkbox" class="ck " id="mealstotal" value="12"> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">close</button> </div> </div> &

xamarin - Can I use C# code to add a call to a command instead of a <Grid.GestureRecognizers>? -

i have code: <viewcell x:name="co"> <grid verticaloptions="centerandexpand" padding="20, 0"> <grid.gesturerecognizers> <tapgesturerecognizer command="{binding openpickercommand}" commandparameter="{x:reference copicker}" numberoftapsrequired="1" /> </grid.gesturerecognizers> <picker x:name="copicker" isvisible="false" horizontaloptions="end" selectedindexchanged="copickerselectedindexchanged" itemssource="{binding order}"></picker> <label x:name="colabel" horizontaloptions="end"/> </grid> </viewcell> is there way can in c# connect command tapping of cell rather have use xaml <grid.gesturerecognizers> ? adding gesturerecognizer viewcell big no-no. viewcell exists within listview or tableview have more enough tapped options of own. addi

windows - java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty -

i have added certificate in keystore, , trying connect email exchange server using java code. when connect throws exception. the same thing works fine when execute same java code in eclipse fails when execute same service fails. here code: public static void getemailconnection(string folder){ try{ store store = null; properties properties = system.getproperties(); folder emailfolder = null; final string ssl_factory = "javax.net.ssl.sslsocketfactory"; string host = "host name"; string username = "username";// change accordingly string password = "password";// change accordingly string mailstoretype = "pop3"; string port = "1234"; //set manual properties properties.setproperty("mail.pop3.socketfactory.class", ssl_factory); properties.setproperty("mail.pop3.socketfactory.fallback", "false"); properties.setproperty("mail.pop3.socke

access spring model attribute in javascript with variable -

i added attribute 'workplacegroups' spring model, list. later try accsess on 1 object in list given index. access works if .get(0) use variable int .get(i) but error. can tell me why got error or how can use variable int i? answers. <script th:inline="javascript"> function printtest(i){ var test = [[${workplacegroups.get(0).getid()}]]; //works var test2 = [[${workplacegroups.get(i).getid()}]]; //doesn't work } </script>

javascript - Capitalizing values -

i'm going have apologize how simple question going be. literally on chapter 2 trying learn javascript, , preparing myself come. my questions refers chapter 2 of eloquent javascript's section on variables. in websites js sandbox uses example: var luigisdebt = 140; luigisdebt = luigisdebt - 35; console.log(luigisdebt); // → 105 105 got no problem! test around bit more: var luigisdebt = 140; luigisdebt = luigisdebt - 35; luigisdebt = luigisdebt - 5 console.log(luigisdebt); 100 however if mess around capitalization this: var luigisdebt = 140; luigisdebt = luigisdebt - 35; luigisdebt = luigisdebt - 5 console.log(luigisdebt); 95 my output becomes incorrect 95, instead of correct 100. thanks other posts i've learned camelcase , constructer functions , pascalcase . still can't figure out why output changes upper , lower case? luigisdebt not defined in code, should answer 105. define before using it.

python 2.7 - Changing the video frame quality(compress) in to JPEG and rendering -

i'm totally new opencv library , i'm implementing simple client server application using opencv , python. here client captures video webcam , sends server. need compress video frame in order reduce bandwidth usage. find can save frame in jpeg loosy compression technique. using provided method have write frame , jpeg image. need without writing image rendering low quality(compressed frame). i'm doing writing jpeg , reading again. 2 io cycles per single frame not efficient @ all. can suggest better solution? cv2.imwrite('imagename.jpg', frame, [int(cv2.imwrite_jpeg_quality), 90]) newframe=cv2.imread('imagename.jpg') cv2.imshow('preview',newframe); (frame= current image frame captured, newframe=loading saved image in programme)

jsp - java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String in Struts' logic:equal tag -

i have error when iwant acces jsp page . my bean: public class bechildren implements serializable { ... private string isfilledchildren; .... /** * @param isfilledchildrenthe isfilledchildrento set */ public void setisfilledchildren( string isfilledchildren) { this.isfilledchildren= isfilledchildren; } public string getisfilledchildren( ) { if ( getnom( ) != null ) { return "true"; } else { return "false"; } } ... } error: 28/07/17-09:13:10,670 error org.apache.struts.taglib.tiles.inserttag - servletexception in '/pages/sub/dir/detail/body.jsp': javax.servlet.jsp.jspexception: invalid argument looking property: "bean.enfant.isfilledchildren" of bean: "sub/dir/detail" org.apache.jasper.jasperexception: javax.servlet.servletexception: javax.servlet.jsp.jspexception: invalid argument looking property: "bean.enfant

sorting - Sort sublists in a list, Python -

this question has answer here: python sort using key , lambda, lambda do? 1 answer python sort list using lambda function 1 answer i have following list in python upto n: l = [[x_1,y_1,h_1,w_1], [x_2,y_2,h_2,w_2], ..., [x_n,y_n,h_n,w_n]] and need sort in descending order respect sum of first , third elements in sublists (x_i , h_i) , first n sublists. i managed storing sums in new list, there efficient way sort without creating one? edit: sorry, duplicate question indeed. go below link , see full detail how sort in python sorting in python = sorted(l, key=lambda x: x[0] + x[2])

How to install OAuth (e.g. apache oltu) in order to use an API with Eclipse for Java -

i want use oauth able use api website. due limited programming experience, seem unable install apache oltu correctly. after 2 hours of searching posting question original question brought me apache maven , apache oltu: what need make 'import oauth.signpost.oauthconsumer;' command in eclipse java work? right giving me 'the import oauth cannot resolved.' error. tried downloading apache oltu package, unzipped , put in java folder not seem tell eclipse, there. i feel not specific right now, on other hand seems basic question. surely try respond can, if there information missing. thanks in advance helpful answer! peter :) did add jar in path. refer how import jar in eclipse it looks eclipse cannot find oauth package in path unable import package

Unable to see QConsole typeahead suggestions in MarkLogic -

i'm unable see typeahead suggestions in marklogic query console. similiar intellisense auto-complete functions/expressions. how enable typeahead suggestions? thanks. typeahead suggestions feature added in marklogic 9 - make sure you're running version.

git - Run Jenkins job when Pull request has been approved in GitHub? -

my project runs jenkins job upon each pull request. run after pull request has been approved @ least 2 people. currently i'm stuck @ web hook configurations. webhook works fine opening new pull request job, fails when new review added. web hook return back: error 400 hook should contain event type hook should contain event type i'm using below plugins jenkins: https://github.com/jenkinsci/github-api-plugin https://github.com/jenkinsci/github-plugin

How to add user to openstack project in keystoneclient api v3 using python -

i using openstack keystoneclient api v3 python bindings way add existing user project role. you can add user project role below: from keystoneauth1.identity import v3 keystoneauth1 import session keystoneclient.v3 import client # admin credentials auth_url = 'http://192.0.0.10:35357/v3' user_id = 'abd78a0b166e47eb8fe40381853f3d90' password = 'password' project_id = '5a56b817ec7342a9a6c0eea26f591621' auth = v3.password(auth_url=auth_url, user_id=user_id, password=password, project_id=project_id) sess = session.session(auth=auth) keystone = client.client(session=sess) # user, role , project details role_id = '7836dac8513745a6be2c9cf5df4640c9' user_id = '7b96131d69b141be8d8d6749ef0e0168' project_id = '121088df9f364c8a92541f969c971b3e' keystone.roles.grant(role_id, user_id, project_id) reference link - https://docs.openstack.org/python-keystoneclient/latest/api/keystoneclient.v3.html#module-keystoneclient.v3.r

oracle - Need to update 15 min every last column value -

Image
select route_desc, transit_time, to_timestamp(time_depart) + numtodsinterval(transit_time,'hour') "arrival", (to_timestamp(time_depart) +numtodsinterval(nvl(transit_time,0),'hour')) + interval '15' minute "dept" fe_jproute_ship_tmp trip_no='trp0000464' , guid='-1259520161' order seq_no; i want output this route_desc transit_time arraival dept ----------------------------------------------------------------- null null 25-jul-17 06.15.00.000000000 null 1 25-jul-17 07.15.00.000000000 25-jul-17 07.30.00.000000000 null 3 25-jul-17 10.30.00.000000000 25-jul-17 10.45.00.000000000 you need use cumulative sum() - rows between unbounded preceding , current row - default in oracle sum () on (order ) along nulls first clause. here s

How to get the difference in dates in SQL Server -

Image
i'm having trouble writing query difference between updatedate , creationdate of 2 records if id lowets , difference between recent , second recent updatedate. here's query: select a.id, a.requestid, b.krstatus, b.crdate , b.updatedate, datediff (hour, b.crdate, b.updatedate) timedifference, case when a.id = (select max(a.id) [dbo].[krdocs_hist] a.requestid = 1) 'yes' else 'no' end ismax, case when a.id = (select min(a.id) [dbo].[krdocs_hist] a.requestid = 1) 'yes' else 'no' end ismi [dbo].[krdocs_hist] a, [dbo].krdocs_details_hist b a.requestid = b.requestid , a.id = b.id , a.requestid = 1 order b.requestid here's current result: what i'd last possible record, check see if there existing 1 before it. if there wasn't compare updatedate , crdate (updatedate minus crdate. if there record before want updatedate minus previous updatedate. using query: select b.id, b.requestid, b.update

postgresql - How to use dynamic array of ids in raw query (rails + postgres)? -

i have code language.all.map{|l|[l.language, l.accounts.joins(:children).where("accounts.id in (?)", @accounts.ids).uniq.count]} i trying output [["eng", 5] ["span", 3] ["ital", 4] ... ] i want write raw query. i tried this, activerecord::base.connection.execute("select languages.language, (select count(*) accounts accounts.language_id = languages.id) languages").values but need pass accounts.ids dynamic.. this select languages.language, (select count(*) accounts accounts.language_id = languages.id , (accounts.id in (#{@accounts.ids})) languages" when tried pass accounts.id in #{@accounts.ids} getting error (accounts.id in ([2839, 284.. .. should have been in (2839, 284..) instead, taking array. how pass dynamically ? you can try: "... accounts.id in (#{@accounts.ids.join(',')})" hope helps.

sql - Access Query - Select count distinct per record on multiple tables -

i have query (concatenated inside vb string): select a.table_no tbl, count(b.table_no) total_call_count, avg(timevalue(c.service_time) * 86400) total_time table_button_link a, button_log b, service_time_log c b.table_no = c.table_no , format(b.transaction_datetime,""dd/mm/yyyy"") = '" & date.now.tostring("d") & "' " , b.type <> 2 , b.table_no = a.table_no , c.table_no = a.table_no group a.table_no i want count tbl_no table button_log returns this: |tbl_no | total_call_count | total_time | | 1 | 4661 | 7.2134 | | 2 | 5 | 3 | | 3 | 576 | 9.33333 | my desired output this: |tbl_no | total_call_count | total_time | | 1 | 5 | 7.2134 | | 2 | 1 | 3 | | 3 | 3 | 9.33333 | button_log looks this: | id | table_no | type | transaction_datetime | | 1 |