Search Results

Search found 3192 results on 128 pages for 'implicit conversion'.

Page 18/128 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • Problem with Informix JDBC, MONEY and decimal separator in string literals

    - by Michal Niklas
    I have problem with JDBC application that uses MONEY data type. When I insert into MONEY column: insert into _money_test (amt) values ('123.45') I got exception: Character to numeric conversion error The same SQL works from native Windows application using ODBC driver. I live in Poland and have Polish locale and in my country comma separates decimal part of number, so I tried: insert into _money_test (amt) values ('123,45') And it worked. I checked that in PreparedStatement I must use dot separator: 123.45. And of course I can use: insert into _money_test (amt) values (123.45) But some code is "general", it imports data from csv file and it was safe to put number into string literal. How to force JDBC to use DBMONEY (or simply dot) in literals? My workstation is WinXP. I have ODBC and JDBC Informix client in version 3.50 TC5/JC5. I have set DBMONEY to just dot: DBMONEY=. EDIT: Test code in Jython: import sys import traceback from java.sql import DriverManager from java.lang import Class Class.forName("com.informix.jdbc.IfxDriver") QUERY = "insert into _money_test (amt) values ('123.45')" def test_money(driver, db_url, usr, passwd): try: print("\n\n%s\n--------------" % (driver)) db = DriverManager.getConnection(db_url, usr, passwd) c = db.createStatement() c.execute("delete from _money_test") c.execute(QUERY) rs = c.executeQuery("select amt from _money_test") while (rs.next()): print('[%s]' % (rs.getString(1))) rs.close() c.close() db.close() except: print("there were errors!") s = traceback.format_exc() sys.stderr.write("%s\n" % (s)) print(QUERY) test_money("com.informix.jdbc.IfxDriver", 'jdbc:informix-sqli://169.0.1.225:9088/test:informixserver=ol_225;DB_LOCALE=pl_PL.CP1250;CLIENT_LOCALE=pl_PL.CP1250;charSet=CP1250', 'informix', 'passwd') test_money("sun.jdbc.odbc.JdbcOdbcDriver", 'jdbc:odbc:test', 'informix', 'passwd') Results when I run money literal with dot and comma: C:\db_examples>jython ifx_jdbc_money.py insert into _money_test (amt) values ('123,45') com.informix.jdbc.IfxDriver -------------- [123.45] sun.jdbc.odbc.JdbcOdbcDriver -------------- there were errors! Traceback (most recent call last): File "ifx_jdbc_money.py", line 16, in test_money c.execute(QUERY) SQLException: java.sql.SQLException: [Informix][Informix ODBC Driver][Informix]Character to numeric conversion error C:\db_examples>jython ifx_jdbc_money.py insert into _money_test (amt) values ('123.45') com.informix.jdbc.IfxDriver -------------- there were errors! Traceback (most recent call last): File "ifx_jdbc_money.py", line 16, in test_money c.execute(QUERY) SQLException: java.sql.SQLException: Character to numeric conversion error sun.jdbc.odbc.JdbcOdbcDriver -------------- [123.45]

    Read the article

  • Java conditional operator ?: result type

    - by Wangnick
    I'm a bit puzzled about the conditional operator. Consider the following two lines: Float f1 = false? 1.0f: null; Float f2 = false? 1.0f: false? 1.0f: null; Why does f1 become null and the second statement throws a NullPointerException? Langspec-3.0 para 15.25 sais: Otherwise, the second and third operands are of types S1 and S2 respectively. Let T1 be the type that results from applying boxing conversion to S1, and let T2 be the type that results from applying boxing conversion to S2. The type of the conditional expression is the result of applying capture conversion (§5.1.10) to lub(T1, T2) (§15.12.2.7). So for false?1.0f:null T1 is Float and T2 is the null type. But what is the result of lub(T1,T2)? This para 15.12.2.7 is just a bit too much ... BTW, I'm using 1.6.0_18 on Windows. PS: I know that Float f2 = false? (Float) 1.0f: false? (Float) 1.0f: null; doesn't throw NPE.

    Read the article

  • Converting string to a simple type

    - by zespri
    .Net framework contains a great class named Convert that allows conversion between simple types, DateTime type and String type. Also the class support conversion of the types implementing IConvertible interface. The class has been implemented in the very first version of .Net framework. There were a few things in the first .Net framework that were not done quite right. For example .Parse methods on simple types would throw an exception if the string couldn't be parsed and there would be no way to check if exception is going to be thrown in advance. A future version of .Net Framework removed this deficiency by introducing the TryParse method that resolved this problem. The Convert class dates back to time of the old Parse method, so the ChangeType method on this class in implemented old style - if conversion can't be performed an exception is thrown. Take a look at the following code: public static T ConvertString<T>(string s, T @default) { try { return (T)Convert.ChangeType(s, typeof(T), CultureInfo.InvariantCulture); } catch (Exception) { return @default; } } This code basically does what I want. However I would pretty much like to avoid the ugly try/catch here. I'm sure, that similar to TryParse, there is a modern method of rewriting this code without the catch-all. Could you suggest one?

    Read the article

  • Converting Future Composer FC14 tracker music to MIDI data

    - by okw
    I have an old .FC music file from the Amiga/C64 days. It was made using Future Composer. The first four bytes of the file read as FC14 in ASCII; I'm pretty sure that's the version number. I need to dump the channels and their notes into a standard MIDI file in order to play it through my MIDI devices. Is there a way to do this with existing programs? If not, are there any specifications available on the format of these files? I do not require the samples, and I am aware that they will be lost during the conversion process.

    Read the article

  • In SSIS Convert European Currency Format to United States Currency Format

    - by Rob
    I have an interesting problem. I have an SSIS package that processes account data. We are now processing files from Europe. These files are in a CSV format using text qualifiers. For an example of the problem: In the United States the currency format is 123456.99 (We purposely leave the thousands separator out). The files sent from Europe are coming in with two formats. One is 123456,99 and the other is 123.456,00. SSIS is attempting to parse the text file and place it into a NUMERIC(20,2) field. This causes a parsing error in SSIS even with the text qualifiers. If I change the field to CURRENCY it sends a conversion error. I would like for SSIS to deal with this directly without requiring the data to be in the United States format. Has anyone had this problem? Any help will be greatly appreciated. Rob

    Read the article

  • How to convert series of MP3 to a M4B in a batch

    - by Artem Tikhomirov
    Hello. I have a batch of MP3 based books. Some of them divide into files according to book's own structure: chapters and so on. Some of them was just divided into equally lengthened parts. So. I've bought an iPhone, and I want to convert them all to M4B format. How could I convert them in a batch? I mean how cold I set up a process once, for each book, and then, after couple of weeks, receive totally converted library. The only able program for such conversion I've found was Audiobook Builder for a Mac. But it is pretty slow and do not support batching in principle. Solutions for any platform, please.

    Read the article

  • .vob to h.264 MP4 Files - Worth The Effort?

    - by harper89
    When I was doing the converting to digital format a while back I chose .VOB due to no quality loss. However recently I have been informed of this h.264 compression method. Time is not an issue here, I don't mind waiting for conversions etc. I also understand that any sort of compression will reduce quality. To test I converted a 4GB .VOB to a .mp4 using h264 in handbrake and the quality loss was very very very hard to notice. From what I have understood through research Space = .mp4(h.264) Quality = .Vob Playback = Both equally supported? But these concerns have yet to be answered: My comparison was done on a computer monitor, would the quality loss be substantially noticable if I purchased a 50 inch TV in the future? Is this type of file highly supported? (I don't want to experience incompatible players) What other issues could a conversion of files such as this cause in the future?

    Read the article

  • How to convert series of MP3 to a M4B in a batch

    - by Artem Tikhomirov
    I have a batch of MP3 based books. Some of them divide into files according to book's own structure: chapters and so on. Some of them was just divided into equally lengthened parts. So. I've bought an iPhone, and I want to convert them all to M4B format. How could I convert them in a batch? I mean how cold I set up a process once, for each book, and then, after couple of weeks, receive totally converted library. The only able program for such conversion I've found was Audiobook Builder for a Mac. But it is pretty slow and do not support batching in principle. Solutions for any platform, please.

    Read the article

  • How do I convert an animated GIF to a YouTube friendly video format?

    - by Dave Webb
    My son has made some animations with Pivot Stickfigure Animator which we'd like to upload to YouTube. The problem is Pivot saves as animated GIFs which I can't upload to YouTube. The Wikipedia article recommends using Windows Movie Maker to convert GIF to WMV, but unfortunatley I'm using Window 7 for which you can get the new Windows Live Movie Maker which doesn't seem to support GIFs. I Googled and found an article which said to use Beneton Movie GIF to convert animated GIF to AVI, but this seemed to rely on a 3rd Party application which wasn't installed and so failed. Installing the missing application - pjBmp2Avi - by hand and adding it to the path still didn't allow Beneton to do the conversion. I hoped FFmpeg might do the trick but this only outputs to animated GIFs, it won't read from then. Further Googling found lots of applications with 30 day trials and so on but I was hoping for something free. So any suggestions on how I can convert an animated GIF to a movie file on Windows using free (as in beer) software?

    Read the article

  • How do I convert an animated GIF to a YouTube friendly video format?

    - by Dave Webb
    My son has made some animations with Pivot Stickfigure Animator which we'd like to upload to YouTube. The problem is Pivot saves as animated GIFs which I can't upload to YouTube. The Wikipedia article recommends using Windows Movie Maker to convert GIF to WMV, but unfortunately I'm using Windows 7 for which you can get the new Windows Live Movie Maker which doesn't seem to support GIFs. I Googled and found an article which said to use Beneton Movie GIF to convert animated GIF to AVI, but this seemed to rely on a 3rd Party application which wasn't installed and so failed. Installing the missing application - pjBmp2Avi - by hand and adding it to the path still didn't allow Beneton to do the conversion. I hoped FFmpeg might do the trick but this only outputs to animated GIFs, it won't read from then. Further Googling found lots of applications with 30 day trials and so on but I was hoping for something free. So any suggestions on how I can convert an animated GIF to a movie file on Windows using free (as in beer) software?

    Read the article

  • Video converters don't work anymore after reinstalling Windows

    - by tassiekev
    A few days ago, I decided to reinstall Windows 7 as my HD partition seemed to be nearly full and things were slowing down. I'd been using Handbrake almost exclusively to convert TV recordings and used Freemake on occasion. Following the reinstall, I can't get either to work: Handbrake says it's encoding for about 2 seconds and then says it's finished, but there are no converted files of any size. Freemake just says 'Conversion Error' and won't go any further. As an experiment I tried two programs that I don't normally use, VideoReDo & Any Video Converter. Both worked fine. Anyone got any clues?

    Read the article

  • PDF to HTML - batch converter - most reliable and accurate free AND paid for software?

    - by Rob
    I'm look for either a free or paid-for (about 50$/40pounds) BATCH PDF to HTML converter to convert several PDF files at once. Needs to be able to handle vectored and bitmap images within the file, outputting both as jpegs referenced by the html pages. I've tried iorigsoft paid-for PDF to HTML - problems it seems to hang or just go idle, and the stuff it actually converts have broken links - the wrong name is used for constituent chapters as html. Also tried application from intrapdf.com but this crashes near the beginning of the conversion, consitently. Looked at opensource tools but they look equally flakey or use old PDF versions. Need it on Windows 7 32bit home. Thoughts?

    Read the article

  • text to image conversion with JSON response

    - by ruhit
    i have made an application to convert text into image and it working out fine,now i am using JSON for conversion,it also working but except only two fields.....why i dont know, my codes are given below...please help me , is there any better way? // img.html excoflare enter your text here: Font Size:          Color:               Font:                 Height:              Width:                                            img.php require_once 'JSON/JSON.php'; header('Content-type: application/json'); header ("Content-type: image/png"); $text =$_REQUEST['text']; $text=json_encode($text); $path="C:\wamp\www\image"; $height=$_REQUEST['height']; $width=$_REQUEST['width']; define("WIDTH", $width); json_encode(WIDTH); define("HEIGHT", $height); json_encode(HEIGHT); $img = imagecreate(WIDTH, HEIGHT); imagesavealpha($img, true); $trans_colour = imagecolorallocatealpha($img, 0, 0, 0, 127); imagefill($img, 0, 0, $trans_colour); $getcolor=$_REQUEST['color']; switch($getcolor) { case 'red': $red = imagecolorallocate($img, 223, 14, 91); $color=json_encode($red); break; case 'white': $white = imagecolorallocate($img, 255, 255, 255); $color=json_encode($white); break; case 'black': $black = imagecolorallocate($img, 0,0,0); $color=json_encode($black); break; case 'grey': $grey = imagecolorallocate($img, 128, 128, 128); $color=json_encode($grey); break; // default: // break; } //$background_color = imagecolorallocate ($img, 25, 25, 25); $font = $_REQUEST['font']; //$font=json_encode($font); $fontsize =$_REQUEST['size']; //$fontsize=json_encode($fontsize); imagettftext($img, $fontsize, 0, 20, 20, $color, $font, $text); //Create image imagepng($img); imagepng($img,"$path/img.png"); //destroy image ImageDestroy($img); //header ('Content-type: image/png'); ? Thanks in advance..

    Read the article

  • Any advantage to the script version of Google Adwords' conversion tracking code?

    - by ripper234
    Google Adword has an HTML snippet to track conversions: <script type="text/javascript"> /* <![CDATA[ */ var google_conversion_id = 12345; var google_conversion_language = "en"; var google_conversion_format = "3"; var google_conversion_color = "ffffff"; var google_conversion_label = "someopaqueid"; var google_conversion_value = 0; /* ]]> */ </script> <script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js"> </script> <noscript> <div style="display:inline;"> <img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/12345/?label=opaque&amp;guid=ON&amp;script=0"/> </div> </noscript> It is composed of two parts: For clients supporting javascript, an inline script that sets variables, plus loading a reporting script. For other clients, an image tag. As far as I can see, the image tag has some advantages: It works on all browsers. It is asynchronous. It's shorter to have only this version, compared to both this and the js version. Any reason not to drop the <noscript> tag and just use the image conversion snippet directly?

    Read the article

  • Python mistaking float for string

    - by wrongusername
    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 initialized: money = 0 bet = 0

    Read the article

  • How `is_base_of` works?

    - by Alexey Malistov
    Why the following code works? typedef char (&yes)[1]; typedef char (&no)[2]; template <typename B, typename D> struct Host { operator B*() const; operator D*(); }; template <typename B, typename D> struct is_base_of { template <typename T> static yes check(D*, T); static no check(B*, int); static const bool value = sizeof(check(Host<B,D>(), int())) == sizeof(yes); }; //Test sample class Base {}; class Derived : private Base {}; //Exspression is true. int test[is_base_of<Base,Derived>::value && !is_base_of<Derived,Base>::value]; Note that B is private base. Note that operator B*() is const. How does this work? Why this works? Why static yes check(D*, T); is better than static yes check(B*, int); ?

    Read the article

  • Double pointer const-correctness warnings in C

    - by Michael Koval
    You can obviously cast a pointer to non-const data to a a pointer of the same type to const data: int *x = NULL; int const *y = x; Adding additional const qualifiers to match the additional indirection should logically work the same way: int * *x = NULL; int *const *y = x; /* okay */ int const *const *z = y; /* warning */ Compiling this with GCC or Clang with the -Wall flag, however, results in the following warning: test.c:4:23: warning: initializing 'int const *const *' with an expression of type 'int *const *' discards qualifiers in nested pointer types int const *const *z = y; /* warning */ ^ ~ Why does adding an additional const qualifier "discard qualifiers in nested pointer types"?

    Read the article

  • var in C# - Why can't it be used as a member variable?

    - by David Neale
    Why is it not possible to have implicitly-typed variables at a class level within C# for when these variables are immediately assigned? ie: public class TheClass { private var aList = new List<string>(); } Is it just something that hasn't been implemented or is there a conceptual/technical reason for why it hasn't been done?

    Read the article

  • Why aren't operator conversions implicitly called for templated functions? (C++)

    - by John Gordon
    I have the following code: template <class T> struct pointer { operator pointer<const T>() const; }; void f(pointer<const float>); template <typename U> void tf(pointer<const float>); void g() { pointer<float> ptr; f(ptr); tf(ptr); } When I compile the code with gcc 4.3.3 I get a message (aaa.cc:17: error: no matching function for call to ‘tf(pointer<float>&)’) indicating that the compiler called 'operator pointer<const T>' for the non-templated function f(), but didn't for the templated function tf(). Why and is there any workaround short of overloading tf() with a const and non-const version? Thanks in advance for any help.

    Read the article

  • Why `is_base_of` works with private inheritance?

    - by Alexey Malistov
    Why the following code works? typedef char (&yes)[1]; typedef char (&no)[2]; template <typename B, typename D> struct Host { operator B*() const; operator D*(); }; template <typename B, typename D> struct is_base_of { template <typename T> static yes check(D*, T); static no check(B*, int); static const bool value = sizeof(check(Host<B,D>(), int())) == sizeof(yes); }; //Test sample class B {}; class D : private B {}; //Exspression is true. int test[is_base_of<B,D>::value && !is_base_of<D,B>::value]; Note that B is private base. Note that operator B*() is const. How does this work? Why this works? Why static yes check(D*, T); is better than static yes check(B*, int); ?

    Read the article

  • Is it guaranteed that new Integer(i) == i in Java?

    - by polygenelubricants
    Consider the following snippet: int i = 99999999; byte b = 99; short s = 9999; Integer ii = Integer.valueOf(9); // should be within cache System.out.println(new Integer(i) == i); // "true" System.out.println(new Integer(b) == b); // "true" System.out.println(new Integer(s) == s); // "true" System.out.println(new Integer(ii) == ii); // "false" It's obvious why the last line will ALWAYS prints "false": we're using == reference identity comparison, and a new object will NEVER be == to an already existing object. The question is about the first 3 lines: are those comparisons guaranteed to be on the primitive int, with the Integer auto-unboxed? Are there cases where the primitive would be auto-boxed instead, and reference identity comparisons are performed? (which would all then be false!)

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >