on-internet

Pipe output and capture exit status in Bash

I want to execute a long running command in Bash, and both capture its exit status, and tee its output. So I do this: command | tee out.txt ST=$? The problem is that the variable ST captures the exit status of tee and not of command. How can I solve this? Note that command is long running and redirecting the output to a file to view it later is not a good solution for me.

Join the discussion →

Arbitrary-precision arithmetic Explanation

I'm trying to learn C and have come across the inability to work with REALLY big numbers (i.e., 100 digits, 1000 digits, etc.). I am aware that there exist libraries to do this, but I want to attempt to implement it myself. I just want to know if anyone has or can provide a very detailed, dumbed down explanation of arbitrary-precision arithmetic.

Join the discussion →

Get Name of selected RadioButton in EXT-GWT RadioGroup

I have following code: final Radio trDelRadio = new Radio(); trDelRadio.setName("TDRADIO"); trDelRadio.setBoxLabel("Training"); final Radio cdcRadio = new Radio(); cdcRadio.setName("CDCRADIO"); cdcRadio.setBoxLabel("Content"); final Radio msRadio = new Radio(); msRadio.setName("MSRADIO"); msRadio.setBoxLabel("Management"); final Radio osRadio = new Radio(); osRadio.setName("OSRADIO"); osRadio.setBoxLabel("Outsourcing"); final RadioGroup radioGroup = new RadioGroup(); radioGroup.setOrientation(Orientation.VERTICAL); radioGroup.add(trDelRadio); radioGroup.add(cdcRadio); radioGroup.add(msRadio);

Join the discussion →

authenticate with ntlm (or kerberos) using java UrlConnection

I need to consume a rest web service with java, passing the credentials of a domain user account. right now I'm doing it with classic asp set xmlHttp = server.createObject( "msxml2.serverxmlhttp" ) xmlHttp.open method, url, false, domain & "\" & user, password xmlHttp.send body out = xmlHttp.responseText set xmlHttp = nothing and with asp.net HttpWebRequest request = (HttpWebRequest) WebRequest.Create( url ); request.Credentials = new NetworkCredential(user, password, domain); request.Method = WebRequestMethods.Http.Get HttpWebResponse response = (HttpWebResponse) request.GetResponse(); Stream

Join the discussion →

How to send data to local clipboard from a remote SSH session [closed]

Most Unix-like systems have a command that will let you pipe/redirect output to the local clipboard/pasteboard, and retrieve from same. On OS X, these commands are pbcopy, pbpaste Is there a way to replicate this functionality while SSHed into another server? That is, I'm using Computer A. I open a terminal window I SSH to Computer B I run a command on Computer B The output of Computer B is redirected or automatically copied to Computer A's clipboard. And yes, I know I could just (shudder) use my mouse to select the text from the command, but I've gotten so used to the workflow of pipping outp

Join the discussion →

x86 equivalent for LWARX and STWCX

I'm looking for an equivalent of LWARX and STWCX (as found on the PowerPC processors) or a way to implement similar functionality on the x86 platform. Also, where would be the best place to find out about such things (i.e. good articles/web sites/forums for lock/wait-free programing). Edit I think I might need to give more details as it is being assumed that I'm just looking for a CAS (compare and swap) operation. What I'm trying to do is implement a lock-free reference counting system with smart pointers that can be accessed and changed by multiple threads. I basically need a way to implement

Join the discussion →

"Correct" way to mark up testimonials in HTML

I thought this would be an easy enough thing to find online but it seems not. I'm trying to find out what would be considered the correct way to mark up a list of testimonials - quotes with authors - on a page. e.g. "This is what I think" - My Name, My Company I'd imagine the quote should go in a blockquote. I've also seen some use of cite to shown where a quote comes from but the HTML reference seems to show that this should be used to give the URL of a web page that the quote comes from, not the name of the person. Does anyone have any suggestions for how this should be marked up?

Join the discussion →

GPL and LGPL open source licensing restrictions [closed]

I am having trouble understanding the usage permissions of open source. I read somewhere that GPL or LGPL enforces that software that uses GPL software must also be released open-source. I want to create an application that uses some open-source image recognition library. Can I sell this application or does it have to be open source?

Join the discussion →

How can I echo HTML in PHP?

I want to conditionally output HTML to generate a page, so what's the easiest way to echo multiline snippets of HTML in PHP 4+? Would I need to use a template framework like Smarty? echo '<html>', "\n"; // I'm sure there's a better way! echo '<head>', "\n"; echo '</head>', "\n"; echo '<body>', "\n"; echo '</body>', "\n"; echo '</html>', "\n";

Join the discussion →

What Skill set should a low level programmer possess?

I am an embedded SW Engineer, with less than 3 yrs of experience. I aim to "sharpen the saw" continuously. I was wondering if there was anything specific to low level programming that C/C++ coders should be proficient with. What comes to my mind is familiarity with the hardware's architecture and instruction set. Knowing how to fiddle with bits is also important, resource management and performance have been part of my job, is there anything else? EDIT: I work with an in-house customized RTOS, not embedded Linux.

Join the discussion →

cross platform settings directory

I am making a jython application that needs a config/settings file (and probably eventually directory) but I want it be stored in the expected/correct directory for each os. ~/.app_name/config in linux c:/documents and Settings/User/app_name ?? in windows. I have found this: http://snipplr.com/view/7354/home-directory-crossos/ but this is for python and I have feeling that this might not necessary work for jython/windows and I don't have any dev stuff set up in my windows VM to test at this moment If someone could provide any insight into the "best practices" (for jython) for achieving this I

Join the discussion →

How do I create tab indenting in html

I have a situation as follows <body> Test<br /> test<br /> test1<br /> </body> I need to add a tab after the 2nd test and 3rd test so that it looks similar to this. Test test test1 Is there a special HTML entity or special character for TAB. eg. Non-breaking space == & nbsp ; thanks

Join the discussion →

Difference between type(obj) and obj.__class__

What is the difference between type(obj) and obj.__class__? Is there ever a possibility of type(obj) is not obj.__class__? I want to write a function that works generically on the supplied objects, using a default value of 1 in the same type as another parameter. Which variation, #1 or #2 below, is going to do the right thing? def f(a, b=None): if b is None: b = type(a)(1) # #1 b = a.__class__(1) # #2

Join the discussion →

RadGrid export to excel

I have a radgrid that generates columns dynamically based on user input. Once the grid is populated, the user has the option to export to excel or word. However when the user want's to retain the page formatting, no data is getting exported. But if the user then selects to ignore paging, everything works fine. So it seems that if the radgrid property "AutoGenerateColumns" is set to false, and "IgnorePaging" is also false, data isn't getting exported. Anyone else have this problem or am I over looking something? Here are the methods that configure and call the export: private void ConfigureRepo

Join the discussion →

Which Cipher Suites to enable for SSL Socket?

I'm using Java's SSLSocket to secure communications between a client and a server program. The server program also serves up HTTPS requests from web browsers. According to "Beginning Cryptography with Java", page 371, you should always call setEnabledCipherSuites on your SSLSocket / SSLServerSocket to ensure that the cipher suite that ends up being negotiated is sufficiently strong for your purposes. That being said, a call to my SSLSocketFactory's getDefaultCipherSuites method yields some 180 options. These options range from TLS_RSA_WITH_AES_256_CBC_SHA (which I think is fairly secure) to SS

Join the discussion →

Near-duplicate image detection [closed]

What's a fast way to sort a given set of images by their similarity to each other? At the moment, I have a system that does histogram analysis between two images, but this is a very expensive operation and seems too overkill. Optimally, I am looking for a algorithm that would give each image a score (for example, a integer score, such as the RGB average), and I can just sort by that score. Identical scores or scores next to each other are possible duplicates. 0299393 0599483 0499994 <- possible dupe 0499999 <- possible dupe 1002039 4995994 6004994 RGB average per image sucks. Is there somethin

Join the discussion →

Get first key in a (possibly) associative array?

What's the best way to determine the first key in a possibly associative array? My first thought it to just foreach the array and then immediately breaking it, like this: foreach ($an_array as $key => $val) break; Thus having $key contain the first key, but this seems inefficient. Does anyone have a better solution?

Join the discussion →

Unable to create SSL Socket Factory for client

I am using Java 1.5.0_16 (JBoss-4.2.3.GA application). My application implements a WS client which needs to integrate with an external Web Service. This communication needs to be handled through https.I am getting following error when i trying to call remote Api via web services.can anybosy help me out what could be the cause 14:25:17,609 WARN [HTTPClientInvoker] Unable to create SSL Socket Factory for client invoker: Error initializing socket factory SSL context: Can not find truststore url. 14:25:18,203 INFO [STDOUT] ERROR: 14:25:18,203 ERROR [STDERR] javax.xml.ws.WebServiceException: java.i

Join the discussion →
Older stories