Posts

Showing posts from March, 2015

geometry - How to determinate position of a point with triangulation -

Image
i working on project of localization wireless sensors network. using triangulation method estimate position of wireless sensors, have 2 sensors position known : a(x1,y1) and b(x2,y2) and point want locate c(x,y) and have distances between points : ab, ac & bc how can triangulation ? put a := dist(b,c), b := dist(a,c). := (a1,a2), b := (b1,b2), c := (x,y). we have (x - a1)^2 + (y - a2)^2 = b^2 eq (1) (x - b1)^2 + (y - b2)^2 = a^2 thus: x^2 -2(a1)x + (a1)^2 + y^2 -2(a2)y + (a2)^2 = b^2 x^2 -2(b1)x + (b1)^2 + y^2 -2(b2)y + (b2)^2 = a^2 now subtract: (2(b1) - 2(a1))x + (a1)^2 - (b1)^2 + 2((b2) - (a2))y + (a2)^2 - (b2)^2 = b^2 - a^2 solve y : y = u + vx eq (2) where: u := ((a1)^2 + (a2)^2 - ((b1)^2 + (b2)^2) + a^2 - b^2)/(2((a2) - (b2))) v := (2((b1) - (a1)))/(2((a2) - (b2))) replace y u + vx in eq 1 above: (x - a1)^2 + (u + vx - a2)^2 = b^2 rx^2 + sx + t = 0 where: r :=

python - GET html data from multiple urls on website in one connection -

i have python script takes in input of few urls. script loops through each of these urls , prints out htmltext each page. website see 3 seperate requests , therefore 3 "hits" site or see socket connection , see 1 "hit" page? i think it's first option checking debug, if so, possible data multiple urls on same site site see 1 "hit" site? can utilise keep-alive functionality achieve in urllib3? my script below: for u in url: opener = urllib2.build_opener(urllib2.httpcookieprocessor(cj)) req = urllib2.request(u) req.add_header('user-agent','mozilla/5.0') print urllib2.build_opener(urllib2.httphandler(debuglevel=1)).open(req) resp = opener.open(req) htmltext = resp.read() would website see 3 seperate requests , therefore 3 "hits" site or see socket connection , see 1 "hit" page? yes, if reuse socket connections, still 3 distinct requests (over 1 socket). server's access

c# - XML serialization: class within a class -

i serializing xml, , had working simple class, when made secondary class, of simple class component, serialization stopped working. fails "error reflecting type" error @ serialization stage. code follows: public class customfield { [xmlattribute("fieldid")] public string fieldid; [xmlattribute("fieldvalue")] public string fieldvalue; public customfield() { } public customfield(string fieldid, string fieldvalue) { this.fieldid = fieldid; this.fieldvalue = fieldvalue; } } [xmltype("entry")] public class customentry { [xmlattribute("author")] public string author; [xmlattribute("title")] public string title; [xmlattribute("trial")] public string trial; [xmlattribute("responses")] public list<customfield> responses; public customentry() { } } public static class entryserializer { public static void serializeobj

swing - Java paint class not displaying array of rectangles -

i'm trying print array of rectangles , getting errors on run time. i send number main class ordinary int such 5 getdatafordisplay(the number send) function in paint class. checks in if statement know display rectangle. far working fine in program. now saves in rectangle class , should display rectangles on run time? also worth mentioning i'm learning site user posted on here, active method: https://tips4java.wordpress.com/2009/05/08/custom-painting-approaches/ my paint class is: class mainpanel extends jpanel { int processes, storedprocesses; //for inital values of rectangles int xcoor = 0; int ycoor = 0; int width = 10; int height = 50; static int x = 100; int [] y = {100,150,200,250,300,350,400,450,500,550}; private arraylist<coloredrectangle> coloredrectangles = new arraylist<coloredrectangle>(); class coloredrectangle { private rectangle rectangle; public coloredrectangle()

mysql select distinct column based on group by column -

hi have following columns | id | name | category| | 1 | sam | doctor | | 2 | tom | doctor | | 3 | pam | nurse | | 4 | gum | nurse | | 5 | tom | doctor | | 6 | lim | doctor | i want run query choose distinct names based on category name column unique below | id | name | category| | 1 | sam | doctor | | 2 | tom | doctor | | 3 | pam | nurse | | 4 | gum | nurse | | 6 | lim | nurse | it baffles me you use min : select min(id), name, category yourtable group name, category sql fiddle demo if want distinct names, since you're using mysql, work (but return random ids , categories). if need specific ids/categories, you'll need define them in aggregate (as in previous solution): select id, name, category yourtable group name

javascript - difference between jquery styles -

which style fastest? when use 1 on other? type 1: function makemap(){ getlatlong(); draw(); } function getlatlong(){ ... } function draw(){ ... } makemap(); type 2: var map = { init: function(){ ... } getlatlong: function(){ ... } draw: function(){ ... } } $test = map.init() the better style 1 best fits solution. in general, time '.' used reference property, performance hit; however, may small may not matter. as speed, let's test it: http://jsperf.com/compare-object-function-properties-vs-functions in both chrome , ie, direct function call faster object property reference function call.

String not being added correctly in C++ -

i've spent 3 hours trying figure out searching google , other threads , haven't found solution working me. i'm creating inventory program , i've run pretty unique problem. when run data files i'm given, program throws lexical_cast boost exception. know exact line throwing exception, doesn't make sense why exception being thrown. if take data text file i'm given , copy , paste brand new text file, program runs fine. 100% functional. however, when run original data files, year string deleted when it's added. std::cout << year << std::endl; //prints out year std::string date_str = ""; date_str += year; // <-- here's problem. //gets added empty string std::cout << date_str << " year should added" << std::endl; date_str += month; std::cout << date_str << " month added" << std::endl; date_str += date; std::cout << date_str << " date_str" <&l

c++ - How Do I Set WSABUF.buf For Text And Bin Buffer? -

i'm refactoring code not use std::vector<byte>. how make happen? somehow, wsasend() prefers have wsabuf.buf pointing std::vector<byte> work image files (.jpg, .png, etc). during testing, image/* mimetypes return net::err_content_length_mismatch. byte* httpresponse::getresponse2(ulong *len) { dword dwthreadid = getcurrentthreadid(); char *buffer = (char*)malloc(data_bufsize); memset(buffer, 0, data_bufsize); std::vector<byte> binbuffer = m_sbresponse; std::string ctstr; ctstr.assign(contentype.begin(), contentype.end()); size_t siz = binbuffer.size(); std::string ssiz = std::to_string(siz); strcpy_s(buffer, data_bufsize, resp_ok); strcat_s(buffer, data_bufsize, "\n"); strcat_s(buffer, data_bufsize, "date: "); strcat_s(buffer, data_bufsize, "may 10, 2015"); strcat_s(buffer, data_bufsize, "\n"); strcat_s(buffer, data_bufsize, "content-type: "); s

Comparing multiple numerical values in Perl -

say have few variables, $x, $y, $z, $a, $b, $c , , want make sure have same value. can test if ($x == $y == $z == $a == $b == $c) avoid multiple binary comparisons, i.e. ( if $x == $y , $x == $z , $y == $z ... )? is there way can comparing 1 short , simple test? if ( grep $x != $_, $y, $z, $a, $b, $c ) { print "not same\n"; }

Android Rotate Animation -

i working on simple compass app. using rotate animation rotate image when rotate around 0 360 degrees image flips around start on @ 0 degrees. how stop image rotating backwards 0 degrees. float[] mgravity; float[] mgeomagnetic; public void onsensorchanged(sensorevent event) { if (event.sensor.gettype() == sensor.type_accelerometer) mgravity = lowpass(event.values, mgravity); if (event.sensor.gettype() == sensor.type_magnetic_field) mgeomagnetic = lowpass(event.values, mgeomagnetic); if (mgravity != null && mgeomagnetic != null) { float r[] = new float[9]; float i[] = new float[9]; boolean success = sensormanager.getrotationmatrix(r, i, mgravity, mgeomagnetic); if (success) { float orientation[] = new float[3]; sensormanager.getorientation(r, orientation); //convert azimuth degrees float azimuthindegrees = (float) (math.todegrees(orientation[0])+360)%360;

statistics - How do I calculate the CDF of the chi-square distribution in excel? -

Image
does excell have function cdf of chi-square distribution? if not how calculate manually? i cant seem find i'm looking when try searching online. formula: i don't understand how plug values formula calculate result. if have excel 2010 or later, there function this. =chisq.dist(x, degrees_freedom, cumulative) this function accepts 3 parameters: x , value @ chi-square distribution calculated degrees_freedom , number of degrees of freedom cumulative , true or false conditional, false gives pdf , true gives cdf, you'd want true you can read more microsoft . if you're using excel 2007 or earlier, require more creativity excel's built in chi-square distribution functions right-tailed probabilities.

javascript - SyntaxError: expected expression, got ')' -

i've been stuck @ error few days , still couldn't figure out wrong. great if point me right direction of solving issue. update: realise error gone when commented "addmessages(xml)" in updatemsg() function. how make work then? error: http://i.imgur.com/91hgtpl.png code: $(document).ready(function () { var msg = $("#msg"); var log = $("#log"); var timestamp = 0; $("#name").focus(); $("#login").click(function() { var name = $("#name").val(); if (!name) { alert("please enter name!"); return false; } var username = new regexp('^[0-9a-za-z]+$'); if (!username.test(name)){ alert("invalid user name! \n please not use following characters \n `~!@#$^&*()=|{}':;',\\[\\].<>/?~@#"); return false; } $.ajax({ url: 'login.php',

ios - Swift Converting PFQuery to String Array for TableView -

i trying query of parse users in database , display each individual user in own cell in tableview. have set tableview, i'm stuck on saving user query string array can used within tableview. have created loadparsedata function finds objects in background , appends objects queried string array. unfortunately given error message on line append data. implicit user of 'self' in closure; use 'self.' make capture semantics explicit' seems me suggestion use self. instead of usersarray. because within closure, i'm given error if run way, *classname* not have member named 'append' here code: import uikit class searchusersregistrationviewcontroller: uiviewcontroller, uitableviewdelegate, uitableviewdatasource { var userarray = [string]() @iboutlet var tableview: uitableview! override func viewdidload() { super.viewdidload() tableview.delegate = self tableview.datasource = self } override func didr

Validator on repeatview wicket -

i insert inputs on repeatview (quickview). when inputs have errors (ex: requiredvalidator), submit event stopped, errors don't show. how can validate , display errors on repeatview ? addbaseestimatepanel.java public class addbaseestimatepanel extends panel { private void initform(final form<estimate> form, final feedbackpanel feedbackpanel) { ... idataprovider<estimatedetailmodel> data = new listdataprovider<estimatedetailmodel>( listestimatedetailmodel); final webmarkupcontainer mitsumorideitashōsairowsstable = new webmarkupcontainer( "mitsumorideitashōsairowsstable"); final estimatedetaillistaddtable mitsumorideitashōsairows = new estimatedetaillistaddtable( "mitsumorideitashōsairows", data, listestimatedetailmodel, new itemsnavigationstrategy(), 10, start, null) { private static final long serialversionuid = 3950744346

c - Possible Combination that could be made with the same number -

i'm working on c program calculate number of possibilities made same number. example: 444 should produce 6 number of possibilities (it counts 4,4,4,44,44,444). think use loop if statement in solve problem. thank you it's unclear asking, if understand correctly there simple formula that given number of n caracteres, have: 1 subset of size n 2 subsets of size n-1 ... n subset of size 1 so re computing sum of in 1..n is n*(n+1)/2 in exemple 444 of size 3, , 3*(3+1)/2 = 6

maven - Selenium 2 Automation Framework deployed as WAR on tomcat -

i have created selenium 2 automation framework, using maven have packaged war file. after deploying build, when start getting landing jsp, simple one, button startrun, on click of have initiated creation of webdriver instance (am using chromedriver) , navigation specific url. but when click on button nothing happens,i have enabled log4j capture actions, logs see chromedriver instance created, not able see chrome window opening up. am using selenium-2.44.0 , language java here piece of code chromedriver instance created : system.setproperty("webdriver.chrome.driver", "c://chromedriver.exe"); webdriver driver = new chromedriver(); capturelogs.info("opening browser"); try { objectfortest(driver); } any appreciated, happy share more details if required.

java - Httpclient deprecated -

i'm developing app using httpclient datatransfer. since httpclient deprecated, want port network part urlconnection . conectionhttpclient.java package conexao; import java.util.arraylist; import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstreamreader; import java.net.uri; import org.apache.http.client.httpclient; import org.apache.http.client.methods.httppost; import org.apache.http.client.methods.httpget; import org.apache.http.httpresponse; import org.apache.http.namevaluepair; import org.apache.http.conn.params.connmanagerparams; import org.apache.http.params.httpconnectionparams; import org.apache.http.params.httpparams; import org.apache.http.impl.client.defaulthttpclient; import org.apache.http.client.entity.urlencodedformentity; public class conexaohttpclient { public static final int http_timeout = 30 * 1000; private static httpclient httpclient; private static httpclient gethttpclient(){ if (httpclient == null){

Resampling using Interpolation of ode45 Data in Matlab -

i tried use interp1 solve ode problem... want interpolate previous data equation... below codes... function dxdt = newforced(t,x1,d) dxdt_1 = x1(2); dxdt_2 = -100*x1(2)-250000*x1(1)+(25000*(d^3)); %data should interpolated @ d dxdt = [dxdt_1;dxdt_2]; tspan=[0:0.1:100]; d=x(:,1); %x data sampling previous ode initial_x1=0; initial_dxdt=0; f=interp1(t,d,x); [t,x1]=ode45(@newforced,tspan,[initial_x1 initial_dxdt]); figure plot(t,x,':') figure plot(d,f) issue: have 2 variables (d , x(:,1)) , want resample 1 match length of other. codes above not working many error pops up... can please correct me thanks here's toy example. replace x , y d , x(:,1) . % example data x = 0:9; y = 1:0.1:10; % check if y longer if length(x) < length(y) x = interp1( x, linspace( 1, length(x), length(y) ) ); % resample x else y = interp1( y, linspace( 1, length(y), length(x) ) ); % resample y end so linespace generate indicies between 1 , length(x) lengt

algorithm - How to use a Linear Search in this particular instance in C#? -

i'm reading text file of dates this string[] date = system.io.file.readalllines("date.txt"); i converting them this datetime[] dates = array.convertall(date, s => datetime.parse(s)); how can use linear search search specific date in array can link dates other arrays have? can't them link or output. i have them sorting in quick sort this public static void quick_sort<t>(t[] data, int left, int right) t : icomparable<t> { t temp; int i, j; t pivot; = left; j = right; pivot = data[(left + right) / 2]; { while ((data[i].compareto(pivot) < 0) && (i < right)) i++; while ((pivot.compareto(data[j]) < 0) && (j > left)) j--; if (i <= j) { temp = data[i]; data[i] = data[j]; data[j] = temp; i++; j--; }

want download only last line of a file in url using C# -

want download last line of file in url using c# is possible or should download whole file last line. when request url gives text update every 5 minute. can download last line url? well, achieve you're asking, need know exact byte range of last line in file... unlikely know ahead of time. the server you're making request need support functionality. can find out whether or not looking @ headers of response include header accept-ranges: bytes here's how make partial content request... httpwebrequest request = (httpwebrequest)webrequest.create("http://example.com"); request.automaticdecompression = decompressionmethods.gzip | decompressionmethods.deflate; request.addrange(0, 599); using (httpwebresponse response = (httpwebresponse)request.getresponse()) using (stream stream = response.getresponsestream()) using (memorystream memorystream = new memorystream()) { stream.copyto(memorystream); memorystream.seek(0, seekorigin.begin

node.js - Linkedin API Company Updates not returning 50 recents updates -

i trying fetch companies updates api https://developer.linkedin.com/docs/company-pages#company_updates i use node.js linkedin-js package module wrapper. found got 5 posts company (id=3487133). shown in page, got more 5 updates. how can posts updates ? thanks. here code var linkedin_client = require('linkedin-js')(appid, appsecret, url_callback) var cid = 3487133; var param = { token: { oauth_token_secret: <token_secret>, oauth_token: <token> }, count: 50 } //post linkedin_client.apicall('get', '/companies/' + cid + '/updates', param, function(error, result) { console.log(result) }); there nothing wrong code. from https://developer.linkedin.com/docs/company-pages#company_updates can find that only recent 50 updates events of type status-update returned. other event types, request return updates within past 20 days, or 250 total updates - whichever comes first. using linkedin console ( htt

java - Embedded Jetty is running with old version of servlets API -

my embedded jetty has following file @ /home/user/desktop/jetty-web.xml : <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com /xml/ns/javaee/web-app_3_0.xsd" id="webapp_id" version="3.0"/> i start server following code: server server = new server(); selectchannelconnector connector = new selectchannelconnector(); connector.setport(serverconfig.port); connector.setmaxidletime(serverconfig.max_idle_time); connector.setrequestheadersize(serverconfig.request_header_size); server.setconnectors(new connector[]{connector}); webappcontext webappcontext = new webappcontext(); webappcontext.setdescriptor("/home/user/desktop/jetty-web.xml"); webappcontext.setbaseresource(resource.newresource("/")); webappcontext.setcontextpath("/"

restful url - REST API - filters, child entities or is leaking information really so bad? -

the basic problem i have rest api. sake of example, let's have users, can members in number of groups, , both users , groups can own objects. any user can filter objects various criteria: /objects?color=green /objects?created=yesterday but members of given group can filter group ownership: /objects?groupid=1 and actual user can filter user ownership: /objects?userid=55 there 2 basic patterns - 1 make object child entity of group, such as: /groups/4/objects/1 with 4 being group id , 1 being object id. other option having group , objects side-by-side: /groups/4 and /objects/1 making object child of group and/or user eliminate other filtering options - essentially, have 1 object multiple paths it. the actual question if want limit access regular user he/she can access objects directly owned him/her or groups he/she member of, work filter on collection - entity level? if try: /objects/9 but object owned group not member of, expect authorizatio

tcl - Expect script help - capturing data from send command -

i wrote script sends ios files cisco device if there enough free space, if there isn't enough free space- delete file until there is. works fine , dandy unless ios happens in directory. pseudo code: send directory command parse output , put in format flash:c3560-ipservicesk9-mz.150-2.se7.bin flash:/testfolder/c3560-ipservicesk9-mz.120-2.se7.bin actual code: set index 0 send "dir /recursive \n" expect { #this new code -nocase -re "directory of (\[^\r\]+)" { set test $expect_out(1,string) exp_continue } #old code grabbed ios, working -nocase -re "(\[^\[:space:\]\]+.bin)" { append test ":$expect_out(1,string)" set ioses($index) $test set index [expr $index + 1] exp_continue } #final case escapes exp_continue, , sets free space -nocase -re "\\((.*) bytes free" {set fr

c - Setting a specific element of a char** array to NULL -

i attempting set last element in second char ** array null after encounter specific char in first array. int test(char ** args){ char ** chmd1; for(int = 0; args[i] != null; ++i){ if(!strncmp(args[i], "<", 1)){ chmd1[i] = null; break; } chmd1[i] = args[i]; } for(int = 0; chmd1[i] != null; ++i){ printf("%s", chmd1[i]); } return 0; } this code segfaults second loop goes on more iterations past null should be. i want able able manipulating pointers , not using mallocs, i'm stuck. this code segfaults second loop goes on more iterations past the null should be. you have not allocated memory chmd1 , yet using points valid memory. i want able able manipulating pointers , not using mallocs, i'm stuck. you can't that. have use malloc (or 1 of other functions malloc group of functions: calloc , realloc ) allocate memory chmd1 before can use it.

shell - cryptsetup luksFormat error: Requested offset is beyond real size of device /dev/loop1 -

i'm getting error when try run cryptsetup luksformat command on ubuntu.can please me issue command: $ loop_dev= losetup --find $ echo yes | cryptsetup -v luksformat --key-file="/path/to/keyfile" $loop_dev error: requested offset beyond real size of device /dev/loop1. command failed code 22: requested offset beyond real size of device /dev/loop1 this happening loop devices /dev/loop0-/dev/loop7

Prevent group rename in Outlook 2013 in VSTO Addin -

i developing vsto addin in visual studio 2013 outlook 2013. add own group few of ribbons, such home tab in explorer view. prevent renaming group. users can use customize ribbon feature in outlook manage groups , commands , can rename, move, or remove group customizing it. there way can attach event , prevent user renaming group (i prefer able prevent them removing/hiding group too). have looked through outlook 2013 object model list , cannot find relevant events attach to. don't see group objects or looks relevant. is there way can attach event , prevent user renaming group the fluent ui (aka ribbon ui) nor outlook object model doesn't provide that. you may consider hiding button in outlook (on backstage ui) showing options dialog instead.

Java LibGDX BitmapFont setScale method not working -

i trying scale font receiving error "the method setscale(float, float) undefined type bitmapfont" code section getting error, in lines 2 , 4. font = new bitmapfont(gdx.files.internal("text.fnt")); font.setscale (.25f, -.25f); shadow = new bitmapfont(gdx.files.internal("shadow.fnt")); shadow.setscale (.25f -.25f); i created variables here public static bitmapfont font; public static bitmapfont shadow; when check other examples of using setscale function, seems format used. ideas why occurring? this method doesn't exist anymore in bitmapfont class. an api change bitmap* classes has been introduced libgdx 1.5.6 (released in april 2015) explained in libgdx team blog post . tutorial followed outdated. long story short, latest libgdx version, should able : font.getdata().setscale(.25f,.25f);

android - how to toast inside timerTask run.Exception is uncaught handler -

@override public int onstartcommand(intent intent, int flags, int startid) { toast.maketext(this, "my service started", toast.length_long).show(); time=long.parselong(intent.getstringextra("time")); toast.maketext(this, ""+time, toast.length_long).show(); timer=new timer(); timertask timertask=new timertask() { @override public void run() { calendar c = calendar.getinstance(); int minute = c.get(calendar.minute); if(minute==time) { log.d("alarmservice", "timer"); toast.maketext(getapplicationcontext(),"ringing",toast.length_short); } } }; timer.scheduleatfixedrate(timertask, 0, 1000*2); return super.onstartcommand(intent, flags, startid); } how toast inside timertask run.exception uncaught handler because showing toast run method of timertask execute on non-ui th

eclipse - Programmatically activating existing label decorator from another plugin -

i have plugin contributes label decorator org.ui.eclipse.decorators . want label decorator inactive default, achieved quite straight forward setting state -attribute false . now point of question: possible change state of decorator programmatically from plugin ? user can check , uncheck decorator global preferences, can achieved plugin? thanks in advance! you can enable (or disable) decorator using: idecoratormanager manager = platformui.getworkbench().getdecoratormanager(); manager.setenabled("decorator id", true);

html - Same inner div image height as the outer -

my inner image should have same height outer div. my code is: <div> <div class="col_2_fifth"> <figure> <img src="....." /> </figure> </div> <div class="col_3_fifth"> <div class="description"> <p>....</p> </div> </div> </div> but image height less parent div height. what can now? can fix jquery/js or css? simply write: figure img {height:100%:}

javascript - if part not executed -

$(document).ready(function () { var t=true; var f=false; var cheap; $('.day1').on('change', function (e) { if($(this).val() == "saturday"){ cheap = true; } else{ cheap=false; } }); if(cheap==true){ $('.pricing1').change(function () { var price = parsefloat($('.total').data('base-price')) || 0; $('.pricing1').each(function (i, el) { price += parsefloat($('option:selected', el).data('cheap')); $('.total').val('$' + price.tofixed(2)); }); //console.log('cheap',cheap) }); } else{ $('.pricing').change(function () { var price = parsefloat($('.total').data('base-price')) || 0; $('.pricing').each(function (i, el) { price += parsefloat($('option:selected', el).da

sharepoint 2010 - Watermarking pdf on document upload -

i want add functionality of adding watermark using itextsharp library pdf document being added library. created event listener triggered when item being added. code follows : using system; using system.security.permissions; using microsoft.sharepoint; using microsoft.sharepoint.utilities; using microsoft.sharepoint.workflow; using itextsharp.text; using itextsharp.text.pdf; using system.io; namespace projectprac.watermarkonupload { /// <summary> /// list item events /// </summary> public class watermarkonupload : spitemeventreceiver { /// <summary> /// item being added. /// </summary> public override void itemadding(spitemeventproperties properties) { base.itemadding(properties); string watermarkedfile = "watermarked.pdf"; // creating watermark on separate layer // creating itextsharp.text.pdf.pdfreader object read existing pdf document p

elisp - how to show path to file in the Emacs mode-line? -

Image
in mode-line appears name of buffer working (argf.rb): for buffer visiting file, possible display absolute file name (i.e., include path)? first, see buffer name, not file name. try open 2 files same names (in different directories) , see mean. second, yes, sure possible - customize mode-line-format . third, might not such great idea - mode line quite crowded , long path not fit. know sounds great now, hate next day. instead, put path title bar: (setq frame-title-format '(buffer-file-name "%b - %f" ; file buffer (dired-directory dired-directory ; dired buffer (revert-buffer-function "%b" ; buffer menu ("%b - dir: " default-directory))))) ; plain buffer

javascript - Bing Maps infobox with htmlcontent doesn't show close button -

this part of javascript code use: infobox.setlocation(e.target.getlocation()); infobox.sethtmlcontent(myhtmlcontent); infobox.setoptions({ showpointer: false, showclosebutton: true, offset: new microsoft.maps.point(0, 25), visible: true }); is possible 'showclosebutton' option doesn't work when using sethtmlcontent? or missing something? update: adding code manually i'm able close infobox, i'm not sure if correct way close infobox: '<a class="infobox-close" href="javascript:closeinfobox()">x</a>' and javascript function: function closeinfobox() { infobox.setoptions({ visible: false }); } the show close button when using default infobox template. when use custom html functionality overridden. approach of using link calls javascript close infobox correct approach take.

django - Make a copy of a model instance -

i have following code: class person(models.model): name = models.charfield(max_length=32, verbose_name=_(u"name")) surname = models.charfield(max_length=32, verbose_name=_(u"surname")) address = models.charfield(max_length=32, verbose_name=_(u"address")) class contract(models.model): person = models.foreignkey(person) #person hired project = models.foreignkey(project, blank = true, null = true) starting_date = models.datefield(blank = true, null = true) ending_date = models.datefield(blank = true, null = true) each person shown own contract through inline. i need able modify contract without removing contract i'm modifying, record of contracts person has had. mean, i'll have make copy of contract want modify , make changes in copy @ end i'll have both contracts (the previous 1 , modified version of one). i guess need link or button next every row of inline in order go contract admin page ,

Pivoting columns in SQL Server -

Image
i have below result set(ignore column names, modified show in form of columns) generated using query given source rfrshcycleid sorcetype cyclenmber cyclenme sltme rfrshcycledetalid publishtime ------------------------------------------------------------------------- mercury 1 summary 1 cycle1 3:00:00 null null mercury 2 summary 3 cycle3 6:00:00 1 4/21/15 4:32 mercury 3 summary 5 cycle5 10:00:00 null null mercury 4 summary 2 cycle2 15:00:00 null null mercury 5 detail 1 cycle1 8:00:00 null null mercury 6 detail 2 cycle2 23:00:00 null null mercury 7 complete 1 cycle1 3:00:00 2 4/18/15 1:42 mercury 8 complete 3 cycle3 6:00:00 null null mercury 9 complete 2 cycle2 15:00:00 null null mercury 10 complete 4 cycle4 18:00:00 null null the query used above resultset : select rc.source source, rc.refreshcycleid refreshcycleid, rc.sourcetype sourcetype, rc.cyclenumber cycle

java - orika - one-way mapping -

i'm trying one-way mapping work @ class level. i have 2 classmaps below: mapperfactory.classmap(a.class,b.class).toclassmap() mapperfactory.classmap(b.class,a.class).toclassmap() these classmaps cannot work bidirectional mapping. so, i'm using 2 different mappings. using 2 different classmaps bi-directional mapping making none of above work. i'm looking way use classmap one-way mapping can use both of above. any appreciated. thanks. in orika considered same class map (look @ mapperkey class [a,b] <=> [b,a]), can have different direction on field level within same class map definition. to answer question (if understand) should use 2 mapperfactory. like atobmapperfactory , btoamapperfactory can have different class map definition each direction (as said within single mapper factory not possible)

c - Strange compiler speed optimization results - IAR compiler -

i'm experiencing strange issue when try compile 2 source files contain important computing algorithms need highly optimized speed. initially , have 2 source files, let's call them a.c , b.c , each containing multiple functions call each other (functions file may call functions other file). compile both files full speed optimizations , when run main algorithm in application, takes 900 ms run. then notice functions 2 files mixed logical point of view, move functions a.c b.c ; let's call new files a2.c , b2.c . update 2 headers a.h , b.h moving corresponding declarations. moving function definitions 1 file other modification make! the strange result after compile 2 files again same optimizations, algorithm takes 1000 ms run. what going on here? what suspect happens: when functions f calls function g , being in same file allows compiler replace actual function calls inline code optimization. no longer possible when definitions not compiled @ same time.

MySql Workbench - difference between "Local instance 3306" and "Localhost via pipe"? -

Image
im learning how build simple web app using php , mysql. tools: -xampp database, web , php servers -sublime writing code -mac osx yosemite - workbench database creation i'm having trouble understanding (and finding tutorial) how workbench works. if got things correctly, need create connection between workbench (tool) , database sits "inside" database server? in case, provided xampp. after these 2 talking, create, edit, etc. tables inside database, right? currently have 2 mysql connections on homescreen, please see attached file. thanks! it's connection/transfer method. can connect mysql server via named pipe if such ability provided operating system or via tcp connection network access works , used localhost connections. it transparent user , should not affect communication between server , client. 2 connect same database using different types of communication channels.

android - How to get current entryValues from ListPreference in Fragments -

@override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view v = inflater.inflate(r.layout.record_fragment, container, false); listpreference listpreference = (listpreference) findpreference("formats_listpref"); charsequence currtext = listpreference.getentry(); string currvalue = listpreference.getvalue(); return v; } the method findpreference(string) undefined type browse_fragment i want selected entryvalues listpreference, can value activity when use same code in fragments, not working findpreference(string) undefined tried getactivity().findpreference still showing undefined. in advance . i check fragment extends preferencefragment i.e. public class yourfragment extends preferencefragment { ... } hope helps.

rmi - java.lang.IllegalArgumentException: argument type mismatch $Proxy0.joinNetwork(Unknown Source) -

here code: public class peernode extends unicastremoteobject implements peerinterface { private peerinterface joint; private list<peernode> neighbours; public peernode(string s, int idnumber) throws ioexception { peernode.setnome(s); peernode.setkey(idnumber); this.neighbours = new arraylist<>(); system.out.println("peer node initialized"); system.out.println(this); } public void contactexistingnode(string node) throws exception, remoteexception, notboundexception { system.out.println("i know peer "+ node); system.out.println("i try join automatically network"); joint = (peerinterface) registry.lookup(node); joint.joinnetwork(this); } and interface: public interface peerinterface extends remote { public void joinnetwork(peernode p) throws remoteexception; } i'm trying pass object remote peer... , @ line joint.joinnetwork(thi

cucumber - Should all fields that are visible on a screen be validated in Gherkin? -

we creating gherkin feature files our application create executable specifications. have files this: given product <type> found when product clicked detailed information on product appears , field text has value , field price has value , field buy available we wondering if whole list of and keywords validate if fields visible on screen way go, or if should shorten 'validate input'. we have similar case in our service can return lot of 10's of elements each case validate. not validate every element each interaction, test elements relevant test case. to make easier maintain , switch elements using, use scenario outlines , tables of examples. scenario outline: po boxes correctly located when search in usa "<input>" address contains | label | text | | po box | <pobox> | | city name | <cityname> | | state code | <statecode&g

nfc - ACR122 - Android / How to extract the UID -

i try integrate acr122 android app. i'm using android library ( http://www.acs.com.hk/en/products/3/acr122u-usb-nfc-reader/ ) available acs. everything work, can detect presence of card want extract uid/id of card. know function that? do have example of type of integration? in case of mifare card need send apdu byte array card: (byte) 0xff, (byte) 0xca, (byte) 0x00, (byte) 0x00, (byte) 0x00 . i'm not sure acr122 api need wrap apdu specific api method transmit() update sample code: byte[] command = { (byte) 0xff, (byte) 0xca, (byte) 0x00, (byte) 0x00, (byte) 0x00 }; byte[] response = new byte[300]; int responselength; responselength = reader.transmit(slotnum, command, command.length, response,response.length); system.out.println(new string(response)); reader com.acs.smartcard.reader object , slotnum slot number. i’m not sure how find because don’t have acr test. if told able establish basic communication reader know slotnum.