Posts

Showing posts from January, 2010

Swift RestKit Post not including post data -

i'm not able data posted using following code. i've tried related posts on still can't work. added in request descriptor, have nsdictionary mapping parameters, tried inversemapping, ect. var parms = wearrequestparms() parms.height = height parms.width = width parms.density = density if let userid = alpinemetricshttpclient.getuserid() { parms.userid = userid } var objectmanager : rkobjectmanager? objectmanager = alpinemetricshttpclient.setupclient() // var mapping = rkobjectmapping(forclass:wearrequestparms.self) var mapping = rkobjectmapping.requestmapping() let requestmappingobjects = ["iscircle","height","width","density","userid","wearmodel","platform"] let dict : nsmutabledictionary = ["iscircle":"iscircle","height":"height","width":"width","density":"density","userid":"userid","...

javascript - Print all the names of keys stored in localStorage html -

this question has answer here: get html5 localstorage keys 8 answers i'm trying print names of keys stored in localstorage each key in separate line. code: function viewsaved(){ $('#saved').show(); var stuffsaved = object.keys(localstorage); var splitit = stuffsaved.split(','); (var = 0 ; < splitit.length ; i++ ){ $('#saved').append(splitit[i]+"<br>"); } } when call function, nothing. how do properly? object.keys returns array, not string. modify slightly: var stuffsaved = object.keys(localstorage); (var = 0 ; < stuffsaved.length ; i++ ) { $('#saved').append(stuffsaved[i]+"<br>"); } if have or expect lot of keys, suggest building list in temporary variable first avoid frequent dom update, example: var keys = object.keys(localstorage); var li...

python - Overwriting previously extracted files instead of creating new ones -

there few libraries used extract archive files through python, such gzip, zipfile library, rarfile, tarfile, patool etc. found 1 of libraries (patool) useful due cross-format feature in sense can extract type of archive including popular ones such zip, gzip, tar , rar. to extract archive file patool easy this: patoolib.extract_archive( "archive.zip",outdir="folder1") where "archive.zip" path of archive file , "folder1" path of directory extracted file stored. the extracting works fine. problem if run same code again exact same archive file, identical extracted file stored in same folder different name (filename @ first run, filename1 @ second, filename11 @ third , on. instead of this, need code overwrite extracted file if file under same name exists in directory. this extract_archive function looks minimal - have these 2 parameters, verbosity parameter, , program parameter specifies program want extract archives with. edits...

php - PayPal Reference Transaction by Billing Agreement ID -

i'm trying create php script can execute reference transaction. got in database billing-agreement-ids on page: https://developer.paypal.com/docs/classic/express-checkout/ht_ec-reftrans-setec-doreftrans-curl-etc/ (b-7fb31251f28061234). what should php script step 4? created classic api app, i'm not sure configuration. i downloaded: github.com/paypal/sdk-core-php github.com/paypal/codesamples-php github.com/paypal/rest-api-sample-app-php/ i guess should classic api because ids b-7fb31251f28061234 don't exist in rest api. what you're looking doreferencetransaction api. you'll pass in billing agreement id along amount wish charge. if you're comfortable other sdk's should able handle call without issue. say, though, you'll this sdk better. it's lot easier use paypal's, , own integration technicians prefer , recommend one.

transactions - Grails/Groovy : custom Transactional exceptions -

sorry have updated question, because quite trivial question , should have highlighted actual concerns on here. thinking it, advantage in logs or sake of tracibility having such custom exceptions of use.. i have put demo project grails: https://github.com/vahidhedayati/test-transactions ported on java example found here: https://today.java.net/pub/a/today/2006/08/31/jotm-transactions-in-spring-and-hibernate.html i still need work on @ moment trying find best approach/practice since don't think content of groovy exceptions clean should (a little more java looking groovy) example below source code package com.example.exception class flightnotfoundexception extends travelexception { public flightnotfoundexception(string message) { super(message) } public flightnotfoundexception(exception e) { super(e.getmessage()) } } is correct way of doing exception class in groovy ? source code class flightmanagerservice { @transactional def...

java - Handling special cases with generics in Swagger -

i adding swagger existing project generate documentation. works great, there's edge-cases produce weird documentation , i'm wondering if there's way handle them. one web method operate on generic types, looking this: public abstract class abstractserviceclass<t> { @apioperation(value="blah blah",tags={ "generic methods"}) @path("/dogenericthing") @post @consumes({ "application/xml", "application/json" }) @produces({ "application/xml", "application/json" }) public t dogenericthing(@apiparam t entity) { //... } } @api(value="/a.b.c") @path("a.b.c") public class concreteservice extends abstractserviceclass<someentitytype>{ //... } when swagger generates documentation concreteservice , generates documentation method dogenericthing , not able determine parameter type someentitytype . there way tell swagger parameter type of inherite...

.net - Using Service Controller in Classic ASP -

i'm trying see if can use servicecontroller in classic asp page page can send custom commands windows service. articles , questions have read online using asp.net or application/component (but sadly i'm limited using classic asp). both of attempts failed because error: microsoft vbscript compilation error '800a0401' expected end of statement here 2 attempts @ trying use servicecontroller on asp page: attempt #1 expected end of statement points '(' dim myservice set myservice = new servicecontroller("mynewservice") myservice.executecommand(0) myservice.executecommand(1) myservice.executecommand(2) attempt #2 expected end of statement points 'as' dim myservice new servicecontroller("mynewservice") myservice.executecommand(0) myservice.executecommand(1) myservice.executecommand(2) so, possible use servicecontroller in classic asp? please explain how possible or why not possible. servicecontroller .net class,...

php - AJAX/Jquery Store dropdown value in variable -

in script have following:- <script> $("#country").on("change", function(){ var selected = $(this).val(); $("#results").html("<div class='alert-box success'><span><img src='images/shipping_ukrm.jpg'></span> <b>&pound" + selected + " plus packaging</b></div>"); $('#frmelement').val(selected); }) </script> i select country in turn gets value of option value in dropdown select field, want store dropdown value country name in variable pass , use within form anyone help this select dropdown box information echo '<select name="country" id="country" class="span5" />'; echo '<option value="0" selected>select country</option>'; mysql_connect("$host", "$username", "$password")or die("canno...

c# - Attaching Issue in Entity Framework -

i create stored procedure returns table (physically stored table). create procedure usptest begin select * table1 end when capture output using entity framework, loads entity properly. var output = entities.database.sqlquery<table1>("dbo.usptest").tolist<table1>(); the "output" variable contains data returned sp list of table1 object doesn't not load foreign key tables automatically. added below code mitigate problem foreach (var member in output) { entities.table1s.attach(member); } after attaching each entity child tables linked each table1 member. but, when come same method second time, gives me error failing attach. attaching entity of type 'table1' failed because entity of same type has same primary key value. can happen when using 'attach' method or setting state of entity 'unchanged' or 'modified' if entities in graph have conflicting key values. i tried setting state of entity detache...

javascript - Error in generating multidimensional array from JSON array -

i use javascript obtain data server through php. php obtains data mysql, encodes json data , sends via http protocol client - in case, browser. javascript i.e. shown below picks values , renders chart. testing i'm printing out conversion of jsonarray stringarray output of php. any suggestions why when js code gets point below mylogger("mylogger - newobject.dummmysetsjsonarr.entryid" + newobject.dummmysetsjsonarr.entryid); it throws following error seen in console: uncaught typeerror cannot read property 'entryid' of undefined here's example of db data converted json: {"dummmysetsjsonarr":[{"entryid":"1","distance":"100","calories":"50"},{"entryid":"2","distance":"200","calories":"100"},{"entryid":"3","distance":"300","calories":"150"},{"entryid...

java - new BigDecimal(double) vs new BigDecimal(String) -

this question has answer here: bigdecimal double incorrect value? 3 answers convert double bigdecimal , set bigdecimal precision 7 answers when bigdecimal used input of double , bigdecimal input of string different results seem appear. bigdecimal = new bigdecimal(0.333333333); bigdecimal b = new bigdecimal(0.666666666); bigdecimal c = new bigdecimal("0.333333333"); bigdecimal d = new bigdecimal("0.666666666"); bigdecimal x = a.multiply(b); bigdecimal y = c.multiply(d); system.out.println(x); system.out.println(y); x outputs as 0.222222221777777790569747304508155316795087227497352441864147715340493949298661391367204487323760986328125 while y is 0.222222221777777778 am wrong in saying because of double imprecision? since bigdecimal , should...

java - Jtable does not refresh after inserting a new data -

here iam trying search prodcuts jtable.but problem is,the new search results getting added under previous search results , not updating jtable used firetabledatachanged() method. here code @override public void actionperformed(actionevent e) { system.out.println("im in createiban values: " +combobox.getselecteditem()+ " , " + textfield.gettext()); if(combobox.getselecteditem().tostring().equals("serial no")) { system.out.println("0"); string cmb=textfield.gettext().tostring(); try{ con= (connection) connect.connectdb(); string sql="select * stocks serial=?"; pst = (preparedstatement) con.preparestatement(sql); pst.setstring(1, cmb); rs=pst.executequery(); model = (defaulttablemodel) jt.getmodel(); model.firetabledatachanged(); **//here used method** while(rs.next()) { dt = rs.getstring("d...

Global sum wrong with multi threads in JAVA -

i'm new multi-threads in java , made little code see how works. have global = 0 global int variable, , for loop initialize lot of threads (100) add 1 global variable. @ end of code result should 100, not. have 99 @ end of code or other number (around 100). question is, why threads "fight" between them , don't make sum right? public class test extends thread { public static int global =0; public static void main(string[] args) throws exception { for(int i=0;i<100;i++){ string stream = string.valueof(i); new test2(stream).start(); } thread.sleep(1000); system.out.println(global); } public test(string str) { super(str); } public void run() { int = integer.parseint(getname()); global = global+1; system.out.println("el hilo "+a+" tiene el número "+global); } } i know don't need int ...

django haystack elasticsearch multiple search fields -

i have implemented haystack search engine 2 models. models meant searched within same field ok. want different search index new model , index has no connection first 2 , used on different page different search field. don't know how this. read can use 2 engines this, after settings don't know how tell in views use different model second search. haystack_connections = { 'default': { 'engine': 'haystack.backends.elasticsearch_backend.elasticsearchsearchengine', 'url': 'http://127.0.0.1:9200/', 'index_name': 'haystack', 'excluded_indexes': ['names.search_indexes.namesindex'], }, 'autocomplete': { 'engine': 'haystack.backends.elasticsearch_backend.elasticsearchsearchengine', 'url': 'http://127.0.0.1:9200/', 'index_name': 'autcomplete', 'excluded_indexes': ['play...

java - Unable to publish my application to WAS 7.0.0.29 on RAD 7.5.5.5 iFix1 -

i'm trying publish application 7.0.0.29, facing below issue. environment details below: operating system: windows 7 rad version: 7.5.5.5 ifix1 version: 7.0.0.29 error details: 00000018 ffdcprovider w com.ibm.ws.ffdc.impl.ffdcprovider logincident ffdc1003i: ffdc incident emitted on c:\program files (x86)\ibm\sdp\runtimes\base_v7\profiles\appsrv01\logs\ffdc\server1_59175917_15.04.14_12.14.50.5172426886460813428056.txt com.ibm.ws.management.application.task.configuretask.performtask 363 00000018 ffdcprovider w com.ibm.ws.ffdc.impl.ffdcprovider logincident ffdc1003i: ffdc incident emitted on c:\program files (x86)\ibm\sdp\runtimes\base_v7\profiles\appsrv01\logs\ffdc\server1_59175917_15.04.14_12.14.50.5481471140400342152325.txt com.ibm.ws.management.application.schedulerimpl.run 307 00000018 **systemerr r java.lang.nullpointerexception** 00000018 systemerr r @ **com.ibm.ws.management.application.task.configuretask.getmdfrommoduleref(configuretask.java:1450)** ...

python - IndentionError: unexpected indent, in except statement -

i making python program checks if server if isn't tweet saying it's down. go on tweet when comes up. but when run code error: file "tweet_bot.py", line 31 textfile = open('/root/documents/server_check.txt','w') ^ indentationerror: unexpected indent my code broken section below: try : response = urlopen( url ) except httperror, e: tweet_text = "raspberry pi server down!" textfile = open('/root/documents/server_check.txt','w') textfile.write("down") textfile.close() except urlerror, e: tweet_text = "raspberry pi server down!" textfile = open('/root/documents/server_check.txt','w') textfile.write("down") textfile.close() else : html = response.read() if textfile = "down": tweet_text = "raspberry pi server up!" textfile = open('/root/documents/server_check.txt','w') ...

ruby on rails - Before filter on new and create actions? -

i have security related, general question rails. let's assume have controller this: def projectscontroller before_action :user_has_paid, :only => [ :new, :create ] ... def new @project = project.new end def create @project = current_user.projects.build(project_params) if @project.save flash[:success] = "project saved." redirect_to projects_path else render :new end end ... private def user_has_paid if current_user.has_not_paid? flash[:notice] = "you must pay first." redirect_to payments_path end end end from security point-of-view: need before_action on both new and create action? to save couple of sql queries use on new action only, wonder if that's save or if malicious user might able circumvent new action , create project anyway, without having paid first. thanks advice. from security perspective you'll want have before_a...

c# - How to handle lots of derived model with only one controller -

i using asp.net mvc , have several model classes derived parent object. want handle of these models in 1 controller action since identical exception of data fields. want save them database. how can achieve such behavior? example: class parentmodel {...} class childmodel1 : parentmodel {...} class childmodel2 : parentmodel {...} class childmodel3 : parentmodel {...} class childmodel4 : parentmodel {...} public class modelcontroller : controller { //but want handle child objects //and add them automatically database. public actionresult add(parentmodel model) { db.parentmodel.add(model); } } you should create viewmodel class such : public class viewmodel { public childmodel1 childmodel1 { get; set; } public childmodel2 childmodel2 { get; set; } public childmodel3 childmodel3 { get; set; } public childmodel4 childmodel4 { get; set; } } then cre...

ios - 'Done' UINavigationBarButtonItem on right side cut off -

Image
i'm using uibarbuttonitem result: i'm using code add navigation self.donebutton = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemdone target:self action:@selector(dismisswebviewcontroller:)]; [self.navigationitem setrightbarbuttonitem:self.donebutton]; what i'm doing wrong? looks navigation bar larger screen. check out storyboard. select navigation bar, must see square @ begining , @ end of element. if not, move fit screen. as reference navigation bar iphone 6 4.7 inch application 375 width. in addition, review if have set constraints correctly. review navigation bar has "spacing nearest neighbor" 0 top , -16 left , right.

Checking arduino code with multimeter -

when upload code on arduino ,sometimes not desired results. saw friend of mine doing test on arduino using multimeter make sure code right. he said can make sure code right checking voltages on carious i/o pins on arduino. if voltage on i/o pins less 5 v code having error,and if chckt voltage on rx , tx pins should 0.29 v. i know question posted me not clear, worked not able understand properly. so if can deduce means , how done so, please proide answer? there 2 main things test multimeter: voltage of power arduino (between 5v , gnd), , voltage of io pins (between them , gnd). voltage of power supply tells if arduino powered correctly, if power management circuits or power supply have failed, you'll able pick here. voltage of outputs should either 5v or 0v, relative ground. testing voltage on pin can tell whether being written high (5v) or low (0v) arduino, hence seeing code doing pins. i should make clear there no right or wrong way tell if code in genera...

linux - Decrease Decimals in Fourth Column In a Text File -

i have text file fourth column contains numbers many decimal places. need reduce places 0.1 decimal place. data: 2015041416 kbos tmp2m 62.034 2015041417 kbos tmp2m 65.0826 2015041418 kbos tmp2m 66.7278 2015041419 kbos tmp2m 67.5033 2015041420 kbos tmp2m 67.1731 2015041421 kbos tmp2m 65.9252 2015041422 kbos tmp2m 62.7644 2015041423 kbos tmp2m 60.8136 2015041500 kbos tmp2m 56.167 2015041501 kbos tmp2m 55.7116 2015041502 kbos tmp2m 51.8512 2015041503 kbos tmp2m 51.6005 2015041504 kbos tmp2m 50.1643 2015041505 kbos tmp2m 49.2167 2015041506 kbos tmp2m 48.273 2015041507 kbos tmp2m 46.6407 awk '{printf "%s %s %s %.1f\n",$1, $2, $3, $4}' file > file2 output file2: 2015041416 kbos tmp2m 62.0 2015041417 kbos tmp2m 65.1 2015041418 kbos tmp2m 66.7 2015041419 kbos tmp2m 67.5 2015041420 kbos tmp2m 67.2 2015041421 kbos tmp2m 65.9 2015041422 kbos tmp2m 62.8 2015041423 kbos tmp2m 60.8 2015041500 kbos tmp2m 56.2 2015041501 kbos tmp2m 55.7 2015041502 kbos tmp2m ...

automation - Fuse Fabric8 Clustering -

i noob in fabric8. have doubt regarding clustering docker images. i have pulled docker image fabric8 fabric8/fabric8 . want make containers launch automatically fall same cluster without using fabric:create , fabric:join . say if launch 3 containers of fabric8/fabric8 should fall under same cluster without manual configuration. please give links references. i'm lost. thanks in advance in fabric8 v1 idea create fabric, using fabric:create command , spin docker container, using docker container provider in pretty same way doing child containers (either using container-create-docker command or using hawtio , selecting docker container type).

javascript - PhonegapBuild plugins -

i'm new using plugins phonegap, know how connect plugin app via config.xml can't figure out i'm supposed put js comes plug in. want change status bar appearance integrated this: https://github.com/phonegap-build/statusbarplugin/tree/0944be5c9f96ca0e39e0079f46ffc37894a586cd change content colour need copy js somewhere, , that? in index.html, special js file? , same process every other plugin too? thanks in advance. all library files plugin bundled default plugins folder. using plugin, related javascript have call after deviceready event. deviceready event fired when cordova/phonegap loaded.once event fires, can safely make calls cordova apis. ex: document.addeventlistener("deviceready", ondeviceready, false); function ondeviceready() { // safe use device apis statusbar.backgroundcolorbyname("red"); }

c# - InsertOnSubmit on Linq - Put it into the database -

Image
this how going users of website can sustain themselves, when try this, what could'm going happened in code here create user in database. protected void buttonopretbruger_click(object sender, eventargs e) { string fejl = "hov hov, du skal læse vore betingelser"; if (checkboxbetingelser.checked) { labelerror.visible = false; string brugernavn = system.globalization.cultureinfo.currentuiculture.textinfo.totitlecase(textboxbrugernavn.text); //checks if username exists in database. var opretbrugertjekemail = db.brugeres.firstordefault(brugeremail => brugeremail.brugernavn == brugernavn); if (opretbrugertjekemail == null) { //begin create user in database. opretbrugertjekemail.brugernavn = brugernavn; opretbrugertjekemail.adgangskode = hash.gethashsha256(textboxadgangskode.text); opretbrugertjekemail.fornavn = textboxfornavn.text; opretbrugertjeke...

windows - Making a C++ application "Opened with..." -

i'm working on (c++) program more or less revolves around renaming files. make can select file, right-mouse click , select "open with" , select application. got context menu part figured out, don't know how c++ part. in other words, how make program (in c++) can opened file (so context menu or directly opening it) , process file? example: in windows, associate ".roberto" extension " c:\program files\myprogram\myprogram.exe ". if open ".roberto" file, command prompt pops up, displaying name of selected file. i hope clear, not sure how explain this. had trouble searching on question, please forgive me if has been asked before. thanks. on windows platform in mfc -based application done automatically framework in initinstance() method of application class: enableshellopen(); registershellfiletypes(true); important: in general functionality framework dependent , os speicific.

encrypt SQL connectionstring c# -

i created c# application (not asp webpage) connects sql 2005 server. in sourcecode password , userid sql-server coded plain text in connectionstring. sqlconnection con = new sqlconnection(); con.connectionstring = "data source=server1;"+ "initial catalog=mydatabase;"+ "integrated security=no;"+ "user id=admin;password=mypassword;"; con.open(); is there easy way encrypt password or whole connectionstring, other peoples disassemble tool not able see password? thanks you should store connection string in config file , encrypt section. see http://www.4guysfromrolla.com/articles/021506-1.aspx or http://msdn.microsoft.com/en-us/library/89211k9b%28vs.80%29.aspx .

php - There's a way of applying a laravel filter for HTTP method? Like on POST? -

i develop system using laravel , , system has kind of user how can special operations, called master. he 1 kind of user how can create/edit things. users "read" permissions can read (show method), though. there's way of applying filter post methods? note: use laravel "route::resource" , grouping them , apllying filter, dispite fact more logical , easy, not easy task do. you can register filters directly in controller documented here this post requests: public function __construct() { $this->beforefilter('permission', array('on' => 'post')); } or specific controller methods: $this->beforefilter('permission', array('only' => array('create', 'edit', 'store', 'update', 'delete')); however in scenario simplest thing might specify methods allowed call: $this->beforefilter('permission', array('except' => array('index...

Get rid of moron view in Intellij -

Image
so when check out project in intellij shows normal ide files on right side can see them all. shows in call moron view because of directories stacked along top , can open 1 file @ time , not see entire structure. sure serves purpose since have used webstorm on year , intellij 3 months assume changing project structure view simple option... know how change view moron normal. change this: to this: your 2 screen shots show 2 different things: navigation bar (screen shot 1) , project view (screen shot 2). it looks have moved project view button top (the 1 intellij idea icon). drag , drop or right click , select move > left , move left side again. need resize , make bigger, see project file tree again. after that, call moron view, still visible. in intellij idea called navigation bar. , can show , hidden via view menu.

debugging - Mutlithreaded python application not hitting breakpoints in Visual Studio -

i developing pyqt application in visual studio. debugging has been working great, until decided keep ui responsive moving stuff worker thread qt threads. class mainwindow(base, form): start_work = qtcore.pyqtsignal() def __init__(self, parent=none): # create seperate thread in update information polled. self.thread = qtcore.qthread() # create worker object , move new thread self.worker = worker() self.worker.movetothread(self.thread) # connect signal start work in tread self.start_work.connect(self.worker.get_work_done) self.thread.start() #function emit signal start doing work def do_work(self): self.startwork.emit() any function invoked on worker object connected via signal slots class worker(qtcore.qobject): @qtcore.pyqtslot() def get_work_done(self): #lets time consuming work. the code works fine. problem now, cannot debug happening inside get_work_done . visual st...

Verify returned list with a list in python? -

i have function returns me single list. i'm trying take returned , find if exists in list have. missing 'for' loop iterate through cat_colors list? or 'color' returned in way can't match in list? trying understand , if have better solution? for cat in cat_names: color = get_color(cat) print cat_colors print color if color not in cat_colors: print "fail" else: print "pass" output print: ['brown', 'grey', 'white', 'black', 'red', 'orange', 'green', 'blue'] ['brown'] fail ['brown', 'grey', 'white', 'black', 'red', 'orange', 'green', 'blue'] ['grey'] fail ... ['brown'] isn't in ['brown', 'grey', 'white', 'black', 'red', 'orange', 'green', 'blue'] . string 'brown...

maven - Get Code Coverage for GWT project using Jacoco surefire -

i having gwt maven project , want find code coverage. getting report coverage 0%. pom.xml <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>gwt-maven-plugin</artifactid> <version>2.7.0</version> <executions> <execution> <configuration> <extrajvmargs>-xmx512m</extrajvmargs> </configuration> <goals> <goal>compile</goal> <goal>generateasync</goal> <goal>test</goal> </goals> </execution> </executions> </plugin> <plugin> <artifactid>maven-surefire-plugin</artifactid> <version>2.6</version> <configuration> <argline>${jacocoargs}</argline...

oracle11g - SQL Error: ORA-12899: Overflow inserting null in 30 character column -

i running simple insert select , code insert temp select a.emp_name, null address, a.emp_id, ....... temp1 a,temp2 b a.batch_id=b.batch_id now column address varchar2(30) though inserting null . got overflow . sql error: ora-12899: value large column "temp"."address" (actual: 35, maximum: 30) really puzzled how can happen.can provide tips? using oracle 11g you putting wrong values columns, since haven't specified them in insert clause. it's better list columns explicitly , not rely on order appear in data dictionary: insert temp (emp_name, address, empi_id, ...) select a.emp_name, null, a.emp_id, ....... temp1 join temp2 b on a.batch_id=b.batch_id i've changed explicit join syntax, though isn't relevant question...

ssl - Verify certificates using OpenSSL -

i created 2 intermediate certificates called cert1.crt , cert2.crt signed common cert0 root , need verify them using verify command. i type: verify -cafile cert1.crt cert2.crt what is: error 20 @ 0 depth lookup:unable local issuer certificate. same error appears when replaced .crt files 2 .pem files generated certificates. doing wrong? use openssl toolkit operating system windows 8. i don't know how create common cert0 root. you can following steps: 0) create ca private key , rootreq $ openssl req -nodes -newkey rsa:1024 -sha1 -keyout rootkey.pem -out rootreq.pem 1) create ca self-signed cert $ openssl x509 -req -in rootreq.pem -sha1 -signkey rootkey.pem -out rootcert.pem 2) create client private key , certreq $ openssl req -nodes -newkey rsa:1024 -sha1 -keyout userkey.pem -out userreq.pem 3) create client cert client certreq $ openssl x509 -req -in userreq.pem -sha1 -ca rootcert.pem -cakey rootkey.pem -cacreateserial -out usercert.pem 4)...

machine learning - R: Tuning SVM parameter - class.weights in {e1071} package -

i wanted training svm classifier package {e1071}. realize class.weight 1 of parameters wanted tune. eg. want test 2 class weights c(25, 50) vs. c(20, 55) wonder if build in tune function job, , if so, how? here training data: training.data = height0 height1 height2 weight0 weight1 gender class 1 0 1 0 1 0 1 1 2 0 1 0 0 1 0 1 3 0 1 0 0 0 1 1 4 1 0 0 1 0 0 1 5 0 1 0 0 1 0 2 6 0 1 0 0 1 0 2 and there 2 levels in response variable 'class' training.data$class = [1] 1 1 1 1 2 2 levels: 1 2 i want use function this, param.obj <- tune(svm, class ~., data = training.data, ranges = list("1" = c(25, 20), "2" = c(50,55) ), tunecontrol = tune.control(sampling = "cross", cross = 5) ) but don't thin...

POST flask server with XML from python -

i have flask server , running on pythonanywhere , trying write python script can run locally trigger particular response - lets server time, sake of discussion. there tonnes , tonnes of documentation on how write flask server side of process, non/very little on how write can trigger flask app run. have tried sending xml in form of simple curl command e.g. curl -x post -d '<from>jack</from><body>hello, worked!</body>' url but doesnt seem work (errors referral headers). could let me know correct way compose xml can sent listening flask server. thanks, jack first, add -h "content-type: text/xml" headers in curl call server knows expect. helpful if posted server code (not everything, @ least what's failing). to debug use @app.before_request def before_request(): if true: print "headers", request.headers print "req_path", request.path print "args",request.args...

Passing PHP Array to Javascript OnLoad -

i trying pass in php array javascript function through onload(); in similardomains.php: <?php $domainsjs = json_encode($similardomainsunique); ?> <body onload="init(<?php echo "\"$domainsjs\""; ?>);"> i pass string object in order later process string using json.parse(). in javascript have var obj = json.parse(domainsjs); for string processing. seems have syntaxerror: syntax error @ line 1. html doctype. if remove doctype, goes next first line. appears when have body onload calling php did. how can process php array in order used in javascript. after said , done, have input processed values js array. here body onload turns out in html <body onload="init("{"0":"estatelawyer.com","1":"reaestatelawyer.com","2":"estately.com","3":"thestate.com","4":"estaterescue.com","5":"boisestate.edu",...

CouchDB and PouchDB plain users can create Databases -

i don't want normal users able create databases. in futon screen /_utils, when logged in plain user, functions expected. admins can create databases. but when sync pouchdb couchdb, plain users can create (replicate?) database. want adding of new databases restricted admin users. also noticed existing db edited when user restricted. how can fix this? var remotecouch = http://testuser:testuser@{domain}.iriscouch.com/testdb; pouchdb.debug.disable(); if (remotecouch) { sync(); } else { console.log("no remote server."); } function sync() { var opts = {live: true}; db.replicate.to(remotecouch, opts, syncerror); db.replicate.from(remotecouch, opts, syncerror); } edit testuser not in /_config/admins testuser: { "_id": "org.couchdb.user:testuser", "_rev": "1-7d28b3388a62cfca103cbe3642549bee", "password_scheme": "pbkdf2", "iterations": 10, "type...

c# - Can't call controls in ItemTemplate -

i have listview element has itemtemplate within has image element within can't access in code reason, way this? <div class="container"> <asp:listview id="listview1" runat="server"> <itemtemplate> <div class="col-sm-6 col-md-4"> <div class="thumbnail"> <h4><%# eval("colour") + " " + eval("make") + " " + eval("model") + " " + "(" + eval("type") + ")"%></h4> <asp:image id="image1" class="main" runat="server" /> <div class="caption"> <h4><div class="title"> seller: </div><%# eval("first_name") + " " + eval("last_name")%></h4> <h4><div class="title"> location: </div><%# eval("city") %></h4> <h4><div class="title...

mysql - DataSource leaves sleeping connections -

i'm using spring , have setup datasource bean: @bean datasource getdatasource(){ mysqldatasource ds = new mysqldatasource(); ds.seturl(database_url); return ds; } i'm able inject datasource object using spring's @autowired annotation , perform operations on database. i'm running against test instance of mysql server (with connection limit of 150) , reached limit within few minutes. checked on number of connections, , majority of 150 connections sleeping. to decrease number of sleeping connections, i've tried following, none successful: 1) instead of calling datasource.getconnection() in each of dao's methods, instead @autowired method called setdatasource(datasource ds) in saved reference connection. thinking instead of calling datasource.getconnection() each time, particular instance of dao use 1 connection instead. doing worked fine, , decreased number of sleeping connections, not much. 2) manually called close() method on conne...

java - Can't see why this won't work | Loop won't run -

public static void main(string[] args) { scanner xis = new scanner(system.in); int h1 = 0; int m1 = 0; int h2 = 0; int m2 = 0; int[] numeros = new int[4]; system.out.println("type numbers."); for(int = 0; <= numeros.length; i++) { numeros[i] = xis.nextint(); h1 = h1 + numeros[0]; m1 = m1 + numeros[1]; h2 = h2 + numeros[2]; m2 = m2 + numeros[3]; } system.out.println(h1); system.out.println(h2); int horaduracao = (h2 - h1) * -1; int minutoduracao = (m2 - m1) * -1; if(horaduracao <= 0) { horaduracao = horaduracao + 24; } if (minutoduracao <= 0) { minutoduracao = minutoduracao + 59; horaduracao = horaduracao + -1; } } when user types answer this: system.out.println("type numbers."); it won't continue next part of code. sorry if it's repost, kept searching time this, couldn't find. your lo...

Unable to execute pig scripts using Azure powershell -

Image
this pig script $querystring = "a = load 'wasb://$containername@$storageaccount.blob.core.windows.net/table1' using pigstorage(',') (col1 chararray,col2 chararray,col3 chararray,col4 chararray,col5 chararray,col6 chararray,col7 int,col8 int);" + "user_list = foreach generate $0;" + "unique_user = distinct user_list;" + "unique_users_group = group unique_user all;" + "uu_count = foreach unique_users_group generate count(unique_user);" + "dump uu_count;" i error when execute above pig script '2015-04-14 23:17:55,177 [main] error org.apache.pig.pigserver - exception during parsing: error during parsing. <line 1, column 166> mismatched input 'chararray' expecting right_paren failed parse: <line 1, column 166> mismatched input 'chararray' expecting right_paren @ org.apache.pig.parser.queryparserdriver.parse(queryparserdriver.java:241) @ org.apache.pig.parser.queryparserdr...

javascript - Space out nodes evenly around root node in D3 force layout -

Image
i starting on d3, if has general suggestions on thing might not doing correctly/optimally, please let me know :) i trying create force directed graph nodes spaced out evenly (or close enough) around center root node (noted larger size). here's example of layout i'm trying achieve (i understand won't same every time): i have following graph: var width = $("#thevizness").width(), height = $("#thevizness").height(); var color = d3.scale.ordinal().range(["#ff0000", "#fff000", "#ff4900"]); var force = d3.layout.force() .charge(-120) .linkdistance(30) .size([width, height]); var svg = d3.select("#thevizness").append("svg") .attr("width", width) .attr("height", height); var loading = svg.append("text") .attr("class", "loading") .attr("x", width / 2) .attr("y", height / 2) .attr("dy...

How to group data using GoogleVis in R -

i have data frame: df <- data.frame(country=c("us", "gb", "br", "us"), val1=c(1, 3, 4, 6), val2=c(23, 12, 32, 17)) when plot bar chart using googlevis , gives me barlines each country (us twice). bar1 <- gvisbarchart(df, xvar="country", yvar=c("val1", "val2")) plot(bar1) what want group sum of val1 , val2 on graph. try aggregating data first. library(googlevis) df.summary <- aggregate(cbind(val1, val2) ~ country, data=df, fun = sum) df.summary ## country val1 val2 ## 1 br 4 32 ## 2 gb 3 12 ## 3 7 40 bar1 <- gvisbarchart(df, xvar="country", yvar=c("val1", "val2")) plot(bar1)

How can I extract column value corresponding to maximum row value in R? -

this question has answer here: for each row return column name of largest value 3 answers i need calculate : a) maximum , minimum (temperature) values every row of data set(200 such rows). b) every column corresponds 'jan', 'feb' ... 'dec' (12 columns). thus, need find month associated maximum , minimum temperature. for (a) works: i= 1 temp.max = null for(i in 1:200) { temp.max[i]<- max(temp.data[i,1:12])} can please me (b)? eg. if dataset looks : jan feb mar apr may jun ... dec 1 2 3 4 12 6 2 max value 12. need output that, 'may' corresponding month. max.col handy (i've repeated first row 3 times show works multiple rows): names(dat)[max.col(dat,ties.method="first")] #[1] "may" "may" "may" data used: dat <- setnames(data.frame(matrix...

Using specific web service -

i'm trying use web service hosted in government server in mexico. have followed many tutorials can't work , think more complex thought. the service one: https://www.ventanillaunica.gob.mx/ventanilla-ws-pedimentos/consultarpedimentocompletoservice?wsdl what add web reference on visual studio , shows me many clases , delegate no methods use.

underscore.js - Javascript (Underscore), function to change javascript object -

this question has answer here: javascript, transforming object underscore (or not) 2 answers trying change object prepare send taking array inside , turning object items in array being keys values of true. it starts out looking - {"state":["saved","published"],"discipline":["marketing"]} so end result {"state":{"saved":true,"published":true},"discipline":{"marketing":true}} so looks @ array , changes object values of true. trying use underscore plain js work fine. here attempt, there better way this, maybe underscore? - function transformoutputtofiltermodel(model) { var transformedobj = _.map(model, function(obj) { return obj.reduce(function(obj, k) { obj[k] = true; retu...

Bash read & parse file - loop performance -

i'm trying read file, , parse in bash. need dd convert ebcdic ascii , loop , read x bytes, piping each x bytes row in new file: #!/bin/bash # $1 = input file in ebcdic # $2 = row length # $3 = output file # convert ascii , replace nul (^@) ' ' dd conv=ascii if=$1 | sed 's/\x0/ /g' > $3.tmp file=$(cat "$3.tmp") sindex=1 findex=$2 # remove file rm $3 echo "filesize: ${#file}"; # loop, retrieving each fixed-size record , appending file while true; # append record file echo "${file:sindex:findex}" >> $3; # break @ end of file if [ $findex -ge ${#file} ] break; fi # increment index sindex=$((sindex+findex)); done # remove tmp rm $3.tmp any way make whole process faster? answering own question. answer simple use of fold ! # $1 = ascii input file # $2 = file record length (i.e. 100) # $3 = output file (non-delimited, row-separated file) # dd : convert ebcdic ...

ant - How to add a Netbeans project as a dependency to a Gradle project? -

i new gradle , of existing projects in ant (netbeans projects). do have create gradle project each of projects want reuse? can straightaway declare existing netbeans projects dependencies in gradle project? if yes, how? thanks. the simplest approach add dependency on files produced ant build (they in build/dist ). similar gradle dependencies file directories better solution start using repository manager: ivy, artifactory, nexus. update netbeans projects publish built artifacts repository , gradle projects can refer them. check more details in http://gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html

java - How do I implement a class that loads a file into my program that other classes can use? -

okay building program sort grades , records of students. command-line program , when run start asking user input. there several commands such exit(exits program), load [file name](loads file name), student [student name] (loads student records), etc. others not important. wondering , stuck on functions in separate classes , called when user inputs specific command, if put "load" command in own class, how share information other classes? know have use bufferreader read in files, how go implementing load class, or if there better way feel free so. here code far. there isn't on other classes because feel need figure out how read in , share file other classes first. import java.util.*; import java.io.*; public class program7 { public static void main(string[] args) { scanner scan = new scanner(system.in); system.out.println("grade stats "); system.out.print(">"); while(scan.hasnextline()) { ...