Posts

c++ - How to get address of printf function in arm executable -

i have assingment make loader arm elf relocatible files. have managed parse elf somehow, , managed make simple relocations, have following , have trouble. need call printf function inside elf file trying load, , must same printf function 1 program trying load it. (thats host program, writen in c++ arm arch). how can printf address, , after how can relocate symbol in elf file. (i googled , found out type of relocation uses 24-bit pc relative addressing) can me extract address of printf? thanx in advance! if can understand c++, use source luke. arm-reloc-property.cc arm-reloc-property.h arm-reloc.def elf32-arm.c see: assemblers , loader , david solomon . [some pearls of wisdom, archaic trivia] as understand, printf in same file , need patch address @ run-time. in case, relocation 24-bit pc relative relocation. answer nothing in case. executable , implementation both in same binary, 24-bit pc relative relocated no matter load address is. if relocating sha...

database - SQL Server backup command fails via Perl/DBI but works via DOS> SqlCmd. Why? -

i have simple perl/dbi program backup sql server databases. program runs cleanly, produces no errors, supposedly creates database backups, backup files not exist! when execute following command via dbi, backup database dz disk='c:\sqlbackups\dz.perl' init no backup file created. perl , sql report "processed x pages database 'y', backup file not appear when execute dos> dir when execute similiar command via sqlcmd, backup database dz disk='c:\sqlbackups\dz.sqlcmd' init a backup file created. i'm running activestate perl version perl 5, version 16, subversion 1 (v5.16.1) built mswin32-x64-multi-thread on microsoft windows 7 professional build 6.1 (build 7601; service pack 1) here's program #!perl -w #test making database backups via perl dbi #preparations use strict; #require variable declaration use dbi; #database interface $dbhandle = dbi->connect("dbi:odbc:driver={sql server};se...

.htaccess - htaccess regex Keep spiderbots outside -

i can't part of htaccess working : rewriteengine on rewritebase / rewritecond %{http_user_agent} ^(360spider|acoon|ahrefs|aihit|altushost|amazon|archive|airjordanin|applecreek|baidu|bezeqint|bilbo|bork|botje|butterfly|buy) [nc,or] rewritecond %{http_user_agent} ^(catchbot|career|cloud-ips|coach|contabo|corbina) [nc,or] rewritecond %{http_user_agent} ^(dataprovider|digext|discobot|dotbot|ec2|edisterbot|energis|ephorus|exabot|exigen|ezooms|fastlink|genieo|huaweisymantecspider) [nc,or] rewritecond %{http_user_agent} ^(iguana|ileadz|ipxserver|jaunty|jadynave|jikespider|keywordspy|kimsufi|kobala|komodiabot|koula|longchamp) [nc,or] rewritecond %{http_user_agent} ^(magpie|majestic12|malas|media|michael|mj12bot|modx|mohitseo|mor306|mulberryoculos) [nc,or] rewritecond %{http_user_agent} ^(nashirnet|ncsa|netwiz|obot|openindex|osso|panscient|pathcom|peoplepal|piki|presto|purity) [nc,or] rewritecond %{http_user_agent} ^(santrex|scoutjet|shabnet|sistrix|siteexplorer|softlayer|sogou|sos...

hadoop - How to run large Mahout fuzzy kmeans clustering without running out of memory? -

i running mahout 0.7 fuzzy k-means clustering on amazon's emr (ami 2.3.1) , running out of memory. my overall question: how working easily? here invocation: ./bin/mahout fkmeans \ --input s3://.../foo/vectors.seq \ --output s3://.../foo/fuzzyk2 \ --numclusters 128 \ --clusters s3://.../foo/initial_clusters/ \ --maxiter 20 \ --m 2 \ --method mapreduce \ --distancemeasure org.apache.mahout.common.distance.tanimotodistancemeasure more detailed questions: how tell how memory i'm using? i'm on c1.xlarge instances. if believe aws docs , sets mapred.child.java.opts=-xmx512m. how tell how memory need? can try different sizes, gives me no idea of size of problem can handle. how change memory usage? start different workflow different class of machine? try setting mapred.child.java.opts? my dataset not seem large. it? vectors.seq collection of sparse vectors 50225 vectors (50225 things related 124420 others), total of 1.2m relationships. ...

Replace certain part of a php string -

i have text (in specific case $expression ) , quite long. want output text same way is, except outputting numbers % bold. spelled 3% , there's space 123 % . <?php $expression = 'here got number 23 % , on'; $tokens = "([0-9]+)[:space:]([\%])"; $pattern = '/[0-9][0-9] %/'; $keyword = array($pattern); $replacement = array("<b>$keyword</b>"); echo preg_replace($keyword, $replacement, $expression); ?> this have i'm not sure i'm doing wrong. outputs error on line $replacement = array("<b>$keyword</b>"); , outputs actual string except replaces number% <b>array</b> . try $expression = 'here got number 23 % , on'; var_dump(preg_replace('/(\d+\s*\%)/', "<b>$1</b>", $expression));

javascript - If there is no distinction between classes and objects why doesn't this code work? -

i taught in javascript there no distinction between objects , classes. can explain why code generate error: var firstobj = function() {}; firstobj.prototype.sayhi = function() { document.write("hi!"); }; firstobj.sayhi(); whereas 1 works: var firstobj = function() {}; firstobj.prototype.sayhi = function() { document.write("hi!"); }; new firstobj().sayhi(); what's difference? why isn't first 1 working? the key issue here firstobj variable function object, not firstobj object. subtle distinction, type of object determines prototype inherits. the prototype template applied newly created objects of particular type. must create firstobj object (usually new invokes constructor , assigns prototype) in order have template applied it. in first example, firstobj variable function object, not firstobj object has prototype of function not of else.. in second example, create firstobj object inherits prototype type of object. if...

java - Constructor is undefined in ArrayAdapter -

i trying populate listview control in android app. have looked @ many code samples , seem suggest doing way. however, when try implement following error: the constructor arrayadapter(mainactivity.readjsontask, int, arraylist) undefined protected void onpostexecute(string result){ try{ listview lv = (listview)findviewbyid(r.id.lstitems); jsonobject jsonobj = new jsonobject(result); arraylist<string> items = new arraylist<string>(); iterator<string> looper = jsonobj.keys(); while(looper.hasnext()){ string key = looper.next(); items.add(jsonobj.get(key).tostring()); } adapter = new arrayadapter<string>(this, android.r.layout.simple_list_item_1, items); lv.setadapter(adapter); }catch(exception ex){ log.d("readadscendjsontask", ex.getlocalizedmessage()); } } wha...