Posts

Showing posts from January, 2012

How can I specify a Windows drive letter when using subversion svn+ssh -

how can specify windows drive letter when using subversion svn+ssh? possible? on 1 system works: svn list svn+ssh://username@hostname://preserve/svn_repository but on machine, of svn , repository , ssh logs on c: drive. on new machine, subversion repository on n: drive, ssh , svn command live on c: drive. i haven't been able come path specification finds repository (the repository in directory: n:\preserve\repositories\jbp) note can access when logged machine via command: svn list file:///n:/preserve/repositories/jbp as example here call fails using svn+ssh svn list svn+ssh://username@hostname/n:/preserve/repositories/jbp if want file based reference, you need use file based uri . note hostname "localhost" , if omit it, uri standard assume meant localhost. if decide attempt access file different machine; well, need network uri (which may url). not possible directly access file system lies on other side of network, must use network acce...

python regex match line if exist or not -

i have little problem regex. here sample of text parse : output = """ country : usa zzzzzzz continent : americ eeeeeee ------ country : china zzzzzzz continent : asia planet : earth ------- country : izbud zzzzzzz continent : gladiora zzzzzzz zzzzzzz planet : mars """ i want parse , return country, continent , planet. so did regex : results = re.findall( r"""(?mx) ^country\s:\s*(.+)\s (?:^.+\s)*? ^continent\s:\s*(.+)\s (?:^.+\s)*? (?:^planet\s:\s*(.+)\s)*? """,output) but return : [('usa', 'americ', ''), ('china', 'asia', ''), ('izbud', 'gladiora', '')] and don't know regex wrong ? if has idea, thanks. i found pattern seems work: r"""(?mx) ^country\s:\s*(.+)\s (?:^.+\s)*? ^continent\s:\s*(.+)\s (?:^.+\s)*? (?:^(?:planet\s:\s*(.+)\s|-+\s|\z)) ...

c# - What AttributeTarget should I use for enum members? -

i want use isgpubasedattribute enum members this: public enum effecttype { [isgpubased(true)] pixelshader, [isgpubased(false)] blur } but compiler doesn't let me use: [attributeusage (attributetargets.enum, allowmultiple = false)] what right attributetarget value limit usage enum members? far know, there isn't 1 enum constants. closest "field", limits use field members of class or struct (which enum constants treated purposes of attributes). edit: bringing explanation of "why" comments, enum constants that, , such values , usages embedded directly il . enum declaration therefore not different creating static class definition static constant members: public static class myenum { public const int value1 = 0; public const int value2 = 1; public const int value3 = 2; public const int value4 = 3; } ... difference being derives system.enum value type instead of being reference class (you can...

php - How can I use Phing to SCP directory with symlinks inside it? -

i'm playing around phing, , i've setup task this: <scp .... > <fileset dir="/my/dir"> <include name="**" /> </fileset> </scp> but fails when gets symlink within directory (the symlink relative symlink pointing @ directory inside /my/dir structure . how can have phing transfer these symbolic links? or should use method? not sure expected behaviour is. whether want transfer actual symbolic link or dereferenced file. might not problem of actual scp task rather of fileset. have @ http://phing.info/docs/guide/stable/chapters/appendixes/appendixd-coretypes.html#fileset , try playing around expandsymboliclinks flag.

java - How to manage URLs on errors on Spring MVC? -

i have webapp spring mvc 3.0.4.release. i have following scenario: 1) enter search web page path: search.html 2) click search , post path: searchresults.hmtl 3) when click search result, post searchresults/enterresult.html 4) let assume controller raises exception... 5) need return searchresults.html page previous search. i can't use forward, because maintains path searchresults/enterresults.html, if click o search result builds following inexistent path: searchresults/searchresults/enterresults.html do know how manage problem? if error occurs, why not redirect:searchresults.html instead of forwarding it? if want send error message displayed in page, can add them parameters, this: redirect:searchresults.html?error_message=yada . by way, if avoid using relative url when constructing search result form action, shouldn't searchresults/searchresults/enterresults.html problem in first place. seem doing post on enterresults.html instead of /your-app/sear...

java - How to instantiate Class class for a primitive type? -

i'm trying this, doesn't work: public static class loadit(string name) throws throwable { return class.forname(name); } assert foo.loadit("int") == int.class; // exception here how should properly? you can't, because primitives not objects. what trying though not yet instantiation - loading class. can't primitives. int indeed name used int types, whenever class object obtained (via reflection, example method.getreturntype() ), can't load forname() . reference: reflection tutorial : if fully-qualified name of class available, possible corresponding class using static method class.forname(). this cannot used primitive types a solution instantiate primitive use commons-lang classutils , can wrapper class corresponding given primitive: if (clazz.isprimitive() { clazz = classutils.primitivetowrapper(clazz); } clazz.newinstance(); note assumes have class representing int type - either via reflection, or via literal ( i...

django - Should I use Python 2.7 32 bit or 64 bit with Windows 7 -

i setting django, , trying decide whether use 32 bit or 64 bit version of python 2.7 on windows 7 machine. i've seen issues 64 bit installer, real question whether or not of necessary libraries available 64 bit, or whether 1 version has other issues should aware of. i recommend 32-bit 1 unless going exhaust address space. many third-party modules opencv , numpy considerably easier install 32-bit python. (you can build modules source them work 64-bit python that's more time , effort necessary in cases. there unofficial 64-bit builds aren't supported module authors.) while don't need modules django, if personal computer , might install them different project , don't want deal 2 python installations on same machine, choose 32-bit.

delphi - Is there any way to catch unhandled application exceptions and log them -

is there way catch , log errors in application. in moment use try catch blocks in places think error can occur. there possibility catch errors in application level (i mean, can put try catch block project file or maybe other trick it)? take @ madexcept . if add project, automatically installs hooks catch unhandled exceptions, generate informative error reports, , email them or post them web service. it's next best thing being able attach debugger clients' systems.

swing - java update Jpanel component -

i using custome jpanel in gui builder jfram class a, problem facing update components (lable) in jpanel when click button in jframe.here button in gui builder jframe classa: changes color of jpl , remove labels not update new labels. private void btnshowactionperformed(java.awt.event.actionevent evt) { // todo add handling code here: random randomgenerator = new random(); (int idx = 1; idx <= 10; ++idx) { q = randomgenerator.nextint(100); } jpl1.removeall(); new jpl().printme(classa.q); jpl1.revalidate(); jpl1.setbackground(color.blue); jpl1.repaint(); } here jpl class used custome component in guibuilder jframe class a. public class jpl extends jpanel { public jpl() { printme(classa.q); } public void printme(int q) { (int = 0; <q; i++) { system.out.println(i+"rinting lable"); string htmllabel = "<html><...

php - Web Service with .net and nusoap -

i using nusoap connect .net service, error "notice: undefined variable: header in c:\xampplite\htdocs\newsoap\searchwwcc.php on line 54 fatal error: uncaught soapfault exception: [client] function ("serializeenvelope") not valid method service in c:\xampplite\htdocs\newsoap\searchwwcc.php:54 stack trace: #0 [internal function]: soapclient->__call('serializeenvelo...', array) #1 c:\xampplite\htdocs\newsoap\searchwwcc.php(54): soapclient->serializeenvelope(' here reference code using require_once('lib/nusoap.php'); $serverpath ='https://service.website.net/ws/bridge.asmx?wsdl'; $soapclient = new soapclient($serverpath); $soapaction = "http://connect2.askadmissions.net/webservices/getcontact"; $body='<?xml version="1.0" encoding="utf-8"?> <soap:envelope xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:soap...

com - IClassFactory failed due to the following error: 800a0153 -

i'm trying reference com component , throwing below error. creating instance of com component clsid {xxx} iclassfactory failed due following error: 800a0153. specifically error gets thrown when try instantiate object. checked that the project being built x86 processors is the com object registered using regsvr32, , available in registry. i can see methods in object browser, know .net finding it. any ideas on i'm missing? this error code that's specific component. if don't have documentation explains code might mean you'll need support vendor.

flex: How to respond to change of data inside a component -

i've created custom component based on image component. want teach respond change of binded variable. e.g. if main class has variable balance, want component change image in case balance = 100 1 image, in case balance = 50 another. can understand how that i using flex3 don't see propertywatcner there. using component2 main mxml file way <mycomp:myicon left="15" top="20" width="60" height="60" id="tower" price="100" accountstate="{accountmoney}" click="drawbuildingshadow(event)" /> and inside component myicon want able react changes of binded accountstate variable. without code go (please include sample of both components if can), there number of ways approach this. you add changewatcher bound variable in question, , invokes method when property changes. method change image, based on whatever conditions apply property. it something this: component 1: [b...

jquery: test whether input variable is dom element -

i write jquery function accepts either dom element or id input: function myfunction(myinput){ // pseudocode: // if (myinput dom element){ // var myid = $(myinput).attr('id'); // } else { // var myid = myinput; // } // stuff myid ... } question: how can tell whether myinput dom element??? it's easier check other way around - check if it's string if use id else treat dom node/element , handle if one. function myfunction(myinput) { var myid; if (typeof myinput == 'string'){ myid = myinput; } else { myid = myinput.id; // myinput.id enough } // } or if want check against if it's htmlelement every dom html element extends htmlelement abstract interface. check mdc more info on htmlelement. ... if (myinput instanceof htmlelement){ myid = myinput.id; // myinput.id enough } else { myid = myinput; } ... in end won't matter... call! tom

apache - mod_proxy_ajp error: renders html as text/plain, prompts user to "save as..." -

we have odd, intermittent error occurs mod_proxy_ajp, i.e. using apache front end tomcat server. the error user clicks on link browser prompts user "save as...." (e.g. in firefox "you have chosen top open thread.jsp application/octet-stream"...what should firefox file) user says "huh?" , presses "cancel" user clicks again on same link browser displays page correctly this error occurs intermittently, unfortunately on our test server , on production. in firefox's livehttpheaders see following in above usecase: first page download (i.e. click on link) "text/plain" second download "text/html" i thought problem may stem proxypassreverse (i.e. muddling whether use http or ajp), these proxypassreverse settings resulted in same error: proxypassreverse /ajp://localhost:8080/ proxypassreverse /pe http://localhost/pe proxypassreverse /pe http://forumstest.company.com/pe additionally, i've checked...

io - Multiple readers for InputStream in Java -

i have inputstream i'm reading characters. multiple readers access inputstream. seems reasonable way achieve write incoming data stringbuffer or stringbuilder, , have multiple readers read that. unfortunately, stringbufferinputstream deprecated. stringreader reads string, not mutable object that's continuously being updated. options? write own? input stream work this: once read portion it, it's gone forever. can't go , re-read it. this: class inputstreamsplitter { inputstreamsplitter(inputstream toreadfrom) { this.reader = new inputstreamreader(toreadfrom); } void addlistener(listener l) { this.listeners.add(l); } void work() { string line = this.reader.readline(); while(line != null) { for(listener l : this.listeners) { l.processline(line); } } } } interface listener { processline(string line); } have interested parties implement listener , add them inputstreamsplitter

php - date("m"); returns the following result for this month... "02" -

date("m"); returns following result month... "02" that fine , dandy, problem is, need change 02 february, , not changing date("f"); i need use date function convert supplied number of 02 february, there way of going logically without bunch of if/else statements?? while date('f') preferred: $monthnames = array( '01'=>'january', '02'=>'february', '03'=>'march' ); // , on... echo $monthnames[date("m")]; edit adjusting hitherto unspecified requirement: $ts = mktime (0, 0, 0, date("m"), 1, date("y")); doc: http://us2.php.net/manual/en/function.mktime.php

Matrix multiplication using MATLAB -

if have following matrix: a=[10 1 0 1 1 50 1 0 0 0 60 0 0 0 1] how can multiply first column in matrix [10 50 60]' vector multiplication rest of matrix , following: b=[10 10 0 10 10 50 50 0 0 0 60 0 0 0 60] if want frame matrix multiplication, like: b = [a(:,1), diag(a(:,1))*a(:,2:end)] should work (it's been while since i've done matlab, though).

asp.net - Can ComboBoxItem holds object value? -

from experience in silverlight, comboboxitem can holds object data, can combobox.selecteditem , cast data object type , databinding object out. but in asp.net, comboboxitem seems have text , value property databinding. wonder if there way can databinding object out? not searching datasource , find object text , value... thanks in advance. you can try in code behind vb... ctype(ddldropdownlist.items(ddldropdownlist.selectedindex), objecttype)

emacs - How to open http://XYZ from my *own* tag in org-mode? -

when have ([abc] or [[abc]] or *abc ... ) in org-mode text, how can link command http://prosseek/wiki.php/abc?action=edit ? i want edit own wiki page simple org-mode link. simple way manually input [[http://prosseek/wiki.php/abc?action=edit][abc]] , want generate first http part automatically. this code snippet you're looking for: (setq org-link-abbrev-alist '( ("mine" . "http://prosseek/wiki.php/%s?action=edit") )) this let [[mine:abc]] jump link.

python - How to make RTS units -

i want make units fight in space try out stuff need print whats going on , results. i'm planing on loading each unit separate file or similar (units modifiable think should better way, no need keep each unit stats instancing). i'm not sure how load units. question broad? link similar helpfull couldn't find anything there bunch of different ways of handling this, depending on trying save , how want use it. if want save basic unit-type stats can modified, plain-text file or csv file work nicely. (if have copy of game alpha centauri, @ faction definition files - should give lots of ideas!). for ultimate in flexibility, save units python source-files , import needed. "flexibility" can make debugging nasty. half-way step definite own 'unit definition language' you use cpickle if want save , reload units, not edit them; might useful savegames. for graphics or 3d models, lot of game engines (panda, pyogre, etc) have binary-format support buil...

PHP Count number of specific words said via Twitter -

using twitter's oauth... want know if it's possible rummage through person's tweets , count how many times person has word in tweets... what you, possible? of course possible. other questions?

Change Jquery Cycle plugin code (move Pager position) -

i have this: <script type="text/javascript"> $(function() { $('#slideshow').after('<div id="slideshow-nav">').cycle({ fx: 'fade', timeout: 0, prev: '#prev', next: '#next', fit:1, pager: '#slideshow-prevnext', pageranchorbuilder: function(idx, slide) { return '<a class="dot" href="#">&nbsp;</a>'; } }); }); and makes html markup this: <div id="slideshow-prevnext" class="slideshow-prevnext"> <a id="prev" class="left" href="#"><span class="invisible">prev</span></a> <a id="next" class="right" href="#"><span class="invisible">next</span></a> <a href="#" class="dot">&nbsp;</a> <a href="#"...

c++ - Representation of Long Integers -

possible duplicate: what difference between int , long in c++? #include <iostream> int main() { std::cout << sizeof(int) << std::endl; std::cout << sizeof(long int) << std::endl; } output: 4 4 how possible? shouldn't long int bigger in size int ? the guarantees have are: sizeof(int) <= sizeof(long) sizeof(int) * char_bits >= 16 sizeof(long) * char_bits >= 32 char_bits >= 8 all these conditions met with: sizeof(int) == 4 sizeof(long) == 4

ruby - How to use a CGI to redirect from an HTML page to another using POST? -

i want send parameters page via redirect using ruby cgi script; however, want post if possible (ie. not pass parameter string in url). have working using parameter string in url using code below. def redirect( new_page ) print "location:#{new_page}\n\n" end redirect("apage.html?name=bla&something=else"); as far have been able research, have not found way this. 1 way around without doing html redirect open html file in cgi script , print when cgi generating html. catch here have url cgi script in address bar, may possible redirect using .htaccess (though can't sure if work). hope helps! :-d

c++ - Why wont my "intellect" variable add by 5? -

if (checkforroll == "intellect" && checkforroll == "intellect") {//checks intellect intellect = intellect + 5; } else if (checkforroll == "strength" && checkforroll == "strength") { strength = strength + 5; } cout << intellect; when execute this, intellect int not add 5. why? you requiring string equal both intellect , intellect impossible. change "and" ( && ) "or" ( || ).

iphone - Which Three20 view should I use after a thumbnail is clicked to produce an Instagram look? -

Image
i followed instructions on getting three20 photo gallery created. however, when click thumbnail behaves native photo app. functionality overridden? when click thumbnail want produce view image below. the answer is, none of views provided three20 directly trick. instagram implemented such view heavily customizing cocoa touch's uitableview. if want same style, have roll sleeves , implement yourself.

Does a char array need to be one byte bigger than you intend to use? - C -

i've started learning c , bit confused when comes arrays. #include <stdio.h> int main() { int i; char j[5]; (i = 0; < 5; i++) { j[i] = 'a'; } printf("%s\n", j); } running code prints out aaaaa♣ i've read char array needs 1 byte longer string compiler can place \0 @ end. if replace code this: #include <stdio.h> int main() { int i; char j[5]; (i = 0; < 4; i++) { j[i] = 'a'; } printf("%s\n", j); } the output is: aaaaa the char array 1 byte longer i'm using. suspect why don't see odd character @ end of string? i tried test theory following code: #include <stdio.h> int main() { int i; char j[5]; (i = 0; < 4; i++) { j[i] = 'a'; } (i = 0; < 4; i++) { printf("%d\n", j[i]); } } but, in output, see no nullbyte. because added when outputed string? 97 9...

exit - Why when a .bat file tests for %ERRORLEVEL% after running .NET app, it is testing for a string return type, not an int? -

i looking @ how run .net app command line, or in bat file, , code given testing %errorlevel% (the exiting return value) of application: @if "%errorlevel%" == "0" goto success why testing "0" , not 0? understand it, .net executable returning int when exits, not string. it's coercing numeric value string , comparing. can helpful if environment variable has no value %param% == 1 evaluate == 1 cause error. for checking program's errorlevel, it's better evaluate per raymond chen's blog . if errorlevel 1 echo error level 1 or more

Django-python: how to pass argument from child class to parent class? -

class malemanager(models.manager): def get_query_set(self): return super('here should employeemanager', self).get_query_set().filter(sex='male') # need pass class name employeemanager malemanager class employeemanager(malemanager): def get_query_set(self): return super(employeemanager, self).get_query_set() so want here passing employeemanager genericmanager, , have no idea how that? if for, whatever reason, you've described make sense, might looking self.__class__ property.

Django Inline Formset Issue (list out of range) -

this should simple , had working yesterday. have no idea changed it's throwing error. def game_design(request): user=user.objects.get(pk=request.user.id) organization=user.organization_set.all()[0] website=organization.website_set.all()[0] surveys=website.survey_set.all() error='' surveyformset=inlineformset_factory(website, survey, extra=0, can_delete=true) navigationformset=modelformset_factory(navigation, extra=1) if request.method=='post': survey_formset=surveyformset(request.post, request.files, prefix="surveys") navigation_formset=navigationformset(request.post, request.files, prefix="navigations") if survey_formset.is_valid() , navigation_formset.is_valid(): survey_formset.save() navigation_formset.save() return httpresponseredirect("/rewards/") else: error="please fix errors" survey_fo...

android scrollbar thumb length -

hi using drawable scrollbar track , thumb ,in case of thumb , need see thumb in original dimension of image, thumb stretched. there 3 (for horizontal plus 3 vertical) protected methods in view used calculate how draw scrollbar , thumb, , can override them. see here , following methods.

iphone - Is there a possibility to play 2 videos simultaneously by url -

before start task want know possibilities playing 2 videos simultaneously(together) using url. code i'm tried play video in partial screen: player = [[mpmovieplayercontroller alloc] initwithcontenturl:[self movieurl]]; player.view.frame = cgrectmake(100, 150, 250, 300); [self.view addsubview:player.view]; [[nsnotificationcenter defaultcenter]addobserver:self selector:@selector(moviefinishedcallback:) name:mpmovieplayerplaybackdidfinishnotification object:player]; [player play]; error: error:request member 'view' in somthing not structure or union anyone helpme... not normally. mpmovieplayercontroller works connecting separate server process, actual video decompression. decompresses 1 stream @ time, 1 movie view can have playing content @ once. your best bet use favorite video editing software combine both movies single movie, s...

SaxParser Not Working to Extract Larger Strings Android -

i using saxparser parsing xml contains image url long enough. using sax parser storing them in variable. code wrote simple , accurate parse parsing same xml accurately smaller length strings. which ensure code correctness. saxparser failing in extracting larger strings. help me out plz i know doing wrong. though more better answer if post code of yours. you must storing character string in character reading delegate of parser in string variable. problem . instead should use string builder , append characters in new buffer extract string xml in character reading delegate . like this stringbuilder obj = new stringbuilder(); // in starting tag delegate public void characters (char buf [], int offset, int len) throws saxexception { obj.append(buf); } this problem occurs many threads can running @ time sometime preempt parsing thread. hope helps :)

android - creating layouts dynamically and getting control on each layout -

i have create layouts dynamically depending on action example depending on action have created 5 layouts horizontal scroll , want control of each layout how go please give me suggestion your requirement not entirely clear. if want load layouts xml resource fiel can use layoutinflater . return handle loaded layout can use further manipulation.

java - JTable row selection -

i need select row when click on row on jtable. default behavior when mouse pressed, row gets selected. how can change behavior? expectation :: mouse pressed --> mouse released ==> selected mouse pressed --> mouse dragged -- > mouse released ==> not selected mouse clicked ==> row selected i want else when mouse dragged, don't want change previous row selection on action. import java.awt.event.*; import javax.swing.*; /** * * @author jigar */ public class jtabledemo extends mouseadapter { int selection; public static void main(string[] args) throws exception { jframe frame = new jframe(); frame.setdefaultcloseoperation(jframe.exit_on_close); string[] headers = {"a", "b", "c"}; object[][] data = {{1, 2, 3}, {4, 5, 6}}; jtable table = new jtable(data, headers); jscrollpane scroll = new jscrollpane(); scroll.setviewportview(table); frame...

java - Struts 2 Action error -

i have problem struts 2 action error while forwarding 1 action action .the problem lies there interceptor in between , doing redirect action can how copy action error old action current action or save action error in session? it highly appreciable if 1 gives working peice of code thanks your result type "redirect" or "redirectaction" these reset value stack use "chain". although should solution not use of aforementioned result types...

flash - TextField's size in Flex -

i'm converting code project flash 3 flex 4. i've got problem textfield controls. text placed in doesn't appear. i've checked thoroughly , width equal 4. no matter text placed in it, narrow. know in flex, should provide width , height explicitly components there issues: i don't know initial size of such field - want automatically determine size based on text stores there couple of other containers contain , should resize automatically too, have correct size display content of textfield. thanks first, i'll assume you're using uitextfield . if not, use one. having out of way, set autosize property textfieldautosize.right, , leave width undefined. if have text multiple lines, or text won't fit in line want displayed, you'll want set width of field percentage, 100% (percentagewidth actionscript, width mxml), , leave height undefined. if there containers need resized, i'd recommend using vbox/hbox instead of whatever you're...

c# - automatic datacontext transaction management -

i assumed when using datacontext in following fashion automatic rollback: update called submitchanges twice question still applies. public void updateuser(user user) { using (var context = new userdatacontext()) { //update stuff. context.submitchanges(); //update stuff. context.submitchanges(); } } when goes wrong there no rollback. instead, provide rollback i've implemented following: public void updateuser(user user) { var context = new userdatacontext(); try { context.connection.open(); context.transaction = context.connection.begintransaction(); //update stuff. context.submitchanges(); context.transaction.commit(); } catch (exception e) { context.transaction.rollback(); throw; } { context.dispose(); } ...

https - How to configure playframework server to support ssl -

how configure playframework server support ssl example https://localhost:9000 if prefer use integrated way, described in release notes of playframework v1.1. can set port https in applicaon.conf.

c++ - Which function calls are not resolved at compile time in object oriented programming? -

which function calls resolved @ compile time , ones @ runtime? read somewhere not function calls resolved @ compile time dont know which. virtual function calling mechanisms resolved @ run-time. because, in c++ , pointer derived class type-compatible pointer base class. so, call virtual function, actual type of constructed object( or actual under lying object ) base class pointer pointing must known, can resolved @ runtime. struct foo { virtual void virtualmethod() { cout<< " \n virtualmethod of foo \n"; } void normalmethod() { cout<< " \n normalmethod of foo \n"; } virtual ~foo() {} }; struct bar: public foo { void virtualmethod() { cout<< " \n virtualmethod of bar \n"; } void normalmethod() { cout<< " \n normalmethod of bar \n"; } ~bar() {} }; foo* obj = new bar ; obj->virtualmethod() ; now,...

.net - When calling an object method on an integer literal (such as ToString), is the CLR boxing the literal first? -

i wonder if boxing taking place in order tostring() called on integer literal (5): 5.tostring(); oh, , if not, taking place in order clr able call tostring() method? no, doesn't require boxing - because int overrides tostring . compiler can determine method called, doesn't need go through virtual dispatch. doesn't use callvirt - call correspond il of call instance string [mscorlib]system.int32::tostring() if don't override tostring() (etc) in struct, calls virtual method require boxing.

linux - poll() can't detect event when socket is closed locally? -

i'm working on project port tcp/ip client program onto embedded arm-linux controller board. client program written in epoll(). however, target platform quite old; kernel available 2.4.x, , epoll() not supported. decided rewrite i/o loop in poll(). but when i'm testing code, found poll() not act expected : won't return when tcp/ip client socket closed locally, thread. i've wrote simple codes test: #include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <fcntl.h> #include <pthread.h> #include <poll.h> struct pollfd fdlist[1]; void *thread_runner(void *arg) { sleep(10); close(fdlist[0].fd); printf("socket closed\n"); pthread_exit(null); } int main(void) { struct sockaddr_in hostaddr; int sockfd; char buf[32]; pthread_t handle; sockfd = socket(af_inet, sock_stream, 0); fcntl(sockfd,f_setfl,o_nonblock|...

winforms - Coloring backgorund of richtextbox line in C# -

i'm trying color specific line's background in richtextbox. need line's background colored way end of right side of control. tried using selectionbackcolor property, colors until end of line. know of way this? :) mmm, believe cannot without custom painting, because said, rtf formatting format text if not have text ( chars or white spaces or tabs... ) cannot reach parts of control empty, unless change whole control background color...

sql - TSQL - Return value from sp when sp does not contain return -

i have stored procedure called stored procedure alter procedure [dbo].[usp_test] begin declare @errorcode int declare @lastidentity int select @errorcode = @@error if @errorcode=0 begin update vehicle set model='1996----------' make='merc' select @errorcode = @@error select @lastidentity = @@identity end print 'usp_test lastidentity=' + convert(varchar(10), isnull(@lastidentity,0)) print 'usp_test errorcode=' + convert(varchar(10), @errorcode) end if call stored procedure this declare @retval int exec @retval=usp_test print 'return value ' + convert(varchar(10), @retval) i following messages msg 8152, level 16, state 14, procedure usp_test, line 14 string or binary data truncated. statement has been terminated. usp_test lastidentity=0 usp_test errorcode=8152 return value -6 by adding return 0 @ end , return @errorcode after select @errorcode... have nice clean way of return...

How to split a string with java but also keep the delimiters end of sentance -

possible duplicate: is there way split strings string.split() , include delimiters? suppose have following sentences- what name? name don. nice! i want output java follows what name? name don. nice! i used java split() method. split without delimiters. used split("[\\.!?]") this trick: split("(?<=[.?!])"); (adapted this great answer )

ruby - Bundle install to development -

for reason when run bundle install installs production: your bundle complete! installed ./rails_env=production arrrghh, how switch development?? notes: i haven't modified environment files when run rails.env console "development" gem file: source 'http://rubygems.org' gem 'rails', '3.0.3' gem 'sqlite3-ruby', '1.3.2', :require => 'sqlite3' group :development gem 'rspec-rails' gem 'nokogiri' gem 'will_paginate' end group :test gem 'rspec' end also worth noting, creates folder in app called rails_env=production posted question here guess linked issue. update when run bundle config following information, can see path set culprit! ideas how change this? tried re-installing bundler gem no avail, maybe bug within bundler? $ bundle config settings listed in order of priority. top value used. disable_shared_gems set local app (/users/zinc/ror/site/.bundl...

content management system - BFOs and ‘jobs’ – Java only, no .NET? -

i have started investigating documentum (i have developer edition 6.6) task that, probably, require usage of documentum’s business object framework (bof) objects (tbos , aspects) , documentum’ ‘jobs’. understand correctly both bofs , ‘jobs’ can written on java , not on .net? important me because of project .net-oriented. yes, assumption correct. documentum is, @ core, java based application, , required write these jobs in java.

excel vba - how to use Application.OnKey by C# without involving VBA code? -

i want use udf in excel template(.xlt) have used application.onkey("^v","myfunction"); i want use separate function when user paste the cell in excel i.e. myfuction when defined function in thisworkbook.cs wont work... thanks in advance.. this won't work. need define function in vba , call .net method vba function, explained here @ end: http://msdn.microsoft.com/en-us/magazine/cc163373.aspx

making an element optional using xsd -cvc-length-valid ERROR -

<xs:element name="currencycode" minoccurs="0"> <xs:simpletype> <xs:restriction base="xs:string"> <xs:length value="3" /> </xs:restriction> </xs:simpletype> </xs:element> but if value empty returns error cvc-length-valid: value '' length = '0' not facet-valid respect length '3' type '#anontype_currencycodeserviceservicelist'. so how can deal ? your schema allows omitt currencycode element if present value must string 3 characters length. you weaken restriction allow 0-length values specifying min , max length: <xs:element name="currencycode" minoccurs="0"> <xs:simpletype> <xs:restriction base="xs:string"> <xs:minlength value="0" /> <xs:maxlength value="3" /> </xs:restriction> </xs:simpletype...

c# - How to add query string to httpwebrequest -

i want add querystrings httpwebrequest, cannot find property? remembered there querystring dictionary can use before. the best way add query string follows: var targeturi = new uri("http://www.example.org?querystring=a&b=c"); var webrequest = (httpwebrequest)webrequest.create(targeturi); var webrequestresponse = webrequest.getresponse(); remember: if you're using user input construct uri, ensure validate it, escape , don't trust it.

NHibernate in a class library? -

i have visual studio 2010 mvc 3 web solution containing number of projects. 1 of these projects site, handles data access. i using nhibernate access database , have put mapping files, nhibernate.config , nh dlls inside data access project. i have enough of idea how use nhibernate i've ever used in small, single test projects - never solution multiple projects i want reference nhibernate.config in site's web.config - can that? if not should do? put the nh dlls in site's bin folder , stick nh config straight dll? totally lost - appreciated! i put nhibernate.config in web project , data access layer create session factory this: private isessionfactory createsessionfactory() { configuration cfg; cfg = new configuration().configure(path.combine(appdomain.currentdomain.basedirectory, "nhibernate.config")); return (cfg.buildsessionfactory()); } always searching nhibernate.config in base directory, can reference dal in other projects....

ajax - Experiences with integrating spring 3 mvc with GWT? -

given: spring 3.0 mvc has excellent rest support 1 of representation being json. gwt simplifies development ui developed in java. default uses rpc client server interaction. there option use json. questions: can share experiences using spring 3.0 mvc gwt ? what best approach integrate these 2 frameworks? is default gwt's mvp architecture client side , work json? thanks can share experiences using spring 3.0 mvc gwt ? yes. we've built whole large application around gwt , spring mvc (1500 source files, 6 months in development). spring key project's success. spring able test individually pieces of application on server side. what best approach marry these 2 frameworks? ignore default servlet used gwt , instead create own spring controller handle incoming gwt-rpc requests. blog post key integrating 2 techs. we integrated other components: flash animated charts , third-party javascript components other stuff. these communicate server through...

Can you recommend a CAPTCHA library for use with an ASP.NET MVC application? -

if you've incorporated captcha asp.net mvc application, did use external captcha library of kind? if so, recommend , why? do use nuget? if don't, right click on reference section of project , choose ad library package reference get online tab, , install microsoft web helpers dll in refrence, find handy helper recaptcha.gethtml you can use on view below; @recaptcha.gethtml(configurationmanager.appsettings["recaptcha-public-key"], "white") i keep recaptcah keys inside web.config used configurationmanager.appsettings reach them. can own public , private keys http://www.google.com/recaptcha in controller, easy handle legitimate call below; if (recaptcha.validate(configurationmanager.appsettings["recaptcha-private-key"])) { //the call legitimate } else { // call not legitimate } i hope helps. update 1 uppps. don't forget put private , public keys inside _viewstart.cshtml file below; @{ layout = "~/vie...

c# - How to Create a Directory Structure from Database for treeview? -

i saving relative path of files in db string. want create treeview input. there can multiple folders file path. please in how functionality. thanks in advance. your question bit generic , vague if guess right issue how parse paths db , create proper hierarchy of treenodes reflect folder nesting, right? have here: dynamic binding of hierarchy data structure treeview control you can start ask more specific questions if still not work.

flash - Using bitmap data to draw massive image -

Image
i making snow boarding game in as3. problem having want leave trail in snow behind board. i have had think , feel best way of achieving use lineto() method draw line form snowboards previous position current position. if of way down slope end line 23000 pixels long seems extremely large , have major impact on performance. if convert trail movieclip bitmap improve performance? targeting minimum of flash player 9 have found have issues when handling bmp's on 2880 pixels think method might not work. can think of clean , fast solution? thanks in advance you store few values in fixed length vector/array , keep updating single value while shifting others (so bit 'out of date'): var ptsnum:int = 25; var pts:vector.<point> = new vector.<point>(ptsnum,true); for(var i:int = 0 ; < ptsnum ; i++) pts[i] = new point(mousex,mousey); this.addeventlistener(event.enter_frame, update); function update(event:event):void{ //update for(var i:int = ...

php - Magento Design Patterns -

magento, imho, represents php system built on thought-out coding principles - reuseable design patterns being 1 of them. in terms of example of php system, think can considered pretty cutting edge , therefore worth considering architectural point of view. as understand it, there many design patterns available oop developer. seeing such patterns being put use in open-source system such magento allows developer view examples of such patterns in real use , in situ, rather in examples can rather achedemic, , little misleading. as such, wondering patterns, other ones have listed below, magento programmers have used when developing magento. as note, understand of these patterns in place consequence of being built on zend framework, mvc / front controller being couple of them, the obvious ones are: factory: $product = mage::getmodel('catalog/product'); singleton: $category = mage::getsingleton('catalog/session'); registry: $currentcategory = mage::re...

wsdl - Publishing a web service -

i've been working web services in academic setting quite while now, there's 1 basic aspect them not get. here is: assume have application want people use web service. make (or generate) wsdl description , adapt application functionality can invoked having access wsdl description. have functional web service. how let people know find , represents? i aware of uddi initiative, imho has started fail. doesn't make sense have publish web services in 1 place, , big companies backing seem have realized that. options have left? how can tell people "hey, check out nice web service api made you. here wsdl files too.". make links wsdl descriptions on web page? write documentation , examples it, , publish them along links service on a/your website. that's there it. here's example of documentation website: http://code.google.com/apis/maps/documentation/webservices/index.html

php - Using PDO with 2 databases Intermittent error SQLSTATE[HY000] [2005] Unknown MySQL server host -

most of time works fine. refresh screen once , works , sometime have wait few minutes. have gotten , tried on different pc , appears if not working on 1 computer not working where. the program opens databases in same order each time , error has occurred on both first , second database. i have not seen pattern. i using godaddy.com shared hosting. php version 5.2.17 pdo driver mysql, client library version 5.0.77 any advice appreciated. if you're connecting via tcp sockets, due intermittent dns lookup failure. e.g. connection string uses 'mysql.example.com:3306', , whatever dns server(s) host configured use fails whatever reason.

security - Why doesn't SSH use the interlock protocol? -

it seems ssh designers cared great deal man in middle attack. their approach was, save server's public key finger print @ first time you're connected server (and hope user doesn't connect poisoned network in first time, instance if has virus in computer). user uses fingerprint verify server's public key next time he'll connect server. in practice, found out many user ignores warnings unmatched fingerprints, , assume it's due server re-installation. it's mitm attack difficult conduct , rare, never worry it. moreover, many times user wants use ssh many different computers, , wouldn't bother importing fingerprints computer might want use ssh (hey, can why site down, i'm panicked! i'm not in office, i'll drop nearest internet cafe , have look). to fair, 1 can use dnssec , use dns servers ca . never saw used in practice. , anyhow, it's not mandatory part of protocol. many years thought 1 cannot avoid mitm without preshared secr...

c# - NPOI support CSV/TSV? -

i'm using npoi library c# application. what i'm creating reporting system automatically reads, , extracts data excel sheet. given spec, informing me reports needed ingest in system in .xls format appears not case. i'm wondering possible read in csv or tsv file using npoi library? i've crawled web seem able find answers relating java version of library. any appreciated, :) to read csv files in .net should take 1 of these: a fast csv reader filehelpers library

c# - Where to place RemoteCertificateValidationCallback? -

i have same problem here: how disable "security alert" window in webbrowser control i answer, going place servicepointmanager.servercertificatevalidationcallback = new remotecertificatevalidationcallback(validateservercertificate); ? i 'invalid certification' message after submit login page of school network code: htmlelementcollection ellements = webbrowser.document.getelementsbytagname("input"); foreach (htmlelement ellement in ellements) { if (ellement.outerhtml == "<input onclick=\"this.value = 'submitted'\" value=\" login \" type=submit>") { ellement.invokemember("click"); this.dialogresult = dialogresult.ok; break; } } thank much. :) you should put following @ any point before show web browser control / submit page: servicepointmanager.servercertificatevalidationcallback += new remotecertificatevalidationcallback((sender, certificate, ...

java - How to specify the order in which a rich:extendedDataTable selection and h:selectOneMenu value are applied -

i'm working on application that's customised database administration tool. the page structure following: <a4j:region> <h:selectonemenu value='#{bean.selectedtable}'> ... <a4j:ajax event='change' render='tablepanel'/> </h:selectonemenu> <a4j:outputpanel id='tablepanel'> <rich:extendeddatatable id='table' selection='#{bean.selectedrows}' ...> <f:facet name='header'> [datascroller etc.] <a4j:commandbutton action='#{bean.deleteselectedrows}' execute='@region' render='tablepanel'/> </f:facet> [columns] </rich:extendeddatatable> </a4j:outputpanel> <a4j:region> the selectonemenu used choose database table displayed. backing bean request scoped , set pick first available table default when it's initialised. i'm using extendeddatatable subclass paginate data in ...

.net - Watin CaptureWebPageToFile() generates black image -

i have console application running on application server uses watin automate ie navigation. when use makenewieinstancevisible = false property, images created black. if make ie visible, creates images fine, need have ie suppressed doesn't pop when people using server. anyone know of way capture screenshots without having ie window visible? is running on server 2008 instance or windows 7? can run executable administrator? when run program executes .capturewebpagetofile() lower permissions image comes out black.

css - Unwanted vertical HTML text - premature shrink wrap effect -

Image
i've encountered on drupal websites, may have either zen or garland theme default css. however, life of me cannot determine why continues happen, @ random. the best way explain view image here. happens regardless of word-wrap , white-space css settings, , @ random. it's 1 element, it's (here has happened between 'our brand' , 'submit' in menu). the image attached inline <ul> links inside each <li> . any insight appreciated! here sample of styling menu shown in screenshot: <style type="text/css"> #navbar { float: left; height: 32px; overflow: hidden; margin-left: 0px; margin-right: -100%; padding: 0px; width: 100%; } #navbar ul { margin: 0px; padding: 0px; text-align: left; } ul.links li { display: inline; list-style-type: none; padding: 0px 0.5em; } #navbar li { float: left; padding: 0px 20px 0px 0px; } #primary { text-decoration: none !important; white-space: pre !important; } </style> ha...

c++ - Why can't I set my QDialog to have no sizeGrip? -

according qt4 docs qdialog's sizegrip disabled default, mine has 1 anyways. try running setsizegripenabled(false) , still have one. so, else must causing this, don't know what. if matters dialog box has no parent because i'm designing/testing it. don't see why should matter, mentioning in case reason. here's full code: #include "qtgui" //#include "clposter.h" void add_new_account() { // check::make sure process destroyed when it's supposed // todo::connect signals slots // // create dialog box add user account qdialog *accountdialog = new qdialog(); accountdialog->setmodal(true); accountdialog->setwindowtitle("add new account"); accountdialog->setsizegripenabled(false); // create main layout qvboxlayout *mainvbox = new qvboxlayout(accountdialog); qlabel *accountnamelabel = new qlabel(accountdialog); accountnamelabel->settext("account:"); qlineedit *ac...

html - Check whether a class exists in any row of a table in JavaScript -

i have table (simplified question): <table><br> <tr onclick="selectrow"><br> <td>table data</td><br> <td>table data</td><br> <td>table data</td><br> </tr><br> <tr class="selected" onclick="selectrow"><br> <td>table data</td><br> <td>table data</td><br> <td>table data</td><br> </tr><br> </table> class="selected" result of clicking on row. want make button when clicked, return true if there row class 'selected', , false if there not. any appreciated. thanks. function checkexist(){ var mytr = document.getelementsbytagname('tr'); for(var i=mytr.length; i--;){ if(mytr[i].classname.match('(^|\\s+)selected(\\s+|$)')){ alert('true');//return true; ...

asp.net - ReportViewer - Subreport processing impersonation context -

i have reportviewer report sub report. running locally report works fine, when deploy server sql access denied error local user on remote machine. eg access denied servername\servername$ i have feeling due me firing sql command data required sub report , when deployed on server report viewer firing command , becuase of connection strings using integrated security (for security reasons) not got correct impersonation context. my database access class in different assembly reporting assembly, both of these assemblies referenced web application it seems report viewer calling sub report processing event when needs data sub report. web application impersonates user when runs sub report processing event not use specified user. instead perhaps local system account instead, , connection strings using integrated security local system account not have access database on server. anyone else have problem? here code report page /// <summary> /// page load /// ...