Posts

Showing posts from March, 2013

Plot function line on scatter plot R -

Image
i have function eq = function(x){x*2} for line plot on scatter plot in r. my attempt follows (have not posted data, not runnable, syntacticly equivalent): plot(per_class$input_kb, per_class$kb, col="red", ylab="peak memory usage (kb)", xlab="input data (kb)", main="peak memory per input size") which give me plot. try lines(eq,y=null) however, error. error in as.double(y) : cannot coerce type 'closure' vector of type 'double' is there way plot function on plot in r (ideally without ggplot2)? or have make data frame representing function...seems kinda hacked. when plotting function, can either use lines or use curve . the error arising because lines requires vector (or matrix) arguments (type 'double' in error message) , feeding function (type 'closure'). the curve function designed directly plotting functions , may preferable. below example of plotting 2 functions estimate s...

asp.net mvc 4 - Changing c# code from database first to Code First -

i have succesfuuly migrated application database first code first, further want automatically change code structure instead of doing manually. for example, in database first: test_masters tt = new test_masters(); tt.test_name = "httt"; edmx.addtotest_masters(tt); // database first syntax edmx.savechanges(); so above thing have manually change support code first syntax. in code-first: test_masters tt = new test_masters(); tt.test_name = "httt"; edmx.test_masters.add(tt); // code-first syntax edmx.savechanges(); is there other way automatically change above code instead of doing manually? same applies stored procedures: var data1 = edmx.sp_gettest("cbc").tolist(); // database first syntax var data = edmx.database.sqlquery<string>("sp_gettest @testname,@active", new sqlparameter("testname", "lisa"), new sqlparameter("active", false)).tolist(); // code-first syntax

Fiware Cosmos Hive connection with Python -

i´m trying send hive queries fiware cosmos using following python code: with pyhs2.connect(host='cosmos.lab.fiware.org',port=10000, authmechanism="plain", user='xxx', password="xxx", database ="xxx" ) conn: print ("pyhs --- %s seconds ---" % ( time.time() - start_time)) conn.cursor() cur: print ("conn ok --- %s seconds ---" % ( time.time() - start_time)) cur.execute("add jar /usr/local/apache-hive-0.13.0-bin/lib/json-serde-1.3.1-snapshot-jar-with-dependencies.jar") but following error: raceback (most recent call last): file "script2.py", line 40, in <module> database ="default" ) conn: file...

javascript - Replace element with new one in React.js -

i'm trying replace <input> element new one, in order clear it. in render method: let fileinput = null fileinput = ( <input id={this.props.name} key={performance.now()} accept="image/*" onchange={this.handlechange.bind(this)} type="file"/> ) return fileinput render() called each time select item (due component updating info displayed) , therefore should replace <input> new one, doesn't. why?

Google App Engine - Search API index growth -

i know how can estimate growth (how size increasez in period of time) of index of app engine search api (fts) based on number of entities inserted , amount of information. know how index size calculated (on depend). specifically: when inserting new entities, growth (size) influenced number of previous existing entities? (ie. growth exponential)? ex. if have 1000 entities , insert 10, index grow x bytes. if have 100000 entities , insert 10, increase x or more x (exponentially, let' 10*x) ? does number of fields (properties) influences size exponentially? ex. if have entity 2 fields , entity b 4 fields (let's identical in values, mathematical simplicity) size increase, when adding entity b, twice of entity or more that? what other means can use find statistical information; have other tools in cloud console of app engine, or can programmatically ? thank you. you can check size of given index running code below. from google.appengine.api import search inde...

php - Combine Nested While Statement -

i have nested while statement gives results need inefficient , takes forever run? thoughts on how these combined? i first create temporary table data need larger table called student grades . students , course names because want group these each report. each student scores each assignment. want average of of last 3 assignments each particular learning outcome id. //mysql query create temp table $qrytmp = "create temporary table if not exists tmp (select studentsisid,coursename,assessmenttitle,studentname,outcomescore,recordid,learningoutcomeid,learningoutcomename,assessmentid studentgrades studentsisid '$studentid' , coursename '$coursename')"; mysql_query($qrytmp); //mysql query coursename , student name $qrycourse = "select studentsisid,coursename,studentname tmp studentsisid '$studentid' , coursename '$coursename' group studentsisid,coursename order studentname,coursename"; $resultcourse=mysql_query($qrycourse); while...

arduino uno - DC motor speed control by aurdino using processing -

i have attached video link. in dc motor speed controlled using aurdino uno , processing software moving cursor of laptop. want control laptop aero keys . please send me modified program if possible. https://youtu.be/sqdawycrfu0 you can find program on this: http://www.instructables.com/id/speed-control-of-dc-motor-from-laptop-using-arduin/ please consult the reference , you'll find handy input functions, including keypressed() function. can use input arrow keys. void keypressed(){ if (keycode == up) { //up } else if (keycode == down) { //down } else if(keycode == left){ //left } else if(keycode == right){ //right } } more info can found in this tutorial on user input in processing . (note: wrote tutorial.) by way, it's hard answer general "how do this" type questions other pointing reference , google. stack overflow designed more specific "i tried x, expected y, got z instead...

javascript - Show information after mouseover on image -

i have 3 pictures on website generated way: <!doctype html> <html lang="de"> <head> <meta charset="utf-8"> <title>ajax</title> <meta name="viewport" content="width=device-width; initial-scale=1.0"> <link rel="stylesheet" type="text/css" href="lib/css/stil.css" /> <script type="text/javascript" src="lib/js/ajaxeinsendeaufgabe2.js"></script> </head> <body> <h1>zusatzinformationen</h1> <table> <tr> <td> <img class="img" src="img/b1.jpg" /> </td> <td id="info0"></td> </tr> <tr> <td> <img class="img" src=...

java - Windows environment variable resolution error -

i trying put java jdk path windows path environment variable. i changed/inserted appropriate variables , got command javac working yesterday, when tried same thing today, getting command not recognized error. here values of relevant variables ( on fresh cmd instance ): >> echo %java_home% java_home=c:\program files\java\jdk1.8.0_101 >> echo %path% c:\windows\system32;c:\windows;c:\windows\system32\wbem;c:\windows\system32\windowspowershell\v1.0\;%java_home%\bin;c:\users\anmol\appdata\local\programs\python\python35\scripts\;c:\users\anmol\appdata\local\programs\python\python35\;c:\users\anmol\appdata\local\programs\python\launcher\ i tried avoid spaces present in 'program files' writing java_home=c:\progra~1\java\jdk1.8.0_101 , error persisted. also, if open cmd , type set path=%java_home%\bin;%path% , in same session type javac , recognized correctly. can tell going on , how set path correctly? you have modified path set command,...

Static class property pointing to special instance of the same class in Python -

coming cpp/c#, how 1 refer same class in class body in python: class foo(object): answer = foo(42) fail = foo(-1) def __init__(self, value): self._v = value when try use code, "name 'foo' not defined" exception in line trying instantiate answer instance. the name foo not set until full class body has been executed. way can want add attributes class after class statement has completed: class foo(object): def __init__(self, value): self._v = value foo.answer = foo(42) foo.fail = foo(-1) it sounds re-inventing python's enum module ; lets define class constants instances of class: enum import enum class foo(enum): answer = 42 fail = -1 after class statement has run, foo.answer instance of foo .value attribute set 42 .

apache - Remap request to different local path -

i'd serve multiple subdomains webserver: example.com projects.example.com blog.example.com wiki.example.com ... the document root being set follows: servername example.com serveralias *.example.com virtualdocumentroot "/var/www/%0/public" this works automatically sets document root corresponding subdomain. next requirement however, should detect if public folder in document root exists, , if not, serve file 1 directory earlier. most of applications written laravel, come public folder, want create new script doesn't have public or deploy external software doesn't. therefore document root example.com (which serves static index.html , style.css ) should /var/www/example.com/ rather /var/www/example.com/public . tried via rewrite rules: <if "!-d '/var/www/' . %{http_host} . '/public'"> rewriteengine on rewriterule ^ "/var/www/%{http_host}" [l,qsa] </if> this result of rewrite err...

c++ - Is Visual Studio recursive_directory_iterator.pop() broken? -

given example directory tree testing: root a1 a2 b b1 b2 i wish recursively enumerate directories, skip processing of directory completely. according msdn documentation code following should job: void testrecursion1() { path directory_path("root"); recursive_directory_iterator it(directory_path); while (it != recursive_directory_iterator()) { if (it->path().filename() == "a") { it.pop(); } else { ++it; } } } ...it not. msdn recursive_directory_iterator.pop() states if depth() == 0 object becomes end-of-sequence iterator. otherwise, member function terminates scanning of current (deepest) directory , resumes @ next lower depth. what happens due short circuit test in pop() if 'depth == 0' nothing happens @ all, iterator neither incremented nor become end of sequence iterator , program enters infinite loop. the issue seems semantically pop...

javascript - infragistics webdatagrid get selected cell from keydown event in client side -

i have build infragistics webdatagrid in c# : var columnone = new bounddatafield(); columnone.datafieldname = "columnone"; columnone.key = "columnone"; columnone.header.text = "columnone"; var columntwo = new bounddatafield(); columntwo.datafieldname = "columntwo"; columntwo.key = "columntwo"; columntwo.header.text = "columntwo"; webdatagridobject.datakeyfields = "columnone"; webdatagridobject.columns.add(columnone); webdatagridobject.columns.add(columntwo); i javascript update cell column 2 when typed in cell column one. for example, user starts typing value in cell @ line 3 , column one, cell @ line , column 2 must automatically updated constant value, "updated". to that, bit struggling, have attach lot of client events c#, , think 1 usefull keydown : webdatagridobject.clientevents.mousedown = "web...

How filter is working with softlayer API in python -

i trying fetch storageid through softlayer api using filter. giving me list of storages if applied filter method. import softlayer import json storagename = "abc-123" client = softlayer.client() accountservice = client['softlayer_account'] objectfilterstorage = {"username": {"operation": storagename}} storageid = accountservice.getnetworkstorage(filter=objectfilterstorage) print storageid also, how can figure out attributes needed while fetching list of particular offering? here found attributes & took list 'objectfilterstorage'. still confused how works. try following python script: """ script retrieves storage identifier through name important manual pages: http://sldn.softlayer.com/reference/services/softlayer_account/getnetworkstorage http://sldn.softlayer.com/reference/datatypes/softlayer_network_storage license: http://sldn.softlayer.com/article/license author: softlayer technologies, ...

active directory - Which is the best option for make folders from web with AD authentication? -

i interested in making web creating folder structure acl in microsoft ad domain, process following: the user log in web (best credentials of windows user) authorized users give name of folder (in case name of project) a structured folder created correct acl also need option move folder location , remove/rename folder i don't know best option, , more compatible this, i'm bit lost start googling

node.js - Google App Engine - nodejs application goes down over night -

hi using google app engine host single instance nodejs application. application works fine , scripts showing no errors in logs. application in testing , not getting used on night, come work next day , server returning internal server errors. no errors shown in application log other 502 errors when trying access next day. see 100s of calls /_ah/_background/ overnight appear have timed out. @ point must restart instance app continue function. i stumped.. because app using web-sockets must use manual scaling , single instance. appreciate / suggestions. i venture gues have deferred task stuck running. tasks run in taskqueue api set default continuously retry. can visit taskqueue api taskqueue api to tasks stop running right visit google cloud console select project. select app engine. select task queues. click on task running (probably default). there should option pause queue. should prevent 500 errors occurring not fix reason task failing.

javascript - Disable the dropdown value which already exist in database -

can guide me solution. example , there dropdown down in form contains animals name. if user select 1 animal that, saved in dropdown. again in selection process, saved data want become disabled. other options able select. solution want. you can achieve helper method view, or set instance variables in controller here pseudo code going. def disabled_animals animal.where(already_selected: true).pluck(:name) end def selectable_animals animal.all.pluck(:name) - disabled_animals end the idea 2 arrays, 1 without disabled animals , 1 disabled animals , pass select helper method, in view.: select("post", "animal", selectable_animals, {disabled: disabled_animals}) which produce this: <select name="post[animal]" id="post_animal"> <option value=""></option> <option value="joke">joke</option> <option value="poem">poem</option> <option di...

php - Yii2 Modules and configuration -

i'm not 100% sure module right way go here. thought i'd ask. use case have large application powered oracle db. we have db isn't oracle , involved in different type of work , different user group, thought should use module - right? if not what's best way achieve kind of set up? if so, there way configure second db within module or should done within main app/config/dp.php file? since, using yii2-basic application . so, directory structure like. root folder -> assets -> commands -> components -> config -> console.php -> db.php -> params.php -> web.php -> controllers -> mail . . . your database connection details present in db.php . now, want database play important rle in application. no worries. create 1 more database connection details in,say, db2.php inside config folder. db2.php <?php return [ 'class' => 'yii\db\connection...

war - Is there a way to leave the version tag in the maven pom.xml empty or blank -

i'm working on maven project in netbeans 8 , every time generate war clicking "cleaning , building" option, war generates version name put in verion tag. myprojectname-1.0-snapshot.war. is there way leave version tag empty when generate war name project name? myprojectname.war, i'm tired of changing name of war paths of csss in code work. i tried removing version tag pom.xml gives me error saying couldn't find version tag.

javascript - DOM Manipulation in Promise `then` is not occurring after successful AJAX call in previous `then` -

i in middle of refactoring large js class, (which leans heavily on jquery), , have switched mess of callbacks, variables , tightly intertwined code series of promise chains carry out required changes in, each triggered different user actions fire events. the script modal on page of html game links. part of having issue does, in order: listens 'play game' button pressed. pulls information game button's data-attributes. opens modal loading animation. conditionally uses of information correct user token api service. conditionally uses of information post api service serves games themselves. response object contains url game itself. replace iframe src attribute url, shuts off loading animation , , displays iframe. all relevant information - urls, codes, tokens, titles etc. - held in object called state . each function used in chain of promises takes state object argument, , returns modified version. generally, have single side effect (normally dom update). upd...

java - handle the result form the gallery -

i searched many days how image gallery admit found alot of codes no 1 worked . have code , when hit button , choose image program stop "unfortunately app has stopped " . appreciated ... code public class mainactivity extends appcompatactivity { private static int result_load_image = 1; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); button buttonloadimage = (button) findviewbyid(r.id.button); buttonloadimage.setonclicklistener(new view.onclicklistener() { @override public void onclick(view arg0) { intent = new intent( intent.action_pick, android.provider.mediastore.images.media.external_content_uri); startactivityforresult(i, result_load_image); } }); } @override protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresul...

Single pixel event image processing in python -

Image
i have had lonng term problem proceccing ccd image of xray source, attached here ccd image after theresholding arbitrary value, thing need subtract multi-pixel events image. need count number of pixels belongs single pixels. *- multi pixel mean pixels has nonzero value in sorounding pixels. i have code working using pil.image.open() read in list , analysis pixel pixel! i'm looking standard image prcessing routin more reliable , better results. appriciate if can give me how it. cheers you can quite imagemagick installed on linux distros , available osx , windows. there c/c++, python, perl, php, ,net , other bindings available. i'll @ command line here. so, here start image: first, let's threshold @ arbitrary 80%: convert ccd.png -threshold 80% result.png now let's find white pixels have no other white pixels around them: convert ccd.png -threshold 80% -morphology hmt peaks:1.9 result.png the technique "hit-and-miss morphology...

innodb - sync_binlog parameter mysql -

i going through documentation sync_binlog parameter , found discrepancy in sync_binlog parameter documentation. the documentation here http://dev.mysql.com/doc/refman/5.6/en/replication-options-binary-log.html#sysvar_sync_binlog says: a value of 1 safest choice because in event of crash lose @ 1 commit group binary log. which means data updated might not there in binlogs. however,in binary log documentation here http://dev.mysql.com/doc/refman/5.6/en/binary-log.html says: for example, if using innodb tables , mysql server processes commit statement, writes many prepared transactions binary log in sequence, synchronizes binary log, , commits transaction innodb. if server crashes between 2 operations, transaction rolled innodb @ restart still exists in binary log. which means transaction first written in binlog , committed innodb, there chance in case of crash row there in binlog doesn;t exist in database. i have asked question in mysql forum , waiting response, appre...

How to make Foundation Apps Interchange load images as needed? -

the documentation foundation apps (and angular base apps, now-maintained fork of f4a) interchange gives example way load small size of image on mobile devices in order save bandwidth: <ba-interchange> <img media="small" src="assets/img/small.jpg"> <img media="medium" src="assets/img/medium.jpg"> <img media="large" src="assets/img/large.jpg"> </ba-interchange> however, while small image displayed, browser still sees 3 img tags , requests 3 images, before angular loaded. defeats purpose of using interchange @ all, @ least, if purpose save bandwidth. the foundation 6 sites interchange avoids putting of images data-interchange attribute string on element instead. f4a have similar i'm missing? or there above example code i'm missing? i suggest using ba-if directive provided angular base apps. directive internally uses ng-if directive, causing img element no...

Slow Small Webpack 2 Build - Tree Shaking - Sass - Chunking -

i've put basic webpack 2 build, seems slow project size. 3 things wanted have were: chunking (js & scss) scss compiling tree shaking webpack seemed choice being able these things. i've been using gulp , rollup, scss/chunking along side of tree shaking nice thing. it takes around 4000 - 5000ms compile build, wouldn't end of world except project small, i'm worried becoming larger project grows. i've tried couple things improve speed. resolve : { root: path.resolve(__dirname,'src') } this did help, reducing time couple hundred ms, great. tried take further resolving alias, didn't show gains far tell. i set devtool eval well. beyond haven't been able improve things, i'm sure it's in way i've set things up. it's worth noting while 'webpack' compiles build, running webpack-dev-server doesn't. it's starts up, hangs on compile , crashes. may or may not separate issue, thought worth includi...

asp.net - How can I open an access database in c#? -

Image
i'm trying open access database extension .accdb can read information database. have no problem doing this, if use wizard: however when try use code exception when try connect: from debugging understood exception comes not having opened connection. open connection the database comes empty: i have looked around stack overflow , tried apply many of answers similar questions haven't worked. in theory if can connect through wizard should able connect through oledbconnection object in c#. how can fix this? i found problem. table name had space between "tab_project data" , because didn't use [] looking table named "tab_project" couldn't find. had put "[tab_project data]" inside query , works.

perl - Write into a file and open the same file for input -

i writing perl script below open(fh, '>', "temp.out") or die "cannot open"; select fh; print "hello world!"; close fh; open (fi, "temp.out") or die "cannot open"; while ( <fi> ) { print $_; } unfortunately when running script not getting "hello world!" printed. should ideal case, isn't it? however in temp.out file can see "hello world!" printed. i tried using variable filename, didn't work. always use strict , warnings in scripts, have caught error encountered: print() on closed filehandle fh @ t.pl line 10, <fi> line 1. your fh still selected after all, if closed it. unless have lot of print statements , can somehow isolate select (e.g. select @ start of function , restore previous default @ end) i'd it's preferable explicitly specify file handle in print statement.

html - navigation bar with drop down navigation is not taking full browser width -

Image
hi creating drop down menu using unordered list , want make navigation width full without affecting dropdown menu. when try parent div(.menu) overflow problem occurs. want menu take entire width in browser text of navigation center align. in advance. .menu ul { list-style: none; } .menu ul li { width: 220px; height: 35px; float: left; text-align: center; background-color: red; position: relative; list-style-type: none; line-height: 35px; } .menu ul li { text-decoration: none; color: white; display: block; } .menu ul li a:hover { background-color: green; } .menu ul ul { position: absolute; display: none; } .menu ul li:hover > ul { display: block; } .menu ul ul ul { margin-left: 220px; top: 0px; } <div class="menu"> <ul> <li><a href="#">home</a> <ul> <li><a href="#">sub1</a> </li> ...

android - Error Code : 1 (SQLITE_ERROR) Caused By : SQL(query) error or missing database -

by click on snackbar want add page favourite list face error when click snackbar: error code : 1 (sqlite_error) caused : sql(query) error or missing database. (no such table: ghavaed (code 1): , while compiling: insert ghavaed(saal,title) values (?,?)) this first project please help here page class want add favourite lists: public class styleghaede extends appcompatactivity { string title, tozih, sarfasl, saal; textview style_ghaede_content; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); bundle extras = getintent().getextras(); title = extras.getstring("title"); tozih = extras.getstring("tozih"); sarfasl = extras.getstring("sarfasl"); saal = extras.getstring("saal"); setcontentview(r.layout.activity_...

javascript - hiding one div tag hides others -

when hide "div1title", other divs hiding. there can solve issue? <div id="div1title" style="visibility: visible;display:inline"> <table class="htmlrtabledata" style="width:1000px"> <tr> <td style="width:20px"> <img id="div1plus" src="images/plus.jpg" width="20px" height="20px" onclick="onclicksubreport('div1', event, this)"> </td> <td id="div1titletext"></td> </tr> </table> <div> <div id="div2title" style="visibility: visible;display:inline;"> <table class="htmlrtabledata" style="width:1000px"> <tr> <td style="width:20px"> <img id="div2plus" src="images/plus.jpg" width="20px" height="20px" onclic...

linux - Redirect multiple UARTs in Qemu -

i emulating chip multiple uarts/usarts. want redirect uart3 /dev/uart3 on host, uart7 /dev/uart7 on host, etc. can't seem find examples or guides deal more 1 uart, , examples did find don't seem select uart dumping console/socket/whatever. (some of them use "id=id" have no idea means , qemu documentation didn't seem cover it.) man qemu says: -serial dev redirect virtual serial port host character device dev. default device "vc" in graphical mode , "stdio" in non graphical mode.this option can used several times simulate up 4 serial ports. also, add virtual usb serial ports: -usbdevice serial:[vendorid=vendor_id][,productid=product_id]:dev for dev substitute host's serial ports in form /dev/ttyxxx in both cases you omit vendor , product id specification. in case qemu create generic serial usb device virto' ids

cloud - What is s tenant in VMware vCloud Director -

i have problem understanding should tenant in vmware vcloud director. name "tenant" appears in form creating organisation vcd template (vdc means virtual data center). until saw form mentioned above, thought tenant same thing organisation - entity limited resource quotas (similar in openstack, tenant (which same project)). after research , communication vmware solution providers came conclusion that tenant = organisation in case of vmware software (e.g. vcloud director). terminology difference derives legacy - vmware had products before openstack , similar software, term tenant , multi-tenancy used.

How to use union in "if" statement [Crystal] -

following code works , print "5.0" $x : float64 $y : float64 $x = 3.0_f64 $y = 2.0_f64 puts $x + $y now, change code support "nil". $x : float64? $y : float64? $x = 3.0_f64 $y = 2.0_f64 puts $x + $y if !$x.nil? && !$y.nil? however code reports following error message. no overload matches 'float64#+' type (float64 | nil) overloads are: - float64#+(other : int8) - float64#+(other : int16) - float64#+(other : int32) - float64#+(other : int64) - float64#+(other : uint8) - float64#+(other : uint16) - float64#+(other : uint32) - float64#+(other : uint64) - float64#+(other : float32) - float64#+(other : float64) - number#+() couldn't find overloads these types: - float64#+(nil) puts $x + $y if !$x.nil? && !$y.nil? i stop call of method "#+()" if $x or $y nil , print calculated result if both float64. what best practice situation? in above code, simplified code question. in result, meaning of ques...

mysql - Update query is not working in my sql procedure.why? -

create procedure sp_iu_group( gid int, groupname nvarchar(200), userid int, status int ) begin if gid=0 insert tblgroup (groupname,userid,status) values (groupname,userid,status); else update tblgroup set groupname=groupname,userid=userid,status=status gid=gid; end if; end this query: update tblgroup set groupname=groupname,userid=userid,status=status gid=gid will update every record in table... to itself . matches every record, because always true: where gid=gid and updates value to itself : groupname=groupname the problem you're using the same names multiple things. give things different names. simple this: create procedure sp_iu_group( gidnew int, groupnamenew nvarchar(200), useridnew int, statusnew int ) (or use other standard want distinguish variables database objects, such prepending them special character @ .) then query can tell difference: update tblgroup set groupname=groupnam...

How to wrap ASP.net validation controls in Bootstrap classes? -

Image
i using bootstrap 3 asp.net webforms , new bootstrap. webform working on uses asp.net validation controls. web form has standard layout 2 columns , using "form-group" class group labels , input fields. now problem placing label, input field validator in bootstrap "form-group" class, message in text property of validator being displayed in next line after validation. want displayed right next input field. there alternative way can this? <div class="form-group"> <asp:label runat="server" associatedcontrolid="txtbox">address <span class="required">*</span></asp:label> <asp:textbox id="txtbox" runat="server" cssclass="form-control"/> <asp:requiredfieldvalidator id="rfvline1" validationgroup="<%# validationgroup %>" controltovalidate="txtbox" runat="server" display="dynamic" errormessage...

c# - get 400 bad request in a simple rest api get method -

i have in customercontroller.cs [httpget] [actionname("getcustomernames")] [route("api/accounts/mydept/customer/getcustomernames", name = "get_customernames")] public httpresponsemessage getcustomernames() { ...} in register.cs have public static void register(httpconfiguration config, iunitycontainer container) { config.routes.maphttproute( name: "get_customernames", routetemplate: "api/accounts/mydept/{controller}/{action}", defaults: null, constraints: null, handler: defaulthandlers); } in fiddler, use http://localhost:5426/api/accounts/mydept/customer/getcustomernames i 400 bad request. i must have missed something. please let me know.

amazon web services - How to set Auto Scaling Group correctly for an existing Load Balancer -

i have 1 ec2 instance , connected load balancer. scenario this: 1) ec2 instance works alone 2) when over-load happens on server, add duplicate of it's load balancer. (max 3) 3) when over-load ends, delete one. to provide scenario, trying create auto scaling group , set load balancer demanded & minimum & max amount 1 , mark "keep group @ initial size". when set auto scaling group, automatically creates empty ec2 instance , sets load balancer (not duplicate of ec2 instance, brand new 1 "out of service" time load balancer). when check instances of newly created auto scaling group see newly created one, not instance. my question "how can set auto scaling group checks ec2 instance located in load balancer, duplicates 1 when needed, appends load balancer , removes added 1 when need ends?".

amazon web services - Map attributes in DynamoDB table while migrating data -

i have 2 dynamodb tables following items: table_1 someid: string name: string table_2 id: string name: string surname: string this need: migrate data table_1 table_2. map table_1.someid attribute table_2.id attribute while migrating set default values table_2.surname i took of amazon data pipeline service. apparently, can export data table_1 s3. , then, import data s3 table_2. http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/dynamodbpipeline.html what cannot see how map attributes if tables have different schema. i found solutions base on writing console application scratch using sdk. better advice on this? i think 1 way of solving use hive. can load data dynamo s3, use emr cluster run hive script , export s3 dynamo. there quite similar example here: https://github.com/awslabs/data-pipeline-samples/tree/master/samples/dynamodbtoredshiftconvertdatausinghive in example after transformation data put redshift can replace step i...

ios - Sending int data to BLE device -

i have 4 distinct int values need send ble device (connection established ok). i'll call int values a,b,c,d clarity. , b range between 0-100, c has range of 0-2000 , d has range of 0-10000. values determined user input. i need send these 4 values ble device in quick succession, , package each of them differently: , b (8 bits), c (16 bits) , d (32 bits). i'm unsure how package values correctly. below 3 methods i've tried varying degrees of success. convert int data , send, e.g. (8 bit) int: const unsigned char chr = (float)a; float size = sizeof(chr); nsdata * adata = [nsdata datawithbytes:&chr length:size]; [p writevalue:adata forcharacteristic:achar type:cbcharacteristicwritewithresponse]; convert string first, e.g. (16 bit) c: nsstring * cstring = [nsstring stringwithformat:@"%i",c]; nsdata * cdata = [cstring datausingencoding:nsutf16stringencoding]; [p writevalue:cdata forcharacteristic:cchar type:cbcharacteristicwritewithresponse]; ...

Can java variables be an unbounded wildcard? -

for example, can variable so: public <? extends foo> fooextension = new fooaugmentation(); without throwing errors, or there not implementation of this? example of how useful so: public class human{ private string localname; private <? extends animal> favoriteanimalinstance; public human(string name, <? extends animal> fav){ localname=name; favoriteanimalinstance = fav; } public <? extends animal> getfavoriteanimal(){ return favoriteanimalinstance(); } } with main code: public class main{ public static void main(string[] a){ human animatedcharacter = new human('fry',new seymour()); system.out.println(animatedcharacter.getfavoriteanimal().ispetrifiedindiamondium()? "not episode dog" : "it's episode dog.."); } } or on complicating done more that? since discussion starts out of hand... your code, if valid, result in huma...

Spark Streaming with MongoDB backend -

i have requirement read csv files pumped telemetry equipment location on cloud , store relevant data mongodb store. using spark streaming read new files (they arrive every minute, more frequent) , using momgodb-spark connector.the problem data not being loaded momgodb. have added dataframe's show() steps in code , being displayed @ console correctly, means streaming application reading , processing files expected. final step of saving mongodb not happening. code looks follows reqdata.foreachrdd { edata => import sqlcontext.implicits._ val loaddata = edata.map(w => energydata(w(0).tostring,w(1).tostring,w(2).tostring)).todf() loaddata.show() loaddata.printschema(); mongospark.save(loaddata.write.option("uri","mongodb://127.0.0.1:27017/storedata.energydata").mode("overwrite")) } ssc.start() the loaddata.show() function displaying data fine. i have checked mongodb logs , found few strange lines like "2016-0...

java - Calculating total price -

i have abstract class transaction , calculate total price of each transaction . total price calculated getting price of each product in map , multiply price quantity of each product . don't know how multiply these prices quantities values in map . can me, please? tried , nothing works. public abstract class transaction { //attributes ... //links map<product,integer> products; //constructor transaction() { id = newtrid.incrementandget(); date = new date(); products = new hashmap<>(); } abstract void addproduct(product aproduct, int aquantity); bigdecimal calculatetotal() { bigdecimal total = new bigdecimal(0); for(product eachproduct : products.keyset()) { total.add(eachproduct.getprice()); } (integer eachproduct : products.values()) { } return total; } } bigdecimal immutable , add does not change ...

css - If I use .container-fluid in Bootstrap 3, does that mean I need to use grid classes? -

i've read several of answers .container , .container-fluid are, missing simple. use column classes col-xs-6, col-md-9, etc., if using .container-fluid? both resize , .container specific sizes, why use col-x-x classes, .container-fluid resizes time, .container-fluid take care of column sizing automatically , "trust" gets right? the container-fluid used contain grid ( row + col-* ) can used other things such headings, tables, etc.. so no, container-fluid not replacement columns, it's holder of columns. difference between container-fluid , container container not full-width on larger screens. container fixed width that's centered large margins on sides. container-fluid doesn't resize, it's 100% width. container demo if want use responsive grid (rows , columns), need use container or container-fluid this.. <div class="container-fluid"> <div class="row"> (one or more col-*-* here) ...

php - Escaping my own regular expressions -

i have function replaces matched content other content larger body of text. this [5] content so in example, regex looks in '[]' , replaces content determined '5', lets string table index of 5. here regex using: /(?<!/)\[(.*?)\]?\]/ theres few bracket checks other functionality, , there behind right excluding tag preceded '/' what want do, when tag escaped / remove escape character , move on the next match. so: this /[5] content becomes: this [5] content as opposed to: this [5] content becoming: this [insert content here] content i hope that's not confusing. the way i'm replacing matched content recursive function finds first match, replaces it, updates original material, , calls it's self until there no matches left. source of problem, not figure out way of doing it. if preg_match matches once , loop through each, updating original content, position of matched tags changes when preg_match run...

android - Enter key listener for Google keyboard is not working -

i want add functionality on click of "enter" key of google's keyboard without vanquishing default newline characteristic. have used onkeylistener not working. edittext edittext = (edittext) findviewbyid(r.id.user_query); edittext.setonkeylistener(new onkeylistener() { public boolean onkey(view v, int keycode, keyevent event) { if ((event.getaction() == keyevent.action_down) && (keycode ==keyevent.keycode_enter || keycode == keyevent.keycode_dpad_center)) { //here want print numbers next line in edit text return true; } return false; } }); the same code working other keyboards. as stated here interface definition callback invoked when hardware key event dispatched view. callback invoked before key event given view. useful hardware keyboards; software input method has no obligation trigger listener. and safe bet use addtextchangedlistener in case below edittext.addtextc...

c++ - How to capture audio from specific application and route to specific audio device in Windows 7? -

ok, question this: how can programmatically capture audio specific application , send specific audio device in windows 7? i know fact can done, since soundleech captures audio individual programs, , theoretically once have sound can want (including play sound output device). i'm c++ programmer know little windows programming. need pointers capturing sound individual programs. work audio recording , willing put in large amount of work develop way better handle sound in windows given how difficult use is. so how can capture audio streams directly applications without first routing them through virtual audio cables or like? you cannot using standard user mode apis. need either hook apis or create virtual devices accept application streams/sessions. intercepting , postprocessing audio streams on windows recording audio output specific program on windows is possible caputre rendering audio session process? capture audio of single application on windows 7 ...