Posts

Showing posts from April, 2014

objective c - iphone - moving a UIImageView -

i'm having difficulty moving image location after first animation finished. the image animates @ point i've specified, stops (that works fine). move image location , repeat. here's code: -(void) loadtap { nsarray *imagearray = [[nsarray alloc] initwithobjects: [uiimage imagenamed:@"tap1.png"], [uiimage imagenamed:@"tap2.png"], [uiimage imagenamed:@"tap3.png"], [uiimage imagenamed:@"tap4.png"], nil]; tapimage.animationimages = imagearray; tapimage.animationrepeatcount = 1; [imagearray release]; tapimage.animationduration = 1; tapimage.animationrepeatcount = 20; [tapimage star...

c# 4.0 - Exceptions not caught in release build (WinForm desktop app, C#, VS 2010) -

Image
i developed desktop application, it's done still contains bugs i'm eliminating. i use general [try...catch] block wrapped around application [stathread] static void main() { try { program = new program(); // ... } catch (exception x) { // ... messagebox.show( message, resources.messagebox_error_crash_caption, messageboxbuttons.ok, messageboxicon.error); } } my program class constructor being: public program() { // [...] application.enablevisualstyles(); application.setcompatibletextrenderingdefault(false); // [...] frmlogon = new logon(); application.run(frmlogon); } to ensure unhandled exception bubble way stack , @ least responded communicative message box. it works fine when run application under visual studio (debug mode), when deployed , installed on pc, doesn't - that's when bug (which i've identified, way) causes ...

c++ - Rewriting a program without using goto statements -

i had program similar problem using goto statements. asked rewrite our code without using goto statement. don't know how begin doing program. paste in previous program code using goto. // 8 queens problem using 1 dimesional array , goto statement #include "stdafx.h" #include <iostream> using namespace std; int main() { int q[8]; q[0] = 0; int c = 0; int count = 0; nc: //cout << "next column\n" << "column = " << c << endl; c++; if (c == 8) goto print; q[c] = -1; nr: //cout << "next row\n" << "row = " << q[c] << "\ncolumn = " << c << endl; q[c]++; if (q[c] == 8) goto backtrack; for(int = 0; < c; i++){ if(q[i] == q[c] || abs(q[c] - q[i]) == (c - i)) goto nr; } goto nc; backtrack: //cout << "backtrack" << endl; //cout <<"column = ...

BMP decoding in JavaScript and drawing to Explorer Canvas -

i need download bmp javascript , render screen, in internet explorer. first off, yes, know insane, i'm not going why, let's accept moment img src not working because of security constraints, ajax request proper authentication in post pull image. example bypasses security sake of simplicity , proves can render something. the best idea come fetch stream via ajax, decode bitmap, , render canvas. internet explorer doesn't support canvas, luckily google provided wrapper svg called excanvas can use that. my code (drawing code appears work, bmp decoding not much) http://gist.github.com/614328 future support other images besides bmp plausable, , because of how canvas works it's easiest draw pixels in rgba. texture2d wrapper class rgba byte array, plus drawing code. bytestream makes bit easier on eyes dealing byte array, , bitmapdecoder contains method translate bgr format rgba texture2d drawing. is possible bytes getting mis-translated along way or there matt...

function - Flex 4 timers keep Firing -

i'm trying create simple flex4 project involves timers trigger other functions. i don't have experience action script , less timer events. here bit of code seems working part lines i'm adding total score (score = score +1;) seems keep adding , adding when test application. think because timers keep firing function i'm not sure. private var score:int = 0; private function submit():void { this.currentstate = 'loading'; var timer:timer = new timer(2200); timer.addeventlistener(timerevent.timer, removeloading); timer.start(); } private function removeloading(event:timerevent):void{ removeloading.play(); var timer1:timer = new timer(1000); timer1.addeventlistener(timerevent.timer, viewresults); timer1.start(); this.currentstate = 'results'; } private function viewresults(event:timerevent):...

iphone - Core Data, filtering out child entities in result set -

so have typical 1:m relationship: car can have many models i want car objects , model names begin 'a'. i tried subquery: nsfetchrequest *fetchrequest = [[nsfetchrequest alloc] init]; nsentitydescription *entity = [nsentitydescription entityforname:@"car" inmanagedobjectcontext:_context]; [fetchrequest setentity:entity]; nspredicate *predicate = [nspredicate predicatewithformat:@"subquery(models, $model, $model.name beginswith 'a').@count > 0"]; [fetchrequest setpredicate:predicate]; this return car long has model begins 'a'. that's fine, car s returned, returns model s, , want ones start 'a' but seems long operate on higher level entity (car), subquery filters cars , doesn't filter models @ all. what i'm doing filtering models in inner loop (using nspredicate ), i'd rather filtering on sql side. ideas? run fetch against models entity predicate: [nspredicate predicatewithform...

data structures - Understanding Fusion Trees? -

i stumbled across wikipedia page them: fusion tree and read class notes pdfs linked @ bottom, gets hand-wavy data structure , goes lot of detail sketch(x) function. think part of confusion papers trying general, , specific example visualize. is data structure appropriate storing data based on arbitrary 32 or 64 bit integer keys? how differ b-tree? there 1 section says it's b-tree branching factor b = (lg n)^(1/5) . populated tree 32 bit keys, b 2. become binary tree? data structure intended use longer bit-strings keys? my googling didn't turn terribly useful, welcome links on topic. passing curiosity, haven't been willing pay pdfs @ portal.acm.org yet. i've read (just quick pass) seminal paper , seems interesting. answers of questions in first page. you may download paper here hth!

version control - Including pre-compiled libraries in source tree -

i have cross-platform c++ project. in project, use several third-party, statically-compiled libraries quite huge , not easy build. currently, our source tree looks this: | +-3rdparty | +-include (initially empty) | +-lib (initially empty) | +-some-library | +-another-library | +-source when checking out code, developer first build , install "some-library" , "another-library". install step put right files include , lib folders, , can build our project. in order make building our project easier, thinking of removing "some-library" , "another-library", , instead put includes , pre-compiled binaries include , lib folders. way, new developper have checkout project, , build straight away. my questions are: is bad practice so? (ie: including precompiled libraries source tree). what potential problems / drawbacks may arise setup? what folder organization suggest account several platforms (windows, mac osx, , linux)? addition...

cocoa touch - Handling Orientation with Multiple Windows on iPad -

i have ipad application goes between 2 states, 1 using splitview other tableview. currently have single uiwindow object, , switch between views following code -(void) switchtostatea { [viewcontrollerb.view removefromsuperview]; [window addsubview:viewcontrollera.view]; } -(void) switchtostateb { [viewcontrollera.view removefromsuperview]; [window viewcontrollerb.view]; } everything works fine unless change device orientation. after changing orientation , switching states, state not active during change still in frame of old state (leaving black areas @ edge of display). if change orientation again new state fixed. i've tried adding [viewcontrollera.view setneedslayout]; after swapping views did not have effect. how make sure background view controllers orientation callback, or how invoke 'refresh' when switch state? this pure speculation on part, if instead of removing view controller's view window, set view hidden , use exchangesubviewatindex...

c - Trimming a string of Int -

in program want input string of integer e.g 2107900000. want length , want remove 0's , 1's. perhaps not optimal, copy buffer conditionally: char buffer[20]; char num[] = "2107900000"; int j = 0; (int = 0; num[i]; i++) { if (num[i] != '0' && num[i] != '1') { buffer[j] = num[i]; j++; } } buffer[j] = 0 //null terminator or in single buffer: char num[] = "2107900000"; int j = 0; (int = 0; num[i]; i++) { if (num[i] != '0' && num[i] != '1') { num[j] = num[i]; j++; } } num[j] = 0 //null terminator

How to load specific cell of uitableview whileloading view or reloading tableview -

all doing 1 chat application, using uitable view display reply , response user.in case after interval of time reloading tableview fetch new data server. problem after adding new content table view go @ bottom of table view , have scroll table view see one.or in other case whenever reloading table show first cell on view. question "is possible load last cell of uitableview after view gets load or reload table view?" thanks in advance.. [stableview reloadrowsatindexpaths:[nsarray arraywithobject:[nsindexpath indexpathforrow:sender.tag insection:0]] withrowanimation:uitableviewrowanimationnone];

c# - Intercept SOAP messages from and to a web service at the client -

i have client communicates web service. class communicate c# class generated through wsdl.exe. want log incoming , outgoing messages. what i've done far write class inherits automatically generated c# class , have overridden getreaderformessage method. way can access incoming message more or less this: protected override xmlreader getreaderformessage(soapclientmessage message, int buffersize) { system.xml.xmlreader areader = base.getreaderformessage(message, buffersize); system.xml.xmldocument doc = new system.xml.xmldocument(); doc.load(areader); string content = doc.innerxml.tostring(); system.xml.xmlreader areader2 = system.xml.xmlreader.create(new system.io.stringreader(content)); return areader2; } obviously i'm not happy solution, because i'm creating 2 xml readers. 1 read contents of soap message , 1 return method caller. plus can't same getwriterformessage method. but may i'm doing things difficult start with. instance po...

php - Trying to track number of clicks in user's emails -

my issue follow: i'm trying count number of clicks on ads in our newsletter. thing can't include js in emails - it's understandable. found way around writing small piece of code: <script type="text/javascript" src="http://www.factmag.com/wp-content/themes/modularity_/js/jquery-1.3.2.min.js"></script> <script type="text/javascript"> function geturlvars() { var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexof('?') + 1).split('&'); for(var = 0; < hashes.length; i++) { hash = hashes[i].split('='); if($.inarray(hash[0], vars)>-1) { vars[hash[0]]+=","+hash[1]; } else { vars.push(hash[0]); vars[hash[0]] = hash[1]; } } return vars; } func...

The best Linux tool for disassembling C++ executables -

which tool best disassembling c++ executables? i'm looking ollydbg linux. edit: sorry, forgot tell want able debug, too, not see asm code. edit2: "best" mean - "the best windows ollydbg - can see asm code , can debug, it's user friendly , powerful. 1 best linux". here some. luck debugging! ups debugger evan's debugger assembly language debugger (ald) insight data display debugger (ddd) asmbug dissy

regex - php regular expression...weird behavior -

what's wrong in expression? echo preg_replace("/condizioni/","ciao","<tr bla vla condizioni"); it not return anything... anyway works when remove "<" char...but don't understand why...is special char, , if i have match literally. thank you... it work want ( code on ideone ). thing echo "<tr bla vla ciao"; in web page cause troubles. have escape html chars. htmlspecialchars() : echo htmlspecialchars(preg_replace("/condizioni/","ciao","<tr bla vla condizioni")); it echo &lt;tr bla vla ciao .

c# - Image manipulation -

i need easy learn & fast method generating image background image, texts , after saving jpeg format. what can suggest? library or tutorial on this? important criteria simpleness. i using gdi+ . there lots of tutorials on over net, need this: using(image image = new bitmap(width, height)) using (graphics g = graphics.fromimage(image)) { g.draw.... g.draw.... image.save(filename, imageformat.jpeg); } the calls draw.... can draw primitives, images, text , forth. also remember text looks jagged, have methods on graphics object smooth out. in case g.textrenderinghint = textrenderinghint.antialias; there other options make better, if feel jagged. default settings geared more towards performance quality, if want high quality need set yourself. g.smoothingmode set example highquality make round primitives smoother default configuration. it's easy use, , make final image want to, give try!

c# - Don't save embed image that contain into attachements (like signature image) -

i work on vsto in c#. when click on button save attachment in folder. problem : when have rich email image in signature, have element in attachment. don't want save image. outlook (application) hide attachment in area attachment ! why not me :-( my code : mailitem mailitemselected = this.outlookitem; foreach (attachment in mailitemselected.attachments) { a.saveasfile(path + a.filename); } but don't find test don't save image of signature. we had need show "mail attachments" (not embedded ones used rendering) in outlook add - in, , works. if (mailitem.attachments.count > 0) { // attachments foreach (attachment attachment in mailitem.attachments) { var flags = attachment.propertyaccessor.getproperty("http://schemas.microsoft.com/mapi/proptag/0x37140003"); //to ignore embedded attachments - if (flags != 4) { ...

ipad - can't access UIView from UIViewController -

i have problem access view methods uiviewcontroller. started programming in xcode 2 weeks ago , have modify program made other person. the uiview drag , drop in interface builder in .xib of uiviewcontroller , initialized method initwithframe , drawrect. view contains nstimer need stop when user click on button close of navigation bar. so have ibaction in uiviewcontroller activated when button close pressed. , method should launch 1 of uiview's method doesn't work. xcode detects no error or warning code of uiview never ran. when launch application, works fine this. uiview.h: @interface clock3d : uiview { ... nstimer *timer; nstimer *timers; } ... @property (retain, nonatomic) nstimer *timer; @property (retain, nonatomic) nstimer *timers; ... -(void) donetest; @end uiview.m: @implementation clock3d @synthesize timer, timers, ... ... -(void) donetest{ nslog(@"arret timers"); [timers invalidate]...

php - How to scrape websites when cURL and allow_url_fopen is disabled -

i know question regarding php web page scrapers has been asked time , time , using this, discovered simplehtmldom. after working seamlessly on local server, uploaded online server find out wasn't working right. quick @ faq lead me this . i'm using free hosting service edit php.ini settings. using faq's suggestion, tried using curl, find out turned off hosting service. there other simple solutions scrape contents of of web page without use or curl or simplehtmldom? if curl , allow_url_fopen not enabled can try fetch content via fsockopen — open internet or unix domain socket connection in other words, have http requests manually. see example in manual how request. returned content can further processed. if sockets enabled, can use third party lib utilitzing them, instance zend_http_client . on sidenote, check out best methods parse html alternatives simplehtmldom.

jsp - convert UploadFile object to a ZipFile object -

<html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>jsp page</title> </head> <body> <% // decode source request: try { multipartformdatarequest multipartrequest = new multipartformdatarequest(request); // files uploaded: hashtable files = multipartrequest.getfiles(); zipfile userfile = (zipfile)files.get("bootstrap_file"); if (! files.isempty()) { bootstrapdatamanager bdm = new bootstrapdatamanager(userfile); bdm.bootstrapstudent(); bdm.bootstrapcourse(); bdm.bootstrapsection(); bdm.bootstrapbid(); bdm.bootstrapcompletedcourses(); bdm.bootstrapprerequisite(); } } catch (exception error) { // set error flag in session: request.getsession().setattribute("error", error); // throw further print in error-page: throw...

android - Not able to capture images when there is an incoming call? -

i continuously capturing images camera @ interval of 1 min.it working without problem.but when got incoming call,my camera activity goes background , not capturing images.when call finishes m able see activity , images captured without problem. what when incoming call,still camera should capture images. thanks , regards. rohan wagh what when incoming call,still camera should capture images. if problem occurs if "camera activity goes background" other reasons (e.g., open notification leads other activity, press home button), think out of luck. camera preview required capture images, , preview not visible while other activities have foreground (e.g., in-call screen). if problem specific in-call screen, though, cannot explain.

c# - Convert DateTime -

this works: testdatetime = datetime.parseexact("16/10/2010", "dd/mm/yyyy", null); this not: string somedate = "16/10/2010"; testdatetime = datetime.parseexact(somedate, "dd/mm/yyyy", null); why?? both code snippets absolutely equivalent , should work/not work same. suspect value of somedate variable not think inside application. try debugging.

php - Strip Tags short div -

hello have lot of div tags, want delete div tag of characters in little div tag.number of string <10 ex $txt=<<<html <div class="abc"> 123ab</div> <div id="abc"> 123ab</div> <div class="abc"> 123abcdfdfsdfsdfdsfsdfsdfdsf</div> html; and return dig(include long string) $txt=<<<html <div class="abc"> 123abcdfdfsdfsdfdsfsdfsdfdsf</div> html; preg_replace('#<div(?:[^>]*)>.{0,10}</div>#u','',$txt) not tested

asp.net - Which assembly/DLL do I need in inetpub/wwwroot for launching aspx pages? -

what have add c:\inetpub\wwwroot folder serve aspx pages browsers? my webproject in folder think i'm missing running asp.net , asp.net mvc webpages. create virtual directories in iis click start, point programs, click select administrative tools, , click internet services manager. expand server name. in left pane, right-click default web site, point new, , click virtual directory. in first screen of virtual directory creation wizard, type alias, or name, virtual directory (such mywebdata), , click next. in second screen, click browse. locate content folder created hold content. click next. in third screen, select read , run scripts (such asp). make sure other check boxes cleared. click finish complete wizard. for asp content, may want confirm application created. this, right-click new virtual directory, , click properties. on virtual directory tab, make sure virtual directory name listed in application name box under application settings. if not, click cre...

Set python virtualenv in vim -

i use vim coding , python coding in particular. want execute current buffer python interpreter. (for example run unittests), :!python % <enter> this scenatio work works fine global python, want run virtualenv python instead. how enable virtualenv within vim? possible switch virtualenv on runtime? i'm using macvim here's use (sorry highlighting screwy). " function activate virtualenv in embedded interpreter " omnicomplete , other things that. function loadvirtualenv(path) let activate_this = a:path . '/bin/activate_this.py' if getftype(a:path) == "dir" && filereadable(activate_this) python << eof import vim activate_this = vim.eval('l:activate_this') execfile(activate_this, dict(__file__=activate_this)) eof endif endfunction " load 'stable' virtualenv if 1 exists in ~/.virtualenv let defaultvirtualenv = $home . "/.virtualenvs/stable" " attempt load virtua...

asp.net mvc 2 - Passing the form action attribute to a Partial View -

i have partial view using 2 different forms. in order use jquery validation use tag instead of html.beginform helper. means should specify action attribute myself asp.net mvc 2 when call html helpers. questions are: how can it? are there better ways want do? its relatively easy, write form tag follows: <form id="myform" method="post" action='<%= url.action("myaction") %>'> if calliing partial separate places easiest way achieve want

gwt - Inserting JSON in DataTable in Google Visualisation -

i read json can inserted datatable. however, done in js on html page (if memory serves right). using gwt- visualisation driver given here , , methods add row not designed json in mind. there work-able solution? trying make stacked column chart. thanks. i struggled using geomap , data table combined. in workaround used evaljson() in prototype javascript framework make json string object. var country_obj = country_data.evaljson(true); then loop on object's length : var data = new google.visualization.datatable(); data.addrows(country_obj.country.length); data.addcolumn('string', 'country'); data.addcolumn('number', map_context); var j = country_obj.country.length; ( = 0; < j; i++ ) { var num = new number(country_obj.country[i].geo_mstat_reads); data.setvalue(i, 0, country_obj.country[i].country_name); data.setvalue(i, 1, num.valueof()); } // , table.draw() data this worked me because scales exact size of dataset try...

linux - How does nohup work? -

what performed behind scenes when program runs nohup? is pid of parent process being changed? thanks. edit : understood nohup (and disown) causes sighup not sent process if parent process receives it. mean equivalent handling sighup (and ignore it)? use source, luke!

windows - Persistent system / processor ID that stays across reinstalls and drive changes (C#) -

i'm looking produce unique id embedded systems manage. systems running windows embedded 7 standard , .net 4.0. ids must: be relatively unique -- each embedded system running on same motherboard, drive, etc. , can't have collisions. persist across reinstalls -- these computers reimaged new versions of our software regularly. cannot rely on disk serial number -- we're not using real disks, rather cf cards cf sata adapter, , cf cards swapped out occasionally. also, have multiple nics in machine, relying on on-board nic mac address work if can tell me how identify nic on-board vs usb device. after further research looks isn't possible within scope of managed code. what's best way accomplish this? i suggest use wmi obtain information machine's cpu, using win32_processor class. can construct unique id machine attributes such processorid , uniqueid . this way using each machine's cpu persisten "store" machine id.

iphone - release sounds and memory manegment -

hello in application use code below handle , play sounds, want know if need release things or nothing do. the code : -(void) playnote: (nsstring*) note type: (nsstring*) type { cfurlref soundfileurlref; systemsoundid soundfileobject; cfbundleref mainbundle; mainbundle = cfbundlegetmainbundle (); // url sound file play soundfileurlref = cfbundlecopyresourceurl (mainbundle, (cfstringref)note, (cfstringref)type, null); // create system sound object representing sound file audioservicescreatesystemsoundid (soundfileurlref, &soundfileobject); audioservicesplaysystemsound (soundfileobject); } thanks , you need call audioservicesdisposesystemsoundid to clean when done sound. in header @interface xyz { systemsoundid soundfileobject; }; in .m file, create init method (if dont have one): -(id)init { if ( (self = [super init]) ) { audioservicescreatesystemsoundid (soundfileurlre...

c++ - Forward declare FILE * -

how forward declare file * in c? using struct mytype; , naturally doesn't appear possible. if behaviour differs between c standards or compilers , c++, of interest. update0 why want aside: i'm asking how forward declare non-struct/"typedef'd struct" type can declare pointers it. using void * , casting in source file bit hackish. you can't. standard states file "an object type capable of recording information needed control stream"; it's implementation whether typedef of struct (whose name don't know anyway), or else. the portable way declare file #include <stdio.h> (or <cstdio> in c++).

iis - Definition of Connection -

does know constitutes official connection workstation? have reasonably small scale operation using workstation, not server, server. part, works fine, there 10 connection limit , toying new functionality , ended causing problems 10 connection limit kept getting hit. from trial , error, pretty sure using web service on workstation counts connection surfing web pages served workstation. if set-up mysql database? everytime pc connects or replicates data mysql server, count connection? connecting pc via mapping drive? these 2 articles should help: understanding iis7 request restrictions on windows vista iis limits imposed operating system version basically vista on number of connections unlimited. it's number of of concurrent requests iis can process restricted. in theory have 15 concurrent connections iis 5 of them queued.

iphone - NSMutableArray - Remove duplicates -

i tried doing this: values = [[nsset setwitharray:values] allobjects]; , no sucess, thanks your method should work, except returns nsarray instead of nsmutablearray . use [values setarray:[[nsset setwitharray:values] allobjects]]; to set values content of new array.

c++ - Understanding the design of std::istream::read -

std::istream has prototype istream& read (char* s, streamsize n) actual number of bytes read should gotten calling istream::gcount() , validity of istream can known ios::good . i discussing stream class' implementation trying write colleague of mine, saying might follow design; said instead of having user call gcount everytime, 1 have read's prototype istream& read (char* s, streamsize n, size_t &bytes_read) it'll on in single call , former clumsier. unable defend std 's design choice. what's real rationale behind istream::read ? i assume it's because c++ doesn't typically force interface may not needed everyone. if require read accept parameter people don't care about, causes coding work (declaring int pass parameter). saves bytes read regardless of whether client cares or not (some clients may care read failed indicated eof/fail bits). with separate method de-couple interface different pieces of information may or ma...

html - PHP: htmlentities not working with variable -

i'm using htmlentities() convert characters Ç , ® character codes. i'm getting texts mysql database. while($row = mysql_fetch_array($array, mysql_num)){ echo "<div style='float:left; margin-right:40px;'> <div style='width:148px; height:141px; background-image:url(uploads/".$row[0].")'> <img src='images/glasscase.png' alt=''/> </div> <font style='font-size:20px'>".htmlentities($row[1], ent_quotes,"utf-8")."</font> <br/> <font style='font-size:14px'>".htmlentities($row[2], ent_quotes, "utf-8")."</font> </div>"; } however $row[2] returning empty string when using htmlentities(). knows what's wrong? thanks! why don't scrap 'htmlentities' , use htmlspecialchars();

Flash Actionscript 3 SimpleButton doesn't have focusEnabled property? -

this driving me insane. working in flash (not flex) actionscript 3. have instance of class simplebutton. have textfield don't want lose focus when user clicks simplebutton. understanding both actionscript 2 flex class 'button' both have settable/gettable property called "focusenabled". can't seem find equivalent flash actionscript 3's simplebutton. did find link ifocusmanager , ifocusmanagercomponent, neither seem available me. cheers. how using click event set focus textfield? don't have worry whether or not simplebutton has focusenabled property. code should be stage.focus = mytextfield;

polymorphism - Is there any reason that Java uses late/static binding for overloaded methods in the same class? -

is there specific reason why java uses binding overloaded methods? wouldn't possible use late binding this? example: public class someclass { public void dosomething(integer i) { system.out.println("integer"); } public void dosomething(object o) { system.out.println("object"); } public static void main (string[] args) { object = new integer(2); object o = new object(); someclass sc = new someclass(); sc.dosomething(i); sc.dosomething(o); } } prints: object object i rather expect: integer object it seems me obvious reason allows compiler guarantee there function called. suppose java chose function based on run-time type, , wrote this: public class myclass { public void foo(integer i) { system.out.println("integer"); } public void foo(string s) { system.out.println("string"); } public static void main(string[] arg...

How to use JNI to call MEMCMP from Java -

i need compare 2 byte arrays , know 1 bigger or if equal (just equal or different not enough). byte arrays represent string value of 15 characters or more. comparison repeated considerably in code. i improve bye array compare using equivalent of c++ memcmp method in java (hopefully jni). found example use dllimport in c#, hope jni call can applied well. here c# code segment: [dllimport("msvcrt.dll")] unsafe static extern int memcmp(void* b1, void* b2, long count); unsafe static int bytearraycompare1(byte[] b1, int b1index, int b1length, byte[] b2, int b2index, int b2length) { comparecount++; fixed (byte* p1 = b1) fixed (byte* p2 = b2) { int cmp = memcmp(p1 + b1index, p2 + b2index, math.min(b1length, b2length)); if (cmp == 0) { cmp = b1length.compareto(b2length); } return cmp; } } does know how implement in java? thanks in advance...

Oracle sqldeveloper - how to connect DB from command line -

i writing small db utility. give user ability open instance of oracle sqldeveloper directly utility. possible open oracle sqldeveloper ide connected specific db? something sqldeveloper userid/password@database /? works rather /h. there options override cofiguration file whether can or not determined facilities offered config file.

Reading mails from outlook progamatically using C# -

i trying create program reads mail microsoft outlook can move them different folders based on thier contents. using microsoft.office.interop.outlook 12.0, works fine outlook 2007. how handle scenario user uses outlook 2010? thanks. do need use c#? if don't need use c#, can open 1 of messages need move , click on "add rule". there can define rules to, example, move mail boss folder called work. don't see why need use c#. difficult in c# except simulating mouse movements...

user interface - Open Source Box.net using S3, RackCloud etc -

wondering if knows of open source project box.net using s3 or rackcloud or others. have googled have never googled before , couldn't find anything. tried different terms etc ... nothing. i love host own solution instead of paying $25 per user per month. have lot of users ... 100+ , yes give discount still pretty expensive. seems easy build. thanks help! and....2 years later :) http://owncloud.org/support/install/ http://pogoplug.com/

javascript - Silverlight window.external.notify() securityproblem? -

in silverlight application using webbrowser control. i call following javascript function on page i'm navigating to. function notify() { window.external.notify("close"); } the weird fact works when navigating page using: this.browser.source = new uri("http://localhost/testoutofbrowser.web/htmlpage1.htm"); when navigate using real server name: this.browser.source = new uri("http://testservername/testoutofbrowser.web/htmlpage1.htm"); i javascript exception ('unspecified error.') when executing window.external.notify("close"); line. this security related don't have clue how solve problem.. how can work? for facing same or similar problem: appearantly cross-domain scripting security issue. browser control not execute if domain of silverlight application , page(you navigating to) different. (! 127.0.0.1 , localhost evaluated 'different' domains ) i ended using relat...

serialization - How can I change package for a bunch of java serializable classes -

i want change packages of multiple classes in application. nice eclipse redactor have been great of classes serializables , need support cross version compatibility. any idea on how can done? can done automatically/semi-automatically? if class structure remains same, can subclass custom objectinputstream, call enableresolveobject(true) in constructor , override readclassdescriptor() that: protected objectstreamclass readclassdescriptor() throws ioexception, classnotfoundexception { objectstreamclass read = super.readclassdescriptor(); if (read.getname().startswith("com.old.package.")) { return objectstreamclass.lookup(class.forname(read.getname().replace("com.old.package.", "org.new.package."))); } return read; }

c# - What does the @ sign mean in the following - Class.Field = @"your text here"; - -

possible duplicate: what “@” means in c# what sign @ mean in following: class.field = @"your text here"; i came across in piece of code, compiler not seem complain... i've searched around no avail... what @ mean? it indicates verbatim string literal. can use escapes aren't treated such: string path = "c:\\documents , settings\\username\\my documents"; becomes: string path = @"c:\documents , settings\username\my documents";

Retrieving the dateFormat from jQuery UI datepicker -

i retrieve dateformat datepicker default set declaration so: $.datepicker.setdefaults({ constraininput: true, dateformat: 'dd/mm/yy', gotocurrent: true, hideifnoprevnext: true, mindate: '-1y', maxdate: 0, showon: 'both' }); is there way retrieve information? i retrieve when above dateformat value has been overridden when localised datepicker code added after above defaults. so have above , following added set dateformat 'yy-mm-dd': /* hungarian initialisation jquery ui date picker plugin. */ /* written istvan karaszi (jquery@spam.raszi.hu). */ jquery(function($){ $.datepicker.regional['hu'] = { closetext: 'bezárás', prevtext: '&laquo;&nbsp;vissza', nexttext: 'elÃ…‘re&nbsp;&raquo;', currenttext: 'ma', monthnames: ['január', 'február', 'március', 'Ãprilis', 'május', 'június', '...

python mp3 meta-tag -

i try write script scan recursive given directory , if found mp3 , print meta tag it. ever passed geteyed3tag got exception. here code have written far def geteyed3tags(path): try: trackinfo = eyed3.mp3audiofile(path) tag = trackinfo.gettag() tag.link(path) print tag.getartist() print tag.getalbum() print tag.gettitle() #return (tag.getartist(),tag.gettitle(),tag.getalbum()) except eyed3.invalidaudioformatexception: print "file %s not mp3 file " % path mp3num=0 temp=os.walk(valid-folder-name) root, dirs, files in temp: in files: if os.path.join(root,i): temp=os.path.splitext(i) temp[1].lower() if temp[1]=='.mp3': mp3path=os.path.join(root,i) print mp3path geteyed3tags(mp3path) mp3num+=1 raw_input() #print "**" else: print...

algorithm - How are efficient consecutive word searches implemented? -

search engines , databases allow use consecutive string search (such "this test" ), matches this test match , won't match test a . i know databases have built-in features allow use same functionality without writing single line of code (e.g. mysql's full text search). that's not kind of answer looking for. what want know kind of algorithm , database structures used enable fast searching of strings. what indexed table given above example? similar this? // indexeditemid | position | word 1 | 0 | 1 | 1 | 1 | 2 | 1 | 3 | test 1 | 4 | 1 | 5 | 1 | 6 | match 2 | 0 | test 2 | 1 | 2 | 2 | 2 | 3 | now there indexed items, how efficiently create sql statement matches items? here's 1 example can think of: select indexeditemid form (select indexeditemid, position indexedwords word = "this") word1position exists(select * indexedwords indexeditemid = word1position.indexeditemid , word = "is" , position = word1position.position + 1) ...

sql server - SQL Select Return Default Value If Null -

database: ms sql 2008 select listing.title, listing.mls, pictures.pictureth, pictures.picture, listing.id listing inner join pictures on listing.id = pictures.listingid (pictures.id = (select min(id) pictures (listingid = listing.id))) the issue is, have several "listings" without picture, , because of sql script don't show up. how can them show up? maybe give pictures.picture column value of "default.jpg" if value null? i'm pretty lost on this, if help, that'd amazing. sorry if i'm asking question poorly well, dont understand how ask need do. ask more details , i'll post them. each listing can have many pictures user wants, need script display listing if doesn't have picture. phase 2 thank all. far i'm learning new commands never knew existed. issue returning row each picture listing has. default image working great. select listing.title, listing.mls, coalesce(pictures.pictureth, '../default_th.jpg') pictur...

What indexes will I need to make on this SQL Server table? -

Image
i have following sql query sql server 2008 db. select top(@numberofstreetresults) locationtype, locationid, name [dbo].[locationnames] contains(name, @searchquery) , locationtype = 7 notice how i'm using contains keyword? have fts on name field. i'm not sure index(s) need manually add table because query common in our system. do need add index against locationtype ? update here's query graphs... if locationtype highly selective suggestion create covered index on table key locationtype , add locationid in include column list

automation - Can I use window hooks in C# to determine if a window gains or loses focus? -

i've written c# application automates instance of ie. i'd know when internet explorer gains focus , when looses focus. from shdocvw.internetexplorer object can it's hwnd. there how can create message hook receive wm_killfocus , wm_focus events (assuming correct events listening :))? thanks everyone!! update: found way use accomplish above goal without using hooks (which haven't quite figured out how in c# yet), using .net framework in question . the problem code automationfocuschangedeventhandler focushandler = new automationfocuschangedeventhandler(onfocuschanged); automation.addautomationfocuschangedeventhandler(focushandler); is easy window foreground window , event won't fire when window switched because it's waiting specific ui element in focus. (to test can use function uses code , prints message everytime new window in focus, such msdn sample trackfocus, , click on webbrowser. when webpages or blank page being displayed in ...

random custom field wordpress -

i have 3 custom fields on page, dailytip_1, dailytip_2 , dailytip_3. so want show 1 tip of 3 tips randomly on page. can do? thanks! <?php $dailytip_1 = get_post_meta($post->id, 'dailytip_1', true); ?> <?php if ($dailytip_1 !== '') { ?> <p><?php echo get_post_meta($post->id, 'dailytip_1', true); ?></p> <?php } ?> does following help? <?php $random_dailytip = 'dailytip_' . rand( 0, 2 ); $dailytip = get_post_meta($post->id, $random_dailytip, true); ?> <?php if ($dailytip !== '') { ?> <p><?php echo get_post_meta($post->id, $random_dailytip, true); ?></p> <?php } ?> as can see, $random_dailytip gets values dailytip_0 , dailytip_1 or dailytip_2 randomly.

simple jquery fade in bg question -

im trying have background fade in onclick jquery , im unsure on how it. here code: $(".work").click( function(){ $("body").removeclass('bg2 , bg3').addclass("bg1"); }); $(".about").click( function(){ $("body").removeclass("bg1 , bg3").addclass("bg2"); }); $(".contact").click( function(){ $("body").removeclass("bg1 , bg2").addclass("bg3"); }); thanks :d if using jquery ui plug-in , allow animation of color. can this: $("body").animate({"background-color": "red"}, 1000); and can animate color want. give "fade" effect, have animate out white , color. if not using jquery ui, may add overhead site, might want check out jquery.color plugin . 4kb in size. here example of fading using jquery ui: http://jsfiddle.net/9vhpm/ update i didn't realize looking fade background image. may find helpf...

How to create Rails app with Facebook single sign-on? -

i creating rails application need allow users login site facebook ids. how do that. don't understand facebook documentation much. there other clear resources on internet? thanks omniauth new kid on block looks promising. it's rack-based , provides common api authentication via twitter, facebook, linkedin et al.

Converting from an int to a bool in C# -

int vote; insertvotes(objecttype, objectid , vote, userid); //calling for method call, want convert vote bool . how can convert it? here method signature: public static bool insertvotes(int forumobjecttype, int objectid, bool isthumbup, int userid) { // code... } you can try like insertvotes(objecttype, objectid , (vote == 1), userid); //calling assuming 1 voted up, , 0 voted down, or that.

svn - Subversion with LDAP authentication -

i'm facing issues configuring svn ldap. svn version: 1.6.6 apache version: 2.2 i using tortoisesvn client access repository. i've copied "mod_authz_svn.so" , "mod_dav_svn.so" svn modules directory of apache installation. apache starts without trouble. below configuration file. <location /svn> dav svn svnparentpath d:/repos svnlistparentpath on authzsvnaccessfile d:/repos/access.txt authzldapauthoritative off authtype basic authbasicprovider ldap authname “ou.org” #authldapbinddn “cn=trophy,cn=users,dc=vw,dc=vwg” authldapbinddn "domain\trophy" authldapbindpassword “syperb” authldapurl ldap://ou.org:389/cn=users,dc=ou,dc=org?samaccountname?sub?(objectclass=users) require valid-user </location> error:200 ok if replace "/svn" location path, don't see above error, unable authenticate server. notice login prompt pops every time give credentials. i'm...

ruby on rails - Resque plugin's resque-web is not running -

i using resque , resque scheduler, when enter command resque-web not running. instead prompting error: bash: resque-web: command not found how start resque-web on local server. it's trying open default browser , failing so. try using: $ resque-web -l

toggle - Toggling jQuery function not workin on Safari Mobile -

i'm trying make work functionality exists on website works bad on safari iphone. well, have "li" element: .. <li><input id='showorhide' type='button' value='show or hide'/></li> <li><input type='text' value='ok'/></li> .. when click on 'show or hide' button, text input should appear or disappear. then, have jquery function binds click: $("#showorhide").click(function(){ if($(this).parent().next().is(':visible')) $(this).parent().next().hide('slow'); else $(this).parent().next().show('slow'); }); the problem that, if element appears, safari hides shows it. so think safari checks wether element visible or not. if it's visible, hides it, go "else" selection. there, checks if element visible or not. find it's not visible, make appear. so on stackoverflow adivises me use toggle function , did: $("#...

node.js - Using nodejs : mongodb find then add to Array -

i made simple db few users in mongodb , nodejs. next im looping through list , display users in list's names etc sys.puts(). no adding users array() this: db.open(function(err, db) { db.collection('users', function(err, collection) { collection.find({}, {'sort':[['name', 1]]}, function(err, cursor) { cursor.each(function(err, user) { if(user != null) { users[user._id] = { 'name':user.name, 'email': user.email }; sys.puts(">> adding user list... "+ user.name); } }); db.close(); }); }); }); is how add users array? because users.lenght = 0. im bit lost now what doing setting properties on array object, might bit confusing. [] both used indexes , keys , means in case of array, users[0] return first element in array, users['blaid12'] get/set property blaid12' on ...

xml - I18n of XSD validation error messages in Java -

i perform xsd xml validation using following classes: import javax.xml.validation.schema; import javax.xml.validation.schemafactory; import javax.xml.validation.validator; the problem xsd error messages returned validator in english language. possible call locale-aware validation jaxp api? jaxp api; actual implementation (for example, apache xerces ) provide localization-aware messages. normally, though, system-level libraries , implementations (such jaxp & xerces) provide messages localized based on system's default locale (whatever returned expression java.util.locale.getdefault() ); is, again, os-specific. on microsoft windows, example, can change system's default locale using regional settings window. if want, can override "default locale" used jvm specifying user.language , user.region system properties (for example, -duser.language=fr , -duser.region=ca make jvm yield "canadian french" default locale. eventually, setting...

xcode - localized nib not working in a iPhone project -

i working on iphone project have translated 2 languages : french , spanish. the issue have 1 file : rootviewcontroller nib. i localized mainwindow.nib, , works (when change language, text in app changes according specified). have several nslocalizedstrings, localizable.strings file, works, rootviewcontroller doesn't: i made file localizable, added 2 languages (fr , es), modified, files located in fr.lproj folder , es.lproj folder, , included in target/app/"copy bundle ressources". text in app 1 english nib, when change language. any idea come from? is english xib in en.lproj folder side side other languages? if english xib in root, may finding , not looking elsewhere.

memory management - What is meant by statically relocated or static relocation of a segment -

the elf format executable contains various segments code, data, bss, stack etc. if segment xyz statically relocated mean? the elf format binary contains relative addresses each segment. when statically relocated mean relative addresses physical addresses? static relocation means moving data or coding , assigning absolute locations them before program run. ex:- linker example of static relocation moves several modules of program , combine them program.

Randomizing text file read in Java -

i trying read text file in java, set of questions. 4 choices , 1 answer. structure looks this: question option a option b option c option d answer i have no trouble reading way: public class rar{ public static string[] q=new string[50]; public static string[] a=new string[50]; public static string[] b=new string[50]; public static string[] c=new string[50]; public static string[] d=new string[50]; public static char[] ans=new char[50]; public static scanner sr= new scanner(system.in); public static void main(string args[]){ int score=0; try { filereader fr; fr = new filereader (new file("f:\\questions.txt")); bufferedreader br = new bufferedreader (fr); int ar=0; for(ar=0;ar<2;ar++){ q[ar]=br.readline(); a[ar]=br.readline(); b[ar]=br.readline(); c[ar]=br.readline(); d[ar]=br.readline(); string tempo=br.readline(); ans[ar]=tempo.charat(0); system....

Can I install and run SharePoint Server 2007 or 2010 on Windows 7 Professional? -

can install , run sharepoint server 2007 or 2010 on windows 7 professional? of course. i've installed sp 2007 on vista, it's same steps on win7 too. http://community.bamboosolutions.com/blogs/bambooteamblog/archive/2008/05/21/how-to-install-windows-sharepoint-services-3-0-sp1-on-vista-x64-x86.aspx happy sharepoint-ing

asp.net mvc - livequery not always live when used with jquery.validate -

i use jquerylive plugin add additional css classes .field-validation-error class this: $(".field-validation-error").livequery(function () { $(this).addclass('ui-state-error ui-corner-all'); }); when spans class generated jquery.validate above code works, @ 2nd validation doesn't. here live link: http://mrgsp.md:8080/awesome/person click on create after click save validation messages , click again on save why not hook function same event triggers validate()? update i read other comments , saw using xval, read bit on jquery.validate well. jquery.validate ties in many events , registering on event handlers messy. reason livequery works first time labels generated if don't exist creation event makes function run, everytime after label hidden/shown doesn't triggered again jquery.validate's showlabel function resets classes. the ideal place in xval making 1 small change in xval.jquery.validate.js file. in _ensureformismarke...

sql order by - Linq orderby two-column sort with custom comparer -

list<myobject> objects = (from in alist join b in blist on a.id equals b.id a.number != 4 orderby b.rank, a.customfield select a).tolist(); this query , want use custom comparer customfield property. there way in two-field orderby? i able this: list<myobject> objects = objects.orderby(a => a.customfield, new mycomparer<object>()) but need sorted both s.rank , a.customfield. use orderby() in conjunction thenby() custom comparers. // i'm pretty sure not possible specify // custom comparer within query expression list<myobject> objects = (from in alist join b in blist on a.id equals b.id a.number != 4 select new { a, b }) .orderby(o => o.b.rank, new myrankcomparer()) .thenby(o => o.a.customfield, new mycomparer<object>()) .select(o => o.a) ...

java - How to sort the array list? -

hey guys. thanx major regarding obstacles. problem time is, how can sort array list provided in code dont know whati need add in provied code below, simplyfive got 3 arraylist want make them 1 arraylist, can sorted in amont of guesses , tries( if 2 players have same guesses time should determine) . pretty hard explain tried best.............the best thing run figure whats issue is? here code: import java.util.*; import java.util.scanner.*; import java.util.arraylist.*; public class main { public static string tostring(int a, double b, string c) { string = integer.tostring(a); string bs = double.tostring(b); string scorelist = (as + "\t\t" + bs + "\t\t" + c); return scorelist; } private static void start() { int tries = 0 ; int guess = -1; string name ; string quit = "quit"; string y = "yes"; string n = "no"; string currentguess; string = ("y") ; sca...

asp.net - No dll compiled in visual studio 2008 express when built -

i'm .net newb, forgive me if stupid question. i've inherited website i've amended , need rebuild. i've opened .sln file in vs2008, made changes files , clicked 'build > rebuild website'. seems run okay - outputs load of comments in panel @ bottom it's building, , stops, saying: "validation complete. rebuild all: 1 succeeded, 0 failed, 0 skipped". but when check bin folder, there no dlls in there. does know what's going wrong here? need build thing , upload aspx , dll files , should sorted, can't seem build @ all. thanks pointers... if web project , not web application visual studio not build , compile it. checks through errors , let's runtime compile web pages , code behind. won't dll in bin folder. you can try pre-compiling site , copying output web server. cheers tigger.