convert

What's the easiest way to convert a list of integers to a string of comma separated numbers in C#

I'm looking for the one liner here, starting with: int [] a = {1, 2, 3}; List<int> l = new List<int>(a); and ending up with String s = "1,2,3"; ...

linux shell output to html

is there any way to convert bash output to html ? for example if I had some colorized output in bash ( something like htop ), how can I convert it to html tags ... ( something like this: <p style="color: red">some text</p>) ...

how to convert decimal to binary in c++

hi , I have a method to convert dec to bin QList<bool> widgetInput::decToBin(int number) { int remainder; QList<bool> result; if(number <= 1) { result << number; return result; } remainder = number%2; decToBin(number >> 1); result << remainder; } but u...

How would this method be in C#? [From VisualBasic.Net]

Here's the snippet: Function Encode(ByVal dec As String) As String Dim bt() As Byte ReDim bt(dec.Length) bt = System.Text.Encoding.ASCII.GetBytes(dec) Dim enc As String enc = System.Convert.ToBase64String(bt) Return enc End Function I'm trying to make an program that sends a...

Convert.ToInt32 - Keep Preceding Zero

I have numbers stored in a database, and some have a zero as their first digit as they always need to be a certain amout of digits. I have a text box that has this number typed into it, so i do a Convert.ToInt32(TextBox.Text), which removes the starting zero if it has one. Does anyone have any ideas how i can keep the zero, or add it to ...

T-SQL to PL/SQL (IDENTITY)

I've got a T-SQL script, that converts field to IDENTITY (in a weird way). How do I convert it to PL/SQL? (and, probably, figure out, if there is a simpler way to do this - without creating a temporary table). The T-SQL script: -- alter table ts_changes add TS_THREADID VARCHAR(100) NULL; -- Change Field TS_ID TS_NOTIFICATIONEVENTS t...

c# - programmatically convert docx file to doc.

Hi, What options do I have to convert .docx documents to .doc document programmatically using C#? I'm looking to do this as cheaply as possible. Ideally I want to do this directly in code via libraries within the .net framework or via a well establish downloadable dll. The one constraint we have is that we can't install Office onto our ...

How to split the array keyword value separated by commas in PHP?

Hello! I have an array in $_POST: Array ( [tags] => Javascript,PHP,Java,C++,Python) How can i convert this Array into Array like this: Array ( [tag1] => Javascript [tag2] => PHP [tag3] => Java [tag4] => C++ [tag5] => Python) I guess i need to use regexp to remove the commas and do split in "foreach as".. But i'm so newbie in PHP....

Rewrite equation in c

Gain = 255 / (1 - 10 ^ ((Refblack-Refwhite) * 0.002/0.6) ^ (Dispgamma/1.7)) Is that a computer language, it looks like c but exclusive or floats doesnt compute. Can anybody convert that to c? thanks ...

Help in Converting Small Python Code to PHP

Hello, please i need some help in converting a python code to a php syntax the code is for generating an alphanumeric code using alpha encoding the code : def mkcpl(x): x = ord(x) set="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" for c in set: d = ord(c)^x if chr(d) in set: ...

C# Dynamic template implicit conversion error from System.EventHandler to System.EventHandler<TEventArgs>

Code: public void InstantiateIn(System.Web.UI.Control container) { PlaceHolder ph = new PlaceHolder(); SectionArgs e = new SectionArgs(); ph.DataBinding += new EventHandler<SectionArgs>(ItemTemplate_DataBinding); container.Controls.Add(ph); } static void ItemTemplate_DataBinding(object s...

Convert keyword in SQL Server 2005

Hi guys, I want to convert a DATETIME field (DateOfBirth)... When I execute the following query it says invalid syntax near convert SELECT e.Emp_Id,e.Emp_Name,e.Address,e.Department, (convert(varchar, e.Date_Of_Birth, 103) as Date_Of_Birth) from Employee as e But when I execute the below query it gives result but my dateofbirth colu...

Javascript function to convert date yyyy/mm/dd to dd/mm/yy

Hi all, I am trying to create a function on javascript to bring the date from my database in format (yyyy-mm-dd) and display it on the page as (dd/mm/yy). I would appreciate any help. Thanks. PD: Let me know if you need more clarification. ...

Flex AS3 Project Convert to CS4

Hi, Has anyone got experience in converting AS3 projects (no mxml) in Flex, to Flash CS4? Are there any resources out there as to what works in Flex Builder that doesn't work in Flash, and how to get the project running? I read somewhere that (for instance) certain Metadata tags don't work. If I've got all my code in the src folder,...

C# binary array to decimal ?

In SQL, the following works cast([comlum] as Decimal(18,4)) How can I do the same conversion (from the binary data) in C#? the data type of varbinary in SQL C# loading to byte[] so, I want to byte[] convert to decimal or double? Sql query: select cast([column_A] as decimal(18,4), [column_A] from table result: 191128.0000      0x120...

Best way to convert decimal or string to currency in C#?

Hello, I've been trying to find best way to convert decimal/string to currency depending on my choice. public static string returnWaluta(string varS, string varSymbol) { decimal varD = decimal.Parse(varS); if (varSymbol == "EUR") { Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR", false...

Ruby Convert String to File

Is it possible to convert a string to a file without writing it to disk? I would like to work ubiquitously with either a string of a file: input = "123" if (ARGV.length == 1) input = File.open(ARGV[0]) #do stuff with input Can I create a file from a string (without writing to disk)? Otherwise, I would not be able to do input.read...

How to convert 2010-03-01 to Unixtime

How can i convert 2010-03-01 to unixtime like 1267452738 ...

JSON to C# : convert an arraylist of doubles to an array of ints ?

I have an arraylist of doubles returned by a JSON library. After the JSON parser's decode method is run, we have this in the C# locals window: Name Value Type myObj Count=4 object {System.Collections.ArrayList} [0] 100.0 object {double} [1] 244.0 object {double} [2] 123.0 ...

How to get Color from Hex color code using .NET?

How can I get Color from a Hex color code(e.g. #FFDFD991)? I am reading a file and getting Hex color code, I need to create the corresponding System.Windows.Media.Color instance for the Hex color code. Is there any inbuilt method in framework to do this? ...