Posts

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...