Posts

Showing posts from April, 2015

php - Creating a Form that autofills itself -

php - Creating a Form that autofills itself - i'm working on "ticket" page, simple form collects info , saves record. need have select (combobox) when select something, other inputs (textfileds) auto fill or populate themselfs. simple! when select 1 alternative combobox others textfields "retrieve" info related combobox , "print" on page without reloading. i been working php, mysql, java , i'm soooo stuck :p the thing achieved java "pull" value of selection combobox textfield need @ to the lowest degree 2 diferent values related first option: in database this: solution - code - cost paint - p990 - 3.20 grind - g789 - 5.27 repair - rii8 - 89.2 so, display "labels" in combobox, related values, code , cost need auto fill textfields every time take different combobox :) you need utilize javascript , observe when combo box changes value utilize javascript http request (get or post), php returns ...

c# - Run WCF Service Library when .exe in debug is ran -

c# - Run WCF Service Library when .exe in debug is ran - when run wpf uses wcf service library through visual studio wcf service host startup @ same time service starting wcf service library, when click on exe wpf in debug folder doesn't startup there anyway create start in code next code have believed work doesn't. try { host = new servicehost(typeof(service1), new uri("http://" + system.net.dns.gethostname() + ":8733/databasetransferwcfservicelibarymethod/service1/")); host.open(); }catch(addressalreadyinuseexception) { } i'm trying not utilize service references. i'm no expert @ this, perhaps you're missing binding. here simplest illustration can create of hosting , consuming wcf service in code (you'll need add together references system, system.runtime.serializaton, , system.servicemodel, otherwise, code complete). using system; using system.runtime.serialization; using system.servicemodel; namespace co...

java - What is the best practice for putting classes under package names in Android -

java - What is the best practice for putting classes under package names in Android - android studio 0.8.11 hello, i have completed test on android build app takes live news feed, , display them. however, instructor critical set classes under 1 package. i wondering best practice packaging classes. particular test have next classes under bundle name: com.viewsys.ncon my classes these: dbhelper <-- database creating , ugprading detailactivity <-- activity add together ncondetailfragment nconcontract <-- properties of database schema columns, table name ncondetailfragment <-- detail fragment nconlistfragment <-- list fragment nconviewpager <-- view pager jsonnewsfeed <-- class downloads , parses json format mainactivity <-- main activity newsfeed <-- class of properties getters/setters news feed newsfeeddb <-- simple array list store object sqlite3 db splashactivity <-- activity add together splashf...

c++ - How can i add a return statement to magicTime? -

c++ - How can i add a return statement to magicTime? - i'm trying find output of next code. how can add together homecoming statement magictime? out set should a: 10 b: 30 c: a: 10 b: 30 #include <iostream> using namespace std; int magictime(int a, int &b, const int &c){ a=c; b=20; } int main(){ int = 10; int b = 30; int c; cout << "a: " << << " b " << b << " c " << c << endl; c=b; magictime(c, b, a); cout << "a: " << << " b " << b << " c " << c << endl; homecoming 0 ; } ok want homecoming array of int pseudo code int[] magictime(int a, int &b, const int &c){ a=c; b=20; homecoming new int [] { a, b, c}; } c++ nullpointerexception pass-by-reference pass-by-value

ruby on rails 4 - How to fetch an associated-through collection (proxied collection) using active-record methods -

ruby on rails 4 - How to fetch an associated-through collection (proxied collection) using active-record methods - i have has_many relation between subscription , article , article has product . class subscription < activerecord::base has_many :articles end class article < activerecord::base belongs_to :subscription belongs_to :product end class product < activerecord::base has_many :subscriptions end now. i'd fetch products within subscriptions. solution includes : class subscription < activerecord::base has_many :articles def products articles.includes(:product).map{|a| ap.product} # or .map(&:product) end end solution has_many :through : class subscription < activerecord::base has_many :articles has_many :products, through: articles end the first has downside not homecoming collection can chained upon (e.g. subscription.products.pluck(:id) ), rather simple array. the sec not exclusively 'semantically...

c# - Fastest way to get directory data in .NET -

c# - Fastest way to get directory data in .NET - this question has reply here: is there faster way scan through directory recursively in .net? 8 answers i'm working on file synchronization service synchronize files between 2 folders on different machines. need find fast way enumerate directory , pull next info it: a info construction or structures of file paths , sub-directory paths within directory, includes lastly write time each file or sub-directory. for each sub-directory found @ level below current directory, same above. so far, have come this: static void main(string[] args) { list<tuple<string, datetime>> files = new list<tuple<string, datetime>>(); list<tuple<string, datetime>> directories = new list<tuple<string, datetime>>(); stopwatch watch = new stopwatch(); while (true) {...

Clearing Arduino's serial buffer -

Clearing Arduino's serial buffer - i have simple arduino code: void loop() { if serial.available { c = serial.read(); if (c == 'a') { blinkled(); } else offled(); } } it should glow led if send character 'a'. , shld go off when dont give when loop goes next itration. but 1 time give 'a'. starts glowing , never goes off. is reading char 'a' buffer? if how clear ? serial.flush() not working. any ideas please. new arduino. sorry if silly. you have set offled function within serial.available() path. turn off serial.available() beingness true , pushing different character reads other 'a' unfortunately illustration above makes same mistake. construct led turns off outside if statement arduino

SQL Server 2008 Passing Multi-value Parameters or Parameter Array to a Stored Procedure -

SQL Server 2008 Passing Multi-value Parameters or Parameter Array to a Stored Procedure - i have 2 tables tbl_properties , tbl_locations tbl_properties has list of properties (including fk location_id) tbl_location has list of locations i using next stored procedure search properties in location: sppropgetsearch ( @location_id int ) select p.prop_id, p.prop_title, p.prop_bedrooms, p.prop_price, l.location_title tbl_properties p inner bring together tbl_locations l on l.location_id = p.location_id (p.location_id = @location_id or @location_id = '0') order p.prop_dateadded desc i pass location_id (such '1002') , works fine , returns properties located within location / area. now, want pass multiple location_ids such '1002', '1005', '1010' search properties located in of areas. how that? appreciate detailed reply not database expert. i found next illustration , it's working fine. please can , check if there's vu...

c# - How to return ActionResult with specific View (not the controller name) -

c# - How to return ActionResult with specific View (not the controller name) - i have method sendmail in mvc controller.this method calls other method validatelogin. signature of validate login: private actionresult validatelogin(models.resetpassword model) when phone call validatelogin sendmail, exception appears because controller seek search view sendmail, want load resetpassword view: global error - view 'sendmail' or master not found or no view engine supports searched locations. next locations searched: ... this code of sendmail: public actionresult sendmail(string login) { homecoming validatelogin(login); } how can override view on homecoming statement? thanks in advance the view method has overload string viewname . want pass string model , asp.net framework confuses trying find view value string . seek this: public actionresult sendmail(string login) { this.model = login; // set model homecoming view("vali...

javascript - JQuery change width that given in percent issue. -

javascript - JQuery change width that given in percent issue. - i using script smiling slider http://codepen.io/zuraizm/pen/vgdhl, but when seek set #slider ul li width 90% in css want work, i've checked js , if utilize percent width intend of pixel homecoming me 0 value var slidewidth = $('#slider ul li').width(); but if illustration set #slider ul li width 100px; in css calculate in right way. i have read percent , pixels different , seems says $('#slider ul li').width() should homecoming px instead of percent, homecoming 0 me. just want create slider 90% width , max-width 760 px, when alter width causes on calculation js. you're setting ul slidecount * slidewidth . if you're slide 500px width 4 slides, ul width 2000px. if li width set 90%, that's 1800px. see? you want set each li width same slider width, add together line in middle code: ... $('#slider ul').css({ width: sliderulwidth, marginleft: -...

javascript - Meteor.call() callback not return the response -

javascript - Meteor.call() callback not return the response - meteor.call not giving response when click on button.how can response , results based on response.please help me. when click button saveprofile not giving response database updated records. , client side code template.ban.events ({ 'click #saveprofile': function() { var properties = { ip: $('#ip').val(), client_name: $('#clt_name').val(), usage: $('#use').val(), blocked_usage: $('#buse').val(), }; meteor.call('updatevalues',properties,function(err,result){ if(err) { console.log(err); } else { alert("update done"); console.log("update done"); } }); } }); and server side code updatevalues: function updatevalues(properties,callback){ ...

sql server - SQL - Constraint between FK -

sql server - SQL - Constraint between FK - i new in sql , have basic question. in sql table having multiple fk pointing same foreign table, possible create constraint imposes rules between fk? here's illustration of trying : the table 1 contains names , gender of grouping of people name(pk), gender the table 2 associates grouping of 4 people room number. room(pk), name (fk), name(fk), name(fk), name(fk) how can constraint fk in sec table insure person of same gender associated room? is there improve way deal such scenario? thank you. you can grouping on gender , if there more 1 row illustration if 2 names male , 2 names female, grouping on gendr homecoming 2 rows, in case raise error saying people same gender can allocated room. sql sql-server foreign-keys foreign-key-relationship

java - JPA closes connection before creating JoinTable statement -

java - JPA closes connection before creating JoinTable statement - there 2 entities in application - user , role. set unidirectional manytomany relationship. my entities: role: @entity @table(name = "roles") public class roleentity extends baseentity { @column(nullable = false, unique = true) private string name; //getters , setters } user: @entity @table(name = "users") public class userentity extends baseentity { @column(nullable = false, unique = true) private string username; @column(nullable = false, unique = false) private string password; @column(nullable = false, unique = false) private string firstname; @column(nullable = false, unique = false) private string lastname; @manytomany(fetch = fetchtype.eager) @jointable(name = "users_roles", joincolumns = @joincolumn(name = "role_id"), inversejoincolumns = @joincolumn(name = "user_id")) private set...

winapi - cmake, how to automate windows SDK build? -

winapi - cmake, how to automate windows SDK build? - i automate build of project using cmake on windows using windows sdk compiler. developing on linux, , cannot cross-compile (i building library linked matlab mex file, although don't think detail important). i can generate, nmake files, or visual studio solution files using cmake generators desired, how can build project without user interaction? it seems reading around have launch special command prompt set environment variables etc before building, case and/or there workaround? what steps building cmake project, starting cmakelists.txt on windows, using windows sdk, without user interaction? note answers suggesting using flavour of mingw not i'm looking for, know how way. want windows sdk steps, or steps express versions of msvc++ compilers of interest. winapi cmake

php - Object is set to null before persisting - ZF2/Doctrine -

php - Object is set to null before persisting - ZF2/Doctrine - i'm relatively new zend framework 2 , doctrine 2 please bear me. i have 2 entities - bills , payments. trying create payment form can create payments single bill. problem when go create payment nasty error catchable fatal error: argument 1 passed application\entity\payment::addbill() must instance of application\entity\bill, null given, called in /var/www/zend/module/bill/src/bill/controller/billcontroller.php so var dump on $bill_obj , this: //var dump results object(application\entity\bill)[337] protected 'inputfilter' => null protected 'id' => int 5 protected 'creditor' => string 'sdafddddddd' (length=11) protected 'type' => string '123fasdfsadfdd' (length=14) $bill_obj instance of bill. if set $bill_id 5 works. public function paymentaction() { $bill_id = (int) $this->params()->fromroute('id'); ...

meteorite - How to create an inventory of a Meteor environment -

meteorite - How to create an inventory of a Meteor environment - the question how create exact listing of packages installed in specific meteor environment, including release versions , total bundle names? the smart files see seem outdated or not listing wat installed, , under packages can see short bundle names. i need recreate environment somewhere else, not actual code files on top of that, meteor , installed packages in right version. the meteor list command seems not list finish bundle info how approach problem? meteor meteorite nitrous

python - Not getting any error messages from failed subprocess.Popen -

python - Not getting any error messages from failed subprocess.Popen - i set subprocess.popen generate pdf through pdflatex. code snippet: process = subprocess.popen(command, stdout=subprocess.pipe, shell=true) output, err = process.communicate() print output print err it works fine, problem error message. if pdflatex doesn't manage generate file, e.g. message "fatal error occured, no output pdf file produced!" @ end of printed output, still "none" printed out err. any insight appreciated edit: adding stderr=subprocess.pipe helps. don't "none" anymore, blank error message regardless of whether or not generation of pdf successful. looks this: process = subprocess.popen(command, stdout=subprocess.pipe, stderr=subprocess.pipe, shell=true) same above try this: fout = open("temp.txt", "w") process = subprocess.popen(cmd, stdout=subprocess.pipe, stderr=fout, shell=true) i prefer subprocess.check_ou...

angularjs - Parent directive accessing child directive function -

angularjs - Parent directive accessing child directive function - let's have 2 directives: <navigation-extended> <navigation /> </navigation-extended> navigation-extended html template uses transclude property on div insert basic navigation. besides that, navigation-extended contains html (controls navigate). what best way access kid functionalities within parent directive? things i've tried: -require ->using able access navigation-extended methods within navigation not other way around i think best way accomplish using $broadcast fire event in parent directive , using $on handle in kid directive, more info check reply http://stackoverflow.com/a/14502755/158421 angularjs angularjs-directive

javascript - jQuery post wont post data to ASP.NET API Controller -

javascript - jQuery post wont post data to ASP.NET API Controller - i having nightmare of time sending info asp.net controller via jquery post. info looks after json.stringify: [{"scheduletaskid":"203","task":"permit","baselinedate":"4/6/2005 8:00:00 am","scheduleddate":"4/6/2005 8:00:00 am","actualdate":"4/6/2005 8:00:00 am","finisheddate":"","selected":"on"},{"scheduletaskid":"195","task":"office files","baselinedate":"7/13/2005 8:00:00 am","scheduleddate":"7/13/2005 8:00:00 am","actualdate":"7/13/2005 8:00:00 am","finisheddate":"","selected":"on"},{"scheduletaskid":"196","task":"foundation","baselinedate":"7/27/2005 8:00:00 am","sch...

c# - Is there a MemoryLeak? -

c# - Is there a MemoryLeak? - i load list of liefitems. list<liefitem> list = this.loadliefitems(); liefitem implementing inotifypropertychanged on way: public event propertychangedeventhandler propertychanged; [notifypropertychangedinvocator] protected virtual void onpropertychanged(string propertyname) { propertychangedeventhandler handler = propertychanged; if (handler != null) { handler(this, new propertychangedeventargs(propertyname)); } } after loading list, subscribing propertychanged: foreach(var item in list) { item.propertychanged += itemonpropertychanged; } after, list used itemssource of datagrid. i asking me now, if load list sec time , set new list itemssource of datagrid, first loaded items removed memory or have memoryleak because subscribing propertychanged , don't unsubscribe? no memory leak there. c# events implement subject-observer pattern underneath. when event raised, happens underneath pho...

sql - `Must declar Scalar variable at...` Can someone explain exactly what this is? -

sql - `Must declar Scalar variable at...` Can someone explain exactly what this is? - can help me declaring scalar variable? don't understand scalar variable declaration. below code causing exception. int customer_id; int.tryparse(customer_idtextbox1.text, out customer_id); string sql = @"update client set customer_name = @customer_name customer_id = @customer_id"; sqlcommand sqlcommand = new sqlcommand(sql, sqlconnection); sqlcommand.parameters.addwithvalue("@customer_name", customer_name); sqlconnection.open(); sqlcommand.executenonquery(); you have @customer_name variable declared parameter. add together line sqlcommand.parameters.addwithvalue("@customer_id", customer_id); under current addwithvalue line. sql

How to query for Xml values and attributes from table in SQL Server -

How to query for Xml values and attributes from table in SQL Server - i have xml code below,i want "processengine -> id" how can using sql "<?xml version="1.0" encoding="utf-8"?> <processengine id="5077000" instancename="bg2-dev.excers"> <controller heartbeat="2014-10-27t15:59:50"/> <loader heartbeat="2014-10-27t16:01:00" queuelength="62"/> <conditionwaitlist queuelength="52"/> <retrywaitlist queuelength="0"/> <actionwaitlist queuelength="0"/> <preconditionpipelinemanager load="1.463905239430332e-6" noofpipelines="5" queuelength="0" recentload="1.1947981003500136e-5"> <pipeline heartbeat="2014-10-27t16:01:01" index="4" load="7.216747673537921e-6" name="pre status pi...

spark streaming getts kill after 2hr -

spark streaming getts kill after 2hr - i requirement run spark streaming 24x7. trying accomplish both using standalone mode , yarn cluster mode. problem streaming session gets killed after period of time. i streaming 300,000 records in 1/2 hr through kafka, apply action , transformation logic , utilize updatestatebykey have historical data. case streaming app gets killed within 1 hr i array out of bound exception, task killed i started streaming app , did not stream test if spark running 24x7 1 time again got killed in 2hr, no log traces knew job got killed through ui localhost:8080 the workers , not available then lost workers 14/10/29 13:52:03 error taskschedulerimpl: lost executor 1 on 172.18.152.36: worker lost 14/10/29 13:52:04 error taskschedulerimpl: lost executor 0 on 172.18.152.36: worker lost in above 2 senario not able spark streaming running 24/7 possible ? how done, share thoughts. apache-spark spark-streaming

html - Is There Any Way To Force An Element Sized Using An Intrinsic Ratio To Fill Its Container Vertically As Well As Horizontally? -

html - Is There Any Way To Force An Element Sized Using An Intrinsic Ratio To Fill Its Container Vertically As Well As Horizontally? - sassmeister here if element's dimensions defined using intrinsic ratio: sass: body, html, .wrapper { width:100%; height: 100%; } .videocontainer { position: relative; max-width: 100%; height: 0; overflow: hidden; &.sixteen-nine { padding-bottom: 56.25%; } &.four-three { padding-bottom: 75%; } } .videocontainer iframe, .videocontainer object, .videocontainer embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } html: <div class="wrapper"> <div class="videocontainer vimeo sixteen-nine"> <iframe src="http://player.vimeo.com/video/109777141?byline=0&amp;portrait=0&amp;badge=0&amp;color=090909" class="js-only" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="...

HTML5 video tag not working with "codecs" attribute on Chrome -

HTML5 video tag not working with "codecs" attribute on Chrome - i´ve got "video" tag follows: <video id="videotag" loop autoplay controls preload poster="xxx.jpg" height="100%" width="100%"> <source src="xxx.mp4" type="video/mp4; codecs='avc1.64001e, mp4a.40.2'"/> </video> it has been working in chrome until recent chrome update (can´t assure version), since update had remove "codecs" attribute "source", leaving this: <video id="videotag" loop autoplay controls preload poster="xxx.jpg" height="100%" width="100%"> <source src="xxx.mp4" type="video/mp4"/> </video> and working well. my question is: why did happen? chrome no longer supports "codecs" attribute or codec specifically? "codesc" attribute useful browser? please shed lite on it...

php - Large $_POST variable get's cut off -

php - Large $_POST variable get's cut off - i'm send big array via post server when output $_post variable parameters cutting off echo '<pre>'.print_r($_post , true).'</pre>'; it seems array cutting off @ same length if add together elements @ origin of array 1 element @ end removed. this happens on servers guess it's wrong setting or server limitations. the post_max_size above 64 mb , post not close size how can around this? you need set value of upload_max_filesize , post_max_size in php.ini : ; maximum allowed size uploaded files. upload_max_filesize = 40m ; must greater or equal upload_max_filesize post_max_size = 40m after modifying php.ini file(s), need restart http server utilize new configuration. you can utilize ini_set function: ini_set('post_max_size', '64m'); ini_set('upload_max_filesize', '64m'); php post

actionscript 3 - Flash, using buttons (with mouse) to move -

actionscript 3 - Flash, using buttons (with mouse) to move - so allow me clear here, not trying drag something, can find on keeping activated whilst clicked. know how move while clicked, have made version utilize mouse making in app, need utilize other mouse functions? code: mright.alpha = 0; mleft.alpha = 0; stage.addeventlistener(event.enter_frame, move); function move(e:event) { if(player.y >= 33 && player.y <= 763) { mright.addeventlistener(mouseevent.mouse_down, mrgh); function mrgh(e:mouseevent) { player.y -= 1; } mleft.addeventlistener(mouseevent.mouse_down, mlft); function mlft(e:mouseevent) { player.y += 1; } } else if(player.y < 33) { player.y = 33; } else if(player.y >= 763) { player.y = 763; } } try : as3 code : var timer:timer = new timer(10) timer.addeventlistener(timerevent.timer, t...

django - I18n stopped working -

django - I18n stopped working - i utilize script compile django.po , working: #!/bin/sh django-admin.py makemessages -a django-admin.py compilemessages suddenly stopped working, error: $ i18n.sh traceback (most recent phone call last): file "c:/python34/scripts/django-admin.py", line 5, in <module> management.execute_from_command_line() file "c:\python34\lib\site-packages\django\core\management\__init__.py", line 385, in execute_from_command_line utility.execute() file "c:\python34\lib\site-packages\django\core\management\__init__.py", line 377, in execute self.fetch_command(subcommand).run_from_argv(self.argv) file "c:\python34\lib\site-packages\django\core\management\base.py", line 288, in run_from_argv self.execute(*args, **options.__dict__) file "c:\python34\lib\site-packages\django\core\management\base.py", line 338, in execute output = self.handle(*args, **options) file ...

javascript - Multiple Google Charts on one page - Loading Library efficiently? -

javascript - Multiple Google Charts on one page - Loading Library efficiently? - i've seen many people inquire having multiple google charts on 1 page, , reply "your html/js wrong", or "just add together of them in 1 function that's called in setonloadcallback". my issue bit different. if want buttons, client side, that, when clicked, generate google chart. need phone call "google.load(....)" every time, , setonloadcallback well, or there way load once, , point forwards utilize loaded objects? the thing can think of store flag that's updated on first google.setonloadcallback, , if flag set, don't load again, if clicks few buttons have issued "load" function calls. basically want 1 generic function can phone call (i create myself) don't want function calling google.load everytime, feels inefficient. how go efficiently? google.load should indeed called 1 time per page load. don't have set charts...

javascript - A way to hid a div when another div is open -

javascript - A way to hid a div when another div is open - i have 2 divs set hidden until button clicked problem don't want both of them show @ same time. <div id="searchaddparams" class="hidden" style="color:orangered"> <label for='txtsearch'>street number:</label> <input type='text' id='txtstreetnum' /> <label for='txtsearch'>predir:</label> <input type='text' id='txtpredir' /> <label for='txtsearch'>pretype:</label> <input type='text' id='txtpretype' /> <label for='txtsearch'>street name:</label> <input type='text' id='txtstreetname' /> <label for='txtsearch'>suf dir</label> <input type='text' id='txtsufdir' /> <input type='button' id='btnsearch' onclick='searcha...

Data type design in Haskell -

Data type design in Haskell - learning haskell, write formatter of c++ header files. first, parse class members a-collection-of-class-members passed formatting routine. represent class members have data classmember = cmtypedef typedef | cmmethod method | cmoperatoroverload operatoroverload | cmvariable variable | cmfriendclass friendclass | cmdestructor destructor (i need classify class members way because of peculiarities of formatting style.) the problem annoys me "drag" function defined class fellow member types classmember level, have write lot of redundant code. example, instance formattable classmember format (cmtypedef td) = format td format (cmmethod m) = format m format (cmoperatoroverload oo) = format oo format (cmvariable v) = format v format (cmfriendclass fc) = format fc format (cmdestructor d) = format d instance prettifyable ...

mysql - AJAX for successful php :: delete checked table list :: using hyperlink NOT input -

mysql - AJAX for successful php :: delete checked table list :: using hyperlink NOT input - project focus: delete multi-checked table list form. specs: 1.) delete actioned using <a href> hyperlink (not <input type="submit" 2.) i'd action ajax, including confirm & error/success responses. status of delete action: i've got code working delete multi-checkboxes. see successful php code snippet below. note: successful $_post coding beingness handled in same page using <input type="submit" name="delete>" . i've tried work, no luck. please have through coding & script see if can spot errors? my thoughts (but uncertain): 1) ajax var formdata written wrong accomplish getting both $delete = $_post['delete']; , $chkbx = $_post['chkbx']; 2) instead of .click <a href"#" id="#btn_del" should maybe seek using .post form <form action="<?php echo $_server['php_s...