Posts

Showing posts from April, 2012

What is the Html5 API which retrieves image metadata such as file size, format (jpeg, png ..) from image file? -

i want retrieve metadata (width, hight, format ..) image file (jpeg, png, bmp etc.) in html5. can use canvas api deal width image. however, cannot find api retrieve metadata file. can know me? it looks this little lib might trick you.

qt4 - How to Programmatically Compose Email using my mail account in Nokia Qt? -

i new concept. can please give path solution, framework or library need use in app work. for example: to:examples@example.com subject: test mail message: body of message thanks in advance check out qt mobility messaging api .

html - Javascript Complete Amateur? -

i have javascript function wrote append select box radiobutton set based on radio button clicked. when 1 clicks 1 or other. problem is, i'm such amateur can't stop adding new select elements span set place them in. keep trying different ways check if element or innerhtml have been set , use check decide whether create select. none of has worked me. can point me in direction of tutorial (i've been searching, tried everything, no fez makes me think simpler problem structure of whole function). here code, light shed on super helpful. taught myself code know horrible. help!! function moreinput(vinput) { var mored = document.getelementbyid('mored'); //document.write(mored); if(vinput == \"approved\") { if(mored.length > 0) { mored.removechild(approvedopts); } var select = document.createelement(\"select\"); select.options[0] = new option('a'); select.options[1] = new optio...

java - Grails baked-in testing -

i read article saying testing support baked-in : testing priority , first-class citizen in grails. grails promotes testing; , provides utilities make testing easier — low level unit tests high level functional tests. in addition, grails not married particular testing framework. can use junit, spock, easyb, geb, selenium, canoo etc. testing framework can made work grails (by writing plugin hooks testing framework grails testing infrastructure). does mean can test grails other java ee framework? block of text saying nothing(like grails have integration junit) or there special grails testing? edit: how compare seamtest? i grails supports testing means of folder structure contains folders unit , integration tests, , commands out test writing. when create domain class or controller, instance, automatically creates test stubs you. has commands run tests, run unit/integration tests or run individual tests - these create reports automatically ...

deployment - Deploy asp.net mvc web application on IIS 6 -

i have develop asp.net mvc 2 web application. want deploy published version on server (local office server). has been set windows 2003 server , iis 6.0 version. i went through this link , followed option 1) unfortunately not succeed. other option seems impossible me now. what have here? please guide me. open iis manager right click on “web sites” folder hit new -> web site… in wizard hit next add description, hit next assign ip, port , host header, hit next enter/browse path website deployment folder, hit next select read, run scripts , write, hit next, hit finish right click newly added website, hit properties in properties window go “home directory” tab click “configuration…” button in popup window on “mappings” tab locate .aspx extension in “application extensions” grid, select , hit “edit…” button (this copy location of aspx mapping) in edit window copy executable path, hit cancel back in application configuration screen hit “insert…” button pas...

How to control file permissions in CVS repository? -

currently users have umask set in ways result in execute permission on regular files, i'd avoid . is there way force files checked in read exceptions? what recommended way handle in cvs? i not sure if best solution, cvswrappers file in cvsroot directory of repo, using commitinfo, commitcheck , commit_prep.pl. if don't have commit_prep.pl, can use one: http://opensource.apple.com/source/cvs/cvs-29/cvs/contrib/commit_prep.pl there quite few examples on web, search commit* files if don't have in repo. note that, post suggests, permission set during first commit of file, after that, you'd need "manually" modify permission on repository itself. how add execute permission file in cvs after it's been checked in? in commit_prep.pl, can clear exec permission using chmod ugo-x , before file committed first time. this solution assumes using linux.

highlight - Emacs style highlighting for incremental search in vim -

in vim, there way enable on-the-fly highlighting all matches when searching? if enable incsearch , type "/something" highlight first match only. if enable hlsearch , type "/something", nothing happens until press enter (it highlights previous search). in emacs first match highlighted, , (after slight delay) other matches on screen highlighted in different color, giving instant feedback when scanning matches in piece of code. doesn't answer question, maybe this wikia post can help? quote post: put following code in vimrc, or create file ~/.vim/plugin/autohighlight.vim (unix) or $home/vimfiles/plugin/autohighlight.vim (windows) containing script below. restart vim. to automatically highlight current word, type z/ . turn off, type z/ again. " highlight instances of word under cursor, when idle. " useful when studying strange source code. " type z/ toggle highlighting on/off. nnoremap z/ :if autohighlighttogg...

Understanding .NET + COM interoperability -

i'm in need of on understanding architecture when calling com/dll's created tlbimp.exe, .net application. scenario is: i have dll called xyz.dll contains methods, classes etc. can create .net wrapper around xyz.dll , interop.xyz.dll can reference .net application. my first question then: when in .net application create object class in interop.xyz.dll , call method on class, original xyz.dll called? far understand interop.xyz.dll works form of proxy class original xyz.dll , therefore xyz.dll must present on system making call happen? second question: lets have create interop.xyz.dll using tlbimp.exe. on system .net application running, xyz.dll file patched/updated. assumtion application still work long same classes/methods avaible in newly patched xyz.dll. or wrong? there best-practice when having deal patching of referenced interop'ed dll's? thanks ! best regards frank your understanding of generated interop dll pretty correct - contains bunch of ...

Nhibernate 3.0:Mapping in the hbm.xml file for a relational table step by step procedure needed -

i'm using nhibernate version 3.0 , first time im using it.i know how can create hbm.xml file tables relationship exists between them. here scenario have 2 tables named table , table b. table b primary key foriegn key in table a. how need write hbm file , how need insert values both tables simultaneously using 1 object. (ie., how should need write table class file , table b class file.) if 1 explains me in set step procedure easier me understand. this covered in nh doc. relationship talking <many-to-one/> , search here: http://knol.google.com/k/fabio-maulo/nhibernate-chapter-5-basic-o-r-mapping/1nr4enxv3dpeq/8# you find examples. in order have intellisense inside visual studio when write hbm files, can copy these files nhibernate-configuration.xsd nhibernate-mapping.xsd in c:\programme\microsoft visual studio xxx\xml\schemas path. in order save simultaneously referred entity have ensure apply cascade="save-update" on <many-to-one/...

c# - What are the advantages of using [DataContract] rather than [Serializable] in WCF -

any advantage using datacontract? see great comparison of xmlserializer , datacontractserializer on dan rigsby's blog. some points in favor of datacontractserializer: about 10% faster xmlserializer will serialize decorated [datamember] - if it's not public visible will not serialize unless tell ("opt-in") you can define order in elements serialized using order= attribute on [datamember] doesn't require parameterless constructor deserialization

Jquery UI range silder in rails app -

i have small problem slider use time range. when move 1 of handlers , second first 1 changes it's value tiny bit. (5 min in case) here's code function slidetime(event, ui){ var minutes0 = parseint($("#slider_range").slider("values", 0) % 60); var hours0 = parseint($("#slider_range").slider("values", 0) / 60 % 24); var minutes1 = parseint($("#slider_range").slider("values", 1) % 60); var hours1 = parseint($("#slider_range").slider("values", 1) / 60 % 24); $("#log_times_from").val(gettime(hours0, minutes0)); $("#log_times_to").val(gettime(hours1, minutes1)); } function gettime(hours, minutes) { var time = null; minutes = minutes + ""; if (minutes.length == 1) { minutes = "0" + minutes; } return hours + ":" + minutes; } slidetime(); $(document).ready(function() { $("#slider_range...

PHP Session Handling (read function) Problem -

i have class handle session in code , store session data in db. in read callback function write query , load data db , return value when dump $_session empty! i trace code , query corrent , data load not set session value. problem apear in subdomains session_id , cookie correct. my read function code: function read($session_id) { $result = @mysql_query(" select session_data session_table session_id = '".$session_id."' , session_expire > '".time()."' "); if (is_resource($result) && @mysql_num_rows($result) > 0) { $fields = @mysql_fetch_assoc($result); return $fields["session_data"]; } return ""; } my log: read function log: select session_data sessions_table session_id = '389...

c - Why does the compiler ignore OpenMP pragmas? -

in following c code using openmp in nested loop. since race condition occurs, want perform atomic operations @ end: double mysumallatomic() { double s2 = 0.; #pragma omp parallel shared(s2) for(int a=0; a<128; a++){ for(int b=0; b<128;b++){ double myterm = (double)a*b; #pragma omp atomic s2 += myterm; } } return s2; } the thing #pragma omp atomic has no effect on program behaviour, if remove it, nothing happens. if change #pragma oh_my_god , no error! i wonder going wrong here, whether can tell compiler more strict when checking omp pragmas or why not error when make last change ps: compilation use: gcc-4.2 -fopenmp main.c functions.c -o main_elec_gcc.exe ps2: new code gives me same problem , based on gillespie idea: #include <stdio.h> #include <string.h> #include <stdlib.h> #include <omp.h> #include <math.h> #define nrack 64 #define nstars 1024 double mysumallatomic_serial(float rocks[nrack][...

Jquery UI Dialog ... CSS in IE doesn't work like FF etc -

if write html jquery ui dialog box naturally centred. add div , use css ... #printreport { text-align: left; font-family: tahoma; font-size: 12px; width: 880px; } ... , then $("#printreport").empty().append(results); to put text on page - , want in ff/chrome etc (left justified) ... in ie (v7 , v8) text still centred. am missing something? thanks i assuming of parent div's set centered, eiter using deprecated tag or doing like: margin: 0 auto in order make work should this: body { text-align: center } #printreport { width: 880px; margin: 0 auto; text-align: left } hope helps.

c# - ToString on null string -

why second 1 of these produce exception while first 1 doesn't? string s = null; messagebox.show(s); messagebox.show(s.tostring()); updated - exception can understand, puzzling bit (to me) why first part doesn't show exception. isn't messagebox, illustrated below. eg : string s = null, msg; msg = "message " + s; //no error msg = "message " + s.tostring(); //error the first part appears implicitly converting null blank string. because cannot call instance method tostring() on null reference. and messagebox.show() implemented ignore null , print out empty message box.

asp.net - Multiple roles in ASP Menu -

i have problem asp.net menu. have parent menu 3 childs. 2 of child have anonymous access, , 1 child have role base access. parent has access e.g : parent - child - child b - child c child & b have anonymous acces, or in role can use "*" character. child c show specific role, not anonymous. how can set role parent ? child a, b , c in asp.net menu (.net framework 4) used sqlsitemapprovider. you can set parent role "*" well. long child c has it's role specified, filtered out accordingly. so example this: parent roles="*" childa roles="*" childb roles="*" childc roles="rolec" if had specific roles each node set roles this: parent roles="rolea,roleb,rolec" childa roles="rolea" childb roles="roleb" childc roles="rolec" to have these filtered based on these roles need enable security trimming in web.config. guide can found here: http://msdn.m...

php - send a email with attachment(Problem is the file size is 0k) -

dear friends, have problem file attachment, using email functionality attachment project, attached file.xls mail, in mail cant file values, showing 0k. file in local having datas, not working while run email functionality, attachment have 0k size, can me please... code below.... $filename = "test.xls"; $path = $_server['document_root']."/path/to/documents/"; $file = $path.$filename; $to = "example@test.com"; $subject = 'repairs list report'; $message = "please find attachment file repairs list of last week..."; //strip_tags($_post['message']); $attachment = chunk_split(base64_encode(file_get_contents($file))); //$filename = $_files['file']['name']; $boundary =md5(date('r', time())); $headers = "from: test@example.com\r\nreply-to: example@test.com"; $headers .= "mime-version: 1.0"; $message=...

vb.net - Displaying progress while uploading data -

i using following code located here upload files public function uploadfile(byval ofile fileinfo) boolean dim ftprequest ftpwebrequest dim ftpresponse ftpwebresponse try ftprequest = ctype(ftpwebrequest.create(ftpsite + currentdirectory + ofile.name), _ ftpwebrequest) ftprequest.method = webrequestmethods.ftp.uploadfile ftprequest.proxy = nothing ftprequest.usebinary = true ftprequest.credentials = new networkcredential(username, password) ftprequest.keepalive = keepalive ftprequest.enablessl = usessl if usessl servicepointmanager.servercertificatevalidationcallback = _ new remotecertificatevalidationcallback(addressof validateservercertificate) dim filecontents(ofile.length) byte using fr filestream = ofile.openread fr.read(filecontents, 0, convert.toint32(ofile.length)) end using using writer stream = ftprequest.getrequeststream writer.write(filecontents, 0, filecontents.length) end using ftpresponse = ctype(ftprequest.getresponse, ftpwebresponse) ftpresponse.close() f...

django - Robots.txt is not serving -

i using python django framework web application. have made urls.py entry serve robots.txt file, reason seems it's not able serve up. url(r'^robots.txt$', 'support.views.robot_file',name="robot_file"), this method works sitemap.xml has similar entry works url(r'^sitemap.xml', 'support.views.sitemap_file',name="sitemap_file"), which leads me believe serving robots.txt file problem when change serve robot.txt works. can throw pointers in why happening? you seem using apache - there's in apache config breaking robots.txt - maybe "alias /robots.txt /somewhere/that/doesn't/exist.txt" perhaps.

c++ - DCOM: How to close connection in server on client crash? -

i have rather old project: dcom client , server, both in c++\atl, windows platform. works fine: local , remote clients connect server , work simultaneously without problem. but when remote client crashes or being killed task manager or "taskkill" command or power switch off - have problem. server not know client crash , tries send new events clients (also crashed). result have pause (server can not send data crashed client) , it's duration proportional numbers of crashed remote clients. after 5 crashed clients pauses long equal server stop. i know dcom "ping" mechanism (dcom should disconnect clients not respond "every 2 minutes ping" after 6 minutes of silence). , really, after 6 minutes of hang have small period of normal work server coming "paused" state. what can of this? how make dcom "ping" works fine? if implement own "ping" code possible disconnect old dcom clients connection manually? how it? i...

Auto click macro by using php -

i'm using macro recorder programs auto clicking. these kinds of programs made visual basic, c++, etc., i'd write 1 in php. i'm loading remote website using php's curl implementation. i'd php script click exact mouse positions (for example: x:345px y:234px), wait 15 seconds, repeat. is possible in php? if so, php functions should use? check out selenium ide firefox extension play , simple record test cases. supports click on specific coordinate. selenium command clickat

windows - Determine password expiry date -

i have windows xp system , user accounts configured have passwords expire in 45 days option set. trying figure out, either manually or via use of batch file, password expiry date based on current user logged in. know there vbscript files can accomplish this, these pc's configured not execute vbscript files, therefore need either manually or batch files. thanks! if on 1 computer, 1 user, , ran locally... net user username | findstr "expires" multiple machines ran remotely 1 user account... put computer names or ip's in text file (i.e. systems.txt) psexec @systems.txt net user username | findstr "expires" psexec free sysinternals if want know expiration date on local users on multiple network computers can use powershell , psexec (remote machines not require powershell), so... $systems = get-content .\systems.txt; foreach ($sys in $systems) { foreach ($token in (get-wmiobject win32_useraccount -computername $sys -filter "doma...

wpf controls - wpf remove datagrid left padding -

Image
can please shed light on how rid of mysterious padding on left? i've tried numerous properties none seem affect. the padding referring row header. remove row headers, can set headersvisibility="column" on datagrid . i have seen cases property set "column" of rows still show header. can work around setting rowheaderwidth="0" on datagrid .

Google Checkout: Offering Multiple Options when Adding to Cart -

i'm using google checkout merchant account , i'm having difficulty add cart code when try have multiple options 1 product. specifically, want sell **paint** , give customers 2 options: **size** (5-gallon, gallon, quart) , **color** (100s of colors) , use 1 add cart button: **paint**      **size**    **color**    **add cart** is possible? or need have 3 add cart buttons? **paint**      **5-gallon**    **color**    **add cart** **paint**      **gallon**    **color**    **add cart** **paint**      **quart**    **color**    **add cart** thanks, thomas pauly for best user experience, may want build cart (which allow alternate user interface, such drop down tin size, or colour picker choose available shades) - can use xml api transm...

database - Mysql - Add auto_increment to primary key -

i have strange problem mysql. i trying alter table's column primary key , has auto_increment constraint defined on it. foreign key reference multiple other tables. need change length of column in both , parent , children. set foreign_key_checks=0; alter table parent modify identifier smallint(10) unsigned; alter table child_1 modify fk_identifier smallint(10) unsigned; alter table child_2 modify fk_identifier smallint(10) unsigned; alter table child_3 modify fk_identifier smallint(10) unsigned; alter table child_4 modify fk_identifier smallint(10) unsigned; alter table child_5 modify fk_identifier smallint(10) unsigned; set foreign_key_checks=1; this removes auto increment on parent table. best way add constraint ? the below seems failing. mysql> alter table parent modify identifier smallint(10) primary key auto_increment; error 1068 (42000): multiple primary key defined alter table parent modify identifier smallint(10) auto_increment; ------------------------...

silverlight - How to set http header If-Modified-Since on a WebRequest in Windows Phone 7? -

trying set 'if-modified-since' header in wp7: request.headers[httprequestheader.ifmodifiedsince] = datestring; gives error: this header must modified appropriate property. which means property .ismodifiedsince should used on request class, described in msdn: http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.ifmodifiedsince.aspx but property not exist in silverlight i.e. wp7. has been able set header http request on windows phone 7? shawn wildermuth posted problem in september 2010, no solution: http://social.msdn.microsoft.com/forums/en/windowsphone7series/thread/8aec7481-2cf3-4047-b0d4-05d4313a9e4c thank you! you can use string httprequestheader.ifmodifiedsince represents: request.headers["if-modified-since"] = datestring; i've had number of other headers wp7 doesn't expose helper methods setting. update based on remarks @ http://msdn.microsoft.com/en-us/library/8y7x3zz2(v=vs.95).aspx appear not possible ...

iphone - Correct way to release a UIColor PatternImage -

i have few, full screen, uicolor patternimages (in scrollviews ) in ipad app , experiencing memory problems (surprise?) when started having memory issues, implemented lazy loading in scrollviews. when problems continued, moved away factory methods (like [uicolor colorwithpatternimage:...] ) "alloc"ed methods (like [[uicolor alloc]initwithpatternimage:...] ), respond memory warnings releasing pages. however, whenever release uicolor patternimages, “exc_bad_access” error. at first thought might caused [uiimage imagenamed:...] pattern images, switched [[uiimage alloc]initwithcontentsoffile:...] images, didn't help. set nszombiesenabled , tells me problem is: -[uicgcolor release]: message sent deallocated instance 0x187b50 with backtrace: #0 0x35823910 in ___forwarding___ () #1 0x35823860 in __forwarding_prep_0___ () #2 0x357e53c8 in cfrelease () #3 0x357e48de in _cfautoreleasepoolpop () #4 0x3116532c in nspopautoreleasepool () #5 0x341a7508 in ...

html - Padding table with CSS doesn't work on IE -

this not working on ie: <table style="padding:5px">...</table> however works on opera. is there workaround? the earlier css specs (which ie6 follows -- , use word "follows" loosely) not clear padding defined on table should mean. ie6, naturally, decided interpret differently every other browser, ignoring padding. other browsers decided render adding spacing between table border , outermost cells, without affecting spacing inside cells, or between internal cells. time ie7 came out, specs had cleared work other browsers, ie6 still has problem, ignores padding. the best solution avoid putting padding on table, instead surrounding div, , putting padding there. <div style="padding: 5px;"> <table...> </table> </div> of course, if want cell spacing or cell padding (as opposed padding on table), should use cellspacing or cellpadding attributes (even if don't want these, @ least need cellspa...

iphone - presentModalViewController: how to interact with parent -

showing modal viewcontroller works fine: uinavigationcontroller *navcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:myview]; [self.navigationcontroller presentmodalviewcontroller:navcontroller animated:yes]; [navcontroller release]; in modal view, have navigation button switch mainmenu. call [self.navigationcontroller poptoviewcontroller:delegate.viewmainmenu animated:yes]; thats not possible inside modal view. how can interact "parent" call him calls poptoviewcontroller ? thanks lot! use property parentviewcontroller in modal vc , call [self.parentviewcontroller dismissmodalviewcontrolleranimated: yes];

Gmail - Back button click on browser -

after logging gmail , clicking button on browser site doesn't gets user login screen? how done? pointers in java server side programming helpful. how without java script. they use http cookies , server side sessions track user authentication state. take @ this article more info using cookies persist login info.

dom - HTML source appearing different in Firebug to standard browser 'View Source' option? -

i have html content being generated via php. whilst investigating css problem, noticed through firebug elements in dom not organised expected. yet, when did standard 'view source' in firefox showed correct. i know source being displayed firebug accurate, because source presents me corresponds aesthetic issue i'm seeing on screen, i'm not sure means , how investigate further. why happen, , source version should looking at? (p.s. have no javascript running on website.) firebug cleans dom tree, if there's syntax bugs in raw source, won't see them in firebug (unless they're bad screws parse tree completely). the regular view-source functionality shows page's source came server. if manipulations of dom after page loaded, won't show in view-source, that's outdated. firebug show live in-memory tree, manipulations included, clean things up.

mysql - Is it safe to delete replication relay-bin files? -

i've got small database, around 50mb. it's master replicating remote server. noticed relay-bin files total on 5gb. safe delete them? no, not delete relay-bin files manually. can purge binary files using mysql commands. see mysql 5.0 manual more on purge binary logs command.

html - What is a Geo Cookie? How do I implement one? -

i've been tasked using 'geo cookie' identify in world users accessing site from, , redirect them site configured region. i understand cookie in context of web, i'm not sure geo cookie, partly because i've never heard of 1 before. could please tell me if real thing, or if term made people didn't know proper name they're talking about? (this happens quite regularly, seems). there way me identify user located? i'd never heard of term before, , doing little googling confirmed suspicion not common term in usage. my thoughts, reading off of first search result query , you're being asked implement cookie stores users region. can done normal cookie, , can give name "geo" - viola! geo cookie. if you, i'd go stakeholder , find out requirement means. determining user located (without asking directly) can use ip of user, , geo-location service. see know ip address geolocation service more info on that.

python - Urllib trouble across platforms -

on linux, urllib.urlopen("https://www.facebook.com/fql.php?query=select first_name user") have spaces automatically quoted , run smoothly. (by way, url fictional) however on mac, not case. somehow url not escaped, , error thrown. have checked both python versions @ least 2.6 , version of urllib 1.17 is bug? urlopen documentation doesn't promise escape anything. use urllib.quote() escape yourself.

.net - CLR C++ syntax question about GetElementsByTagName -

i'm newbie in c++. have xml file , code: xmldocument^ xml = gcnew xmldocument(); xml -> load( "url.xml" ); box -> text = xml -> documentelement -> getelementsbytagname("item") -> item(0) -> getelementsbytagname("title") -> item(0) -> innerxml; // code doesnt work. and xml file: <item> <pubdate>date</pubdate> <title>title</title> <author>author</author> <description>description</description </item> <item> ... i want title tag first item. , dont know how. please. upd. tried code, not work :( xml -> documentelement -> getelementsbytagname("item") -> item(0) -> childnodes -> getelementsbytagname("title") -> item(0) -> innerxml; if call xml.loadxml() using string copies have file, error </description doesn't have end > . if fix that, xmlexception because have mult...

Perl: What exactly is C<our>? -

i in process of teaching self perl. using epic debugger in eclipse. whenever have var used 1 time in sub warning: typographical errors show unique variable names. if had reason having unique name, mention again somehow suppress message. c<our> declaration provided purpose. c<our> ? standard searching inconclusive. as far c<> part may have confused you, looks epic took text in pod format , printed raw instead of rendering pod formatted text. c<our> in pod syntax means "print text 'our' formatted code", meaning mono-spaced font. similar stackoverflow's `our` backtick-surrounded format command own question used. the error comes perl's diagnostics module, provides extended explanations otherwise cryptic perl warnings (in case, " name "%s::%s" used once: possible typo "). matter of fact, judging pod formatting confused you, epic uses source pod above-linked "perldiag" document generate...

objective c - retrieve video ram usage iphone -

i have see article retrieve memory usage off iphone app programmatically-retrieve-memory-usage-on-iphone it's great ! in project want retrieve available vram free, because app load many textures, , must preload theses video ram fast rendering. but on vm_statistics don't view theses properties : vm_statistics man page thanks lot help. as you've seen far, getting hard numbers gl texture memory usage quite difficult. it's complicated further fact coreanimation use gl texture memory without "consulting" you, including processes other yours. practically speaking, suggest use vm tracker instrument in instruments watch changes in vm pages process maps under iokit tag. it's bit crude, it's best approach i've found. in experience, process largely guess , check. you asked way determine amount of free vram, if info, it's not helpful. if app totally opengl , uses no uiviews or coreanimation layers other processes, importantly mor...

Linux script start,stop,restart -

can please tell me script does? #! /bin/sh test –f /usr/bin/sshd || exit 0 case “$1” in start) echo –n “starting sshd: sshd” /usr/sbin/sshd echo “.” ;; stop) echo –n “stopping sshd: sshd” kill `cat /var/run/sshd.pid` echo “.” ;; restart) echo –n “stopping sshd: sshd” kill `cat /var/run/sshd.pid` echo “.” echo –n “starting sshd: sshd” /usr/sbin/sshd echo “.” ;; *) echo “usage: /etc/init.d/sshd start|stop|restart” exit 1 ;; esac i want know part: #! /bin/sh test –f /usr/bin/sshd || exit 0 case “$1” in start) echo –n “starting sshd: sshd” /usr/sbin/sshd echo “.” ;; does because other part same! please ;) which other part same? way script works checks value of $1 , first parameter script supplied on comm...

File associations with Inno-Setup registry -

i have following in swatchdogprc.iss: (snip) [files] source: "c:\program files\palmone\instapp.exe"; destdir: "{app}"; flags: ignoreversion source: "c:\program files\palmone\instaide.dll"; destdir: "{app}"; flags: ignoreversion source: "c:\program files\palmone\palmcmn.dll"; destdir: "{app}"; flags: ignoreversion source: "c:\program files\palmone\userdata.dll"; destdir: "{app}"; flags: ignoreversion [registry] root: hkcr; subkey: ".prc"; valuetype: string; valuename: ""; valuedata: "swatchdogprc"; flags: uninsdeletevalue root: hkcr; subkey: "swatchdogprc"; valuetype: string; valuename: ""; valuedata: "swatchdog prog"; flags: uninsdeletekey root: hkcr; subkey: "swatchdogprc\defaulticon"; valuetype: string; valuename: ""; valuedata: "{app}\instapp.exe,0" root: hkcr; subkey: "swatchdogprc\shell\open\command...

c++ - Setting up SCons to Autolint -

i'm using google's cpplint.py verify source code in project meets standards set forth in google c++ style guide . use scons build i'd automate process having scons first read in of our .h , .cc files , run cpplint.py on them, building file if passes. issues follows: in scons how pre-hook build process? no file should compiled until passes linting. cpplint doesn't return exit code. how run command in scons , check whether result matches regular expression? i.e., how text being output? the project large, whatever solution #1 , #2 should run concurrently when -j option passed scons. i need whitelist allows files skip lint check. one way monkey patch object emitter function, turns c++ code linkable object files. there 2 such emitter functions; 1 static objects , 1 shared objects. here example can copy paste sconstruct: import sys import scons.defaults import scons.builder originalshared = scons.defaults.sharedobjectemitter originalstatic = scons.defa...

objective c - Can preprocessor directives be used to import different header files for Mac and iOS? -

i writing class library mac os x , ios released cocoa framework os x , static library ios. simplify matters, intend use multiple targets in xcode. however, classes on mac os x link against cocoa.h whereas on ios link against foundation.h. my questions are: could mac os x framework link against foundation.framework instead? classes used within framework nsstring, nsmutablestring, , nsmutablearray. or use preprocessor directives within header files control framework inclusion, e.g. #ifdef macosx #import <cocoa/cocoa.h> #else #import <foundation/foundation.h> #endif you can use these separate platform dependent code (see targetconditionals.h ): #ifdef target_os_iphone // ios #elif defined target_iphone_simulator // ios simulator #elif defined target_os_mac // other kinds of mac os #else // unsupported platform #endif here's useful chart .

Java slow socket.connect() -

below source code of client , server. client connects (concurrently) server , immediatly closes connection. when threads done, waits 2 minutes , connects again. confused fact simple connect needs around 3 seconds! of time connect needs around 0-32ms. here typical output client: ... connect 23 [ms]: 16 connect 22 [ms]: 32 connect 21 [ms]: 32 connect 15 [ms]: 32 connect 14 [ms]: 16 connect 13 [ms]: 16 connect 11 [ms]: 32 connect 25 [ms]: 3016 this seems happen if client , server on different hosts. windows , linux comparable behaviour java 1.6.23 to start server 2 parameters needed: [port] [thread pool size] to start client 3 parameters needed: [host] [port] [thread pool size] for example used 150 thread pool size server , 25 thread pool size client. can explain behaviour? ----- server ----- package de.test.server; import java.io.ioexception; import java.io.inputstream; import java.net.serversocket; import java.net.socket; import java.util.concurrent.executorservi...

php - Coupon displayed after user uses Addthis -

i see addthis has sample code may help: http://www.addthis.com/help/client-api#events in registration form, want display coupon code in input text field if share site. ideas on how this? in html, give input field id can reference later: <input type="text" id="coupon-code" value=""> then, here's addthis listener: <script type="text/javascript"> addthis.addeventlistener('addthis.menu.share', function(evt) { // show coupon code document.getelementbyid('coupon-code').value = "code12345"; }); </script>

c# - How to propagate a Task's Canceled status to a continuation task -

i using task parallel library in application. have task (let's call "dosomething") may canceled. whether task faulted, canceled, or completes successfully, have continuation attached task performs cleanup. in code launches task, want return task object status (faulted, canceled, ran completion) reflects status of dosomething task, it's important task return not reflect status until continuation task executes. here's example: public task start(cancellationtoken token) { var dosomethingtask = task.factory.startnew(dosomething , token); var continuationtask = dosomethingtask.continuewith ( (antecedent) => { if (antecedent.isfaulted || antecedent.iscanceled) { //do failure-specific cleanup } //do general cleanup without regard failure or ...

Is there anyway nested xib with another xib file? -

what want do, have uiview uitoolbar via ib, , uitoolbar customized via ib, want set set uitoolbar xib file, not load source? is possible? thanks. create uitoolbar in uiview xib-file. change class of uitoolbar uitoolbar mycustomtoolbarsubclass(choose yours subclass) in ib. it's important have mycustomtoolbarsubclass custom uitoolbar. , have declare parent uitoolbar. change object, uiviewcontroller or choose parent class when create new class uitoolbar. also there many solves problems custom toolbars. helps me.

asp.net mvc model database change -

i've used mvcscaffolding , mvc3 generate tables in sql2008 database. data has been added. i've changed single model , wish alter underlying table. is there way auto-update single table keep in sync model? after adding new model how can database table created without recreating database you're looking rails' migrations. there couple .net migrations providers floating around, basic setup you've described doesn't support alterations schema without recreating database (at least in experience).

checkbox - Get/set multiple struts2 checkboxes to/from list -

i´m developing struts2 app user make 1 of 3 choices, , based on choice number of different predefined checkboxes presented. of checkboxes appear regardless of choice made, while others unique each choice can made. in total, there around 50 different checkboxes, , each checkbox have id, 1 50. the selections made user persisted rows in database, , need able repopulate selected checkboxes should user want change selections made. using checkboxlist not suitable, need put checkboxes different fieldsets on page. guess i´m stuck regular . now, has got idea of how could: 1) retrieve selected checkboxes, preferebly putting them list/set in action 2) repopulate selected checkboxes list selections has been stored? any ideas appreciated! 1) retrieve selected checkboxes, use (supposing you're using jsp): <input type="checkbox" name="yourname" id="checkbox-1" value="1" /> <input type="checkbox" name="yourname...

conflict between jquery 1.4.2 and jQuery 1.2.3 -

i using 2 above described libraries, 1 type writer effect on <ul> , other used script match floating <div> s height. when link jquery 1.2.3, typewriter stops , shows <ul> contents? think can do? reference: matching height: http://filamentgroup.com/lab/setting_equal_heights_with_jquery text effect: http://web-development.tuljo.com/news-ticker-bbc-style you should using single version of jquery library, not multiple ones. if need choose, go newer 1 (in case 1.4.2).

c# - An attempt was made to access a socket in a way forbidden by its access permissions -

i downloaded c# sdk , asp.net mvc sample, modified work 4.2.1. (web config facebooksettings parameters etc.), created facebook application , tried run it. click facebook login button - ok, entering credentials facebook popup - ok, allowing access application - ok, , error: system.net.sockets.socketexception: attempt made access socket in way forbidden access permissions 66.220.146.47:443 var app = new facebookapp(); if (app.session == null) { // user isnt logged in facebook // send them home page return redirecttoaction("index"); } // user info graph api dynamic me = app.api("/me"); // exception thrown here viewdata["firstname"] = me.first_name; viewdata["lastname"] = me.last_name; tje app object ok think (containing settings params, session object access token , facebook userid, etc.) i using local development address http://myappdev.local (set 127.0.0.1 in hosts file). same address set in facebook app settings, doma...

plugins - How to develop a third-party SAS PROC? -

is possible, third party, develop sas proc? i'm thinking of matlab toolbox or r package. i've looked everywhere info on how this, , lack of discussion leads me believe not done. can point counterexamples, preferably insight both technical , business issues involved? you can create custom procs using sas/toolkit product if have licensed. don't think used sas customers. did trivial example many years ago see involved. think sas customers stick using sas macro , sas/af , more proc fcmp custom code bundling requirements (there ways of calling java object methods , windows dll routines too). the primary document sas/toolkit software: usage , reference, version 6, first edition , looks available purchase there no pdf link there of other sas docs. sas usage note 15647: documentation sas/toolkit® software explains there no single document available sas9 - use v6 document , various changes , enhancements documents since v6 - usage note lists them you. ...

emulation - Android emulator API 1.6, Manage Applications > (see screenshot) -

i've noticed strange app on android emulator (1.6) does know is? can't un-install it, , "force quit" doesn't seem anything. doesn't appear take memory, has kinds of permissions. i don't know how research this, because don't read language. my specific questions are: has seen on emulator? is kind of virus or trojan, etc.? only 1 screen shot(dont'ask more, stackoverflow wont let me.): http://img834.imageshack.us/i/weirdapp.png/ it's google pinyin input method, way input chinese character using pinyin. can see more options @ settings->locale & text. so, no, that's not virus or trojan.

algorithm - Computer Science Theory: Image Similarity -

so i'm trying run comparison of different images , wondering if point me in right direction basic metrics can take group of images. assuming have 2 images, , b, pretty want data possible each can later programmatically compare them. things "general color", "general shape", etc. great. if can me find specific properties , algorithms compute them great! thanks! edit: end goal here able have computer tell me how "similar" pictures are. if 2 images same in 1 blurred out face; should register similar. if 2 pictures different, computer should able tell. what talking way general , non-specific. image information formalised entropy . what seem looking feature extraction , comparing these features. there tons of features can extracted lot of them irrelevant depending on differences in pictures. there space domain , frequency domain descriptors of image each can useful here. can name more 100 descriptors in case, 1 sufficient or none ...

excel - XLS with 512 sheets to 512 CSVs -

i have xls file containing 512 sheets, want have each sheet in separate csv file, , i'm not going hand. any idea? sub separatecsv() dim sh worksheet dim wb workbook each sh in thisworkbook.worksheets sh.copy set wb = activeworkbook wb.saveas sh.name & ".csv", xlcsv wb.close false next sh end sub

php - Why does this XML not render in the browser the way I want? -

i want use php create rss mysql. can see content in page source code. can not see item part in web browser(ie, firefox or opera). web browser show `your rss feed name or website name a description of feed or site.` <?php require_once ('mysql_connect.php'); //set xml header header('content-type: text/xml'); //construct rss feed headers $output = '<rss version="2.0">'; $output .= '<channel>'; $output .= '<title>your rss feed name or website name</title>'; $output .= '<description>a description of feed or site.</description>'; $output .= '<link>http://www.yoursite.com/</link>'; $output .= '<copyright>your copyright details</copyright>'; //body of rss feed mysql_select_db("rss", $db); $result = mysql_query("select * rss limit 15",$db); while ($row = mysql_fetch_array(...

How to add a UI to a large android listview? -

i have android app displays custom contact list of 500 people , works fine; if looking name starts letter "s", takes forever scroll down. how can program jump s without scrolling entire list? here xml layout code: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="fill_parent" android:layout_width="fill_parent" android:background="@color/background" android:orientation="vertical"> <listview android="@+id/android:thelist" android:layout_height="0dip" android:layout_width="wrap_content" android:scrollbars="vertical" android:fadingedge="vertical" android:padding="2dp" android:fastscrollenabled="true"> </listview> <textview android:text="@+id/textview01" android:layout_width="wra...

asp.net - Align controls properly -

Image
i want adjust appearance on same controls on website working on, seems not going good. want use css align controls. want have checkbox , label aligned left , little bit room, textbox coming. want textboxes aligned same vertically. how can css without using tables. thanks in advance help, laziale css div{margin-bottom:2px;} input[type="checkbox"]{display:block; float:left; margin-right:2px;} label{display:block; float:left; width:150px;} html <div><input type="checkbox" /><label>address</label><input type="text" /></div> <div><input type="checkbox" /><label>state</label><input type="text" /></div> <div><input type="checkbox" /><label>city</label><input type="text" /></div> <div><input type="checkbox" /><label>zip</label><input type="text" /...

Track down a textmate snippet by keybinding -

i'm trying use snippet installed bundle has keybinding command+shift+a. problem it's being overridden other snippet. how track down snippet , remove it's keybinding can use 1 want. press ⌘⌃t show select bundle item window, click on magnifying glass , switch field "key equivalent". type keyboard shortcut.

c# - How to customize a CodedUI test search property - specifically window title -

suppose trying automate notepad, , depending on open, tile of window either "notepad", "notepad - letter_to_boyfriend.txt", "notepad - readme.txt", etc. when recorded coded ui test, assumed title "notepad". want customize test somehow, title looks "notepad*" enough. how can so? sorry, not have recorded code share @ moment, might later. not hard reproduce. it has got search property. in advance. doubleclick on [mapname].uitest, in ui control map select window, press f4 see properties, , in search properties change operator equalsto contains , value "notepad".

objective c - Class method that returns object and transfers ownership -

[this memory management clarification/question] i have class method returns nsmutablearray*. i want caller own , have call release. i don't want use autorelease because want freed memory caller done. is ok long start name new or alloc, correct? e.g. + (nsmutablearray*) newarrayfromdb { nsmutablearray* myarray = [[nsmutablearray alloc] init]; //stuff populate array return myarray; } then caller call with: nsmutablearray* test = [thatclass newarrayfromdb]; //use test [test release]; the static analyzer seems think ok...but wanted second opinion... thanks feedback.... yes, you're doing correct - you're following rules in object ownership policy correctly. the point might question i don't want use autorelease because want freed memory caller done . default autorelease pool drained every time through main run loop, in cases memory released anyway. and, if caller needs force release sooner, can allocate/drain autorelease pool man...

html - Automatically expand margins to fill container? -

i've got following html layout: div |-- h3 |-- ul |-- li |-- ... |-- li the height of div fixed. i'd li 's fill entire height of div. manually it, can adjust margin-bottom dynamic content, out of question. any ideas? thanks! the way can think of using css3 box layout model (flexbox), doesn't have support. a pretty tutorial can found here , js solution implement in older browsers can found here (haven't tested myself yet, found in comments blog post above. edit - tutorial here

jpa - Hibernate: Adding versioning to a non versioned DB -

i created db time ago using hibernate (jpa), didn't included @version fields entities. turns out project became important , need use versioning (versioning optimistic locking). i know need add new property (field) every single entity @version annotation. question: know how can update real db (mysql) include version columns without data loss , work? thanks much. create sql statement create column tables of entities want , @version attribute. use other query set value of columns rows 1. an little bit other way create column default value, , remove default. (works mysql) alter table xyz add version integer not null default 1; alter table xyz change version version integer not null; the purpuse of approach long not run second statement (remove default), old application run, if not set value version column when creates new objects.

java - cannot find symbol -method getvalue (); maybe you meant : intValue -

import java.util.arraylist; public class averager { private arraylist list; public averager() { list = new arraylist(); } public void addgrades(int test, int quiz) { list.add(new integer(test)); list.add(new integer(test)); list.add(new integer(quiz)); } public double getaverage() { int sum = 0; for(int = 0; < list.size(); i++) { sum += ((integer)list.get(i)).getvalue(); } return sum / list.size(); } } integer class not have getvalue() method. there intvalue() method. arithmetic operations don't have call - java autoboxing : sum += (integer)list.get(i);

Help please, I'm Newbie. About payment application on Visual Basic 2010 -

i want build 1 project simple payment information little shop. any body can me? i'm still not understanding visual basic 2010. i'm developed in pascal 7.0 ago.. the application simple using textbox input , calculate in output textbox pressing button. can me? thanks its not clear part having trouble with. but you'll need understand creating project adding controls form event handling referring controls on form code you might want start quick tour of ide , move on this turtorial new development site may helpful down road. you might find videos this youtube user helpful.