Posts

Showing posts from March, 2015

How can I create task in asana from setting asana to forward emails back -

i'm using asana forwarding email other website post email comments, method 1 can send email *elp@***.net , set asana forward email asana create new task i have made email school , belong school, wants student with@dewv.edu can send email asana, found out members when send emails, create under task, when other student send receive email.

java - JavaFX throws LoadException inside .fxml file -

i pretty new java have php , javascript background. i'm trying build interactive javafx application basic log in, data handling , log out - straight forward. at moment have stumbled upon problem not understand. develop on 2 different environments - @ home , @ work. started project @ home no issues installing jdk , intellij , setting project configuration. followed same steps on work computer (os x - same home computer) cannot run application intellij. fxml file: <?xml version="1.0" encoding="utf-8"?> <?language javascript?> <?import java.net.*?> <?import javafx.geometry.*?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <?import javafx.scene.text.*?> <gridpane fx:controller="carmanager.login.logincontroller" xmlns:fx="http://javafx.com/fxml" alignment="center" hgap="10" vgap="10" styleclass="root"> <padding> ...

laravel - php artisan make:controller throws: method controller doesnt exists -

i'm trying create controller on homestead install laravel. if try: php artisan make:controller test i get [badmethodcallexception] method controller not exist. php version 7, php artisan --version = 5.3 oh writing question discovered error in routes.php. corrected error fine...

python - How to view my local database name in Django -

i trying find local database name is, isn't directly stated in settings file. have listed. databases = { 'default': dj_database_url.config( default='sqlite:////{0}'.format(os.path.join(base_dir, 'db.sqlite3')) ) } i don't want change because bit freaked out change have. way through shell? your config should this: databases = { 'default': { 'engine': 'django.db.backends.sqlite3', 'name': os.path.join(base_dir, 'db.sqlite3'), } } as can see, database name db.sqlite3 .

php - Woocommerce How to get Order item meta in client side -

Image
based on order id how order item meta? used product add-ons plugin sending item meta data client side exact order item data need display on client side: $order = new wc_order($order_id); $customer = new wc_customer( $order_id ); based on order id need retrieve order item meta client side. you can if use woocommerce hook called woocommerce_after_order_itemmeta . i create custom example function show how work, if need more see link add_action( 'woocommerce_after_order_itemmeta', 'lt_order_meta_customized_display',10, 3 ); /** * @param $item_id * @param $item * @param $product product */ function lt_order_meta_customized_display( $item_id, $item, $product ) { /* * default key "$all_meta_data" can be: _qty,_tax_class,_line_tax,_line_tax_data,_variation_id,_product_id,_line_subtotal, _line_total,_line_subtotal_tax */ $all_meta_data = get_metadata( 'order_item', $item_id, "", "" ); ?...

javascript - How to reload the current Angular 2 Component -

how can reload same component again in angular 2? here code below: import { component, oninit, elementref, renderer } '@angular/core'; import { router, activatedroute, params } '@angular/router'; import { productmodel } '../_models/index'; import { categorylistservice } '../_services/index'; @component({ selector: 'app-product', templateurl: 'product.component.html', styleurls: ['product.component.css'] }) export class productcomponent implements oninit { uidproduct: productmodel; param: number; constructor( private elementref: elementref, private route: activatedroute, private router: router, private categorylistservice: categorylistservice) { } ngoninit() { this.route.params.subscribe(product => { console.log('logging sub product obj', product); }); this.uidproduct = json.parse(sessionstorage.getitem('product')); var s = document.createelement(...

css - Bootstrap select tag drop down align issue with ie9 -

Image
i have drop down alignment issue ie9 while using bootstrap "select" tag. need drop down should start @ bottom of box, ovelaping on it. select tag css editing reflecting on box no control on dropdown. how can fix issue. select::-ms-expand { display: none; } <select class=" form-control "> <option>select option 1</option> <option>select option 2</option> <option>select option 3</option> <option>select option 4</option> <option>select option 5</option> </select>

node.js - NodeJS and Express -- How to mock token authentication middleware for testing? -

i'm making rest api uses jwts authentication, test endpoints want mock middleware verifys jwts. i've defined middleware checking token: // middlewares/auth.js njwt = require('njwt'); nconf = require('nconf'); module.exports = { verifytoken: function(req, res, next) { // check header or url parameters or post parameters token var token = req.body.token || req.query.token || req.headers['x-access-token']; // decode token if (token) { // verifies secret , checks exp njwt.verify(token, nconf.get("auth:secret"), function(err, verifiedjwt) { if (err) { return res.json({ success: false, message: 'failed authenticate token.' }); } else { // if good, save request use in other routes req.userid = verifiedjwt.body.sub; next(); } }); } else { ...

java - Retreving the keys of Hashmap -

i trying retreive keys of hashmap i using hashmap follows hashmap<string, string> inner = new hashmap<string, string>(); hashmap<hashmap<string,string>, string> outer = new hashmap<hashmap<string,string>, string>(); i putting values in both hashmap follows: inner.put("1","one"); inner.put("2","two"); inner.put("3","three"); outer.put(inner,"outer1"); outer.put(inner,"outer2"); now want output 1 1 outer1 1 one outer2 2 two outer1 2 two outer2 3 three outer1 3 three outer2 but unable this. can please me solve this. edited code: hashmap<string, string> inner = new hashmap<>(); hashmap<string, string> inner1 = new hashmap<>(); hashmap<hashmap<string, string>, string> outer = new hashmap<>(); outer.put(inner, "outer1"); outer.put(inner1, "outer2"); in...

java - FIFO queue with circular list -

i have created queue implementation using single connection list.in code using 2 pointers (first,last) define start , end of queue. code : import java.io.printstream; import java.util.* /** * @author justin bieber */ public class stringqueueimpl<t> implements stringqueue { private int total; // number of elements on queue private node head; // beginning of queue private node tail; // end of queue private class node { t ele; node next; node(t ele) { this.ele = ele; next = null; } } /** * creates empty queue. */ public stringqueueimpl() { first = null; last = null; total = 0; } boolean isempty() { return (head == null); } public <t> void put(t ele) { node t = tail; tail = new node(ele); if (isempty()) head = tail; else t.next = tail; total++; } public t get() { if (isempty()) throw new nosuchelementexception(); t v = head.ele; node t = head.next; head = t; return v; ...

mysql - Is char or varchar better for a database with utf-8 encoding? -

i making table of users store info: username, password, etc. question is: better store usernames in varchar utf-8 encoded table or in char. asking because char 1 byte , utf-8 encodes 3 bytes characters , not know whether might lose data. possible use char in case or have use varchar? in general, rule use char encoding under following circumstances: you have short codes same length (think state abbreviations). sometimes when have short code might differ in length, can count characters on 1 hand. when powers-that-be have use char . when want demonstrate how padding spaces @ end of string causes unexpected behavior. in other cases, use varchar() . in practice, users of database don't expect bunch of spaces @ end of strings.

How does rails pass instance variable from controller to views? -

i created simple rails app in rails using scaffolding method restaurants . this show , edit controller method restaurants_controller.rb . notice how blank methods: # /restaurants/1 # /restaurants/1.json def show end # /restaurants/1/edit def edit end this restaurants/show.html.erb : <p id="notice"><%= notice %></p> <%= image_tag @restaurant.image_url %> <p> <strong>name:</strong> <%= @restaurant.name %> </p> <p> <strong>address:</strong> <%= @restaurant.address %> </p> ... and restaurants/edit.html.erb : <h1>editing restaurant</h1> <%= render 'form', restaurant: @restaurant %> <%= link_to 'show', @restaurant, class: "btn btn-link" %> | <%= link_to 'back', restaurants_path, class: "btn btn-link" %> here question: current understanding (could wrong) define instance variable, in...

json - Java - Does Google's GSON use constructors? -

i wondering when working on our project. gson api google use constructors json's want deserialize? example: i've got json string want convert employee object. employee object has constructor applies checks parameters (for example, it's id > 0). we're using code below deserialize json's. constructor called when deserializing json employee? link gson: https://github.com/google/gson edit: after experimenting break points figured out constructor not called. know way called anyway? /** * gson class create , de-serialize json objects. */ gson gson = new gson(); /** * convert json object. * @param json json convert. * @param cls class convert to. * @return converted json object. */ public object jsontoobject(string json, class<?> cls) { return gson.fromjson(json, cls); } libraries gson, jackson or java persistence api (jpa) use no-argument (default) construtor instantiate object , set fields via reflection. in newer versions of gs...

python - Why am I getting an index out of range in one place but not the other? -

def extendedstring(string1, string2): newstring = "" if len(string1) == len(string2): in range(0, len(string1)): newstring = newstring + string1[i] + string2[i] return newstring else: if len(string1) < len(string2): in range(0, len(string2)): string1 = string1 + string1[i - 1] in range(0, len(string1)): newstring = newstring + string1[i] + string2[i] return newstring else: in range(0, len(string1)): string2 = string2 + string2[i - 1] in range(0, len(string2)): newstring = newstring + string1[i] + string2[i] return newstring within first if statement use code: newstring = newstring + string1[i] + string2[i] and no index out of bounds error in else statement use exact same line of code on 12th line , index out of range error, why this? it may because in if...

Large GeoJSON not working w/ MapBox GL -

i've got mapbox gl js setup, won't load large (~75mb) geojson file. console not throw errors, nothing shows on map. file not work located here . the script has no issues smaller files such this one . loads , gets highlighted. my code simple (and works smaller datasets): map.addsource('plutodata', { type: 'geojson', data: 'http://173.254.28.39/~keggera1/reogeo/data/mnmappluto.geojson' }); map.addlayer({ id: 'pluto-fills', type: 'fill', source: 'plutodata', layout: {}, paint: { 'fill-color': '#627bc1', 'fill-opacity': 0.5 } }); i don't detect wrong geojson encoding , can't find size limitations in mapbox documentation. does know causing this? this data issue: if @ source of smaller file, pluto.geojson , you'll see: [-74.002537,40.733446],[-74.002543,40.733446],[-74.002547,40.733446], the...

Android Google Maps Custom Marker From Path -

i trying add custom marker map in android. trying add custom marker path using frompath(string mybus). map crashes after build it. ideas problem is? public void onmapready(googlemap googlemap) { mmap = googlemap; string mybus = "https://maps.google.com/mapfiles/kml/shapes/parking_lot_maps.png"; mmap.setmaptype(googlemap.map_type_hybrid); // add marker in sydney , move camera 93 latlng sydney = new latlng(41, -90); mmap.addmarker(new markeroptions().position(sydney).title("marker in sydney").icon(bitmapdescriptorfactory.frompath(mybus)));

Qt loading deleted/renamed file with Windows 10 -

i'm seeing weird behavior when running test install of qt program (tried using qt 5.5.1 , 7.0). haven't noticed issue when running in debug/development environment - see issue when installed "program files (x86)". the issue is: i'm using qdiriterator find database files within "qstandardpaths::datalocation" locations , loading them in via sqlite. phantom files located in program files (x86)//library/.ndat i'm seeing files previous install (which have been deleted) , ones have been renamed, deleted, still show , readable in program. these "phantom" files have been blocking loading of up-to-date file. it's strange - wonder if has seen issue? i'm running windows 10 home on ssd-based machine (if matters). same issue qt 5.5.1 , 5.7. i've replicated on different machine similar configuration. any ideas? here's summary of code: qstringlist standardpaths = qstandardpaths::locateall(qstandardpaths::datalocation, ...

c# - ASP.NET session state not being shared in Redis -

we planning migrate aspstate redis store session. installed redis msi package on 1 of servers , c# application hosted on different server. have multiple web applications within single application hosted in iis. the configuration both applications looks this: <sessionstate mode="custom" customprovider="mysessionstatestore" timeout="180"> <providers> <add name="mysessionstatestore" type="microsoft.web.redis.redissessionstateprovider" host="serverip" port="6379" accesskey="" ssl="false" /> </providers> </sessionstate> now problem session not being shared between applications. checked machine key , found same both applications.

osx - Python Import cv2 error in jupyter works on mac terminal -

Image
i having difficulty importing cv2 on jupyter notebook . however, when enter: import cv2 in mac terminal there no error. i referenced post 1 identify jupyter notebook refers python3.5 file path mac terminal import works fine refers python 2.7 file path. i entered below in jupyter notebook referenced in post 2 solve issue, i'm still getting error: import sys sys.path.append('/usr/local/lib/python2.7/site-packages') import cv2 any appreciated! i don't think can use module python 2.7 in python 3.5, you'll either have install cv2 in python3 environment or jupyter use python2

Fetching data from graphql with express-graphql and HTTP client -

im having difficulty making http fetch request on standard apollo graphql-server-express i've tried following guidance on graphql.org no avail. just test this, using fusetools news feed example , switching out fetch call call apollo-server using standard http: ``` fetch('https://localhost:8080/graphql', { "method": 'post', "headers": { "content-type": "application/graphql", "accept": "application/json"}, "body": {"query": "{ places { id name address city }" } }) .then(function(response) { return response.json; }) .then(function(responseobject) { data.value = responseobject; }); ``` this full code with returned fields changed. ``` <dockpanel> <javascript> var observable = require("fusejs/observable"); var data = observable(); ...

python - tensorflow making an op for gpu usage -- demo app doesn't work -

i'm using tensorflow , after creating following files error below. suspect i'm supplying wrong kind of input, don't know how change proper representation. dijkstra.py : self.maze = tf.variable(tf.zeros([64], dtype=tf.int32), name="grid") print self.maze if true : self.grid_module = tf.load_op_library('d_grid_gpu.so') tf.session('') sess: sess.run(tf.initialize_all_variables()) self.output = self.grid_module.grid_gpu( self.maze ).eval() d_grid_gpu.cc : #include "tensorflow/core/framework/op.h" #include "tensorflow/core/framework/op_kernel.h" using namespace tensorflow; register_op("gridgpu").input("grid: int32").output("prev: int32"); void run( int * in); class dgridgpuop : public opkernel { public: explicit dgridgpuop(opkernelconstruction* context) :...

c - Too many arguments for format [-Wformat-extra-args] -

fprintf(fptr2,"\n\n:%s",ctime(&t),"\t ","\t"); this line works fine in dev not in ubuntu generating following error warning: many arguments format [-wformat-extra-args] fprintf(fptr2,"\n\n:%s",ctime(&t),"\t ","\t"); ^ what should do? fprintf takes variable number of arguments: a file* output stream a format string one arguments each % format, preceded optional width and/or precision if these specified * . you should have 1 argument, string %s format. the arguments "\t" , "\t" ignored, compiler gives diagnostic presence indicates programming error. such warnings blessing prevent many silly bugs, typos argument type mismatches. dev environment configured stay quiet these, disadvantage. fix it: add compiler options such -wall -w or -weverything .

arules - R - Remove itemsets - ECLAT Algorithm -

Image
i'm trying analyze associations on products. r code is: library(arules) library(arulesviz) library(igraph) library(iplots) data <- read.transactions('file', sep=',') itemsets <- eclat(data, parameter = list(supp = 0.1, maxlen = 15)) plot(itemsets, method="graph", control=list(type="items")) this code executing i'm getting products haven't associations shown image below: there exists way remove ids map? these itemsets single item. can call eclat parameters = list(minlen = 2) . see ? eclat more details.

html - Bootstrap Navbar shows in very weird form -

Image
i run ruby on rails 5 , use bootstrap gem. issue having when put html in 1 of partials have weird looking 'nav-bar'. <html><head> <title>app</title> <link rel="stylesheet" media="all" href="/assets/application.self-09a09de7df140e59268bd2c94d4ba54f4e8477100ad6ca7894899b63e99bf8c7.css?body=1" data-turbolinks-track="reload"> <script src="/assets/jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1" data-turbolinks-track="reload"></script> <script src="/assets/tether/tether.self-49a614f96d3d9b228d4f800376a8db0a8315c1f10eb759f66a528112980505de.js?body=1" data-turbolinks-track="reload"></script> <script src="/assets/tether.self-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.js?body=1" data-turbolinks-track="reload"></script> <script src="/asse...

testing - Citrus framework flightbooking -

i trying implement flightbooking-sample using citursframwork ,the link : https://github.com/christophd/citrus-samples/tree/master/sample-flightbooking and still new framework , steps did are(using mac os) : 1-run activemq 2-run jetty:run sample-bakery . 3-using intllijidea open sample-bakery , run test case . every time test case failed , got following : actiontimeoutexception: action timeout while receiving message channel 'royalairlineserver.inbound' @ com/consol/citrus/samples/flightbooking/flightbookingit(receive:57-90) 4-i tried change timeout still same error . please can explain me timeout , , wrong in steps ? note:only 1 time using terminal test case pass using : mvn clean install -dembedded=true you mixing different sample projects here. start infrastructure of bakery sample while executing tests of flightbooking sample. both samples work totally different endpoints , domains. please stay within sample project when starting infra...

Binary Search Tree To List Scheme -

i having trouble understanding how take in bst , convert list without using append or advanced techniques. example, given bst each node having number , name (sorted string smallest largest) , want output list, in order, of items in bst value of 3 or along these lines. i understand can done recursively think biggest problem understanding has splitting of left , right nodes, because using recursion on both of these somehow have put them in final list. any in understanding appreciated, thank in advance. the short answer question is: you're right, need append . news is, (if you're doing assignment), can implement own append . if you're not doing part of assignment... use append directly!

javascript - how to decode following code -

how convert following code original lenguage eval(function(_0x904fx1, _0x904fx2, _0x904fx3, _0x904fx4, _0x904fx5, _0x904fx6) { _0x904fx5 = function(_0x904fx3) { return _0x904fx3.tostring(_0x904fx2); }; if (!_0x2a81[5][_0x2a81[4]](/^/, string)) { while (_0x904fx3--) { _0x904fx6[_0x904fx5(_0x904fx3)] = _0x904fx4[_0x904fx3] || _0x904fx5(_0x904fx3); }; _0x904fx4 = [function(_0x904fx5) { return _0x904fx6[_0x904fx5]; }]; _0x904fx5 = function() { return _0x2a81[6]; }; _0x904fx3 = 1; }; while (_0x904fx3--) { if (_0x904fx4[_0x904fx3]) { _0x904fx1 = _0x904fx1[_0x2a81[4]](new regexp(_0x2a81[7] + _0x904fx5(_0x904fx3) + _0x2a81[7], _0x2a81[8]), _0x904fx4[_0x904fx3]); }; }; return _0x904fx1; }(_0x2a81[0], 32, 32, _0x2a81[3][_0x2a81[2]](_0x2a81[1]), 0, {})); without original code can't tell does. however, way check outputted sou...

r - How to reshape data from long to wide format? -

i'm having trouble rearranging following data frame: set.seed(45) dat1 <- data.frame( name = rep(c("firstname", "secondname"), each=4), numbers = rep(1:4, 2), value = rnorm(8) ) dat1 name numbers value 1 firstname 1 0.3407997 2 firstname 2 -0.7033403 3 firstname 3 -0.3795377 4 firstname 4 -0.7460474 5 secondname 1 -0.8981073 6 secondname 2 -0.3347941 7 secondname 3 -0.5013782 8 secondname 4 -0.1745357 i want reshape each unique "name" variable rowname, "values" observations along row , "numbers" colnames. sort of this: name 1 2 3 4 1 firstname 0.3407997 -0.7033403 -0.3795377 -0.7460474 5 secondname -0.8981073 -0.3347941 -0.5013782 -0.1745357 i've looked @ melt , cast , few other things, none seem job. using reshape function: reshape(dat1, idvar = "name", timevar = ...

PHP get cell content -

i want retrieve php contents of table cell file. code, retrieve contents of all cells of row . $url = 'folder/mypage.php'; $content = file_get_contents($url); $first_step = explode('<tr id="foo">' , $content ); $second_step = explode('</tr>' , $first_step[1] ); echo $second_step[0]; how retrieve particular cell ? (the second, example...) $url = 'folder/mypage.php'; $content = file_get_contents($url); //ugly code !...doesn't work ! $first_step = explode('<tr id="foo"><td[1]' , $content ); $second_step = explode('</td></tr>' , $first_step[1] ); echo $second_step[0]; thanks.nicolas. i have found solution !! second explode </td> , not </tr> : $url = 'folder/mypage.php'; $content = file_get_contents($url); $first_step = explode('<tr id="' . $ref . '">' , $content ); $second_step = explode('</td>...

Trying to get Rust to load files -

i'm having trouble trying rust load files in subdirectories. rust treats files modules , code part of module, i'm used ruby's way of treating files , directories separate code contain. src/main.rs mod lib { pub mod manifest; } src/lib/manifest.rs mod structs { pub mod entity; } src/lib/structs/entity.rs pub struct entity { type: string } the error is: error: cannot declare new module @ location --> src/lib/manifest.rs:2:13 | 2 | pub mod entity; | ^^^^^^ | note: maybe move module `structs` own directory via `structs/mod.rs` --> src/lib/manifest.rs:2:13 | 2 | pub mod entity; | ^^^^^^ note: ... or maybe `use` module `entity` instead of possibly redeclaring --> src/lib/manifest.rs:2:13 | 2 | pub mod entity; | ^^^^^^ the best way fix rename manifest file mod.rs , change first line in main.rs to: mod lib; and change mod.rs to: pub mod structs { mod entit...

Android post values to MySQL with PHP -

Image
this question has answer here: php parse/syntax errors; , how solve them? 11 answers i work on android project, in use asynctask send namevaluepairs webservice. use php code below send data application database: <?php require_once('dbconnect.php'); $studentid = $_post['name']; $classid = $_post['classid'] $studentid = $_post['studentid']; $start = $_post['start']; $end = $_post['end']; $startsig = $_post['startsig']; $endsig = $_post['endsig']; $sql = "insert signature (studentid,classid,start,end,startsig,endsig) values ('$studentid','$classid','$start','$end','$startsig','$endsig')"; if(mysqli_query($con,$sql)){ echo 'success'; } else{ echo 'failure'; } mysqli_close($con); ?> valu...

node.js - Using Node-Js as message passing layer -

is (client) node-js http request <-----------> node-js http listen (server) ^ 100/1000 mbit/s ^ | lan | v v file in ramdrive file in ramdrive ^ ^ | | v v c# program requesting c# or java program compute on data computing easier than (client)c# tcp ip <--------------------------------->c#/java tcp ip (server) socket 100/1000 mbit/s lan socket in terms of error handling(such half-open connections, acknowledgement packet management , picking right window/buffer size) , scalability (for 10-100 servers using tree-like connections)? if node-j...

Parsing Nested Arrays using VBA and JSON -

i have json trying parse in vba. have parsed out array of "offers". inside array of "offers" array "prices""usd". the problem not every "offers" object has "usd" array. trying create object can make table/sheet can't objects print in debug mode. works fails because not every dict offerdetails contains "usd" object. what able print string , if "usd" object missing skip , print ones have "usd". have tried ismissing (in code) fails when hits missing "usd" object. any idea how can string "usd" values? note "usd" array , contains several objects, don't know how address them either. ideally parse out "usd" same way did "offers". totally lost not in vba this working script valid web json. sub getjsonep_lib_working() 'need jsonconverter found here https://github.com/vba-tools/vba-json 'need microsoft scripting ru...

android - PlacePicker does not launch with location -

i working on project api google place. use placepicker , track phone launch placepicker am. class location , placepicker. public class prospectionactivity extends baseactivity { private static final int place_picker_request = 1; private textview mname; private textview maddress; private textview mattributions; private static final latlngbounds bounds_mountain_view = new latlngbounds( new latlng(48.8453849, 2.328134900000009), new latlng(48.866667, 2.333333)); public double latitude; public double longitude; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); framelayout contentframelayout = (framelayout) findviewbyid(r.id.content_frame); //remember framelayout area within activity_base.xml getlayoutinflater().inflate(r.layout.activity_prospection, contentframelayout); locationmanager service = (locationmanager) getsystemservice(location_service); b...

javascript - How do I dynamically set the checked property on a checkbox in Aurelia based on condition -

i have list of objects using create menu checkboxes. want set checked property on these checkboxes on load basing off of enum value object model has. here example of tried: <li repeat.for="item of items"> <input type="checkbox" checked="${item.status == 'enumvalue' ? 'checked' : '' /> </li> this did not work. can give me nudge in right direction? thanks! you can use checked.bind="<expression>" syntax bind boolean expressions properties. [documentation] in case: <input type="checkbox" checked.bind="item.status == 'enumvalue'" /> gist demo: https://gist.run/?id=b9a2929bdd34061795b90ddbfd745e75

input validation against DB in Spring+hibernate -

its spring mvc app hibernate. @service public class userserviceimpl implements userservice { @autowired userdao userdao; @autowired private sessionfactory sessionfactory; @override public boolean save(user user) { return userdao.save(user); } @override public void update(user user) { userdao.update(user); // return this.userdao.update(user); } @override @transactional public user findbyid(int id) { return this.userdao.findbyid(id); } @override @transactional public list<user> listpersons() { return this.userdao.listpersons(); } @override @transactional public user deleteuser(int id) { return userdao.deleteuser(id); } public boolean validateuser(int id) { list<user> list= (list<user>) findbyid(id); return false; } public user validateuser(user user) { session session ...

javascript - How to load a server variable only after a specific event? -

i need 2 server variables loaded after var change in db. right now, load when page loaded , therefore keep value had before event ( upvotesref.transaction ). $('.hp').text("<%= post.upvotes - post.downvotes %> hp"); code: $('.upvotebutton').click(function () { var $this = $(this); if ($this.hasclass("on")) { $this.removeclass("on"); upvotesref.transaction(function (upvotes) { if (!upvotes) { upvotes = 0; } upvotes = upvotes - 1; return upvotes; }); userref.remove(); $('.hp').text("<%= post.upvotes - post.downvotes %> hp"); edit: i ended creating local variables solve problem. thank answers ! var upvoteslocal = <%= post.upvotes %>; var downvoteslocal = <%= post.downvotes %>; $('.upvotebutton').click(fun...

c++ - Is there an equivalent of _mm_slli_si128(__m128i a, int num) for floats? -

let's have vector of 4 floats: __m128 vector = |f0|f1|f2|f3| (pseudocode) my intention transform variable this: |0.0|f0|f1|f2| doing shift right appear simplest choice, haven't been able find such intrinsic available floats. what fastest way accomplish this? here's solution: __m128 const mask = _mm_castsi128_ps(_mm_set_epi32(0, -1, -1, -1)); vector = _mm_shuffle_ps(vector, vector, _mm_shuffle(0,3,2,1)) vector = _mm_and_ps(vector, mask);

vb.net - BC30451 'VARIABLE' is not declared. It may be inaccessible due to its protection level -

i seem have error code below. private sub form1_load(sender object, e eventargs) handles mybase.load me.centertoscreen() if my.computer.filesystem.fileexists("bin\php\php.exe") dim phprc string = "" dim php_binary string = "bin\php\php.exe" else dim php_binary string = "php" end if if my.computer.filesystem.fileexists("pocketmine-mp.phar") dim pocketmine_file string = "pocketmine-mp.phar" else if my.computer.filesystem.fileexists("src\pocketmine\pocketmine.php") dim pocketmine_file string = "src\pocketmine\pocketmine.php" else msgbox("couldn't find valid pocketmine-mp installation", msgboxstyle.exclamation, "pocketmine-mp") end if end if process.start("c:\users\damian\desktop\games\pocketmine\installer\pocketmine-mp\bin\mintty.exe", "-o columns=88 ...

python - Detecting that an object is repeatedly iterable -

does obj == iter(obj) imply obj isn't repeatedly iterable , vice versa? didn't see such wording in docs, according this comment , standard library checks if object repeatedly iterable by testing if iter(obj) obj : @agf: there parts of python standard library rely on part of spec; they detect whether iterator/generator testing if iter(obj) obj: , because true iterator/generator object have __iter__ defined identity function. if test true, convert list allow repeated iteration, otherwise, it's assumed object repeatably iterable, , can use is. – shadowranger jun 3 @ 17:23 the docs state if obj iterator, it's required iter(obj) returns obj . don't think that's enough conclude non-repeatedly iterable objects can identified using iter(obj) obj . all iterators iterables, not iterables iterators. the requirement of iterable defines __iter__() method returns iterator: one method needs defined container objects provide iteration s...