convert

C#: How to convert long to ulong

Hello, If i try with BitConverter,it requires a byte array and i don't have that.I have a Int32 and i want to convert it to UInt32. In C++ there was no problem with that. ...

C# parse string "0" to integer

I have a new laptop at work and code that worked earlier in the week does not work today. The code that worked before is, simplified: while (dr.Read()) { int i = int.Parse(dr.GetString(1)) } Now it fails when the database value is 0. Sometimes, but not reliably, this will work instead: while (dr.Read()) { int i = Convert.To...

How to convert chm to pdf

I have two types of document: CHM and PDF, but I'd rather like it if they all were in PDF format. I am looking for some good way to change it. Has anyone good ideas? I'll appreciate it. Update: Thanks for eveyone who helped me. :) ...

How to cast a dword into a byte array in C#

Hello, As you already may know,I'm migrating into C# and some things in C++ look different. C++ code BYTE packetBuffer[32] = {0}; *(LPWORD)(packetBuffer + 0) = 0xC; *(LPWORD)(packetBuffer + 2) = 0x5000; *(LPDWORD)(packetBuffer + 6) = dwArgs[13]; *(LPDWORD)(packetBuffer + 10) = *(keyArray2 + 0); *(LPDWORD)(packetBuffer + 14) =...

Convert JavaScript links to standard links

Hey, I am working with HTML which has javascript links like below: <a href="javascript:openExternalLink(5542, true, 'http://www.websitedomain.com')"&gt;Links Text Here</a> I need to replace these with standard anchor tags like so: <a href="http://www.websitedomain.com"&gt;Links Text Here</a> What would be the best solution to achi...

Convert number to binary string

Is this the best way to convert a Python number to a hex string? number = 123456789 hex(number)[2:-1].decode('hex') Sometimes it doesn't work and complains about Odd-length string when you do 1234567890. Clarification: I am going from int to hex. Also, I need it to be escaped. IE: 1234567890 -> '\x49\x96\x02\xd2' not '499602D2' ...

How do you convert HTML entities to Unicode and vice versa in Python?

Duplicate: Convert XML/HTML Entities into Unicode String in Python How do you convert HTML entities to Unicode and vice versa in Python? ...

How do I format a number stored in a string?

If I have numbers as a text string without decimal places, how can I convert it to 2 decimal places such that 12345 is converted to 123.45? The string can be any length greater than 1. ...

Rounding corners of pictures with ImageMagick

Hi, in my Rails app I want to have a similar profile section like Facebook where uploaded images are automatically thumbnailed and corner-rounded. I'm using the convert utility to downsize images into thumbnails, but is there an option to round their corners too? Thanks. ...

Select and filter nvarchar like a int

I have a nvarchar column BigMacs in table McTable in my MS SQL 2005 database with alfanumeric and numeric values. For example: 132 432adfad sfs54543 5256 And now i would like to do something like this: select Convert(BigMacs, int) from McTable where IsNumerc(BigMacs) = 1 AND Convert(BigMacs, int) > 6 But when I do this i get a err...

Convert mht\pdf\excel and encoding

I am looking for a .net library that can help me do one of the following: 1. Convert an MHT file to PDF 2. Convert between pdf versions 3. Change a pdf file encoding 4. Convert an MHT to an Excel file 5. Convert a MIME version of excel (an Excel file that is readable via notepad) to a binary Excel file 6. Convert between Excel version ...

Is it possible to convert PowerPoint to images programatically?

I'm wondering if it is possible to convert a slideshow from PowerPoint (ppt/pptx) to a series of images (jpeg/png) (one for each slide)? Are there any libraries that do this out there (C#, C/C++, Ruby)? ...

How to convert a Java object (bean) to key-value pairs (and vice versa)?

Say I have a very simple java object that only has some getXXX and setXXX properties. This object is used only to handle values, basically a record or a type-safe (and performant) map. I often need to covert this object to key value pairs (either strings or type safe) or convert from key value pairs to this object. Other than reflecti...

convert sql to linq help please

select m.messageID,m.[addeddate],m.message,count(*) as Comments from intranet.dbo.Blog_Messages AS m inner join intranet.dbo.Blog_Comments AS c on c.messageid = m.messageid group by m.messageID,m.[addeddate],m.message need help converting this to linq to sql ...

How do I convert a document from Latex into Microsoft Word 2003?

I need to find a way to quickly convert a latex document into a Microsoft Word 2003 document. I'm using Kile to edit latex documents on Ubuntu at present. I can do it the following way: latex filename.tex tex4ht filename.tex mk4ht oolatex filename.tex then I have to open the resulting filename.odt document in OpenOffice and save as ...

How to convert a double* to an array<double>(6)

I have a function that returns a array of 6 doubles. double* Validation(); I would like to cast this return value in managed code. array<double>^ validationPosition = gcnew array<double>(6); validationPosition = Validation(); I get this error: error C2440: '=' : cannot convert from 'double *' to 'cli::array<Type> ^' How should ...

Integer representation for day of the week

I would like to convert a date object its integer representation for the day of week in C#. Right now, I am parsing a XML file in order to retrieve the date and storing that info in a string. It is in the following format: "2008-12-31T00:00:00.0000000+01:00" How can I take this and convert it into a number between 1 and 7 for the day o...

PHP library for converting HTML4 to XHTML?

I need to convert HTML4 input to valid XHTML (strict) in PHP5 for further processing (SAX for instance). Any suggestions? ...

DateTime Object Representing Day of Week

How can I convert a number between 1 and 7 into a DateTime object in C# which represents the day of the week? The numbers are coming from a XML file which I am parsing. I am retrieving each instance of a field containing a number between 1 and 7 which represents a day of the week between Sunday and Saturday. ...

How can I convert four characters into a 32-bit IEEE-754 float in Perl?

I have a project where a function receives four 8-bit characters and needs to convert the resulting 32-bit IEEE-754 float to a regular Perl number. Seems like there should be a faster way than the working code below, but I have not been able to figure out a simpler pack function that works. does not work - seems like it is close $floa...