Posts

Showing posts from March, 2012

java - Group duplicates values into single hashmap -

using list<map<string, object>> have merge same groupname , product_attributes converted arrays. receiving below data in list<map<string, object>> data following method converts data private list<map<string, object>> mapdataforclient(list<map<string, object>> data, list<long> ids) { list<map<string,object>> list = new arraylist<>(); for(map<string, object> d: data) { map<string, object> group = new hashmap<>(); string groupname = (string) d.get("group_name"); group.put("groupname", groupname); string productid = (string) d.get("product_id"); string productattributetype = (string) d.get("product_attribute_type"); string productattributename = (string) d.get("product_attribute_name"); map<string, object> types = new hashmap<>();

c++ - Usage of AllocaInst with example: LLVM -

i new llvm , know proper usage of allocainst examples. tried searching online , llvm webpage not have right examples it. below patch of code trying execute. string temp =(dyn_cast<constantint>operand0))->getvalue()).tostring(10,true); type* = integertype::getint32ty(f.getcontext()); string name = "t"+to_string(++counter); allocainst* variable = new allocainst(a,null,4,name,&*inst); when run this, error: error:no matching function call 'llvm::allocainst::allocainst(llvm::type*&, null, int, std::string&, llvm::instruction*)' allocainst* variable = new allocainst(a,null,4,name,&*inst); i know how provide address location in allcainst. appreciated. you cannot initialize array way. problem of code array size. allocainst expects llvm::value* array size, i.e., size must live in ir. constant 4 have use constantint::get create constant integer value in ir. constantint* can provided allocainst constructor. wiki

html - how to draw minimum rectangle boundary with javascript -

minimum rectangle boundary, point in polygon test.html , js included, leaflet code gives error: addlayer not defined (i want work on dataset need calculate bounds.i new in javascript. couldn't find sample code. if can me kind of way should follow,i happy.) function project (longitude, latitude) { return { x: longitude, // transform “longitude” in way y: latitude // transform “latitude” in way } } var bounds; function getboundingbox (data) { bounds = {}, coords, point, latitude, longitude; data = data.features; (var = 0; < data.length; i++) { coords = data[i].geometry.coordinates[0]; (var j = 0; j < coords.length; j++) { longitude = coords[j][0]; latitude = coords[j][1]; bounds.xmin = bounds.xmin < longitude ? bounds.xmin : longitude; bounds.xmax = bounds.xmax > longitude ? bounds.xmax : longitude; bounds.ymin = bounds.ymin < latitude ? bounds.ymin : latitude; b

python - Broadcasting error when counting occurance of data in multiple column -

i using pandas calculating occurrence of data on particular row in column. data use pressure values need find if acutal observation data (d3) appearing on other rows of colums. here data use:- date aa1 bb1 cc1 aa2 bb2 cc2 aa3 bb3 cc3 01/06/2016 1008 1007.5 1008 1008.4 1006.8 1008 1008.4 1007.4 1008 02/06/2016 1007.8 1007.4 1008.8 1007.8 1006.8 1008.8 1007.6 1007 1008.8 03/06/2016 1007.8 1006.4 1008.2 1007.8 1006.4 1008.2 1006.8 1007 1008.2 04/06/2016 1007.4 1006.5 1007 1007.8 1006.4 1007 1007.6 1006.4 1007 05/06/2016 1008 1006.2 1007.3 1007 1006.8 1007.3 1007.6 1006.4 1007.3 06/06/2016 1007.8 1006.8 1007.9 1007.6 1006.8 1007.9 1007.2 1007 1007.9 07/06/2016 1007.4 1007.4 1007.3 1008 1006.4 1007.3 1007.8 1006.8 1007.3 08/06/2016 1006.4 1005.8 1007 1006.8 1006.4 1007 1007.8 1007 1007 09/06/2016 1007.6 1006 1007.4 1007.4 1005.4 1007.4 10

webpack - How to run Vue.js dev serve with https? -

i'm using vue-cli create vue project webpack template. how run https in development using: npm run dev ? webpack template uses express server development. replace var server = app.listen(port) with following code in build/dev-server.js . var https = require('https'); var fs = require('fs'); var options = { key: fs.readfilesync('/* replace me key file's location */'), cert: fs.readfilesync('/* replace me cert file's location */')) }; var server = https.createserver(options, app).listen(port); please note in webpack template, http://localhost:8080 automatically opened in browser using opn module. you'd better replace var uri = 'http://localhost:' + port var uri = 'https://localhost:' + port convenience. wiki

retrofit2 - How to get Response values (Login Responses) from retrofit android -

i beginner of android learner,i used retrofit in project,i responses login request {"android":{"msg":"user login successfull","data":{"id":"14","name":"meena","url":"","email":"meena04@gmail.com","password":"202cb962ac59075b964b07152d234b70","phone":"","country":"china","photo":"","status":"pending","role":"3","device_id":"","oauth_uid":"","resume":"","oauth_provider":null,"created":"1503316508"}}} try can parse json this try { jsonobject json = new jsonobject(jsonresponse); string msg= data.getstring("msg")// msg jsonobject data = json.getjsonobject("data");// secong json object string id= data.getstring("id

c# - Bind Dictionary with list in viewmodel to checkboxes -

how bind dictionary , it's values per key checkboxes? can display them in httpget binding selected values again httppost doesn't seem work. viewmodel public class editviewmodel { public foo foo { get; set; } public dictionary<bar, list<barversioneditvm>> matrix { get; set; } } public class barversioneditvm { public int id { get; set; } public string name { get; set; } public string version { get; set; } public bool issupported { get; set; } } view: <form asp-action="edit"> <div class="row"> @foreach (var kvp in model.matrix.orderbydescending(x => x.key.name)) { <div class="col-md-2 col-lg-2"> <fieldset> <legend>@kvp.key.name</legend> @foreach (var version in kvp.value) { <div> <input type="checkbox" id="@version.id" value="@version.issupported" name="@version.name

Corda: How to use attachments for reference of previous transaction? -

if transaction b valid when has reference previous transaction a, can include transaction a's state properties/contract code within attachment in transaction b? how attachment referenced , retrieved from? participating nodes of transaction b able view contents of transaction validation? suppose have stateb , valid in presence of reference given transaction. define field in stateb of type signedtransaction hold reference. in kotlin: class stateb(val txref: signedtransaction?) : contractstate { override val participants: list<abstractparty> get() = listof() override val contract: templatecontract get() = templatecontract() } in java: class stateb implements contractstate { signedtransaction txref; stateb(signedtransaction txref) { this.txref = txref; } public signedtransaction gettxref() { return txref; } @notnull @override public contract getcontract() { return new templatecontract();

python - Pyforms AttributeError: ‘module’ object has no attribute ‘start_app’ -

after installing pyforms on raspberry pi 3 tried running example found on readthedocs , application throwing attributeerror (i tried both python2 , python3) python code import pyforms pyforms import basewidget pyforms.controls import controltext pyforms.controls import controlbutton class simpleexample1(basewidget): def __init__(self): super(simpleexample1,self).__init__('simple example 1') #definition of forms fields self._firstname = controltext('first name', 'default value') self._middlename = controltext('middle name') self._lastname = controltext('lastname name') self._fullname = controltext('full name') self._button = controlbutton('press button') #execute application if __name__ == "__main__": pyforms.start_app( simpleexample1 ) error: traceback (most recent call last): file "picontrol.

java - Usage of Enum<> generic type for variables -

we have code similar below, wherein have enum , check whether given variable of enum type present in list of enum type. import java.util.arraylist; import java.util.list; public class test { public static enum color {red, blue, green}; public static void main(string[] args) { enum<color> red = color.red; list<color> colorlist = new arraylist<>(); colorlist.add(color.green); // ** find bugs reports warning - gc_unrelated_types system.out.println(colorlist.contains(red)); } } our qa team has run findbugs against code, , have flagged warning - gc_unrelated_types, states that gc: no relationship between generic parameter , method argument ( gc_unrelated_types ) this call generic collection method contains argument incompatible class of collection's parameter (i.e., type of argument neither supertype nor subtype of corresponding generic type argument). therefore, unlikely collection

symfony - Api-platform request issue -

i have 2 entities author , book book | manytoone |author id | |id idauthor | in author controller have action function gets author details , books (using forward function books) public function authordetailsaction($id){ $author= $this->getdoctrine()->getrepository(author::class)->find($id); $books= $this->forward('appbundle:book:authorbooks',array('id' => $id)); return array('author' => $author, 'books' => $books); } but shows author informations or when im rutrning books return $books got error the controller must return response (array(0 => object(appbundle\entity\book), 1 => object(appbundle\entity\book), 2 => object(appbundle\entity\book)) given). (500 internal server error) thanks in advance guidance as looks use api platform, can achieve want without creating custom controller: add filter author resource able search author name: https://api-plat

ios - Accelerometer freak out -

i testing app, , meant getting readings accelometer...pretty simple! right , code says, if acceleration above 0.005, start adding 1 value... reason, when rotate ipad, , seems 'standing on 1 of edges' diamond, value seems increasing? increases if ipad still. here code : motionmanager.accelerometerupdateinterval = 0.02 motionmanager.startaccelerometerupdates(to: operationqueue.current!) { (data,error) in if let mydata = data { if mydata.acceleration.y > 0.05 { self.damian += 1 print(data) } i'm not sure based on documentation looks you're getting gravity + useracceleration. it's pretty normal non-zero values y-axis in device positions. the total acceleration of device equal gravity plus acceleration user imparts device ( useracceleration ). to useracceleration should call startdevicemotionupdates(to:withhandler:) - https://developer.apple.com/documentation/coremotion/cmmotionmanager/161

Cordova exec success function not called (Android) -

the java plugin updates boolean in timezonevariables true/false if device's timezone changes while app in background. call plugin when app resumes boolean value, , prints "getistimezonechanged true", not print "timezone did change". the $log.debug javascript function works fine, console.log. relevent code below if can tell me why exec successcallback isn't being called. java code: @override public boolean execute(string action, jsonarray data, callbackcontext callbackcontext) throws jsonexception { if(action.equals("createtimezonechangelistener")) { timezonevariables.setcallbackcontext(callbackcontext); timezonevariables.setistimezonechanged(false); }else if(action.equals("checktimezonechange")){ if (timezonevariables.getistimezonechanged()){ log.d("timezoneupdater","getistimezonechanged true"); timezonevariables.setistimezonechanged(false);

mysql - Configure a Wildfly 10 MSQL datasource in OpenShift v3 -

i have application working on local dev machine. uses wildfly 10, mysql 5.7 , hibernate. application looks 'appds' datasource within wildfly. i've created wildfly 10 container , mysql container on openshift v3. typically, log wildfly , configure datasource, configuration lost when container restarts. thought matter of finding connection environment settings, , using pre-configured database connections, can't find variables should set to, , default connections don't work without them. i downloaded , read openshift developers, side-step issue creating direct database connection, rather going through datasource. exporting environment variables failed because 'no matches apps.openshift.io/, kind=deploymentconfig'. book out of date? not using deployment config store environment variables? i appreciate if point me in right direction. i have project running locally on machine uses wildfly 10, mysql 5.7 , hibernate. found documentation incomplet

r - Plot with specific variables -

i have table matrix tab seprated: name variable value abc12 present in 4 abc12 present in b 2 abc12 total present in ab 6 abc12 present in c 5 abc12 present in d 5 abc12 total present in cd 10 abcd12 present in 2 abcd12 present in b 6 abcd12 total present in ab 8 abcd12 present in c 4 abcd12 present in d 8 abcd12 total present in cd 12 i want plot in geom_bar, x-axis name , y- axis value. x-axis name has show 1 bar - total present in ab - fill present in , present in b 2 bar - total present in cd - fill present in c , present in d wiki

php - Laravel 5.2 - Make different Read/Write Connections -

in laravel 5.2, wanted have different connections read/write, followed advice provided in laravel documents. but, default, creating default mysql named connection , not 2 different read/write connections, therefore picking read connection operations insert/update . after debugging, found in databasemanager.php file connection named passed argument makeconnection() mysql , not mysql::read or mysql::write . before config/database.php 'mysql' => [ //we need have nested options both read/write 'read' => [ 'host' => env('db_read_host'), ], 'write' => [ 'host' => env('db_write_host'), ], 'host' => env('db_read_host'), 'username' => env('db_username'), 'password' => env('db_password'),

javascript - MVC, how get model property from response viewModel -

iam implementing "show more post" in blogs list following this example but want make little change , switch viewdata viewmodel this relevant code: private void addmoreurltoviewdata(int entrycount) { viewdata["showmore "] = url.action("index", "messaggi", new { entrycount = entrycount + defaultentrycount }); } that switch to viewmodel.showmore = url.action("index", "messaggi", new { entrycount = entrycount + defaultentrycount }); the index action of example: public actionresult index(int? entrycount) { if (!entrycount.hasvalue) entrycount = defaultentrycount; int totalitems; if(request.isajaxrequest()) { int page = entrycount.value / defaultentrycount; //retrieve page specified page variable page size o defaultentrycount ienumerable<entry> pagedentries = getlatestentries(page, defaultentrycount, out totalitems); if(entrycount < totalitems) addmoreurltoviewdata(entr

ajax - converting to JSON Stringify -

i working on data tables server side processing . in ajax call sending data , changing values on next call of pagination. this ajax call code in datatable, "ajax": { url: "getbasiccallanalysisdata.json", data: function(d) { return $.extend({}, d, { "newrequest": newreq, "totalrecords": total, "phone": anumber, "from_date": startdate, "to_date": enddate }); }, type: "post", error: function() { alert("error"); }, complete: function(data) { total = data.responsejson.recordstotal; newreq = 0; test(total, newreq); $("#loading_image").hide(); $(".show_datatable").show(); } } in data attribute need convert returned values in json.stringify because on server side handles strings not json objects. i using not working

c++11 - C++ std::mem_fn with overloaded member function -

when compiling following code, visual studio reports: \main.cpp(21): error c2664: 'std::_call_wrapper<std::_callable_pmd<int classa::* const ,_arg0,false>,false> std::mem_fn<void,classa>(int classa::* const )' : cannot convert argument 1 'overloaded-function' 'int classa::* const ' 1> 1> [ 1> _arg0=classa 1> ] 1> context not allow disambiguation of overloaded function why compiler confused when creating mem_fptr1 ? how mem_fptr2 ok when specify types. can create member function pointer overloaded member function takes no argument? class classa { public: void memberfunction() { std::cout <<"invoking classa::memberfunction without argument" << std::endl; } void memberfunction(int arg) { std::cout << "invoking classa::memberfunction integer " << arg << std::endl;

.net - duplicate formsauthentication cookie breaks edge -

Image
we're using formsauthentication in .net mvc application , we're seeing strange issue. (seemingly random) response comes server 2 cookies identical names. seems chrome, mozilla, opera handle allright. edge deletes authentication cookie entirely. after next request returned login page because don't have authentication cookie. here's screenshot edge developer tools showing request/response cookies. i've been searching everywhere i've got no idea why happening. ideas welcome! wiki

wso2 api manager analytics -

just installed wso2 data analytic server api manager. i have 2 questions why there 2 views reports - 1 see in publisher , second set of reports see in store ? i interested in report of api usage application. don't see it. how create report? wiki

javascript - How do I check if an element is hidden in jQuery? -

it possible toggle visibility of element, using functions .hide() , .show() or .toggle() . how test if element visible or hidden? since question refers single element, code might more suitable: // checks display:[none|block], ignores visible:[true|false] $(element).is(":visible"); same twernt's suggestion , applied single element; , matches algorithm recommended in jquery faq wiki

How to add wordpress specific post format -

how add worddpress specific post format? format want add -> doctor http://354.today/wpscreen.jpg i try code , code not working add_action('init', 'my_theme_slug_add_post_formats_to_page', 11); function my_theme_slug_add_post_formats_to_page(){ add_post_type_support( 'doctor', 'post-formats' ); register_taxonomy_for_object_type( 'post_format', 'doctor' ); } you can add post formats custom post type of 'doctor', cannot create own custom post format called 'doctor'. https://codex.wordpress.org/post_formats wiki

python - Sequence stores according to their distances using pandas df -

i have 3 dataframes. 1.contains distances of stores main warehouse.(df1) ware_house store km 1 1023 1.1 1 1056 0.3 1 1089 1.7 2.contains distances of stores store.(df2) start_store destination_store km 1023 1056 5.3 1023 1089 3.7 1056 1089 4.5 1056 1023 5.8 1089 1056 3.9 1089 1023 4.2 i have 1 more dataframe contains test file (df3) rowid store sequence 100 1023 101 1056 102 1089 i want sequence stores in df3 such that, first picks store minimum distance warehouse , assign sequence no. 1 in df3. then looks combination of store stores , picks least distance store , inserts sequence no.2 in df3. similarly checks next store same above logic. in case df1 see store 1056 has least km. therefore in df3 , store 1056 assign se

What is "Redefined from long to double" meaning in javascript -

Image
i read javascript document know mouseevent.clientx . can't understand when , why use "redefined long double". clientx returns long type? wiki

javascript - How to enable double and single click for GridView row in Asp.net c# -

i have gridview row in asp.net, single click event working on it need add double click event on grid rows. how can that? please me. protected void gridview1_rowdatabound(object sender, gridviewroweventargs e) { if (e.row.rowtype == datacontrolrowtype.datarow) { // linkbutton control in first cell linkbutton _singleclickbutton = (linkbutton)e.row.cells[0].controls[0]; // javascript assigned linkbutton string _jssingle = clientscript.getpostbackclienthyperlink(_singleclickbutton, ""); // prevent first click posting // (therefore giving user chance double click) pause // postback 300 milliseconds using settimeout _jssingle = _jssingle.insert(11, "settimeout(\""); _jssingle += "\&

vb.net - Convert DBNull To String Before Populating Data To Datagridview -

i need way convert dbnull string when populating data database datagridview. below code private sub fetchdata() sql = "select contributiontype,status,paymethod,bankname,accountno,amount,fullname,district,refno,contributorgrp" sql &= " tblincome txnid=@id" command = new oledbcommand(sql, connection) command.parameters.add(new oledbparameter("@id", oledbtype.varchar)).value = lbltxnid.text adapter = new oledbdataadapter(command) dt = new datatable adapter.fill(dt) each row in dt.rows populategrid(row(0), row(1), row(2), row(3), row(4), row(5), row(6), row(7), row(8), row(9)) next dt.rows.clear() dt.dispose() end sub private sub populategrid(contributiontype string, status string, paymethod string, bankname string _ , accountno string, amount double, fullname string, district string _ , refno string, contributorgrp string) dim row stri

php - How do I display Image from ftp server like 5gbfree -

hello i'm developing blog using laravel framework , i'm stuck , because want diplay profile picture retrieved ftp server "5gbfree" can't url error messag said the driver doesn't support urls. i want know how can retrieve images , display them html tag src property or there method retrieve non-public photos ftp server. thank much. wiki

vb.net - Why can't I call ToList on a WhereSelectEnumerableIterator(Of T, String) -

i'm trying use linq extract values set of items. there possibility field doesn't exist, or empty, want filter fields not null , not empty. field values of numeric type , want project them string. return on query whereselectenumerableiterator(of nestedtableitem, string) . edit: looks appropriate return type. i'm struggling understand why still projecting nestedtableitem along side string. in end want call tolist on query, exception tolist not found on type. .net version: 4.5.1 references: microsoft.visualbasic , system , system.core , system.io , system.linq , system.runtime , system.xml , system.xml.linq imports: imports system , imports system.text , imports system.collections.generic , imports system.linq , imports system.runtime.compilerservices , imports system.xml , imports system.io dim aasitems ienumerable(of nestedtableitem) = aastable.nestedtableitems dim query = item in aasitems let field = item.allfields.valuefields.find("aaspropos

batch file - How To Set Variable Value In If -

hi make simple batch file tried add correct answers number @ end keeps saying 0 because variable values not changing when answers chosen. here code below @echo off title game 1 color 1f ::############################# :one set correctn=0 set correctn2=0 cls echo 2 + 2? echo. echo. echo a) 6 echo b) 4 echo c) 49 echo d) 17 echo. echo. echo type correct answer. set /p ch1= echo. echo. if not defined ch1 (goto one) if %ch1%==a goto no if %ch1%==a correctn=0 if %ch1%==b goto yes if %ch1%==b correctn=1 if %ch1%==c goto no if %ch1%==c correctn=0 if %ch1%==d goto no if %ch1%==d correctn=0 pause>null ::######################################### :no cls echo sorry, answer incorrect. echo. echo. echo correct choice b, 4. pause>null goto 2 ::######################################### :yes cls echo correct. congratulations. echo press key continue. pause>null goto 2 ::########################################## :two cls echo 100 divided 2? echo a) 45 echo b) 50 echo c) 90 echo d) 17 ec

Show rectangle in camera preview and crop image within it using android camera2 -

i have been trying achieve this using android camera2. i want rectangle load on top of camera preview , once press button capture image image should cropped within rectangle preview. have tried numerous solutions find of them using deprecated android hardware.camera , not camera2. ones find camera2 , textureview not have code cropping. in above image, have put overlay on texture view using image made in photoshop. how should crop within rectangle bounds? thanks. to add rectangle can define image in xml layout file , position in centre of preview. cropping uses scalar_crop_region: rect croprect = new rect(0, 0, 1755, 3120); capturerequestbuilder.set(capturerequest.scaler_crop_region, croprect); wiki

android - share video on whatsapp from my app -

i want share video ,i have link of , downloaded in app when user want share video, video not shared on whatsapp dont how ,here code tried not worked. intent videoshare = new intent(intent.action_send); videoshare.settype("*/*"); videoshare.putextra(intent.extra_stream, uri.parse(environment.directory_downloads+"/"+title)); videoshare.setpackage("com.whatsapp"); startactivity(intent.createchooser(videoshare, "share video")); public void sharevideo(string pkgname, string appname) { string path = null; try { path = mediastore.images.media.insertimage(getcontentresolver(), arrimagepath.get(slidepager.getcurrentitem()), "title", null); } catch (filenotfoundexception e1) { e1.printstacktrace(); } uri uri = uri.parse(path); intent share = new intent(intent.action_send); share.setpackage(pkgname); share.putextra(intent.extra_stream, uri); share.settype("video/*&qu

mysql - Managing database connections in java -

a full day of googling problem has left me more confused ever i'm appealing help. i'm trying use pooled connections mysql db i'm misunderstanding something. below snippets of code application scans folder new directories represent "jobs"; when found, database objects created each folder found. based _insert() method on pattern found on so. understanding connections closed , returned connection pool. however, noticed that, after adding 8 objects, code hang on getconnection(). found somewhere default number of active connections 8, added debug line limit number of active connections 2. sure enough, 2 objects added before code hangs. what's going on? need change make these connections freed , added pool? found one post mentioned poolableconnection class i'm confused documentation fact other examples i've found don't seem use it. the scanner class creates job objects in database based on folders found in particular directory on disk: public

create drop down in UITableView swift -

Image
i have gotten point have selectable list of options, loaded same .xib files. trying make upon click on cell different .xib file populated below, , of other cells shift down. however, unsure of how have 2 different xib's tableviewcells in swift. there's 2 ways can think of accomplish trying do: single xib file: should use single xib file hides lower section contains options until cell tapped. when tapped, property on uitablecell class set, e.g. isexpanded . when isexpanded set, cell unhide options (by changing constraints). multiple xibs: when tapped, insert new item datasource. in cellforrow, check identifier , load either regular cell or options cell using this: func tableview(_ tableview: uitableview, cellforrowat indexpath: indexpath) -> uitableviewcell { if indexpath.row == optionsrow { let cell = tableview.dequeuereusablecell(withidentifier: optionscellidentifier, for: indexpath) as! optionscell //configure cell here return cell } els

about db object init process of meanjs.org -

i'm reading meanjs.org source files learn , can't sure of db setup here . i've guess: db being fed there: mongooseservice.connect(function (db) { is initialized in config.js , fed module on line , yet still can not understand, how extracted out of config object , please? i decided ask here knows sure please tell me if understood mechanism correctly: 1. db defined in of environment modules, development, production, etc. found in mean/config/env/ 2. in config.js method : var initglobalconfig = function () {... on line collected other objects environmentconfig variable , here merged config object 3. config variable containing objects, including db, returned module , importing in app.js here brings in db object ready use. i stay guess decided document here , ask make sure, hope other people trying figure out same thing, read , pay less time. thank you. wiki

php - Unable to use DOMDocument in Symfony -

i have been unable use domdocument in symfony. after digging around, found problem might not have php xml extension, thought absurd because, despite no being able use domdocument, can use symfony's domcrawler , uses similar domdocument. well, after looking through crawler's source code, found uses like $dom = new \domdocument('1.0', $charset); instead of usual $dom = new domdocument('1.0', $charset); does know difference between two, , why 1 works , other doesn't in symfony? because in symfony use namespace in each class. , because have declared namespace in class need inform php namespaces of each class want use. if not declare namespace of class using, php think class in same namespace current class. so backslash "\" in code: new \domdocument() there informe php want use domdocument class "global" namespace. if want use datetime object need use backslash when instantiating datetime object. another solut

javascript - RatchetPHP no WebSocket property for new connections -

i'm trying access query parameters incoming connections in websocket server's onopen function using ratchet. both official documentation , other stackoverflow posts can accessing websocket property of connectioninterface object passed function: public function onopen(connectioninterface $conn) { $query = $conn->websocket->request->getquery(); } however, there's no websocket property incoming connection objects. when start server , connect client, notice given, results in fatal error calling function on null object: php notice: undefined property: ratchet\server\ioconnection::$websocket i'm using php 7.0 , i'm requiring latest stable release in composer.json : "require": { "cboden/ratchet": "^0.3.6" } i'm connecting client in chrome js console code copied directly hello world documentation well: var conn = new websocket('ws://localhost:8080?foo=bar'); conn.onopen = function(e) {

oauth - (ASP.NET MVC5) How to change default time out of 5 mins? -

Image
i have web app developed aspnet mvc5 in authentication done identityserver3 using openidconnect (idp configured use google+). the issue that, session timed out after 5 mins set cookie & session 60 mins. below code: this code on startup of client app.usecookieauthentication(new cookieauthenticationoptions { authenticationtype = "cookies", slidingexpiration = true, cookiename = "refmanweb", expiretimespan = timespan.fromhours(1), }); also have sessionstate set in web.config <sessionstate timeout="60"></sessionstate> can guy point out wrong here ? advice appriciated ! update: cookies have exprires = "at end of session". slidingexpiration works option usetokenlifetime = false in openid middleware. for e.g. app.useopenidconnectauthentication( new openidconnectauthenticationoptions() { authority = options.au

date - R: Best way around as.POSIXct() in apply function -

i'm trying set new variable incorporates difference (in number of days) between known date , end of given year. dummy data below: > date.event <- as.posixct(c("12/2/2000","8/2/2001"), format = "%d/%m/%y", tz = "europe/london") > year = c(2000,2001) > dates.test <- data.frame(date.event,year) > dates.test date.event year 1 2000-02-12 2000 2 2001-02-08 2001 i've tried applying function achieve this, returns error > time.dif.fun <- function(x) { + as.numeric(as.posixct(sprintf('31/12/%s', s= x['year']),format = "%d/%m/%y", tz = "europe/london") - x['date.event']) + } > dates.test$time.dif <- apply( + dates.test, 1, time.dif.fun + ) error in unclass(e1) - e2 : non-numeric argument binary operator it seems apply() not as.posixct(), testing version of function derives end of year date, returned numeric in form '978220800' (e.g. end of year 2000).

Neural net backpropagation, all outputs tend to 1 and all weights only increase in value (java) -

so trying create own neural network project , challenge myself. have checked math , have made sure correct propagation algorithm outputting numbers tend 1. have checked math , unable find error. anny or tips appreciated , sorry bad variable names, not creative person when comes sort of stuff. main runner class public static void main(string[] args) { net tester = new net(); int[] arrangement = {1, 3, 1}; double[] lister = new double[1]; double[][] inputvalues = {{1.0}, {0.0}};; double[][] expected = {{1.0}, {0.0}}; double[] returned = null, outstored = new double[1000], expectedstored = new double[10000000]; random rand = new random(); int storer = 0, inter = 0; tester.settup(arrangement); for(int j = 0; j < 10000; j++) { storer = rand.nextint(inputvalues.length); returned = tester.feedforward(inputvalues[storer]); tester.backprop(expected[storer], 0.1); if(returned[0] >= 0.5) { inter

java - Is there a way to disable Thymeleaf, or only enable for certain REST Calls? -

for instance, have basic post returns html called "result" using thymeleaf. works , cool. @postmapping("/greeting") public string greetingsubmit(@modelattribute greeting greeting) { return "result"; } but have totally unrelated method, different, , returns not template. @postmapping(value = "/otherstuff", headers = "content-type=multipart/*") public object otherstuff( @requestparam("file") multipartfile datafile ) = { //totally unrelated stuff return resultlist; naturally, exception: org.thymeleaf.exceptions.templateinputexception: error resolving template "/otherstuff", template might not exist or might not accessible of configured template resolvers because i'm intentionally not resolving template. can turn off thyme leaf method? rest api multi-purpose, , rather unhelpful if thyme leaf ends disrupting whole project. thanks wiki

python - How do I concatenate protobuff messages for a TFRecordFile in ruby? -

i want concatenate ruby-generated protobuff example messages tensorflow tfrecordreader can understand them. i'm confident messages in correct format independently, don't know how concatenate them in compliance tensorflow's expectations. how should concatenate messages in ruby safe play in tfrecord land? wiki

Cannot launch AVD in emulator for Windows 8.1 Android studio -

good day. have problem android studio emulator. i've searched internet , can seem find solution problem. whenever try launch emulator, get: cannot launch avd in emulator. output: emulator: warning: cannot find system dns servers! name resolution disabled. emulator: warning: cannot find system dns servers! name resolution disabled. ###warning: use system default dns server ###warning: unable configure dns servers, name resolution not work hax enabled hax ram_size 0x40000000 hax working , emulator runs in fast virt mode the emulator starts, app refuses run. solution please? it has been solved. connected system internet restarted android studio. don't know in world happened works now. what doing.... wiki

java - how to unit test code that should cause compile error -

i have class take arraylist parameter: public class foo { private arraylist<bar> bars; public foo(arraylist barlist) { bars = barlist; } } there bug can pass arraylist constructor: // should compile error line foo foo = new foo(new arraylist<string>()); the problem if add case test suite, when bug fixed, can not compile it. there anyway test case? i don't know of language/unit test framework let "test" code should not compile. if can't compile it, there nothing test. can turn on compiler warnings when building. i'm pretty sure passing unparameterized collection big warning in jvm after jdk5. wiki