conversion

Why/When to use (!!p) instead of (p != NULL)

In the following code, what is the benefit of using (!!p) instead of (p != NULL)? AClass *p = getInstanceOfAClass(); if( !!p ) // do something else // do something without having valid pointer ...

Convert RFC 1123 date to timestamp in PHP

What is the easiest or most elegant way to convert a RFC 1123 date (From an HTTP-Expiration-header) to a UNIX timestamp? Example: Sun, 14 Aug 2005 16:13:03 GMT Do I really have to 'substr' everything? ...

converting binary to decimal in ocaml

How could I convert binary to decimal in ocaml in the following, If I am representing binary numbers like the following 01 is [False; True] which equals 2? I want to write a method to return the double of the number in decimal form. For example in this case the method will take in [False; True] and return [False; False, True] which is 4...

converting binary to decimal and decimal to binary in ocaml

How could I convert binary to decimal and decimal to binary in the following, If I am representing binary numbers like the following 01 is [False; True] which equals 2? I want to write a method to take in [False; True] and return 2. Also a method for doing it the other way around taking in an integer 2 and returning [False; True]. ...

Is there any way to easily convert Ruby code to PHP?

Hi, We need to develop a functionality for one of our client's website. However, we actually have that code ready in Ruby. Is there any way to directly convert that ruby code to PHP? ...

How can I extract the first paragraph of a PDF document using Perl's CAM::PDF?

How can I extract the first paragraph of a PDF document using Perl's CAM::PDF? ...

C# Money numeric value to written value.

I am receiving data which I am basically recreating the image of a check for filing purposes. I have the monetary amount of the check coming in, but I need to create the written out value. i.e $2400.22 >> Two Thousand Four Hundred Dollars and Twenty Two Cents Was wondering if any one out there knows of a pre-packaged class or something...

CONTEXT_INFO() and CONVERT

In an attempt to build example code for this question, I ran into a problem with CONTEXT_INFO(). What I'm doing is converting an int to varbinary(128) so I can pass that to SET CONTEXT_INFO. I can convert the varbinary back to int before I do the SET, but after I SET and then GET, the CONVERT always returns zero even though the varbinar...

mySQL to postgreSQL

We are trying to switch our application from talking to mySQL to postgres. I wished we would have some kind of a subroutine (in VB6) were I can input the mySQl SQL query and get a string out containing the appropriate postgres query. Does anybody have a solution or is interested working with us on that? Thank you! Thomas ...

How to migrate project from RCS to git? (SOLVED)

I have a 20-year-old project that I would like to migrate from RCS to git, without losing the history. All web pages suggest that the One True Path is through CVS. But after an hour of Googling and trying different scripts, I have yet to find anything that successfully converts my RCS project tree to CVS. I'm hoping the good people at...

Using KeyValuePair in VB.NET for a reverse lookup capable dictionary (example hint in C# needs converting)

Hi, I'm currently on a VB.NET project and wish to use a KeyValuePair to facilitate a reverse lookup. I've found a great example in C# here: http://www.dreamincode.net/forums/showtopic78080.htm, however I am having a small problem converting to VB.NET (both manually and using a translator (online carlosag)). For example the syntax I woul...

How do I use an enum parameter in struts 2?

I'm trying to get an Action in Struts 2 to work with an Enum as an input parameter. What I've done so far looks like: public TestAction { public enum Module { VALUE1; } private Module module; public void setModule(Module module) { this.module = module; } public Module getModule() { return module; } } But wh...

Making a superclass object become a sublcass object in PHP5

<?php class A{ //many properties protected $myProperty1; protected $myProperty2; protected $myProperty3; public function __construct(){ $this->myProperty1='some value'; $this->myProperty2='some value'; $this->myProperty3='some value'; } public function getProperty1(){ re...

Java Double to String conversion without formatting

I have the number 654987. Its an ID in a database. I want to convert it to a string. The regular Double.ToString(value) makes it into scientific form, 6.54987E5. Something I dont want. Other formatting functions Ive found checks the current locale and adds appropriate thousand separators and such. Since its an ID, I cant accept any for...

Convert two-digit year to four-digit year in Ruby

I have strings like "84", "03" etc. that I want to convert to Date objects, but Date.new only takes the expanded 4-digit year as a parameter. I know it's simple to do, but I don't want to reinvent this wheel. Is there something that does this already? Either in standard Ruby or in ActiveSupport. ...

PowerBuilder GUI to web application - best options?

Does anyone have any opinions on the best options for converting a PB GUI application that I sell to users to be a web app? (The web app would be run on my servers, not the clients' servers.) It seems there are a number of options. One is to use PB 11's ability to retarget an app as an ASP.NET WebForms app, but I really don't understand...

Copy data from an SQL Server 2005 database to Access 2007 database with a different schema in C#

I have data in an SQL Server 2005 database which I need to copy to an Access 2007 database. It is a database conversion tool. Essentially each table corresponds to a table of a different name and within each table each column needs to be mapped to a corresponding column in the Access 2007 database. Just wondering what is the easiest way...

Converting a unix time to a human readable format

I'm building my own unix time to human readable conversion, and I'm stuck. I can extract the year just fine, but the day is proving too tricky. /* Converts a 32-bit number of seconds after 01-01-1970 to a _SYSTEMTIME structure */ static _SYSTEMTIME Convert(unsigned long a_UnixTime) { newtime.wMilliseconds = 0; newtime.wYear = (un...

Converting Byte recieved from the registry to String

Hello, I'm in the process of creating an application which will monitor specific registry key values for changes and write those changes to a text file. At present I can monitor the changes and know when specific values have changed and collect the data held in those values. The problem I'm having at the moment is the return type of the...

built-in Java classes/methods to convert between binary, decimal, and octal?

hi, i know of several general formulas for converting between binary, decimal, and octal, but i was wondering if java has any built-in methods or classes that convert between the three. for instance, in the Integer class, there are static methods such as toBinaryString, toOctalString, etc which allow for decimal conversion, but i haven't...