Posts

Showing posts from June, 2013

Android TabActivity with Toolbar - setSupportActionBar() unknow -

is possible use setsupportactionbar() in tabactivity ? extending appcompatactivity not possible... public class tabhost extends tabactivity { public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.tabhost); toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); // unkown getsupportactionbar().setdisplayhomeasupenabled(true); //also do have switch tabactivity fragmenttabhost ? thanks no can't. have extend appcompatactivity , , shouldn't use tabactivity in first place. deprecated long time ago. should use solution based on viewpager , fragment s achieve same behavior

model view controller - Changing MVC username settings on registration form -

i'm developing application mvc. i'm trying register test user rui.martins username, can't. user name rui.martins invalid, can contain letters or digits . how can change restrictions? i solved public accountcontroller(usermanager<applicationuser> usermanager) { usermanager = usermanager; usermanager.uservalidator = new uservalidator<applicationuser>(usermanager) { **allowonlyalphanumericusernames = false** }; }

php - ajax success doesnt alert anything -

i have ajax request , if id succeeds alert data. if print_r php function correct result. my ajax: $.ajax({ type: "get", url: "getquestions.php", datatype: "json", data:{ compid: id[4].innerhtml }, success: function(response){ alert(response); } }); my getquestions.php: <?php include "functions.php"; getquestions($_get['compid']); my function getquestions($compid) in functions.php: function getquestions($compid){ $int=intval($compid); $vastus=array(); $conn = dbconnect(); $sql="select * bet_question compid = $int"; $result = $conn->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { array_push($vastus,$row); } } else { echo "error: " . $sql . "<br>" . $c...

ruby on rails - How do you apply limits and ordering to associations? -

i'm trying create query can following, category has_many dates query takes location , category provides array of categories, ordered number of jobs in category. this, i'm using default_scope { order(jobs_count: :desc) } in category model, jobs_count counter. in each category query provides array of jobs jobs ordered boolean associated attribute order.featured , date ( order belongs_to job ) only shows jobs attribute: open: true . can done scope. only shows jobs near location if location present. requires call of class method job.within() shows 20 if no category has been set. proving difficult. is possible in 3 calls database? attempt @ solution at high level, first find find jobs in right area, attribute open: true if need show 20 jobs per category, group jobs category using ruby's group_by , attempt order them correctly, remove first 20 in each array. i take ids of these jobs. i perform database call category table, category.includes(:jo...

php - CodeIgniter's force_download() problems -

i'm trying generate .json file download using codeigniter's force_download() in ajax call, doesn't work expected. here ajax call: $.ajax({ url: /myfunction, type: 'post', data: {value_sent: my_json_array} }); and php function: public myfunction() { $dl_array = $this->input->post("value_sent"); $this->load->helper('download'); force_download("file.json", $dl_array); } data sent (i double checked), download prompt never shown. assume force_download() fails, don't understand why. any appreciated, thanks! this isn't problem codeigniter, it's limitation of javascript. can't download files via ajax, referenced in download file jquery.ajax . you can't through ajax because javascript cannot save files directly user's computer (out of security concerns)

uitableview - ios Cutom tableview cell subview each other overlaping each other -

Image
i have created 2 custom cells uilabel , uiimageview . if added space between them uiimageview cell overlaps uilabel cell. in addition, updating frame of uilabel cell not updating. not using autolayout. can 1 give me solution this? - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { determinecoatingcell *cell=[[nsbundle mainbundle] loadnibnamed:@"determinecoatingcell" owner:self options:nil][0]; float cellheight = [self tableview:tableview heightforrowatindexpath:indexpath]; nsdictionary *option =[arroptions objectatindex:indexpath.row]; if (is_ipad) { // float yvalue=(cellheight/2)-10; lbltable= [[uilabel alloc]initwithframe:cgrectmake(30, 5, 590, cellheight)]; lbltable.font=[uifont systemfontofsize:30]; lbltable.numberoflines=0; lbltable.textcolor=[uicolor colorwithred:63.0/255.0f green:126.0/255.0f blue:199.0/255.0f alpha:1.0]; lbltable.textalignme...

python - xpath: return value within an element found by preceeding value -

apologies weird title (hard explain). here html: <p> <strong>date:</strong> may 12, 2015 </p> basically, want extract date ( may 12, 2015 ). i've come with: print advisory.xpath('//p/strong[text()="date:"]')[0].text but naturally returns date: . idea how traverse parent, skip w/e in strong tag , return rest? alternatively, since date text after-text of <strong> element, can use tail attribute this: [2]: s = '''<root><p><strong>date:</strong> may 12, 2015</p></root>''' in [3]: lxml import etree et in [4]: tree = et.fromstring(s) in [5]: tree.xpath('//p/strong[text()="date:"]')[0].tail out[5]: ' may 12, 2015'

java - Spring jpa hibernate insert OneToMany -

i'm trying to insert data in table (onetomany). have 2 tables(good, category). @entity @table(name = "goods") public class implements serializable { @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "category_id") private category category; @jsonbackreference public category getcategory() { return category; } //getters,setters ommited and another: @entity @table(name = "category_of_products") public class category implements serializable { @onetomany(mappedby = "category", fetch = fetchtype.lazy, cascade = { cascadetype.persist, cascadetype.refresh }) private list<good> goods; @jsonmanagedreference public list<good> getgoods() { return goods; } //getter, setters ommited than, in category example(id=1), trying create product relate category. @requestmapping(value = categories_id_goods_add_do, method = reques...

jenkins - Is there any way to start appium server silently? -

use case: need start appium server on ci jenkins , run tests right after that. tests don't start because appium server starting in debug mode , doesn't switch command. have jenkins on windows machine following build steps (as windows batch command): start /b node path_to_appium_server\appium.js --address 127.0.0.1 --port 4723 timeout 10 "path_to_tests_runner\vstest.console.exe" "path_to_dll\test.dll" , in case, tests cannot started because jenkins terminate first process (with appium). basic issue permissions '*.dll' file contains tests , cannot ran bat file without 'runas' command (which waiting password) jenkins. jenkins job contains 3 build steps: execute windows batch command start node path_to_appium_server\appium.js --address 127.0.0.1 --port 4723 run unit tests vstest.console (to build option need install vstest runner plugin) specify path dll , command line parameters execute windows batch command taskkil...

html - Why isn't there a working solution for disabling browser caching? -

i have registration (unique) form want disable memory of email , password field won't autocomplete. tried methods. autocomplete=off fields, explicitly setting field blank disabling caching meta tag. nothing worked. why nothing possible when easy understand need functionality? it easy understand need functionality wrong. should not try prevent user using useful features. browsers removed support autocomplete="off" precisely because of people you, made autocomplete feature less useful.

node.js - Phonegap Install Ionic Framework -

i want install ionic framework npm cordova project. i'm getting error. npm log ; 28596 error windows_nt 6.3.9600 28597 error argv "c:\\program files\\nodejs\\\\node.exe" "c:\\program files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "ionic" 28598 error node v0.12.2 28599 error npm v2.7.4 28600 error code econnreset 28601 error errno econnreset 28602 error syscall read 28603 error network read econnreset 28603 error network not problem npm 28603 error network , related network connectivity. 28603 error network in cases behind proxy or have bad network settings. 28603 error network 28603 error network if behind proxy, please make sure 28603 error network 'proxy' config set properly. see: 'npm config' 28604 verbose exit [ 1, true ] try installing older version of node (0.10.38). having same error newer version of node.

php - Insert data in Postgres with XML-RPC -

i trying insert data postgres database xml-rpc. code insert data in postgres database <?php $customer_array = array('name'=>new mlrpcval('customer name',"string")); $client = new xmlrpc_client("http://xxx.xxx.x.xx:8069/xmlrpc/object"); $msg = new xmlrpcmsg('execute'); $msg->addparam(new xmlrpcval($dbname, "string")); $msg->addparam(new xmlrpcval($user_id, "int")); $msg->addparam(new xmlrpcval($pwd, "string")); $msg->addparam(new xmlrpcval("res.partner", "string")); $msg->addparam(new xmlrpcval("create", "string")); $msg->addparam(new xmlrpcval($customer_array, "struct")); $resp = $client->send($msg); $customer_id = $resp->value()->scalarval(); ?> i getting following error "faultstring access denied" know how can solve it? miss...

java - Not able to stop the listener using separate method -

i have create file watcher using org.apache.commons.io.monitor.filealterationmonitor. file changes captured correctly. want stop monitor task using separate method. not working. source code below. import java.io.file; import java.io.ioexception; import java.util.scanner; import org.apache.commons.io.filedeletestrategy; import org.apache.commons.io.fileutils; import org.apache.commons.io.monitor.filealterationlisteneradaptor; import org.apache.commons.io.monitor.filealterationmonitor; import org.apache.commons.io.monitor.filealterationobserver; import org.apache.commons.io.monitor.fileentry; public class filemonitor2 { //public final class filemonitorexample { private static final string example_path = "d:\\testrail\\install.txt"; private static final string parent_dir1 = "d:\\ibi\\devstudio77\\client\\wfc\\etc"; private static final string parent_dir2 = "d:\\ibi\\devstudio77\...

java - Breakpoint at exception in Eclipse - how to examine Exception object? -

i feel i'm missing simple here. have eclipse set break on exceptions. so, let's breaks on assertationfailedexception. debug window show thread suspended , has following data: thread [thread-1] (suspended (exception assertionfailedexception)) contactmanager.addcontact(string) line: 93 contactmanager$contactdatacallback.dispatch(string, element, clientconnector) line: 118 packethandler.handle(fractuspacket) line: 173 serverconnection.syncprocess(fractusmessage) line: 122 serverconnection.run() line: 248 thread.run() line: 636 however, text i'm looking for, such as: "getter called outside realm of observable org.eclipse.core.databinding.observable.set.writableset@4b7361e2", not available until step through exception (thus propagating way stack) outputs type of exception, text (which part want) , stack trace. how can examine "assertationfailedexception" (or other exception) in order message exception construc...

java - Is it OK to use a HashMap to keep indices of list elements? -

i have list of objects. list<myobject> mylist; this list populated in beginning , no update done after that. the order of objects in list significant because need iterate on list in order later. during execution of program, need find index of given myobject in mylist ; i know can use mylist.indexof(object) worried performance. going use hashmap map each myobject in mylist index in mylist can find index efficiently. but not sure whether missing trivial , going use 2 containers redundant data done using different container. so, can see better way this? you can use linkedhashmap contain myobject instances. map<string, myobject> map = new linkedhashmap<string, myobject>(); hash table , linked list implementation of map interface, predictable iteration order. this allow have 1 collection both.

java - Can I have arrayList of string in realm object android -

as dont have list data type in realm, how can use arraylist<string> in realm object? had same question arraylists of custom models make i.e. arraylist<custommodel> understand first have make realmobject of same custom model using public class customobject extends realmobject { private string name; private string age; } and can use private realmlist<customobject> customobjectlist; in realmobject do have same arraylist of string? 1. making string object 2. use object in realm list yes, have manually box strings in stringobject. we'd add support realmlist<string> , realmlist<integer> , etc., it's long way out.

subquery - SQL server Temp table with joins inside other select -

i have following structure: create @temp select ...inser...into @temp ... (select ... @temp join tbla ... ) union (select ... @temp join tblb ... ) after build above table need able perform where, joins, ... something like: select ... (above statement) join .... where.... i don't know how of if @temp,joins, union... can inside other select. or thing can create @temp2 inserting first statement result , work other join,where... ? update 1: i trying: with cte (query returned columns) (same query using build @temp before) (select ... cte join tbla where...) union (select ... cte join tblb where...) but im stuck @ same point in how perform other joins, where... above total result actually can without temp-table: with mycte [ ( column_name [,...n] ) ] ( here define query ) and after select use cte select ... mycte join .... where.... about cte can read here after update select fields mycte join table1 union select fields mycte join table2 w...

java - How to Implement cooperative co-evolutionary GA Model on the Watchmaker Framework -

i trying implement cooperative co-evolutionary ga based model have 2 populations different data type , should interact each other produce better result after each generation. using watchmaker framework this. have built first population , trying add second population. not sure how this. not find class or method support adding second population. have found package org.uncommons.watchmaker.framework.islands class manages parallel evolution across multiple evolutionengines (islands) periodic migration between them. not sure if me, have understood class support populations similar data types. can 1 me issue? there way implement coevolutionary ga model using watchmaker framework? have done huge work , don't want change framework if there possible way in framework.

How to Increase the number of characters in EXCEL 2013 cells? -

how increase number of characters in excel 2013 cell values? because have 5 lack length of characters. tried insert values single row or cell, time cell split , insert values row. how handle , if there way achieve this? excel allows enter 32,767 maximum characters in cell . nothing can that. however in cases see ##### signs on cell. suggests format incorrect , changing general may able add additional characters. here can learn more on limits in excel: https://support.office.com/en-nz/article/excel-specifications-and-limits-16c69c74-3d6a-4aaf-ba35-e6eb276e8eaa

c++ - can not refer to the addresses of constructors -

a constructor 'special' member function task initialize objects of class. it special because name same class name. constructor invoked whenever an object of associated class created.it called constructor because constructs value of data members of class. a constructor declared , defined follows: //class constructor class integer { int m,n; public: integer(void); // constructor declared }; integer::integer(void)// constructor defined { m=0;n=0; } we can not refer addresses why? because language doesn't allow way take address of constructor. or, if you're asking why it's not allowed: because there's no reason so. you'd take address of function in order call it, , never call constructor directly. it's called indirectly, result of creating object.

logging - Golang logrus - how to do a centralized configuration? -

i using logrus in go app. believe question applicable other logging package (which doesn't offer external file based configuration) well. logrus provides functions setup various configuration, e.g. setoutput, setlevel etc. like other application need logging multiple source files/packages, seems need setup these options in each file logrus. is there way setup these options once somewhere in central place shared on application. way if have make logging level change can in 1 place , applies components of app. you don't need set these options in each file logrus. you can import logrus log : import log "github.com/sirupsen/logrus" then functions log.setoutput() functions , modify global logger , apply file includes import. you can create package global log variable: var log = logrus.new() then functions log.setoutput() methods , modify package global. awkward imo if have multiple packages in program, because each of them has different log...

asp.net - Html.Partial vs Html.RenderPartial & Html.Action vs Html.RenderAction. can any one please describe the difference -

in asp.net mvc, difference between: html.partial , html.renderpartial html.action , html.renderaction html.action invokes controller's action, means instantiates controller entity, calls action method, builds model returns view result. html.partial uses created model (or can called without model @ all) render specified view. when use 1 on other? if have model , want have reusable view, opt html.partial . if see piece deserves own model , action, maybe makes sense use html.action . this question discussed in greater details in this article , , see above excerpt it.

How to get id in mongodb without " ObjectID" string in Html and meteor -

while fetching id in mongodb getting ids this. objectid("55545a387d55e6f2a67ff6a0") is there way id like 55545a387d55e6f2a67ff6a0 first need run find command print in html without object can use way , can use _str in html {{this._id._str}}

Laravel 5, Password reset email not working -

i working on laravel 5 application. hosted on shared server , tried reset password. throwing following exception. swift_transportexception in streambuffer.php line 265: connection not established host mailtrap.io [connection timed out #110] i using default authentication driver. the code in password controller follows: <?php namespace app\http\controllers\auth; use app\http\controllers\controller; use illuminate\contracts\auth\guard; use illuminate\contracts\auth\passwordbroker; use illuminate\foundation\auth\resetspasswords; class passwordcontroller extends controller { /* |-------------------------------------------------------------------------- | password reset controller |-------------------------------------------------------------------------- | | controller responsible handling password reset requests | , uses simple trait include behavior. you're free | explore trait , override methods wish tweak. | */ use ...

sql server - Custom query converts dt_wstr in nchar sql type -

i create in ssis custom query: select top 1 * (select * [dbo].[tyrepoints]) [reftable] ([reftable].[brand] ? or [reftable].[brand] = '*') order [reftable].[priority] desc the "?" replaced dt_wstr(20) variable , [reftable].[brand] nvarchar(20) field in db. when check result of query sql profiler : exec sp_executesql n'select top 1 * (select * [dbo].[tyrepoints]) [reftable] ([reftable].[brand] @p1 or [reftable].[brand] = ''*'') order [reftable].[priority] desc',n'@p1 nchar(20)',n'test ' why ssis converts dt_wstr type in nchar? how can have result nvarchar type?

java - Maintaining multiple JDBC connections in Struts2 -

the number of connections db exceeds permissible limit. this tried far. when user logs in add 1 connection object session: connection conn = databaseconnectionmanager.getconnection(); sessionmap.put("connection", conn); then, whenever need db connection, fetch session: map<string, object> sessionmap = (map<string, object>) actioncontext.getcontext().get("session"); connection conn = (connection) sessionmap.get("connection"); in getconnection() method print number of times method called. although fetch connection object session why number of connections exceed permissible limit 50 ? jndi code: connection conn = null; try { context initctx = new initialcontext(); context envctx = (context) initctx.lookup("java:comp/env"); datasource ds = (datasource) envctx.lookup("jdbc/mysqdb"); conn = ds.getconnection(); } catch (namingexception ex) { logger.getlogger(databaseconnectionman...

C# event click containing more than one method -

i trying nest methods, or place methods within other methods. using c# , microsoft visual studio first time , dilemma this. have created form event click button validate user input, fine in itself, need validate more 1 input when button clicked. in calculate button’s click event handler, perform input validation on 3 text boxes (the 3 user use data entry). code efficiency want use separate methods achieve this. have tried writing more methods directly within event handler, no matter how start method public, private, static, void, main etc errors. assistance/advice appreciated. private void btncalculate_click(object sender, eventargs e) { int txtlength = 0; if ((txtlength < 5) & (txtlength > 50)) messagebox.show("length measurement invalid" + "\r\n" + "please enter value between 5 , 50", "data invalid"); int txtwidth = 0; ...

passing wildcard arguments from bash into python -

i'm trying practice python script writing simple script take large series of files named a_b , write them location b\a. way passing arguments file python script.py * and program looks from sys import argv import os import ntpath import shutil script, filename = argv target = open(filename) outfilename = target.name.split('_') outpath=outfilename[1] outpath+="/" outpath+=outfilename[0] if not os.path.exists(outfilename[1]): os.makedirs(outfilename[1]) shutil.copyfile(target.name, outpath) target.close() the problem this script way it's written set accept 1 file @ time. hoping wildcard pass 1 file @ time script execute script each time. my question covers both cases: how instead pass wildcard files 1 @ time script. and how modify script instead accept arguments? (i can handle list-ifying argv i'm having problems , im bit unsure how create list of files) you have 2 options, both of involve loop. to pass files 1 o...

php - Wordpress Permalinks not working - Apache Configuration Reset -

on live server, resolve 404 error when trying access page, changed below setting in httpd.conf <directory "/usr/local/apache/htdocs"> options includes indexes followsymlinks multiviews allowoverride order allow,deny allow </directory> but on next day gets reset below <directory "/usr/local/apache/htdocs"> options includes indexes followsymlinks multiviews allowoverride none order allow,deny allow </directory> really hoping going work, no go. .htaccess looked after changed permalink option: <directory /> options +followsymlinks allowoverride </directory> <files .htaccess> order allow,deny deny </files> # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule> # end wordpress the pages still not acc...

single sign on - Thinktecture v3 auto login for ADFS users within the same domain -

i using thinktecture identity server v3 authentication , authorization. works local database. added external identity provider adfs. works asks credentials intranet users. requirement automatically login intranet users without asking credentials. if user internet user, asks credentials. possible? this unrelated identityserver3. browser , adfs need configured correctly use windows integrated authentication.

VBScript to return Windows Product Key -

i need vbscript return windows product key. found vbscripts online these specific windows versions. there vbscript available work on windows 7 - windows 8.1? you can try this code : const hkey_local_machine = &h80000002 strkeypath = "software\microsoft\windows nt\currentversion" strvaluename = "digitalproductid" strcomputer = "." dim ivalues() set oreg = getobject("winmgmts:{impersonationlevel=impersonate}!\\" & _ strcomputer & "\root\default:stdregprov") oreg.getbinaryvalue hkey_local_machine,strkeypath,strvaluename,ivalues dim arrdpid arrdpid = array() = 52 66 redim preserve arrdpid( ubound(arrdpid) + 1 ) arrdpid( ubound(arrdpid) ) = ivalues(i) next ' <--- create array hold valid characters microsoft product key ---> dim arrchars arrchars = array("b","c","d","f","g","h","j","k","m","p",...

javascript - Removing "\"" from json string -

hello trying remove following example jsonstring "work_desc":"hello\"world" tried following; jsonstring = jsonstring.replace(new regexp('\\\"', 'g'), ' '); would transform this: [{"pigsback":0,"work_desc":"hello\"world","owner":"jbb"}] to: [{"pigsback":0,"work_desc":"hello world","owner":"jbb"}] currently above replace code this: [{ pigsback :0 work_desc : hello world , owner : }] any ideas? you turn json object handle of you.. json.parse(jsonstring);

php - is it possible to POST/GET data to TLSv1.1+ secured site without curl and wget? -

i in unfortunate situation: my website using outdated software (security patches applied) openssl 0.9.8o 01 jun 2010 doesn't support tlsv1.1/1.2 i have payment gateway pci dss compliant therefore ssl , tls disabled there my website used exchange data payment gateway tlsv1.0 dropped can no longer use php's curl library or file_get_contents() (or wget/lynx/curl via shell) is there workaround, option how connect tlsv1.1+ secured server without using built-in libraries? i know classes exists in php phpseclib ssh client, great people can't use ssh2 module does exists php? there way can connect gateway? so far best idea connecting gateway thru other server (with updated software) once used utility called stunnel non-tls client, quote website: stunnel proxy designed add tls encryption functionality existing clients , servers without changes in programs' code. architecture optimized security, portability, , scalability (including load-balanci...

c# - Grouping the details of the data into one, price field should be separated by semi-colon -

i have requirement need group data ordernum, price needs consolidated in 1 row separated semi-colon, determined type. can iterating results but, there's better way in linq. var notebooks = new list<notebook> { new notebook { type = 1, currency = "usd", price = 1000, ordernum = "123" }, new notebook { type = 2, currency = "usd", price = 2000, ordernum = "123" }, new notebook { type = 0, currency = "usd", price = 3000, ordernum = "456" }, new notebook { type = 0, currency = "usd", price = 4000, ordernum = "789" }, new notebook { type = 4, currency = "usd", price = 5000, ordernum = "753" } }; var results = r in notebooks group r new { r.ordernum } g select new { ...

android - ScrollView Focus LinearLatout or others elements -

Image
have activity scrollview when item selected, turn layout in view.visible, or vice versa, when select item bit down, state 3 image, losing half information, forcing user have move finger. the question is: how can linearlayout requestfocus?   note: close layouts, need focus. i've tried google : android scrollview focus edittext / elements / layout / onclick focus scroll , not work . save last opened linearlayout in variable , close after user open new. or show more code. edit use scrolltoview(view view, scrollview scrollview) , view linearlayout . linearlayout take maximum possible space in scrollview public static void scrolltoview(view view, scrollview scrollview) { scrolltoview(view, scrollview, 0); } public static void scrolltoview(final view view, final scrollview scrollview, int count) { if (view != null && view != scrollview) { count += view.gettop(); scrolltoview((view) view.getparent(...

c# - Usercontrol drag & drop on Panel -

i'm making graphical editor, experiencing problems drag & drop on panel . ellipse doesn't take exact position drop it, , think it's placed in usercontrol of size 150;150. here's link of short movie illustrate mean: http://gyazo.com/abf5484a31e2d1ce8ebccc49bee9fdb6 in first part can see ellipse goes wrong position , in end of movie when draw line seems ellipse has block around it. how can solve issues? form1.cs public partial class form1 : form { bool draw = false; int x, y, xe, ye; public form1() { initializecomponent(); menucomboboxshape.combobox.datasource = enum.getvalues(typeof(item)); } public enum item { pencil, rectangle, ellipse, } private void panel_mousedown(object sender, mouseeventargs e) { draw = true; x = e.x; y = e.y; } private void panel_mouseup(object sender, mouseeventargs e) { draw = false; xe = e.x; ...

spring cloud config environment repository has a database? -

history i have application dependencies program sources front-end ( includes js, jsp, other ria application files) back-end ( includes java classes, table, columns). analyzing this, have analyze each project develop architecture , configure many properties. each time adapt program each project, had spend lot of time make configuration customizing each project. also, took long time making configuration. but, accumulated many environment sets after adaption many projects. want gather properties sets 1 repository , watch thing in web view , reuse them if can find similar 1 in repository. motivation & implementation yesterday got idea right after saw spring cloud config. besides, changing source of properties properties file database. , make web view managing database. question first : connect spring cloud config database, need data-source connector of spring cloud config. can't find that. second : gather kinds of properties 1 repository. idea? if have experienc...

pybluez install windows 7 64 bits python 3.3 -

i have message error : unable find vcvarsall.bat when use "python setup.py install" install pybluez with https://github.com/karulis/pybluez under windows 7 64 bits. how fix ? basic assumption have microsoft visual studio express installed (2010, @ least) , environment variable vs100comntools set proper path in program files directory. i've installed vs 2015 , created mentioned variable following value: c:\program files (x86)\microsoft visual studio 14.0\common7\tools\ .

pointers - Call native method from Swift that has uint8_t ** as output parameter -

i have c method interface size_t foo(uint8_t ** output) this gets imported swift as func foo(_ output: unsafemutablepointer<unsafemutablepointer<uint8>>) -> int how can call method swift? assuming foo() allocates uint8_t array, puts address memory location pointed output , , returns size of allocated array, can use swift this var output : unsafemutablepointer<uint8> = nil let size = foo(&output) in 0 ..< size { println(output[i]) } you have decide responsible releasing allocated memory. if foo() functions allocates using malloc() can release swift with free(output)

c++ - Making a copy constructor more flexible for ADT queue -

i have constructed copy constructor adt queue. copy constructor works fine. want improve code, don't know how shorten make more flexible. code given below: template <typename t> queue <t>::queue(const queue & other) { if (other.first == nullptr) { first = nullptr; nrofelements = 0; } else { node* savefirst; node* walker; first = other.first; walker = new node(first->data); savefirst = walker; while (first->next != nullptr) { walker->next = new node(first->next->data); walker = walker->next; first = first->next; } walker->next = nullptr; first = savefirst; } this->nrofelements = other.nrofelements; } the class queue contains inner private node class contains pointers first , next , etc: private: int nrofelements; class node { public: node* next; t data; node(t data) { ...

ubuntu - hiding port with a path - nginx -

i have kibana running on port 9292 on localhost. want achieve when type http://ip_adress/kibana page port 9292 loaded path remain http://ip_address/kibana/index.html#/dashboard/file/default.json instead http://ip_adress:9292/index.html#/dashboard/file/default.json here code: server { ... location /kibana { return 301 /kibana/; } location ~ /kibana/(.*) { error_log /var/log/nginx/kibana-error.log debug; proxy_pass http://ip_address:9292/$1; } } finally updated kibana 3 4 helped , i'm using configuration : upstream kibana { server 127.0.0.1:5601; } ... location /kibana { return 301 /kibana/; } location ~ /kibana/(.*) { proxy_pass http://kibana/$1; }

linux kernel - thread execution : how to ensure the systematic starting of thread -

i seeing different ways of starting threads in ubuntu , in other linux platform. pthread_create ( &thread1, null, (void *) &myfun1, (void *) msg1); pthread_create ( &thread2, null, (void *) &myfun2, (void *) msg2); pthread_create ( &thread3, null, (void *) &myfun3, (void *) msg3); pthread_create ( &thread4, null, (void *) &myfun4, (void *) msg4); in above case of ubuntu , first thread4 starting while in case of other linux os it's thread1. when checked reason, seems because of scheduling policies (correct me if wrong). in these cases how ensure first thread (thread1) executes first despite of different linux flavours. / generic query /, scheduling policy not depend upon kernel ? because 2 different types of thread execution seen in different linux flavours. pseudo code makes thread 1 start before other thread execute tasks: mutex mutex = ... /* static init here */ condition cond = ... /* static init here */ boolean first_thre...

python - twitter stream JSON decoding -

so, have created geo map box gather tweets, , want more precise locations using long;lat. i need out coordinates (long;lat separate) without rest of "coordinates" data. im using tweepy , understand iam not decoding right can't seem understand why doesn't work. and , how keep failing input json { u'contributors':none, u'truncated':false, u'text': u'stundas tikai l\u012bdz 12.00 \u0001f64c\u0001f389\u0001f389\u0001f389 (@ r\u012bgas valsts v\u0101cu \u0123imn\u0101zija - @rvv_gimnazija in r\u012bga) https://t.co/xcp8ozqqgk', u'in_reply_to_status_id':none, u'id':599100313690320896, u'favorite_count':0, u'source': u'<a href="http://foursquare.com" rel="nofollow">foursquare</a>', u'retweeted':false, u'coordinates':{ u'type':u'point', u'coordinates':[ 24.06...

javascript - jsCall return value to outside of jquery ajax post request -

i want jquery ajax post request value outside ajax function. code , return undefined console output. how should fix it function submit() { var outputfromajax = submitviapost('administrator/validationforinputvaluesofaddrole'); console.log(outputfromajax); } function submitviapost(url) { var formdata = $('form').serializearray(); var output; $.post(urlforphp + '/' + url, formdata, function (outputdata) { output = outputdata; }); return output; } edited i changed code sync type ajax post request , check output. not changed. here code function submit() { var outputfromajax = submitviapost('administrator/validationforinputvaluesofaddrole'); console.log(outputfromajax); } function submitviapost(url) { var formdata = $('form').serializearray(); var output; $.ajax({ url: urlforphp + '/' + url, data: formdata, datatype: 'json', ...

java - how to insert value in multiple text box in selenium webdriver -

this java code package com.ej.zob.modules; import org.openqa.selenium.by; public class setexchange { public void execute(string countryname, string value) { launchapplication.driver.findelement(by.linktext("set")).click(); launchapplication.driver.findelement(by.linktext("exchange rate")).click(); //launchapplication.driver.findelement(by.id("new_afghanistan_afn")).sendkeys(value); launchapplication.driver.findelement(by.xpath("//input[@maxlength='4']")).sendkeys(value); launchapplication.driver.findelement(by.xpath("//input[@value='set']")).click(); } } this html <div style="display: table-cell;width:270px" name="cell"> <input id="new_afghanistan_afn" type="text" maxlength="4"> <input type="button" value="set" onclick="setexchangerate('afghanistan','afn')" name="save...

Raising a 2D array to a power in C -

i'm using c , have 2d array representing square matrix. want calculate matrix power of n , given integer. i'm after efficient way this. first thought multiply matrix n times heard of exponentiation squaring. i'm not sure how implement this, please guide me through it? here basic outline: matrix matrixexponent(matrix m, int n) { matrix accumulator = matrixidentity(); matrix power2 = m; while(n != 0) { if(n & 1) accumulator = matrixmultiply(&accumulator, &power2); power2 = matrixmultiply(&power2, &power2); n = n / 2; } return accumulator; } you store accumulator, partially computed exponent. given integer exponent can broken down series of power-of-2 exponents multiplied together. example when raising array power of 14 (1110 in binary), matrix multiplied 14 times equal to: m 14 = m 8 * m 4 * m 2 so compute powers of 2 repeatedly multiplying pow...

unable to open chrome using webdriver in javascript -

i got weird problem when trying out webdriverjs on windows machine , or suggestion on one. follow instruction online, first npm install selenium-webdriver, download chromedriver , configure path. before proceed testing double check installation, chrome , firefox working , when running "chromedriver" on cmd works correctly "starting chromedriver 2.14.313457 on port 9515 local connections allowed." assume system setup correct. tried first simple example using js. below code: var webdriver = require('selenium-webdriver'); var driver = new webdriver.builder(). withcapabilities(webdriver.capabilities.firefox()). build(); driver.get('http://www.google.com/ncr'); driver.sleep(10000); driver.quit(); this works fine firefox,and firefox opened , directed google page. however, when switch second example using chrome, chrome never opened , no error messages showed, stuck there. here second example used, difference first 1 changing firefox chrom...

Python: shuffle and create a new array -

i want shuffle array, find method random.shuffle(x) , best way randomize list of strings in python can like import random rectangle = [(0,0),(0,1),(1,1),(1,0)] # want # disorderd_rectangle = rectangle.shuffle now can away with disorderd_rectangle = rectangle random.shuffle(disorderd_rectangle) print(disorderd_rectangle) print(rectangle) but returns [(1, 1), (1, 0), (0, 1), (0, 0)] [(1, 1), (1, 0), (0, 1), (0, 0)] so original array changed. how can create shuffled array without changing original one? people here advising deepcopy, surely overkill. don't mind objects in list being same, want shuffle order. that, list provides shallow copying directly. rectangle2 = rectangle.copy() random.shuffle(rectangle2) about misconception: please read http://nedbatchelder.com/text/names.html#no_copies

yii2 - Gridview pager link with pjax -

i'm using pjax in such way: <?php pjax::begin([ 'id' => 'clients-list', 'enablepushstate' => false, 'enablereplacestate' => false, ]); ?> and works fine url in browser, replaces links pagination in gridview (link action in controller processing ajax requests). how avoid it? by default, links inside pjax container trigger pjax request. to avoid it, add 'data-pjax' => 0 attribute them, , in case ignored.

multithreading - Does thread-safe generally imply greenlet-safe in Python? -

the situation have in mind using python extension module can call python, there may mixture of python , non-python stack frames @ point when greenlet yields. i assume if module uses thread-local storage misbehave greenlets. is there other reason why thread-safe module might not greenlet-safe? edit: want know whether there difference between way context switches implemented greenlets vs. regular threads. greenlets take shortcuts might work python break kinds of extension module? greenlets stay within single thread in python. cannot jump thread. if code thread-safe, greenlet safe. another way @ greenlets execute 1 @ time, have little issues have threads.

protocol buffers - protobuf-c: How to pack nested messages -

i have protobuf protocol file looks this: message foo { message bar { required string name = 1; required string value = 2; } message baz { required bar = 1; } } given protocol file, need write encoder using protobuf-c, c extension protobuf. wrote following code: foo myfoo = foo__init; foo__bar mybar = foo__bar__init; foo__baz mybaz = foo__baz__init; mybaz.a = &mybar; however, stuck @ point on how serialize mybaz . generated struct foo, not contain entry can assign mybaz to. , no method generated directly pack baz. in python, lot more simpler, since mybaz.serializetostring() function had been generated. how should go in c? declaring nested types in protocol buffers declaring nested classes in c++ or static inner classes in java. declares new type; not add field outer type. so, in proto schema, foo empty message -- has no fields. true regardless of programming language you're working in. probably meant this: ...

python - TypeError: unsupported operand type(s) for *: 'float' and 'function' -

i new python , made program calculate speed function of time of man falling approximatly 40 km. now, when run program, gives me following error: line 85 float(dvoorpara=cd*0.5*rho1*v**2*sf) typeerror: unsupported operand type(s) *: 'float' , 'function' this whole program: #data mc=1315. #kg mb=1360. #kg ms=10. #kg mh=4. #kg mp=27. #kg mf=77. #kg mused=ms+mh+mp+mf cd=1.0 sf=1.0 #m^2 sp=14.0 #m^2 r=287.0 #j/kgk g0=9.80665 #m/s^2 h=38969.3 #m hfall=36402.6 #m hpara=h-hfall #m stot=sf+sp #m^2 v=0 #m/s a=-0.0065 a2=+0.001 a3=+0.0028 rho0=1.225 #kg/m^3 p0 = 101325.0 #pa t0 = 288.15 #k t = 0 #s import matplotlib.pyplot plt #isa formulas def rho1(h): if h<=11000: t1=t0+a*(h-0) p1=((t1/t0)**(-g0/(a*r)))*p0 rho1=((t1/t0)**((-g0/(a*r))-1))*rho0 elif h>=11000 , h<=20000: t1 = (t0+a*11000) p0 = (((t1/t0)**(-g0/(a*r)))*p0) rho0 = (((t1/t0)**((-g0/(a*r))-1))*rho0) p1 = (math.e**((-g0/(r*t1))*(h-11000...

Connection of c++ with mysql in Linux -

i learning work mysql , c++ in ubuntu os. there several tutorials on how interface mysql c++ in visual studio or in windows, not 1 linux. mysql website not describe on this. can suggest me link tutorial, book or thing gives information how interface c++ mysql in linux. database in linux machine itself. great help. mysql is database, , gain access data within c++ need able “talk” database via queries (just on mysql command line interface e.g. select * tablename), connection process similar command line interface need supply connection details in hostname (localhost normally), username, password, database use , there other details can pass e.g port number more information can gained the mysql api pages. this link has example connect mysql in c++ unix

Scheduled posting to twitter in PHP cURL -

i able post tweets twitter account using twitter api. using curl. want post tweets on scheduled date/time. know possible no idea how ? code : <?php $twitter_consumer_key = 'xxx'; $twitter_consumer_secret = 'xxx'; $twitter_access_token = 'xxx'; $twitter_access_token_secret = 'xxx'; $twitter_version = '1.0'; $sign_method = 'hmac-sha1'; $status="helloworld"; $url = 'https://api.twitter.com/1.1/statuses/update.json'; $param_string = 'oauth_consumer_key=' . $this->twitter_consumer_key . '&oauth_nonce=' . time() . '&oauth_signature_method=' . $this->sign_method . '&oauth_timestamp=' . time() . '&oauth_token=' . $this->twitter_access_token . '&oauth_version=' . $this->twitter_version . '&status=' . rawurlencode($status); //generate signature base string post...

ios - Access object in UIPageView and UIViewController -

i have main uiviewcontroller had uiscrollview inside used uipageview . assign 4 uiviewcontrollers uipageview . when scroll page1, show no1 uiviewcontroller uiscrollview . my problem - want change label in controllera when user click on button in pageview1. - want change next pagedview3 when user click on button pagedview2. for 1st problem, had try call main uiviewcontroller pageview1 not able display it.

c# - NHibernate Oracle CLOBs - very slow -

i have nhibernate mapping on tables in our oracle 11g database, 1 of tables contains clob column. when attempting query out ~10,000 rows of data, query takes forever. when querying subset of 200 rows, query ran 3 minutes. mathematically means it'll take 2.5 hours query 10,000 rows. if remove clob column nhibernate mapping, same query takes ~3 seconds 200 rows, , ~2 minutes 10,000 rows. is 1 of 'by design' issues, either oracle driver, or way nhibernate handles clobs?

java - allowUnsafeRenegotiation, but still CertificateException -

i try use soapconnection call https, , have point keystore , truststore follow: system.setproperty("javax.net.ssl.keystore", "c:/kei/tasks/mip/cert/ccc_acp.keystore"); system.setproperty("javax.net.ssl.keystorepassword", "password"); system.setproperty("javax.net.ssl.truststore", "c:/kei/tasks/mip/cert/trusteaistore.keystore"); system.setproperty("javax.net.ssl.truststorepassword", "password"); system.setproperty("javax.net.debug", "all"); but still javax.net.ssl.sslhandshakeexception: java.security.cert.certificateexception: no subject alternative names present i google , find follow temporary solution system.setproperty( "sun.security.ssl.allowunsaferenegotiation", "true" ); but set allowunsaferenegotation true, still javax.net.ssl.sslhandshakeexception: java.security.cert.certificateexception: no subject alternative name...