Posts

Showing posts from February, 2014

c# - Analyzing a CLR .dmp file in WinDbg -

i have c# .net 3.5 application created in visual studio 2008 crashing on windows xp sp3 (x86) pc no development environment. i have been able .dmp file pc , take windows 7 64-bit development pc , load windbg 6.12. but, can't see code in call stack c# application. looks it's entirely native call stack. the result !analyze -v below. i have relevant exe, dll, , pdb files in same directory .dmp. executable crashed compiled in debug mode. i have visual studio 2008, if that's easier use. opening dump file in there shows native call stack, nothing code. how can view clr call stack? 0:004> !analyze -v ******************************************************************************* * * * exception analysis * * * *******************************************...

php - Search for text in output and use whatever is behind the text -

i wondering how search text (ie: description), , use that's behind text variable (all on same line) in php. needs read external location, php file must ran (the php file reads content mysql database , outputs sort of index) any appreciated. edit clarify: sample input: lorum ipsum dolor sample output: dolor do mean given string: lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. $wordtofind = "cupidatat"; $alltextbehindwordtofind = substr($str, strpos($str, $wordtofind)); echo $alltextbehindwordtofind; // outputs: 'cupidatat non proident, sunt in culp...

CSS radial gradient as modal overlay background like Apple's -

i couldn't seem right. want radial gradient overlay similar apple's, nothing doing seemed close. i'd center circle have 25% radius, settle 350px radius. they this, yet i've seen newer versions user <canvas> . note ie or opera, need transparent png (not included in css code below) html: <html> <head> <link rel="stylesheet" href="gogo.css" type="text/css" media="screen" title="no title" charset="utf-8"> </head> <body class=" bg"> <div class="radialbg"> heelo world </div> </body> </html> css: body { margin: 0; padding: 0; } .bg { background: url(pattern.jpeg) repeat; } .radialbg { background: transparent -webkit-gradient(radial, center center, 50, center center, 460, from(transparent), to(#000)); background: -moz-radial-gradient(circle, transparent, #000); width: 100%; height: 100%...

authentication - How does 's login system work?

i'm implementing login system similar of stack overflow in 1 of websites. when login stack overflow, creates cookie named usr value. if delete cookie, logged out... so, can think uses sessions, in database, record user sessions. is right? secure? it's other built login/session system. when log in, system generates pseudo-random string identify uniquely - session id, gets sent out via cookie. when return, cookie sent so. so takes value in cookie, looks in session system (could flat files, database, can't tell), finds session represented session id, , loads process request. deleting cookie severs link between , site - on next visit, session cookie (which deleted) isn't sent, so has no way of identifying you, assumes brand new user, , doesn't show of "logged in" portions of site.

jquery - choose an option based on a textbox value -

we doing form, asking user enter price. the user enters price in input field of 456789 . i selectbox element automatically chooses 400,000 - 500,000 option how can done? <div class="field"> <label for="propertyprice">price</label> <input id="currency2" name="limitedtextfield" size="50" type="text" class="medium" onkeypress="return numbersonly(event, false)" onkeydown="limittext(this.form.limitedtextfield,this.form,12);" onkeyup="limittext(this.form.limitedtextfield,this.form,12);" maxlength="12" value="$<?=number_format($r['price'],2);?>" /> <p class="field_help">enter numbers.</p></div> <div class="field"> <label for="propertypricerange">price range </label> <select id=...

iphone - Pull to Refresh (ios) -

i implemented pull refresh here: https://github.com/leah/pulltorefresh . kind of works gets stuck spinning activity indicator. no text right of arrow. doing wrong? thanks! without code there's not can say, maybe try different implementation of pull refresh, enormego (ego) version, code @ github, here it's used in facebook app works.

android - Issues with personal listView Adapter -

i'm having troubles using own adapter class creating listview delimiter. i'm beginner in android development can't fix alone. i want create listview same layout seen on web site , , want items alphabetically ordered. so create 2 adapter, 1 adding delimiters, , other 1 handling specific layout of each item. the class listemusiccontainer arraylist sorted alphabetically name. each 1 works fine separately, when try out both, runtime error. the error doesn't appear when application starts, when try scroll (so guess i'm good). i don't why error when scrolling. how can solved? here adapter use create listview delimiter abstract public class musicadapter extends baseadapter{ abstract protected view getheaderview(string caption, int index, view convertview, viewgroup parent); private list<section> sections = new arraylist<section>(); private static int type_section_header = 0; public musicadapter() { super(); } public void...

issue when Upgrading to jQuery 1.5.1 -

the delete link don't work when upgrading jquery 1.5 jquery 1.5.1: demo: http://jsfiddle.net/efsgn/ this bug clone() method introduced in jquery 1.5 , , fixed in 1.5.1 . the default behaviour clone() should not copy events , data of cloned element, not case 1.5 (where default behaviour was copy events). to fix code, change: $('#add-input').click(function() { main.append(clonedfield.clone()); return false; }); to $('#add-input').click(function() { main.append(clonedfield.clone(true)); return false; }); working fiddle: http://jsfiddle.net/efsgn/7/

php - How to preg_match_all the images which has a http head width>100px and height>80px? -

i want match img s that: have 1 of extensions: jpg|png|gif whose src not begin http:// whose width > 100 , height > 100 i started regular expression: preg_match_all("/(href|src)=([\"|']?)([^ \"'>]+\.(jpg|png|gif))\\2/i",$str,$matches); numeric comparisions in regular expressions not simple, , finding width= , height= attributes necessitate way more complex regular expression. see regex tools hence 1 of cases simpler html parser make sense. example querypath use: foreach (qp($html)->find("img, a") $img) { if ($img->attr("width") >= 100 , ...) { echo $img->attr("src"), $img->attr("href"); } } of course using domdocument faster (and more typing..)

SQL Time Overlap/Conflict Query -

i have requirement need assign resource tine frame .for example existing in database : john smith -- 3/1/2011 -- 6:00 7:00 -- economics inserted: john smith -- 3/1/2011 -- 6:30 7:00 -- maths here while inserting second row want check time overlap if overlapping want skip insert.how can achieve ?i have date , fromtime , totime in seperate columns. use computed dates using conversion: cast(cast(mydatecolumn varchar(20)) + ' ' + cast(mytimecolumn varchar(20)) datetime) yields e.g. start_datetime , end_datetime assume variables: @inserted_start_datetime, @inserted_end_datetime, @name insert mytable(<values>) not exists ( select * table t2 name = @name , (@inserted_start_datetime between start_datetime , end_datetime or @inserted_end_datetime between start_datetime , end_datetime or start_datetime between @inserted_start_datetime , @inserted_end_datetime or end_datetime between @inserted_start_datetime , @inserted_end_dateti...

what is the best way to use datetime in mongoDB -

i parsing nginx log , want store date , time logs mongodb..i storing date string(in format yyyy-mm-dd) in database , programming language perl.what best effective way store date..should use perl datetime module format date ""date" : "sun feb 13 2011 05:30:00 gmt+0530 (ist)"" i want understand best way store date in mongodb.please guide me i suppose logs better story date date not string, because string not able query logs 1 date another(range). suppose use range queries more others.

c++ - Phonon::MediaSource, cannot use resource as media source -

with qt 4.6, trying access wav file in qresource file use media source of media player , not work: phonon::mediaobject *music; music=phonon::createplayer(phonon::musiccategory,phonon::mediasource(:/fps_sounds/arming.wav)); music->play(); if put direct path works. have been successful @ using resources in other parts of program there not seem problem there , qt doc says can use qresource type of operation. bug or missing something? this 1 gave me scratch well. lo , behold, can implemented using temporary file: { qtemporaryfile f; f.open(); qresource res(":/badger"); f.write((char*)res.data(),res.size()); f.flush(); f.setautoremove(true); f.close(); qstring fn = f.filename(); qsound::play(fn); }

excel - Odbcad32.exe file corrupted -

i cannot set excel odbc drivers data sources in control panel. excel drivers not shown in list. i have tried odbcad32.exe file in windows/syswow64 folder, set file, couldn't set file in windows\system32 . , jdbc program couldn't connect driver. the odbcad32.exe file in syswow64 working, replaced same file in system32 file. way able create driver. on running jdbc program, i'm getting error the specified dsn contains architecture mismatch between driver , application i'm using windows7 64 bit. office 2007 don't mix 32 , 64 bit versions of odbcad32.exe . think bad both 32 , 64 bit versions have same name, how ms build it. in system32 there 64 bit version of odbcad32.exe . in windows/syswow64 there 32 bit version of odbcad32.exe . configuration of odbc stored in registry. native, 64 bit applications including odbcad32.exe use: hkey_local_machine\software\odbc\odbc.ini if use such registry location 32 bit apps windows redirects to: hk...

PHP Use zLib to Compress Multiple Files -

$files = array("images/1.jpg", "images/2.jpg", "images/3.jpg"); foreach($files $file){ $temp = null; $fp_in = fopen($file,'rb'); while(!feof($fp_in)){ $temp .= fread($fp_in,1024); } $output[$file] = $temp; fclose($fp_in); } $output = implode('"',$output); $zp = gzopen( 'sequences/backup.gz', "w9" ); gzwrite( $zp, $output ); gzclose( $zp ); the code above works 1 file added archive. best way add multiple files archive using zlib? require 'tar.php'; $tar_object = new archive_tar("tarname.tar"); $tar_object->seterrorhandling(pear_error_print); // optional error handling $v_list = array("images/1.jpg", "images/2.jpg", "images/3.jpg"); $tar_object->createmodify($v_list, "install"); function compress( $srcfilename, $dstfilename ){ // getting file content $fp = fopen( $srcfilename, "r...

php - SQL query INSERT not working inserting values into my DB -

this question has answer here: syntax error due using reserved word table or column name in mysql 1 answer i'm trying insert values db it's not working, i'm trying figure out why it's not working i'm amateur php coder, this code i'm using: $insert = mysql_query (" insert news(id,title,body,date,by) values ('null','".$title."','".$body."','".$date."','".$by."') "); mysql_close($connect); and rows i'm trying insert are: id,title,body,date,by it's not showing in database or on news page. can please me? by special keyword. try wrapping column names in tick marks: insert news(`id`,`title`,`body`,`date`,`by`)

Need MySQL query to run conditions both individually and as a group-possible? -

i have query attempts select cases/clients (clients.id) based on multiple conditions individually , group in 2 different tables (clients , referrals). >since clients can have multiple referrals, need query "loop" through each referral until 2 conditions satisfied , compare results group against third condition , return cases only. problem is running through each condition separately though they're >specified in 'where'. i've tried combining conditions in 'c.id not in' still cannot consider conditions together. to clarify more: want referrals cases/clients satisfy these 3 conditions: each referral within time frame (r.referraldate>='2010-01-01' , r.referraldate<='2010-03-31') each referral agency except agency 16, 17 , 19 (r.agencyid<>16 , r.agencyid<>17 , r.agencyid<>19) and referrals case/client linked or referralcodeid = 18 select c.id, c.lastname, c.firstname, a.agencylabel 'referra...

iphone - pushViewController call from uiview -

let me explain problem: i have uiviewcontroller 2 uiviews. have button in 1 of uiview , call methode uiviewcontroller. [controller actionmainsettings]; and methode: -(void)actionmainsettings{ mainsettings *maincontroller = [[mainsettings alloc] initwithnibname:@"mainsettings" bundle:nil]; [self.navigationcontroller pushviewcontroller:maincontroller animated:yes]; [[self navigationcontroller] setnavigationbarhidden:yes animated:no]; [maincontroller release]; } mainsettings uivewcontroller... and nothing happen... when put button in uiviewcontroller ( [self.view addsubview:buttonsettings]; ) it's ok want put in uiview. can explain me happen? thx i not sure try super.navigationcontroller instead of self . also, of code, assume it's settings view. recommend use [self presentmodalview:yourview animated:yes] . can @ uiview documentation range of animations.

How can I make links out of my PHP twitter feed output? -

i'm using simple php include grab my current twitter status , output content my website . trouble though, output doesn't generate links actual status when there urls in status. what best or simplest way make happen? here's php i'm using populate status: <?php $response = new simplexmlelement('http://twitter.com/users/show/jglovier.xml',null,true); echo $response->status->text.''; ?> *edit: since i'm front-end developer comfortable html, css, , barely js, i'm looking simplest fix here, preferably js based. try using bcherry/twitter-text-js . autolink urls, @mentions, , #hashtags specification twitter.com uses. put twitter-text.js on server, load after load jquery, , run snippet below on document ready. $('p.status').each(function(index, element) { $(element).html(twttr.txt.autolink($(element).text())); });

c# - Using System.Security.AccessControl to remove an ACE from a folder ACL is very slow if the target folder size is very large -

i need remove accounts (like "everyone" trustee or global group giving access folder) acl on particular subfolder of share. directorysecurity object, , loop through authorizationrulecollection, remove accessrule in question acl, , call setaccesscontrol apply changes. works fine if target folder small, if has lot of child folders , files, can take forever apply changes (much longer manually). want deal acl on target folder. there way using .net directorysecurity classes? or have resort win32 api or other solution? thanks. here snippet of code. call dirinfo.setaccesscontrol(dirsec) hangs when folder size large. directoryinfo dirinfo = new directoryinfo(path); directorysecurity dirsec = dirinfo.getaccesscontrol(); authorizationrulecollection acl = dirsec.getaccessrules(true, true, typeof(system.security.principal.ntaccount)); foreach (filesystemaccessrule ace in acl) { if (groupstoremove.contains(ace.identityreference.val...

java - Best way to export data to mySQL database -

what best way export bunch of strings android app mysql database? i've looked on place. on here , on internet. have found bunch of different answers nothing makes sense. should use asynctask or httpclient? looked @ microsoft jdbc database export didn't make sense me. help. edit: need add data mysql database table. you can jdbc connector , jdbc api. i've tested connector mysql-connector-java-3.0.17-ga-bin.jar , works perfect , fast. you'll need asynctask or runnable in own thread avoid locking ui thread , risking killing apk. check here for example

Do these two PHP OOP syntaxes yield the same result? -

in php, is: $objectvar = someclassname::somefunction($var); the same as: $object = new someclassname(); $objectvar = $object->somefunction($var); no. $objectvar = someclassname::somefunction($var); here, somefunction static method; i.e. belongs class, not object. $object = new someclassname(); $objectvar = $object->somefunction($var); in code, instance method should accessed through object. the result same, handle used call method different.

java - setContextClassLoader implications -

similar question: setcontextclassloader implications , trying clean warnings memory leaks. specifically, have servlet code follows: public void doget(httpservletrequest httprequest, httpservletresponse httpresponse) throws servletexception, ioexception { class basicthread extends thread { public void run() { // finite amount of stuff here } } thread thread = new basicthread(); //thread.setcontextclassloader(null); thread.start(); } this article: http://wiki.apache.org/tomcat/memoryleakprotection#cclthreadspawnedbywebapp , indicates if uncomment setcontextclassloader line, error messages go away. but question is: there memory leak? if so, don't want make warnings go away, want fix leak. how do so? thanks. (also, if change line "// finite amount of stuff here" "// infinite amount of stuff here (ie, loop forever)", proper way of ensuring no memory leaks in scenario?) this real issue if...

ieee - Last-page column equalization for latex IEEEtran class? -

in documentation ieeetran latex class, it's mentioned 2 columns on last page need manually adjusted in order balanced (have same length). i see \newpage allow me break first column rest of content on second column. allows paragraph-level equalization, , looks good, i'm having trouble line-level equalization, is, breaking column lines instead of paragraphs. when insert \newpage in middle of paragraph (instead of between paragraphs), latex splits paragraph in two. second part goes top of second column (as desired) , first part remains in first column. there 2 issues i've found this, , i've solved 1 of them. the first issue partial paragraph on top of second column treated latex new paragraph, it's indented. fixed adding \noindent after \newpage it's not indented. the second issue partial paragraph in first column, paragraph justified (as expected), last line ragged (no justification). there way force justification of last line? latex has environme...

c# - Call JavaScript function from global.asax.cs -

i want call javascript function (which internally shows popup error message) global.asax.cs file. here code trying in global.asax.cs file, protected void application_error(object sender, eventargs e) { system.web.ui.page mypage = (system.web.ui.page)httpcontext.current.handler; mypage.registerstartupscript("alert", "<script language=javascript>alert('test');</script>"); } but not calling alert nor giving error or warning message in firebug , google chrome console. how can javascript code called? there 2 different kind of errors @ point. errors thrown compiler. errors thrown program. the compiler can throw error there , example, can not find literal control in code behind. in case page not exist , there no way @ point , give javascript alert. errors run time of program , example, null exception, can stop page rendered , stop page , can not have page handler there. so httpcontext.current.handler not page . in ...

java - File Upload in fire fox -

iam not able upload files in firefox , safari iam able in explorer. when tried debug found out in case of ie upload browser giving entire file eg c:\documents , settings\jjayashree\my documents\price.csv in ff , safari upload widget giving file name no extension. code if (filename.contains("\")) { index = filename.lastindexof("\"); } if (this.filename != null && this.filename.trim().length() > 0 && index >= 0) { this.filename = this.filename.substring(index + 1, this.filename.length()); int dotposition = filename.lastindexof('.'); string extension = filename.substring(dotposition + 1, filename.length()); try { if (profiletype.equalsignorecase("sampleprofile")) { if (extension.equalsignorecase("csv")) { //filenametextbox.settext(this.filename); this.form.submit(); ...

set - MySQL blob dump to tab delimited files -

i migrating mysql 5.1 database in amazon's ec2, , having issues tables longblob datatype use image storage. basically, after migration, data in longblob column different size, due fact character encoding seems different. first of all, here example of before , after migration: old: x??]]??}?_ѕ??d??i|w?%?????q$??+? new: x��]]����_ѕ��d��i|w�%�����q$��+� i checked character set variables on both machines , identical. checked 'show create table' , identical well. client's both connecting same way (no set names, or specifying character sets). here mysqldump command used (i tried without --hex-blob well): mysqldump --hex-blob --default-character-set=utf8 --tab=. db_name here how loaded data: mysql db_name --default-character-set=utf8 -e "load data infile 'example.txt' table example;" here mysql character set variables (identical): old: +--------------------------+----------------------------+ | variable_name | value ...

sql - mysql insert after delete fails because of "duplicate entry" -

i have code 2 mysql queries. delete my_table user_id=some_number insert my_table (user_id, ... ) values(some_number, ...) the field user_id unique. in rare cases insert fails claiming duplicate entry occurred. first instinct leads me to believe delete didn't finish , insert trying insert , i'm getting duplicate entry. possible? how can avoid this? might there different explanation can think of? update: reason i'm deleting because want delete data not updating / inserting first time. also, think important state of data remains same. set autocommit=0; start transaction; delete my_table user_id=some_number; insert my_table (user_id, ... ) values(some_number, ...); commit;

Use of "this" keyword in C++ -

possible duplicate: is excessive use of in c++ code smell when should use "this" keyword in c++? is there reason use this-> in c++, keyword "this" omitted? example: person::person(int age) { _age = age; } as opposed to: person::person(int age) { this->_age = age; } yes, not required , omitted. might required accessing variables after have been overridden in scope though: person::person() { int age; this->age = 1; } also, this: person::person(int age) { _age = age; } it pretty bad style; if need initializer same name use notation: person::person(int age) : age(age) { }

Problems with postgresql COPY command with Rails on different server -

i have rails app has been working months. in few places call directly database via activerecord::base.connection.execute( sql_code ) with recent need scale, added second server data processing. want run same app connect on network other database server. difference here. other areas of app work--it can connect remote database. where breaking, have rails issue psql copy command import csv file. result = activerecord::base.connection.execute( @pgsql_copy_command ) # perform copy command this fails , says csv file can not found. have verified there , readable both user running rails app , postgres user. am missing something? you can use copy stdin around this... so: conn = activerecord::base.connection_pool.checkout raw = conn.raw_connection raw.exec("copy tablename (col1, col2, col3) stdin") # open csv file looping through line line , getting line format suitable pg's copy... raw.put_copy_data line # once done... raw.put_copy_end while res = ...

ruby on rails - Why do I get an uninitialized constant Test::Unit::AutoRunner::Priority error? -

i upgrading ruby 1.9.2, , getting following error: /workspace/current/upgrade1.9.2/vendor/rails/activesupport/lib/active_support/dependencies.rb:131:in `rescue in const_missing': uninitialized constant test::unit::autorunner::priority /vendor/rails/activesupport/lib/active_support/dependencies.rb:120:in `const_missing' /.rvm/gems/ruby-1.9.2-p180@ruby-192-upgrade192/gems/test-unit-2.2.0/lib/test/unit/autorunner.rb:257:in `block in options' /.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/optparse.rb:799:in `initialize' /.rvm/gems/ruby-1.9.2-p180@ruby-192-upgrade192/gems/test-unit-2.2.0/lib/test/unit/autorunner.rb:151:in `new' /.rvm/gems/ruby-1.9.2-p180@ruby-192-upgrade192/gems/test-unit-2.2.0/lib/test/unit/autorunner.rb:151:in `options' /.rvm/gems/ruby-1.9.2-p180@ruby-192-upgrade192/gems/test-unit-2.2.0/lib/test/unit/autorunner.rb:141:in `process_args' /.rvm/gems/ruby-1.9.2-p180@ruby-192-upgrade192/gems/test-unit-2.2.0/lib/test/unit/autorunner.rb:57:in `run...

ruby on rails - Associated model is not saving data when page is refreshed -

rails 3.1 rc4 i have 1:1 association between user , profile . when submit new profile form, data i've entered displayed fine (see screenshot: http://i.imgur.com/fy8yu.png ), when refresh data instantly wiped. could tell me causing this? here's submit form: <%= form_for([@user, @user.build_profile]) |f| %> <div class="field"> <%= f.label :first_name %><br /> <%= f.text_field :first_name %> </div> <div class="field"> <%= f.label :last_name %><br /> <%= f.text_field :last_name %> </div> <div class="field"> <%= f.label :picture %><br /> <%= f.text_field :picture %> </div> <div class="field"> <%= f.radio_button(:sex, "male") %> <%= f.label(:sex, ...

lighttpd - How do I enable external access to a python fcgi app? -

i have simple web app displays simple hello world . can access app through web browser (127.0.0.1:3000/test/hello), cannot access using local ip app running on, or using external ip (i have forwarded port appropriately on router). server.modules += ( "mod_fastcgi" ) server.document-root = "/users/me/test" server.port = 3000 server.bind = "127.0.0.1" fastcgi.debug = 1 fastcgi.server = ( "test" => ( "python-fcgi" => ( "socket" => "/tmp/fastcgi.python.socket", "bin-path" => "/users/me/hello.py", "check-local" => "disable", "max-procs" => 1, ) )) how access web app using external ip? set server.bind local network ip of server rather localhost 127.0.0.1 . check port 3000 not blocked between hosts on network. by binding localhost bound loopback interface of machi...

java - Action Audit on a JSF with just a Primefaces DataTable -

Image
i auditing user actions on project , having following issue. there functionality called audit log , lists complete set of audited actions performed user on system. whenever user lists audit log action needs audited well. jsf page audit log made following: <ui:composition ...> <ui:define name="content"> <h:form id="audit_list"> <h:panelgrid columns="1"> <p:breadcrumb> <p:menuitem value="#{i18n['xxx']}" url="index.xhtml" /> <p:menuitem value="#{i18n['yyy']}"/> </p:breadcrumb> <p:panel header="#{i18n['zzz']}"> <p:datatable var="auditentry" value="#{auditlist.allauditentries}" paginator="true" ...

c# - how to copy all *.bak files from Directory A to Directory B? -

how copy *.bak files directory a directory b ? this should need: string dira = @"c:\"; string dirb = @"d:\"; string[] files = system.io.directory.getfiles(dira); foreach (string s in files) { if (system.io.path.getextension(s).equals("bak")) { system.io.file.copy(s, system.io.path.combine(targetpath, filename), true); } }

java - Comparator for a specific column in JTable -

how can set custom comparator specific column in jtable? the third column of table contains string representaion of double values , want creat comparator column when click on header of column sort according comparator. the first question why, if managing doubles, dealing strings. should better if used doubles , set format in cellrenderer column. anyway, looking may this: http://download.oracle.com/javase/tutorial/uiswing/examples/components/tablesorterdemoproject/src/components/tablesorter.java edit: if somehow translation double representation complicated, create comparable class contains both double number , string representation. equals(), hashcode() , compareto() implemented using value of double; cellrenderer() , tostring() use string representation.

multithreading - Simultaneous access to a Java synchronized block using threads? -

how can 2 threads access synchronized block simultaneously? is, how can make 1 thread give chance other thread execute synchronized block, before thread finishes execution of same synchronized block? see wait() , notify() , , notifyall() . edit: edit question incorrect. sleep() method not release monitor. for example: private static final object lock = new object(); public static void main(string[] args) { executorservice executorservice = executors.newfixedthreadpool(2); executorservice.execute(new one()); executorservice.execute(new two()); } static class 1 implements runnable { @override public void run() { synchronized (lock) { system.out.println("(one) own lock"); system.out.println("(one) giving lock , waiting"); try { lock.wait(); } catch (interruptedexception e) { system.err.println("(one) shouldn't have been interrupt...

c# - How do you include Xml Docs for a class library in a NuGet package? -

Image
i creating nuget package c# class library, , include generated xml documentation library. nuspec file: <?xml version="1.0" encoding="utf-8"?> <package> <metadata> <id>mylibrary</id> <version>1.0.0.0</version> <authors>john nelson</authors> <language>en-us</language> <description>a c# class library</description> </metadata> <files> <file src="..\..\build\mylibrary.dll" target="lib\net40" /> <file src="..\..\build\mylibrary.xml" target="lib\net40" /> </files> </package> when build package command : nuget pack mylibrary.nuspec it generates error. if remove line: <file src="..\..\build\mylibrary.xml" target="lib\net40" /> nuget.exe creates nupkg. can unzip package, , verify contents correct. doing wrong? should xml file go different target di...

php - What's the best way to store Checkbox Values in MySQL Database? -

first, take @ page example: click here if view 'amenities' section, there 3 sets of checkboxes (unit features, community features , utilities included in rent). my question is: how can use php make 3 array variables (e.g. $unit_features, $community_features , $utilities_included) store boxes are/are not checked 3 respective fields in table? more importantly: how pull data out of table in same array format specifics can viewed/edited/deleted? note, i've tried countless times having separate fields in table (as tinyints) - gets bulky , isn't elegant @ all...i thought of making object class failed yet again.. you have many-to-many relationship between properties , amenities. model this, need separate table, not variable number of columns. there 1 table stores properties. insert property (id, address, square_footage...) values (111, '123 main st', 1234...) there 1 table stores possible amenities. insert amenities (id, type, descripti...

java - Android passing an arraylist back to parent activity -

i've been searching simple example of no luck. in android application have 2 activities: 1. main activity launched @ startup 2. second activity launched pressing button on main activty. when second activity finished (by pressing button) want send arraylist of type myobject main activity , close itself, main activity can whatever it. how go achieving this? have been trying few things crashing application when start second activity. when user presses button launch second activity: intent = new intent(mainactivity.this, secondactivity.class); startactivityforresult(i, 1); the array bundled after pressing button on second activity: intent intent= getintent(); bundle b = new bundle(); b.putparcelablearraylist("myarraylist", mylist); intent.putextras(b); setresult(result_ok, intent); finish(); and listener on main activity (although i...

javascript - Overriding default behaviour of anchor tags using jquery -

i trying override default behaviour of anchor tag can load in web page on server exisiting div, rather new tab or window. so far have: mycontainer.click(function(){ event.preventdefault(); $('a').click(function(){ var link = $(this).attr('href'); mycontainer.load(link); }); }); in chrome have click link twice before anything, in ie ff doesnt work @ , refreshes page new link. any appreciated. shouldn't just: $('a').click(function(e) { e.preventdefault(); mycontainer.load(this.href); }); your code assigns click handler inside click handler. first click attach click handler link, , second click (on link) execute new click handler. it seems need one click handler. if links added dynamically, can use .on() (the successor of .live , .delegate ): mycontainer.on('click', ...

objective c - executing shell command with | (pipe) using NSTask -

i'm trying execute comamnd ps -ef | grep test using nstask can't | grep test included in nstask: this i'm using output of ps -ef string need somehow pid of process test nstask *task; task = [[nstask alloc] init]; [task setlaunchpath: @"/bin/ps"]; nsarray *arguments; arguments = [nsarray arraywithobjects: @"-ef", nil]; [task setarguments: arguments]; nspipe *pipe; pipe = [nspipe pipe]; [task setstandardoutput: pipe]; nsfilehandle *file; file = [pipe filehandleforreading]; [task launch]; nsdata *data; data = [file readdatatoendoffile]; nsstring *string; string = [[nsstring alloc] initwithdata: data encoding: nsutf8stringencoding]; nslog (@"got\n%@", string); piping feature provided shells, such /bin/sh . may try launching command via such shell: /* ... */ [task setlaunchpath: @"/bin/sh"]; /* ... */ arguments = [nsarray arraywithobjects: @"-c", @"ps -ef | grep tes...

air - Strange Bar Overlayed on Flex Interface -

when set flex application run in fullscreen_interactive, click on control bar appears along bottom of screen. it's quite obtrusive , has shown on 2 different computers far. there's lot of solid white underneath , covers @ least 5-10% of bottom of screen, blocks controls also. never made/placed thing, has else come across this? append: protected function windowedapplication1_applicationactivatehandler(event:airevent):void { stage.displaystate = stagedisplaystate.full_screen_interactive; stage.addeventlistener(keyboardevent.key_down, stopesc); //scale resolution size var thisscreen:screen = screen.mainscreen; var newscalex:number = thisscreen.visiblebounds.width / 1019 * 0.98; var newscaley:number = thisscreen.visiblebounds.height / 680 * 0.98; var newscale:number = math.min(newscalex,newscaley,1.5); this.scalex = newscale; this.scaley = newscale; ...

android - How to have same height for TextView as for EditText? -

i have view 3 lines, in 1 of them 2 textviews, in other 2 1 textview , 1 edittext. how can have same height lines, , size of textview replaces edittext in 1 line have same size other edittexts? regards, eddie example code here: have 2nd textview in first line have same size (of view , of text within it) edittext in following lines. <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" > <linearlayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" > <textview android:text="datum:" android:layout_width="60dip" android:layout_height="wrap_content" android:layout_alignparentleft="tr...

Need help altering this Jquery code to fix vertical positioning of an element -

i have set on jsfiddle page, please take @ here: http://jsfiddle.net/ryanjay/bq5ee/ my problem is, when open div (column), aligns other closed divs bottom of it. can me adding jquery code make when open each div(column) other divs stay aligned top. perhaps has margin-top, unsure. i using slider wraps around columns, floating them isn't option.. wrap next line. must have display of inline-block. thanks here html: <div class="column"> <div class="open"> open </div> <div class="close">close</div> <div class="contentinner"> <div class="projectcontainer"> content goes here. </div> </div> </div> <div class="column"> <div class="open"> open </div> <div class="close">close</div> <div class="contentinner"> ...

types - Null Vs Option in F# -

i have problem understanding co-existence of "null" , option in f#. in book have read null value not proper value in f# because way f# eliminates excessive null checking. still allows null-initialized references in f#. in other words, can have null values don't have weapons defend with. why not replace nulls options. because of compatibility issues .net libraries or languages it's still there? if yes can give example shows why can't replaced option? f# avoids use of null when possible, lives in .net eco-system, cannot avoid completely. in perfect world, there no null values, need them. for example, may need call .net method null argument , may need check whether result of .net method call null . the way f# deals is: null used when working types come .net (when have value or argument of type declared in .net, can use null value of type; can test if equals null ) option needed when working f# types, because values of types declared in f# c...

iphone - Problem with Response asihtttprequest -

nsurl *url = [nsurl urlwithstring:@"someurl"]; asiformdatarequest *request = [asiformdatarequest requestwithurl:url]; [request setpostvalue:year1 forkey:@"year"]; [request setpostvalue:appy_level forkey:@"appy_level"]; [request setpostvalue:reasons forkey:@"reasons"]; [request setpostvalue:country forkey:@"country"]; [request setpostvalue:city forkey:@"city"]; [request setpostvalue:sex forkey:@"sex"]; [request setrequestmethod:@"post"]; [request setvalidatessecurecertificate:no]; [request setdelegate:self]; [request startasynchronous]; nslog(@"response -%@",[request responsestring]); [self dismissmodalviewcontrolleranimated:yes]; } - (void)requestfinished:(asihttprequest *)request { nsstring *response = [request responsestring]; nslog(@"%@",response); } any idea why code return (null) mean response null? , requestfinised: method isnt working write[requestsetdidfinishselector:@...

c# - How to generate .NET 4.0 classes from xsd? -

what options generate .net 4.0 c# classes (entities) xsd file, using visual studio 2010? simple enough; run (at vs command prompt) xsd your.xsd /classes (which create your.cs ). note, however, of intrinsic options here haven't changed since 2.0 for options, use xsd /? or see msdn ; example /enabledatabinding can useful.

c# - how to validate asp textbox placed inside jquery template -

i have asp:textbox inside jquery template given below <script id="projecttypetemplate" type="text/x-jquery-tmpl"> <tr id="trprojtype"> <td>${lang_id} </td> <td><input id="${lang_id}" type="text" /> <span class="requiredfieldstar">*</span></td> <td>${merchant_id}</td> <td>${lang_id}</td> <td>${name_lang}</td> </tr> </script> i have validation this <div id = "projtypediv"> <table id = "project_type_templ_tbl" border="1" cellspacing="0" style="width:100%;"> <asp:requiredfieldvalidator id="reqvprojecttypedescription" runat="server" errormessage="enter project type description" ...

How to validate non-english (UTF-8) encoded email address in Javascript and PHP? -

part of website working on contains registration process users have provide email address. became aware non-ascii based domains possible (so email). backend utf-8 encoded mysql expecting users (with differnt locales) should able enter email don't know how validate kind of email address. currently testing out jquery tools , validates english email address correctly fails validate non ascii email. need same @ server side php. there regular expression can validate kind of email address? i have tried fails in jquery tools (this example demo, don't understand too) 闪闪发光@闪闪发光.com also happen when type english email address (jonesmith@somemail.com) own ime. can validated current regular expression have english mail validation. don't have worry if email exist not. thanks attempting validate email addresses may not idea. specifications ( rfc5321 , rfc5322 ) allow flexibility validating them regular expressions literally impossible , , validating function great ...

asp.net - Preventing non-logged in members from accessing a certain page -

i'm using asp.net , 'member' site me, site-admin privileges. i'm setting can make small edits pages without having re-upload site every time. i have "editpage.aspx" page i'm going have send me to-to edit page. how keep other nosy people accessing page without being logged in? there lots of ways accomplish this. on sites, have login (i.e. there no need full-blow membership provider admin runs not logged in), after login, set flag in session variable. on each page need protect in page load: protected void page_load(object sender, eventargs e) { if (session["myuser"] == null) response.redirect("login.aspx", true); that way, arrives on page not logged in, gets redirected login page. pretty simple solution, , easy implement. wouldn't hide state secrets behind it...but have never had problem unauthorized users getting protected pages. using session has benefit of timing out if logged in user...

Where can I find H.264 standard? -

i write little fuzzer h.264 not aware file format. give me standard please, in order forge correct (and therefore incorrect) h.264 files. thanks mathias you can download copy of here: http://www.itu.int/rec/dologin_pub.asp?lang=e&id=t-rec-h.264-200305-s!!pdf-e&type=items

c# - WCF hosting and Performance -

i have wcf service. have done testing basichttp binding , tcp binding. in console client created hundreds of threads , hit service tcp , http binding. turned out tcp twice faster http. then made web client runs on iis , hits service. turned out http faster tcp. how happen? isnt tcp supposed faster basichttp? code 1 below. similar. stopwatch start here thread[] ts = new thread[100]; for(int i= 0; i< ts.lenght;i++){ ts[i] = new thread(foo); // replace bar second test. ts[i].start(); } for(int 0;i< ts.lenght;i++){ ts[i].join(); } stopwatch stop here. public static void foo(){ myserviceclient myclient = new myserviceclient("nettcpbinding"); myclient.getresult(1); } public static void bar(){ myserviceclient myclient = new myserviceclient("basichttpbinding"); myclient.getresult(1); } did know wcf has throttling turned on by default . before run these tests, should turn off using bit of config in web.config's se...