Posts

Showing posts from July, 2010

java - Control output file of a script -

in continuation this question. i need in making tabletocsv (function converts .html table csv), render code database, rather .csv. created bufferedreader, converts .csv database, can't 2 connect. please make output file of tabletocsv go bufferedreader. tabletocsv * [tabletocsv.java] * * summary: extracts rows in csv tables csv form. extracts data tables in input. output in xxx.csv. * * copyright: (c) 2011-2014 roedy green, canadian mind products, http://mindprod.com * * licence: software may copied , used freely purpose military. * http://mindprod.com/contact/nonmil.html * * requires: jdk 1.6+ * * created with: jetbrains intellij idea ide http://www.jetbrains.com/idea/ * * version history: * 1.0 2011-01-23 initial version. * 1.1 2011-01-25 allow specify encoding */ package com.mindprod.csv; import com.mindprod.common11.misc; import com.mindprod.entities.deentifystrings; import com.mindprod.hunkio.hunkio; import java.io.bufferedoutputstream;

c++ - how do I re-project points in a camera - projector system (after calibration) -

i have seen many blog entries , videos , source coude on internet how carry out camera + projector calibration using opencv, in order produce camera.yml , projector.yml , projectorextrinsics.yml files. i have yet see discussing files afterwards. indeed have done calibration myself, don't know next step in own application. say write application uses camera - projector system calibrated track objects , project on them. use contourfind() grab points of interest moving objects , want project these points (from projector!) onto objects! what want (for example) track centre of mass (com) of object , show point on camera view of tracked object (at com). point should projected on com of object in real time. it seems projectpoints() opencv function should use after loading yml files, not sure how account intrinsic & extrinsic calibration values of both camera , projector. namely, projectpoints() requires parameters vector of points re-project (duh!) rotation + tran

c++ - Wrapping a map of map iterator -

i have c++ class wraps map<int, map<int, stuff>> , find more efficient map<pair<int, int>, stuff> . however, i'd iterator interface of latter style. for example, i'd able following: for (const auto& loc_to_stuff : instance) { pair<int, int> loc = loc_to_stuff.first; int src = loc.first; int dst = loc.second; ... } i'm not sure c++ provides here: have implement iterator. keep in mind iterator class particular members. iterator class operator * , -> , == , != , , ++ , , maybe few more if can go and/or random seeks. internally, iterator hold 2 iterators map, map<int, map<int, stuff>>::iterator (the "outer" iterator) , map<int, stuff>::iterator (the "inner" iterator). ++ attempt increment inner iterator, , if fails, increment outer iterator, , start inner iterator @ map outer iterator pointing too. like: iterator &operator ++ () { ++m_inner; // if we'v

Problems with unit testing in rails especially with foreign keys -

i cant run unit test in rails. keep getting error: sqlite3::constraintexception: column email not unique. have foreign key email in post model dont know why keep getting above error. code follows test class: test "should not save post without title" post = post.new post.text = "hello world" assert !post.save end test "should not save post without description" post = post.new post.title = "hello" assert !post.save end it turns out rails 4 not using test in format above. worked when changes method headers like: def test should_not_save_post_without_title //add testing code end and make sure model fixtures have sample data in them every single variable needs tested. example of is: in post fixture: one: text: mystring title: mystring

javascript - Error: Backbone is not defined -

i trying run simple basic sample of backbone model found on tutorial learning library. <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> <script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.string/2.3.3/underscore.string.min.js"></script> <script src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"></script> <script> user = backbone.model.extend({ initialize: function() { alert("backbone model initialized"); } }); var user = new user; </script> but on console there 2 errors : uncaught typeerror: object # has no method 'each' on backbone-min file uncaught referenceerror: backbone not defined and not working. yo please me understand doing wrong? you're not loading full underscore library. replace second script tag following: <script src="http://cdnjs.cloudflare.com

cocoa - Mac OSX daemon for a task to maximize windows -

i want small functionality mac osx application windows. when double click on title bar, either nothing happens or application minimised(if appropriate option checked) instead, want create functionality maximised completely(not full screen). i assuming should write daemon quite new coding. so question is: can "goal" achieved daemon? no, cannot. there no way implement functionality public apis on mac os x.

c++ - Reconstructed position from depth - How to handle precision issues? -

Image
in deferred renderer, i've managed reconstruct fragment position depth buffer.... mostly. comparing results position stored in buffer, i've noticed i'm getting lot of popping far away screen. here's screenshot of i'm seeing: the green , yellow parts @ top skybox, position buffer contains (0, 0, 0) reconstruction algorithm interprets normal fragment depth = 0.0 (or 1.0?). the scene rendered using fragcolor = vec4(0.5 + (reconstpos - bufferpos.xyz), 1.0); , anywhere resulting fragment (0.5, 0.5, 0.5) reconstruction , buffer have exact same value. imprecision towards of depth buffer expected, magenta , blue seems bit strange. this how reconstruct position depth buffer: vec3 reconstructpositionwithmat(vec2 texcoord) { float depth = texture2d(depthbuffer, texcoord).x; depth = (depth * 2.0) - 1.0; vec2 ndc = (texcoord * 2.0) - 1.0; vec4 pos = vec4(ndc, depth, 1.0); pos = matinvproj * pos; return vec3(pos.xyz / pos.w); } where te

oracle - PLSQL: BEFORE INSERT TRIGGER (check value in column from other table before allowing insert) -

i've made simple dvd store database. dvd table has column "status" can either 'for_rent','for_sale','rented',or 'sold'. want write trigger block insertions rentals table if status column in dvd table not set 'for_rent'. much of documents i've looked @ don't show example using values 2 different tables i'm bit flummaxed. this believe has been best attempt far: create or replace trigger rental_unavailable before insert on rental; each row when (dvd.status != 'for_rent') declare dvd_rented exception; pragma exception_init( dvd_rented, -20001 ); begin raise dvd_rented; exception when dvd_rented raise_application_error(-20001,'dvd has been rented'); end; / i'm getting error: ora-00911: invalid character try - have not complied code, should good. in case see compilation issues let me know , post schema on sqlfiddle.com create or replace trigger rental_unavailable before insert

Download QT static build on windows -

i have been trying months qt 5.2.x compile statically mingw on windows, none of online guides work. there website has pre-built libraries mingw qt 5.2.x available download? after few hours of googling managed working qt 5.0.2, , have applied same steps 5.2.1 version. retrieve sources http://download.qt-project.org/official_releases/qt/5.2/5.2.1/single/qt-everywhere-opensource-src-5.2.1.zip , extract them inside c:\qt\5.2.1-static-thedate\ you'll have configure.bat file directly in c:\qt\5.2.1-static-thedate. using date-based folders can usefull when dealing multiple versions of qt. then open command prompt in folder , execute following command display possible flags, may want set or unset. configure -platform win32-g++ -? i personnaly have chosen command line compiling static version, suits needs, you'll have adjust fit yours. configure -debug-and-release -opensource -static -nomake examples -nomake tests -nomake tools -accessibility -no-sql-sqlit

r - Adjusting the "margin" space for axis text in ggplot2 -

Image
which property, if any, in ggplot controls width (or amount of blank space) of axis text? in example below, ultimate goal "push in" left-hand side of top graph lines bottom graph. i tried theme(plot.margin=..) affects margin of entire plot. facet 'ing doesn't either, since scales on y different. as last resort, realize modify axis text itself, need calculate cuts each graph. reproducible example: library(ggplot2) library(scales) d <- data.frame(x=letters[1:5], y1=1:5, y2=1:5 * 10^6) p.base <- ggplot(data=d, aes(x=x)) + scale_y_continuous(labels=comma) plots <- list( short = p.base + geom_bar(aes(y=y1), stat="identity", width=.5) , long = p.base + geom_bar(aes(y=y2), stat="identity", width=.5) ) do.call(grid.arrange, c(plots, ncol=1, main="sample plots")) here 1 solution. the idea borrowed " having horizontal instead of vertical labels on 2x1 facets , splitting y

javascript - In D3's zoom behavior, bubble the mousewheel event if maximally zoomed out -

i'm using d3's zoom behavior on large world map. var zoom = d3.behavior.zoom().scaleextent([1, 100]); it works great, providing natural zoom functionality , disabling usual scroll activity 1 expects mousewheel event, should. however, when map takes whole screen, worry users frustrated if try scroll down using mouse wheel when map zoomed way out. there way bubble behavior in circumstance? a example way scrollable div on page scroll down when mouse wheel used on top of it. when reaches bottom, page resumes scrolling down. i don't know lot event bubbling, see d3 zoom behavior called d3.event.preventdefault().

javascript - how to validate email -

this question has answer here: how validate email address in javascript? 65 answers i need add add following characteristics form i'm stuck. b appreciated. one or more word characters exactly 1 at-sign one or more word characters exactly 1 period 2 or more characters a-z, a-z, 0-9, period, or hyphen <!doctype html> <html> <head> <script> function validateform() { var x=document.forms["myform"]["email"].value; var atpos=x.indexof("@"); var dotpos=x.lastindexof("."); if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length) { alert("not valid e-mail address"); return false; } } </script> </head> <body> <form name="myform" action="demo_form.asp" onsubmit="r

Can I develop an IOS\Android app which can send Facebook notifications (inside FB) to user's friends with customized text? -

i hope well. i developing app ios , android logged via facebook. info retrieve each user (1) name (2) photo , (3) friends list. app work in way each user can send notification/message/alert his/her fb friends (with list inside app). i wanted know if possible program personalized text goes in notification. example, "john reccomends marvel", john person sent notification , marvel link marvel's fb page. know if possible this? if not, happen know other way can communicate user's friend? maybe via e-mail? have access user's friends mails? i appreciate in advance. cheers, luiz henrique

ios - Problems with Core Plot Graph on device but not on simulator -

i'm trying use core plot create graph of 3 investment scenarios on ipad. i'm using xcode 5, ipad 4, , ios 7. the basic premise user enters initial investment , interest rate 3 different investments , upon clicking button, second view displayed shows core plot scatter plot representation of each scenario on same plot space. my problem when run application on ipad (the actual device), resulting graph has plots equal y = 0 (this displayed, can't post pictures due need higher reputation stack overflow) however, in ipad simulator in xcode graph appears properly, equations have set using data input initial data view. i have 2 uiviews 2 separate view controllers. 1 data, , 1 graph display. code following: dataviewcontroller.h #import <uikit/uikit.h> @interface dataviewcontroller : uiviewcontroller @property (weak, nonatomic) iboutlet uitextfield *principalonetext; @property (weak, nonatomic) iboutlet uitextfield *rateonetext; @property (weak, nonatomic)

Javascript added Soundcloud embed says url is invalid. Via Redactor -

i'm working on plugin converts soundcloud urls embeds in wysiwyg editor redactor. working 1 exception. if first thing in editor paste soundcloud url , press enter, result in error of: url parameter not valid soundcloud url. learn more using soundcloud embeds. if paste same soundcloud url , press enter, embed work fine. upon inspecting html, urls identical, i'm not sure causing issue. work if load page, press enter, paste in soundcloud url, , press enter. i'm not sure if redactor issue or soundcloud issue or if i've done incorrect. advice appreciated. thanks! my current demo: http://caseybritt.com/_tmp/redactor-sc/ redactor uses 0 width spaces you'll need strip off matches before constructing url soundcloud embed. matches[2].replace(/u200b/g, '')

javascript - Links not working on Chrome & IE -

Image
i have used jquery bind menu on website , that's working in firefox not on chrome & ie. issue : when click on link anchor text in chrome, no redirect or navigation. check on website : http://www.pricingindia.in function show_n(e) { (var t = 1; t < 9; t++) { if (e == t) { $("#snav" + t).css("display", "block"); $("#stab" + t).addclass("act") } else { $("#snav" + t).css("display", "none"); $("#stab" + t).removeclass("act") } } if (e == 1) { $("#snav" + e).html('<ul class=\"snav\"><li><a href=\"http:\/\/www.pricingindia.in\/mobile\/87\" title=\"mobile phones\">mobile phones <span>(15707)<\/span><\/a><\/li><li><a href=\"http:\/\/www.pricingindia.in\/t

java.lang.OutOfMemoryError: Java heap space in tomcat7 -

i getting error in tomcat server. exception in thread "http-bio-8080-exec-17" exception in thread "http-bio-8080-exec-2" exception in thread "http-bio-8080-exec-15" exception in thread "http-bio-8080-exec-20" exception in thread "http-bio-8080-exec-18" java.lang.outofmemoryerror: java heap space. i have seen mat how generate .hprof file in tomcat server. thank you. to remove error edit file etc/default/tomcat7 replace with: java_opts="-djava.awt.headless=true -xmx1280m -xx:+useconcmarksweepgc" then restart our web server xmx new maximum size of memory , should affordable machine.

Python - Regex - findall duplicates -

Image
i'm trying match e-mails in html text using following code in python my_second_pat = '((\w+)( *?))(@|[aa][tt]|\([aa][tt]\))(((( *?)(\w+)( *?))(\.|[dd][oo][tt]|\([dd][oo][tt]\)))+)([ee][dd][uu]|[cc][oo][mm])' matches = re.findall(my_second_pat,line) m in matches: s = "".join(m) email = "".join(s.split()) res.append((name,'e',email)) when run on line = shoham@stanford.edu i get: [('shoham', 'shoham', '', '@', 'stanford.', 'stanford.', 'stanford', '', 'stanford', '', '.', 'edu')] what expect: [('shoham','@', 'stanford.', 'edu')] it's matched 1 string on regexpal.com, guess i'm having trouble re.findall i'm new both regex, , python. optimization/modifications welcomed. try this: (?i)([^@\s]{2,})(?:@|\s*at\s*)([^@\s.]{2,})(?:\.|\s*dot\s*)([^@\s.]{2,}) debuggex demo

git clone - Can we reclone a git repository from the existing local repository -

since git distributed vcs, should have complete history of changes done repository. so can extract version of repo cloned first? actually have done lot of changes in existing local repo. , not want revert original state losing data. want extract original repository(which cloned initially) other location using existing git objects(blob/tree). note : don't have access git server now. try this: git clone source_path new_path # clones have committed cd new_path # go new clone, don't modify pre-existing 1 git reset --hard rev # rev revision "rewind" (from git log) so need figure out explicitly revision go (git doesn't know revision cloned, can figure out). first step clone local disk local disk in different directory can keep existing work untouched.

sass - Sencha Architecture Theming and CSS is not Working -

when upgrade version css , theme taking default 1 .architect shows error theme error saving theme.cmdenabled projects need have local library base path.yours set " http://cdn.sencha.com/touch/sencha-touch-2.2.1/ " likely want set library base path to touch/, selecting library node under resources.

java - Calling a function with setContentView(R.layout) from another function? -

when call dbconctfun(view v) method through onclick threads , runnable code executing last after executing other code in dbconctfun(view v) method. in console shows: out of loop out of loop test####### multiple class.forname queryexct queryexct my code: package com.example.loginandroid; import java.sql.connection; import java.sql.drivermanager; import java.sql.resultset; import java.sql.sqlexception; import java.sql.statement; import android.os.bundle; import android.app.activity; import android.app.alertdialog; import android.util.log; import android.view.view; import android.widget.edittext; import android.widget.toast; import android.os.looper; public class mainactivity extends activity{ string username,password; resultset rs =null; boolean temcfag=false,temqfag=true; public static string tag="lifecycle activity"; edittext user,pass; alertdialog.builder dialog; @override protected void oncreate(bundle savedinstancestat

c# - Inherit DependencyProperties -

i have created several usercontrols headereddatepicker . the xaml of usercontrol looks like: <usercontrol x:class="book.customcontrols.headereddatepicker" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" datacontext="{binding relativesource={relativesource self}}" width="200" height="50"> <grid> <grid.rowdefinitions> <rowdefinition height="auto"/> <rowdefinition/> </grid.rowdefinitions> <textblock grid.row="0" margin="2,2" verticalalignment="center" text="{binding header}" fontweight="{binding headerfontweight}"/> <datepicker grid.row="1" margin="2,2" verticalalignment="center" selecteddate="{binding

arrays - Upload csv file using javascript and d3 -

i new javascript , d3 , cannot figure out how allow users upload csv file , displaying scatterplot using d3. using tag allow user select file. not sure on next step should be. there way read csv file , store it's contents in d3 array , displaying graph using array ?? thanks in advance look d3.csv function ( https://github.com/mbostock/d3/wiki/csv ). here simple example //load example.csv file d3.csv('example.csv', function(data){ //this object, contents of should //match example.csv input file. console.log(data); // more stuff 'data' related // drawing scatterplots. // //----------------------- }, function(error, rows) { console.log(rows); }; ); there number of examples online showing how go data array scatterplot...it's matter of modifying examples fit specific data format.

r - What is the proper way to document S4 methods in which the signature contains the `<-` class? -

in formula.tools package, define , document rhs method expressions <- b. #' @rdname formula.parts #' @aliases rhs,set-method setmethod( 'rhs', '<-', function(x) x[[3]] ) (n.b. signature list '<-' not wrong, here. class of assignment statement.) for s4 method, roxyger2-3.1.0, generates following in man/formula.parts.rd : \s4method{rhs}{<-}(x) i believe proper documentation tag should be: \s4method{rhs}{`<-`}(x) is there way force roxygen2 generate correct rd syntax? struggled bit, not find way. background r-3.0.1 roxygen-3.1.0 i answering own questions, after reporting this issue roxygen developers. confirmed not working prior roxygen2-4.0.0. pushed out patch within day. (awesome!) roxygen2 produces correct rd syntax signatures <-. additional notes: upgrading roxygen2-4.0.0 requires r >= 3.0.2 , newest version of rcpp.

How to find specific table from DB in postgresql? -

in db have 642 tables. have search specific table name contain empsal in it's name. above many tables there contain keyword in start of name or end of name or in between. so want list tables have empsal in it's name @ place. an newer postgresql don't know how so. is there method can me ? any suggestion this? this query: select table_name information_schema.tables table_schema='public' , table_type='base table'; should give list of tables in database. can add @ end: and table_name '%empsal%'; don't forget remove previous semicolon, or you're going have syntax error :)

solr - SolrJ and Auto Commit -

i adding documents solr 4.3 core using solrj api , noticed have autocommit set 15 seconds in stock solrconfig using below. <autocommit> <maxtime>${solr.autocommit.maxtime:15000}</maxtime> <opensearcher>false</opensearcher> </autocommit> my undestanding since auto commit set true means solr instance auto commiting anyhow every 15 seconds, not need commit explicity using solrj api in below everytime add document solr , understanding correct ? httpsolrserver.add(doc1); httpsolrserver.commit();// still needed ? thanks in advance! if have auto-commit defined, don't need explicit commit. however, in definition above, have opensearcher set false (hard) commit. means, solr commit not show changes. in example configuration works because there autosoftcommit commit opensearcher set true (or true default). make changes show without doing expensive hard commit. together 2 sections work seeing results fast ,

adding up down motion to a line in canvas html5 -

i trying add normal , down motion 2 lines drawn in html5 using canvas . unable to.. kindly suggest me way overcome , there better way this. adding function here function create_blades() { canvas_context.moveto(60+x_pos,80); canvas_context.lineto(125+x_pos,40+y_factor); canvas_context.linewidth = 3; canvas_context.stroke(); canvas_context.moveto(60+x_pos,110); canvas_context.lineto(125+x_pos,60-y_factor); canvas_context.linewidth = 3; canvas_context.stroke(); //motion(); } you not describing motion here generic approach animate lines (or objects). update positions check boundaries/criterias clear canvas redraw shape loop here live example . var xpos = 0, // holds current position (here, delta fixed pos) ypos = 0, dlty = 2, // delta values dltx = 2; (function loop() { xpos += dltx; // add delta values ypos += dlty; // check boundaries, here canvas edges if (xpos < 0 || xpos > canvas.width) dltx = -dltx; if (yp

iphone - How to add array values in a string in ios -

can please tell me how put array values[adding values] string or integer . suppose array a=[1,2,3] . after adding(+ action) should like string=1+2+3=>6 thanks , regards, use kvc collection operator nsarray *array =@[@(1),@(2),@(3)]; nslog(@"sum : %@", [array valueforkeypath:@"@sum.self"]);

json - how to modify the response in emberjs restadatper? -

i learning ember js. using product model : app.product = ds.model.extend({ id: ds.attr('string'), name: ds.attr('string'), code: ds.attr('string'), version: ds.attr('string'), description: ds.attr('string') }); the response server /products url follows (array of json objects): [ { "name": "product1", "code": "asdf", "version": "1.1", "id": "1" }, { "name": "product2", "code": "qwer", "version": "2.2", "id": "2" } ] but when return this.store.find('product'); model hook app.productsroute error: no model found '0' . i sure has ds.restadapter , related restserializer , extractarray , unable figure out. should json convention follow such response? , modify in .then(onsuccess) method of this.store.find() ?

Secure Nginx Directory But Not Files -

is there way require authentication view directory listings still allow public access files without authentication? using sample code: location / { auth_basic "closed site"; auth_basic_user_file conf/htpasswd; autoindex on; } requires authentication on both files , directories. not sure if work or not, try , tell me if works. location ~ /$ { auth_basic "closed site"; auth_basic_user_file conf/htpasswd; autoindex on; } location / { try_files $uri =404; }

azure - Virtual Machines all got restarted together, how to avoid that? -

my virtual machines got restarted fabric controller. think because set them in 1 virtual network , 1 affinity group. how can avoid them been restarted together? must in same network setting redundant virtual machines , using availability sets ensures service remain online during maintenance operations fabric controller (like 1 occured weekend).

javascript - programmatically calling drag event from function draggable() in jQuery -

i have following code in java script file. need trigger drag event pragmatically not able to. $(".toolitems").draggable({ drag: function (event, ui) { alert(); }, stop: function (event, ui) { removetoolitem(event, ui); } }); i trying call in following manner function createevt1() { var evt1 = $.event('drag'); evt1.clientx = 20; evt1.clienty = 30; $('.toolitems').trigger("drag",evt1); } but working try this: function createevt1() { var evt1 = $.event('drag'); evt1.clientx = 20; evt1.clienty = 30; makedraggable('.toolitems'); } function makedraggable(selector){ $(selector).draggable({ drag: function (event, ui) { alert("dragging"); }, stop: function (event, ui) { alert("stopping"); } }); }

Save excel workbook form always on top c# -

i'm creating new excel file c#, @ end need open form save it, @ moment window opens behind application. is there way open on top? here code: excel.application _xlapp; _xlapp.activewindow.activate(); _xlworkbook.close(true, type.missing, type.missing); _xlapp.quit(); _xlapp = null; we use next helper class purpose: public class processmanager { private intptr _buffer = intptr.zero; private intptr _hwnd = intptr.zero; private string _filenamemarker; public void startassiciatedprocessandbringittofront(string filename, string filenamemarker) { if (string.isnullorempty(filename)) throw new argumentexception(); _filenamemarker = filenamemarker; try { process.start(filename); if (!string.isnullorempty(_filenamemarker)) { _buffer = intptr.zero; _hwnd = intptr.zero; _buffer = marshal.allochglobal(512);

text rendering - Google's Open Sans Regular 400 always italic? -

Image
it seems google serving open sans regular 400 italic. else experiencing same issue? preview tools various websites suggest same. screenshot http://typecast.com/preview/google/open%20sans i found reason issue: i had installed some of google's open sans font styles (bold, bold italic, italic, etc), not regular 400, using service called skyfonts. when website offered serve webfont-version of open sans, chrome resolved using system font open sans, falling 400 italic, closest 400 regular, rather downloading webfonts. internet explorer not handling issue same way, , managed present webfont instead of using closest matched system font. solution the solution 1 of following: remove locally installed open sans font variations install missing 400 regular font variation in addition there

python - Using struct.unpack() without knowing anything about the string -

i need parse big-endian binary file , convert little-endian. however, people have handed file on me seem unable tell me data types contains, or how organized — thing know is big-endian binary file some old data. function struct.unpack(), however, requires format character first argument. this first line of binary file: import binascii path = "bc2003_lr_m32_chab_im.ised" open(path, 'rb') fd: line = fd.readline() print binascii.hexlify(line) a0040000dd0000000000000080e2f54780f1094840c61a4800a92d48c0d9424840a05a48404d7548e09d8948a0689a48e03fad48a063c248c01bda48c0b8f448804a0949100b1a49e0d62c49e0ed41499097594900247449a0a57f4900d98549b0278c49a0c2924990ad9949a0eba049e080a8490072b049c0c2b849d077c1493096ca494022d449a021de49a099e849e08ff349500a is possible change endianness of file without knowing it? you cannot without knowing datatypes. there little point in attempting otherwise. even if homogeneous sequence of 1 datatype, you&#

ruby on rails - Rake Clear tmp is taking too long -

this rails app, when tried execute rake tmp:clear ,it taking long (about 45 minutes have passed , yet task not finished!). ask there possibility caused server generating tmp? this project on linode production server. thanks! try following: run rails console on server rails console and then rails.cache.clear then should see cache clear, , can quit console. have same effect clearing tmp.

ios - GLKit Offscreen render to texture not working -

when try create fbo texture attached in opengl es 2.0 this: glgenframebuffers(1, &framebuffer); glgentextures(1, &textureid); glbindframebuffer(gl_framebuffer, framebuffer); glbindtexture(gl_texture_2d, textureid); glteximage2d(gl_texture_2d, 0, gl_rgba, width, height, 0, gl_rgba, gl_unsigned_byte, null); gltexparameteri(gl_texture_2d, gl_texture_min_filter, gl_linear); gltexparameteri(gl_texture_2d, gl_texture_mag_filter, gl_linear); gltexparameteri(gl_texture_2d, gl_texture_wrap_s, gl_clamp_to_edge); gltexparameteri(gl_texture_2d, gl_texture_wrap_t, gl_clamp_to_edge); glframebuffertexture2d(gl_framebuffer, gl_color_attachment0, gl_texture_2d, framebuffer, 0); glenum status; status = glcheckframebufferstatus(gl_framebuffer); switch(status) { case gl_framebuffer_complete: nslog(@"fbo complete"); break; case gl_framebuffer_unsupported: nslog(@"fbo un

python - "child exited with status 13" error with Lighttpd running Django app -

i trying run django application through lighttpd mod_fscgi . unfortunately keeps throwing error cant determine. here config: cat /etc/lighttpd/lighttpd.conf server.modules = ( "mod_expire", "mod_setenv", "mod_redirect", "mod_rewrite", "mod_compress", "mod_access", "mod_auth", "mod_secdownload", "mod_accesslog", "mod_fastcgi", # "mod_geoip" ) server.document-root = "/var/www/default" server.upload-dirs = ( "/var/cache/lighttpd/uploads" ) server.errorlog = "/var/www/logs

c# - How to map a JSON value to a model property of a different name -

how map json property value model property of different name using httpclient library using .net 4.5.1 framework , c# ? i using api weather underground, , created console app test out before make move asp.net mvc 5 web app. static void main(string[] args) { runasync().wait(); } static async task runasync() { string _address = "http://api.wunderground.com/api/{my_api_key}/conditions/q/ca/san_francisco.json"; using (var client = new httpclient()) { try { httpresponsemessage response = await client.getasync(_address); response.ensuresuccessstatuscode(); if (response.issuccessstatuscode) { condition condition = await response.content.readasasync<condition>(); } console.read(); } catch (httprequestexception e) { console.writeline("\nexception caught!");

multithreading - running UVM phases on multiple cores -

how can devote individual phases in uvm run, elaboration, build etc run on multiple cores of system. how can done through coding. as far know, multicore support can't influence through coding. it's simulator either has or hasn't. if could, have problem build, connect, run, etc. phase must execute in sequence.

How to add Cache-control header to $resource in AngularJS -

i trying bypass aggressive ie10 caching setting cache-control header of requests. however, not seem have desired effect. below can find code use. names sanitised bit. service.factory('service', ['$resource', function($resource) { return $resource(url + '/:year', {year : '@year'}, {'get': { headers : { 'cache-control': 'private, max-age=0, no-cache' } }}); } ]); the suggested solutions did not me, give food thought. posting posterity config solved problem. var config = { headers : { "pragma": "no-cache", "expires": -1, "cache-control": "no-cache" } };

ios - How to make a custom UIView to combine with UINavigationBar make it looks as one -

Image
as can see below, 3 buttons: store,area , all. these buttons looks uinavigationbar , them combined together. tried in storyboard, added custom uiview , try set it's colour match uinavigationbar background color. has differences, , can see border line between uinavigationbar , custom uiview. how make uiview combine uinavigationbar make looks combined. ios 7 has shadow next navigation bar. try below remove shadow: if (is_ios7) { [[uinavigationbar appearance]setshadowimage:[[uiimage alloc] init]]; }

seo - Static files served by node.js on heroku - is it a good idea? -

i have backbone powered single page app. app consists of couple of files: index.html javascripts/app.js javascripts/vendor.js stylesheets/app.css images/ -> image assets i want add prerender.io service app make seo-friendly. easiest way of doing me use express.js hosted on heroku : var express = require('express'); var app = express(); app.use(require('prerender-node').set('prerendertoken', 'your_token')); // ... app.listen(process.env.port || 5000); but maybe express or node not best serving static files? maybe heroku isn't best serving static files? best solution? recommend? see stackoverflow question serving static files through expressjs: static files express.js you should able use heroku's free dyno handle bit of traffic since you're serving static files. i suggest putting of files/folder in "public/" directory , using code: var express = require('express'); var app = express(); app.u

java - Get date by utc/gmt in Android -

i want display time in country, , timezone gmt+4. private void loadweather(){ timezone tz = timezone.gettimezone("gmt+0400"); calendar cal = calendar.getinstance(tz); date date = cal.gettime(); dateformat df = dateformat.getdatetimeinstance(dateformat.short,dateformat.short, locale.getdefault()); string mydate = df.format(date); tv_time.settext(mydate); } i've tried this, gives me time, , not other one the problem you're specifying time zone on calendar - only used current instant in time, doesn't depend on time zone. need specify on format instead, it's applied when creating appropriate text representation of instant: private void loadweather() { date date = new date(); // enough; uses current instant. dateformat df = dateformat.getdatetimeinstance( dateformat.short, dateformat.short, locale.getdefault()); df.settimezone(timezone.gettimezone("gmt+0400")); string mydate = df.format(

dictionary - Catch copy event android -

i programming dictionary has instant lookup function. wanna when selected text , copy it, popup displayed (display text , meaning of it). firstly, wanna display selected text. idea , advice. can view apps: quickdict it, if using api level 11 (3.0) or above, can use addprimaryclipchangedlistener documented click here , there example usage click here .

parse xml file with PHP and I want to delete elements by jQuery bas on user need -

this xml file, generted automatilcally want parse , modify content first want have delete action not work me. <?xml version="1.0"?> <guide totalpages="1"> <guidetitle>testme</guidetitle> <guidename>hawreguide2014030516131719</guidename> <page number="1"> <content type="statement">statment test</content> <content type="question type1" option1='op1' option2='op2'>can answer?</content> <content type="question type5" option1="multiple choice1" option2="multiple choice2" option3="multiple choice3" option4="" option5="">multiple choice</content> </page> </guide> this php code parsing if (file_exists('../xmlpages/hawreguide2014030516131719.xml')) { $xml = simplexml_load_file('../xmlpages/hawreguide2014030516131719.xml');

Runnung Capistrano recipe with rbenv sudo -

i'm trying use rbenv sudo plugin within capistrano 2 recipe. but, when run i'm asked input password recipe doesn't complete. run "cd #{current_path} && rbenv #{sudo} bundle exec foreman export upstart /etc/init -a appa -u appaser -l ~/apps/appa/current/log" is there way use rbenv sudo capistrano? thanks you have make sure user running command can run sudo without having provide password. check out post see how set up: http://www.davidverhasselt.com/2008/01/27/passwordless-sudo/

sql - retrieving xml node from multiple raws -

i retreieved column using inner join on 2 tables: select table_1.*, table_2.c table_1 inner join table_2 on charindex(table_2.a, table_1.b) > 0 , table_2.c=1 table_1.d '%xxx...%' one of column in above query type xml: <column1> --------- <xml1> --------- <xml2> --------- <xml3> --------- . . . 1.i want retrieve string each xml , display additional column in query (all xml structure identical)? thanks. lets xml follow: <root> <row> <string>xxx...</string> </row> </root> okay, assume column of table contain xml of below format. <root> <row> <value>1</value> </row> </root> then check below query. select b.id, x.xmlcol.value('value[1]', 'int') [nodeval] yourtable b cross apply b.actualxmlcol.nodes('/root/row') x(xmlcol);

excel - How to use double For loop in VBA? -

i trying define file path , file name using loop. after doing main action (that count of rows in example), need path next file path , next file name @ same time , main action (rows count). but have problems using next, because order trying use wrong. maybe can this? in advance! sub countrows() dim wbsource workbook, wbdest workbook dim wssource worksheet, wsdest worksheet dim strfolder string, strfile string dim lngnextrow long, lngrowcount long dim lastrow dim cl range dim cell range lastrow = wsdest.cells.find("*", searchorder:=xlbyrows, searchdirection:=xlprevious).row lngnextrow = wsdest.range("f" & wsdest.rows.count).end(xlup).row + 1 'here define path file each cl in wsdest.range("g11:g" & lastrow) strfolder = cl.value 'here define file name each cell in wsdest.range("c11:c" & lastrow) strfile = cell.value 'here

ios - Transparency of UISearchDisplayController -

Image
lately i've noticed strange thing in app. while tap on uisearchbar , uisearchdiplaycontroller starts tasks can see relics regular uitableview . wouldn't annoying regular uitableview freezed when use custom pull-to-refresh controller sspulltorefresh it's placed in inset of uitableview it's visible. also, wouldn't eye catching if status bar transculent it's transparent , can see what's under uisearchbar , status bar . question is: is possible make uisearchbar , status bar opaque? in latest version i'm using amscrollingnavbar custom pull-to-refresh view has moved status bar guess if status bar set inferred it's issue uisearchbar . set uisearchbar style black. set statusbar black.