Search Results

Search found 2509 results on 101 pages for 'converting'.

Page 52/101 | < Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >

  • efficiently convert string (or tuple) to ctypes array

    - by Mu Mind
    I've got code that takes a PIL image and converts it to a ctypes array to pass out to a C function: w_px, h_px = img.size pixels = struct.unpack('%dI'%(w_px*h_px), img.convert('RGBA').tostring()) pixels_array = (ctypes.c_int * len(pixels))(*pixels) But I'm dealing with big images, and unpacking that many items into function arguments seems to be noticeably slow. What's the simplest thing I can do to get a reasonable speedup? I'm only converting to a tuple as an intermediate step, so if it's unnecessary, all the better.

    Read the article

  • Where did the name `atoi` come from?

    - by Earlz
    Ok I've been curious about this for a while. In the C language where did they come up with the name atoi for converting a string to an integer? The only thing I can think of is Array To Integer for an acronym but that doesn't really make sense.

    Read the article

  • scala implicit or explicit conversion from iterator to iterable

    - by landon9720
    Does Scala provide a built-in class, utility, syntax, or other mechanism for converting (by wrapping) an Iterator with an Iterable? For example, I have an Iterator[Foo] and I need an Iterable[Foo], so currently I am: val foo1: Iterator[Foo] = .... val foo2: Iterable[Foo] = new Iterable[Foo] { def elements = foo1 } This seems ugly and unnecessary. What's a better way?

    Read the article

  • mysql: inserting data and autoincrement

    - by every_answer_gets_a_point
    i am converting from access to mysql i have a table in access where one of the columns is an autonumber when i transfer the data into the mysql database (where i also have a column that is auto_increment), should i be transfering the auto_increment data into the auto_increment column, or will it auto_increment itself? how do i ensure that if i do not transfer the autoincrement data from access, that it auto_increments properly?

    Read the article

  • XCode: Function argument indentation

    - by user343317
    I was unable to find any solution of my specific issue. I'm using Xcode 3.2. I'd like to indent the next line of function argument just one step in from the previous line: somevariable = pow( a, b); However, Xcode's syntax-aware indenting insists on converting the above into: somevariable = pow( a, b); Where the arguments are aligned with opening parenthesis of the function. How can I make indenting be configured to match my preference?

    Read the article

  • Hoe to convert a JSON array of paths to images stored on a server into a javaScript array to display them? Using AJAX

    - by MichaelF
    I need for html file/ ajax code to take the JSON message and store the PATHS as a javaScript array. Then my buildImage function can display the first image in the array. I'm new to AJAX and believe my misunderstanding lies within the converting of the JSON to Javascript. I'm confused also about if my code creates a JSON array or object or either. I might need also to download a library to my app to understand JSON? Below is a PHP file loading the paths of the images. I believe json ecode is converting the PHP Array in a Json message. <?php include("mysqlconnect.php"); $select_query = "SELECT `ImagesPath` FROM `offerstbl` ORDER by `ImagesId` DESC"; $sql = mysql_query($select_query) or die(mysql_error()); $data = array(); while($row = mysql_fetch_array($sql,MYSQL_BOTH)){ $data[] = $row['ImagesPath']; } echo $images = json_encode($data); ?> Below is the script in is going to be loaded on an Cordova app. <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="css/styles.css"> <link rel="stylesheet" href="css/cascading.css"> <script> function importJson(str) { // console.log(typeof xmlhttp.responseText); if (str=="") { document.getElementById("content").innerHTML=""; return; } if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { //var images = JSON.parse(xmlhttp.responseText); document.getElementById("content").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","http://server/content.php"); xmlhttp.send(); } function buildImage(src) { var img = document.createElement('img') img.src = src alert("1"); document.getElementById('content').appendChild(img); } for (var i = 0; i < images.length; i++) { buildImage(images[i]); } </script> </head> <body onload= "importJson();"> <div class="contents" id="content" ></div> <img src="img/logo.png" height="10px" width="10px" onload= "buildImage();"> </body>

    Read the article

  • Counting comma seperated values in php,how to?

    - by Jay
    Hey folks, I have a variable holding values separated by a comma (Implode), I'm trying to get the total count of the values in that variable however, count() is just returning 1. I've tried converting the comma separated values to a properly formatted array which still spits out1. So heres the quick snippet where the sarray session equals to value1,value2,value3: $schools = $_SESSION['sarray']; $result = count($schools); Any help would be appreciated.

    Read the article

  • Security concerns for a multi-lingual web application.

    - by The Rook
    I am converting a PHP MySQL web application written for English language into a Multi-Language site. Do you know any vulnerabilities that affect web applications in another language? Or perhaps vulnerabilities that could be introduced in the conversion of code base to support multiple languages. (If you know any vulnerabilities of this type in another programming language I'll give you a +1)

    Read the article

  • editing swf files in flash

    - by user297627
    after converting my website file from swf to .fla format with the sothink decompiler many of the frames are missing that have text and images in them when i open the converted file in flash cs4..i am using flash and editing website files for the first time a descriptive answer would be appreciated.

    Read the article

  • Monad in plain English? (For the OOP programmer with no FP background)

    - by fig-gnuton
    In terms that an OOP programmer would understand (without any functional programming background), what is a monad? What problem does it solve and what are the most common places it's used? EDIT: To clarify the kind of understanding I was looking for, let's say you were converting an FP application that had monads into an OOP application. What would you do to port the responsibilities of the monads into the OOP app?

    Read the article

  • Is there a better way to format this date string

    - by Mark Breen
    Hello is there are better way to structure this line of code, as you can see, I am changing the format of a string that contains a date. lblCourseStartDate.Text = String.Format("{0:D}", DateTime.Parse(CourseStartDate)); I just found it untidy that I am converting twice or three times to get the format I want. Thanks

    Read the article

  • Under what conditions will you get unresolved external symbol for __declspec(dllimport)?

    - by Mark
    I am converting an application to use .dlls and I'm riddled with linker errors stating unersolved external symbol"__declspec(dllimport) public: void __thiscall Rail::SetNextrail(class Rail *)" There is more gibberish at the end of this error message. Why should this happen and how do you fix it? __declspec(dllimport) is being placed with a macro defined as: #ifdef LUDOAI_EXPORT #define DECLSPECAI __declspec(dllexport) #else #define DECLSPECAI __declspec(dllimport) #endif

    Read the article

  • Generating Anaglyphs (3D images)

    - by Rich Bradshaw
    I'm planning to make some simple 3d shapes into anaglyphs that will be in 3d when viewed with 3d glasses (red cyan). there's lots of info for converting pictures into 3d, but none for spinning 3d shapes. Has anyone got any experience/ideas in how to do this?

    Read the article

  • strict string to int[long]

    - by baskin
    Do we have a standard way of converting a char* to int (or long) in a strict way, i.e. we should get proper result only if all characters are digits and can fit in an int (or long) -- some way by using strtol etc.. ? Thus "sbc45", "4590k", " 56", "56 ", should be all invalid using that function.

    Read the article

  • Java Script JQUery

    - by windi
    Hi I am extracting data from an xml file converting it into json and rendering the images which i am retriving to the html file via jtemplate.now i want to user scroller and scroll the images .i can call to the scroller plugin but it is not scrolling throuhg . can any one help me please.

    Read the article

  • Convert in-memory pdf to byte[]

    - by daft
    I'm writing a websercive in C# that will generate pdf-files and send back to the caller as a byte[]. The pdf file is generated using a third party component, but I'm struggling with the conversion. The pdf is just an in-memory object in the web service, and I can't find any good way of converting the generated pdf to a byte[] before returning it to the caller. Any advice on this?

    Read the article

  • SQL 2008 CASE statement aggravation...

    - by Brad
    Why does this fail: DECLARE @DATE VARCHAR(50) = 'dasf' SELECT CASE WHEN ISDATE(@DATE) = 1 THEN CONVERT(date,@DATE) ELSE @DATE END Msg 241, Level 16, State 1, Line 2 Conversion failed when converting date and/or time from character string. Why is it trying to convert dasf to date when it clearly causes ISDATE(@DATE) = 1 to evaluate to false... If I do: SELECT ISDATE(@DATE) The return value is 0.

    Read the article

  • Deserialize JSON, sometimes value is an array, sometimes "" (blank string).

    - by karl.r
    I am trying to deserialize a field: "presenters":[{...},{...}] but some of the rows come back with only: "presenters":"" When the serializer gets to the row with that empty string I get: Error converting value "" to type 'System.Collections.Generic.List`1[DataPrototype.Model.Presenter]'. Am I right in thinking that I need a JsonConverter that will change the empty string into an empty List?

    Read the article

< Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >