Posts

Showing posts from April, 2012

objective c - Application isn't the active one, after an update with Sparkle -

i use sparkle provide updates application. the process simple , basic 1 : updates application zipped , xml appcast provides sparkle url zip. all work expected, sparkle advertises of update, , once click install it, downloads, unpacks archive, , asks install , relaunch. there 1 problem : after relaunch application isn't active (foremost ?) one, : application (re)launched 'finish_installation' tool stays @ bottom of applications stack. from how other apps updated sparkle behave, isn't normal behavior , application correctly given focus system on normal, classic launches. if matters, run mac os x 10.9.1 , xcode 5.0.2, , application document-based. i did notice message in system log, saying zip importer encountered error (2) parsing archive used update, doubt root of problem. does observed such behavior ? on non-update configuration ? appreciated. i haven't observed behavior on apps. should fixable adding [nsapp activateignoringotherapps:yes

xcode5 - Video slow motion using AVPLAYER in Cocoa Aplication -

i'm going start video slow motion using avplayer in cocoa application. example: can select start position , end position video. if play again video want slow motion start , end position . 1 please tech me how implement that. how select start position , end position , slow motion using avplayer. you'll need add time observer player - addperiodictimeobserverforinterval:queue:usingblock: . called on regular intervals specify. you'll use know when player reaches start or end positions. for start , end positions have store them somewhere in code , compare them in block of method. take in mind observer needs cmtime , many people bit confused it. here answers: trying understand cmtime trying understand cmtime , cmtimemake i prefer work cmtime instead of seconds it's you. then slow motion need set rate property of player whatever need - 0.5 make twice slower original speed, 0.25 make 4 times slower etc. value of 0 pause playback , value of 1 play

php - How to extract variable part from URL and how to know if URL variable is appended by digits? -

i have url this: www.example.com/education/edu.php?main=colleges&category=engineering-colleges i rewrite url using .htaccess www.example.com/education/colleges/engineering-colleges also have url in same education directory like: www.example.com/education/edus.php?main=colleges&collegeid=$id&collegename=$name i want rewrite url this: www.example.com/education/colleges/$name-sqr$id how can accomplished? can't think of way because above 2 rewrite urls have same number of parameters. can't redirect them correct page. these questions: is there way using .htaccess validating url variable sqr$id , redirecting edus.php page. how extract id url , make variable operation in page. try code in /education/.htaccess : rewriteengine on rewritebase /education/ rewritecond %{request_filename} -f [or] rewritecond %{request_filename} -d rewriterule ^ - [l] rewriterule ^([^/]+)/([^-]+)-sqr([0-9]+)/?$ edus.php?main=$1&collegeid=$3&col

java - How do portlets relate to JSF? -

i haven't worked java portlets or jsf 'till , thought might try learn them. high view seems me both used building component-based user interfaces web applications. more read, more find confusing. i know portlets need run in portlet container both technologies seem "widget" builders. how portlets relate jsf? a high-level analogy: portlet container desktop windowing system ========================================================== portlet window jsf widget framework jsf tag widget the portlet provides api allows application receive , respond requests container. not specify use render portlet views or how application organizes data. in this, portlet similar servlet. jsf provides means specifying views, navigating between them, , interacting model layer. a specialized portlet acts jsf controller/container - typically portlet bridge.

python - Alembic/Flask-migrate doesn't recognise database structure -

i have flask-based application , i'm trying enable migrations able manage database structural changes. database not empty , contains tables , records before started alembic , flask-migrate. first, tried use alembic stand-alone, pip install alembic , configure , use autogenerate generating diff. works fine output not expected: info [alembic.autogenerate.compare] detected removed table u'user' generating /users/me/documents/project/app/migrations/versions/3de1151ce5de_.py ... done so table user present in database (i think it's reserved table in postgresql) , have never removed it. also, have bunch of other tables seem invisible alembic. @ first thought failed configure alembic properly, started on , decided try this nice flask extension miguel grinberg . lot easier setup, result same message. any ideas doing wrong? edit: decided add important information on how edited original alembic env.py: .... import sys,os sys.path.append(os.getcwd()) import a

Count max interval of cells with numbers before blank cell in Excel -

is there way count, using formulas, intervals of cells numbers in row (before blank cell appears) , display value of "biggest chain" found? doing research automatization in twitter. have list of n users. there 1 column each hour of research, , in every cell there number of tweets published each user during hour. if user didn't publish in 1 specific hour, cell empty (here x means empty cell): user 1: x x x 1 1 1 2 1 3 8 4 2 1 3 1 1 1 1 x 2 x user 2: 1 2 x 2 3 1 3 x x 2 1 8 7 2 1 2 3 x 1 3 x i conclude user 1 uses kind of automatization because active 15 hours in row. user 2, although active user 1, active 8 hours in row with first row of data showing user in a2 , tweet numbers in b2:v2 can use "array formula" in x2 =max(frequency(if(b2:v2<>"",column(b2:v2)),if(b2:v2="",column(b2:v2)))) confirm ctrl + shift + enter , copy down that gives me 15 , 8 sample data

javascript - Add class active to menu links is working with links that has no extension only, how to make it find all links with and without extinctions? -

using .httaccess removed .php extensions end of url, example index.php shown index "site.com/index , not site.com/index.php". now, using script below, adding class of .active anchor of current open page. //main menu .active classes handler $("#mainmenu a").filter(function () { var _href = location.href.replace(/#.*/, ""); if (location.pathname === "/") {_href += "index";} return _href === this.href; }).addclass("active"); the problem is? script above try , find page names/url without php extension, example, links have follows in order work: <li><a href="index">home</a></li> but links follows, , don't want remove .php extension <li><a href="index.php">home</a></li> what can make find urls php or without? tried adding .php var _href = location.href.replace(/#.*/, ""); thinking way it, did not wo

javascript - "Uncaught TypeError: Cannot read property 'checked' of null" -

i have problem php , javascript code. i put simplified code here. first step, want select trip "walking" submit. got trip number 50 , shows check-box. after that, want select check-box , click "select checkbox" button. should call myfunction() . but code inside myfunction() not getting result because got error uncaught typeerror: cannot read property 'checked' of null and tried put myfunction() inside <head></head> , did not work well. suggestion guys? <html> <head></head> <body> <form action = "thispage.php" method = "post"> <select name="typesselect"> <option value="">walking</option> </select> <input type="submit" name="searchformsubmit" value="search" /> </form> <button onclick="myfunction();">select checkbox</button> <?php $trip = 1; if(isset($_post['sea

excel - Cannot return the address of a cell range from one function to another, I get an 'object required' error -

i 'object required' error when try return value of range 1 function function. read other answers 'object required' cannot figure out how relates code. forgive me i'm new vba. here's code: function functionone() dim r range workbooks("workbook1.xls").activate sheets("sheet1").select set r = getrange("a1") application.goto r end function function getrange(strstart string) variant dim rng1 range dim rng2 range dim rng3 range set rng1 = cells.find("*", [a1], , , xlbyrows, xlprevious) set rng2 = cells.find("*", [a1], , , xlbycolumns, xlprevious) set rng3 = range([strstart], cells(rng1.row, rng2.column)) getrange = rng3.value end function the 'object required' error happens @ set r = getrange("a1") in functionone(). help. change getrange function return range object: function getrange(strstart string) range dim rng1 range d

SQL Server - Select list and update a field in each row -

i hate ask know has been answered, after 45 minutes of searching yield here. i have table need select list of items based on value, , take 1 field , add year , update column value. example: select * table description='value_i_need' update table set enddate=dateadd(year, 1, begindate) -- each item in select edit: select statement return ton of results. need update each row uniquely. i don't know how combine select or loop through results. my sql knowledge limited, , wish have figured out without having ask. appreciate help edit 2: have 1 table need go through , update end date on each item matches description. have 1000 "computers" example, need update field in each row description based on field in same row. coming 1 table try this update table t1 set t1.enddate=dateadd(year, 1, begindate) t1.description='value_i_need'

javascript - How to draw a line in canvas with a background image -

Image
i'm trying draw line in canvas (which can do), want put repeating pattern on line using background image (unless there way put repeating background image on line in canvas?). how can draw line background image? i understand concept of clipping, seems work shapes... not stroke. ideas? here jsfiddle of trying http://jsfiddle.net/z9cd7/ function (callback) { window.settimeout(callback, 1000 / 60); }; })(); var radius = 50; var x = 100; var dx = 10; var y = 100; var dy = 10; var delay = 10; var img = new image(); img.onload = function () { var canvas1 = document.getelementbyid("image"); var ctximg = canvas1.getcontext("2d"); ctximg.drawimage(img, 0, 0, img.width, img.height, 0, 0, canvas.width, canvas.height); /* ctx.clearrect(0, 0, canvas.width, canvas.height); ctx.save(); ctx.beginpath(); ctx.arc(100, 100, radius, 0, 2 * math.pi, false); ctx.clip(); ctx.drawimage(img, 0, 0, img.width, img.height

Object Detection by giving an input image using opencv -

i'm new opencv .my requirement in video giving input image should tag every occurence of image in video using opencv. appreciated. you can try opencv template matching where have extract each frame video , apply template matching. can see opencv video tutorial here . see opencv documentation reading , writing images , video .

javascript - Best way to handle dynamically generated textarea or form to send the value to controller -

the below code creates , populates dynamically textareas. want edit value of textareas , send using ajax controller. thinking create dynamically unique ids of each textarea , somehow track id button click , submit in ajax. not sure if thats best way ! <% list<?> allcomments = (list<?>) request.getattribute("allcomments") ; if(allcomments.size()>0){ for(int = 0;i < allcomments.size(); i++ ) { comment comment = (comment)allcomments.get(i); %> <form action="editcomment.htm"> <div id="commentdiv" style="margin-bottom: 4px;" > <table style="margin-left: 40px;"><tr><td><textarea style="width: 500px; border-width:0px; background-color: #f4f4f8;"> <c:out value="<%=comment.getcomment() %>"></c:out>

JqGrid Adding extra parameter to server on sorting -

i know if there way add parameters sort call. when click on jqgrid column in order sort (asc or desc) row, know if there way add parameters in order able customize order on server side basing in passed parameters. because, every time click order column, when reach server dont know if call sort event or load event, , have know make diferents querys. thanks you can use onsortcol event modify postdata of grid send additional flag alternatively, know default sort column , sort order set in grid object. check in backend see if sidx , sort parameters different defaults.

Add an image as a background to a previously manipulated image with Imagemagick -

i'm writing script that: scales crops adds background image to series of around 400 transparent pngs. i'd make run fast possible. currently i've got 2 separate commands: convert $input.png -scale $scale% -gravity center -crop 640x640+0+0 +repage $output.png composite -gravity center $output.png $background $output.png is there way reduce single command? i've been looking @ docs -composite can't see way add image background after doing other manipulation. any ideas? thanks why don't use && between 2 commands? second command executed when furst exits without error... should work...

r - $tab output from bca in ade4 -

i know stupid question, can explain me $tab output bca() in ade4 package mean? did: > obs.pca=dudi.pca(data.frame(t(data)), scannf=f, nf=10) > obs.bet=bca(obs.pca, fac=as.factor(data.cluster), scannf=f, nf=2) i'd understand better different outputs given command, of $tab. on ade4 manual explained `a data frame class-variables containing means per class each variable. can explain me better mean? thanks! from gather, analysis finds x classes, , give variable average each variable v1 vp in x classes. for specific questions on ade4 package, there mailing list. messages in french , english: adelist@listes.univ-lyon1.fr

c++ - Boost Spirit Qi: Omit element in Kleene Star parser -

i want parse special constructs , throw rest away. don't want use skipper. i want vector of these constructs, use kleene star parser main rule. but, everytime gets thrown away, default constructed element inserted vector. here made example. looks string test , throws rest away, @ least plan. every time rule garbage succeeds adds default constructed item vector in rule all , giving output of 7 insteat of 1. how can tell spirit add vector if rule item succeeds? #define boost_spirit_use_phoenix_v3 #include <boost/config/warning_disable.hpp> #include <boost/spirit/include/qi.hpp> #include <boost/fusion/adapted/struct.hpp> #include <boost/spirit/include/phoenix.hpp> #include <iostream> #include <string> #include <vector> namespace qi = boost::spirit::qi; struct container { std::string name; bool dummy; }; boost_fusion_adapt_struct(::container, (std::string, name) (b

r - Using 'PerformanceAnalytics' package to calcuate Performance Measures -

i need use 'performanceanalytics' package of r , use package, understand need convert data xts data, panel data. following forum's suggestion have done following: library(foreign) rnom <- read.dta("return panel without missing.dta") rnom_list<-split(rnom,rnom$gvkey) xts_list<-lapply(rnom_list,function(x) {out<-xts(x[,-1],order.by=as.date(x$datadate,format="%d/%m/%y")) }) it gives me rnom_list , xts_list . after this, can please me estimate monthly returns using function return.calculate , lapply , save output generated addition variable in original data-set regression analysis? subsequently, need estimate var, es , semi-sd. the data can downloaded here . note, prccm monthly closing price in data , gvkey firm id. an efficient way achieve goal covert panel data (long format) wide format using 'reshape2' package. after performing estimations, convert long format or panel data format. here example: library(fore

multithreading - Multi-Threading Issue in C -

i'm trying out multi-threading in c first time, , seem doing wrong hope me with. here code: #include "stdafx.h" #define max_threads 2 int a[100000]; int b[200000]; void startthreads(); dword winapi populatearraya(lpvoid data) { int i; int* pa = (int*)data; for(i = 0; < sizeof(a) / sizeof(int); i++) { *pa = i; pa++; } return 0; } dword winapi populatearrayb(lpvoid data) { int i; int* pb = (int*)data; for(i = 0; < sizeof(b) / sizeof(int); i++) { *pb = i; pb++; } return 0; } void startthreads() { handle threads[max_threads]; dword threadids[max_threads]; threads[0] = createthread(null,0,populatearraya,a,0,&threadids[0]); threads[1] = createthread(null,0,populatearrayb,b,0,&threadids[1]); if(threads[0] && threads[1]) { printf("threads created. (ids %d , %d)",threadids[0],threadids[1]); } waitformultipleobjec

C++ Overloading functions and function templates - different behaviour? -

i have following code: void a(const int*) { cout << "const int*" << endl; } void a(const int&) { cout << "const int&" << endl; } template <typename t> void b(const t*) { cout << "const t*" << endl; } template <typename t> void b(const t&) { cout << "const t&" << endl; } int main() { int* = nullptr; a(a); //output: const int* int* b = nullptr; b(b); //output: const t& return 0; } a(a) invoking function a(const int*) b(b) invoking template function b(const t&) i not surprised template behaviour because of way overload resolution works. cannot explain why non-templated functions return opposite result (which kinda more intuitive). is because non-templated functions there no need type deduced , considered exact match (adding const-ness permited?) ? i not expert meta programming , things

c# - Why does a parsed double not equal an initialized double supposedly of the same value? -

Image
when execute line: double dparsed = double.parse("0.00000002036"); dparsed gets value: 0.000000020360000000000002 compared line, double dinitialized = 0.00000002036; in case value of dinitialized 0.00000002036 here in debugger: this inconsistency trifle annoying, because want run tests along lines of: [subject("parsing doubles")] public class when_parsing_crazy_doubles { static double dinitialized = 0.00000002036; static double dparsed; because of = () => dparsed = double.parse("0.00000002036"); should_match = () => dparsed.shouldbelike(dinitialized); } this of course fails with: machine.specifications.specificationexception "": expected: [2.036e-08] was: [2.036e-08] in production code, 'parsed' doubles read data file whereas comparison values hard coded object initializers. on many hundreds of records, 4 or 5 of them don't match. original data appears in text file this:

c# - How can i send message to different ip's through microsoft message queue -

i working on intranet based application ( visitor management system of university), messages sending , recieving through message queue , want send message particular department selected in dropdown menu chemistry department can view visitors or department can view visitors only.. i have system central server , several clients connected on same network through ip address , @ backend have defined ip addresses of department send message particular ip messages sending departments . this code of queue service public class queueservice { public void queuemessage(historymodel hmsgs) { message msg = new message(); msg.body = hmsgs; msg.recoverable = true; //msg.formatter = new binarymessageformatter(); msg.formatter = new xmlmessageformatter(); string machine = environment.machinename; iphostentry host; string localip = ""; host = dns.gethostentry(dns.gethostname()); foreach (ipaddress

django - When I try to add a deck of cards to my database i get: Integrity error decks_deck.cardID_id may not be NULL. What am I doing wrong? -

i made models this: from django.db import models class attribute(models.model): idattr= models.charfield(primary_key=true, max_length=40) description= models.charfield(max_length=40) def __str__(self): return self.description class cardtype(models.model): idcardtype= models.charfield(primary_key=true, max_length=40) description= models.charfield(max_length=40) def __str__(self): return self.description class monstertype(models.model): idmonstertype= models.charfield(primary_key=true, max_length=40) description= models.charfield(max_length=40) def __str__(self): return self.description class cardclass(models.model): idcardclass= models.charfield(primary_key=true, max_length=40) description= models.charfield(max_length=40) def __str__(self): return self.description class card(models.model): idcard= models.charfield(primary_key=true, max_length=40) name= models.charfield(max_length=4

uiimagepickercontroller - cameraOverlayView in ios7 hides default camera toolbar, but works in ios6 -

my code place overlay in imagepicker works in ios6, not in ios7. in ios6 camera display fine; appears overlay slotted between picker , controls nicely. in ios7, seems overlay placed on top layer, hiding controls. can still click on take photo button though. is there anyway put camera controls on top? or bug? imagepicker =[[uiimagepickercontroller alloc] init]; overlayview = [[uiimageview alloc] initwithimage:[uiimage imagenamed:imagestring]]; imagepicker.cameraoverlayview = overlayview; imagepicker.delegate=self; imagepicker.title=@"test"; imagepicker.showscameracontrols = yes; [self presentmodalviewcontroller:imagepicker animated:yes ]; [imagepicker release];

javascript - Google Chrome form submission with onclick events -

i have small issue submission button in form. <input type="submit" name="submit" onclick="this.disabled=true;this.value='uploading...';return true;" value="upload" /> i disable button , display text let user know upload being processed. note return true inform chrome still want submit form after execution. however, despite returning true, google chrome not submit form unless remove onclick event entirely. do have put in function in embedded script elsewhere on page , call function in onclick event?

Reading list from a file -

i don't have experience in prolog. add(first, second) :- see('telefon_375319.txt'), read(l), seen, m = [[first, second] | l], tell('telefon_375319.txt'), write(m), nl, told. the purpose of above code to: read list (which list of list) file (into l). add list [first, second] @ beginning of list (it might @ end or in middle). save file. the result in file following: [[x, y], end_of_file]. the result should be: [[x, y], , here should rest of list]. i don't know why ,but prolog read text end_of_file l instead of list stored in file. what's wrong? end_of_file not text. it’s atom , it’s read when file ends. in swi prolog see empty line must me placed @ end of file in order read correctly. searching relevant info on that.

javascript - Get width of d3.js SVG text element after it's created -

i'm trying widths of bunch of text elements have created d3.js this how i'm creating them: var nodestext = svg.selectall("text") .data(dataset) .enter() .append("text") .text(function(d) { return d.name; }) .attr("x", function(d, i) { return * (w / dataset.length); }) .attr("y", function(d) { return 45; }); i'm using width create rectangles same size text 's boxes var nodes = svg.selectall("rect") .data(dataset) .enter() .append("rect") .attr("x", function(d, i) { return * (w / dataset.length); }) .attr("y", function(d) { return 25; }) .attr("width", function(d, i) { //to do: find width

java - Socket does not throw exception when trying to write to closed connection -

i new in java socket programming have faced problem. when trying write connection unexpectedly closed in client side don`t exception. have server side. public static void main(string[] args) throws ioexception { serversocket socket = new serversocket(8036); string st; while(true) { system.out.println("hello"); socket socket1 = socket.accept(); bufferedreader reader = new bufferedreader(new inputstreamreader (socket1.getinputstream())); bufferedwriter writer = new bufferedwriter(new outputstreamwriter(socket1.getoutputstream())); system.out.println(reader.readline()); writer.write("h"); writer.flush(); } } and client public static void main(string[] args) throws exception{ inet4address s = (inet4address)inet4address.getbyname("localhost"); system.out.println("begin"); socket socket = new socket(s,8036); bufferedwriter w = new bufferedwri

javascript - Find similar items in an object -

i have object looks so: { title: "test", subtitle: "test", "list-item-1": "this item 1", "list-item-2": "this item 2", "list-item-3": "this item 3" } i want find keys in object end -1 , or - numerical value. , group of in way can access them calling "if item has -1 @ end of it, find other items have same first part ( list-item in case) , save them own array or variable. how go this? one simple way harvest properties use built in methods keys(), filter(), , test(): var obj={ title: "test", subtitle: "test", "list-item-1": "this item 1", "list-item-2": "this item 2", "list-item-3": "this item 3", }; var arrok=object.keys(obj).filter(/./.test, /list-item-\d+$/); alert(arrok); // shows: "list-item-1,list-item-2,list-item-3"

database - Code not working while trying to pull user login data from form in php -

i created registration form works fine in php project undertaking. attempt use form, login form in pull username , password data user verify against database. getting parsing errors , other errors. haven't started validation yet haven't got basics in ready. i don't think i'm going right way or if it's silly mistake. <edit remove important info> // check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } if (isset($_session['logged'])){ //already logged in //$url= 'x'; // page exit(); //ends script if user logged in } else { //not logged in or submitted } $user_name = mysqli_real_escape_string($con,$_post['username']); $pass = mysqli_real_escape_string($con,$_post['password']); $notify=""; if(isset($_post['notify_box'])){ $notify = $_post['notify_box'];

extjs: Grid Buffered Scrolling with Row Editing/Deletion/Addition -

has seen sample of extjs grid buffered scrolling new row, row editing , row deletion support? can cellediting , rowediting plugins used buffered scrolling? is row editing possible buffered scrolling? cheers, avi i had opened thread @ ext forum , got response, insertion , deletion not supported buffered scrolling. http://forums.ext.net/showthread.php?27969-buffered-scrolling-with-row-editing-deletion-addition&p=124559&posted=1#post124559 cheers, avi

html - How to reduce the height of my div -

i embedded style tag css , have added max-height:90% suggested div element still overflowing other elements. doing wrong??? <head> <style> .atlas.region-map { border: 2px solid #716e64; max-width: 500px; overflow: hidden; margin: 0; float: left; } .atlas.map-content.info-col { margin-left: 549px; width: 335px; } .atlas.map-content.info-col p { color: #5c5642; margin-top: 15px; font-size: 12px; } .atlas_test { height: 300px; font-size: 14px; overflow-y: scroll; max-height: 90%; } </style> </head> <body> <div class="info-col"> <p>content go here!!!</p> </div> </body>

gcc - install CMAKE error linuxmint -

i'm trying install cmake on linuxmint 16, errors. have gcc. the errors: /usr/bin/ld cannot find crt1.o no such file or directory /usr/bin/ld cannot find crti.o no such file or directory /usr/bin/ld cannot find -lc /usr/bin/ld cannot find crtn.o no such file or directory collect2: error: ld returned 1 exit status test failed compile how can solve this? this command solved problem me: sudo apt-get install libc6-dev

Amount validation - regular expression in Java -

in java class need regular expression amount validation following conditions: maximum price 9999.99 minimum amount 1 decimal values optional (paise optional) 9999 valid i write following regular expression return false both valid , invalid inputs. here's example: private static final string price_pattern = "((/d{1,4})(((//.)(/d{0,2})){0,1}))"; public pricecheck() { pattern = pattern.compile(price_pattern); } public boolean validate(final string username) { matcher = pattern.matcher(username); return matcher.matches(); // return false; } use expression instead: private static final string price_pattern = "((\\d{1,4})(((\\.)(\\d{0,2})){0,1}))";

html - jQuery replaceWith if ID clicked -

i have basic website displays streams ip video cameras. 5 feeds displayed via table below '#main' feed inside div. want when 1 of feeds in table clicked, '#main' feed replaced feed it's displayed larger. my js file testing first 2 cam feeds. apologies if isn't formatted correct, it's first post here. html: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>dsac cattle feed</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"> </script> <script type='text/javascript' src='camjq.js'></script> </head> <body> <

algorithm - How to plot a room outline from range finder sensors in a toy car? -

i have toy car has arduino , 4 ultrasonic range finder sensors in front, rear , both sides, give me distance wall if exist within range sensor covers, sensors give me data in short intervals, car has move around room , plot outline, rooms can have columns , kind of irregular, don't know algorithms involved in plotting, insight appreciated. heh once did robot same :) bud turn around @ 1 place (no turning radius) easy drive , map environment in case hard because not see car kinematics anyway hints: 1.while doing ultrasonic listening should have motors quiet i used stepper motors pulses heard in receiver if use dc motor tricky (may need full stop) or determine echo echo , commutator noise with brushless (bldc) , sinusoidal driving ok but pwm or other impulse driving create same problems so need synchronize listening times , pulse noisse times without proper measure equipment extremly hard (oscilloscope ideal this) 2.ultrasound emitters to avoid many

visual studio 2012 - total amount of the entire column in Datagridview passing to a textbox in c# -

how can overall total amount in datagridview textbox in same form? // part calculating total amount of row private void salesdatagrid_cellendedit(object sender, datagridviewcelleventargs e) { if (salesdatagrid != null) { (int x = 0; x < salesdatagrid.rows.count; x++) { salesdatagrid.rows[x].cells[3].value = convert.toint32(salesdatagrid.rows[x].cells[1].value) * convert.todouble(salesdatagrid.rows[x].cells[2].value); //and i've tried 1 below if work didn't } if (salesdatagrid != null) { (int x = 0; x < salesdatagrid.rows.count; x++) { txtsalestotal.text = salesdatagrid.rows[x].cells[3].value.tostring() ; } } try this: double totalamount=0; (int x = 0; x < salesdatagrid.rows.count; x++) { totalamount += convert.todouble(salesdatagrid.rows[x].ce

java - MacBook multi-touch pad, MouseEvent and JavaNativeExceptions -

i have java program wrote kids allows them paint circle on jpanel left mouse button, , remove circle clicking right mouse button within circle created. here code mouselistener: addmouselistener(new mouseadapter() { @override public void mouseclicked(mouseevent e) { switch (e.getbutton()) { case mouseevent.button1: addcircle(e.getpoint()); break; case mouseevent.button2: // nothing break; case mouseevent.button3: removecircle(e.getpoint()); break; default: // no default action } } }); the program works fine regular mouse, when using macbook multi-touch pad, 4 finger swipe throws javanativeexception: java[15233:507] lookup: unhandled exception 'javanativeexception' caught in __57+[lulookupdefini

sockets - Android not getting past serverSocket.accept(); -

i trying open socket in android, code keeps sticking @ 1 sentence. private serversocket serversocket; private socket clientsocket; private printwriter out; private bufferedreader in; public void run(){ log.i("debugmessage", "serverthread received pulse. trying open socket now!"); try{ serversocket = new serversocket(25555); log.i("debugmessage", "serversocket open, waiting clientsocket."); clientsocket = serversocket.accept(); log.i("debugmessage", "serversocket , clientsocket both open! waiting in-/output!"); in = new bufferedreader( new inputstreamreader(clientsocket.getinputstream())); out = new printwriter(clientsocket.getoutputstream(), true); string input = in.readline(); out.println("received: " + input); in.close(); out.close(); } catch(exception e) { log.i("debugmessage", "failed o

perl - Variable value not passing through loop -

i have loop checks see whether files in directory uploaded directory checking see if number of files constant. starting out, knows there $before files in directory ("before" looks again). use strict; use warnings; $after = 0; $before ="10"; until($before == $after) { #check again, changes value of $after. #now.... $after = "20"; if ( $after == $before ) { print "after before. moving out of until because files there!\n"; } else { print "after isn't before.\n"; $before = $after;#set $before new value after update $after = 0; #this updated in next update sleep 1; } } when run this, claims setting $before $after in else{} , but, in fact, $before remains 10, set before, , program loops endlessly. the script runs correctly when remove my s inside else{} : use strict; use warnings; $after = 0; $before ="10"; until( $before == $after ) { #ch

CSS or SVG text clip / mask -

Image
i not sure if possible, there way make text clipping path or mask? example: if there layer of text above layer of text, have top layer "knock out" lower layer background seen through. see link below (sorry, don't have enough rep yet post images), don't want border around letters, added try , describe trying achieve. notice how bottom "this text" string has missing color top layer overlaps. top layer of text transparent "knock out" or apply transparency anywhere overlaps lower layer of text. you can filter. ideally, we'd use 2 feimage's import source text , composite them together. firefox doesn't support yet, cross-browser, we're stuck using "green-screen" type effect , careful positioning of source text. it's a little using elephant gun kill fly. work: http://codepen.io/mullany/pen/sogvi <svg> <filter id="knockoutspecial"> <feoffset dy="150" result="

c - Can we call functions before defining it? -

#include <stdio.h> void main() { m(); } void m() { printf("hi"); } output hi warnings main.c:11:10: warning: conflicting types 'm' [enabled default] void m() ^ main.c:7:9: note: previous implicit declaration of 'm' here m(); ^ why program runs though m() called before defined? , meaning of warning? c89 allow implicitly converting return type of function , parameter passed int . see here . but, not valid in c99 , later. has been omitted standard. either have declare prototype function or define before main . see result here . there compile time error in case.

Ruby Watir: cannot launch browser in a thread in Linux -

i'm trying run code in red hat linux, , won't launch browser. way can work if launch browser outside of thread, makes no sense me. here mean: require 'watir-webdriver' $alphabet = ["a", "b", "c"] $alphabet.each |z| puts "pshaw" thread.new{ thread.current["testputs"] = "ohai " + z.to_s thread.current["mybrowser"] = watir::browser.new :ff puts thread.current["testputs"] } $browser = watir::browser.new :ff end the output is: pshaw (launches browser) ohai (launches browser) pshaw (launches browser) ohai b (launches browser) pshaw (launches browser) ohai c (launches browser) however, if remove browser launch outside of thread, so: require 'watir-webdriver' $alphabet = ["a", "b", "c"] $alphabet.each |z| puts "pshaw" thread.new{ thread.current["testputs"] = "ohai "

Compile Solution without DLL's Visual Studio Managed C++ -

i'm new @ c++ managed , visual studio keep in mind. ive programmed application makes easy users bind keys in counterstrike, found here: https://sites.google.com/site/intrepidprojects/ the first error ran friends testing program "msvcr120d.dll missing". lead me finding have set runtime library multi-threaded (/mtd), if don't want users download visual studio c++ dll's . when choose option given error /mtd , /clr incompatible. turned common runtime support no support. of namespaces invalid such 'system', 'collections', etc. my question how produce stand alone application without needing dll's? every solution have come across leads me more errors not understand. again, language using c++/cli. sorry if not using proper lingo communicate errors teaching on own.i aware question has been asked many times before, answers not leading me solutions. my question how produce stand alone application without needing dll's? basically: do

java - Is there any SAX based parser for GWT -

i have tried find sax based parser gwt not find any. know if there such parser exists. reason asking server return huge xml file , literally hang browser while parsing using piriti parser. think based on dom. https://code.google.com/p/piriti/wiki/xml no, reasons given here http://tinyurl.com/lxr5lw2 there's none, it'd make little sense. do processing on server , send relevant xml client send json instead of xml because that's javascript understands "natively" i believe i'm not 1 telling that ;-)

"last seen time" for a term in elasticsearch -

i have mapping has host , timestamp (among other fields), , "last seen time" number of seen hosts. there better way first term facet on host field, range query (limit=1) on each of term values sorted in descending order? a term stats facet bring min/max timestamp each host wouldn't it? { "query" : { "match_all" : { } }, "facets" : { "host_time_stats" : { "terms_stats" : { "key_field" : "host", "value_field" : "timestamp" } } } }

elasticsearch - Boost rank for special type of document -

i have index 2 types of document: district , street . boost rank of district documents. is there way without script option? you can use custom_filters_score boost documents matching filter, , filter can type -filter. here's runnable example can play with: https://www.found.no/play/gist/8744808 #!/bin/bash export elasticsearch_endpoint="http://localhost:9200" # index documents curl -xpost "$elasticsearch_endpoint/_bulk?refresh=true" -d ' {"index":{"_index":"play","_type":"district"}} {"title":"there"} {"index":{"_index":"play","_type":"street"}} {"title":"there"} ' # searches curl -xpost "$elasticsearch_endpoint/_search?pretty" -d ' { "query": { "custom_filters_score": { "query": { "match": {

c# - Load xml row into 2D array -

so have xml <document> <month> <depth>-0,25</depth> <october>0,95</october> <november>-0,90</november> ... </month> <month> <depth>-0,5</depth> <october>0,47</october> <november>-0,17</november> ... </month> ... </document> i've searched bit , saw way linq 1d array, becasue end be array[0,0] = -0.25 array[0,1] = 0.95 array[0,2] = -0.90 ... if you're happy jagged array (an array of arrays) linq makes easy: xdocument doc = xdocument.load(...); var array = doc.root .elements("month") .select(month => month.elements().select(x => (double) x).toarray()) .toarray(); if need rectangular array, that's trickier. personally build custom type depth , october , november properties, rather relying on order of elements within month , that's different

pulling text from url and putting text back in url with javascript -

i have tried googling can't find i'm looking for. have url has number in it. want able take number there , depending on number there interject name url. example: let's url is: www.example.com/video15637 can take number , like: var namevariable; if(video15637){ namevariable = video15637; } if(video26597){ namevariable = video26597; } if(video18737){ namevariable = video18737; } then, somehow interject namevariable url displayed? you can try with: var = document.createelement('a'); a.href = 'http://www.example.com/video15637'; var namevariable = a.pathname.substr(1); // video15637

jquery - Parsing JSON Data/Converting to Objects -

i using following function test case application: $(function() { var json = { "people": { "person": [{ "name": "peter", "age": 43, "sex": "male"}, { "name": "zara", "age": 65, "sex": "female"}] } }; $.each(json.people.person, function(i, v) { if (v.name == "peter") { alert(v.age); return; } }); }); this searches set of json data static input, in case name "peter", , returns 'age'. want modify function pull input text field , use in place of static string "peter" can search name id like. function called submit button. that first obstacle. my second id use subset of result object, rather string, in application. in other words, if placed name in text field function find name within json data , return, in