convert

Convert int64_t to NSInteger

Hi all, How can i convert int64_t to NSInteger in Objective-C ? This method returns into score an int64_t* and I need to convert it to NSInteger: [OFHighScoreService getPreviousHighScoreLocal:score forLeaderboard:leaderboardId]; Thank you. ...

C++ read registry string value in char*

I'm reading a registry value like this: char mydata[2048]; DWORD dataLength = sizeof(mydata); DWORD dwType = REG_SZ; ..... open key, etc ReqQueryValueEx(hKey, keyName, 0, &dwType, (BYTE*)mydata, &dataLength); My problem is, that after this, mydata content looks like: [63, 00, 3A, 00, 5C, 00...], i.e. this looks like a unicode?!?!. I...

Is there any way to modify a column before it is ordered in MySQL?

I have a table with a field value which is a varchar(255). The contents of the field can be quite varied: $1.20 $2994 $56 + tax (This one can be ignored or truncated to $56 if necessary) I have a query constructed: SELECT value FROM unnamed_table ORDER BY value However, this of course uses ASCII string comparison to order the resu...

Python mistaking float for string

I receive TypeError: Can't convert 'float' object to str implicitly while using Gambler.pot += round(self.bet + self.money * 0.1) where pot, bet, and money are all doubles (or at least are supposed to be). I'm not sure if this is yet another Eclipse thing, but how do I get the line to compile? Code where bet and money are initiali...

Why Java SimpleDateFormat().parse() is printing weird formate?

My input is String formated as the following: 3/4/2010 10:40:01 AM 3/4/2010 10:38:31 AM My code is: DateFormat dateFormat = new SimpleDateFormat("dd/mm/yyyy hh:mm:ss aa"); try { Date today = dateFormat.parse(time); System.out.println("Date Time : " + today); } ...

convert a binary file in a list (python)

Hi all, I'd like to be able to open a binary file, and make a list (kind of array) with all the chars in, like : "\x21\x23\x22\x21\x22\x31" to ["\x21","\x23","\x22","\x21","\x22","\x31"] What would be the best solution to convert it ? Thanks ! ...

How can I convert one Perl hash to another using the keys?

I've just started diving in to the crazy world that is perl and have come across a problem that I cannot seem to wrap my head around. Specifically I need to be able to convert from one hash structure to another, that uses the keys/values as the new hashes keys/values. An example: Input hash: my %original_hash = ( first_key => ...

Including a model's virtual attributes when converting a record to JSON in Rails

Hello, I'm trying to convert an ActiveRecord model to JSON in Rails, and while the to_json method generally works, the model's virtual attributes are not included. Is there a way within Rails to list not just the attributes of a model, but also it's attr_accessor and attr_reader attributes in order that all readable attributes are avail...

Saving page as PDF or as HTML but with all entries

Hello every one :) I wont to create a pdf from a form on my page, but the Problem is, I need it excactly like the page with form, all entires. So I have for example 2 Input Fields, 7 Radio, 2 Checkboxes, and as result i need a PDF with the same sructure, but if someone check the checkbox, it must be saved in pdf. I have tryed to save...

Convert Delphi Real48 to C# double

Hey, I need to be able to convert from a Delphi Real48 to C# double. I've got the bytes I need to convert but am looking for an elegant solution. to the problem. Anybody out there had to do this before? I'm needing to do the conversion in C# Thanks in advance ...

iPhone Chinese simplified to traditional character conversion

Is there a way to convert Chinese simplified characters to traditional characters in Cocoa/Objective-C? On the .NET platform you can include a VB dll in your projects that gives you access to a function for an easy conversion. Is there anything I can use in Cocoa/Objective-C that will allow me to do the same? I want to go between simplif...

merge / convert multiple pdf files into one pdf

How could I merge / convert multiple pdf files into one large pdf file? I tried the following, but the content of the target file was not as expected: convert file1.pdf file2.pdf merged.pdf I need a very simple/basic cli solution. Best would be if I could pipe the output of the merge / convert straight into pdf2ps ( as originally att...

PHP: Convert curl_exec output to UTF8

I would like to only work with UTF8. The problem is I don't know the charset of every webpage. How can I detect it and convert to UTF8? <?php $url = "http://vkontakte.ru"; $ch = curl_init($url); $options = array( CURLOPT_RETURNTRANSFER => true, ); curl_setopt_array($ch, $options); $data = curl_exec($ch); // $data = magic($data); p...

InvalidCastException in DataGridView

(Using VS 2010 Beta 2 - .Net 4.0 B2 Rel) I have a class, MyTable, derived from BindingList where S is a struct. S is made up of several other structs, for example: public class MyTable<S>:BindingList<S> where S: struct { ... } public struct MyStruct { public MyReal r1; public MyReal r2; public MyReal R1 {get{...} set...

Convert From Custom List to List of String

Hi all I have the following code: Public Shared Function ConvertToString(ByVal list As IList) As String Dim strBuilder = New System.Text.StringBuilder() Dim item As Object For Each item In list strBuilder.Append(obj.ToString()) strBuilder.Append(",") Next Return strBuil...

Convert varchar to numeric in Informix

I have problem while converting varchar type to Int type in Informix. Actually I don't know if the value is really varchar or not which I want to convert to INT. It's a sandbox system. As Example: I am trying to run this kind of Select telnumber from numbers n where Cast(n.telnumber AS INT) between 1234 and 9999 I got this error:...

Java Preprocessor in C#

Say I want to create a sort of Pre-processor for existing java code, so I can get the language specific keywords and objects, and then create routines that convert them to their Csharp equivalents, using Csharp code - what route should this take? I'm thinking of Regular Expressions, but I'm fuzzed. I have a bunch of about a 100 .java fi...

formatting and converting in java

I have few small basic problems : How to format : int i = 456; to give output : ""00000456" ? I've tried %08d but it's not working. Next thing is a problem with conversion and then formatting. I have side and height of triangle, let's say int's 4,7, and 7 is the height. From formula for field we know that F=1/2(a*h). So how to get...

Convert binary information to regular data type without outside modules in python.

Hello World. I'm tasked with reading a poorly formatted binary file and taking in the variables. Although I need to do it in C++ (ROOT, specifically), I've decided to do it in python because python makes sense to me, but my plan is to get it working in python and then tackle re-writing in in C++, so using easy to use python modules won't...

Converting this code from ASP to PHP

I'll admit I'm a novice programmer and really the only experience I have is in classic ASP. I'm looking for a way to convert this asp code to PHP. For a customer who only has access to a linux box but also as a learning tool for me. Thanks in advance for the help: Recordset and Function: Function pd(n, totalDigits) if totalDi...