Search Results

Search found 15210 results on 609 pages for 'technical writing'.

Page 215/609 | < Previous Page | 211 212 213 214 215 216 217 218 219 220 221 222  | Next Page >

  • Concise way to getattr() and use it if not None in Python

    - by MTsoul
    I am finding myself doing the following a bit too often: attr = getattr(obj, 'attr', None) if attr is not None: attr() # Do something, either attr(), or func(attr), or whatever else: # Do something else Is there a more pythonic way of writing that? Is this better? (At least not in performance, IMO.) try: obj.attr() # or whatever except AttributeError: # Do something else

    Read the article

  • How do I check if my program has data piped into it.

    - by monkeyking
    Im writing a program that should read input via stdin, so I have the following contruct. FILE *fp=stdin; But this just hangs if the user hasn't piped anything into the program, how can I check if the user is actually piping data into my program like gunzip -c file.gz |./a.out #should work ./a.out #should exit program with nice msg. thanks

    Read the article

  • How efficient is PHP's substr?

    - by zildjohn01
    I'm writing a parser in PHP which must be able to handle large in-memory strings, so this is a somewhat important issue. (ie, please don't "premature optimize" flame me, please) How does the substr function work? Does it make a second copy of the string data in memory, or does it reference the original? Should I worry about calling, for example, $str = substr($str, 1); in a loop?

    Read the article

  • Ruby / rubyzip alternative capable of handling rar/tar/zip/7z?

    - by Nick Gorbikoff
    I was wondering if anyone knows of rubyzip alternatives for Ruby, that can handle various formats in particular zip / rar / 7z? I know of libarchive, but it's not complete for my purposes ( it's a good gem thou). (To clarify, libarchive - won't work for me - cause I need to be able to run in on Windows. ( Yeah I know sucks to be me)) Right now I end up running system commands to the os, but I'd like something OS independent, and capable of handling those formats - reading and writing. Thank you

    Read the article

  • java generated excel sorting color mess.

    - by afzal
    I am using jxl api for generating a excel sheet, in which the alternate rows are highlighted, when I sort the contents of a excel and sort manually, the cell background colors messup, usually this is because I am writing the color cell by cell, is there anyway through which i color the alternate rows of the excel while generating it, in such a way that it doesnt effect the sorting of the contents.

    Read the article

  • Graphical designer for asp.net controls.

    - by truthseeker
    Hi, I'm searching a graphical designer, better than visual studio designer for asp.net typical and ajax controls. Visual studio designer (VS 2010 B2) very often don't handle with html code and shows nothing. Is there any better tool for writing code behind and design graphically controls for asp.net web sites?

    Read the article

  • Detecting client disconnect in tomcat servlet?

    - by Seth
    How can I detect that the client side of a tomcat servlet request has disconnected? I've read that I should do a response.getOutputStream().print(), then a response.getOutputStream().flush() and catch an IOException, but is there a way I can detect this without writing any data?

    Read the article

  • JMF. Create new custom streamdatasource

    - by Afro Genius
    Hi there. I am looking to create a means of building a DataSource object (and hence a Processor) that gets data from a stream instead of a file, RTP, and so on. I am writing a module for a much larger application that is meant to transparently transcode audio data. Going through the JMF docs only specify how to create a source from file however I need to be able to create a source from a stream within my application. Any idea where I can start looking?

    Read the article

  • request parameter using jquery/javascript

    - by Bunny Rabbit
    is it possible to stop the submission of a form,after submit button has been clicked and get the action attribute and the request parameters of the submission using javascript(preferably jQuery) ? I want to get the action and the parameter so that the it can be submitted to an alternate location ,what i am tryin to do is try writing a proxy website.

    Read the article

  • OCCI createEnvironment Blocks My Thread

    - by sahs
    Hello, I'm writing a multi-threaded application, where there is a main thread which distributes tasks to the worker threads. According to the task, a worker thread creates a connection, by using a global occi environment. When a worker thread completes its task, it closes the connection (I'm sure, there is no exception thrown while termination). My problem is that after a while(sometimes 5 mins, sometimes 5 hours) the threads cannot get connection from the environment, and they get blocked there. What can be the problem?

    Read the article

  • Help with django filters

    - by Cato Johnston
    In a django template, I want to get an value from the first object in a list's field. I have the following code {{ list.object|first.field }} But it results in an error. Is there a way to achieve this without writing a loop or doing it in the view?

    Read the article

  • mysql db image convert to file

    - by ntan
    Hi i am writing a converter from Oracle to mysql In Oracle the images are stored in db. I want to read the content of the image and save to file system I suppose that i have to read the blob entry and using php file commands create the file (am i right) What about image type. Should i save as jpg (what if the store image is not jpg) Any suggestion are welcome

    Read the article

  • How do i program a simple IRC bot in python?

    - by Jake
    Hi every one. I need help writing a basic IRC bot that just connects to a channel.. is anyone able to explain me this? I have managed to get it to connect to the IRC server but i am unable to join a channel and log on. The code i have thus far is: import sockethost = 'irc.freenode.org' port = 6667 join_sock = socket.socket() join_sock.connect((host, port)) <code here> Any help would be greatly appreciated.

    Read the article

  • Software Architecture: Unit of Work design pattern discussion

    - by santiagobasulto
    Hey everybody. According Martin Fowler's Unit of Work description: "Maintains a list of objects that are affected by a business transaction and coordinates the writing out of changes and resolution of concurrency problems." Avoiding very small calls to the database, which ends up being very slow I'm wondering. If we just delimit it to database transaction management, won't prepare statements help with this?

    Read the article

  • Sending STDERR to logger

    - by Gnutt
    Im writing a bash-script to perform an offsite backup, using rsync over SSH. I'm able to send STDOUT to logger, for logs via rsync --del -az -e 'ssh -i mycrt.crt' /home/gnutt/backup/ me@offisite:backup | logger -i But I want to send STDERR instead, so if there is a problem, such as that offsite is unavailable, that output should be sent to logger and logged.

    Read the article

  • intercepting feed:// in safari5

    - by edwink
    Hello. I am writing an extension for Safari5 and I am trying to intercept the fact that the user is clicking on an RSS icon and loading a feed://.... URL to offer him/her subscription options. I have tried to register a start content script for the feed:/// whitelist pattern but that does not work. Does anyone know how to make this work?

    Read the article

  • HttpPost request unsuccessful

    - by The Thom
    I have written a web service and am now writing a tester to perform integration testing from the outside. I am writing my tester using apache httpclient 4.3. Based on the code here: http://hc.apache.org/httpcomponents-client-4.3.x/quickstart.html and here: http://hc.apache.org/httpcomponents-client-4.3.x/tutorial/html/fundamentals.html#d5e186 I have written the following code. Map<String, String> parms = new HashMap<>(); parms.put(AirController.KEY_VALUE, json); postUrl(SERVLET, parms); ... protected String postUrl(String servletName, Map<String, String> parms) throws AirException{ String url = rootUrl + servletName; HttpPost post = new HttpPost(url); List<NameValuePair> nvps = new ArrayList<NameValuePair>(); for(Map.Entry<String, String> entry:parms.entrySet()){ BasicNameValuePair parm = new BasicNameValuePair(entry.getKey(), entry.getValue()); nvps.add(parm); } try { post.setEntity(new UrlEncodedFormEntity(nvps)); } catch (UnsupportedEncodingException use) { String msg = "Invalid parameters:" + parms; throw new AirException(msg, use); } CloseableHttpResponse response; try { response = httpclient.execute(post); } catch (IOException ioe) { throw new AirException(ioe); } String result; if(HttpStatus.SC_OK == response.getStatusLine().getStatusCode()){ result = processResponse(response); } else{ String msg = MessageFormat.format("Invalid status code {0} received from query {1}.", new Object[]{response.getStatusLine().getStatusCode(), url}); throw new AirException(msg); } return result; } This code successfully reaches my servlet. In my servlet, I have (using Spring's AbstractController): protected ModelAndView post(HttpServletRequest request, HttpServletResponse response) { String json = String.valueOf(request.getParameter(KEY_VALUE)); if(json.equals("null")){ log.info("Received null value."); response.setStatus(406); return null; } And this code always falls into the null parameter code and returns a 406. I'm sure I'm missing something simple, but can't see what it is.

    Read the article

  • MutiHomed computers and rmi?

    - by ipkiss
    Hello, I am writing a program using rmi to connect server and clients together and got the following issue: My rmi server support both ethernet and wifi mode rmi clients can connect to the server either vi ethernet or wifi depending. That because s*ome clients can only run via ethernet* and some can only run via wifi. My question is: how can I make my rmi server connect to all clients in such situation? Thanks.

    Read the article

  • Svn auto updater

    - by uzay95
    I am writing my code in my virtual machine and always committing the folder that contains published web site to the free svn server. There is also another remote machine which is test server. I would like to make auto update in the remote machine. Is there any program can make auto update in every 30 seconds?

    Read the article

< Previous Page | 211 212 213 214 215 216 217 218 219 220 221 222  | Next Page >