Posts

Showing posts from August, 2015

iphone - hiding tableview index dynamically -

in iphone sdk, there way dynamically decide whether or not show index @ side of table view, , sections well? example, show index "a...z" if table has on 50 entries, hide if it's less that. can decided dynamically? using uilocalizedindexedcollation display index. thanks! uitableview has property called sectionindexminimumdisplayrowcount - number of table rows @ display index list on right edge of table.

android - How to get gmail user's contacts? -

i need retrieve email addresses user has stored in gmail account. in app, user can decide invite friend of him. want application (if user tell me "ok") presents list of user's contacts email addresses stored in gmail, among can choose 1 or more... i know exists authentication , authorization google apis" . right way? and, how use them in android? the question , accepted answer @ get contact info android contact picker has example of how use android native contact-picker.

java - maven and unit testing - combining maven surefire plugin AND testNG eclipse plugin -

could please share way of unit testing in eclipse ? using surefire plugin, m2eclipse & maven, or testng eclipse plugin ? combine these alternatives ? i'm using testng + maven surefire-plugin , had been using testng eclipse plugin year ago see results in testng view. started using maven, when "maven test phase" using m2eclipse, there console output , surefire reports can check in browser , choose test suite, test, or test method can set via testng.xml. on other hand, if use surefire plugin , have specific settings regarding classpath etc., rely on, running tests via testng eclipse plugin doesn't have compatible code. using surefire plugin, classpath different - target/test-classes , target/classes - using testng plugin, using project classpath. how go talking about? is possible synchronize "maven test" using m2eclipse , surefire plugin testng eclipse plugin , view ? edited: i'm wondering, why maven project ("java build path")...

iphone - Error: Parameter name omitted -

i'm trying have auto reversing animation, , getting above error on "completion:^(bool)finished{" line. [uiview animatewithduration:0.5 delay:0 options:uiviewanimationoptionautoreverse animations:^{ [[[self diebuttons] objectatindex:i] settransform:cgaffinetransformmaketranslation(0, 200)]; } completion:^(bool)finished{ }]; note first attempted following code button jumped new location @ end of animation. [uiview beginanimations:nil context:nil]; [uiview setanimationduration:0.5]; [uiview setanimationrepeatautoreverses:yes]; [button settransform:cgaffinetransformmaketranslation(0, 200)]; [uiview commitanimations]; finished name of bool parameter, , objective-c blocks have c-style function signatures, has in parenthe...

mysql - ORDER BY uses all rows -

i want show 10 latest forum topics , ordering date asc. put index on date, however, still gets rows check (i use explain see that). what problem or can't see without seeing table? thank you. depending on type of index, ordering date need full scan. think can't mysql. nevertheless, 1 solution "cut" search using clause. eg where date > 10 days ago the ordering not done on full scan on left after clause. weird may seem, , depending on table, may able optimize query ... 2 queries. eg : select max(primary key) topics => $max select topic topics primary key >= $max - 10 these 2 request faster full scan if table has many lines , give same result if primary key auto-increment. i hope you jerome wagner

html - CSS 3 column fluid layout issues, 3rd column too wide -

i've been trying implement 3 column fluid layout following http://www.alistapart.com/articles/holygrail/ (left 300px fixed, center fluid, right 300px fixed) , reason 3rd column blowing out right side of layout. here's want vs i'm getting: http://i.stack.imgur.com/qfvvp.png am testing on linux chrome , ff - both latest stable versions. my css is: #home { min-width:900px; font-family: arial; font-size: 12px; color: #565656; } /* main page divisions */ #page-top { height: 120px; background-color: #ffffffff; } #page-middle { height: 250px; background-color: #6ac0eb; float:left; width:100%; padding-left: 300px; /* lc width */ padding-right: 300px; /* rc width */ } #page-middle .column { position: relative; float: left; } #page-bottom { clear:both; height: 300px; background-color:#ededed; overflow:scroll; } /* middle page divisions */ #page-middle-centre { width:60%; } #page-middle-lef...

groovy - Get all records by date ignoring the time in DateTime in grails -

i'm using grails joda date time plugin want fetch record day ignoring time precision in date. whats best way it? thanks help. class record { datetime datefield def getallrecordsforoneday(aday = new datetime()) { def localdate = new localdate(aday); record.findalldatefieldbetween(localdate.todatetimeatstartofday(), localdate.plusdays(1).todatetimeatstartofday()) //or criteria record.withcriteria { between 'datefield', localdate.todatetimeatstartofday(), localdate.plusdays(1).todatetimeatstartofday() } } }

r - quantmod::chartSeries does not plot all components -

i have read quite lot of r docs, can't find recognized answer this. forehead sore banging against desk. ;) this specific library(quantmod) , because trying learn, suppose general question too. r 2.12.2 gui 1.36 leopard build 64-bit (5691) mac os x 10.6.6 i trying replicate behaviour of quantmod example @ http://www.quantmod.com/examples/intro/ from gui, - below generates chart http://www.quantmod.com/examples/intro/aapl-full.png : > require(ttr) > getsymbols("aapl") [1] "aapl" > chartseries(aapl) > addmacd() > addbbands() but when source() .r file gui, chart for > chartseries(aapl) that is, price chart , volume chart underneath it. further, if try following command line kind of works expected. $ r --no-save `<`quantmod.r a file called rplots.pdf generated, contains 3 pages. third page contains price + volume + macd + bollinger bands. what quantmod doing make life difficult? or not understand blindingly obvious ,...

.htaccess - Non WWW to WWW redirection using htaccess File -

i using codeigniter-. domain not redirect www version. for example if type mydomain.com stays mydomain.com . want redirect www.mydomain.com . if types mydomain.com/controller/method should www.mydomain.com/controller/method . another problem: tried other solutions problem when redirects www version, automatically adds " index.php " in url. when type www in domain name works fine, no " index.php " in url. problem occurs during redirection. here .htaccess file (i've removed redirection code) rewritecond $1 !^(index\.php|system|rpc_relay.html|canvas.html|robots\.txt) rewritecond $1 !^(sitemap\.xml|export) rewriterule ^(.*)$ /index.php/$1 [l] any appreciated. to redirect http:// http://www . , , remove route file ( index.php ) in url, put these lines on htaccess : rewriteengine on rewritecond %{http_host} !^www.domain.com$ [nc] rewriterule ^(.*)$ http://www.domain.com/$1 [l,r=301] rewritecond $1 !^(index\.php|images|css|js|styles|r...

c - Static pthreads mutex initialization -

using pthreads, how one, in c, initialize static array of mutexes? for single static mutex, seems can use pthread_mutex_initializer. static array of them? as, in example, #include &ltpthread.h&gt #define num_threads 5 /*initialize static mutex array*/ static pthread_mutex_t mutexes[num_threads] = ...? or must allocated dynamically? if have c99 conforming compiler can use p99 initialization: static pthread_mutex_t mutexes[num_threads] = { p99_dupl(num_threads, pthread_mutex_initializer) }; this repeats token sequence pthread_mutex_initializer, requested number of times. for work have sure num_threads doesn't expand variable decimal integer constant visible preprocessor , not large.

ios - Detect only double or single tap with UIViews? -

i want detect double / single tap when user touches view. i made this: - (void)touchesbegan:(nsset *)touches withevent:(uievent *)event { uitouch *touch = [touches anyobject]; cgpoint prevloc = [touch ] if(touch.tapcount == 2) nslog(@"tapcount 2"); else if(touch.tapcount == 1) nslog(@"tapcount 1"); } but detect 1 tap before 2 taps. how can detect 1 / 2 tap? thanks help. found way that: -(void)handlesingletap { nslog(@"tapcount 1"); } -(void)handledoubletap { nslog(@"tapcount 2"); } - (void)touchesended:(nsset *)touches withevent:(uievent *)event { nsuinteger numtaps = [[touches anyobject] tapcount]; float delay = 0.2; if (numtaps < 2) { [self performselector:@selector(handlesingletap) withobject:nil afterdelay:delay ]; [self.nextresponder touchesended:touches withevent:event]; } else if(numtaps == 2) { [nsobject cancelpre...

javascript - How to determine if a field has focus? -

very similar how find out dom element has focus? except i'm not trying find field has focus, need know if particular 1 has focus. possible? you can try $("input#id").is(":focus") edit : should read post if plan use on older browsers. http://forum.jquery.com/topic/is-the-focus-selector-valid

Having XCopy copy a file and not overwrite the previous one if it exists (without prompting) -

i'm sending commands remote computer in order have copy file. want file copied, not overwrite previous file same name (if exists). need command run without prompts (xcopy likes prompt whether target name i've specified file or directory, , prompt overwriting file). no way make not overwrite far know. /y make overwrite. , /i rid of file/dict prompt. see xcopy /? options

sql - How can I select the primary key columns from a table? -

i need select columns primary key or column not null. how can that? and want columns, not values. select column_name information_schema.columns table_name = '<table_name>' , is_nullable = 'no'

dll - ASP.NET MVC 3 File Structure -

i apologize vague title - new asp.net mvc coming php, , have teamed .net developer has webforms background. when working mvc in php, of files visible on server - say, can go of model, view , controller files , edit of code remotely without problem. in .net mvc, couldn't find controller or model files, asked developer how webpage being put together, , told me how .net compiles code .dll files , unable access this. wanted view controller see how pulling views, didn't see controller folder on server. to me, doesn't sound right, not sure because of lack of experience in .net. can provide input if typical .net scenario, , if not, doing wrong? should take red flag? keep in mind .net mvc new both of us. thanks! there no code files because these code files compiled dll files during publish process. it's not strange - it's better because of performance reasons. it's common scenario asp.net , asp.net mvc applications. you can deploy yor application ...

How can you retrieve a pages source code (after javascript has ran) using PHP? -

on page, javascript adds lot of classes on page load (depending on page). how can wait til javascript has added classes, html using either javascript or php different file? when page has finished loading, post rendered source php script using ajax. $(function() { var data = $('body').html(); $.post('/path/to/php/script', data); }); (this example assumes you're using jquery)

convert a string into a two-dimensional array in javascript -

i'm trying convert string "10|15|1,hi,0,-1,bye,2" first 2 elements 10|15 mean different 1,hi,0,-1,bye,2 . separate them each other. naive way accomplish be: value = string.split("|"); var first = value[0]; var second = value[1]; var tobearray = value[2]; array = tobearray.split(","); (of course, if know way in better way, i'd glad know). however, array array contains array[0]=1, array[1]=hi, array[2]=0, array[3]=-1 , etc. however, want obtain 2 dimensional array such array[0][0]=1, array[0][1]=hi, array[0][2]=0 array[1][0]=-1, array[1][1]=bye, array[1][2]=2 is there way that? thanks the first 2 elements ( 10|15 ) can extracted beforehand. after you're left with: var = "1,hi,0,-1,bye,2"; let's splice until we're left nothing: var result = []; = a.split(','); while(a[0]) { result.push(a.splice(0,3)); } result; // => [["1","hi","0"],["-1",...

asp.net - difference between RDLC and SSRS -

what difference between local/web data reports (rdlc) , ssrs? ssrs (sql server reporting services) part of some editions of microsoft sql server (sql server express advanced services non-free verisons). allows process server-side reports ( .rdl files). the reportviewer control included in visual studio allows process client-side reports ( .rdlc files). not require sql server. since both components use same reporting engine, rdls , rdlcs use same xml schema. thus, material find online ssrs applies rdlcs. the following msdn article outlines difference between rdl , rdlc files: converting rdl , rdlc files

android - Java:Unzipping a file, without creating target folder -

i have nice java code unzips .zip file. problem code is i need create target folders(note:only folders not file) before running code. otherwise path not found exception. so code wont work if zip file content not known before. think useless code. have better logic? or bellow code need edited? package com.mireader; import android.os.environment; import android.util.log; import java.io.file; import java.io.fileinputstream; import java.io.fileoutputstream; import java.util.zip.zipentry; import java.util.zip.zipinputstream; /** * * @author jon */ public class decompress { private string _zipfile; private string _location; public decompress(string zipfile, string location) { _zipfile = zipfile; _location = location; _dirchecker(""); } public void unzip() { try { fileinputstream fin = new fileinputstream(_zipfile); zipinputstream zin = new zipinputstream(fin); ...

asp.net - how do I access object tags in aspx.cs page? -

i desingned page tags, want access object tags in code behind. this aspx page code.... <object type="label" runat="server" class="system.web.ui.webcontrols.label" id="label_priority" parent="-1" bindedfield="priority" empty="1" value="myvalue"> here adding runat=server in object tags giving error "an object tag must contain class, classid or progid attribute." then added class="system.web.ui.webcontrols.label" , not giving error not showing in browser. so question how access object tags in aspx.cs page? or want create label object tag accessible in code behind. sujeet when have runat="server" on <object/> or <script/> tag, .net expects server side object. can create entire markup on server side. assuming have <div id="somecontainer" runat="server"></div> in page: protected void page_load(object s...

java - Multiple files as input on Amazon Elastic MapReduce -

i'm trying run job on elastic mapreduce (emr) custom jar. i'm trying process 1000 files in single directory. when submit job parameter s3n://bucketname/compressed/*.xml.gz , "matched 0 files" error. if pass absolute path file (e.g. s3n://bucketname/compressed/00001.xml.gz ), runs fine, 1 file gets processed. tried using name of directory ( s3n://bucketname/compressed/ ), hoping files within processed, passes directory job. at same time, have smaller local hadoop installation. in that, when pass job wildcards ( /path/to/dir/on/hdfs/*.xml.gz ), works fine , 1000 files listed correctly. how emr list files? i don't know how emr lists files, here's piece of code works me: filesystem fs = filesystem.get(uri.create(args[0]), job.getconfiguration()); filestatus[] files = fs.liststatus(new path(args[0])); for(filestatus sfs:files){ fileinputformat.addinputpath(job, sfs.getpath()); } it list files in input...

iphone - Objective-C, protocols and subclasses -

let's have following protocols defined: // basic protocol user interface object: @protocol uiobjectprotocol <nsobject> @property (assign) bool touchable; @end // basic protocol user interface object held holder object: @protocol uiheldobjectprotocol <uiobjectprotocol> @property (readonly) id holder; @end and following class hierarchy: // base class user interface object, synthesizes touchable property @interface uiobject : nsobject <uiobjectprotocol> { bool _touchable; } @end @implementation uiobject @synthesize touchable=_touchable; @end at point, ok. create uiobject subclass named uiplayingcard . inherently, uiplayingcard conforms uiobjectprotocol since it's superclass too. now suppose want uiplayingcard conform uiheldobjectprotocol , following: @interface uiplayingcard : uiobject <uiheldobjectprotocol> { } @end @implementation uiplayingcard -(id)holder { return nil; } @end note uiplayingcard conforms uiheldobjectp...

How to make MS Access tick or check box work with MySQL or SQL -

i using ms access 2007 front-end application, links odbc mysql. the problem access form interprets tickbox -1 true while mysql/sql interprets 1 true. tick or check boxes not work true state on access forms. if write code behind (before update event) , single form should work ubound control (not linked data field), on on so-called "continuos form" when control unbound change state when ticked not on record/row on rows. unless can tell access form change tick-box true/false interpretation not sure how use on continuous form. any solutions or hints?

Updated: Free tools for checking security vulnerabilities for rails app -

i know whether there free tools available can used test security vulnerabilities in rails app. came across skipfish , found not intuitive in report. there similar tools available? update i've found tool, zap , can used doing penetration testing web applications. can automate integrating testing tools such selenium. looks cool , has many features , easy use too. leena rails best practices mentioned general code quality checks, security vulnerabilities checks, have @ brakeman , "an open source vulnerability scanner designed ruby on rails applications. statically analyzes rails application code find security issues @ stage of development". you hook app in rails brakeman have brakeman security report run every time commit @ github.

asp.net - How can I make all buttons on a page the same width via CSS? -

i have 30 buttons of different sizes , want set width of @ once through css. haven't been able work right. [insert example of failed css code here] but doesn't work. example, following button doesn't follow above rule: [insert minimal, complete html example here illustrates issue] you can create button class in css .button { width: ____px; } and in .aspx add cssclass="button" asp buttons (i assume they're asp.net controls?)

html - How to get full height of webpage with CSS? -

i trying create pseudo lightbox using little javascript. in process of creating translucent black overlay behind modal having problems stretching black overlay way down length of page. overlay stops @ end of initial scrollable area. so, if user scrolls down page, page not covered overlay. here code using overlay: .black-overlay { position: absolute; top: 0%; left: 0%; width: 100%; height: 100%; background-color: #000000; z-index: 1001; -moz-opacity: 0.8; opacity: .80; filter: alpha(opacity=80); } it's heigh: 100% limiting page spanning whole length of page. try position: fixed; instead.

php - Delete a database record and associated image -

i have table of photos this: photo_id, photo_url, user_id when want delete photo, need delete row in table , photo on server. this, need 2 queries: a select query return photo's url , delete unlink() a delete query delete row in table is simpler way this, perhaps using 1 query? your way best way this....how can simpler.... also, if photos use ids may delete row instead of selecting query return photos url. if successful proceed deleting thumbnail

Can MATLAB for 64 bit use pre-compiled 32 bit mex files? -

i have access library pre-compiled 32 bit mex files (windows: .mexw32 , linux: .mexa32 ). having hard time compiling library myself 64 bit machine, wondering if there way make matlab 64 bit work 32 bit mex files. in general accessing 32bit code 64bit executable nontrivial . therefore doubt have implemented in matlab natively...

Javascript MVC ASP.NET simple if condition not working -

i've following asp.net mvc razor view code doesn't seem working: @{ bool condition1=model.someobject.condition1; bool condition2 = model.someobject.condition2; } if('@condition1') { alert('hi condition1'); } else if ('@condition2') { alert('hi condition2'); } else { alert('hi condition3'); } here not working: when condition2 true javascript 'hi condition2' never hit. i tried below , still not working. else if ('@condition2' ==true){ am missing casting here, please? thank you. according code alert('hi condition2') should work when condition1 == false , condition2 == true. in addition, shouldn't wrap @condition1 , @condition2 in quotes ' . bool, not string. matter in javascript condition not empty string equals true. 1 more thing: .net bool converts string true or false (in upper case). in other side, js bool values true , false . try: if (...

Silverlight 4 Usercontrol Property fails to receive PropertyChanged From Parent Control -

i've set simple silverlight 4 control supposed switch visibility of 2 textboxes based on public property. add control view , set databinding of control's property property of parent view's viewmodel. when change in parent viewmodel's property occurs, nothing happens in usercontrol. although it's bound, onpropertychanged doesnt seem interest bound property of user control. below code of user control. <usercontrol x:class="controls.eappasswordbox" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d" d:designheight="300" d:designwidth="400" x:name="_root" > <grid x:name="layoutroot" background="white"> <stackpanel horizont...

flash - Do Adobe Air Apps on Android receive system events? -

i'm considering using adobe air write application android marketplace. wondering if tell me (if any) limitations regard getting / handling system events. instance can pause app if user receives text message? or detect if have music playing , mute app's sounds? it seem real pity if air cannot this. i can't seem see online - if finds out. speaking authoritatively ios packager (and extension assuming should true of apk packager) know recent air versions indeed let pause when os interrupts application. nativeapplication.nativeapplication.addeventlistener(event.activate, onnativeappactivated); nativeapplication.nativeapplication.addeventlistener(event.deactivate, onnativeappdeactiated); if need put special logic in app handle interruptions you'd write handlers event.activate , event.deactivate nativeapplication instance. as other bits of accessability hardware, there limitations. eg: aren't allowed fine-grained gps location, coarse location. if ...

iphone - MkMapView drop a pin on touch -

i struggling unearth standard way drop pin on mkmapview based on touch input. there isnt standard way, worth asking. if have implement myself best approach add gesture recogniser pick tap on map view. yes, can use uilongpressgesturerecognizer this. this previous answer of mine has details sample code: how add push pin mkmapview(ios) when touching? to animate drop, in viewforannotation , return mkpinannotationview animatesdrop set yes.

r - RMySQL: Transforming extracted data -

i trying extract numeric data database columns have been set varchar(100) . data in relevant columns numeric there shouldn't problem extracting data formatted integer. there nice way in r? here got: m_df <- dbgetquery(conn, paste("select ", direc, " position, ", power, " power ", table, " d left join files f on f.id=d.fileid parc='", parc, "' , timestamp >= '", w_date[1], "' , timestamp <= '", w_date[2], "' , plantnumber = ", w_mach, sep="")) executing following: sum(m_df$power) produces error: error in sum(m_df$power) : invalid 'type' (character) of argument performing: str(m_df) generates: 'data.frame': 4317 obs. of 2 variables: $ position: chr "280" "281" "288" "294" ... $ power : chr "294" "342...

ruby on rails - Giving a user a 'primary key' inside their data domain -

i have rails app consists of lots of accounts. inside these accounts users can create tickets. what best way give each ticket id sequential inside account? obviously managing id's myself seems initial answer, seems filled sort of edge cases cause issues (for instance, 2 tickets writing down db @ once...) i think you'll end managing them - i've implemented similar previously, account stored 'current_ticket_id' , when ticket (for example) get's created still stored global pk observer assigns friendly_ticket_id , increments 1 on account model next time round. can use friendly_ticket_id scoped account via urls make sure right ticket back.

How to download csv using jquery in php -

i using following piece of code, <script type="text/javascript"> function firedownload(){ var path= '<?php echo url; ?>/downloadmyfile'; $.post(path,function(data){ alert(data); }); } </script> i have downloadfileaction in controller public function downloadmyfileaction() { $this->_helper->viewrenderer->setnorender(); $this->_helper->gethelper('layout')->disablelayout(); ..... ..... .... $this->view->list=$mydata; ///create csv $myfile = "order_" . time() . ".csv"; header("content-disposition: attachment; filename=\"$myfile\""); header("content-type: application/vnd.ms-excel; charset=utf-16le"); $out = fopen("php://output", 'w'); $csvdata = array('slno...

Publishing site in Visual Studio 2005, without updating video files -

is there way update , publish site in visual studio 2005, without updating files haven't changed. have media folder has videos , music. not need update folder when publish, becomes long process. instead want publish pages have changed. there way, please help. remove files , folder project. they still on file system, not published rest of site. see how to: add , remove solution items (vs 2005) on msdn.

Struts2 conditional validation -

is possible in struts 2 avoid several validations (defined anotations) depending on value of given field? like: "if radiobutton has value x not validate fields a, b , c". this useful me since i'm developing jsp page (model driven) , i'm not showing fields @ same time, visible ones depend on radiobutton value. however, when submiting, validators hidden fields "activated" , validation process fails. so, want to ignore hidden ones, there way this? thanks! i using ognl , expression validator apache struts 2 documentation i using xml because imho annotations bit intrusive, , rather not use them everywhere. sure can use annotation version validation annotation . hope helps...

actionscript 3 - Flex DataGrid in GridItemRenderer -

i've got hierarchical data show in flex spark datagrid, looking this: |------|---------------------------| | row1 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | | in | 1 | 2 | 3 | 4 | 5 | 6 | 7 | | outer|---------------------------| | grid | component spans | | | on multiple columns here| |----------------------------------| | row2 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | | in | 1 | 2 | 3 | 4 | 5 | 6 | 7 | | outer|---------------------------| | grid | component spans | | | on multiple columns here| |----------------------------------| what i'm trying use custom griditemrenderer holds inner datagrid. basic concept looks this: <s:datagrid dataprovider="{outerdataprovider}" width="100%" height="100%" variablerowheight="true"> <s:columns> <s:arraylist> <s:gridcolumn datafield="name"> <s:itemrenderer> <fx:component> ...

c - base64 decoding files of length greater than 8192? -

whenever try base64 decode files (using openssl's bio_f_base64() ) larger 8192, seem wrong value. what magic number 8192? educate me appreciated! updated: here part of code: int dgst(char *alg) { evp_md_ctx ctx; const evp_md *md; unsigned char md_value[evp_max_md_size]; unsigned int md_len, i; char *tob64val = null; char *data = null; openssl_add_all_digests(); md = evp_get_digestbyname(alg); if(!md) { printf("unknown message digest %s\n", alg); exit(1); } data = readfilebuffer("file_out"); printf("strlen(data) %d\n", strlen(data)); evp_md_ctx_init(&ctx); evp_digestinit_ex(&ctx, md, null); evp_digestupdate(&ctx, data, strlen(data)); evp_digestfinal_ex(&ctx, md_value, &md_len); //retrieve digest ctx unto md_value , #bytes written copied md_len evp_md_ctx_cleanup(&ctx); unsigned char *copy = malloc(md_len); memcpy(copy, md_value, md_len); char *buff = encbase64(copy, md_len);...

java - C++ non static callbacks and JNA -

i trying use c++ api in java jna. api uses callbacks handle sessions events. the resource found on how register callbacks jna this , , deals c callbacks, , don't know how can extended c++ non-static callbacks. edit: found this resource , think "revisiting callbacks" chapter might help. all function pointers callbacks stored in following sp_session_callbacks structure: /** * session callbacks * * registered when create session. * if callbacks should not of interest, set them null. */ typedef struct sp_session_callbacks { void (__stdcall *logged_in)(sp_session *session, sp_error error); void (__stdcall *logged_out)(sp_session *session); void (__stdcall *connection_error)(sp_session *session, sp_error error); void (__stdcall *message_to_user)(sp_session *session, const char *message); // other callbacks function pointers } sp_session_callbacks; the java class created described structure following: public class sp_session_callbacks e...

multithreading - Crash using variables declared __declspec(thread) -

i have dll (written in c) uses static thread local storage ( __declspec(thread) ), , want use dll visual basic graphic interface. unfortunately, when running interface on windows xp dll use static thread local storage crashes when try acess thread variables. how can solve problem? thanks, regards g.b. ps not modify dll. this known limitation of static tls. although aren't explicitly calling loadlibrary() , vb runtime on behalf. note limitation has been lifted vista. comprehensive reference know of on ken johnson's blog . you may able around problem if dll included in imports table of generated .exe, involve pe hacking , i'm far it's viable strategy. otherwise you'll need change dll.

command - How to run " ps cax | grep something " in Python? -

how run command pipe | in it? the subprocess module seems complex... is there like output,error = `ps cax | grep something` as in shell script? see replacing shell pipeline : import subprocess import shlex proc1 = subprocess.popen(shlex.split('ps cat'),stdout=subprocess.pipe) proc2 = subprocess.popen(shlex.split('grep python'),stdin=proc1.stdout, stdout=subprocess.pipe,stderr=subprocess.pipe) proc1.stdout.close() # allow proc1 receive sigpipe if proc2 exits. out,err=proc2.communicate() print('out: {0}'.format(out)) print('err: {0}'.format(err)) ps. using shell=true can dangerous. see example the warning in docs. there sh module can make subprocess scripting in python lot more pleasant: import sh print(sh.grep(sh.ps("cax"), 'something'))

Quiz modules for Drupal -

does know alternative quiz modules in drupal? need simple quiz functionality. main problem questions module inside quiz module isn't compatible php 5.1.x, , need kind of quiz module compatible (almost modules are). need tells correct answer question in end. thank you! have looked @ webform ? place question & answer entry fields on 1 page, put pagebreak , answer on next, etc...

web services - WCF - HTTP could not register URL http://+:80/ -

my first post on stackoverflow! i having problems wcf service trying build , need in trying figure out. there 2 parts service, first simple rest style web service full of methods, works fine. the next area pub/sub model push out subscribers internally results of particular invoke method first area. incorporate listening on 2 endpoints, every time invoke 1 method on pubsub service error above. after searching interwebulator have seen lot of posts saying iis using port 80 default. now 2 questions: 1. service listening on following base address, nothing 80 http://localhost:3526/tradeportal , http://localhost:3526/tradeportal/operations 2. ideally host in iis the suggestion change client base address not use port 80, set on sever side or client side config. i'm bit puzzled solution this, have built pubsub model using nettcp binding. any clues how solve appreciated server side config: <system.servicemodel> <services> <service behavior...

MS EntityFramework: how to split entity with inheritance? -

i have table name transaction in db. want have 2 subclasses transactiona , transactionb. i've made described here: http://www.robbagby.com/entity-framework/entity-framework-modeling-table-per-hierarchy-inheritance/comment-page-1/#comment-607 as use t4 templates i've generated self-tracking entities. everything okay 1 thing. can see generated entities transactiona , transactionb cannot see them in context object (objectcontext). normal? if so, how transactionb table using context if transaction class accessible? thanks this expected. transaction en b derive baseclass transaction. in entity model can access them through collection of transactions this: context context = new context(); list<transactionb> list = context.transactions.oftype<transactionb>().tolist();

ubuntu 10.10 - when doing a "build" with AnthillPro, i get an error com.urbancode.command.CommandException: java.net.ConnectException: Connection refused -

any idea how resolve in anthillpro. running anthillpro server on ubuntu 10.10 knowing version on help. knowing step that's failing. assume there connectivity problem agent - either agent server or server agent. validate agent configuration seen server. it's online. in newer versions can run explicit communication test. in older versions can go agent's variable screen used pulled on each request rather cached. then go system -> server settings , find connectivity urls passed agent. ensure can hit urls - on screen - agent. if can't, agent won't able hit server's web services , see sort of connectivity error - perhaps one.

android - What to do with Cursor after a SQLite query? -

this first time using database , i'm not sure how works. made database , made query returns cursor and... what? cursor, really? can use navigate through data or have put in arraylist or listactivity or what? you need iterate cursor results. use cursor.movetofirst() and/or cursor.movetonext() (with while loop). can use getx() method, cursor.getint() or cursor.getstring() . for example, ir expecting 1 result query: if (cursor.movetofirst()) { string name = cursor.getstring(cursor.getcolumnindex('name')); int age = cursor.getint(cursor.getcolumnindex('age')); } else { // oops nothing found! }

How could I be doing this jquery function a bit better? -

i have inputs floating labels on top of them. effect basically, inside email text input, says 'enter email'. click input, label fades away. i have working function all, have repeating code. ie: my html looks this: <div id="action"> <form action="/" method="post" id="#register_form"> <input type="hidden" name="create" value="1" /> <div class="form-field"> <label for="register_name">name (first &amp; last)</label> <input id="register_name" class="form-text" type="text" name="name" tabindex="1"/> </div> <div class="form-field"> <label for="register_email">enter email</label> <input id="register_email" class="form-text" type="text" name="emai...

asp.net - HttpModules Configuration error -

1- have class structure shown below. namespace viewstateseohelper { class viewstateseomodule : ihttpmodule { public void init(httpapplication context) { context.beginrequest += new eventhandler(context_beginrequest); } void context_beginrequest(object sender, eventargs e) { httpapplication application = sender httpapplication; if (application.context.request.url.absolutepath.contains(".aspx")) application.response.filter = new htmlfilterstream(application.response.filter); } public void dispose() { } } } i'm using using in pages through upper code. <httpmodules> <add name="viewstateseomodule" type="viewstateseomodule" /> </httpmodules> but,i got configuration error. parser error: not load type 'viewstateseomodule'. (c:\users\xxx\documents\visual studio 2010\websites\xxx\web.config line 78) line 78: thanks in advance. ...

How to make the Enter key work like Tab in ASP.Net applications? -

i have written program. when hit enter key, want cursor move between textboxes if had hit tab key. how can in asp.net? do javascript, recommend jquery: should basic. create keyboardeventlistener enter key, , there trigger keyboard event tab key. this: keyboardeventistener(enter key) { jquery.event("tab"); }

How do I repeatedly search & replace a long string of text in vim? -

i'm aware of vim replace command, of form, eg: :%s/old/new/gc but if either of these strings long? how can use visual selection mode, clipboard or vim registers instead of having type old/new text in? according manual , can use ctrl + r insert contents of register current position in command line. manual claims ctrl + y inserts text highlighted mouse command line. remember in x11 , other systems, can paste text program system clipboard using middle mouse button or menu command in terminal emulator.

java - processing a jsf datatable -

i've page datatable can considered view on table of database. fields static, others inputtext, meant modify field (in particular, fields of specific column). i press button , save whole table. in general, i'd understand how read entire table in managed bean. thanks! edit: i'll try more clear: imagine you've nxm table of inputtext. outside table, button action #{somebean.process}. i'd have, in process method, list length n , row object m fields. if understand correctly think, need save not datatable, need save rows table. jsf can use binding , when need save data, rows binding , make data operations.

ruby - What is the name for instance variable caching? -

the technique of caching instance variables has specific "academic" name can't remember it. please me out. def current_user @current_user ||= user.find(session[:user_id]) end marshaling called marshalling. lazy loading called lazy loading. described technique called ... ? memoization. http://en.wikipedia.org/wiki/memoization

How to debug "Couldn't match expected type ... against inferred type" in Haskell? -

this error message getting: couldn't match expected type `[(char, int)]' against inferred type `(a, b)' in pattern: (c, n) in definition of `decode': decode (c, n) = map (\ (c, n) -> replicate n c) and code decode :: [(char,int)] -> string decode (c, n) = map (\ (c, n) -> replicate n c) the pattern (c,n) has type (a,b) not match type [(char, int)] . in other words you're saying argument list of pairs, pattern matches single pair. also return value of map list of strings, not single string type signature suggests. if want single string, need use concatmap . so code this: decode pairs = concatmap (\ (c, n) -> replicate n c) pairs or just decode = concatmap (\ (c, n) -> replicate n c)

Php script run next to windows clock -

hello have php script return values mysql database want results shown on windows toolbar next windows clock example in fieldset or something any ideas? lot php won't (unless use gtk, wouldn't recommend). what suggest use php create basic web api. you'd need use .net, java, c++, etc build desktop application consume api , display application near clock.

java - Changing log level on AXIS and cxf webservices -

i accessing webservice deployed in other remote machine implemented using axis2. have created webesrvice using cxf in turn invokes other wesbervice mentioned above. when deploy war file on tomcat getting soap messages on console , getting overridden logs.i disable debug statements. is there way change ? should need modify in remote server axis webservice running( 1 cxf webservice using). getting debug statements below. pache.axis.message.messageelement:trustlevelmap 2011-07-22 12:56:56 deserializationcontext [debug] exit: deserializationcontext: :endelement() 2011-07-22 12:56:56 deserializationcontext [debug] enter: deserializationcontext ::endelement(, trustlevelmap) 2011-07-22 12:56:56 projectresourcebundle [debug] org.apache.axis.i18n.resource: :handlegetobject(pophandler00) 2011-07-22 12:56:56 deserializationcontext [debug] popping handler org.apache.ax is.message.soaphandler@6961fdd9 2011-07-22 12:56:56 deserializationcontext [debug] popped element stack org.a pache.axis....

Issue while store the javascript textbox value into DB using ajax code in MVC2 -

i may missing obvious here, how rewrite code! i trying here store value entered in textbox(textbox showed in javascript dialog page).in javascript dialog page have 1 'ok' button.. when click button want store value entered in textbox.i want save content using ajax. please see sample code view page: <script language="javascript" type="text/javascript"> $(function () { $('.button').live('click', function () { $('.text_dialog').dialog('open'); }); $('.text_dialog').dialog({ autoopen: false, buttons: { 'ok': function () { var textvalue = $(':txtvalue').val(); $.ajax({ url: '/home/about', type: 'post', data: { str: textvalue }, success: function (result) { ...

php - Displaying files from out of httpdocs location -

the files going stored in folder next httpdocs. thus, make hard display files internet user. how i'll overcome problem? mean, want display/serve files users. need use kind of proxy file? old one: -httpdocs\ -index.php -uploads\ <- -folder\ -image.png -image3.jpg -folderbla\ -personal.jpg -sp.pdf new one: -httpdocs\ -index.php -uploads\ <---- -folder\ -image.png -image3.jpg -folderbla\ -personal.jpg -sp.pdf configure web server graft directory url space, e.g. using alias httpd.

iphone - only few contents of .ipa file are getting loaded into the device when sinked via itunes -

i developing application in placed bunch of books in resources folder of app. when load app device xcode, books visible in ipad. when load same app in .ipa format device using itunes in same ipad, few books being loaded (done ad-hoc). can suggest might problem or issue? there provisioning profiles (developer or distribution)? do 1 thing, extract .ipa file stuffit expander. binary file. please check resources there or not. if yes might older ipa file installed in itunes(pc). delete , try install ipa file. if no may issue while compilation.

rest - Localizing reason phrase in status line of the RESTful HTTP API reponse -

we have restful api exposed on http in natural way makes use of http status-line (status-code , reason-phrase) communicate api result client ( http://www.w3.org/protocols/rfc2616/rfc2616-sec6.html ). for example have following status line concurrency error: http/1.1 409 resource updated different user. reload , try again. it turned out messages presented end users of application built against our api meaning need localize them. i'm wondering if accepted approach in such scenarios, considering non-ascii charset of messages, or should reason phrase (status description) kept low level message , content make its' way user screen should passed in response body? there can bite later on if choose localize reason-phrase part? in case use response body pass new version of resource api client , including additional data doesn't see play nicely that. as you'll know rfc: the status-code intended use automata , reason-phrase intended human user so it...

ON clause with Hibernate Query interface -

i getting hibernatequeryexception,when use on clause left outer join. can suggest me cause. regards, raj hql doesn't support ... join ... on ... syntax, can join on defined relationships between entities ( from foo foo join foo.bars bar ). if need join on arbitrary condition, can use old-fashioned form from a, b b a.x = b.y (though can't make outer join way). otherwise have use native sql query. see also: chapter 16. hql: hibernate query language chapter 18. native sql

perl - Why do I get "Pseudo-hashes are deprecated"? -

i have code if (defined($xml->{account}->{p}) == '2') { ... } which gives me warning pseudo-hashes deprecated @ a.pl line 48. the problem in cases $xml->{account}->{p} doesn't exist, why added defined function. $xml object, if makes difference? how can fixed, perl doesn't complain? either $xml or $xml->{account} array, not hash (you can use ref check this, see perldoc -f ref ). perl had now-deprecated feature called "pseudo-hashes" allowed special arrays accessed via hash syntax. if care history, can google around or @ older-edition camel book.

hibernate - JPA "cannot be cast to java.sql.Blob" -

i'm using jpa2 hibernate 3.6.1. , derby database , used following annotation blob: @column(length = integer.max_value) @lob long[] bucket; hibernate creates correct blob column if try save entity following exception: java.lang.classcastexception: [j cannot cast java.sql.blob why , how can make work? if annotate without @lob "varchar bit data" column can contain 32m. you need map property byte[], not long[]. the documentation says @lob indicates property should persisted in blob or clob depending on property type: java.sql.clob, character[], char[] , java.lang.string persisted in clob. java.sql.blob, byte[], byte[] , serializable type persisted in blob. if property type implements java.io.serializable , not basic type, , if property not annotated @lob, hibernate serializable type used. if want persist array, you'll need build custom user type transform data type. can find example here http://docs.jboss.o...

mysql - efficient join needed against a virtual table used multiple times in a subquery -

i trying run query similar one: select s.custno, s.prodno, if(daycode = 1, (select avg(sell) sales ss join (select distinct `prodno` `familycode` prodfamily = 101) f2 on f2.prodno = ss.prodno ss.custno = 800 , ss.weekno = s.weekno - 1), (select avg(sell) sales ss join (select distinct `prodno` `familycode` prodfam = 101) f3 on f3.prodno = ss.prodno ...

asp.net mvc - Share data between two partial views in tab UI -

i've created 2 tabs using jquery ui, , placed 2 partial views in tabs below code. <div id="tabs"> <ul> <li><a href="#tab1">tab 1</a></li> <li><a href="#tab2">tab 2</a></li> </ul> <div id="tab1"> @html.partial("tab1") </div> <div id="tab2"> @html.partial("tab2") </div> </div> how can share data tab2 partial view tab1 partial view. thanks, naren you can't . directly sharing data between partial views no architecture, either. each partial view should exist one distinct purpose , should not interfere or exchange data other ones — in fact, tab1 shouldn't know tab2 exists. however, store data in model property of view containing 2 partial views , hand on each partial view rendered: @model somemodel <div id="tabs"> <ul> <li><a hre...

backbone.js - multiple matching routes -

i've got backbone.js application defines 2 controllers, , controllers both define route patterns match location.hash. i'm having trouble getting both of them fire - e.g. managercontroller = backbone.controller.extend({ routes: { ":name": "dostuff" }, dostuff : function(name) { console.log("dostuff called..."); } }); component1controller = backbone.controller.extend({ routes: { "xyz123": "domorestuff" }, domorestuff : function() { console.log("domorestuff called..."); } }); so if url "http://mysite.com/#xyz123", seeing 'dostuff()' called, or if comment out route, 'domorestuff()' called. not both. i'm using architecture because page highly component oriented, , each component defines own controller. 'component manager' defines controller house keeping on routes. should able configure 2 controllers both respond s...

c# - I'm getting exception when query with Linq to Entity? -

here exception unable create constant value of type 'system.collections.generic.ienumerable`1'. primitive types ('such int32, string, , guid') supported in context. here code list<int> items = new list<int>(){1,5,7,14}; var selecteditems = (from u in _entities.userinfo join type in items on u.typeid equals type u.userid == userid select new userclass { firstname = u.firstname, lastname = u.lastname }).tolist(); any ideas can cause exception? , maybe workaround? for ef4 rid of join on items , add && items.contains(u.typeid) clause. int[] items = new[] { 1, 5, 7, 14 }; var selecteditems = (from u in _entities.userinfo u.userid == userid && items.contains(u.typeid) select new userclass { ...