Posts

Showing posts from August, 2011

python - Pycharm interpreter path contains unicode character -

i trying run basic python code works under spyder, on last version of pycharm: a = 2 print here error message get: file "c:\users\fran�ois\anaconda\lib\ntpath.py", line 84, in join result_path = result_path + p_path unicodedecodeerror: 'ascii' codec can't decode byte 0xe7 in position 11: ordinal not in range(128) process finished exit code 1 as see, pycharm can not handle fact 1 of folder called "françois" (french first name) , since interpreter in folder, launches error. my pycharm python interpreter path set following: c:\users\françois\anaconda\python.exe so how can solve problem without renaming folder in computer? not have access move interpreter location. looked @ options couldn't figure out.

box2d - how to implement hill like below image in libgdx? -

Image
i generate chain shape dynamically and question is: how draw ground below image dynamically? thanks

excel - How to overwrite a table in Access when importing data from a spreadsheet using the DoCmd.TransferSpreadsheet Method? -

i can't figure out how overwrite current table in access when import data excel spreadsheet using docmd.transferspreadsheet method. code below appends imported data table1 while want overwrite imported data. sub accimport() dim s long: s = thisworkbook.worksheets("sheet1").cells(rows.count, "a").end(xlup).row dim acc new access.application acc.visible = true acc.opencurrentdatabase "f:\dbs\mydb.accdb" acc.docmd.transferspreadsheet _ transfertype:=acimport, _ spreadsheettype:=acspreadsheettypeexcel12xml, _ tablename:="table1", _ filename:=application.activeworkbook.fullname, _ hasfieldnames:=true, _ range:="sheet1$a1:p" & s acc.closecurrentdatabase acc.quit set acc = nothing end sub discard existing data table1 before calling transferspreadsheet : acc.opencurrentdatabase "f:\dbs\mydb.a

Connecting to MySQL Database C# -

i need connecting mysql server on web host. here code login button fails log me in. private void btnlogin_click(object sender, eventargs e) { try { string strconnect = "server=localhost;database=cpr_users;uid=myusername;password=*******;"; mysqlconnection myconn = new mysqlconnection(strconnect); mysqlcommand selectcmd = new mysqlcommand("select * cpr_users.cpr_user_info username='" + txtusername.text + "' , password='" + txtpassword.text + "' ;", myconn); mysqldatareader myreader; myconn.open(); int count = 0; myreader = selectcmd.executereader(); while (myreader.read()) { count = count + 1; } if (count == 1) { this.close(); medicalform(); } else if (count > 1) {

html - Font-size on iOS with viewport -

Image
i can't figure out. i'm build html game , game fonts bigger in iphone4 in pc browser (chrome). i'm using tag on html: <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1" /> the font size set @ 4em in buttons "-webkit-text-size-adjust: none;" css property in whole body. i know has pixel density , iphone resolution, tried , can't make them both same. if remove html viewport tag, fonts end looking smaller they're supposed be. thank you. do have appropriate media query it? 4em on mobile huge, don't go above 1.2-5 em on mobile sites. add in css @media screen , (min-width: 1px) , (max-width:590px){ /*what ever element is*/{ font-size: 1em; } }

ios - CABasicAnimation + UIBezierPath -

i'm trying create circular bar such 1 can find around recording button in native camera on ios when doing timelapse. a circle created along animation, , once completed removed again "naturally". i tried next code: cashapelayer *circle = [cashapelayer layer]; circle.path = [uibezierpath bezierpathwitharccenter:cgpointmake(self.lapsebtnoutlet.center.x, self.lapsebtnoutlet.center.y) radius:28 startangle:2*m_pi*0-m_pi_2 endangle:2*m_pi*1-m_pi_2 clockwise:yes].cgpath; circle.fillcolor = [uicolor clearcolor].cgcolor; circle.strokecolor = [uicolor whitecolor].cgcolor; circle.linewidth = 2.0; cabasicanimation *animation = [cabasicanimation animationwithkeypath:@"strokeend"]; animation.duration = self.lapseinterval; animation.removedoncompletion = no; animation.fromvalue = @(0); animation.tovalue = @(1); animation.timingfunction = [camediatimingfunction functionwithname:kcamediatimingfunctionlinear]; [circle addanimation:animation forkey:@"drawcircleanima

javascript - How to mock dependencies for unit tests with ES6 Modules -

i'm trying fiddle ecmascript 6 modules using webpack + traceur transpile es5 commonjs, i'm having trouble unit testing them. i tried using jest + traceur preprocessor, automocking , dependency names seem screwy, plus can't seem sourcemaps work jest , node-inspector debugging. is there better framework unit test es6 modules? i've started employing import * obj style within tests, imports exports module properties of object can mocked. find lot cleaner using rewire or proxyquire or similar technique. i can't speak traceur framework used in question, i've found work setup of karma, jasmine, , babel, , i'm posting here seems popular question of type. i've used strategy when needing mock redux actions. here's short example: import * exports 'module-you-want-to-mock'; import systemundertest 'module-that-uses-above-module'; describe('your module', () => { beforeeach(() => { spyon(exports, 'som

python - How to insert a carriage return in a ReportLab paragraph? -

is there way insert carriage return in paragraph in reportlab? trying concatenate "\n" paragraph string isnt working. title = paragraph("title" + "\n" + "page", mystyle) i want since putting names cells , want control how many names lie on line in cell (ideally 1). 1 cell can contain multiple names within cell each name on own line, hence need insert new line. at point im getting flowable large frame error (i think has table being large or having many merged rows). way can think suppress have 1 name per line in cell can limit table size based on count of names , segment tables smaller tables. seems there has cleaner way of doing this. suggestions? a paragraph flowable in reportlab. newline character not work within flowable in way want to. if paragraph within table (as suggest), might consider creating cell without flowable. example, might this: data = [['title\npage', 'name', 'exists'], # note

Android HTC phone with two rear cameras -

i'm trying select rear camera in htc phones in api have 2 cameras: camera_facing_front , camera_facing_back . when call open() camera_facing_back , camera don't want (lower resolution other one). which id should use open other rear camera? you cannot select camera directly. you should open camera camera_facing_back , set picture size (it has 27 possible different sizes!). accordingly picture size set software camera, 1 of hardware cameras chosen one.

osx - What determines linking behaviour for GHC on OS X? -

i'm observing different linking behaviour between 2 machines when compiling binary. each has same ghc (7.8.3), same code, same flags ( -wall -o2 ), same libgmp (installed homebrew on each): machine-one$ otool -l my-binary my-binary: /usr/lib/libsystem.b.dylib (compatibility version 1.0.0, current version 1197.1.1) /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) machine-two$ otool -l my-binary my-binary: /usr/lib/libsystem.b.dylib (compatibility version 1.0.0, current version 1197.1.1) /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) /usr/local/lib/libgmp.10.dylib (compatibility version 13.0.0, current version 13.0.0) i can't life of me figure out why libgmp linked dynamically on second machine. in terms of differences i've been able recognize: ghc has been installed via binary distribution os x on first machine , homebrew on second. c compilers, have: machi

ios - How to put countDownDuration time from my picker into an integer? -

i found how log time picked: - (ibaction)save:(id)sender { nsdateformatter *formatter = [[nsdateformatter alloc] init]; [formatter setdateformat:@"hh:mm"]; nslog(@"%@", [formatter stringfromdate:[datepicker date]]); } what want accomplish is: i have model class sub-class of nsmanagedobject, class created .model entity. whenever click "save" method want give model class count down time, each object of class have it's countdown time , can fire each object... i'm beginner helpful if can give me guidance in type of object should store count down time selected, , why though putting inside integer see it's not true. thanks you need extract components of nsdate. there's class this: nsdatecomponents . check out other s.o. question guidance: nsdate year/month/day

javascript - Heading in Mobile View Cut Off -

my headings in carousel cut off when visit page in mobile view. website here... www.jocatcreative.com screen shot if issue linked below http://imgur.com/nwpkiup below html carousel... update css info if needed. <div class="banner"> <div id="carousel-example-generic" class="carousel slide" data-ride="carousel"> <!-- indicators --> <ol class="carousel-indicators"> <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li> <li data-target="#carousel-example-generic" data-slide-to="1"></li> <li data-target="#carousel-example-generic" data-slide-to="2"></li> </ol> <!-- wrapper slides --> <div class="carousel-inner"> <div class="item active">

c++ - Error converting void(__cdecl MyClass::*)() to void * -

i trying link external library in qt application. external library has header file following relevant code i'm trying call: extern vgrabdevice_api bool v_assignframesizecallback(igrabchannel* pchannel, void* pfunc); in demo c++ program provided, has no problems compiling, following relevant code is: // in main.cpp void _stdcall myframesizecallback(t x) { do_stuff; } int main(int argc, char* argv[]) { igrabchannel* pchannel0 = something; v_assignframesizecallback(pchannel0, myframesizecallback); } i trying incorporate code qt application, getting problems. in mainwindow.cpp file: void _stdcall mainwindow::myframesizecallback(t x) { do_stuff; } void mainwindow::somefunction() { igrabchannel* pchannel0 = something; v_assignframesizecallback(pchannel0, &mainwindow::myframesizecallback); } the error i'm getting is: error: c2664: 'bool v_assignframesizecallback(igrabchannel *,void *)' : cannot convert argument 2 'void (

java - Determine number of grouped values within a grid -

was wondering if me logic. say have grid consists of: 1 2 3 1 b 2 b b 3 a b there 3 groups in grid, determined each cell's value , neighboring cells have same value, assuming coordinate scheme (col, row): group 1: (1, 1), (1, 2), (1, 3), (2, 3) has value of a group 2: (2, 1), (2, 2), (3, 2), (3, 3) has value of b group 3: (3, 1) has value of a could suggest how determine programmatically? i thinking along lines of: use loop iterate through grid have method checks cell's top, right, bottom , left cell's value (also accounting boundary cells) check if cell of same value, store somehow otherwise new group? recurse but can't around if finds cell different value. think i'm on complicating simple solution here. i ideally store array of coordinates relate groups within grid. i think conceptually easiest way handle recursion. granted, because of java's subpar tail-recursion support, iterative solution more efficient; still,

java - Testing user input with selenium -

i'm student that's employed university write tests verify if code can put production on website. basically, compare series of expected results return. 1 of areas i'm supposed test forms page has several fields user can input information, such as: <div class="label">title: </div> <div class="html"><input id="title" size="40" name="title" type="text" value="" /></div> i need test various inputs might break code or cause problems. going make array of strings , test them i'm having trouble thinking of ideas of put inside it. i told them think should put limit on size of string can input user, after i'm not sure i'd want check. if recommend list of strings or commonly used in tests appreciate it. here similar question answered here , might example string test input boxes you can try sort of numeric input/text input combinations special chars.

php - phpMailer Windows Azure and Gmail SMTP -

i got today access client's server deployed application made, using teamviewer , virtual machine apparently on windows server 2008 r2 (what headache), guys don't have clue on how setup smtp server. so set 1 gmail account use aplication, on local machine works fine emails. even $mail->smtpsecure = 'tls'; $mail->port = 587; //or $mail->smtpsecure = 'ssl'; $mail->port = 465; does not matter in cloud server, gmail keeps blocking access account because server located in switzerland , log account on venezuela, far have told gmail in this url i'm 1 accessing, keeps blocking attempts. any workaround this? thanks

Rails Controller include record and it's children -

in rails app, create list view includes master record , it's children. workorder model: belongs_to :parent, :class_name => "workorder", :foreign_key => "parent_id" has_many :children, :class_name => "workorder", :foreign_key => "parent_id" this attempt: def index17 @workorder = params[:workorder_id] @workorders = workorder.find(@workorder) @workorders = @workorders + workorder.find(@workorder).children end i'm trying make master first record , of it's children. rails doesn't "+": undefined method `+' #<workorder:0x007fefcddf85f8> thanks help! something should work: def index17 @workorder_id = params[:workorder_id] @workorder = workorder.find(@workorder_id) @workorders = [@workorder, @workorder.children].flatten end this create flat list, parent first, followed children. alternatively, if you'd try rails / sql magic, can order par

css - How to align rows of images of different heights? -

i'm using bootstrap css. have handlebars loop, place many images side side: <div class="row"> {{#each imagedata}} <div class="col-xs-12 col-sm-4 col-md-3 col-lg-2 center"> <img src="{{url}}"> <p>{{title}}</p> </div> {{/each}} </div> unfortunately, of images of different dimensions. set following css: img { max-width: 100%; max-height: 400px; } but rows have expected number of images, others have fewer number (depending on number of images same height etc). what css should apply expected number of images on each row ? define height div , apply max-height images: .row > div{ width: 200px;/*example only*/ height: 300px;/*example only*/ } .row > div img{ max-height: 100%; }

Scala self-typed trait and calling method on supertype -

lets have class this class job(args:string) { def config:map[string,string] = ... } i want create trait can mixed in class add more configuration options. did this trait extraconfig { self:job => override def config = self.config ++ map("extra","config") } unfortunately doesnt compile self.config becomes self recursive. i tried doing trait extraconfig extends job {} but job taking constructor param , dont know how thread through. what best way solve this? you looking abstract override modifier, use need explicitly extend job class, in trait can use members of superclass: class job(args:string) { def config:map[string,string] = map.empty } trait extraconfig extends job { abstract override def config = super.config ++ map("extra" -> "config") } val job = new job("name") extraconfig

symfony - Is there a way to set a Doctrine Event Listener that limits every entity query to a specific field id? -

setting doctrine event listeners persisting , updating entities extremely useful feature. appears limited update or insert statements. select queries? let's have hosted cms shared database every record has siteid denoting record belongs site. when search records (entities) display on given site, need limit results records specific siteid . manually limit every single query in code, has potential forgetting (which security issue). considering making automatic every single query (i may need override in instances). so can manipulate dql or querybuilder in sort of preselect event listener makes sure limit siteid? and if so, ideally overwrite in system administrative interfaces want find records regardless of siteid. is possible? bad idea? smell rosemary? take @ doctrine filters . doctrine2 - there pre-selection hook? http://docs.doctrine-project.org/en/latest/reference/filters.html doctrine 2.2 features filter system allows developer add sql condit

sql - Strange behavior with ISNULL() in MSSQL -

i have select statement combining multiple segments of persons name. isn't new. select firstname + ' ' + lastname fullname mytable i tried add middle initial , came following select firstname + ' ' + isnull(middinginitial + ' ', '') + lastname fullname mytable this appears work, during testing of isnull() , came across odd behavior. i'm aware null + 'any string' resolves null . plain odd... here's code, , out result... print '''' + isnull(null + 'any string','results in null') + '''' print '''' + isnull(null + 'any','results in null') + '''' print '''' + isnull(null + 'a','results in null') + '''' print '''' + isnull(null + '','results in null') + '''' /* 'results in ' 'resu' 're' 're' */ any ide

export - Gradle - Camel Case for task names - First character UPPER case -

i have seen few gradle / groovy docs , mention, can create task name this: task kobalory { // code here... } task noprint << { // code here } task titu (...) { ... } task dothisspecialthing { ... } etc does gradle provides way define task exported / global task if make first character of task name upper case, see below. know there's $gradle_home/init.d if have someglobalfile.gradle , define tasks there, you'll have free in gradle process i'm asking if change first character of task name upper case. task kobalory { // code here... } task noprint << { // code here } task titu (...) { ... } task dothisspecialthing { ... } by convention, gradle task names start lowercase letter. technically, capitalization irrelevant.

php - DateTimeZone::__construct(): Unknown or bad timezone (Asia/Jakarta) -

i want made date can save in database. date automatic save in database, in cgridview date not appear in date now. example : date "06 dec 2014", in cgridview appear "05 dec 2014" (without quotation mark). want date save in database , appear in cgridview date now. how fix it? this code : ---------- **in model torque** public function beforesave() { if(parent::beforesave()) { if($this->isnewrecord) { $this->create_time = $this->update_time = strtotime( yii::app()->localtime->timezone = 'asia/jakarta'); $this->create_time = $this->update_time = date ('y-m-d', $this->create_time); $this->id_user=yii::app()->user->id; $criteria=new cdbcriteria; $criteria->select='nomor'; $criteria->limit=1;

c# - SOLVED Issue reading an cvs file in the server -

i having issues reading cvs file in server. know sure not folder permission issue because able upload , delete file in server. the problem here: using (streamreader sr = file.opentext(@"fulldomain/mycvsfolder/promocodes.cvs")) this code works in local if change file location local path @"c:etc" appreaciate help! code: protected void btnpreviewfile_click(object sender, eventargs e) { datatable dt = new datatable(); string line = null; int = 0; try{ using (streamreader sr = file.opentext(@"fulldomain/mycvsfolder/promocodes.cvs")) { while ((line = sr.readline()) != null) { string[] data = line.split(','); if (data.length > 0) { if (i == 0) { foreach (var item in data) { dt.columns.add(new datacolumn())

php - PHPUnit Skeleton Generator: Fatal error: Class 'SebastianBergmann\PHPUnit\SkeletonGenerator\CLI\Application' not found -

i'm trying use skeleton generator every time try use receive error below: fatal error: class 'sebastianbergmann\phpunit\skeletongenerator\cli\application' not found in [path_to_project]/vendor/phpunit/phpunit-skeleton-generator/phpunit-skelgen on line 63 the context i've installed skeletongenerator through composer. the not found class in reality exists in path /vendor/phpunit/phpunit-skeleton-generator/src/cli/application i don't understand why class exists isn't seen. what can solve problem? related autoloading of packages composer? github issue: https://github.com/sebastianbergmann/phpunit-skeleton-generator/issues/46 a place start line in phpunit-skelgen file: foreach (array(__dir__ . '/../../autoload.php', __dir__ . '/vendor/autoload.php') $file) { make sure autoload.php file(s) referred exist. way test add like: echo __dir__ . '/../../autoload.php' . "\n"; ...before foreach loop , see if

Javascript getUserMedia exclusively microphone input without internal audio -

my goal play sound through speakers , analyze audio coming in speakers. however, when run getusermedia audio input, i'm getting microphone input , audio being sent out speakers. i've tested in many ways can think. i'm hoping theres option i'm missing makes possible. there's code on place getting microphone input such one leads this demo . when play this video or music in computer, shows in audio input stream if have headphones on. thus, problem cannot exclusively microphone input... any ideas how make happen?

java - Guice field injection and TestNG -

when developing testng tests guice, la this: @guice(modules=mytestmodule.class) public class mytestclass { } it's easy use field injection declare dependencies of test class. now, suppose have this: @guice(modules=mytestmodule.class) public class mytestclass { @inject private foo foo; @test public void mytest() { injector injector = guice.createinjector(new someothermodule()); } } because of field injection, if someothermodule doesn't provide binding foo , mytest() fail due creationexception , because not have ability create mytestclass , if not intend test create mytestclass injector. is there way express intention, without changing constructor injection of foo ? is, there way somehow make not error create injector, make error when trying provision mytestclass , without changing how mytestclass written?

if statement - MATLAB - How to create output for each iteration of a looped calculation -

this calculation aims take value ( a ) , perform 1 of 2 calculations on each iteration of loop. each sequential loop takes new calculated value , recalculates it. keep outputted value each loop. here example, using logical array decide calculation use on each of 5 loops: a = 0; b = logical([1 0 1 1 0]); = 1:length(b) if b(i) == 1 = 1*2 + a*2 else = a*3 end end this example not correct returns 1 value a rather 5. desired result example is: a = 2 6 14 30 90 please me , amend else wrong here. many thanks. you can do a = [0]; b = logical([1 0 1 1 0]); = 1:length(b) if b(i) == 1 a(end+1) = 1*2 + a(end)*2; else a(end+1) = a(end)*3; end end

ios - UISearchBar with hidden TableView on NavigationBar -

i trying create view searchbar on navigationbar, want searchbar open tableview search results typing begins, , hide once item touched. new platform, need path follow, don't know start actually. according comment: heres more in depth explanation. happy coding: .h @interface tableviewcontroller : uitableviewcontroller <uisearchbardelegate> @property (strong, nonatomic) uisearchbar *searchbar; @end .m - (void) viewdidload:(bool)animated { uiview *searchbarview = [[uiview alloc] initwithframe:cgrectmake(0, 0, self.view.bounds.size.width, 44)]; //this adds container hold search bar. self.searchbar = [[uisearchbar alloc] initwithframe:cgrectmake(0, 0, self.view.bounds.size.width, 44)]; self.searchbar.delegate = self; [searchbarview addsubview:self.searchbar]; self.tableview.tableheaderview = searchbarview; //inserts uiview header of self.tableview [self.tableview setcontentoffset:cgpointmake(0, 44)]; } and thats pretty it. if want customize other things

web services - how to call webservice from playframework 1.1 -

i have webservice 1 function checkorder(string, string, string) return string. how call function checkorder controller. my code: wsrequest ws = ws.url("https://www.nganluong.vn/public_api.php?wsdl/"); ws.parameters.put("merchant_id", merchant_site_code); ws.parameters.put("param", payment_id); ws.parameters.put("checksum", checksum); ws.httpresponse rs = ws.post();

java - difference of final variable in code block -

i see code like public void foo() { final int x = 3; final object z = new object(); ....... } i know x can't modified since final there other reason/explaination that? compare without using final? or developer added final variable because likes to. thanks. declaring variable immutable (final) pretty reason itself. besides adding clarity code, provides valuable information compiler might able optimize code better when knows things not going change. one other reason might hidden in example behind ellipsis: if there closure somewhere in function, references local variables, not compile if not final. imagine example: public void foo() { final int x = 3; final object z = new object(); new thread() { public void run() { for(int = 0; < x; i++) { system.out.println(z); } } }.start(); } for work, x , z must declared final. why? well, local variables created on stack, and, once funct

r - How to display plant species biomass in a site by species matrix? -

i earlier asked "how display 2 columns binary (presence/absence) matrix?". question received 2 excellent answers. take step further , add third column original site species columns reflects biomass of each species in each plot. column 1 (plot) specifies code ~ 200 plots, column 2 (species) specifies code ~ 1200 species , column 3 (biomass) specifies dryweight. each plot has > 1 species , each species can occur in > 1 plot. total number of rows ~ 2700. > head(dissim) plot species biomass 1 a1f56r jactom 20.2 2 a1f56r zinunk 10.3 3 a1f56r mikcor 0.4 4 a1f56r rubcle 1.3 5 a1f56r sphoos 12.4 6 a1f56r nepbis1 8.2 tail(dissim) plot species biomass 2707 og100m562r selcup 4.7 2708 og100m562r pip139 30.5 2709 og100m562r stasum 0.1 2710 og100m562r artani 3.4 2711 og100m562r annunk 20.7 2712 og100m562r rubunk 22.6 i create plot species matrix displays biomass of each species in each plot (rather binary presence/absence matrix), of form:

getting wrong data from USB Communication in C# -

i using microcontroller send data computer. code using data: serialport1.portname = "com13"; serialport1.baudrate = 57600; serialport1.databits = 8; serialport1.parity = parity.odd; serialport1.stopbits = stopbits.one; serialport1.open(); private void serialport1_datareceived(object sender, serialdatareceivedeventargs e) { serialport sp = (serialport)sender; output += sp.readbyte() + " "; } but problem getting wrong data, missing 1 bytes. using "terminal" , seems sending data correctly microcontroller c# getting wrong data. there way parameter of serial port automatically dont need set parameters self.

How change icon dataList of PrimeFaces Mobile? -

Image
this question has answer here: issue navbar icon in jquery mobile 1 answer i have question have problem change icon datalist primeface mobile. researched according style: <p class="ui-li-aside" /> brings icon , position, tried create own style , add icon not work me. default.css (created style) .ui-li-edit { margin: 0; position: absolute; right: 3.333em; text-align: right; top: 1em; background-image: url("/sgcc-web-app/javax.faces.resource/images/icons-18-white.png.jsf?ln=primefaces-mobile"); background-position: -108px 70%; width: 18px; height: 18px; } to have custom icon on side need create class , add a tag in list items. need add :after in class make work. method acts same ui-li-aside custom icon. demo http://jsfiddle.net/0596ezfo/ css & html .ui-icon-myicon:after {

c++ - Breaking out a vector from a 2D vector -

i have 2d vector contains 138 vectors. need break out each of 138 vectors in order calculate dot product. have working dot product function, i'm having hard time breaking out individual vectors initial 2d vectors. here's have: for (unsigned = 0u; != templatevector.size(); ++i) { for(vector<double> vec : templatevector){ // cout << face.quicksort(vec, 0.0, 9.0); cout << "\nscalar_product: index[" << <<"] " << face.scalar_product(vec, queryvector); } std::cout << "\n"; } it ends printing dot product of each vector (index i) 138 times. templatevector vector contains 138 "vec" vectors, each of has 5,632 doubles. queryvector contains 5,632 doubles well. thanks in advance help. your outter loop unnecessary (and reason why see 138 times output each vector), , inner for-range loop unnecessarily copies vectors. simply : for(auto& vec : templatevector)

java - hbase export to flat file -

i'm pretty new hadoop... i have bunch of data in hbase table need export (with minor transformation) out single flat file. this, building mapreduce job scans table , maps data text type textoutputformat. something this: tablemapreduceutil.inittablemapperjob("tablename", // input table scan, // scan instance control cf , attribute selection mymapper.class, // mapper class text.class, // mapper output key text.class, // mapper output value job); job.setnumreducetasks(1); job.setoutputformatclass(textoutputformat.class); job.setoutputkeyclass(text.class); job.setoutputvalueclass(text.class); fileoutputformat.setoutputpath(job, new path("/tmp/mydirectory")); and mapper: private static class mymapper extends tablemapper<text, text> { public void map(immutablebyteswritable row, result result, context context) throws ioexception, interruptedexception { string json =

C++ Bubble Sorting and Comparing -

i've done bit of code try , sort list of movies either year, name or votes when run application not sort. wondering went wrong. believe might have movie movie. update: i've fixed somewhat, sorting first 10 or 20 items on list not sort rest. i've checked cout if there wrong loops , seems go 0-248 fine. enum moviesortorder { by_year = 0, by_name = 1, by_votes = 2 }; int movie::comparebyvotes(movie m) { if (m.get_votes() == this->get_votes()) { return 0; } else if (m.get_votes() > this->get_votes()) { return 1; } else { return -1; } } int movie::comparebyyear(movie m) { if (m.get_year() == this->get_year()) { return 0; } else if (m.get_year() > this->get_year()) { return 1; } else { return -1; } } int movie::comparebyname(movie m) { string = m.get_name(); string b = this->get_name(); if (a[0] = b[0]) { return 0; } else if (a[0] >

php - select order by - heading of items in group -

i have table "items" musical pieces, headers "title" "composer" "description".. various pieces per composer.. trying php script select * items, order "composer" generate header in while composer, output rows work, , on next.. i.e.: items table ------------------------------- david drury | piece 1 | info ------------------------------- david drury | piece 2 | info -------------------------------- alfonzo smith | piece 1 | info -------------------------------- david drury | piece 3 | info output david drury piece 1 | info piece 2 | info piece 3 | info alfonzo smith piece 1 | info can 1 table? or might able create table composers join can see composer, output header, outport pieces join in items table? got it.. subquery. whom might help, i've used: $sqlcommand = "select distinct composer items"; $query = mysqli_query($db_conx, $sqlcommand) or die (mysqli_error()); while ($r

python - Peculiar error downloading keys/files from S3 bucket - [Errno 1] Operation not permitted -

i'm using python script files in s3 bucket. relevant code snippet follow: print ("downloading files...") f in files: cwd=os.getcwd() fname=cwd+"/" fname = fname+f.name dir = os.path.dirname(fname) if not os.path.exists(dir): print dir os.makedirs(dir) try: f.get_contents_to_filename(fname) except oserror,e: print e when on bucket used store log files, error on folders in bucket. e.g. logs folder here: downloading files... /private/tmp/test/logs [errno 1] operation not permitted: '/private/tmp/test/logs/ despite error, directories , files downloaded. why happen? not happen on other buckets, except bucket log files other buckets sent to. or code? or permissions on bucket. has default permissions, nothing have changed. taking @pavel_form's suggestion, figured out p

Trouble getting list box items to populate in C# -

Image
i need call array following program working, can't figure out. i'm not sure or isn't working, because can't list box populate. following code. using system.io; namespace test_your_knowledge__game { public partial class form1 : form { public form1() { initializecomponent(); } string questionone; string questiontwo; string questionthree; string firstquestion = ("who silk worm?"); string secondquestion = ("what sapience mean?"); string thirdquestion = ("what tainou?"); string firstanswer = ("onycho"); string secondanswer = ("wisdom"); string thirdanswer = ("a wolf"); int count = 0; private void listbox1_selectedindexchanged(object sender, eventargs e) { } private void playbutton_click(object sender, eventargs e) { string name; string email; name = n

java - What is the best strategy to recover from an error - neglecting the record where error occurs -

i getting no implementation found native ldalvik/system/vmruntime;.pausegc error, below logcat. 05-13 22:39:22.538: w/dalvikvm(8350): no implementation found native ldalvik/system/vmruntime;.pausegc:(ljava/lang/string;)i 05-13 22:39:22.543: e/mythread(8350): pause gc 05-13 22:39:22.543: e/mythread(8350): java.lang.reflect.invocationtargetexception 05-13 22:39:22.543: e/mythread(8350): @ java.lang.reflect.method.invokenative(native method) 05-13 22:39:22.543: e/mythread(8350): @ java.lang.reflect.method.invoke(method.java:515) 05-13 22:39:22.543: e/mythread(8350): @ android.app.mythread.pausegc(mythread.java:5525) 05-13 22:39:22.543: e/mythread(8350): @ android.app.mythread.performlaunchactivity(mythread.java:2324) 05-13 22:39:22.543: e/mythread(8350): @ android.app.mythread.handlelaunchactivity(mythread.java:2471) 05-13 22:39:22.543: e/mythread(8350): @ android.app.mythread.access$900(mythread.java:175) 05-13 22:39:22.543: e/mythread(8350): @ android.app.mythread$h.handlemessage

php - how to insert image in database using phpmyadmin? -

im develop website using xampp localhost. want add image using phpmyadmin can't add it..the image can display in phpmyadmin can't appear on website..is wrong coding in php? $host="localhost"; // host name $username="root"; // mysql username $password=""; // mysql password $db_name="mmdb"; // database name $tbl_name="artist"; // table name // create connection $conn = mysqli_connect($host, $username, $password, $db_name); // check connection if (!$conn) { die("connection failed: " . mysqli_connect_error()); } $name=$_post['name']; $hometown=$_post['hometown']; $income=$_post['income']; $image=$_post['image']; //file =$_files['image']['tmp_name']; $video=$_post['video']; $sql = "insert $tbl_name(name, hometown, income, image, video) values ('$name', '$hometown','$income','$image','$

.net - Host ASP.NET App In WCF or Generic Web Server -

objective: we have windows service/generic exe hosts wcf service (.net 3.5). i'd able take third party asp.net component in dll, , host through wcf service. is possible do, in way? it seems if want host asp.net app, must through iis, don't use iis. there way load asp.net app memory, make app available through endpoint, , receive requests app? specifically, we'd take "microsoft.reportviewer.webforms.dll", expose web form in web page, , accept requests web form. http://msdn.microsoft.com/en-us/library/ms251723.aspx looking me started. thx. from owin.org " owin defines standard interface between .net web servers , web applications. goal of owin interface decouple server , application, encourage development of simple modules .net web development, and, being open standard, stimulate open source ecosystem of .net web development tools." essentially owin implementations, katana (owin implementations microsoft servers , framework

IOS Objective-C use the Swift pod files -

i want use pod project. found pod. swift. want use pod objective-c project. this pod file link https://github.com/vikmeup/sclalertview-swift i want know how can use swift pod objective-c? possible use swift pod objective-c?

ios - Play notification sound using URL -

i want application play notification sound through url . custom sound file lies @ particular working url . so, want app use link notify user notification. i've tried avplayer ,since plays sound files through url's check this the avplayer code working when call using [self playselectedsong] (plz check code provided in above link) in didfinishlaunchingwithoptions of appdelegate , viewdidload function of other views. whenever notification arrives( didreceiveremotenotification ) audio file url ,which add avplayer ,the sound isn't playing.only text notification shown. no not possible play sound on remote notification unless have on main bundle. check apple document for remote notifications in ios, can specify custom sound ios plays when presents local or remote notification application. sound files must in main bundle of client application. even if add sound file on main bundle , file can not longer 30 seconds custom sounds must un

javascript - open popup after 10 second of staying in the webpage -

how can open popup after visitor stay in webpage 10 seconds? want use popup - http://dinbror.dk/bpopup/ , want open after stay 10 second in webpage. try this settimeout(function(){ $('element_to_pop_up').bpopup({ modalclose: false, opacity: 0.6, positionstyle: 'fixed' //'fixed' or 'absolute' }); },10000);

matlab - Rotate Circular Images -

Image
hello i'm going text detection on circular images. after preprocessing polar cartesian transformation on images this example of real image after doing p2c transformation images become but since images come in different angles p2c transformation cut out characters i think need proper rotation before p2c transformation. my question kind of rotation method proper situation? or should start p2c transformation based on histogram values ? or kind of other ways guys suggest me? thanks i suggest polar cartesian transformation , analyse resulting image x . can find letters summing values along x dimension , using threshold detect if there letter or not: y = sum(x,1); th = (max(y) + min(y)) / 2; letters = y < th; now can find out if there letter @ border of image , shift image if case. if sum(letters([1:10,end-10:end])) x = circshift(x,[0,10]); end of course can't sure there no letter @ border now, better loop procedure until no letter found @

c++ - Common Vehicle Type Recognition Algorithms -

i trying write program in c++ using opencv toolkit accepts single back-view image containing @ 1 vehicle input, , classifies 4 categories: car truck light truck bus what looking common algorithms used challenges this.

mysql - Import SQL File into existing DB-Table (phpmyadmin) -

i have sql-file defining table 2 columns - product-id , product-reference. need import file existing table has same structure (plus columns), product-id corresponds product-id backup file. there simple way via phpmyadmin? one approach use load data infile (see here ) set option assign column values. columns not being set given default values, typically null . personally, load data staging table 2 columns , insert data staging table final table. makes easier validate data before putting "real" table.

Mysql join table result as one row -

i have 2 tables prj id | ptitle 1 | prj111 2 | prj222 prjflow id | pid | paction | pactiontxt 1 | 1 | 1 | man1 2 | 1 | 1 | man2 3 | 1 | 2 | woman1 4 | 1 | 1 | man3 i want output: output ptitle | men | women prj111 | man1,men3 | woman1 i write query: select prj.ptitle , group_concat(pflow1.pactiontxt) men , group_concat(pflow2.pactiontxt) women prj join prjflow pflow1 on prj.id = pflow1.pid , pflow1.paction = 1 join prjflow pflow2 on prj.id = pflow2.pid , pflow2.paction = 2; but output is: ptitle | men | women prj111 | man1,men3 | woman1,woman1 my query when number of rows of men , women have been equal, working want works @ case. thanks lot , excuse me poor english writing just use conditional aggregation: select prj.ptitle, group_concat(case when prjflow.paction = 1 prjflow.pactiontext end order prjflow.id) men, group_concat(cas