Posts

Showing posts from February, 2010

ms access - Date parameters in query -

i have form enter data. sort order, start date , end date. once data entered, report generated. , error. error: "the microsoft access database engine not recognize '[forms]![auditptetotals]![startdate]' valid field name or expression. this crosstab (auditptetotals_crosstabdaterange) query uses data retrieved query (auditptetotalsdaterange) transform sum(auditptetotalsdaterange.ptetotal) sumofptetotal select auditptetotalsdaterange.companyname, auditptetotalsdaterange.regnum, sum(auditptetotalsdaterange.ptetotal) [total of ptetotal] auditptetotalsdaterange group auditptetotalsdaterange.companyname, auditptetotalsdaterange.regnum pivot auditptetotalsdaterange.description; and auditptetotalsdaterange select customer.regnum, customer.companyname, scraptiretype.description, scraptiretype.pteamount, scrapcollectiontiretype.amount, scrapcollection.ptetotal, scrapcollection.date (scrapcollection inner join customer on scrapcollection.regnum = customer.regnum...

Providing links to test outputs in TestNG reports -

in tests, capture output of each test , save them html files in directory. how can provide link these outputs each test in testng reports? e.g. if there failure recorded in testng results, provide link saved html files. thanks it depends on , how want report results. sounds want create custom testng report contain information on status link file generated. there 2 main ways accomplish in testng: create test listener - implements org.testng.itestlistener , reports status of every tests after tests executed. create test reporter - implements org.testng.ireporter , provides consolidated result of test statuses, when tests executed. you can refer testng web site examples on listeners.

android - flip images and read them from a xml file store in external server -

i have small pb first succesud read information pay server work display product ( image, category, price) in customerlist view probelm when clic product want image pop , eabel see image in original size , flip around product image ps: product list stor in xml file : music> <song> <id>1</id> <title>cheminées</title> <artist>brique flammé</artist> <duration></duration> <thumb_url>http://www.xxx.com/music/images/pg.png</thumb_url> <thumb_grand>http://www.xxx.com/music/images/pg.png</thumb_grand> </song> <song> <id>1</id> <title>cheminées</title> <artist>phenicia</artist> <duration></duration> <thumb_url>http://www.xxxx.com/music/images/pg.png</thumb_url> </song> <song> <id>2</id> <title>barbecues</title> <artist>rome</artist> ...

mysql - Php Str_replace with a for loop -

i'm trying give each textarea name can use them later send database. code got weird results , guess because use str_replace . here's code: $description2 = mysql_result($product, 0, 'productdescription2'); $totalteknisk = preg_match_all('/x(a|b|d|e)/', $description2, $matches); $searcharray = array('xa', 'xb', 'xc', 'xd', 'xe'); if ($description2 !=""){ for($z=1;$z <= $totalteknisk; $z++){ $xa = '<textarea name="'. $z .'" style="background-color:#ffffff;resize: none; height: 20px; width: 200px;">'; $z++; $xb ='</textarea><textarea name="'. $z .'" style="background-color:#ffffff;resize: none; height: 20px; width: 200px;">'; $z++; $xc = '</textarea><br>'; $xd = '<textarea name="'. $z .'" style="background-color:#eaf2d3;resize: none; height: 20px; width: 200px;"...

spring - Hibernate causes problems when beans have cross refrence -

i have hibernate beans a, b , c. here relation between them: a contains object of b - many 1 - lazy fetching b contains object of c - many 1 - lazy fetching c contains object of sortedset - 1 many - lazy fetching i trying objects in fashion a->getb()->getc()->getbs() , iterate on bs using loop. after iterating when call hibernatebeanreplicator.deepcopy() on a->getb(), fails fill object graph , many of fields of b remain null. however if change relation a->getc()->getbs(), hibernatebeanreplicator works fine. although current app design not allow me change them this. thanks ton. suman

jsf - Combination of fixed and dynamic tabs in PrimeFaces TabView -

is possible combine fixed , dynamic tabs in pf tabview? use case creating tab each object in object list dynamically. fixed tab hold form creating new object. once form submitted, new tab new object must added tabview. so far managed implement functionality 2 views - 1 displaying objects dynamically , other 1 form new object. i tried write new tabview renderer able render both dynamic , fixed tabs. however, if combine 2 tab types, pf command button not function on fixed tab (i posted problem here: http://forum.primefaces.org/viewtopic.php?t=20840 ). i found forum post creating pf tabs in managed bean ( http://stackoverflow.com/questions/4052581/dynamically-generate-tabs-with-primefaces ). i'd avoid if possible capable use pf components declaratively in .jsf view. we had same issue in our latest project , and solved in simple yet little crude way: we have created 2 (nested) tabviews. top 1 includes 2 tabs. 1 showing dynamic tabs having nested second (dynamic) ta...

java - SWT Button Grid -

it's problem it's annoying me 3 days now. have rewrite ui of little tictactoe(gomoku of n x n) game. problem when created swing gui , made new class inherits jbutton properties , added int rows , int columns. cannot swt(no inheritance). there way me add values of , j button. here example in swing: for (int = 0; < rows; i++) { (int j = 0; j < cols; j++) { final myjbutton button = new myjbutton(i, j); button.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent e) { moveresult move = game.move(button.getrow(), button.getcol()); switch (move) { case validmove: button.setbackground(game.getcurrentplayer().getcolor()); game.changeplayer(); break; } } } } } } i give , j game class give t...

c - Count the number of subset containg 1's -

there bitset of lengt n (it 500-700). need count of every subset containing 1's example n = 32 set = 0* 11 *0* 111 *00* 1 *0* 1 *00* 1111 *0* 11 *00* 111 *000* 1 *0* 1 * out = { [1] = 4, [2] = 2, [3] = 2, [4] = 1, [5] = 0, ... [32] = 0 } void get_count(int tab[], int len) { int *out = calloc(1, sizeof(*out) * int_bit * len); int i, j, k; int cur; int count = 0; for(i = 0; < len; i++) { cur = tab[i]; for(j = 0; j < int_bit; j++) { count += (cur & 1); if(!(cur & 1)) { out[count]++; count = 0; } cur >>= 1; } } for(i = 0; < int_bit * len; i++) { printf("%d ", out[i]); } printf("\n"); free(out); } this simple operation executed billions times. iterate on every bit slow. how optimizing algorithm? i use lookup table choosing appropriate dimension (maybe 8 bits or 16 bits keys). in lookup table associate every key 4 values: number of 1 bits...

Best way to deal with document locking in xPages? -

what best way deal document locking in xpages? use standard soft locking , seems work in notes client. in xpages considered using "allow document locking" feature worried people close browser without using close or save button lock never cleared. is there way clear locks when user has closed session? seeing no such event. or there easier way have document locking? i realize can clear locks using agent when run it? think sometime night lock should no longer active. here code i'm using: /* document locking */ /* use global object "documentlocking" with: .lock(doc) -> locks document .unlock(doc) -> unlocks document .islocked(doc) -> returns true/false .lockedby(doc) -> returns name of lock holder .lockeddt(doc) -> returns datetime stamp of lock */ function yndocumentlocking() { /* lock entry in application scope key = "$ynlock_"+unid containing array ...

android - progress Dialog simpel -

i want add progress dialog button when click on button before new activity apperar, think don't need thread, did search find need thread , many other think s not clear want when clik on progress dialog user wait few sec other activity appear that's all: btn_newsfeed.setonclicklistener(new view.onclicklistener() { public void onclick(view view) { // launching news feed screen intent = new intent(getapplicationcontext(), customizedlistview.class); startactivity(i); } }); there 3 different different ways in can use progressdailog -using threads, handlers , async tasks. here example of async task using progress dialog private class operation extends asynctask<string, void, string> { @override protected string doinbackground(string... params) { // code executed in background thread for(int i=0;i<5;i++) { try { t...

android - Can i add custom keyboard to the core keyboard? -

hey simple question can't seem find answer it. i'm intrested in creating smilies keyboard added native keyboard person can add them in emails/sms etc. now guess can edit os , add keyboard, wondering if can attach event opens keyboard , edit it? again, i'm not intrested in custom keyboard inside app, want while app open (if possible without, better) change regular keyboard. is possible? i wondering if can attach event opens keyboard , edit it? no, sorry. different application yours; cannot change @ runtime. you welcome build own input method editor , use that, though. or, perhaps make contribution existing open source input method editor project.

.net - Using Powershell to get just the file names from a network folder -

i trying use powershell file names network folder. understanding of get-childitems (please correct me if i'm wrong on this) cmdlet trying download entire object which, in case, series of product installers ranging in size 25mb 315mb per file. the purpose of script create menu user choose file download. works, except takes 30+ minutes populate menu, unacceptable. i thinking may need incorporate .net classes make work, if can purely powershell nice. thoughts or suggestions appreciated. $source = get-childitem "\\networkdrive\release\installs\2012.1.2.3\" i found way use .net classes so, strictly speaking, doesn't answer own question. however, job done, here is: $source = [system.io.directory]::getfiles("\\networkdrive\release\installs\2012.1.2.3", "*.exe")

actionscript 3 - How can I Print using FlexPrintJob in Landscape? -

how can print flex component in landscape orientation using flexprintjob? flexprintjob doesn't have orientation property. there case reported in flex bug , management system sdk-11211 . there workaround it's not effective. if knows better solution this, interested seeing it.

hadoop - Reading images from HDFS using mapreduce -

please me in code. trying reiad images hdfs. using wholefileinputformat. wholefilerecordreader. no compile time errors.but code giving runtime errors. output saying: cannot create instance of given class wholefileinputformat. have written code according comments on how read multiple image files input hdfs in map-reduce? please me in code.it contains 3 classes.how debug it? or other way? import java.awt.image.bufferedimage; import java.io.bytearrayinputstream; import java.io.fileinputstream; import java.io.ioexception; import java.util.arraylist; import java.util.iterator; import java.util.list; import javax.imageio.imageio; import net.semanticmetadata.lire.imageanalysis.autocolorcorrelogram; import org.apache.hadoop.conf.configuration; import org.apache.hadoop.conf.configured; import org.apache.hadoop.fs.fsdatainputstream; import org.apache.hadoop.fs.path; import org.apache.hadoop.io.*; import org.apache.hadoop.mapred.*; import org.apache.hadoop.mapred.lib.nulloutputformat; impo...

html - Iterate through nested classes in WWW::Selenium -

is there method in www::selenium allow me iterate through structure (html code) , access hrefs? <div class="mygengo_wrap full_width"> <h1>dashboard</h1> <div class="blue list"> <span class="title">sections </span> <span class="dashboard_master_language"> <span class="dashboard_language wide"> <a href="http://mygengo.com/string/p/demoproject-1/admin/languages/settings/en_us">englisch (master) </a> </span> </span> <span class="dashboard_languages"> <span class="dashboard_language wide"> <a href="http://mygengo.com/string/p/demoproject-1/admin/languages/settings/zh_cn">chinese </a> </span> <span class="dashboard_language wide"> <a href="http://mygengo.com/string/p/demopro...

accessibility - Possible to programmatically suppress the reading of a textarea? -

my first attempt @ accessibility daunting one. i've built site customers "chat" agent, of content being dynamic/ajax. i'm using window-eyes 7.5 testing. for incoming messages add "role=alert" , "aria-live=polite" new divs , screenreader reads incoming text expect. however, if happen typing in textarea i'd send comments, screenreader abruptly cuts off , reads typing instead. is solely configuration of window-eyes? there programmatic way can either 1) suppress reading of textarea, or 2) enforce queueing of sort new messages read? note switching focus isn't option in case. there no way know of force text read while user typing in either jaws, or nvda. assume holds true window eyes if doesn’t should assume user typing stop automatic speaking of text compatible many screen readers possible. screen reader users know typing stop automatic speaking of updated content, , review last several messages make sure didn't miss while ...

jquery ui - ruby on rails implement search with auto complete -

i've implemented search box searches "illnesses" table , "symptoms" table in db. want add auto-complete search box. i've created new controller called "auto_complete_controller" returns auto complete data. i'm not sure how combine search functionality , auto complete functionality: want "index" action in search controller return search results, , "index" action in auto_complete controller return auto_complete data. please guide me how fix html syntax , write in js.coffee file. i'm using rails 3.x jquery ui auto-complete, prefer server side solution, , current code: main_page/index.html.erb: <p> <b>syptoms / illnesses</b> <%= form_tag search_path, :method => 'get' %> <p> <%= text_field_tag :search, params[:search] %> <br/> <%= submit_tag "search", :name => nil %> </p> <% end %> </p> ...

PHP form submits to itself. When clicking on paginating links. All except the Form, vanishes -

it self-submitting form. have 3 independent select lists selected values passed parameters sql query. when click on button, data displayed fine, limited, , link pages below. but: when click on page links, result set , links disappear sight (only select lists remain in sight). believe related isset condition that, if values have not been set, display form, if values have been set, process form. so, first result set displays correctly, when try go second page form interprets select lists not set because reset , because have not clicked on button if click on links instead , therefore, wipes out not html form. there no error in paginating code. error in how link form paginating method. , can't know how should. if (isset($_post['submitted'])) { /***************if set, process values*************************/ $oldcountry = false; $oldfrom = false; $oldinto = false; // here checking variables have been selected if (isset($_post...

c++ - linking g++ and lib in the make file not working -

i'm compiling g++, when run make, following error: ./libnbmdt.so: undefined reference `inflateinit2_' ./libnbmdt.so: undefined reference `zlibversion' ./libnbmdt.so: undefined reference `inflate' ./libnbmdt.so: undefined reference `inflateinit_' ./libnbmdt.so: undefined reference `inflateend' collect2: ld returned 1 exit status make[2]: *** [nbbid2md] error 1 make[1]: *** [all] error 2 make: *** [nb/nbmdt] error 1 has seen before? guess -l<somelibrary> needed, don't know 1 ... it's c++ program way. guess zlib missing when g++ tries link them? of libraries being used are: mt_vlibs = \ libjansson.a \ libnbi18n.a \ libnbslidlc.a \ libnbslidls.a \ libcurl.a \ libvdb \ libnborb \ libnbbase \ -lvxul \ -lvxssl \ -lvxcrypto i can't share makefile unfortunately. thanks you right - "-lz" flag 1 used. zlib not linked not "inflate" functions. mind following: "-lz" mus...

r.java file - Android Development : id cannot be resolved or is not a field -

so started android development, , i've hit wall. have been looking around whole lot online , on website, can't seem find answer works me. have written down far in activity file following. import android.app.activity; import android.os.bundle; import android.widget.button; public class commanderactivity extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); final button button = (button) findviewbyid( r.id.button_id ); } } it in last line of code ( r.id.button_id ) error arises. xml file looks this: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <tablelayout xmlns:androi...

xslt 1.0 - Accessing current node in predicate with xsl:for-each -

i'm stuck finding out how can access current node whilst iterating on collection of nodes xsl:for-each . xml: <events> <event> <date> <year>2012</year> <month>july</month> </date> <description>...</description> </event> <!-- more events --> </events> what try achieve html-representation this: <h2>2012</h2> <dl> <dt>july</dt> <dd>one of these every event year=2012 , month=july</dd> <dt>august</dt> <!-- ... --> </dl> <h2>2013</h2> <!-- ... --> i'm using xpath-expression distinct years , iterate on them calling template called year parameters $year , $events . getting value $year easy, i'm struggling finding right events. following won't work, because . in second predicate refers event being tested predicate. how access y...

html - Check if a div does NOT exist with javascript -

checking if div exists simple if(document.getif(document.getelementbyid('if')){ } but how can check if div given id not exist? var myelem = document.getelementbyid('myelementid'); if (myelem === null) alert('does not exist!');

How to list files in git only upto n-levels? -

i want list files tracked in git repository. so, git ls-files . doing so, gives me entire list including sub-directories, sub-directories , on.. i not want this. there way can specify depth of output of ls-files command? suppose have git repo: mainrepo/ sub-dir1 subdir1.1 subdir1.1.1 sub-dir2 i want go depth 1, perse. means want ls-files ouput sub-dir1 sub-dir2 a rudimentary way strip each line (and including) optional / character, , unique lines that: $ git ls-files | cut -f1 -d/ | uniq (note haven't been able test yet, because i'm on windows using limited bash shell.)

php - Prevent SQL injection with regular expression? -

possible duplicate: best way prevent sql injection in php i wanted ask need use else code bellow: if(isset($_post['submit'])) { $username = $_post['username']; $password = $_post['password']; $validate = '/^[a-z]+[a-z0-9]*[.-_]*$/i'; if ((preg_match($validate , $username)==true) && (preg_match($validate , $password)==true)) { query... } else { echo "you've used characters aren't allowed."; } }else { echo 'not logged!'; } is regular expression save me sql injection?or can give me other suggestions make login form enought! use mysql_real_escape_string if driver still older one, or prepared statements parameters binding if using newer pdo drivers, or...

c# - Write to same performance counter from multiple processes -

i'm using newer system.diagnostics.performancedata set of api's write counters , increment / decrement single counter multiple processes simultaneously. i've tried tweaking countersetinstancetype in various ways no success: if use multiple or multipleaggregate see single instance in perfmon, there separate counter each process , overwrite each other. same behavior happens single counterset type. when try gloablaggregate counterset type performance monitor doesn't seem read values @ all. answering own question: as documented here: http://msdn.microsoft.com/en-us/library/windows/desktop/ee781345%28v=vs.90%29.aspx you need specify how aggregate counters within manifest file (by setting aggregate attribute each counter). it appear not doing cause counters stay @ 0 / undefined. in case of globalaggregate works perfectly. in case of multipleaggregate has impact on _total instance created counterset automatically (as result of defining multipleagg...

web - Difference between in PHP shell-scripts and PHP on MAMP? -

this weird me. wonder why. wrote php script validate syntax of php script named test.php <?php print("hello world"); ?> the validating script index.php is: #!/usr/bin/env php <?php exec("php -l test.php", $error, $retcode); echo($retcode . "<br />"); var_dump($error); ?> when run on command line php index.php , generates output: 0<br />array(1) { [0]=> string(37) "no syntax errors detected in test.php" } this looks me. however, when run on localhost generates output: #!/usr/bin/env php 5 array(0) { } why $retcode set 5? also, i'm on php5.3 okay, figured out. check http://linux.die.net/man/1/rsync exit code info. the problem have use php interpreter on mamp, is: exec("/applications/mamp/bin/php/php5.3.6/bin/php -l $file",$error,$retcode); the 1 used before php interpreter on os x.

salesforce - Apex Trigger Works, can not get test pass -

i came 3 hours later , no changes code, test execution worked. disregard question i have written trigger works great setting accountid on contact record based on external id. i had test worked great, added logic trigger updates contacts 'default account' account. test fails saying did not update account though still works designed when saving records. what missing? i added line 4 id defaultaccid = [select id account name = 'default account'].id; and if around line 9 if (contactnew.accountid == defaultaccid) { } to trigger: trigger trg_contact_sethouseholdid on contact (before update, before insert) { set<string> accidlist = new set<string>(); id defaultaccid = [select id account name = 'default account'].id; // loop through records finding thoes need linked for(contact contactnew:trigger.new){ if (contactnew.accountid == defaultaccid) { accidlist.add(contactnew.rphouseholdid__c); } } map<string, id> acco...

java - Understanding HashMap<K,V> -

ok, here bit not understand. if attempt retrieve object using get() method , null returned, still possible null may stored object associated key supplied get() method. can determine if case passing key of object containskey() method map. returns true if key stored in map so, how containskey() supposed tell me if value associated key supplied null ? the reference if wanna check. page 553 consider simple snippet of code: map<string, string> m = new hashmap<string, string>(); m.put("key1", "value1"); m.put("key2", null); system.out.println("m.get(\"key1\")=" + m.get("key1")); system.out.println("m.containskey(\"key1\")=" + m.containskey("key1")); system.out.println("m.get(\"key2\")=" + m.get("key2")); system.out.println("m.containskey(\"key2\")=" + m.containskey("key2")); system.out.println("m.get...

xml - Android Search dialog in landscape orientation -

i'm using android search dialog in app, , works fine in portrait orientation. flip landscape orientation searchpage xml appears covered large white dialog box. if search, box still there, , hit button on device or emulator, large white box slides away , there search results. seems somehere in code layout width set fill_parent or something. i've looked around solution , suggested adding android:imeoptions="flagnoextractui" seachable.xml in xml folder, doesn't seem have effect. i've discovered it's onsearchrequested(); method throwing white box fills screen. , may have fact software keyboard isn't called when in landscape, vertical orientation. you create own dialog in form of activity. this: <activity android:theme="@android:style/theme.dialog" android:configchanges="keyboardhidden|orientation|screensize" android:name="exampleactivity" > </activity> this activity can of course...

Black Video CAAnimation and AVFoundation AVAssetExportSession -

i'm relative newbie on whole avfoundation video editing circuit. my current test app 2 screen application, first screen avfoundation video recording (1.mov), , second screen lets view video , put title credits on caanimation. the 1.mov video file recorded in portrait saved disk , run though routine should give me title on top of video. black video of right dimensions, time length catextlayer on it. i'm pretty sure i'm missing basic. have code in place should handle whole landscape portrait rotation. -(ibaction)composemovie:(id)sender { nslog (@"composemovie"); calayer *alayer = [calayer layer]; alayer.frame = cgrectmake(0, 0, videosize.height, videosize.width); calayer *blayer = [calayer layer]; nslog(@"create title"); catextlayer *titlelayer = [catextlayer layer]; titlelayer.string = @"sudo make me sandwich"; titlelayer.font = [uifont boldsystemfontofsize:18].fontname; titlelayer.backg...

coldfusion - CFMail Return to Form -

i have form feedback @ end of webpage sent email address once filled out , submitted users. email sends, browser sent cfm file. i'd able hide form , replace thank message. possible? if not, staying on webpage form ideal. thanks everyone. you can send user ever want. use cflocation after email sent send them somewhere, or keep them on same page , display thank message.

Binding a nested ListView in WPF -

i have simple listview in have listview. can't seem inner listview bound actual list<>, shows empty. my code: public collectionviewsource cvsmain {get;set;} //which list<myclassviewmodel>, main listview bounds correctly public class myclassviewmodel{ public class mysubclass{ public string name{return _name;} } list<mysubclass> mylist = new list<mysubclass>(); public string mytext{get;set;} } my xaml: <listview datacontext="{binding cvsmain}" itemssource="{binding}" > <listview.view> <gridview> <gridviewcolumn displaymemberbinding="{binding mytext}" header="my text"/> <gridviewcolumn header="my list"> <gridviewcolumn.celltemplate> <datatemplate> <itemscontrol itemssource="{binding mylist}"> ...

nosql - What database are better for store and search key/value pair data? -

i need build app main purpose store , search key/value data. type of database purpose? or taking consideration databases purpose of storing , searching data, type of database can fit better in purpose store , search key/value data? nosql? relational? you should use nosql. there no point in using relational database when have no relations whatsoever.

c# - SqlDatasource select command is not selecting values from declared columns , it takes all columns that contain the input value -

i have gridview , sqldatasource. i'm trying select values columns sqldatasource.select command instead of selecting values declared columns search , seletects columns have value searched.also,the value highlighted when found. protected void gridview1_rowdatabound(object sender, gridviewroweventargs e) { if (e.row.rowtype == datacontrolrowtype.datarow) { foreach (tablecell rws in e.row.cells) { if (rws.controls.count == 0) { rws.text = rws.text.replace(search.text, "<span style='background-color:#ffff00;'>" + search.text + "</span>"); } } } } the button1 select command: sqldatasource1.selectcommand = "select * ttbs name '%" + search.text + "%' or age '%" + search.text + "%' or birthday '%" + search.text + "%...

command line - Launch 7zip and fetch the output from the console -

in lazarus (freepascal) project added tasyncprocess options: [pousepipes,postderrtooutput] catch output , show last line. using readdata event, added code show last line if grab text: procedure tform1.asyncprocess1readdata(sender: tobject); var aoutput: tstringlist; icpt: integer; sline: string; begin aoutput := tstringlist.create(); aoutput.loadfromstream(asyncprocess1.output); if (aoutput.count > 0) begin setstatus(aoutput.strings[aoutput.count-1]); end; end; then tryed last non-empty line: procedure tform1.asyncprocess1readdata(sender: tobject); var aoutput: tstringlist; icpt: integer; sline: string; begin aoutput := tstringlist.create(); aoutput.loadfromstream(asyncprocess1.output); if (aoutput.count > 0) begin // last non-empty line icpt := (aoutput.count-1) 0 begin sline := aoutput.strings[icpt]; if length(trim(sline)) > 0 begin setstatus(sline); break; end; end; ...

reflection - How can I get the name of the defined class in a parent static method in Groovy -

note: found answer suggests java redirect static method call it's own class if it's called on child class guess need find groovy work-around trick or it's not going doable. here's problem: created abstract generic "launcher" class "public static void main". idea extend , in child class annotate methods this: @command("show explorere shell") public dir() { "explorer".execute() } the parent of class has main goes through, reflects @command annotation , if method name matches parameter, executes it. the problem can't figure out how tell actual, instantiated class within parent's static main method. i'm pretty sure there trick somewhere--"this" won't work in statics, stack traces don't contain actual class, parent class, , can't find meta-info in class or metaclass objects helps. currently i've gotten work hard-coding name of child class parent's main this: public cla...

osx - PHP ZipArchive zip files won't open in Mac OS -

possible duplicate: dynamically created zip files zipstream in php won't open in osx i'm using php ziparchive allow website users combine few files zip file, , download them. works on fedora linux computer i'm running on. if download files using mac laptop files not unzip, double clicking creates cpgz file. double clicking cpgz file creates cpgz, etc etc. going google search zip-cpgz loop looks pretty common problem, solutions suggest original file poorly formatted; zip of non-existant initial file, zip produced windows machine different file ending, things that. don't think that's case mine because works fine on linux machine. opening zip file in terminal using unzip works, though gives warning warning [filename.zip]: 3 bytes @ beginning or within zipfile (attempting process anyway) i prefer not tell users use terminal though, if can avoid it. here's link 1 of files, can't provide link website i'm operating, it's not ...

I cannot create a controller in ruby on rails. All my gems are not loading? -

rails g controller welcome index c:/program files/ruby.../rubygems/dependency.rb:247: amongst [actionmailer 3.2.3,actionpack...(all rubygems listed here)] (gem::loaderror) c:/program files/ruby-1.9.3.../rubygems/dependecney.rb:256:in 'to_spec' c:/program files/ruby-1.9.3.../rubygems.rb:1231: in 'gem' c:/railsinstasller/ruby1.9.3/bin/rails:18:in '<main>' im beginner ruby on rails, trying make first project. following http://railsinstaller.org , , right when type in first line, next 5 lines error appears. im wondering if problem might 2 different ruby's seem have (in program files , rails installer?). looked through other posts , couldn't find quite this, tried gem install bundler , didn't anything. if know problem or how fix it, appreciate it do $ bundle install @ command line @ root (top directory) of project. your efforts bundler indicate installing not running project.

artificial intelligence - Hebbian learning -

i have asked question on hebbian learning before, , guess got answer accepted, but, problem realize i've mistaken hebbian learning completely, , i'm bit confused. so, please explain how can useful, , for? because way wikipedia , other pages describe - doesn't make sense! why want keep increasing weight between input , output neuron if fire together? kind of problems can used solve, because when simulate in head, can't basic and, or, , other operations (say initialize weights @ zero, output neurons never fire, , weights never increased!) your question seems rather theory-related, , i'm not sure if belongs so, since directly connected neural networks, i'll try answer. we increase weight between input , output neurons if fire because firing means somehow related. let's use example of logic functions. in and function, have 2 input neurons. if input data (0, 0) , means neither input neuron fire, , neither output. don't need strong connect...

objective c - How can I match UITouch objects in Obj-C with corresponding touch objects in WebKit JavaScript? -

i can't figure out way match uitouch objects in uikit corresponding touch objects in javascript. for uitouch, 1 typically uses value returned hash message identify uitouch instance across touch phases. in html / javascript, touch.identifier used , guaranteed unique number across multiple touches. however, numbers returned [auitouch hash] , atouch.identifier not related. ideas on how can match touch objects received in javascript notifications uitouch objects received in obj-c? thanks. the solution came store uitouch objects in dictionary using key derived location. so, touch occurred @ x 120 y 200 stored using key "120:200". happens when overriding sendevent method of main window class. i add information these touches (in case, radius of touch area) , push them dictionary in javascript runtime using similar scheme. in general positions reported webkit match reported window class, javascript runtime able use current location of touch hash lookup to...

Android trying to create a base class for the Activity classes and app crashes -

i thought need if had base class screens on android. not have retype in same stuff,....but crashes when replace activty cbase (my base class) base class public class cbase extends activity{ public void oncreate(bundle savedinstancestate) { } } my class crashes public class tellafortuneactivity extends cbase implements onclicklistener { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); // add add // create adview adview adview; adview = new adview(this, adsize.banner, "a14e10cb6b18825"); // lookup linearlayout assuming it’s been given // attribute android:id="@+id/mainlayout" linearlayout layout = (linearlayout)findviewbyid(r.id.mainlayout); // add adview layout.addview(adview); // initiate generic request load ad adview.loadad(new adrequest()); // add listeners v...

Android - Convert View to JPEG issue -

Image
i have canvas draw chart. when clicking button want generate view jpeg image. in fact, works, resulting image not correspond draw on chart. please see screenshot: i don't have idea happens, in resulting saved image, lines should appear @ top of chart, appears moved lot down. do guys have idea why behaviour may occur? here relevant snippets of code: @override protected void ondraw(canvas canvas) { super.ondraw(canvas); drawlines(canvas); drawpoints(canvas); // other drawing operations converttojpegfile(canvas) } //the method conversion jpeg public void converttojpegfile(canvas canvas) { string imagename = "/chart.jpg"; try { this.setdrawingcacheenabled(true); fileoutputstream fos = new fileoutputstream(new file( environment.get...

ios - Get a view controller's class name as string -

if have uiviewcontroller subclass, how can class name string? i've tried doing [vc class] , returns class object, not nsstring . nsstringfromclass returns name of class string. nsstring * nsstringfromclass ( class aclass );

RepositorySystemSession Null in Maven 3 Plugin Unit Test -

i attempting write unit test maven 3 plugin dependency on aether using maven plugin testing harness. when executing tests though repositorysystemsession null , after extensive search can not figure out how inject session unit tests plugin harness. i using maven 3.0.3 core apis, maven plugin test harness 2.0 , aether 1.12. have tried other various combinations appear missing critical component somewhere along line. the code base example can found here: http://www.sonatype.com/people/2011/01/how-to-use-aether-in-maven-plugins/ . the documentation plugin harness can found here: http://maven.apache.org/plugin-testing/maven-plugin-testing-harness/getting-started/index.html . my example code can seen here: myaethermojo myaethermojotest any ideas on how repositorysystemsession injected container unit test? tia, scott es the plugin testing harness not support aether testing. have use maven invoker plugin demonstrated in how use aether in maven plugins demo code...