Posts

Showing posts from June, 2013

c# - Data format issue. Export GridView to Excel -

there string (1008901023816550000000) in gridview somehow saved scientific number (1.0089e+21) in excel when exported gridview excel. i using .net 4.0. here tried, didn't solve problem: added dataformatstring="{0:g}" boundcolumn tag. set style after rendercontrol called. string style = @" .text { mso-number-format:\@; } "; can shed light on problem? presuming using csv file perform export: this quirk of excel that's hard shake. idea know of try using format inside csv file: ="1008901023816550000000" this force formula returns desired text.

ruby on rails - Running Heroku rake db:migrate on Heroku not migrating the database -

so when run heroku rake db:migrate, after pushing latest code heroku doesn't alter tables. however, when try on pc(where use postgresql) , run rake db:migrate, migrates database , adds necessary tables , fields existing tables. however, heroku, don't errors, response get. sql (2.4ms) select distinct i.relname, d.indisunique, d.indkey, t.oid pg_class t, pg_class i, pg_index d i.relkind = 'i' , d.indexrelid = i.oid , d.indisprimary = 'f' , t.oid = d.indrelid , t.relname = 'flow_elements' , i.relnamespace in (select oid pg_namespace nspname in ('"$user"' ,'public') ) order i.relname sql (2.2ms) select a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull pg_attribute left join pg_attrdef d on a.attrelid = d.adrelid , a.attnum = d.adnum a.attrelid = '"flows"'::regclass , a.attnum > 0 , not a.attisdropped order a.attnum pk , serial sequence (3.7ms) select attr....

css - Absolute positioned div not display full content when the content extends beyond the browser height -

so, issue right have wrapper div overflow: hidden , min-height: 100% stays height of browser window. however, causes issues when have huge population of content on sidebar (shown in linked image) http://d.pr/2jvn if remove overflow: hidden wrapper div it'll funky. what need know how keep content displaying without disappearing. add max-height:100% , overflow: auto @ div. pretty sure going work. better if provided code.

php - What, *specifically*, makes DataMapper more flexible than ActiveRecord? -

i'm comparing doctrine 2 , propel 1.5/1.6 , , i'm looking in of patterns use. doctrine uses datamapper pattern, while propel uses activerecord pattern. while can see datamapper considerably more complicated, i'd assume design flexibility comes complication. far, legitimate reason i've found use datamapper on activerecord datamapper better in terms of single responsibility principle -- because database rows not actual objects being persisted, propel doesn't concern me because it's generated code anyway. so -- makes datamapper more flexible? i've worked both, new propel , doctrine2. datamapper (and mean doctrine2) makes adorable domain objects clean , simple, don't extend irrelevant classes add many irrelevant methods classes (violating srp said). they're simple entities few properties , few methods part of business layer. , that, of course, lets write unit tests them , reuse them in future. i wouldn't datamapper considerably mor...

android - Auto Scale TextView Text to Fit within Bounds -

i'm looking optimal way resize wrapping text in textview fit within getheight , getwidth bounds. i'm not looking way wrap text- want make sure both wraps , small enough fit entirely on screen. i've seen few cases on stackoverflow auto resizing needed, either special cases hack solutions, have no solution, or involve re-drawing textview recursively until small enough (which memory intense , forces user watch text shrink step-by-step every recursion). but i'm sure out there has found solution doesn't involve i'm doing: writing several heavy routines parse , measure text, resize text, , repeat until suitably small size has been found. what routines textview use wrap text? couldn't somehow used predict whether text small enough? tl;dr : there best-practice way auto-resize textview fit, wrapped, in getheight , getwidth bounds? with android 8.0 (api level 26) default feature. https://developer.android.com/guide/topics/ui/look-and-feel/auto...

Plotting Graphs in c -

i beginner in c programming, using gedit of ubuntu 10.04 write c prog, want plot graph, able it, can 1 tell me hw can done or else there way extract data output spreadsheet can plot req, graph?? appreciate help..n thanx!!! medsphere has pretty great gtk# widgets graphing (among other things), you'll need little more clear input/output requirements more specific help.

ldap - VBScript to get DC SYSVOL information (path, size, free space) -

i obtaining information dcs , need pull in path sysvol, total size, , free space remaining. cant done in vbscript , if how? thanks have @ microsoft support page - registry entries in document of sysvol , other ntds directories stored. you might find can information through active directory i'm not sure - check adsiedit shorly.

c++ - Get "Access is denied" when trying to compile with g++ from command line. Cygwin -

Image
i have installed packages in cygwin. have added c:\cygwin\bin path variable. when try compile c++ file in command line error 'access denied'. same commands work in cygwin batch window. know what's wrong? edit: changed permissions gcc , g++. no longer 'access denied' error, new one: "this version of c:\cygwin\bin\g++.exe not compatible version of windows you're running. check computer's system information see whether need x86 (32-bit) or x64 (64-bit) version of program, , contact software publisher.". because c:\cygwin\bin\gcc.exe isn't executable file, it's cygwin symbolic link. $ file /bin/gcc /bin/gcc: symbolic link `/etc/alternatives/gcc' $ file /etc/alternatives/gcc /etc/alternatives/gcc: symbolic link `/usr/bin/gcc-4.exe' the underlying file runs fine. c:\cygwin\home\ben>gcc-4 --version gcc-4 (gcc) 4.5.0 copyright (c) 2010 free software foundation, inc. free software; see source copying conditions....

cocoa - The "edit" button pictogram -

Image
i'd ask you, can find system picture "edit" here: thanks! use character named kpencilleftunicode in carbon's events.h header: 

c++ - Programmatically set DNS nameserver on Linux -

i'd able add ip addresses dns nameservers on linux c/c++ program. i'm on embedded platform read-only /etc/resolv.conf. means can't add "nameserver xxx.xxx.xxx.xxx" line file without little trickery. there clean ways code? i try symlinking /etc/resolv.conf file in tmpfs, seems hackish , feels should able without writing file. have @ nsaddr_list in resolv.conf libc. this question says: although not documented, common way set resolver used update _res.nsaddr_list . in uclibc 0.9.31 there comment on line 533 in resolv.c describing how works.

c# - Request.Browser.Browser and ask.com toolbar -

we're having strange issue our site , ask.com toolbar. somehow, if install ask.com toolbar on client in our network, it's overriding request.browser.browser , request.browser.majorversion on other clients not have ask.com toolbar installed. however, user agent string correct on other clients have toolbar installed. problem restricting access our site based on request.browser.browser , request.browser.majorversion , if ask.com toolbar installed somewhere it's screwing logic we're using restrict access. update: apparently, after short period of time, problem goes away , request.browser.browser , request.browser.majorversion reported correctly though no changes made. so guess have 2 questions: 1) how can installing third-party toolbar on 1 client have effect on asp.net request object? 2) asp.net request object info (because doesn't appear parsing user agent string it)? third party toolbar's ask on writes user agent string of browser. user agent i...

android - openFileOutput FileNotFoundException -

this noob question week. i'm looking more general speculation specific code , maybe hoping android folks watching , correct this: the sdk documentation context.openfileoutput says: open private file associated context's application package writing. creates file if doesn't exist. ok, sounds good. can create file. except method throws filenotfoundexception, apparently amiss. why function supposed create file if it's not found throw exception if file not found??? kinda defeats whole "creates file..." thing, doesn't it? i have apologize leaping before looked on one. kinda panicked while reading documentation. after testing, found openfileoutput() does, in fact, work advertised , will create file if it's not found, not throw fnf exception feared. apparently, fnf throw added in case activity's application directory not exist. again, apologies hopefully, might others confused documentation.

rest - Random RESTful Resource -

i trying design urls can 1 random resource of said type. best route in going this, query params? /fruits/orange?search=random since there's no formal definition rest url designs, answer going quintessentially subjective. however, tend think it's more consistent restful url patterns server random resource via url this: /fruits/orange/random (especially can't think of query parameter key name makes sense use). however, in keeping whole idea of rest seem best /fruits/orange/random redirects user specific entity, e.g., /fruits/orange/4129 .

c# - overriding Form's OnFormClosing for validation -

i'm planning on overriding onformclosing (of system.windows.forms.form) perform validation of user input dialog. if validation fails, set formclosingeventargs's cancel property true: protected override void onformclosing(formclosingeventargs e) { if (dialogresult == dialogresult.ok) { if (!isdialoginputvalid()) { e.cancel = true; return; // not calling base class onformclosing okay here? } } base.onformclosing(e); } my question: should calling base class' onformclosing when cancel close (that is, should remove return above)? my current thinking should not call it, since delegates attached formclosing event wouldn't expect called when dialog has decided not closing. on other hand, i'm nervous perhaps base class' onformclosing other necessary stuff. fyi, i'm new winforms, advice on how should performing validation (if not best approach) appreciated. related link: http:/...

forms - Is there a reasonable way to leverage Spring binding when my model can be represented by a simple type, rather than a custom bean? -

spring binding works nicely when model complex enough warrant custom domain object, application needs receive simple piece of data user doesn't warrant domain object. however, there doesn't seem way handle case. for example, have form user prompted activation code, , nothing more. can represented string . on page, we're asking user accept agreement, , indicate acceptance checking checkbox, submitting form. represented boolean . unfortunately, haven't found way bind these simple types , still retain value-add spring brings table. in case, want use validation, , expose validation errors user via <form:error> tag. end writing mostly-pointless class following: public class verificationbean { private string pin; public string getpin() { return pin; } public void setpin(string pin) { this.pin = pin; } } i toyed idea of using regular <input> tags , pulling user's input handler method @requestparam annota...

How to load an xml file from android's assets folder by name -

i trying load xml file located in /assets folder of android project name using method: getassets().openxmlresourceparser("thefilename.xml"); however, executing code throws "filenotfound" exception, though file located in /assets folder , correct file name. now, have not put file in /res/xml folder because need able 1. edit file right on device , importantly 2. add new xml files application without issuing update, allow easy user modifications. in advance. i think looking either getassets().open("thefilename.xml") or getassets().openfd("thefilename.xml") depending on end use of file is. can see dianne's response in post awhile openxmlresourceparser() not usable gain access files in assets/ directory: http://goo.gl/2kfgt from there have stream feed saxparser or whatever else choose. side note: on points mentioned can't edit files directly in assets/ or add new files assets/ @ runtime. need work files on either int...

jsp - supporting bilingual application struts framework -

i working on bilingual application (english , arabic) struts framework. my application built support english characters. now trying post , read utf-8 encoded characters on jsp pages in tomcat 6 environment. so have basic things set in jsp pages , action class. i have set in action class `request.setcharacterencoding("utf-8"); response.setcharacterencoding("utf-8"); response.setcontenttype("utf-8");` in jsp pages: <%@page pageencoding="utf-8"%> <%@page language="java" contenttype="text/html;charset=utf-8"%> so when try post arabic characters jsp page, displays junk characters. how correct it? else need support arabic or chinese characters? also, using database save form once user fills out application. user can either use english or arablic fill form. how achieve this? you need 2 things utf-8 work post forms. put in top of jsp: <%@ page pageencoding="...

make ie behave like a standards-compliant browser -

i'm looking "the best" script makes internet explorer 6, 7 , 8 behave standards-compliant browser, making support css3, png transparency , other features. it might jquery plugin or raw javascript css. any suggestions? does google chrome frame count? and if doesn't, don't think there javascript library or jquery plugin want. there might odd thing (e.g. curvycorners.js ) may address odd feature, having large number of these cover wide range of features horribly hacky , difficult maintain.

sql server - What is the suggested migration route from mssql extension in php -

this has been asked before can't find anywhere. i have found out mssql extension has been dumped php (i know while ago i'm bit slow). i have legacy app using , mssql_query etc functions. i'm wondering suggested route is? pdo? microsofts driver move db? i'm not entirely averse moving mysql since everytime have move boxes have huge issues getting mssql work correctly php. old mysql extension still supported or need move pdo anyway? is there easy way move pdo? suggestions welcome. pdo recommended anyway abstract db connections, if go mysql i'd highly recommend using it. if you're on windows environments connecting sql server ms sqlsrv library route take. have used odbc_* functions when dealing mssql in past no problems, including calling stored procs own queries. another db didn't have os lock in move though. mysql ubiquitous, don't rule out alternatives without doing research first.

iphone - Is this NSTimer dealloc acceptable or will it produce an unexpected error? -

i duplicating code, refactored this: -(void) dealloc { [self resettimer]; [super dealloc]; } -(void) resettimer { if( timer != nil ) { [timer invalidate]; } timer = nil; // set other value zero... } is acceptable call resettimer method in dealloc method? otherwise end writing same 4 lines in resettimer twice. i did same thing, , worked fine me. (although rely on nil call, it's just:) -(void) resettimer { [timer invalidate]; timer = nil; }

perl help replacing commas and embedding values with ctrl characters -

i need tweaking perl script. i've got input file comma separated values so: to_em,from_em,flags,updated,marks xtr133823@xra.co.nz#hv,abc@def.com,16,2007-08-18 16:18:50,33 the first row column names to_em from_em flags updated marks , following record values each column: to_em = xtr133823@xra.co.nz#hv from_em = abc@def.com flags = 16 updated = 2007-08-18 16:18:50 marks = 33 i creating unique value (md5), prefixed " __pkey__ ". each column name starts ^e . each value starts ^a , including hex value. record end ^d . i want final output file this: __pkey__^ad41d8cd98f00b204e9800998ecf8427e^eto_em^axtr133823@xra.co.nz#hv^efrom_em^aabc@def.com^eflags^a16^eupdated^a2007-08-18 16:18:50^emarks^a33^e^d but, coming out this: __pkey__^ad41d8cd98f00b204e9800998ecf8427e^e^ato_em^e^d__pkey__^a5c09354d0d3d34c96dbad8fa14ff175e^e^axtr133823@xra.co.nz#hv^e^d here's code: use strict; use digest::md5 qw(md5_hex); $data = ''; while (<>) { $di...

iphone - Very odd UIImagePickerController behavior (Pic attached) -

Image
i've been totally unable bottom of this. capturing camera image. preview image looks image below? the resulting captured image fine. it's preview appears image below? that's image there in middle..... tiny... ? screenshot of issue: anyone have idea? the code using: //open camera view uiimagepickercontroller *picker = [[uiimagepickercontroller alloc] init]; picker.sourcetype = uiimagepickercontrollersourcetypecamera; picker.allowsediting = yes; picker.delegate = self; picker.modaltransitionstyle = uimodaltransitionstylefliphorizontal; [self presentmodalviewcontroller:picker animated:yes]; [picker release]; thanks help.

ios - kqueue on iphone? -

i porting linux server ios. single threaded, event driven design uses kqueue on osx handle sockets , other events. there similar on ios? thanks! you try using corefoundation. cfrunloop can run event loop you, sources including file descriptors , sockets.

Need some clarification on HTML DOCTYPEs -

i used pspad wordpress template , realized doctype defaulted to: <!doctype html public "-//w3c//dtd html 4.01 transitional//en"> as fancybox suggests proper doctype, tried few of following listed here: http://www.alistapart.com/articles/doctype/ my dilemma if change doctype now, website looks worse (things off-center being common). i'd appreciate hearing suggestions on how best proceed. default pspad doctype incorrect , should have started 1 of "official" ones instead? better off spending few days redesigning match "official" doctype? if use website in career portfolio, need concerned if leave doctype is? just not sure how proceed here. thanks. edit: ironically, took time begin in attempting ensure website looked same in both firefox , internet explorer. best way proceed switch proper, valid doctype. spend time fix issues come up, , you'll setting easier maintenance in future. yes, default pspad doctype incorr...

java - Calling a function when I click on a link -

so in jsf page have outputtext content generate managed bean. <h:outputtext value="#{bean.show(id)}" /> then here method show() inside managed bean bean . public string show(long fromuserid){ user = myejb.finduserbyid(fromuserid); string content = ""; //this method contains complex business logics, below illustration if(...){ content += ... ; //generate content here content += "<a href=\"profile.jsf?userid=" + fromuserid + "\">"; content += from.getfname() + " " + from.getlname() + "</a> }else if(...){ //code required access database content += ...; }else if(...){ content += ...; } ... return content; } so on page, have content , link link profile page. want when click on link, i want invoke method run of business logic before redirect me profile.jsf page . guess need write javascript when c...

java - Enter value in JTable cell and click OK does not register value -

i have jtable has cells editable. if user enters in value editable cell , clicks ok button on form, code: // value in editable cell string value = model.getvalueat(row, column); does not pick entered value. the way entered value picked above code once user has pressed enter after typing in value or clicking in cell value "pushed in". does know code write "push" value in when click ok button? see table stop editing solution.

python - How to build a IMS open source corpus workbench and NLTK readable corpus? -

currently i've bunch of .txtfiles. within each .txt files, each sentence separated newline. how change ims cwb format it's readable cwb? , nltk format. can lead me howto page that? or there guide page that, i've tried reading through manual dont know. www.cwb.sourceforge.net/files/cwb_encoding_tutorial.pdf does mean create data , registry directory , run cwb-encode command , converted vrt file? convert 1 file @ time? how script run through multiple file in directory? it's easy produce cwb's "verticalized" format nltk-readable corpus: from nltk.corpus import brown out = open('corpus.vrt','w') sentence in nltk.brown.sents(): print >>out,'<s>' word in sentence: print >>out,word print >>out,'</s>' out.close() from there, can follow instructions on cwb website .

linux - Why does my threaded Perl script segfault? -

i'm writing curses script requires cleanup after processing sigint in order return terminal original status. i segfault when signal handler enabled. for support's sake, removed curses code boil problem down. code: #!/usr/bin/env perl use strict; use warnings; use threads; sub cleanup { exit 0; } sub run { while (1) {} } # comment line , problem disappears $sig{int} = \&cleanup; foreach $i (1..100) { print "creating thread\n"; $t = threads->create(\&run); print "created thread\n"; } while (1) { print "looping\n"; } sample error trace (segfaults 90% of time): $ ./threadtest.perl ... creating thread creating thread detaching thread detaching thread creating thread ^csegmentation fault $ specs: threads 1.72 archname "" os "" perl 5.10.1 (came debian) debian 6 squeeze initial impression: i think problem occurs when custom signal handler grabs control. somehow prevents ne...

Noncommutative Multiplication and Negative coeffcients at the Beginning of an Expression in Mathematica -

with of gracious stackoverflow contributors in post , have following new definition noncommutativemultiply (**) in mathematica: unprotect[noncommutativemultiply]; clearall[noncommutativemultiply] noncommutativemultiply[] := 1 noncommutativemultiply[___, 0, ___] := 0 noncommutativemultiply[a___, 1, b___] := ** b noncommutativemultiply[a___, i_integer, b___] := i*a ** b noncommutativemultiply[a_] := a c___ ** subscript[a_, i_] ** subscript[b_, j_] ** d___ /; > j := c ** subscript[b, j] ** subscript[a, i] ** d setattributes[noncommutativemultiply, {oneidentity, flat}] protect[noncommutativemultiply]; this multiplication great, however, not deal negative values @ beginning of expression, i.e., a**b**c + (-q)**c**a should simplify to a**b**c - q**c**a , not. in multiplication, variable q (and integer scaler) commutative; still trying write setcommutative function, without success. not in desperate need of setcommutative , nice. it helpful if able pull...

.net - Invalid attribute value inputToolkit:ButtonSpinner for property TargetType -While Xap Loading -

this exception got, system.windows.markup.xamlparseexception unhandled user code message="system.windows.markup.xamlparseexception: invalid attribute value stylepalette property property. [line: 6024 position: 26]\r\n @ ms.internal.xcpimports.createfromxaml(string xamlstring, boolean createnamescope, boolean requiredefaultnamespace, boolean alloweventhandlers, boolean expandtemplatesduringparse)\r\n @ ms.internal.xcpimports.createfromxaml(string xamlstring, boolean createnamescope, boolean requiredefaultnamespace, boolean alloweventhandlers)\r\n @ system.windows.markup.xamlreader.load(string xaml)\r\n @ system.windows.controls.theming.resourceparser.parse(stream stream, boolean checktypes)\r\n @ system.windows.controls.theming.theme.loadtheme(stream themeresourcestream)\r\n @ system.windows.controls.theming.theme..ctor(assembly themeassembly, string themeresourcename)\r\n @ system.windows.controls.theming.twilightbluetheme..ctor() [line: 0 position: 0]\r\n ...

c# - What is recommended way to perform async tasks in WPF? -

are there standard tools, or recommended approaches async tasks execution? upd understand, how use threads. need know recommended wpf way block ui while performing async call, , how update progress info. you can use several ways, example: thread pool background worker plain old threads and since .net 4, preferred way use tasks .

php - Kohana: why won't this route generate fully? -

i have following route in bootstrap: route::set('cycleadmin', '(<lang>/)cycleadmin(/<model>(/<action>(/<id>)))', array( 'lang' => $lang_options, 'model' => '[a-z_]{0,}', 'action' => '[a-z_]+', 'id' => '\d+', ))->defaults(array( 'controller' => 'cycleadmin', 'lang' => default_lang, 'model' => 'cycle', 'action' => null, )); then have following uri request generate route: echo route::get('cycleadmin')->uri(array('action' => 'add')); but ends returning: /cycleadmin i'm using kohana 3.1 (v3.1.1.1). worked in kohana 3.0.9. what missing? try set <model> . work? regards sorin

parallel processing - Is this PLINQ bug? -

why plinq output different sequential processing , parallel.for loop i want add sum of square root of 10,000,000 numbers.. here code 3 cases: sequential loop: double sum = 0.0; for(int = 1;i<10000001;i++) sum += math.sqrt(i); output of is: 21081852648.717 now using parallel.for loop: object locker = new object(); double total ; parallel.for(1,10000001, ()=>0.0, (i,state,local)=> local+math.sqrt(i), (local)=> { lock(locker){ total += local; } } ); output of is: 21081852648.7199 now using plinq double tot = parallelenumerable.range(1, 10000000) .sum(i => math.sqrt(i)); output of is: 21081852648.72 why there difference between plinq output , parallel.for , sequential loop? i suspect it's because arithmetic doubles isn't associative. information potentially lost while summing values, , what information lost depend on order of operations. here's example showing effect: using system; class test { sta...

c# - Add Custom action to VS 2008 Setup project -

im using vs 2008 , have created application , setup file using c#. setup file contain standard setup interfaces provide visual studio 2008. need check windows registry , folder path , copy files application folder while installation. need add custom code while installation. standard interfaces. welcome installation folder confirm installation progress finished need. welcome installation folder confirm installation progress my custom action interface finished my custom action performs below action. ex: registry path. object test= registry.getvalue("hkey_local_machine\\software\\kofax image products\\ascent capture\\3.0" ,"exepath",null) if(test!=null) { ///copy files application folder test path. } how can that? you can always create own custom action (based on existing panels ui) take @ scott's post entry on subject you can find there how create setup project , add custom a...

php - include $page; NOT working -

hi have included in index.php include $page; but not working on live server working fine on localhost. have included include ('includes/_ini.php'); on top of index.php page in $page defined. please suggest on server giving following warning warning: include(?pgid=1&parid=&rid=1&lang=1) [function.include]: failed open stream: no such file or directory in /opt/lampp/htdocs/mysite.com/index.php on line 290 warning: include(?pgid=1&parid=&rid=1&lang=1) [function.include]: failed open stream: no such file or directory in /opt/lampp/htdocs/mysite.com/index.php on line 290 warning: include() [function.include]: failed opening '?pgid=1&parid=&rid=1&lang=1' inclusion (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/mysite.com/index.php on line 290 the include() statement includes , evaluates **specified file** . look @ warning: warning: include(?pgid=1&parid=&rid=1&lang=1) compare ...

Need Android tabhost back press navigation -

friend's, implemented tabhost in application,i have 3 tabs defined in activity tab1,tab2,tab3...here have problem navigate tab3 tab1 @ onkey pressed event ,how can reach tab1 tab3 , tab2,i tried using overided keyback pressed,but times it's not responding navigate.without overriding onkey pressed exits application. here code tabhost= gettabhost(); tabhost.addtab(tabhost.newtabspec("tab1").setcontent( new intent(this, dealcities.class)).setindicator(preparetabview("deals",r.drawable.test))); tabhost.addtab(tabhost.newtabspec("tab2").setcontent(new intent(this, dbserveractivity.class)) .setindicator(preparetabview("my quaddeals",r.drawable.mydeal))); tabhost.addtab(tabhost.newtabspec("tab3").setcontent(new intent(this, account.class)) .setindicator(preparetabview("my account",r.drawable.img_myaccount))); here tabhost defined...

linux show process ram usage -

free shows centos system used 4/11 gb ram, can't pinpoint process has used them. used top, shows 1 process(mysqld) used 1gb. what's going on? # free -g total used free shared buffers cached mem: 11 4 7 0 0 3 -/+ buffers/cache: 0 11 swap: 1 0 1 sks: 91 total, 1 running, 90 sleeping, 0 stopped, 0 zombie cpu(s): 0.0%us, 0.1%sy, 0.0%ni, 99.9%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st mem: 12299928k total, 4372572k used, 7927356k free, 77392k buffers swap: 2097144k total, 0k used, 2097144k free, 3925252k cached pid user pr ni virt res shr s %cpu %mem time+ command 1 root 18 0 10352 704 588 s 0.0 0.0 0:00.82 init 2 root rt -5 0 0 0 s 0.0 0.0 0:00.01 migration/0 3 root 34 19 0 0 0 s 0.0 0.0 0:00.00 ksoftirqd/0 4 root rt -5...

android - Append Non-Editable String to EditText -

is there anyway append string edittext value, string appended not editable? i.e. have edittext email addresses, want treat email address single entity rather single characters. therefore if users deletes last character of email address, want whole email address removed rather last character. i've been looking @ spannable can't see obvious. similar how gmail , other apps it. reposting comment answer (and modifying words make suggestion clearer). have [ ontextchanged ]( http://developer.android.com/reference/android/widget/textview.html#ontextchanged(java.lang.charsequence , int, int, int)) attached edittext notified of user input. can check length of contents of edittext , , if decreases 1, can assume user deleted character. if user entered me@sample.com on ontextchanged , can set text empty string. of course have checking first make sure user has entered complete email address before applying change. like, maybe make sure user has entered @ character...

javascript - How to override jQuery global functions for my plugin? -

i have created plugin creates check box image based based on hidden field. override is() function... possible? i'm using image mock checkbox. html: <input type="hidden" value="1" id="box" /> create plugin hidden field: $('#box').mycheckbox(); i able following: $('#box').is(':checked'); is possible override is() function in plugin? yep :) (function() { var proxied = jquery.fn.is; jquery.fn.is= function() { //do things here return proxied.apply(this, arguments);//call default here }; })(); btw :checked supported default so if u had $('#checkbox').is(':checked');// return true/false depending if checkbox ticked or not don't on complicate things pull ur hair out later on when u forgot u made overriding changes :)

html - How to turn off scroll bars without clipping? -

my website design (www.benjaminchirlin.com, know bit heavy @ moment, still need compress images) demands large fullscreen divs animate across main screen on menu clicks opposed scrolling horizontally. design largely image based have overflow set hidden on each menu div. however, when browser window smaller image content of div, animated divs clipped window size user can see animate left , right. is there way remove scrolls bars window without clipping images? thanks. i position menu divs underneath div 100% height , pixel min-height , negative margin, rather using bottom position. long signposts long enough accommodate big screens, should pretty set. but congratulations on innovative design, btw. impressed.

Windows CMD: Determine which application is using a file -

this isn't programming question... there ways determine application using file? i've been infected 1 of autorun.inf viruses. when try delete autorun.inf windows tells me files in use application (obviously, virus). can find out application using file? i'd easier grab free antivirus i'd first try , remove malware myself before try else (could useful knowledge). you can use sysinternals' process explorer or process monitor that.

logging 2 files every day with log4net -

so wanna log 2 separate files on daily basis. i'm new log4net did usual stuff.. google , google until works :) , works fine, can't make log files every day. here code: web.config: <log4net> <appender type="log4net.appender.rollingfileappender" name="allapp"> <file value="c:\\mylogs\\app.log" /> <appendtofile value="true" /> <rollingstyle value="composite" /> <datepattern value="yyyymmdd" /> <layout type="log4net.layout.patternlayout"> <param name="conversionpattern" value="%d [%t] %-5p %c [%x] - %m%n" /> </layout> </appender> <appender type="log4net.appender.rollingfileappender" name="servicelog"> <file value="c:\\mylogs\\servicelog.log" /> <appendtofile value="true" /> ...

c# - Too "big" Arrays. Do I need a DataBase? Or are there other options? -

i encountered outofmemory error in program due (i guess) excessive use of arrays , double multidimensional arrays (one around 5000x60 elements). i'm searching alternative storing information. are databases alternative? or there other way store information arrays can free memory? read possibility of manually allocating memory (or splitting in chunks? don't recall was) that's not option guess because arrays , objects grow more in size sooner or later i'd reach (in theory) limits of physical ram. although might wrong here. i'm not asking huge code examples, links tutorials or reads (books ok although should able order them in germany without billions of dollars shipping costs ;-)) perfect. also: no, never did databases i'm willing learn anything. thanks in advance help. edit: fixed "double array" "multidimensional array". edit2: thought there might "universal" solution problem huge arrays prooved me wrong. because it...

java me - How to add mobile number to blackberry contact editor in programatically from my blackberry application? -

i developing 1 application in have contact details ,when click contact number ask option call or sms or add phone contact. implemented call , sms, when trying implement add number ,name ,email in phone contact getting struggle. below code used add contact try { contactlist contacts = null; try { contacts = (contactlist) pim.getinstance().openpimlist(pim.contact_list, pim.read_write); } catch (pimexception e) { // error occurred return; } contact contact = contacts.createcontact(); string[] name = new string[ contacts.stringarraysize( contact.name) ]; name[contact.name_given] = "kate"; name[contact.name_family] = "turner"; contact.addstringarray(contact.name, contact.attr_none,name); contact.addstring(contact.email, contact.attr_none, emailaddressto);...

Re-using code in unit tests -

i have rest web-service interface calls-down service layer orchestrates creation, deletion, etc. of various objects in entity-layer. these entity-layer objects map database records. have number of unit tests (in nunit, c# application) test interface sending http requests. consider testing of web service request creates entity-layer object. want verify web service considers request have been processed correctly, checking http status returns me plus data in response body. want independently verify correct database records have been created. have couple of ways (that can think of) this: the easiest way use existing 'reader' classes in entity layer read , validate database entries. easy because incorporate validation , consistency logic entities deal with, , using them simple. uneasy this, though, because using code i'm testing part of test. seems violate principle of separation of concerns, , introduce possibility of entity-layer bug causing object creation fail appe...

javascript - what does this.id return? -

function test(){ alert(this);//alerts oblect alert(this.id);//alerts undefined } <input type="text" onkeypress="test();" id="text1"> why alert(this.id) alert undefined ? because this returns document object? thank you your code should be. function test(objref){ alert(objref);//alerts oblect alert(objref.id);//alerts undefined } <input type="text" onkeypress="test(this);" id="txtnum" /> edit: may use following code too. <script type="text/javascript"> window.onload = function() { var txtnum = document.getelementbyid("txtnum"); txtnum.onkeypress = function() { alert(this); alert(this.id); }; }; </script> <input type="text" id="txtnum" />

How to create deferenced copy of an object in C#? -

i have entity use bind data wpf ui. in need create copy of entity can use "original" data anytime. just creating new object , assigning carries references it. need copy of entity object has no effect of changes made on source. my entity contains value type properties , several nested collections. any suggestions/ideas on this? you need write own copy constructor: shows how. http://msdn.microsoft.com/en-us/library/ms173116(v=vs.80).aspx for collections need copy data too. array.copy work hashtable might need go far serialization or recreating table. sometype[] myarray = new sometype[orig.count+ 1]; orig.copyto(myarray, 0);

javascript - HREF being modified beyond my control...? -

i'm not sure if jquery, javascript or quirk in browser consider code: for(rowidx=0;rowidx<theresultset.rows.length;rowidx++) { thisline = $("#testtemplateli").clone().attr({'id':'test_'+rowidx}).appendto("#test_exerciselistul"); thisline.find('[href*="#pageexercise_exercisenumber"]').each( function(i) {this.href = this.href.replace('exercisenumber', rowidx)} ); } the goal of code above clone list item ( <li> , embedded below) html fragment, modify address anchor elsewhere on page , insert unordered list ( <ul> ). works using wonders of jquery. problem once it's been modified, anchor doesn't seem work. after mod href programattically, returns full url, not anchor reference. example: <ul id='testtemplate' style="display:none"> <li class='arrow' id='testtemplateli'> <a href='#pageexercise_exercisenumber'> <...

ruby on rails - Get attribute of ActiveRecord by name -

i have partial, used in many places of project. it renders items, related specified tag, like: @tag.articles.each |a| # render articles end i need partial render not articles, other items, associated tags. so, partial has 1 parameter association_name , looks this: @tag[association_name].each |a| # render articles end i call partial in following ways: # render articles render :partial => "items", :locals => {:association_name => "articles"} # render videos render :partial => "items", :locals => {:association_name => "videos"} # etc. the problem - cannot refer fields of article model in way: @article[association_name] how , why does't works ? @article.send(association_name)

database - MySQL CSV Row to multiple Rows -

i need migrate old database new one. unfortunately guy wrote old database created n,n relation using field comma separated foreign keys. i write mysql query (maybe using insert ... select) splits comma seperated foreign keys can build table each row foreign key. is possible? it's not straightforward in pure sql. easiest retrieve each record in turn using programming language of choice , insert many-to-many join table records based on comma separated field. following pseudo code suggests approach might use: for each (id, csv_foreign_keys) in source_rows foreign_keys = split ',', csv_foreign_keys each fk in foreign_keys insert (id, fk) many-to-many link table once you've done this, existing column holding comma separated foreign keys can removed.

c# - T must be contravariantly valid -

what wrong this? interface irepository<out t> t : ibusinessentity { iqueryable<t> getall(); void save(t t); void delete(t t); } it says: invalid variance: type parameter 't' must contravariantly valid on 'mynamespace.irepository.delete(t)'. 't' covariant. consider happen if compiler allowed that: interface ir<out t> { void d(t t); } class c : ir<mammal> { public void d(mammal m) { m.growhair(); } } ... ir<animal> x = new c(); // legal because t covariant , mammal convertible animal x.d(new fish()); // legal because ir<animal>.d takes animal and tried grow hair on fish. the "out" means "t used in output positions". using in input position.

How to find sibling of a control that raised an event in DataGrid WPF -

i have datagrid whole columns given below. <my:datagrid.columns> <my:datagridtemplatecolumn header="last name" minwidth="160" sortmemberpath="[last_name]"> <my:datagridtemplatecolumn.celltemplate > <datatemplate> <textblock name="lbllastname" padding="5" text="{binding [last_name]}" /> </datatemplate> </my:datagridtemplatecolumn.celltemplate> </my:datagridtemplatecolumn> <my:datagridtemplatecolumn header="new age group" isreadonly="true" minwidth="130"> <my:datagridtemplatecolumn.celltemplate> <datatemplate> <combobox selectedvalue="{binding agegroupid}" displaymemberpath="agegroupname" itemssource="{binding}" ...

sql - Month statistics -

i have table in postgres , mysql 'created_at' column. query following: month count 1 0 2 0 3 0 4 12 5 15 ... can cough sql? notice months no rows returned must listed 0's. have this: select month(created_at) month, count(*) c `sale_registrations` (created_at>='2011-01-01' , created_at<='2011-12-31') group month(created_at) order month(created_at) use extract(month created_at) month. works in mysql well. edit: use right join on table month numbers: create table months(nr tinyint); insert months(nr) values (1),(3),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12); select nr month, count(*) c sale_registrations right join months on extract(month created_at) = nr (created_at between '2011-01-01' , '2011-12-31') group extract(month created_at) order extract(month created_at) asc; in postgresql use generate_series(), that's not going work in mysql.

c++ - ImportError: dynamic module does not define init function, but it does -

i'm trying write binding vendor c++ library. i've used snippets such below define init functions in other modules, in 1 doesn't seem work: compiles fine, throws importerror try import test script. wrong here? #ifndef pymodinit_func /* declarations dll import/export */ #define pymodinit_func void #endif pymodinit_func initclient(void) { pyobject* m; clienttype.tp_new = pytype_genericnew; if (pytype_ready(&clienttype) < 0) return; m = py_initmodule3("client", client_methods, "client module"); py_incref(&clienttype); pymodule_addobject(m, "client", (pyobject *) &clienttype); } this on 32-bit linux, gcc 4.4.4. i had same issue. @ compile time: path python header: ok path python library: ok link against python library: ok link against needed third parties libraries/object files: ok i forgot compile c file defines module... sigh... so yeah, first thing check: makefile or ...

internet explorer - Jquery JScrollPane causes Error in IE -

i'm doing first site using jquery , added jscrollpane plugin. everything fine in firefox , safari, in ie (obviously) gives me problem can't figure out: when call "jscrollpane" function, causes fault in jquery , mess page! (obviously in ie) if want see page here's link: http://www.klaber.it/demo just click on "prodotti" , click first submenu voice... figured out tests ! on ie status bar throw error when jscrollpane called... it's driving me crazy... help. dario you have code in myfunctionnew.js file $("#datiprodotto").load("prodotto.asp?mypnum=" + showscheda, function() { $('#slider').show(); $('#slider').nivoslider({ effect: 'slicedown', //specify sets like: 'fold,fade,slicedown' slices: 1, animspeed: 500, //slide transition speed pausetime: 4000, startslide: 0, //set starting slide (0 index) directionnav: false, //ne...

java - Ejb3 stateless bean with CMT -

is possible have this? client code in thread pseudo code : transaction.begin(); ejb.method(); transaction.commit(); the method() belongs ejb3 stateless session bean, annotated transactionattributetype.required . method() set setrollbackonly() . if ejb method sets setrollbackonly(), should there checks before trying commit transaction? thanks! you set transaction attribute on called bean (method) transactionattributetype.requires_new force new transaction on method. btw: make sure call proxied methods if specify transaction attribute on method . i.e., calling method of ejb has specific transaction attribute set within same ejb not work expect...

mercurial - Select a modification in hg diff -

with hg diff mercurial show me modifications, separated @@ . can 1 of them? if on windows, recommend installing tortoisehg , using hgtk status

wpf - frontend application in java -

can develop java frontend application in wpf? runs on windows platform? of course, use swing or swt .