Posts

Showing posts from February, 2012

javascript - Sorting Slickgrid by Multiple Columns? -

i started testing out slickgrid project i'm working on , i'm impressed performance. 1 requirement have sorting on multiple columns. don't have head wrapped around dataview in slickgrid, maybe i'm missing obvious, there way sort grid on multiple columns? if ui can't handle sorting more one, able call function columns in order, plus ascending or descending. able datatables , doesn't have grouping (another requirement project). in worst case, resort doing sorting on server , serving content client statically sorted. you can chain sort comparers multiple column sorting. instead of doing function compareroncol1(a, b) { return a["col1"] - b["col1"]; } function compareroncol2(a, b) { return a["col2"] - b["col2"]; } you can do // sort col1, col2 function combinedcomparer(a, b) { return compareroncol1(a, b) || compareroncol2(a, b); // etc. } or implement inline. as far reflecting sort order in ui,

objective c - Custom MKAnnotation always says it's an MKUserLocation class -

i have custom class called device implements mkannotation protocol. in examples i'm following (mapkit , core location on ipad o'reilly media), check if annotation want add mkuserlocation class , return nil if is. understand does, problem device class identified mkuserlocation returns nil never annotations added map. i've gone on code again , again , again. i've o'reilly code samples , can't see i'm going off. it's frustrating. here's device.m : @implementation device @synthesize udid, user, latitude, longitude; - (cllocationcoordinate2d)coordinate { cllocationcoordinate2d internalcoordinate; internalcoordinate.latitude = [self.latitude doublevalue]; internalcoordinate.longitude = [self.longitude doublevalue]; return internalcoordinate; } - (nsstring *)title { return self.user; } - (nsstring *)subtitle { return nil; } - (id)initwithudid:(nsstring *)_udid user:(nsstring *)_user latitude:(nsnumber *)_latitude

c# - How to find the number of occurrences of a string within a huge string like a big book -

i asked question during c# interview session: how efficiently find number of occurrences of word within huge text big book (the bible, dictionary, etc). i wondering efficient data structure store contents of book in. dirtiest soultion think of store in stringbuilder , find count of substrings, sure there has better way this. and reasonably sized string there multiple ways of doing using substring, regular expressions, etc humongous string efficient way. update: looking this: assuming there text file, lets again bible, of size 20 mb, , want find number of times word "jesus" occurs in text, other loading entire 20 mb string or stringbuilder , using substring or regex find match count, there other data structure used store entire text contents. actual search can accomplished in multiple ways, looking efficient "data structure" temporary storage. assuming dont care substrings, full words, use hashtable. can built in linear time , size proportional

image - How is HDR data stored? -

i wondering data structure behind storing images hdr data. understand how regular images (rgba) , cubemaps stored. doubt simple storing multiple images @ different exposures inside same file. you've moved on long ago, thought worth posting references else happened upon question. here old reference radiance .pic (now .hdr) file format. useful info starts @ bottom of page 29. http://radsite.lbl.gov/radiance/refer/filefmts.pdf excerpt: the basic idea store 1-byte mantissa each of 3 primaries, , common 1-byte exponent. accuracy of these values on order of 1% (+/-1 in 200) on dynamic range 10^-38 10^38. and here more recent reference jpeg hdr format: http://www.anyhere.com/gward/papers/cic05.pdf

javascript - what do i need to open this in a popup or new window? -

i'm making bookmarklet website, , have: <a href="javascript:location.href='http://website.com/compartir_link.php?url='+encodeuricomponent(location.href)" >save this</a> wich works fine, problem when try open in new tab: it's when try save: about:blank (in firefox) and want able without loosing current video, that's why thouhgt poput, funcionally target="_blank" work me, any suggestion? thank mucho! pd: link saved bookmark in browser (maybe in other webistes), facebook's bookmarklet/sharer edit after replies have /js/file.js jquery("body").ready(function(){ jquery(".keep_btn").click(function(event) { event.preventdefault(); if(this.href=""){ this.href=document.url; } window.open("http://website.com/api/public/compartir_link.php?url="+this.href,'about keep', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=450,h

passwords - Developing Rainbow Tables -

i working on parallel computing project trying crack passwords using rainbow tables. the first step have thought of implement small version of cracks password of lengths 5 or 6 (only numeric passwords begin with). begin with, have questions configuration settings. 1 - should size should start with. first guess is, start table 1000 initial, final pair. size start with? 2- number of chains - got no information online should size of chain 3 - reduction function - if can give me information how should go building one. also, if has information or example, helpful. there wealth of rainbow tables available online. calculating rainbow tables moves computation burden when attack being run, pre-computation. http://www.freerainbowtables.com/en/tables/ http://www.renderlab.net/projects/wpa-tables/ http://ophcrack.sourceforge.net/tables.php http://www.codinghorror.com/blog/2007/09/rainbow-hash-cracking.html

accessibility - Are there any text-only CAPTCHA systems available? -

for niche reasons find text-only captcha better traditional image/audio solutions. of reasons can think of off top of head: text-based browser support(lynx, links, etc) to provide write-capable public apis, prevent massive amount of spam for accessibility reasons (i've heard audio versions hard understand prevent voice-recognition software attacks) are there text-only captcha systems available out there? all of captchas i've seen don't use images or audio involve sort of cognition: what day of week tomorrow? who host of last week's snl? what 2 + 3 plus four?

android - problem with intent - onClick compared to a onListItemClick -

i'm using following intent pass on next screen shows user information can edited , saved.......this works good @override protected void onlistitemclick(listview l, view v, int position, long id) { super.onlistitemclick(l, v, position, id); intent = new intent(this, contact.class); i.putextra(notesdbadapter.key_rowid, id); startactivityforresult(i, activity_edit); } however on contact screen have button , use following go admin screen can edit , save other information, when click button screen goes black , terminates. public void onclick(view v) { string id = null; switch (v.getid()) { case r.id.admin: // dostuff intent = new intent(this, admin.class); i.putextra(notesdbadapter.key_rowid, id); startactivity(i); break; i'm sure key_rowid problem , needs recoded work onclick compared onlistitemclick....... tryed alot no luck, great. i think problem in first example view passed in container row , in second example it's but

"Navigate Up" issues in sharepoint 2010 -

if on page http://mysite.com/first/second/third/wiki/pages/home.aspx and click navigate button can see following hierarchy (whis correct): home - first - second - third - wiki but if navigate 1 step http://mysite.com/first/second/third/sitepages/home.aspx and click navigate button again first subsite not showing up. home - second - third - home i set navigation settings identical on both sites still same issue/error. how can fix this? cheers a few things can try.... in masterpage / page layout, find sitemappath control. has property called parentlevelsdisplayed . if set -1 (the default) should show parent sites in breadcrumb. also, make sure sitemapprovider same both controls on both pages. in /second subsite, check whether or not global navigation set inherit parent. setting affect how breadcrumb displayed, more on [here] . third (and applies publishing sites), open page layout home.aspx page referencing. search placeholdertitlebreadcrumb . lo

ruby on rails - Stubbing Paperclip S3 requests in specs -

i using paperclip , s3 image uploads , trying stub out calls s3 test suite. found thoughtbot post mentions doing a.cover { a.paperclip_fixture('album', 'cover', 'png') } but gives me "wrong number of arguments (4 2)" error. tried switching arguments above array, removes original error, gives error saying "attribute defined: paperclip_fixture". has been able working? also, i'd ideally use local filesystem development environment. there easy way this? are using shoulda? if aren't using shoulda paperclip_fixture method you're using may come somewhere else , behave differently. potentially relevant: https://github.com/thoughtbot/paperclip/blob/master/shoulda_macros/paperclip.rb

android - Generating a .vcf file from Phone Book Contact -

how generate .vcf file phonebook contacts programmatically in android? have @ this: http://code.google.com/p/android-vcard/ it says on wiki page has been taken android sources, actual sdk doesn't include library reason.

Upgrade Windows Azure web role to Server 2008 R2 to use IIS 7.5 -

i launched test website in windows azure weekend single web role. didn't see options specify os use. using server 2008 (iis 7). according this article though, server 2008 r2 web roles available (iis 7.5). want use specific functionality of iis 7.5 - how can upgrade web role use server 2008 r2? just specify osfamily="2" in serviceconfiguration.cscfg .

iphone - Some questions on iOS app sales and number presentation -

justr wondering, how ios download/purchase stats tracked? stats previous day or further (like froma week ago)? how 1 paid apple? involve submitting tax forms or similar? just wondering how apple compares microsoft way handle developer app licesnes respective phones... how show on popular download lists? with wp7 apps don't show on popular download lists until 6 days after app has been released , until it's on 'new' list, don't download stats apps until 6 days after it's released , stats 6 days ago , before. have sign tax information , other similar things microsoft (bunch of strange irs tax forms need filled in , sent in). thanks input! you sign contract online, , submit banking info. paid "within 45 days of month end" though see payments within 30 days. payments go through when have $100 (or $150 forget) in credit particular country. means countries don't sell lot have rolling credit months on end. edit: apparently isn't c

Uninstalling plugins/features does not remove files under eclipse 3.5 -

i using eclipse 3.5. understand eclipse platform defined plugins present under eco system. however, see plugin details duplicated under workspace ' c:\workspace\.metadata\.plugins ' , installation directory ' c:\eclipse\plugins '. if uninstall plugins (using help > eclipse sdk > installation details ), find actual files not removed. can manually change .metadata directory contents , happy or missing thing? how ensure .metadata\plugins removed when uninstall plugins/features? eclipse pick configuration details from? i have multiple workspaces , workspace not default workspace. have ran uninstall on 1 of workspaces, 1 of plugins effecting platform. metadata entries , plugin directory contents still there, problem resolved. still raises question, can delete files manually? have 1 eclipse installation (not shared one, hence no version conflicts) i have never fiddled <workspace>\.metadata\.plugins , contains properties installed plugins mig

How can I limit variable size in to maximium of 32 KB in Oracle Forms? -

i working oracle forms 6i , want limit size of return value of functions in 32kb. how can ? if you're calling function returns varchar2, it's limited 32,767 bytes. (if want limit less that, you'd add validation code function check return value length, , raise exception if validation fails).

unit conversion - Convert Decimal Degrees or Degree Minutes Seconds to Meters in Java -

i working gis project. right have code convert decimal degrees degree/minute/seconds, don't have idea how convert decimal degree or degree/minutes/seconds meters. can me convert decimal degree or degree/minutes/seconds meters in java? you question might easy, or complicated. can assume spherical earth? if so, might fine basic arc length formula: arc length = degrees * pi * r / 180

iphone - iPad distribution question -

i updated our app universal app iphone , ipad. made changes (classes, nib, targeted device family, icons , on) , worked fine on simulator , iphone/ipad developer devices. submitted app app store , yesterday got 'ready sale'. problem shows iphone version , screenshots in app store , when install app on ipad shows iphone version. have no clue i've make wrong? does know be? need special certificate/provisiong profile or else? found nothing on google that. try check "release" target configuration of build check if target device family field ( targeted_device_family ) set iphone/ipad.

android - Is it possible to have sub-totals with an ExpandalbeListView? -

i'm busy building activity has expandablelistview. i'm doing research @ point on how etc. the thing list there cost field displays amount item worth. each item associated category, that's why have expandablelistview. is possible have last row in group totals record? or have total in group header? if possible, there examples can work from? if isn't possible, there other kind of widgets, views can provide kind of functionality? thanks edit: example of mean, please see below ---category - cats ---- > cat 1 $10 cat 2 $10 cat 3 $10 total $30 ---category - dogs ---- > dog 1 $10 dog 2 $10 dog 3 $10 total $30 ---category - etc ---- > etc 1 $10 etc 2 $10 etc 3 $10 total $30 ------------------------------------- grand total: $90 option have display ---category - cats - total $30---- > cat 1 $10 cat 2 $10 cat 3 $10 ---category - dog

java - Balancing pebbles problem -

i have stumbled upon problem before, balancing problem. program takes in array of integers of size n. program determines if array of integers can split 2 equal parts, sums of integers in each half being equal. ex. 1 2 3 8 10 4 in which, program returns true, meaning can split 2 halves 14 in each i know concerned combinations/permutations , i'm not @ them. i've managed think of brute force method. can solved using other methods? more efficient algorithms maybe? a step step solution helpful. thank much this partition problem can readily seen equivalent subset sum problem , knapsack problem . np-complete, , thought can't appreciably better exhaustive listing of combinations. you can check possible ways readily: each element, it's either in left half or right half.

jquery - get json data in controller action in asp.net mvc -

i have asp.net mvc application. want configure object in jquery , want pass the action of controller . in script using configure data ajax call: var arr=new array(); arr.push(0)=1; arr.push(1)=2; arr.push(2)=3; var peform = { empid: eid, depatrmentid:deptid, empaddress:straddress, empbirthdate:bdate, empaccountsid:arr }; i able values in param here but. when trying this: if(peform!=null) { var json = $.tojson(peform); $.ajax({ url: '/load/savedata', type: 'post', datatype: 'json', data: json, contenttype: 'application/json; charset=utf-8', success: function (data) { } }); } it not calls action in controller. think here : var json = $.tojson(peform); is not work

android - What is ActivityInfo meta data? -

what activityinfo's meta data? bundle bundle = actinfo.metadata; what kind of data bundle contains , how retrieve data bundle if no key pair known? thanks it's whatever meta data specified in activity's manifest. <activity> <meta-data android:name="key" android:value="value" /> <meta-data android:name="key2" android:resource="@string/res" /> </activity> http://developer.android.com/guide/topics/manifest/meta-data-element.html bundle has method called keyset returns set<string> . that, can iterate through data bundle.getstring, getint, getboolean, getfloat. don't think there way know correct/intended data type though.

android - Voice recognition APIs, will Google Voice do this? -

i've got idea android app, want able commands , have application listen out these , perform action. for example, want app sit idle , listen voice, when hears me "start", app start doing until "stop". the idea lay phone down , not have physically touch in order control app. would possible current apis? if ones should into? you can take @ google voice commands. http://www.google.com/mobile/voice-actions/ alternatively, if want customise application, can use google voice service , write activity invoke voice service , return result. check out below link sample application. http://developer.android.com/resources/samples/apidemos/src/com/example/android/apis/app/voicerecognition.html

Updation issue in child table using hibernate -

i have 2 tables, a & b having one-to-many relation. for using list collection inside parent pojo. the code of hbm file of a is: <bag name="uifunrecogniseschooldetaillist" cascade="all"> <key not-null="true" update="false"> <column name="uif_detail_state_code"></column> <column name="uif_detail_district_code"></column> <column name="uif_detail_town_code"></column> <column name="uif_detail_ward_code"></column> </key> <one-to-many class="com.aises.pojo.uifunrecogniseschooldetails"/> </bag> when insert new records in table data inserted without problem using saveorupate() method. when insert same record

apache - Programmatically get path to php -

i'd similar thing how "fork" video conversion process background, in php? : exec("/usr/bin/php ./foo.php > /dev/null 2>&1 &"); // executed in apache however, run on variety of platforms : machine, php compiled in ~/, windows, several prod servers... is there way programmatically "/usr/bin/php" part ? things think of : get current pid, guess executable it in c, first argument path executable, maybe there similar easiest way make sure php cli binary found in $path environment variable, , use php /path/to/foo.php . on unix can use /usr/bin/env php execute first php binary found in $path . won't work in windows. lastly 1 obvious way have location php configurable option, , use user-specified path when appropriate.

mysql - Restore deleted database -

i deleted 2 days of work because though had backup, didn't. need create database scratch , wonder, isn't there built-in backup system, in case of being stupid? it's running on localhost , haven't exported out before. if you've had binary logging enabled, might lucky enough use restore database. note: if ask me 'how know if had binary logging enabled?' pretty means didn't, because it's disabled default.

iphone - how can i know my application is in not working mode? -

i have 1 application in want know in idle mode ? how can know ? in application when go in idle mode want stop 1 java script. or can when no 1 using application long time . - (void)applicationwillresignactive:(uiapplication *)application method called when app goes inactive state.

Embedded Internet Explorer 6 control and HTTP 302 -

we have .net application using webbrowser control. on windows xp sp3 systems internet explorer 6 application not able login web site. control raises navigateerror event error code 302 , displays "navigation canceled" page. we've tried few workarounds , we're begging web site admin change login page use script instead of sending http 302 (we can because application needs able access specific web site). however, have normal solution problem. can suggest solution? goodness, explorer 6 still hasn't died? i had similar problem redirects on explorer 6 few years ago, , problem went away when removed encoding meta tag in head part of html. go figure. in other words, it's due totally unrelated redirect. that's ie6.

Java w/ maven : getting sources from a jar file -

i write gui app , , use image files (gif) icons. when run app in ide - icons appear. when run jar - fail (null pointer exception on resource) the package structure following: code : src/main/java/com/my/app resources : src/main/resources/com/my/app i wrote little example: url url ; url = guiutils.class.getresource("/com/my/app/gui/fading_lines_blue_64x64.gif"); system.out.println("url: " + url); url = guiutils.class.getresource("/resources/com/my/app/gui/fading_lines_blue_64x64.gif"); system.out.println("url: " + url); when ran ide: url: file:/c:/repositories/v8/trunk/myapp/build/com/my/app/gui/fading_lines_blue_64x64.gif url: null when ran jar: url:null url:jar:file:/c:/devenv/projects/viewer/testpicload.jar!/resources/com/cmy/app/gui/fading_lines_blue_64x64.gif i solved , it's not right way it: public static url getresourceurl(string path) { url url = guiutils.

Find the lon/lat from a Google Maps link -

does know how (or if it's possible) long/lat coordinates out of google maps link? lets has planned route on site , sent me link . if decode url can see there 5 markers on route; 'geocode=fcbmdwmd2kf9_w;fxmcdwmdvat-_w;fasudwmdfuf9_w;fzr8dwmdbp39_w;fbz4dwmdnhp-_w' how convert long/lat coords? any appreciated! thanks not sure if exact enough, might worth try. link provided has 2 interesting parameters, namely saddr , daddr . saddr=manor+rd%2fa237 daddr=redford+ave+to%3amollison+dr+to%3agreat+woodcote+park+to%3apeaks+hill where saddr starting point, , daddr seems encode waypoints , of course destination. think feed google directions api . sample request api (with waypoints ): http://maps.googleapis.com/maps/api/directions/json?origin=manor%20rd&destination=peaks%20hill&waypoints=redford%20ave|mollison%20dr|&sensor=false i had leave out "great woodcote park" waypoint, didn't find directions than, leave task citizens (mayb

Amazon EC2 ssh login failure -

i trying login instance on ec2 , have far been unsuccessful. provide output of relevant commands , things i've tried. i've done homework , looked around, still cant explain why unable login. the keypair generated online using amazons aws console , downloaded private file locally. chmod'ed 600. $ ec2-describe-keypairs keypair gsg-keypair bb:ac:f0:5f:5b:c8:24:47:16:a8:93:35:37:1c:b3:c3:84:68:80:e1 $ ec2-run-instances ami-8d18f5e4 -k gsg-keypair instance i-2dcea041 ami-8d18f5e4 pending gsg-keypair 0 m1.small 2011-02-09t10:50:50+0000 us-east-1c aki-a71cf9ce ari-a51cf9cc monitoring-disabled instance-store xen $ ec2-describe instances instance i-2dcea041 ami-8d18f5e4 ec2-75-101-249-242.compute-1.amazonaws.com domu-12-31-39-00-5d-d2.compute-1.internal running gsg-keypair 0 m1.smal2011-02-09t10:50:50+0000 us-east-1c aki-a71cf9ce ari-a51cf9cc monitoring-disabled 75.101.249.242 10.2

How to check real git diff before merging from remote branch? -

i want check real diff between remote branch , local branch. how can that? issuing below command partially works, shows diff of new changes of local branch too. git diff remote/branch from documentation : git diff [--options] <commit>...<commit> [--] [<path>…] this form view changes on branch containing , second <commit> , starting @ common ancestor of both <commit> . "git diff a...b" equivalent "git diff $(git-merge-base b) b". can omit 1 of <commit> , has same effect using head instead. did try this?

perl - Getting command line options and their values -

i want log options , arguments user command after running script. consider command: ./test.pl --ip localhost --id 400154 --class firstgrade ...and many other options , values. desired output this(by using log4perl): debug - ip=>localhost id=>400154 class=>firstgrade i do: use getopt::long; $ip; $id; $class; %h =('ip' => \$ip, 'id' => \$id, 'class' => \$class); getoptions(\%h); $logger->debug(join('=>',%h)); but doesn't work. please help. your code weird combination of 2 distinct features of getopt::long - can either parse options hash or fill individual options variables. possible put part hash , rest variables. this should work: use getopt::long; @options = qw(ip id class); %h = (); getoptions(\%h, map { "$_:s" } @options ) or die "could not parse"; warn map { "$_=>$h{$_} " } keys %h; this variant parsed options put hash. note :s after ea

performance - Reducing the execution time of the code using ICC compiler -

i working on dsp based algorithms involve massive computation. have used gcc library options (-o3, -ftreevectorize...). execution time of whole code 43 ms. run same code using icc compiler there no significant reduction in execution time of code. how can reduce code execution time in icc without modifying existing code? (without using simd/s , asm) if requirements floating-point math not stringent, easiest optimization come icc -fast file.c however, turn on -no-prec-div well, might not want. in case, try passing icc -03 -axsse4.1 -ipo file.c if willing put bit more time compiling, may able substantial speed benefits profiling. icc -03 -axsse4.1 -ipo -prof_gen file.c set generate profile. run code few times, exercising common use case, , recompile using icc -03 -axsse4.1 -ipo -prof_use file.c

javascript - How to get the @htmlDropDownList selected value? -

i have @htmldropdownlist @html.dropdownlist("mylist", new selectlist(model.list, "id", "movie")) in mvc3 view. how can capture selected value of drop down list using javascript , use change contents of view according selected item? to value simple: $('#mylist').val() for second part of question need more info. update how use value? //get url movie description , define id 0, easier replace lateron. var moviedescriptionurl = '@url.action("details", "movies", new { id = 0})'; //get movieid var movieid = $('#mylist').val(); //update div $('#movie-description').load(moviedescriptionurl.replace('0', movieid)); assuming have "details" action return partial view.

iphone - Unable to link UITable delegate to File Owner in IB of xcode -

i facing issue , - i using tabbarcpntroller in application. in there 2 views. both views have tables in that. i able display , populate table in first view try connect delegate of uitable in ib second view , run code, crashes. ps: using same code in first view. kindly me out suggestions, highly grateful thanks in advance!! by looks of question, need uitableview, not uitable, if using, have problems. in header, must define uitableview iboutlet . .h @interface yourviewcontroller : uiviewcontroller <uitableviewdelegate, uitableviewdatasource> { iboutlet uitableview *mytable; } @property (nonatomic, retain) uitableview *mytable; @end once have done this, build (only) code, interface builder see outlet , can connect it.

iphone - Populate a UIImageView from a .plist -

i have .plist references paths .png files ( key value = "maps" ). able add images array using code while loading view: -(void)viewdidload { nsstring *path = [[nsbundle mainbundle] pathforresource:@"countries" oftype:@"plist"]; nsarray *countries = [nsarray arraywithcontentsoffile:path]; nssortdescriptor *descriptor = [[[nssortdescriptor alloc] initwithkey:@"maps" ascending:no] autorelease]; self.sortedcountries = [countries sortedarrayusingdescriptors:[nsarray arraywithobject:descriptor]]; } i able add images tableviewcells using method: -(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {} what trying add these same images instance of uiimageview in new viewcontroller. have viewcontroller set properly, how can pull images array display in uiimageview did uitableviewcells? when selecting row of table following method call- - (nsindexpath *)tableview:(uitableview *

"Object reference not set to an instance of an object"-exception on mobile sharepoint page -

my situation: when try access (custom) masterpage of sharepoint 2010 solution, i'm developing, in mobile view (using microsoft mobile device emulator /w win mobile 6.1/ie6) "object reference not set instance of object" exception without further explanation. error shown directly on page itself. the log on server shows no error(s), , since haven't developed custom mobile sites or webparts yet , normal master-page in ie8 shows no errors literally have not slightest clue what's causing error, , see no mean how debug this... this pretty deadlock me, , gives me serious headaches cause it's first time me work built-in sharepoint mobile-view thing , don't beyond start working. i hope describes problem enough, otherwise i'll try provide further information. (just let me know) i'm aware hard me in special use-case because there no error-source known yet. i'm thankful every answer , comment can point in right direction solve problem and/or s

c# - Printing from a Windows Service -

this question has answer here: printing .net service [closed] 11 answers how can printing document on specific printer windows-service without need of user-interaction? a string, or text-file. maybe crystalreport? thanks. the point not how print windows service or application, if don't want user interaction required have specify print parameters without need show print dialog ( can't because windows service has no access ui ). see here: http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx

scala - base class constructor parameter in trait -

i have base class constructor parameter: abstract class hugeclass(implicit context: contextclass) { ... } because class gets bigger , bigger , subclasses need special behaviour, want refactor trait. however, still need access context in trait. tried this: trait sometrait extends hugeclass { def mymethod = { context.method } } but scala compiler says: not found: value context . how can solve that? parameter context turned private field. fact parameter or member implicit not mean public - implicit within class visible in ( hugeclass ). turn context val : abstract class hugeclass(implicit val context: contextclass) { ... } and work.

c++ - How to make Valgrind debugger step through a program -

good morning, trying use valgrind debugger step through program. my valgrind command line valgrind -tool memcheck --leak-check=full --db-enable=yes ./matchupacurate.exe. i using valgrind-3.5.0 on centos linux release 5.5 gdb version 7,0.1-23.el5_5.2. i enter yes when valgrind asks question attach debugger. then, valgrind debugger returns with: 4428: return new tuple2<int,a>(2, i++, p->next()); when try use gdb step or continue command, valgrind says [new thread 0x410fd10 (lwp 6548] cannot find user-level thread lwp 6551: generic error. when try use valgrind --single-step=yes debugger option on valgrind command-line, valgriind says bad option aborting . could valgrind users show me how step through c++ source code or continue through program? thank you. you can vgdb in 3.7.0 release. release notes: gdb server: valgrind has embedded gdb server. means possible control valgrind run gdb, doing usual things gdb can (single stepping, breakpoints, e

Free API or similar to get Next Earnings Date for stocks -

i looking api or similar can next (upcoming) earnings date stock. have googled , haven't found usable. know of both yahoo , google finance apis, none of them provide next earnings date. many sites, i.e. www.finviz.com (look "earnings" here http://finviz.com/quote.ashx?t=c ) have next earnings date information, no api it. does know can fetch next earnings date? thank :-) i think may have need, it's not free has free trial may sufficient needs: http://www.zacksdata.com/zacks-data-api (disclosure: api managed company)

android - How to fix jagged edges of controls (buttons, autocomplete text)? -

i developing first android application. have created relativelayout 2 buttons , 1 autocomplete text view. 3 controls display correctly on emulator. however, when create apk file , install on samsung galaxy 5, buttons show jagged edges, , top , bottom lines 'sink' bit , text view gets appearance of rounded square brackets on either side horizontal edges sunk half millimeter or so. any in understanding happening , how fix highly appreciated. i'm guessing samsung using own theme in app. can override theme making 1 yourself. this you: http://developer.android.com/guide/topics/ui/themes.html

ruby - How to install plugins on Redmine hosted on Heroku.com -

just pushed redmine heroku platform, though can't backlog-plugin work, works fine locally. i have pushed local database heroku aswwell. heroku's public directory not writable. default redmine assumes/requires so, on start of app server copies static assets plugins (like images, javascripts, css) public/plugin_assets directory. on heroku, fails. , backlogs relies heavily on javascript, it's noticeable. a common work-around copy these assets manually before deploying. can done running config locally once , checking copied assets source control deployed heroku. notice public/plugin_assets included default .gitignore , need remove there obviously.

c# - Maximum number of files that can be stored in a directory for Windows Phone 7? -

what maximum number of files can stored in directory windows phone 7? check post: how many files many files isolated storage?

.net - Can I get EnableUpdate and EnableDelete to work on an EF4 LinqDataSource? -

so started using linq-to-sql 2 years ago, company pushing me switch entity framework v4. don't want l2s vs ef arguments here, please assume cannot switch l2s. anyway, in ol' l2s, i'd define gridview or listview, linqdatasource enableupdate=true, enabledelete=true , enableinsert=true. i'd assign datasourceid of teh gridview or listview id of linqdatasource , bam! instant crud. with ef4 however, seems automatic codeless crud missing. visual studio 2010 design screen, gridview tasks window not show "enable editing" or "enable deleting". these items used appear in l2s apps, , furthermore, when manually add enablex=true properties linqdatasource, error when attempt update: "the data context used linqdatasource 'lds1' must extend datacontext when delete, insert or update operations enabled." so there way make ef4 obey enableupdate/delete/insert commands on linqdatasource? thanks! first of linqdatasource component lin

javascript - What is context in _.each(list, iterator, [context])? -

i new underscore.js. purpose of [context] in _.each() ? how should used? the context parameter sets value of this in iterator function. var someotherarray = ["name","patrick","d","w"]; _.each([1, 2, 3], function(num) { // in here, "this" refers same array "someotherarray" alert( this[num] ); // num value array being iterated // this[num] gets item @ "num" index of // someotherarray. }, someotherarray); working example: http://jsfiddle.net/a6rx4/ it uses number each member of array being iterated item @ index of someotherarray , represented this since passed context parameter. if not set context, this refer window object.

xml - Change Sequence to Choice -

in schema file defined group sequence of possible elements . <group name="argumentgroup"> <sequence> <element name="foo" type="double" /> <element name="bar" type="string" /> <element name="baz" type="integer" /> </sequence> </group> i reference group this: <element name="arguments"> <complextype> <group ref="my:argumentgroup"/> </complextype> </element> is possible reference group @ other point restrict it's choice instead of sequence . position want reuse allow 1 of elements within. <element name="argument" minoccurs="0" maxoccurs="1"> <complextype> <group name="my:argumentgroup"> <! -- somehow change argumentgroup sequence choice here --> </group>

c# - How to synchronize event handlers -

multithreading still on to-do list, title totally wrong :) my object listening serial port, this: class myclass { myopticalscanner _scanner; public myclass() { _scanner = new myopticalscanner(); _scanner.codescanned += codescannedeventhandler; } private void codescannedeventhandler(object sender, codescannedeventargs e) { debug.writeline("threadid: " + thread.currentthread.managedthreadid + " ||| " + e.scannedcode); .... // code, query database, etc... } } the scanner sending ordered data: 001 , 002 , 003 , 004 , 005 , ... if code in codescannedeventhandler takes long process, event raised , got inconsistent ordering. debug.writeline in event handler give me this: threadid: 8 ||| 001 threadid: 9 ||| 002 threadid: 10 ||| 003 threadid: 10 ||| 006 threadid: 8 ||| 004 threadid: 8 ||| 008 threadid: 8 ||| 009 threadid: 8 ||| 010 threadid: 10 ||| 007 threadid: 9 ||| 005 how can assure, eac

java ee - Does weblogic support CDI Beans? -

i started work weblogic 11g version 10.3.2.0 does weblogic support cdi beans ? thanks it doesn't work out of box, apache openwebbeans (the cdi implementation of apache) can weblogic there. jira shows worked on , fixed it. if there's problem, ask them directly. documentation isn't detailed, see respond questions. , myfaces codi lists weblogic compatible server if using openwebbeans, think tested carefully.

.net - How to include an auto generated file in a MsBuild project? -

using msbuild 4.0 included pre-build event generates 1 of project source files. seeks file before generated: error cs1504: source file 'c:\src\data\main.designer.cs' not opened ('unspecified error ') the file generated dbmetal/sqlmetal. there way make work? move action beforebuild target. in project *.csproj default commented. uncomment , call dbmetal using exec task <target name="beforebuild"> <exec command="<your prebuild action 1>"/> <exec command="<your prebuild action 2>"/> </target> if working datasource.db , want generate main.designer.cs can specify input , output parameters target. saves calling dbmetal , rebuilding project itself. <target name="beforebuild" inputs="datasource.db" outputs="main.designer.cs"> <exec command="<your prebuild action 1>"/> <exec command="<y

c++ - Linking problem with wrapper for CLucene -

i'm doing small wrapper clucene. ofxclucene.h #ifndef _ofxclucene_ #define _ofxclucene_ #include "ofmain.h" #include "ofxxmlsettings.h" #include "ofxdirlist.h" #include "clucene.h" using namespace lucene; using namespace lucene::analysis; using namespace lucene::analysis::standard; using namespace lucene::index; using namespace lucene::document; using namespace lucene::queryparser; using namespace lucene::search; using namespace lucene::store; class ofxclucene { private: string name; simpleanalyzer *sanalyzer; directory *dir; indexwriter *writer; indexreader *reader; public: ofxclucene(string name); ~ofxclucene(); void adddocumentsfromdirectory(string pathtodir); void adddocumentxml(ofxxmlsettings *docxml); void indexreader(); void closeindex(); hits* search(string query); }; #endif ofxclucene.cpp #include "ofxclucene.h" //--------------------------------------------------------------

cakephp - Conditional validation -

my hoteladdress model: <?php class hoteladdress extends appmodel { var $name = 'hoteladdress'; var $belongsto = array( 'hotel' => array( 'classname' => 'hotel' ) ); var $validate = array( 'address' => array( 'rule' => 'notempty', ) ); my hotelmodel <?php class hotel extends appmodel { var $name = 'hotel'; var $hasandbelongstomany = array( 'hotelcategory' => array( 'classname' => 'hotelcategory' ) ); var $belongsto = array( 'page' => array( 'classname' => 'page' ) ); var $hasmany = array( 'hoteladdress' => array( 'classname' => 'hoteladdress', 'dependent' => true ), 'hotelphone' => a

cluster computing - jboss clustering GMS, join -

i have jboss 5.1.0. we have configured jboss somehow using clustering, in fact not use clustering while developing or testing. in order launch project have type following: ./run.sh -c -g uniqueclustername -b 0.0.0.0 -djboss.messaging.serverpeerid=1 -djboss.service.binding.set=ports-01 but while jboss starting able see in console: 17:24:45,149 warn [gms] join(172.24.224.7:60519) sent 172.24.224.2:61247 timed out (after 3000 ms), retrying 17:24:48,170 warn [gms] join(172.24.224.7:60519) sent 172.24.224.2:61247 timed out (after 3000 ms), retrying 17:24:51,172 warn [gms] join(172.24.224.7:60519) here 172.24.224.7 local ip though 172.24.224.2 other ip of other developer in our room (and jboss there stoped). so, tries join other node or something. (i'm not familiar how jboss acts in clusters). , result application not starting. what may problem in? how avoid joining ? you can fix specifying -djgroups.udp.ip_ttl=0 in startup. sets ip

c# - How do I loop a SQL parameter list and WHERE clause? Or get results more efficiently? -

what best approach? have c# .net web forms website gathers list of user profiles based on 1 or more tags . site connects sql database , uses stored procedures data retrieval . my first (half-retarded) thought build list of parameters: tag1, tag2, tagn. pass list sp. in sp, build clause looping through parameters. before can loop, how build parameters in sql? it'd nice if pass sp array or list bust apart , build query. however, don't know how - if did, doubt efficiency desirable. i can use commandtype.text , spit out huge query right there in code. doesn't sound efficient either. want keep sql/c# stuff separated possible. site mess , half.. do of have thoughts on this? table valued parameters ideal solution here (assuming on sql server 2008). allow send sets of data sql server (in 2008 , above) , process data set in stored procs (which means can joins on set, use exists perhaps, etc). if not on sql server 2008, have 2 options, first being c

c# - How to handle authorization in an application? -

i have authentication portion of asp.net 3.5 web application complete. know more common authorization patterns. may present current authorization structure: i have database "module" , "operation" tables. modules represent systems in application , operations represent actions 1 able perform within system. customer, order, billing defined module. "operation" related module: customer.add, customer.delete customer operations. each user has role has access operations, depending on role. please note page menus generated based on user's access, , users not see modules , operations not have access to. my questions begin how implement authorization scheme here, possibly using existing pattern or technique. how , when should secure module, , check authorization of user perform operation on said module? i have not implemented yet, here 1 way thought of: user clicks on operation: module: customers | operation: add in click event @ us

ruby on rails - How can I keep a Delayed_Job task from failing with "execution expired" -

i thought since background process, there wouldn't sort of timeout. used delayed_job run reports in background. large, long-running reports failing message. i'm running rails 2.3.5 on apache2 phusion passenger. from delayed_jobs faq wiki page on github : # config/initializers/delayed_job_config.rb delayed::job.destroy_failed_jobs = false silence_warnings delayed::job.const_set("max_attempts", 3) delayed::job.const_set("max_run_time", 5.minutes) end you looking increase max_run_time. default 4 hours, want set 6.hours or longer. should longest think job should take, application / job specific , know longest time that's acceptable is.

algorithm - How to find increasing subsequence of numbers with maximum sum? -

how find increasing subsequence of numbers maximum sum. find o(n^2) want know o(n log n). thanks! i'm assuming: you don't care subsequence length @ all. subsequences don't need contiguous this makes world of difference! solution let optimal set s of increasing subsequences (is) array a set of iss such each s in a have 1 of: s in in s there s' in s such sum(s') >= sum(s) and largest_element(s') <= largest_element(s) the optimal set s can ordered both largest element of subsequences , sum - order should same. mean smallest/largest sequence later. our algorithm must find optimal set of a , return largest sequence. s can calculated by: s := {[]} //contains empty subsequence each element x in a: s_less := (largest sequence in s ends in less x) s := append x s_less s_more := (smallest sequence in s has sum greater s) remove subsequences in s between s_less , s_more (they made obsolete '

load - Why isn't my ExtJS GridPanel paying attention to the limit parameter? -

i have jsonstore: var store = new ext.data.jsonstore({ root: 'data.items', remotesort: false, fields: ['clocktime', 'empid'], proxy: new ext.data.httpproxy({ url: approotpath + 'something/getsomething', method: 'post' })//proxy });//new ext.data.jsonstore i call load on store following: store.load({params:{start: 0, limit: 25}}); i have grid display data in: var grid = new ext.grid.gridpanel({ store: store, title:'employees', stateful: true, id: 'grid', striperows: true, stateid: 'excp_list', bbar: new ext.pagingtoolbar({ store: store, displayinfo: true, prependbuttons: true, emptymsg: "no records display", pagesize: 25 }), viewconfig: { forcefit: true }, columns: [ {header: "emp id", width: 40, dataindex: 'empid&

How to extract a linear slice from an image in OpenCV / EMGU -

Image
i have image , 2 points, , want read pixels between these 2 points, , resample them small 1x40 array. i'm using emgu c# wrapper opencv. thanks, sw emgu cv includes method in image class sampling color along line called sample . refer manual definition. here's link image.sample in version 2.3.0. you still have re-sample/interpolate points in array returned sample end 40 element array. since there number of ways re-sample, i'll suggest other questions that.

C# Linq SQL save List<Point> -

i have class point: class point { public int x { get; set; } public int y { get; set; } public double value { get; set; } } and class chart aggregates cca 1000 points. [table(name = "chart")] class chart { public list<point> points { get; set; } } i want efficiently save points database. don't need operation on top of points. there way how save points in single column? think way should more efficient creating new table 1000000 points. thx look sqlbulkcopy - it's not linq, allows push masses of data sql server more linq would.

How Do I Get By The Basic Authentication Handshake When Using Fiddler To Test A WCF REST Service? -

how basic authentication handshake when using fiddler test wcf rest service? you need base64 encode username:password , prefix basic. end looking like: authorization: basic vefwsvnczgfycmvsog== you enter in request headers field.

security - Is this safe? (PHP download script) -

i have quick question how safe do. have written php force download script , part serves file should pretty familiar: header('content-description: file transfer'); header('content-type: application/force-download'); header('content-length: ' . filesize("user_files/".$temp_actual)); header('content-disposition: attachment; filename="'.$filename."\""); readfile("user_files/".$temp_actual); $filename filename see , $temp_actual real filename on server. there mountain of code above prevent bad things happening basically, users should able download content have uploaded. if upload .php file, don't want running on server, want delivered them via force downoad (and need able upload any file type). it works intended, file extensions being force downloaded, want make absolutely can't run php or html files on server. additional info user_files in website root .htaccess "deny all" every file

c# - sourcecode problem at enum -

goal: assign enum value animaltype object. categories.categorytype animaltype = (categorytype)enum.parse(gettype(categorytype), pcategory); problem: source code not work , gives me 2 error messages: "assignment1.categories.categorytype' 'type' used 'variable'" "no overload method 'gettype' takes 1 arguments" namespace assignment1 { class animalmanager { private list<ianimal> _myanimal = new list<ianimal>(); public void createnewanimal(string pname, string phousing, string page, string pcategory, string panimal, string peater, string pgender) { categories.categorytype animaltype = (categorytype)enum.parse(gettype(categorytype), pcategory); } } } using system; using system.collections.generic; using system.linq; using system.text; namespace assignment1.categories { /// <summary> /// /// </summary> public en

javascript - Animating window scrolling -

hi using following method programmatically scroll web document: window.scrollby(0, delta) the current implementation of scrollby jumps document new position. there way of animating this? using webkit specifically, , jquery (or other javascript framework) not option. thanks in advance. you can animate invoking interval: setinterval(function() { window.scrollby(0, 5); }, 13); this of course on , over, need put in conditional check, when cancel interval. like: var timerid = setinterval(function() { window.scrollby(0, 5); if( window.pageyoffset >= 500 ) clearinterval(timerid); }, 13);

.net - How can I retain connection credentials across calls in System.DirectoryServices? -

i trying connect active directory domain (w2k8r2 dc) in different forest. end, pass credentials following directoryentry constructor: directoryentry(string path, string username, string password, authenticationtypes authenticationtype) this , well. would though retain connection somehow , reuse through calls ad not need pass credentials repeatedly. possible somehow? thanks! if want control @ connection level, recommend use system.directoryservices.protocol . can reuse ldap connection make different ldap queries. however, programming paradigm different directoryentry if need use directoryentry , have store username , password somewhere , pass them directoryentry objects. write method getdirectoryentry(string dn) , have method create directoryentry me correct username , password. doesn't elegant doesn't wrong. if care password being stored in memory in plain text, use securestring store password. this nothing wrong because directoryentry maintaining

Python 2.6 GC appears to cleanup objects, but memory is not released -

i have program written in python 2.6 creates large number of short lived instances (it classic producer-consumer problem). noticed memory usage reported top , pmap seems increase when these instances created , never goes down. concerned python module using might leaking memory isolated problem in code. proceeded reproduce in short example possible. came this: class leaksmemory(list): timesdelcalled = 0 def __del__(self): leaksmemory.timesdelcalled +=1 def leaksomememory(): l = [] in range(0,500000): ml = leaksmemory() ml.append(float(i)) ml.append(float(i*2)) ml.append(float(i*3)) l.append(ml) import gc import os leaksomememory() print("__del__ called " + str(leaksmemory.timesdelcalled) + " times") print(str(gc.collect()) +" objects collected") print("__del__ called " + str(leaksmemory.timesdelcalled) + " times") print(str(os.getpid()) + " : check memory

c# 2.0 - 3DES - Decrypt encrypted text (by JAVA) in C# -

here situation: the encrypted text done in java (which have no java background @ all) the method 3des the padded pkcs#5 base 64 the decryption in c#, , here code: public static string decryptstring(string message, string passphrase) { byte[] results; utf8encoding utf8 = new utf8encoding(); md5cryptoserviceprovider hashprovider = new md5cryptoserviceprovider(); byte[] tdeskey = hashprovider.computehash(utf8.getbytes(passphrase)); tripledescryptoserviceprovider tdesalgorithm = new tripledescryptoserviceprovider(); tdesalgorithm.key = tdeskey; tdesalgorithm.mode = ciphermode.ecb; tdesalgorithm.padding = paddingmode.pkcs7; byte[] datatodecrypt = convert.frombase64string(message); try { icryptotransform decryptor = tdesalgorithm.createdecryptor(); results = decryptor.transformfinalblock(datatodecrypt, 0, datatodecrypt.length); }

silverlight - Running project with debug takes extremely long to load -

for reason, silverlight project in vs2010 started take forever load, upwards of 10min or so. won't ever load far can tell, , hangs on silverlight loading screen blue dots in circle animation. before gets point, painfully spends solid 10 seconds or each symbols file loads. in output i'll get: 'webdev.webserver40.exe' (managed (v4.0.30319)): loaded 'c:\windows\microsoft.net\assembly\gac_msil\system.drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\system.drawing.dll', symbols loaded. then 10 seconds later i'll next one, , there's 50 of them. the weird thing when run project internet disabled, loads extremely quickly. each 1 of symbols loaded statements flies by, , before know i'm looking @ running silverlight project. teammate things might have perforce, how manage our source, , have plugin in visual studio. anyone have ideas causing this? or experienced similar phenomenon once? randomly started yesterday. thanks! edit: i'm using built-in vs se