convert

converting csv string to a string with spaces instead of commas in php

I'm having a string which is comma seperated like this $str = "john, alice, mary,joy"; Some are having space after comma and some don't. What I want to do is remove all the commas and make them like this: $str = "john alic mary joy"; What is the best way to do this in php? ...

When to use a Cast or Convert

I am curious to know what the difference is between a cast to say an int compared to using Convert.toInt32(). Is there some sort of performance gain with using one? Also which situations should each be used for. Currently I'm more inclined to use Convert but I don't have a reason to go either way. In my mind I see them both accomplishin...

Convert vBulletin to Drupal but maintain friendly urls for SEO?

I'm fed up with VB and looking to convert a big vBulletin board to Drupal. But I don't want to lose the links of the friendly urls and risk having everything re-indexed by Google. How can I maintain those urls? The site and huge has been around since 2002. I don't want to be penalised by Google. ...

How do you convert posted "english" characters from international PC's in ASP.NET? (ex 2205)

I have a WebForm search page that gets occasional hits from international visitors. When they enter in text, it appears to be plain ASCII a-z, 0-9 but they are printed in bold and my "is this text" logic can't handle the input. Is there any easy way in ASP.NET to convert unicode characters that equate to A-Z, 0-9 into plain old text? Th...

What's the easiest way to convert Int32's bytes to String?

Dim intChunkId As Integer = &H4D546864 Dim strCunnkId As String = "MThd" Dim easiestWay = GetString(intChunkId) ...

Converting GIF's, PNG's and JPG's to .ICO files using Imagemagick!

From: JPG, To: ICO; /usr/bin/convert -resize x16 -gravity center -crop 16x16+0+0 /chris/images/sites /favicons/temp/1278346974.jpg -transparent white -colors 256 /chris/images/sites /favicons/custom/favicon.ico (Added line breaks for readability --Pekka) This is the output for the command line. From: GIF's, PNG To: ICO; /usr/bin/c...

Flex/Actionscript - capturing canvas bitmap with dynamically placed elements.

I'm attempting to find overlap between elements on a flex canvas, an adaptation of http://www.gskinner.com/blog/archives/2005/08/flash_8_shape_b.html The attempt here is to place some text and figure overlap with previously placed text. The simple example below illustrates the problem. Both ImageSnapshot.captureBitmapData(canvas); o...

Convert .csv to .xls in Java.

Hey everyone, Does anyone here know of any quick, clean way to convert csv files to xls or xlsx files in java? I have something to manage csv files already in place and I need the extra compatibility for other programs. Sample code in addition to package names is always well appreciated. Many thanks, Justian Here's my code thus fa...

[iPhone app] Storing a timestamp value and showing it to the UI

Hello, in my application I get, using JSON, a timestamp value like this : 1278321016000 for 2010-07-05 11:10:16.0 CEST 1278436867000 for 2010-07-06 19:21:07.0 CEST I'm currently storing this value to long type, but I wonder if it is the right way, have I to search thing with NSTimeInterval ? What would be, after storing this value,...

Convert a string, char type to System.Windows.Forms.Keys

I'm trying to get a char converted to System.windows.Form.Keys type or a string to a Keys array. Does anyone know how to do it in a simple way? ...

Convert Float to Integer Equivalent

I want to convert a floating point user input into its integer equivalent. I could do this by accepting an input string, say "-1.234" and then I could just explicitly convert each character to it's decimal representation. (big endian by the way). So I would just say for the example I gave, -1.234 = 1|01111111|00111011111001110110110 ...

ImageMagik/UNIX: How to recursively process a nested directory of photos?

Question: How do I recursively process, using Imagemagik (convert), a nested directory of photos? I have the following directory structure: / ..2008/ ....a.jpg ....b.jpg ..2009/ .....c.jpg And I want to run the following ImageMagik command on each file, to clean/resize up the images, and then save the resulting image out as the exact...

Linux images to video, double digit problem

i have a list of images which im trying to convert to a video. the images are the following: t2.jpg t3.jpg t4.jpg I can convert those three images into a video with: ffmpeg -r 5 -i t%d.jpg -y -an video.avi but if i turn the names to t20.jpg,t30.jpg and t40.jpg, it doesn't work anymore. and changing %d to %02d doesn't make any differen...

CommandConverter - Valid exception or .NET Bug

I'm getting an exception in my C#/.NET application that reads: 'CommandCoverter' is unable to convert 'MyNamespace.MyDerivedFromICommandSubclass' to 'System.String'. What I'm doing is fairly straight forward, as described by the MSDN ICommand documentation: public class MyDerivedFromICommandSubclass : ICommand { // Implement int...

Converting an object to a hash of values in Ruby

i have searched around, but can't find any built-in way to do convert an object (of my own creation) to a hash of values, so must needs look elsewhere. my thought was to use .instance_variables, strip the '@' from the front of each variable, and then use the attr_accessor for each to create the hash. what do you guys think? is that th...

How to convert a unicode string to its unicode escapes?

Say I have a text "Բարև Hello Здравствуй". (I save this code in QString, but if you know other way to store this text in c++ code, you'r welcome.) How can I convert this text to Unicode escapes like this "\u1330\u1377\u1408\u1415 Hello \u1047\u1076\u1088\u1072\u1074\u1089\u1090\u1074\u1091\u1081" (see here)? ...

Char Encoding: Changing file from MacRoman to UTF-8 breaks string

I am working on a CakePHP site saved in MacRoman char encoding. I want to change all the files to UTF-8 for internationalisation. For all the other files in the site this works fine. However, in the core.php file there is a security salt, which is a string with special characters ("!:* etc.). When I save this file as UTF-8 the salt g...

How to Convert string (culture != "en-US") to int C# 2005

C# 2005, I have set the culture like below in Program.cs: CultureInfo myCulture = new CultureInfo("bn-IN");// like "en-US", "ja-JP" etc... Thread.CurrentThread.CurrentCulture = myCulture; Thread.CurrentThread.CurrentUICulture = myCulture; Application.CurrentCulture = myCulture; Then after opening the application I choose my keyboard, ...

Converting video to HTML5 ogg / ogv and mpg4

Hi Does anyone know about any software that can convert video (avi, flv, whatever) to HTML5 supported ogg/ogv and mpeg4 formats? I tried a few but I couldn't find anything that actually works. ...

C++ program converts fahrenheit to celsius

Can someone help me understand why this gives an output of 0? #include <iostream> using namespace std; int main() { float celsius; float fahrenheit; cout << "Enter Celsius temperature: "; cin >> celsius; fahrenh...