convert

Get decorated function object by string name

def log(func): def wraper(*a, **kw): return func(*a, **kw) return wraper @log def f(): print 'f' print locals()['f'] # - prints <function wraper at 0x00CBF3F0>. How do you get the real f object (not decorator wrap)? ...

How to convert a unicode string written in font A to font B?

Assuming all the required fonts are available on client's machine. Probably, you all could see following 'stackoverflow' word written in Indic Language script : 'स्टैकओवरफ्लो' . A quick lookup using Web Developers Tools tells that this word is written using 'Arial, Liberation Sans..' font family. Does that mean Arial font supports Indi...

Converting arrays into another format (PHP)

Hi.. i want to convert this array Array ( [2] => Array ( ) [4] => Array ( [12] => Array ( ) [13] => Array ( [16] => Array ( ) ) ) [5] => Array ...

Using Regex groups in bash

Greetings, I've got a directory with a list of pdfs in it: file1.pdf, file2.pdf, morestuff.pdf ... etc. I want to convert these pdfs to pngs, ie file1.png, file2.png, morestuff.png ... etc. The basic command is, convert from to, But I'm having trouble getting convert to rename to the same file name. The obvious 'I wish it work...

Convert mediawiki to LaTeX syntax

I need to convert mediawiki into LaTeX syntax. The formulas should stay the same, but I need to transform, for example = something = into \chapter{something}. Although this can be obtained with a bit of sed, things get a little dirty with the itemize environment, so I was wondering if a better solution can be produced. Anything that can...

How to convert VisualStudio project to Eclipse CDT

The question is already in the title. I have a Visual Studio project which builds a .dll. Now I need the same library for MacOS X and linux, so I would like to convert the VS project to Eclipse and compile it for both platforms. I will be very thankful for any tips, hints or guidance! ...

pros and cons of TryCatch versus TryParse

What are the pros and cons of using either of the following approaches to pulling out a double from an object? Beyond just personal preferences, issues I'm looking for feedback on include ease of debugging, performance, maintainability etc. public static double GetDouble(object input, double defaultVal) { try { return Co...

Convert a time to specified time zone using C#?

I'm working on an application in C# with .Net 3.5. I have time zone value of the User is stored in DB with this format (-05:00,1), where -5.00 represents EST time zone value and the 1 indicates that this time zone follows daylight saving (if 0 not a daylight saving zone). Now I want to convert any date time value into this timezone val...

Handle DBNull in C#

Is there a better/cleaner way to do this? int stockvalue = 0; if (!Convert.IsDBNull(reader["StockValue"])) stockvalue = (int)reader["StockValue"]; ...

Convert GUI C++ app to a console one

I have a GUI C++ application (Visual Studio 2008) that needs to be converted to a console one. I don't have any experience in C programming. Mostly I use .NET. Where do I start? ...

PHP system returns 4

Hello everybody, I want to convert a pdf file to an image with PHP, but i can't get the command worked. PHP returns a 4. I don't have any kind of idea what that can be. I am using the next code: $tmp = system("convert -version", $value); var_dump($value); Someone an idea? ...

How to use exe in SharePoint on itemAdded?

I have a need to convert any document gets uploaded to Image. I downloaded the exe (with all the dlls) on my local machine (dont have to install) export.exe sourcefile.doc destinationfile.gif >> this syntax works from my local dos prompt. How do I use the same syntax "export.exe exampledoc.doc exampledoc.gif" when an item is added to s...

how to make a variable change from the text "1m" into "1000000" in python

I have variables with values like 1.7m 1.8k and 1.2b how can I convert them to a real number value for example 1.7m = 1700000 1.8k = 1800 1.2b = 1200000000 ...

Convert Byte [] to PDF

Hello All, With help of this question C# 4.0: Convert pdf to byte[] and vice versa i was able to convert byte[] to PDF. Byte array length is 25990 approx. When i try to open the PDF it says file is corrupted. What could be the reason? I tried the BinaryWriter but it creates PDF of 0 KB. It's a response from a Web Service Sample Code ...

" addressof " VB6 to VB.NET

Hello, I´m having some problem to convert my VB6 project to VB.NET I don't understand how this "AddressOf" function should be in VB.NET My VB6 code: Declare Function MP4_ClientStart Lib "hikclient.dll" _ (pClientinfo As CLIENT_VIDEOINFO, ByVal abab As Long) As Long Public Sub ReadDataCallBack(ByVal nPort As Long, pPacketBuffer As B...

How do i convert String to Integer/Float in Haskell

data GroceryItem = CartItem ItemName Price Quantity | StockItem ItemName Price Quantity makeGroceryItem :: String -> Float -> Int -> GroceryItem makeGroceryItem name price quantity = CartItem name price quantity I want to create a GroceryItem when using a String or [String] createGroceryItem :: [String] -> GroceryItem createGrocery...

Convert SDP data from byte[] into Object?

I am currently sending and receiving SIP messages across a network. When I want to add SDP data to a SIP message I use the SessionDescription object in jrtp. This object is then added to the SIP message. But when I get a SIP message from the server its SDP is in a byte[] array. So I'm wondering is there anyway to convert the byte[] b...

Convert local time (10 digit number) to a readable datetime format

Hey all, I'm working with pbx for voip calls. One aspect of pbx is that you can choose to receive CDR packages. Those packages have 2 timestamps : "utc" and "local", but both seem to always be the same. Here's an example of a timestamp : "1268927156". At first sight, there seems to be no logic in it. So i tried converting it several w...

matlab write image into eps file

In MATLAB, how do you write a matrix into an image of eps format? It seems imwrite does not support eps? convert is not working on the Linux server I am using $ convert exploss_stumps.jpg exploss_stumps.eps convert: missing an image filename `exploss_stumps.eps' @ convert.c/ConvertImageCommand/2838 Any idea why? I tried gnovi...

C++ Stringstream int to string but returns null

Hi below is my function: string Employee::get_print(void) { string out_string; stringstream ss; ss << e_id << " " << type << endl; out_string = ss.str(); return out_string; } e_id and type are int and they contain values from the class Employee. But when I pass them into the stringstream they just clear the string wh...