convert

Converting string to tuple and adding to tuple

I have a config file like this. [rects] rect1=(2,2,10,10) rect2=(12,8,2,10) I need to loop through the values and convert them to tuples. I then need to make a tuple of the tuples like ((2,2,10,10), (12,8,2,10)) ...

Use PHP to truncate the age of a MySQL entry to the nearest unit of time

I have a table with a datetime field, and I want to pull that time stamp and use PHP to convert it to the nearest largest unit of time. For example, if the entry was made 2 minutes and 36 seconds ago, I want to echo 2 minutes in PHP. If it was 3 hours and 5 minutes ago, I want it to say 3 hours. If it was 6 days and 4 hours and 40 minute...

Direction angle or pointing a 3D angle to a position in space.

Hello. I'm trying to point an entity to a 3D vector. (basically setting an entities angle so it points to a position in 3D space). At the moment, I'm stuck with getting an angle from a vector. //Vectors in the bracket are 3D, first is the entity position, second is a position in space where I want to point at. ( myEntity.Pos - posToPoi...

Parsing JSON to Java POJO's using GSON

I have a very straight forward issue here. I need to take JSON coming from the API and convert it to objects I created for them. This far, it will deserialize them into my List but each Metric object has null values JSON COMING IN { "metrics": [ { "metric": { "type": 1, "name": "slide-11-start", ...

Cannot implicitly convert type 'System.Data.Linq.ISingleResult<CustomeProcedureName> to 'int'

Sorry for this simple question . I have a Stored Procedure that return an int value , I'm trying to call this sp from my asp.net linq to sql project . int currentRating = db.sproc_GetAverageByPageId(pageId); But i get this error : Cannot implicitly convert type `'System.Data.Linq.ISingleResult<PsychoDataLayer.sproc_GetAverageByPag...

C - Convert GIF to JPG

Hi all! I need to convert a GIF image to Jpeg image using C programming language. I searched the web, but I didn't find an example which could help me. Any suggestion are appreciated! EDIT: I want to do this using an cross-platform open-source library like SDL. ...

Convert Images with PHP without using ImageMagick

I need to convert a .JPG, .JPEG, .JPE, .GIF, etc to a .PNG from my PHP webpage without using ImageMagick. Any ideas? Here is the code I found and am trying to work with: <?php header("content-type: image/png"); $original_filename = $_HTTP_POST_FILES['uploaded_file']; imagepng($original_filename,'border/testconvert.png',9); ?> ...

Convert .BMP to .PNG with PHP

I needed to be able to convert different image formats to the .PNG format. With the help of some others, I was able to make that happen. The only issue is, I also need to be able to convert .BMP files to .PNG without the use of ImageMagick. Here is the code I used for the conversion of other files: <?php $filename = "myfolder/test.jpg...

How to convert a DropDownList Value in INT Variable

Hi, I have a DropDownList with a list of value. I need in my code USE the value selected by the User in the DropDownList AS INT DataType (numeric). At the moment I am using this code below (CONVERTING DATATYOES). Script work just fine. But I would like to know if exists an alternative way to do it. I am pretty new in ASP.NET any ide...

Convert File to HEX String Python

How would I convert a file to a HEX string using Python? I have searched all over Google for this, but can't seem to find anything useful. ...

Convert 2D array of integers to bitmap in Java

I have a 2D array of integers in Java. I want to take this and output a bitmap image file where the red value of each pixel is the corresponding value in the array (blue and green values are 0). Does anyone know how to do this? Thanks. ...

Convert dictionary to list collection in C#

I have problem when trying to convert dictionary to list. Example if I have dictionary with template string as key and string as value. Then i wish to convert dictionary key to list collection as string. Dictionary<string, string> dicNumber = new Dictionary<string, string>(); List<string> listNumber = new List<string>(); dicNumber.Add...

How can I convert SQLite 2 to SQLite3 using Python on Windows?

I'm trying to convert a SQLite 2 file to SQLite3 using Python on Windows. On Linux, I'd just pipe a dump from sqlite to sqlite3: os.system("sqlite db.sqlite .dump | sqlite3 db3.sqlite") On Windows, I have no such convenient means of transferring the dump. Here's what I'm doing: sqlite_dump = os.popen('sqlite %s .dump' % sqlite_db)....

How to convert keycode to character using javascript

How to convert keycode to character using javascript var key_code = 65; result should be character = "a"; ...

How to convert phpBB board to static archive page?

Hello! I used to run a phpBB forum for our class in school but we have now graduated and the forum isn't used anymore. I want to remove the phpBB installation but there is a lot written in the forum that is fun to read now and then. I wonder if there is an easy way to convert the phpBB forum to some kind of static archive page that any...

How to convert a video to .swf?

How to convert any kind of videos into .swf format automatically? So if the user uploads a video in a format from the example inputs how should I convert it automatically into sfw format? Example Inputs: .avi, .ivf, .div, .divx, .mpg, .mpeg, .mpe, .mp4, .m4v, .wmv, .asf, .mov, .qt, .ts, .mts, .m2t, .m2ts, .mod, .tod, .3gp2, .3gpp, .3...

Java - Class to represent weight and measures

Hey, Is there an existing Java library to represent common weights and measures? I would like something which allows you to create objects which represent weight and distances in different units and let you compare them. It wouldn't be too hard to implement myself, but in this case I don't want to re-invent the wheel, since this wheel i...

Bulk sharpen a directory of images with ImageMagick

How can I point imagemagick to a directory of images and use the adaptive sharpen tool to increase the sharpness of all the files in the folder? Thank you. ...

Loading an image from resource and converting to bitmap in memory

I've searched around using google but I'm completely confused on how to load an image (PNG in my case) from resource and then converting it to a bitmap in memory for use in my splash screen. I've read about GDI+ and libpng but I don't really know how to do what I want. Could anyone help? ...

Is there a way to turn this JavaScript code into Objective-C?

http://static.reclaimprivacy.org/javascripts/privacyscanner.js Or at least to understand the code as it is very difficult to read? ...