Posts

Showing posts from June, 2011

cocoa - Objective-C properties -

i wondering, when accessing properties within class, have [self someproperty] or self.someproperty ? or safe refer someproperty ? edit: given name of property doesn't conflict/shawdow.... [self someproperty] or self.someproperty? or can safe refer someproperty? any 1 fine. prefer not use self when being in scope of class. somevalue = 10 ; [ self somevalue ] = 20 ; self.somevalue = 30 ; all above 3 statements going modify interface variable somevalue .

javascript - Questions about Viewports and large image navigation -

okay, i'm working on project using javascript , basic ui want large background image, , when select navigation menu items propels section on large image. i've tried finding documentation on viewports , trying figure out how map applications function have had very minimal success. it google map without user being able slide it. how in world begin approach this? you can set background-image property in css , use javascript change background-position .

bash - how to pass arg values to shell script within in a cronjob -

i have cron entry looks works: (passing in 5 inputs) 30 10 * * 5 sh /home/test.sh hostnm101.abc /mypath/dir test foobar f008ar >> /logs/mytst.log 2>&1 i want change store inputs (4,5) foobar , f008ar in separate file , read in script test.sh ($4,$5) test.sh #!/bin/bash if [ $# != 5 ]; exit 1 fi dirdt=`date '+%y%m%d'` tstdir=$2/test/$dirdate [ ! -d "$tstdir" ] && ( mkdir "$tstdir" || { echo 'mkdir command failed'; exit 1; } ) perl /home/dev/tstextr.pl -n $1 -b $2 -d $tstdir/ -s $3 -u $4 -p $5 -f $dirdt is there easy way within cron (2) input values? thanks. alright try way. 1) create separate file /mypath/dir/login.info content (username/password in separate lines): foobar f008ar 2) modify test.sh this: #!/bin/bash if [ $# != 4 ]; exit 1 fi dirdt=`date '+%y%m%d'` tstdir=$2/test/$dirdate [ ! -d "$tstdir" ] && ( mkdir "$tstdir" || { echo 'mkdir com

Can Workflow Foundation be used in this scenario? -

i want write asp.net based game has rules(of course) want this: when user fills form , clicks button check inputs according rules , save outputs db or show user. -can write rules using wf? -can exchange data between asp.net form-wf-db? -can edit rule file during runtime of web application?(or replace .xaml file completely?) thanks it possible don't think wf4 ideal fit. 1 thing can't modify workflow declaration while workflow running.

ruby on rails - Devise Soft Email Confirmation -

i have rails 3 application uses devise , confirmable module. however, preventing newly registered users accessing the site until confirm email causing retention problems. instead, instantly grant access user and still send them confirmation email. run background task lock out user's have not confirmed email within fixed period of time. is possible confirmable module? there way still create active resource (user) hasn't confirmed email confirmable module? general advice on implementing this? i believe can use confirm_within specify lockout constraint. can enable when call devise_for. http://rubydoc.info/github/plataformatec/devise/master/devise/models/confirmable also, can choose constrain behaviors "only" confirmed users checking confirmed? status of user model. in controller, or using cancan, or whatever. tasks on site don't require confirmation; need more when user interacts other people or can use site send notifications/emails, etc.

php - A link to the server could not be established -

a simple insert function, , yet. gives nasty errors... like: warning: mysql_query(): access denied user '***.'@'***.one.com' (using password: no) in /customers/***.be/***.be/httpd.www/belastingen/classes/btw.php on line 24 warning: mysql_query(): link server not established in /customers/***.be/***.be/httpd.www/belastingen/classes/btw.php on line 24 and code: <?php if(isset($_post['submit'])){ $naam = $_post['name']; $email = $_post['email']; $kind1 = $_post['kind1']; $kind2 = $_post['kind2']; $kind3 = $_post['kind3']; $kind4 = $_post['kind4']; $kind5 = $_post['kind5']; $captcha = $_post['captcha']; if ($captcha == 2){ if (!empty($_post['name']) && !empty($_post['email']) && !empty($_post['kind1'])) { $insert = "insert belastingen (ouder, email, kind1, kind2,

html - Facebook like button: Hard to click - small hotspot -

for reason facebook button on webpage has small hotspot, i'm able click in area under says 'like' rather whole button. http://www.melbournedodgeball.com.au/team/3 if go page team not exist, problem not there: http://www.melbournedodgeball.com.au/team/300 any ideas why case? upon inspection chrome inspector, seems your <h2> ya mum!</h2> element somehow blocking part of button clickable. if somehow shrink width or stop flowing on button, problem solved. edit: tried changing font size h2 , made whole "like" button clickable.

android - How to refresh cursorAdapter especially when deleting last item in a list? -

how refresh cursoradapter when deleting last item in list? scenario: working: editing list-view row, ok adding list-view row, ok deleting list-view row(one one), until 1 left, ok problem: deleting last row/item, failed; need close first activity , open again refresh. i using cursor adapter, , want refresh list when deleting last row/item of list view. method refreshing adapter assign new instance of cursoradapter listview(as if, doing again , again). code: listview.setadapter(new immunizationlistcursoradapter( this,// current activity r.layout.imm_list_row,// layout each row immunizationcursor,// data // pass in cursor bind to. // array of cursor columns bind to. new string[] { immunizationmodel.im_col_vacname, immunizationmodel.im_col_date }, // parallel array of template objects bi

c++ - Can't seem to break a while loop on collision, hashing -

i don't know why code not breaking out of while loop: int table_size = 953; store hash_table[953]; for(int = 0; < table_size; i++) hash_table[i].count = 0; //bunch of stuff hash value here while(hash_table[hashnum].data != pstring || hash_table[hashnum].count != 0){ hashnum++; if(hashnum > table_size) hashnum = 0; cout << hash_table[hashnum].count; // check value of count in array, 0, should have broken loop } you mean: while(hash_table[hashnum].data != pstring && hash_table[hashnum].count != 0) in code loop continue if either case true, hash_table[hashnum].count == 0 not sufficient make clause false.

IndexOutOfBoundsException while uploading file - Java -

i'm getting indexoutofboundsexception while uploading zip file. reason? how can solve it? code:- string sf=""; string contenttype = req.getcontenttype(); datainputstream in = new datainputstream(req.getinputstream()); int formdatalength = req.getcontentlength(); byte databytes[] = new byte[formdatalength]; int byteread = 0; int totalbytesread = 0; while (totalbytesread < formdatalength) { byteread = in.read(databytes, totalbytesread, formdatalength); totalbytesread += byteread; } string file = new string(databytes); string savefile = file.substring(file.indexof("filename=\"") + 10); savefile = savefile.substring(0, savefile.indexof("\n")); savefile = savefile.substring(savefile.lastindexof("\\") + 1,savefile.indexof("\"")); int lastindex = contenttype.lastindexof("="); string boundary = contenttype.substring(lastindex + 1,conte

c++ - QCheckBox inside QTableWidget, clicking on label won't alter state -

if call qtablewidget.setcellwidget widget contains qcheckbox clicking on label of checkbox not alter state. appears though table consuming part of mouse events. if click on box directly alter state. clicking on box or label cause checkbox focus. is there anyway checkbox behave within table? this not real answer want seems work in small test program. i'll show here in hope you: int main(int argc, char* argv[]) { qapplication app(argc, argv); qtablewidget table(1, 1); qcheckbox check("test"); table.setcellwidget(0, 0, &check); table.show(); return app.exec(); }

java - AbstractReadonlyModel in wicket Framework -

package org.apache.wicket.examples.ajax.builtin; import java.util.arraylist; import java.util.arrays; import java.util.collections; import java.util.hashmap; import java.util.list; import java.util.map; import java.util.set; import org.apache.wicket.ajax.ajaxrequesttarget; import org.apache.wicket.ajax.form.ajaxformcomponentupdatingbehavior; import org.apache.wicket.markup.html.form.dropdownchoice; import org.apache.wicket.markup.html.form.form; import org.apache.wicket.model.abstractreadonlymodel; import org.apache.wicket.model.imodel; import org.apache.wicket.model.model; import org.apache.wicket.model.propertymodel; /** * linked select boxes example * * @author igor vaynberg (ivaynberg) */ public class choicepage extends basepage { private string selectedmake; private final map<string, list<string>> modelsmap = new hashmap<string, list<string>>(); // map:company->model /** * @return selected make */ public string getselectedmake() { ret

c# - How to unfreeze outlook2007 inspector when is invoked from other app via interop -

i'm trying make app previews mails in outlook 2007. thing when try capture inspector email, graphics aren't yet loaded , need add delay capture function. use thread.sleep. problem though inspector outlook process freezes well. i'm sure of because when use thread.sleep(15000) in app , try manually interact inspector (move, select text, resize), it's frozen. after i'm done in app (just after capture process took place) can access it. here code: private static void handleoutlookmail(string entryidcollection) { // incoming mailitem based on id. namespace outlookns = outlookapp.getnamespace("mapi"); mapifolder mfolder = outlookapp.session.getdefaultfolder(oldefaultfolders.olfolderinbox); newmail = (mailitem) outlookns.getitemfromid(entryidcollection, mfolder.storeid); // show mail. = newmail.getinspector; //make inspector big enough show entire email i.height=2000; //activate inspector in order avoid b

.net - C# Method to return the part of string -

i using c# .net 2.0. i have got below string me string str = "tcm:0-433-1"; now want create method in c#, take above string input parameter , return "tcm:433-" . please suggest best way it! update : here's bit of nutty idea. 1 possible way of describing desired input/output (to me) this: want take , including : character, skip through first - character, take again through following - character. generalizing idea, came following mess: // awful name, obviously. public static string takeskiptakeetc(this string source, params char[] tokens) { bool taking = true; int startindex = 0; stringbuilder stringbuilder = new stringbuilder(); foreach (char token in tokens) { int index = source.indexof(token, startindex); if (index == -1) { if (taking) { stringbuilder.append(source.substring(startindex)); } return stringbuilder.tostring();

how can i add a button in android default music player or existing package -

i using android music player in project .when clicking button in application show android default music player,for using following code intent intent; startactivityforresult(new intent(android.provider.mediastore.intent_action_music_player),0); button created me placed in bottom of screen.in 1 home button there,but when music player launch thebuttons not visible. want button or home button in music player.i dont know whether possible add button in existing package.now using button in emulator. sorry, not possible. can't modify ui of application.

initialization - How to check BitmapImage instance is initialized or not? WPF -

i try use instances of bitmapimage class in circle receive error messages bitmapimage not initialized. how check bitmapimage initialized before use it? there 2 events commonly used when working bitmaps, 1 fires of when image opened , when image failed; var myimage = new bitmapimage(new uri(@"images/img.jpeg",urikind.relative)); myimage.imageopened += myimage_imageopened; myimage.imagefailed += myimage_imagefailed; void myimage_imagefailed(object sender, exceptionroutedeventargs e) { //handle failed event } void myimage_imageopened(object sender, routedeventargs e) { //handle image opend ok event }

math - Javascript (+) sign concatenates instead of giving sum of variables -

why when use this: (assuming i = 1 ) divid = "question-" + i+1; i question-11 , not question-2 ? use instead: var divid = "question-" + (i+1) it's common problem , doesn't happen in javascript. idea + can represent both concatenation , addition. since + operator handled left-to-right decisions in code this: "question-" + i : since "question-" string, we'll concatenation, resulting in "question-1" "question-1" + 1 : since "queston-1" string, we'll concatenation, resulting in "question-11" . with "queston-" + (i+1) it's different: since (i+1) in parenthesis, value must calculated before first + can applied: i numeric, 1 numeric, we'll addition, resulting in 2 "question-" + 2 : since "question-" string, we'll concatenation, resulting in "question-2" .

debugging - android trace file on device -

is possible create trace file on devices or can use trace file on emulator? cause rt-execption when use debug.startmethodtracing(); here exception: 05-11 09:34:27.687: error/androidruntime(5599): java.lang.runtimeexception: unable open trace file '/sdcard/loop_loclistener.trace': permission denied thanks

python - Address of Dragged File in Windows -

how can know address of dragged file or folder in windows explorer python? i think filename path, function handles 'drop' has struct data need, python not provides gui drop files, widget framework using?

r - remove row with nan value -

let's say, example, have data: data <- c(1,2,3,4,5,6,nan,5,9,nan,23,9) attr(data,"dim") <- c(6,2) data [,1] [,2] [1,] 1 nan [2,] 2 5 [3,] 3 9 [4,] 4 nan [5,] 5 23 [6,] 6 9 now want remove rows nan values in it: row 1 , 4. don't know these rows are, if it's dataset of 100.000+ rows, need find them function , remove complete row. can point me in right direction? the function complete.cases tell rows need: data <- matrix(c(1,2,3,4,5,6,nan,5,9,nan,23,9), ncol=2) data[complete.cases(data), ] [,1] [,2] [1,] 2 5 [2,] 3 9 [3,] 5 23 [4,] 6 9

iphone - Displaying two Videostreams at the same time -

does of know how display 2 (or more) http-video streams on ipad screen @ same time? couldn't find soulution problem. bye, blunzn if use mpmovieplayercontroller can't. taken mpmovieplayercontroller class reference in apple api: note: although can create multiple mpmovieplayercontroller objects , present views in interface, 1 movie player @ time can play movie.

How to get all the posts from rss feed rather than the latest posts? -

rss seems have latest n posts, wonder there anyway posts including history post. thanks jeff zhang this isn't possible since rss reader shows in feed. can pull as published @ time. finding dataset backs rss feed items , downloading directly there else entirely though , possible.

c++ - Qt checkbox/toolbutton with custom/distinct check/unchecked icons -

i need have checkbox control checked , unchecked states use custom graphic. i've looked @ docs qtoolbutton , qcheckbox, along qicon couldn't find combination want. i want use 1 icon (pixmap actually) in unchecked state, , different 1 in checked state. this feels should easy, solution (short of custom control) eluding me. i've tried using style sheet well, , qtoolbutton:checked background-image kind of works can't layout correct -- it's not positioned/sized icon. use ::indicator sub-item. code below works excellent me... qcheckbox::indicator { width: 18px; height: 18px; } qcheckbox::indicator:checked { image: url(.../checkbox_checked_normal.png); } qcheckbox::indicator:unchecked { image: url(.../checkbox_unchecked_normal.png); } qcheckbox::indicator:checked:hover { image: url(.../checkbox_checked_hovered.png); } qcheckbox::indicator:unchecked:hover { image: url(.../checkbox_unchecked_hovered

css - jQuery tmpl plugin - problems with template results from dynamic content (bug?) -

i've use jquery templates ( http://api.jquery.com/jquery.tmpl/ ) render lists on pages based on remote content, working well, when apply class content , have click event class dynamic template content doesn't respect action hard coded content works fine. i've edited basic demo ships tmpl plugin add static list proof of concept: http://jsfiddle.net/3evrr/2/ clicking static 'bar' link generates alert i'd expect. clicking of buttons (cartoons or drama) generate list clicking hyperlink (it has same class hard coded link) not fire alert. can see problem is? firebug not show errors, on inspection classes both static , dynamic content same. thanks as aleksv pointed out, traditional .click() handlers apply elements can selected when handler initialized. in case, .live() (or .delegate() ) handler better approach: // handler apply .getpage element, if created // after handler declaration has been executed. $('.getpage').live('click&#

Page Redirection problem in php -

i want redirect login page main page using php. use following line of code: header('location:index.php'); inspite of redirection received error like: warning: cannot modify header information - headers sent (output started @ c:\wamp\www\student\login.php:18) in c:\wamp\www\student\login.php on line 19 this error occures if print before header() function. for example: <?php echo 'test'; header('location:index.php'); exit; ?> or even: <html> <head> ..... <?php echo 'test'; header('location:index.php'); exit; ?> you have move piece of php code before operation gives output. you can following trick second way should try: <?php echo 'test'; ob_start(); flush(); header('location:index.php'); exit; ?>

php - CodeIgniter DataMapper Problem with Relationship -

hey i've got pretty simple relationship in datamapper model.. in model ticket hav: var $has_one = array("user"); and when try $ticket->user->get()->username; it says: datamapper error: 'ticket' not valid parent relationship user. relationships configured correctly? i dont see problem :/ what user model like? map ticket well? var $has_many = array("ticket");

c# - SOAP request Multicast over UDP -

i want use c# udpclient class multicast soap request on network, can multicast simple strings using udpclient class how soap messages ? public void sendprobe() { udpclient sock = new udpclient(); ipendpoint iep = new ipendpoint(ipaddress.parse("239.255.255.250"), 3702); // want create soap message here multicast using udpclient // // byte[] data = encoding.ascii.getbytes("this test message"); sock.send(data, data.length, iep); sock.close(); } soap servers listen on tcp ports. are sure soap servers you're targeting listening udp traffic?

php - Regex for names with special characters (Unicode) -

okay, have read regex day now, , still don't understand properly. i'm trying validate name, functions can find on internet use [a-za-z] , leaving characters out need accept to. i need regex checks name @ least 2 words, , not contain numbers or special characters !"#¤%&/()=... , words can contain characters æ, é, Â , on... an example of accepted name be: "john elkjærd" or "andré svenson" an non-accepted name be: " hans ", "h 4 nn 3 andersen" or "martin henriksen ! " if matters use javascript .match() function client side , want use php's preg_replace() "in negative" server side. (removing non-matching characters). any appreciated. update: okay, alix axel's answer have important part down, server side one. but page lightwing's answer suggests, i'm unable find unicode support javascript, ended half solution client side, checking @ least 2 words , minimum 5 characters this:

operating system - Get user browser, os, flash version, javascript info -

i came across website outputs whole bunch of user info: ip, browser, os, flash version, javascript, etc in easy use format. it designed remote support, in order determine user operating environment. however, cant recall name of website....any ideas? try http://supportdetails.com/

c++ - Suppress "Operation not permitted" error from socket -

i have small utility application handles sockets, both tcp , udp. occasionally, error "operation not permitted" printed stderr. issues is, handle errors based on return codes of socket functions (and errno), , don't print anything. thus, message must coming 1 of socket calls. not sure one, message occurs infrequently, has been difficult debug, think either coming socket or sendto . is there way suppress messages being printed? can handle errors myself, not need system doing uncontrolled on behalf. note, linux application. thanks help. are using library on top of sockets api? functions used work sockets not supposed print stderr. i'd suggest using strace and/or ltrace check message originates in first place.

Python: Cannot Assign Function Call -

i having problem such as: def function (number): number in list: number = number + 1 for example function(1): number in range(1,5): number = number + 1 error come "can't assign function call" use variable value further calculations. help! i think have 2 problems. first, not naming function or declaring properly; should this: def f(number): ... second, naming function parameter number on next line seem treating list though parameter. think mean instead: def f(list): number in my_list: ...

recursion - jquery recursive function -

im trying make minesweeper game in jquery. when user clicks on table cell, check done see if there number or x in square. if there not, function called , table cell passed it. the function returns adjacent squares clicked square, , uncovered. the question is, selection of adjacent squares returned, how can check if of them empty, , if are, squares adjacent them, , uncover them , check if of them empty....until empty squares adjacent adjacent squares clicked 1 uncovered? if (isemptysquare(this)) { emp = adjacentsquares(this); $(emp).each(function() { $(this).removeclass('covered').addclass('uncovered'); }); } function adjacentsquares(square) { //find row , column of current td(square) var thisrow = $(square).parent().parent().children().index($(square).parent()); var thiscol = $(square).parent().children().index($(square)); var prevrow = (thisrow - 1); var nextrow = (thisrow + 1); if (thiscol == 0) { slice

silverlight - Joomla 1.6 question about incorporating PivotViewer for Joomla Extension -

i think problem in case stems lack of understanding joomla , not pivotviewer component (http://joomlacode.org/gf/project/pivotviewer/) trying install. the component adds bit of macro code article, when publish, article displays macro text , not execute macro. results article text: {pivotviewer id="5" name="markbrandon"}</p>"</p>" this code supposed render silverlight pivotviewer control. have utilized wysiwyg editor in such way prevent rendering of macro? have scoured on component documentation see if have done wrong. using localhost via microsoft webmatrix, iis 7.5, .net 4.0. have checked ensure plugin activated? not automatically activated when installed. component, call {pivotviewer id="5" name="markbrandon"} plugin, maybe still need install plugin ave installed component.

xml - Android Application Layout Help -

hi know how add/change colour of application layout. .xml file i'd add border , change background colour. there text fields in there, possible add border/border colour text fields. i novice way! thanks if new this, should use eclipse android sdk plugin. in eclipse, can use visual layout editor give fast , easy answer questions, , more.

sql - Intervals: How can I make sure there is just one row with a null value in a timstamp column in table? -

i have table column contains 'valid until' date , want make sure can set null in single row within table. there easy way this? my table looks (postgres): create table 123.mytable( some_id integer not null, valid_from timestamp without time zone not null default now(), valid_until timestamp without time zone, somestring character varying) some_id , valid_from pk. want nobody enter line null value in column valid_until if there line null pk. thank you in postgresql, have 2 basic approaches. use 'infinity' instead of null. unique constraint works expected. or if cannot that: create unique index null_valid_from on mytable(someid) valid_until null i have used both approaches. find first approach cleaner , allows use range types , exclude constraints in newer versions of postgresql better (to ensure no 2 time ranges overlap based on given given someid), bt second approach useful first cannot done.

average - Django counting related objects in model layer -

it possible working: class book(models.model): voters = models.manytomanyfield(user, blank=true) vote = models.integerfield() # summary of votes def average_vote(self): return int(vote/self.annotate(count('voters'))) maybe this? class book(models.model): voters = models.manytomanyfield(user, blank=true) vote = models.integerfield() # summary of votes def average_vote(self): return int(self.vote/self.voters.all().count()) let me know if works. haven't tested it.

Issue with C++ constructor -

edit: question came , think aced it! go stackoverflow!! :d i have exams coming up, , 1 of questions on last year's exams spot problem implementation of following constructor , write corrected one. rectangle::rectangle(string col, int len, int br) { setcolour(col); length =len; breadth=br; } the class definitions follows: class polygon { public: polygon(string col="red"); void printdetails(); // prints colour virtual double getarea()=0; void setcolour(string col); private: string colour; }; class rectangle : public polygon { public: rectangle(string, int, int); void printdetails(); // prints colour , area // part 3, delete line below double getarea(); private: int length; int breadth; }; i've written code compiler , runs fine. i'm guessing question relating inheritance, since string colour; private, setcolour public cant figure out. unless rectangle::rectangle(string col, int len, int br):le

Ruby 1.9 and Sass encoding issues. (from ASCII-8BIT to UTF-8) -

i upgraded ruby 1.9 , can no longer compile sass. i've seen solutions state if place @charset "utf-8"; at top of .sccs file, fix it. i'm still getting error. here's full traceback i've tried removing non-ascii characters css file, creating new one, etc. won't compile. tips? traceback: sass watching changes. press ctrl-c stop. /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/util.rb:496:in `encode': transcoding not supported (from ascii-8bit utf-8) (argumenterror) from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/util.rb:496:in _enc' /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/util.rb:515:in rescue in block (1 levels) in ' from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/util.rb:508:in `block (1 levels) in ' from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/util.rb:472:in `yield' from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/ut

orm - Entity Framework, application layers and separation of concerns -

i'm using entity framework 4.1 , asp.net mvc 3 application. mvc provides presentation layer, intermediate library provides business logic , entity framework sort of acts data layer guess? i separate entity framework code set of repository classes, or appropriate variation thereof, whatever constitutes worthwhile data layer, i'm having trouble resolving design problem have. if multi-layered approach exists me keep concerns separated, stands reason choice of data persistence should not concern of presentation layer. problem using entity framework, i'm tightly coupling application notion entity changes tracked , persisted automatically. as such, let's in hypothetical world found reason not use entity framework , wanted swap out. well-designed solution should allow me @ appropriate layer , not have dependent layers affected, because code being written knowledge data layer tracks object changes, able swap out entity framework works in similar fashion, example nhibe

javascript - google chrome background page suggestions/help -

how can use background page, highlight keyword on website, no matter website (google chrome extension)? no pop ups or anything, edits keyword, on site viewing. i've seen done before, can't figure out how! help. the easiest way use jquery highlight plugin content script: "content_scripts": [ { "matches": ["http://*/*"], "js": ["jquery.js", "jquery.highlight-3.js", "myscript.js"] } ], so include jquery, plugin , code controls every page.

c - Does SO_RCVTIMEO affect accept()? -

does so_rcvtimeo option affect accept (causing return eagain or ewouldblock if timeout expires)? there behavior specified standard? can't find in documentation accept or use of options: http://pubs.opengroup.org/onlinepubs/9699919799/functions/v2_chap02.html#tag_15_10_16 while on posix so_rcvtimeo defined "an input function", , so_sndtimeo defined "an output function", can'r find definition "input function" or "output function", i'll read/receive , write/send @ least. in specific case of linux, so_rcvtimeo affects accept() , can seen looking @ inet_csk_accept() , , so_snd_timeo affects connect() , can seen looking @ tcp_sendmsg() .

ruby on rails - How to spec operations that rely on Memcached? -

we have rails application test rspec. want spec operations rely on memcached. best practice so? i thought of doing stubbing calls rails.cache . idea? as per @pan thomakos suggestion, i'm adding additional details 1 of scenarios i'm trying test: we have concept of accounts in our system, therefore on every request retrieve current user , current account. because there not many accounts in system, keep them in cache , retrieve them there. def self.find_by_slug(slug) rails.cache.fetch(account.cache_key_for_slug(slug), :expires_in => 1.day) { super } end for reason, caching in case isn't nice have behavior, expected behavior , thing want test. therefore turning off caching won't do. test without stubbing imho! the sequence this: cache.flush # or equivalent cache.get(slug).shouldbe null # test cache empty method.find_by_slug(slug).should == 'some value' # test method words cache.get(slug).should == 'some value' # test

jvm - Where is Java PERM generation? -

when start jvm perm gen allocated? part of main heap or in addition heap size. for example if use following parameters: -server -xms10g -xmx10g -xx:maxpermsize=1536m is total size of java going 6g + 512m or 6.5g java or perm generation setup inside of heap meaning running application have 6g - 512m = 5.5mb young / tenured(aka old) , perm? this graphic in 4. sizing generations seems imply may outside of heap can't seem find states sure. http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html looking @ output jstat seem on outside of main heap may way reported. [jboss@pts03-taps-03 ~]$ jstat -gccapacity pid ngcmn ngcmx ngc s0c s1c ec ogcmn ogcmx ogc oc pgcmn pgcmx pgc pc ygc fgc 85184.0 85184.0 85184.0 8512.0 8512.0 68160.0 10400576.0 10400576.0 10400576.0 10400576.0 21248.0 1572864.0 1387840.0 1387840.0 431 43 ogcmx = 10400576.0 (almost 10g old gen) ngcmx = 851

Drupal 6.20, fields missing when viewing a node appear when editing -

i have node contains 6 fields. when user views node, fields appear user has entered data. when user edits node, fields visible. have inspected html confirm missing fields not being hidden css. how make fields visible when user views node? if field empty, drupal won't display it.

html - jQuery Slideshow that supports a table format? -

i have client has website using commercespace network solutions , have image fader on front page. issue run cannot seem work right because formatting in table. can't changed because that's way software lays out. have idea? use jquery cycle plugin, cannot work right. help? it working scriptaculous before, didn't decide use due jquery working better us, , worked before. var e2; var f2; var g2; activeimage = 2; paused=0; if (document.getelementsbyclassname('specials')[0] && document.getelementbyid('ctl00_pagecontent_ctl00_productlist')) { trs = document.getelementbyid('ctl00_pagecontent_ctl00_productlist').getelementsbytagname('tr'); featcount = 0; colcount = 1; (i=0;i<trs.length;i++) { if (trs[i].classname == "nojs") { continue; } featcount++; trs[i].id="featimg"+featcount; tds = trs[i].getelementsbytagname('td'); tdnum = 0; timeout = "new effect.parallel(["; (j=0

html - CSS for carousel of elements (container has fixed width, scrollable area has infinite width) -

what css required make viewport can have infinitely wide list inside of it? <div class='viewport'> <ul class='scrollable-content'> <li></li> <li></li> ... </ul> </div> this doesn't seem should require javascript. it's gotta simple, can't wrap mind around @ moment. something this? http://jsfiddle.net/vjgtm/

c++ - Understanding Vertex Array Objects (glGenVertexArrays ) -

i confused point in generating/creating vertex array object (vao) with: glgenvertexarrays(glsizei n, gluint *arrays); and glbindvertexarray(gluint); because can still create buffer object, vertices, , describe buffer object glvertexattribpointer , glenablevertexattribarray without ever creating vao. my question if not have create vao describe data in buffer object, why such sources opengl superbible 5ed include call create vao when creating vbos? used more advanced topics have yet discover, totally confused? also first encountered question when reading wikipedias entry on vbos , sample code includes no calls glgenvertexarrays() still describe data glvertexattribpointer() . wiki vbo entry -- example vaos created reason? performance improvements. in many cases, setting attributes on host require high number of api calls, , important amount of validation inside implementation. doing once, , using vao allow work amortized. see, example, graham sellers'

iphone - Preventing touchmove events in a <video> element in Mobile Safari -

i writing home-screen web app video element in mobile safari. usability reasons, prefer swiping on screen not make page scroll. can prevent swipes scrolling using following code. however, if user swipes on video element, page scrolls. <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width; height=device-height; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;"/> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" /> <title>no scroll</title> <script type="text/javascript"> window.onload = function(){ document.addeventlistener('touchmove',function(event){ event.preventdefault(); },false); }; </script> </head> <body> <p>anything video stationary wh

Android HttpPost Crash, Can't Debug? -

device xoom tablet. reason can't httppost, when try can't trap error. tried bunch of basic examples , crashed out same way (see stack trace). attach manifest in case missed permission. know it's happening in client.execute(post); statement. error not trapped , see in stack trace below. have tried bunch of different ways can't life of me tell real error is. post data not seem matter, same thing happens simple httpget request. on earth missing? block in question try { httpclient client = new defaulthttpclient(); httppost post = new httppost("http://share1.iqperspective.com/test"); list<namevaluepair> namevaluepairs = new arraylist<namevaluepair>(); namevaluepairs.add(new basicnamevaluepair("avar", "test data")); post.setentity(new urlencodedformentity(namevaluepairs)); client.execute(post); }catch (unsupportedencod

web services - Trying to remember software that self-documents SOAP/REST API -

i'm trying remember name of piece of software self-document rest , soap api's other things. has wiki go along well... does remember it? it's open source i figured out; it's called enunciate

Spring PropertyPlaceholderConfigurer Default Properties Not Read -

i trying embed activemq broker in tomcat. code base deployed in different environments. want externalize parameters, want provide default values parameters in case deployed environment not provide values place holders. this have : <property name="properties"> <props> <prop key="embed.broker.networkconnectoruri">static:(failover:(tcp://server01:61616,tcp://server02:61616)) </prop> <prop key="embed.broker.transportconnectoruri">vm://localhost:61616</prop> </props> </property> <bean id="broker" class="org.apache.activemq.broker.brokerservice" init-method="start" destroy-method="stop"> <property name="networkconnectoruris"> <list> <ref >${embed.broker.networkconnectoruri}</ref> </list> </property> <property name="tra

scripting - Clean Up Disconnected Network Drives -

Image
i have app requires connection remote windows. have done use mapped drive build connection on windows startup menu. partial codes this: @if not exist \\remotepc\sharedfolder net use * \\remotepc\sharedfolder /user:user1 pwd /persistent:yes the net use map works fine. mapped drive 1 available network drive letters. in app, unc name used instead(\remotepc\sharedfolder). the issue(not sure issue) after several reboots, can see list of disconnected drivers file explorer: i not sure letters used if reboot pc many times? clean disconnected network drives. can batch script? tried use net use again disconnected drive, deletes ok first time, stays in file explorer. net use t: /delete notes: not sure usage of option /persistent:yes. think should reconnect network drive after log in or reboot. not happen. that's why added scripts start menu. realize other file explorer tools display disconnected network drives. each time reboot, 1 more disconnected network drive appears.

php - return multiple nodes with xpath -

how return more 1 node on page? here code using, returns 1st node found. $dom = new domdocument; $dom->loadhtmlfile($url); $xpath = new domxpath($dom); $users= $xpath->query('//b[@class="xc_user"]'); echo $users->item(0)->nodevalue; $users domnodelist, can iterate over: foreach($users $node) { echo $node->nodevalue; }

sql - how to replace multiple words at once in postgresql -

to replace multiple words, i'm using looping thru candidates, , replacing 1 one. there better way? create or replace function "myreplace"(text, _varchar, _varchar) returns "pg_catalog"."text" $body$ declare int; result text; begin result = $1; in 1 .. array_length( $2, 1 ) loop result = replace( result, $2[ ], $3[ ] ); end loop; return result; end $body$ language 'plpgsql'; besides making stable , strict, , switching using pl/perl or c, there isn't optimization can make faster.

c# - how to stop asp.net encrypting the querystring -

i have requirement have pass values next page via querystring. querystring coming third party , need have on otherpage analysis. i response.redirect , add querystring recieve them other page. problem .net environment encoding/encrypting of special characters used them dont want not bring correct values in new page. example: passed url : abcd.efgh=testing|value1=rtedf%20value2%202010-04-07%207pm|value3=aaaa this gets changed abcd.efgh=testing|value1%3drtedf+value2+2010-04-07+7pm|value3%3daaaa it looks "=" becomes "%3d" , "%20" space becomes "+" how can stop encoding of url , pass in original form. your querystrings being url encoded . standard behaviour due how urls should formatted. need on receiving page use urldecode in order original string.

c# - IAsyncresult - polling without freezing the UI? -

i've got windows svc running asynchronously (i've edited methods , parameters make them async), little like: http://msdn.microsoft.com/en-us/library/ms731177.aspx however, call task want run asynchronously (the call service/server), , update ui (using reportprogress() on backgroundworker - of happening in dowork() method of backgroundworker). however, call endxxx method results, problem is, shouldn't code like? while (!asyncresult.iscompleted) { // ui updating etc here... } // call endxxx here. however, approach locks ui. @ moment, code (and doesn't lock ui): iasyncresult res = null; try { res = servicex.beginxxx(resultcallback, ""); } catch (faultexception<managementexception> managementex) { logger.error(managementex.detail.tostring()); messagebox.show("could not add printer. see log.");

c# - When to use value and reference types for immutable types? (.NET) -

with mutable types, difference in behaviour between value , reference types clear: // mutable value type pointmutstruct pms1 = new pointmutstruct(1, 2); pointmutstruct pms2 = pms1; // pms1 == (1, 2); pms2 == (1, 2); pms2.x = 3; mutatestate(pms1); // changes x property 4. // pms1 == (1, 2); pms2 == (3, 2); // mutable reference type pointmutclass pmc1 = new pointmutclass(1, 2); pointmutclass pmc2 = pmc1; // pmc1 == (1, 2); pmc2 == (1, 2); pmc2.x = 3; mutatestate(pmc1); // changes x property 4. // pmc1 == (4, 2); pmc2 == (4, 2); with immutable types however, difference less clear cut: // immutable value type pointimmstruct pis1 = new pointimmstruct(1, 2); pointimmstruct pis2 = pis1; // pis1 == (1, 2); pis2 == (1, 2); pis2 = new pointimmstruct(3, pis2.y); // can't mutate pis1 // pis1 == (1, 2); pis2 == (3, 2); // immutable reference type pointimmclass pic1 = new pointimmclass(1, 2); pointimmclass pic2 = pic1; // pic1 == (1, 2); pic2 == (1, 2); pic2 = new pointimmclass(3, pi