Posts

Showing posts from September, 2013

c++ - Using QTImage with OpenGL -

ok given code , need set up. unfamiliar c++ , includes say: #include <qt\qimage.h> #include <qt\qgl.h> #include "imageloader.h" i have looked , there download on qt-image website, not have permission on computer (at college) install program. am doing wrong? or there headers can use instead? these missing components left application (needed glut, gml , glew too) you need download installation of qt. if find headers qimage , include headers other parts of qt, , surely need qt libraries link them in application. you download , install external hdd (or usb flash) on home computer, , setup college computer's environment search header files in location.

'Rails server' <- does not work -

i new rails. asked make improvements existing project. downloaded heroku. uses ruby "1.8.7", rvm have project's directory. managed bundle update , bundle install. try 'rails server' , error messages: /home/jacek/.rvm/gems/ruby-1.8.7-p371/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:55: uninitialized constant activesupport::dependencies::mutex (nameerror) /home/jacek/.rvm/gems/ruby-1.8.7-p371/gems/activesupport-2.3.5/lib/active_support.rb:56:in `require' /home/jacek/.rvm/gems/ruby-1.8.7-p371/gems/activesupport-2.3.5/lib/active_support.rb:56 /home/jacek/.rvm/gems/ruby-1.8.7-p371/gems/rails-2.3.5/bin/../lib/rails_generator.rb:28:in `require' /home/jacek/.rvm/gems/ruby-1.8.7-p371/gems/rails-2.3.5/bin/../lib/rails_generator.rb:28 /home/jacek/.rvm/gems/ruby-1.8.7-p371/gems/rails-2.3.5/bin/rails:14:in `require' /home/jacek/.rvm/gems/ruby-1.8.7-p371/gems/rails-2.3.5/bin/rails:14 /home/jacek/.rvm/gems/ruby-1.8.7-p371/bin/rails

scheduled tasks - Java - thread Pool -

my scheduled thread pool---> private static scheduledexecutorservice pendingcheckscheduler = executors.newscheduledthreadpool(1); thread 1---> private scheduledfuture<?> pendingtranstatuscheckhandle=pendingcheckscheduler.scheduleatfixedrate(new pendingtranstatuscheck(),0,checkforpendingtrans,timeunit.seconds ); thread2---> private scheduledfuture<?> forciblebatchclosehandle=pendingcheckscheduler.schedule(new forciblebatchclose(), waitforpendingtrans, timeunit.minutes); thread 1 executing every 10 seconds. thread 2 supposed start after 30 minutes. thread 1 behaving expected thread2 expected start after 30 minutes,is starting after 1 hour. does latency in thread1 contributing problem?if so, thread2 supposed givcen priority when thread 1 finishes considering have 1 thread in thread pool.why thread2 stretched long start after 1 hour? i clueless , expect pointers.please me. your concepts off, offsets conclusions. have one thread al

web services - Entity fetched from a webservice: how to integrate in DDD model? -

i have "process" application complex model (simplified here). application has webservice such: webservice | application behind webservice ------------------------------------------------------ processdto | process .getlabel() | .getlabel() | .getsubcomponents() | .execute(input) // calls processcomponent.execute | processcomponent | .execute(input) processservice | processrepository .findprocess(id) | .findprocess(id) .executeprocess(..)| the problem is: how integrate process entities inside application using webservice? i thinking of creating process entity instead of directly using dto entity. for example, in application, have module has process . i can hook in orm "association" part not problem. problem how module executes process? by calling processservice : that's ugly bec

c# - How to get startPage/rootPage using EPIServer WebService -

i've tried start or root node using episerver webservice. when programming in epi do pagereference parent = pagereference.startpage; but when using webservice gets little trickier since doesn't work pagestoreservice.pagereference.? how do start or root node using web service? thanks. not sure if pagestoreservice can provide information, quite roll own service obtain start page, , other information you'd need something might work (it's untested!) [webservice(namespace=http://yournamespace/")] public class pagereferenceservice : system.web.services.webservice { [webmethod()] public pagereference getstartpage() { return pagereference.startpage; } }

java - Barcode Scanner (ZXing) crashing -

Image
first off want tell have done can. followed 10 tutorials on internet , 10 threads on stacked. still no success. i know guys recommend using scanning via intent,but in case not option , need have native in app. i have downloaded zxing library (2.1) , followed this tutorial when run code on galaxy s3 or galaxy tab 10.1 debug, program crashes, after freezing 20 seconds, when click button should start intent result: com.google.zxing.client.android.scan or com.google.zxing.client.android.captureactivity . note have copied resources barcode scanner app beep sound, xml files , other. crash log my code below: mainactivity.java package com.example.philipscan; import android.os.bundle; import android.app.activity; import android.content.intent; import android.util.log; import android.view.menu; import android.view.view; public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancest

javascript - Decompose a string using regex -

i need decompose string javascript. the initial string: $var="1234 => 4242,example mailbox,root@localhost" the 4 decomposed parts: 1234 4242 example mailbox root@localhost what more efficient way: use regular expression or call string functions? can please provide regex extract such patterns, using groups. here solution little less restrictive : $var.split(/\s*,\s*|\s*=>\s*/)

java - Trouble with static and non-static -

i'm new @ java , following beginners course right now. nice, i'm trying kinds of stuff i'm stuck. piece of code doesn't work. should output input in reverse order (by words). the code flip works in piece of code wrote without gui , i'm trying work in gui fixed buttons, labels etc. i've copied example internet , trying change in such way it'll work. doesn't seem find variables use in actionperformed , setup in addcomponentstopane. has static , non-static, can't seem clear any appreciated. heres code. package flipit; import java.applet.applet; import java.awt.*; import java.awt.event.*; import java.util.list; import java.util.*; //arraylist; import javax.swing.*; public class flipit extends jframe implements actionlistener { public static void addcomponentstopane(container pane) { pane.setlayout(null); jlabel greetinglabel = new jlabel("enter array "); jtextfield infield = new jtextfield(); jtextfield

FFMPEG - build ubuntu 32 bit - missing shared library : libspeex -

i doing cross platform software calling ffmpeg in c++ , need ffmpeg build working on both ubuntu 32bits , 64bits installer. need ffmpeg build include librtmp, libh264, x11-grab, alsa, , mp3. i tried compile ffmpeg on 32bits virtual box have ffmpeg build working on ubuntu 32 bits , 62 bits. i used guide build ffmpeg : https://ffmpeg.org/trac/ffmpeg/wiki/ubuntucompilationguide after compiling libs , ffmpeg himself, after installation using deb files, ffmpeg working on 32bits virtualbox of required components not on 62bits ubuntu. when executing ffmpeg on ubuntu 64bits got message saying : impossible find shared library libspeex. do have idea why have problem on linux 64bits save deb files ? know website find ffmpeg 32bits build components need (static if possible)? tried website http://ffmpeg.gusari.org/static/ build not including alsa... i have build windows working perfectly, downloaded 32 bits static build on website : zeranoe builds website windows. thanks in advan

java - Axis2 2-way ssl handshake URL Filter -

this setup have axis 2 java 6 websphere 7 after lot of issues made axis 2 work in websphere 7 need implement 2 way ssl handshake seems need implement own sslprotocol factory apache httpclient. but catch here .i need ssl cert check service deployed in it. there totally 2 services.and need ssl check 1 service. there url filter can implement can make sure ssl works service intend not whole project can me. been struggling issue weeks. you may have write own ssl socket factory implements filtering want. starting point, axis2 includes 2 ssl socket factory implementations disable cert checking. this one sun java, while this one ibm's jdk. this question has example of setting axis2 use custom ssl socket factory.

PAR installation in perl cannot be completed -

i desperately need help! need compile perl script executable can run in windows without having perl installed. know not idea , absolutely need users of script. i have searched (a lot!) , decided best solution use par::packer. yet have been trying install 10 days no success…  i ve tried possible combinations of perl installation (activestate, strawberry, 5.10, 5.14, 5.16) , par versions, haven’t found combination works…. i tried link: http://www.nicholassolutions.com/tutorials/perl-par.htm and this: http://www.rabbibob.com/index.php/par_compiling_perl_scripts_into_executables#can.27t_find_par_loader and various site.. anyway, right now, have installed (with above instructions): strawberry perl 5.16.3001 par-1.007 the error when try run pp –o script.exe script.pl is that: pp not recognized external or internal command, operable program or batch file indeed don’t find relevant pp.bat in bin. earlier versions of par, bat created, although there other missin

asp.net mvc - MVC Diagram - Two views for one controller -

basically, i've been asked draw mvc diagram application fire off project , i'm little confused. i need draw basic mvc diagram (no problem), application can display 2 views of it's data; 1 view @ time. i'm having difficulty finding examples of on web, appreciated. so basically, can have view displays data , 1 allows edit it. that's 2 views of same data. you'd have 2 actions. assuming user profile, you'd have like: public class userprofilecontroller { public actionresult view(int userid) { //populate model return view(model); } public actionresult edit(int userid) { //populate model return view(model); } } then you'd have 2 different views, view might like: @model usermodel @html.labelfor(m => m.username) @html.displayfor(m => m.username) @html.labelfor(m => m.firstname) @html.displayfor(m => m.firstname) then edit like: @model usermodel @using (html.beg

C++ makefile with MySQL -

i trying build c++ code under linux. first attempt (otherwise, use windows). code using mysql c api library, have problem building it. got output while trying build mainprogram g++ -lstdc++ -c mainprogram.cpp `mysql_config -–libs` -o2 -o mainprogram.obj `mysql_config –-cflags` g++ (gcc) 4.1.2 20080704 (red hat 4.1.2-54) copyright (c) 2006 free software foundation, inc. free software; see source copying conditions. there no warranty; not merchantability or fitness particular purpose. and linking not done, because mainprogram.obj missing my makefile this: cc = g++ cflags = -lm -lstdc++ -wall -o2 mysqlcflags = `mysql_config –-cflags` mysqllibs = `mysql_config -–libs` bin = my_program obj = blockingsocket.obj ftpclient.obj ftpdatatypes.obj ftpfilestatus.obj ftplistparse.obj mystringansi.obj mainprogram.obj .phony: sestav .phony: clean #----------------------------------------- clean: rm -f *.obj #----------------------------------------- ses

Download Files using a For Each Loop -

please keep in mind total noob. not asking code entire project, lost in many cases. , patience appreciated ... my as3 code looks this: var totalfeatureimagedownloads:number = 0; //total file size of feature images, in bytes var totalfeatureimagedownloaded:number = 0; //total downloaded of feature images, in bytes each(var featureimage:xml in xml.featureimages.imgurl) { trace(featureimage); var featureimagerequest:urlrequest = new urlrequest(featureimage); var featureimageloader:urlloader = new urlloader(featureimagerequest); totalfeatureimagedownloads = totalfeatureimagedownloads + featureimageloader.bytestotal; trace(featureimageloader.bytestotal); } currently have 3 images in xml file, , url's traced properly. however, bytestotal equals 0. also, know loop creates 3 identically named urlrequest's , 3 identically named urlloaders. need create 3 differently named ones. i images downloaded simultaneously, , need calculate combined file size three,

android.content.res.resources$notfoundexception string resource id #0x0 -

i getting error when m trying list of data table calling constructor class, main file account.java try{ list<personalinformation> temp = helper.findall(); toast.maketext(getapplicationcontext(), temp.size(), toast.length_long).show(); } catch (exception e) { toast.maketext(getapplicationcontext(), e+"", toast.length_long).show(); } change toast.maketext(getapplicationcontext(), temp.size(), toast.length_long).show(); to toast.maketext(getapplicationcontext(), string.valueof(temp.size()), toast.length_long).show();

Declarative interpretation of Bubble Sort algorithm in Prolog -

i have doubt how work following implementation of bubblesort algorithm in prolog. i have clear how bubblesort algorithm work doubt related prolog first order logic , declarative interpretation. this code: bubblesort(list, sortedlist) :- swap(list, list1), !, bubblesort(list1, sortedlist). bubblesort(sortedlist, sortedlist). /* swap predicate swap 2 element if x come after y in lexicographical order */ swap([x,y|tail], [y,x|tail]) :- x @> y. /* if not true x come after y in lexicographical order let head in original position , call swap predicate on sublist */ swap([z|tail], [z|tail1]) :- swap(tail, tail1). so have doubt declarative interpretation of program: the core of program bubblesort/2 predicate perform scansion of list in performed eventual swap of adjacent elements. so swap/2 predicate work procedural if: 1) if first element in sublist (x) follow second element in sublist (y) in lexicog

python - How to Connect My Django App with incoming data on a TCP Port -

i trying connect django url incoming data on tcp/ip port. great if someone, shed light on this you'll have listen on port process, or thread. save incoming data somewhere, whether log file, database, or whatever. have django use data when prepares web page send in response requests on url.

flex - Stop Flash Builder parsing XML file -

Image
i'm editing xml file in flash builder 4.6, xml contains config data , embedded application. flash builder shows long list of errors, errors linked project not file. the errors things " 1086: syntax error: expecting semicolon " , " 1093: syntax error " shows file not valid actionscript. they this, error on line 1: is there way can stop parsing of file, it's asset , not supposed parsed. there several compiler params can pass when compiling appliation, following link can visit - http://livedocs.adobe.com/flex/3/html/help.html?content=anttasks_4.html . on given link defined can provide config file link follows - <mxmlc ... > <load-config filename="${flex_home}/frameworks/flex-config.xml"/> <source-path path-element="${flex_home}/frameworks"/> </mxmlc>

Cherokee web server with PHP can't connect to MSSQL -

i have cherokee web server , need make work php , sql server database. i've installed freetds , php5-sybase. te problem cherokee doesn't load mssql.so module. loads every other module has odbc.so, pdo.so, pdo_dblib.so,pdo_odbc.so, suhosin.so no mssql.so. i try connect php cli , connects ok. tried install apache in port , works , connect ok sql server. cherokee return "call undefined function mssql_connect()" on cherokee.error log, because module haven't been loaded. phpinfo() doesn't show mssql module load. if cherokee experience can me i'll gratufull. supose in way can add manualy module cherokee. cheers.

ruby on rails - PostgreSQL full-text search: how do i scope it? -

mostly based on railscasts screencasts, #341. i'm trying use postgresql full text search, , works, need scope it. search should go through objects object.state=='saved' . in screencasts method search defined class method, can't use 'where' because 'where' returns array, , search method class method, error here. tried change way: def test_search(query) if query.present? self.where("title @@ :q or text_for_test @@ :q", q:query) else scoped end end to: @tests=test.where(:state=>'saved') @tests.test_search(params[:query]) but rails throws undefined method error. what else can scope search? or how fix error of attempt? use textacular gem gives full-text search postgres. you can use "basic_search" function given textacular similar how use named scopes. test.basic_search('sonic').where(:status => 'saved') test.where(:status => 'saved').basic_search('sonic&#

android - Troubles while importing HoloEverywhere -

Image
i'm following guide: https://stackoverflow.com/a/10888882/1943607 follow steps below add holoeverywhere download zip github computer unzip folder go eclipse , choose file->new-> android project select create project existing source , browse holoeverywherelib folder inside extracted folder press finish right click on newly created project , go properties. under android heading, should see section library checkbox islibrary. make sure that's checked , press add , added library actionbarsherlock. i unzipped folder. went eclipse -> right click -> import -> android -> existing android code workspace. select unzipped folder , it's showing this: when click finish: and if create new project, , try import it, cant find library; type org. , isn't showing rest (org.holoeverywhere.app.***activity). (like github says https://github.com/prototik/holoeverywhere#how-to-use-maven ) can me out? edit: i've tried remove

Android spacing two fragments on same screen -

i have activity displays 2 fragments on screen, 1 under other. top fragment user interface activity , second custom listview. have 2 fragments can fill top slot, each different size. listview used both. the problem i'm facing there major gap between top , bottom fragments. know has layout_weight attribute, , layout_weight way i've seen control how of screen fragment commands. what find out if there way dynamically resize reserved fragment area when fragment loaded, or if i'm stuck ugly gap. here layout: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <tabhost android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent" >

Create an RGBA image in C++ -

i have matrix of 640x480x4 values, i.e. 640x480 pixels each 4 channels (rgba). want create png file shows transparency. have tried using opencv, apparently transparency not supported. quickest , easiest way can this, need save few images? as other said, can't write png image file in c++ without using external library. libpng smallest , portable solution, official png reference library , used of image library write , read png files. it's easy use c library may not best solution c++ novice. exemple of writing png image libpng : file *fp = fopen("file.png", "wb"); png_structp png_ptr = png_create_write_struct(png_libpng_ver_string, 0, 0, 0); png_infop info_ptr = png_create_info_struct(png_ptr); png_init_io(png_ptr, fp); /* write header */ png_set_ihdr(png_ptr, info_ptr, width, height, bit_depth, color_type, png_interlace_none, png_compression_type_base, png_filter_type_base); png_write_info(png_ptr, info_ptr); /* write bytes */ p

perl - Can't locate loadable object for module DBD::Oracle in @INC : Cygwin -

i using cygwin on windows compile perl modules. able install perl dbi through cpan later installed dbd , aslo said installed. cpan[1]> install dbd::oracle going read '/home/e1sched/.cpan/metadata' database generated on wed, 24 apr 2013 12:08:01 gmt dbd::oracle date (1.60). now when execute script, getting error below. $ ./invpayhistload.sh 5 50000 thu, apr 25, 2013 5:53:31 begin batch process ppid 7580 install_driver(oracle) failed: can't locate loadable object module dbd::oracle in @inc (@inc contains: /usr/lib/perl5/site_perl/5.14/i686-cygwin-threads-64int /usr/lib/perl5/site_perl/5.14 /usr/lib/perl5/vendor_perl/5.14/i686-cygwin-threads-64int /usr/lib/perl5/vendor_perl/5.14 /usr/lib/perl5/5.14/i686-cygwin-threads-64int /usr/lib/perl5/5.14 /usr/lib/perl5/site_perl/5.10 /usr/lib/perl5/vendor_perl/5.10 /usr/lib/perl5/site_perl/5.8 .) @ (eval 3) line 3 compilation failed in require @ (eval 3) line 3. perhaps module dbd::oracle

php - How can I secure this user cookie? -

so i've user login network , creates cookie upon login. need know how secure because @ moment can edit cookie , give me access username update loggedin cookie to. existing code: <? $username = $_request['username']; $goto = $_request['goto']; $expdate = time() + 864000; setcookie('loggedin',"$username",$expdate, "/"); echo "<meta http-equiv=refresh content=\"0; url='/$goto.html'\">"; ?> any appreciated! thank you! i'm new cookies , php in general. in php, setting arguments cookies done through optional arguments on “setcookie” function: setcookie( name, value, expire, path, domain, secure, httponly); // open setcookie( 'username', 'bob', 0, '/', '.example', false, false); // locked down setcookie( 'username', 'bob', 0, '/forums', 'www.example.com', isset($_server["https"]), true);

ios - Crash in -[AVPlayerItem _attachToPlayer:] An AVPlayerItem cannot be associated with more than one instance of AVPlayer -

i got crash affecting 10% of users, yet i'm unable reproduce it, , don't know when happens. crashlytics reports half of crashing users having app not in focus, i.e. doing background audio or airplay. app plays hls video stream, , switches audio version when backgrounded. any ideas what's wrong, or why there multiple avplayer instances singleton player class? thanks! exception type: nsinvalidargumentexception reason: avplayeritem cannot associated more 1 instance of avplayer fatal exception latest crash: 4/06/2013 @ 8:48:46 utc+0200 0 corefoundation __exceptionpreprocess + 162 1 libobjc.a.dylib objc_exception_throw + 30 2 avfoundation -[avplayeritem _attachtoplayer:] + 188 3 avfoundation -[avplayer _attachitem:andperformoperation:withobject:] + 336 4 avfoundation -[avplayer _insertitem:afteritem:] + 26 5 avfoundation -[avqueueplayer insertitem:afteritem:] + 136 6 mediaplayer __block_global_4 + 520 7 ... libdispatch.dylib _dispatch_cal

Cocos2d + UIViewController switch -

its game cocos2d 2.1 beta. i used seperate viewcontroller comes when pressing button. when fast switch between these 2 time game hangs...not crash..fps label works. stopanimation.. what's wrong code? how can avoid hang? when fast switched. -(void)shownativeview { uiviewcontroller *controller = [[uiviewcontroller alloc] init]; appcontroller *app = (appcontroller*) [[uiapplication sharedapplication] delegate]; [[app navcontroller] presentmodalviewcontroller:controller animated:no]; [uiview animatewithduration:1.0 animations:^{controller.view.alpha = 1.0;}]; [controller release]; } -(void)gotogameagain { appcontroller *app = (appcontroller*) [[uiapplication sharedapplication] delegate]; [app navcontroller].modaltransitionstyle = uimodaltransitionstylecrossdissolve; [[app navcontroller] dismissmodalviewcontrolleranimated:yes]; } do need initiate uiviewcontroller when button clicked? may better if initiate once

php - Don't save a message in "sent mail" if sent via Gmail -

with symfony2 easy configure gmail smtp provider. great feature sent messages stored in "sent mail" folder. but emails not desirable store them, "forgot password" emails. can't find trace in documentation not storing message in "sent mail" folder. http://symfony.com/doc/master/cookbook/email/gmail.html i think gmail specific behavior, because swiftmailer (the mailer bundle in symfony) uses smtp send emails , smtp sending mails , not storing them. the task store sent email in sent folder (locally or in imap folder) job of mua (mail user agent, email client) , not of server. yeah, google own things.

javascript - How to keep z-index in canvas when updating images via select box -

i'm building poker table maker works follows: when page loads, load components of poker table one-by-one. final users select kind of felt, armrest, body or cup holders want on poker tables through select box. when change detected in select box, src attribute of image object changes well. example: if user wants black felt, i'm loading image: felts/black.png; if decides looks better in blue, page loads image felts/blue.png my problem following: as change 1 element of poker table, new image automatically loaded on top of rest . for example: if change felt color, felt's image go on top of armrest's image. i'd know how force felt image maintain z-index sort of thing. here's code: var tablebody = new image(); tablebody.onload = function() { context.drawimage(tablebody, 0, 0); }; tablebody.src = "http://www.mcptables.com/images/buildyourtable/body/autumn-oak.png"; /* , same thing other parts of poker table... tablearmrest, table

java - Create a New Page During Text to PDF conversion Using Itext -

i converting text file pdf using itext. conversion works fine need during conversion if bufferedreader encounters text, new pdf page started. have tried new page not started when text encountered. sample code below(just relevant part). document output = new document(pagesize.b3); fileinputstream fs = new fileinputstream("c:/abc statements final/file.txt"); fileoutputstream file = new fileoutputstream(new file("c:/pdf statements/file.pdf")); bufferedreader br = new bufferedreader(new inputstreamreader(fs)); pdfwriter writer = pdfwriter.getinstance(output, file); output.open(); writer.open(); ............................. string pageend = "page total"; string trimmedend = br.readline().trim(); if (trimmedend.startswith(pageend)) { output.newpage(); } maybe need change if -statement this: string pageend = "page total"; ... if (trimmed

java - onTouchListener with ViewFlipper doesn't work immediately -

i have created activity using scrollview. inside scrollview have created linearlayout viewflipper of 2 children layouts , have set viewflipper "invisible". before viewflipper have 2 buttons , want set application load right child of viewflipper depending on button user pressed. viewflipper's children layouts buttons. made them add id in array when pressed , want let them in pressed status until user press them again in order release them. have done it, have faced 2 problems: 1) when pressing button, viewflipper draws relative layout, ontouchlistener doesn't work until press other button , viewflipper draw other layout. looks working correctly when changing layouts. know how make work instantly without switching between layouts? 2) ontouchlistener doesn't work totally right. mean, want set button.setpressed(true) or false if has been set true, looks random if work correctly. sometimes, press button , nothing happens , after few seconds try again , works fi

file - Write data to disk in Python as a background process -

i have program in python following: for j in xrange(200): # 1) compute bunch of data # 2) write data disk 1) takes 2-5 minutes 2) takes ~1 minute note there data keep in memory. ideally write data disk in way avoids idling cpu. possible in python? thanks! you try using multiple processes this: import multiprocessing mp def compute(j): # compute bunch of data return data def write(data): # write data disk if __name__ == '__main__': pool = mp.pool() j in xrange(200): pool.apply_async(compute, args=(j, ), callback=write) pool.close() pool.join() pool = mp.pool() create pool of worker processes. default, number of workers equals number of cpu cores machine has. each pool.apply_async call queues task run worker in pool of worker processes. when worker available, runs compute(j) . when worker returns value, data , thread in main process runs callback function write(data) , data being data returned worker.

html - Imported font issue with widths -

Image
@font-face { font-family: 'bryantmedium'; src:url('fonts/bryant-medium-webfont.eot'); src:url('fonts/bryant-medium-webfont.eot?#iefix') format('embedded-opentype'), url('fonts/bryant-medium-webfont.svg#bryantmedium') format('svg'), url('fonts/bryant-medium-webfont.ttf') format('truetype'); font-weight: normal; font-style: normal; } this how import fonts, , here sample div: <div id="info"> <span id="name">username</span> on <span id="date">24 nov 2013</span> </div> here how looks in end: for reason, when page reloaded, not happen sometimes. of times, happens. not happen when use google fonts. so i'm wondering going wrong here? think there issue page resources being loaded (fonts in case) either way should not happening... ideas?

sql - How do I query a columns data type in access 2003? -

i looking way data type of column given table in , name of column. have seen other answers refer msysimexcolumns table access database not have table. using access 2003 if helps any. i result lua code hash table before inserts or lookups can data type of column. it's can determine if field needs quotes around or not. luasql being used access access database. any or direction appreciated the luasql cursor object documentation here suggests should able use cur:getcoltypes() to return "a list (table) of column types".

microcontroller - Arduino Leonardo OR Uno for a pototype solenoid project ?? -

i software developer no prior experience in embedded programming. have develop prototype project:(example) generate morse code pulses output through solenoid in form of vibrations. found either arduino nano or micro job. though have choosen uno project keeping in view later requiremenst evolve. i found leonardo & uno 2 close varianst. selected uno based on research did. learned leonardo not choice beginners due of problems and/or features. uno has more available being seasoned variant. it nice if can have opinion it. as , keshav saharia said, assuming capabilities of uno , leonardo both meet needs, reason choose uno because older, more mature, , better supported. example, of arduino posts here , on ee.se either based on uno or compatible uno. likewise, of arduino guides work out-of-the-box uno, not leonardo; leonardo 1 of footnotes: if have leonardo, need this other thing instead. also, if, @ point, decide ditch arduino , use bare atmega chip, atmega328

python - Assigning name to lines read from a file -

i reading file line line (32 lines in binary) storing in variable named regfile[i] . have assign name each line r0 in variable regfile[i]= 000000001000000000000 how can assign each line in regfile[i] ?? here piece of code. def regread(filename): file = open (filename, 'r') regline = file.readlines() reg= regline reg= map(lambda s: s.strip(), reg) in range(0,32): regfile[i] = int(reg[i]) 'r'i = regfile[i] print 'r' ,i file.close() i don't see why want name variable - index regfile ... following pythonic way of writing have (using islice make sure @ 32 lines read , int(line, 2) convert binary integer)... from itertools import islice open('somefile') fin: reg_file = [int(line, 2) line in islice(fin, 32)] print reg_file[0], reg_file[31] as @mgilson points out - if wanted put them in dict : reg_file = {'r{}'.format(idx):int(line, 2) idx, l

winapi - How to prevent another app from moving (MS Excel 2010) in C# -

i need app open excel 2010 , position in specific area of application. need excel unresizable, unmovable , eliminate menu interactions (close, maximize, minimize) i've found solution everything, apart making unmovable. tried use setwindowpos , set swp_nomove flag , few other flags got no success @ all. --specifications: i'm using wpf c#.net 4.0 , ms excel 2010. --below method i've come with. work expected apart setwindowpos (it doesn't have effect @ all) public static void startexcel(string p_processarguments, int p_x, int p_y, int p_height, int p_width, bool p_startmin = true, bool p_setforeground = true, bool p_useshell = true, bool p_waitinput = true, bool p_setnewstyles = true, bool p_removemenu = true) { //make sure there no excel opened (kill them - if any) closeallexcelprocesses(true); //make basic validations , required info. if (!vali

Expression matching Ocaml -

my question simple: how translate c code : if (x == y + 1) // code else if (x == y - 1) // code else if (x == y + 2) .... basically thinking of using pattern matching seemed appropriate. unfortunatly pattern doesn't work: match x | y + 1 -> code | y - 1 -> code | y + 2 -> code | _ -> code the compiler doesn't seem happy , have found out, expressions on pattenr matching did not tolerated. therefore tried putting them in values thusly: let v1 = y + 1 in let v2 = y - 1 in let v3 = y + 2 in match x | v1 -> code | v2 -> code | v3 -> code | _ -> code unfortunatly warnings saying values v1 v2 , v3 unused , the match cases use them unused too. how can match expression other expressions? thanks actually, c code valid ocaml code. if x = y + 1 (* code *) else if x = y - 1 (* code *) else if x = y + 2 .... pattern matching not replacement if then , has completly different purpose. ocaml allows construct types such type

toggleClass in jQuery -

i cant toggleclass work, here's jsfiddle: http://jsfiddle.net/edddotcom/v6vhx/ clicking on image supposed make text change colour removing .mid class not doing @ moment. here's javascript: $(document).ready(function(){ $("#image").click(function(){ $("p").toggleclass(".mid"); }); }); and html <div class="container"> <div class="row"> <p>hello</p> <p class="mid">hello</p> <img id="image" src="http://icons.iconarchive.com/icons/artua/mac/512/earth-icon.png"/> </div> </div> the css saying .mid class red text, if need see jsfiddle, what missing/doing wrong? with toggleclass, leading dot before class name not required. $("p").toggleclass("mid");

scala - Recursive set union: how does it work really? -

i taking scala course on coursera on free time after work, in attempt give try functional programming. working on assignment supposed "calculate" union of 2 sets contain object. intentionally omitting details it's not important trying ask here. relevant, however, sets defined binary trees, each node containing element, , 2 subtrees. that being case; example union in lecture follows: def union(other:btset) :btset = ((left union right) union other) incl element question1: quite frankly, after having read relevant faq , other forum threads, still don't understand how , why function works. there absolutely no "action" done here in union implementation besides adding (the incl call) element @ head node, calls on , on again. appreciative of explanation... question2: course forum contains many posts stating solution not efficient @ all, , not enough. seeing don't understand how works begin don't understand why it's not enough. please n

reporting services - Convert Crystal Reports formula to SSRS expression -

if {field_a} = 0 0 else (({field_b} / {field_a})*100) i trying convert formula ssrs expression. have tried many different =iff statements, cannot seem run correctly. almost duplicate question: if search here #error ssrs iif you'll plenty of results, such does iif function compute both paths in ssrs or short-circuited? rewriting statement straightforward then: =iif( fields!field_a.value = 0, 0, fields!field_b.value / iif( fields!field_a.value = 0, 1, fields!field_a.value) * 100 )

c# - GridView Table 1 related to Table 2 -

Image
sorry know title confusing couldn't figure out put down. basically created grid view queries database , displays data. works perfectly, no complain, have right is, but want is, question: not sure how can this, can point me out in right direction please ? i think going use nested gridviews. try change select query below... expected result ... sql fiddle : http://www.sqlfiddle.com/#!3/00b5f/15 i have named table fruits select cratetitle,cratedescription,crateid, stuff( ( select ','+ [fruittitle] fruits crateid = t.crateid xml path('') ),1,1,'') types_of_fruits_in_crate (select distinct cratetitle,cratedescription,crateid fruits )t or create proc *place query in proc* *call proc* *assign result set gridview* you can assign stored proc result set gridview using below code : datatable dt = new datatable(); sqlconnection connection = new sqlconnection("your connection string");

AES encrypt C# decrypt Java? -

i'm trying decrypt c# encrypted data in java without success. i'm using 128 bit key&block size pkcs7 padding. here's c# code: public byte[] encrypt(byte[] data, byte[] key) { using (var ms = new memorystream()) { using (var aes = rijndaelmanaged.create()) { aes.key = key; aes.iv = key; var stream = new cryptostream(ms, aes.createencryptor(aes.key, aes.iv), cryptostreammode.write); stream.write(data, 0, data.length); stream.flushfinalblock(); return ms.toarray(); } } } and java code: private static key generatekey() throws exception { key key = new secretkeyspec(files.readallbytes(paths.get("d:/temp/cr.key")), "aes"); return key; } public static byte[] decrypt(byte[] encrypteddata) throws exception { key key = generatekey(); cipher c = cipher.getinstance(&q

php - How to join multiple tables faster -

i'm dealing old structure , bad design database loose , complicated. sadly, have it. :( the old method used php query each info table. re-coded join. big problem occured. takes minute query these info (sometimes more). here's code: select *, car_db.id cid, tbl_province.province_name prov_name, config_car_color.color_title clr_title, config_car_color.description clr_desc, car_viewer.vwr_id viewers car_db inner join tbl_province on tbl_province.province_code=car_db.prov inner join config_car_color on config_car_color.id=car_db.color inner join car_viewer on car_viewer.vwr_cid=car_db.id car_db.tid='$_tid' from latest query of code took 3.37 secs. takes @ least 30 secs run code. the question please suggest me best way process these lines faster. create following indexes: car_db (tid) tbl_province (province_code) -- might pk config_car_color (id) -- might pk car_viewer (vwr_cid)

Convert unicode cyrillic symbols to string in python -

this question has answer here: unicodeencodeerror: 'ascii' codec can't encode character 12 answers when try convert unicode: a = u"Тест" to string: str(a) i got error: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128) i need str(a) give me output: >> str(a) >> 'Тест' pick encoding can encode cyrillic symbols, such utf-8: >>> = u'Тест' >>> a.encode('utf-8') '\xd0\xa2\xd0\xb5\xd1\x81\xd1\x82' the ascii table doesn't have code points cyrillic characters, need specify encoding explicitly. but if want print string, should care encoding of terminal , system font.

vb.net - provider: SQL Network Interfaces, error: 25 - Connection string is not valid -

i developed application on local computer using vs2012 , sql 2008r2. trying move onto production server. virtual server 2012 sql server. checked properties remote connection , enabled. application opens login screen , once enter username , password (this created on computer using wsat. error: network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: sql network interfaces, error: 25 - connection string not valid) have in web.config: <connectionstrings> <remove name="localsqlserver" /> <add connectionstring="server=\\events;database=digital signage;integrated security=true" name="dsconnectionstring" /> <add connectionstring="data source=\\events;integrated security=sspi;attachdbfilename=c:\\ds\aspnetdb.mdf;user instance=true" name="localsqlserver&q