Search Results

Search found 2655 results on 107 pages for 'conversion'.

Page 20/107 | < Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >

  • Date conversion in Java

    - by llm
    How can I take a string in a format such as: 2008-06-02 00:00:00.0 and convert it to: 02-Jun-2008? Can I somehow take the original string, convert it to a Date object, then use a formatter to get the final output (rather than parsing the string myself)? Thanks!

    Read the article

  • Conversion failed when converting the varchar value xxx to data type int error

    - by zurna
    I need to take data between certain dates. But I get the following error. AdsDateStarted : 03/18/2010 01:51:38.000 AM AdsDateENded : 09/13/2010 05:00:00.000 PM formatdate function converts today's date to 3/22/2010 format. SQL = "SELECT * FROM Ads" SQL = SQL & " WHERE AdsActive = 1 AND AdsAreasID = "& rtt &" AND CONVERT(VARCHAR(10), AdsDateStarted, 101) <= "& formatdate(Date()) &" AND CONVERT(VARCHAR(10), AdsDateEnded, 101) >= "& formatdate(Date()) &"" Set kdFonksiyon = objConn.Execute(SQL)

    Read the article

  • automatic xml conversion in scala

    - by Jeff Bowman
    Let's say I have the following class: class Person(val firstName:String, val lastName:String) Is there an automatic way to generate xml from this class without having to hand create a toXml() method? Ideally the output would be something like: <Person <firstNameJohn</firstName <lastNameSmith</lastName </Person It seems like there should be a way to do this without having to write all that out manually. Perhaps there is a trait I haven't found yet?

    Read the article

  • Scala Map conversion

    - by Benjamin Metz
    I'm a Scala newbie I'm afraid: I'm trying to convert a Map to a new Map based on some simple logic: val postVals = Map("test" - "testing1", "test2" - "testing2", "test3" - "testing3") I want to test for value "testing1" and change the value (while creating a new Map) def modMap(postVals: Map[String, String]): Map[String, String] = { postVals foreach {case(k, v) => if(v=="testing1") postVals.update(k, "new value")} }

    Read the article

  • A more effecient millisecond conversion method?

    - by cube
    I am currently using this method to convert milliseconds to min:sec:1/10sec. However it does not seem to be efficient at all. Would anyone know of a faster more efficient and optimized way of accomplishing the same. mills.prototype.formatTime = function(time) { var elapsedTime = (time * 1000); //Minutes var elapsedM = (elapsedTime/60000)|0; var remaining = elapsedTime - (elapsedM * 60000); //add a leading zero if it's a single digit number if (elapsedM < 10) { elapsedM = "0"+elapsedM; } //Seconds var elapsedS = ((remaining/1000)|0); remaining -= (elapsedS*1000); ////add leading zero if (elapsedS<10) { elapsedS = "0"+elapsedS; } //Hundredths var elapsedFractions = ((remaining/10)|0); if (elapsedFractions < 10) { elapsedFractions = "0"+elapsedFractions; } //display results nicely var time_data = elapsedM+":"+elapsedS+":"+elapsedFractions; //return time_data; return[time_data,elapsedM,elapsedS,elapsedFractions] };

    Read the article

  • csv to hash data structure conversion using perl

    - by Kavya S
    1. Convert a .csv file to perlhash data structure Format of a .csv file: sw,s1,s2,s3,s4 ver,v1,v2,v3,v4 msword,v2,v3,v1,v1 paint,v4,v2,v3,v3 outlook,v1,v1,v3,v2 my perl script: #!/usr/local/bin/perl use strict; use warnings; use Data::Dumper; my %hash; open my $fh, '<', 'some_file.csv' or die "Cannot open: $!"; while (my $line = <$fh>) { $line =~ s/,,/-/; chomp ($line); my @array = split /,/, $line; my $key = shift @array; $hash{$key} = $line; $hash{$key} = \@array; } print Dumper(\%hash); close $fh; perl hash i.e output should look like: $sw_ver_db = { s1 => { msword => {ver => v2}, paint => {ver => v4}, outlook => {ver => v1}, }, s2 => { msword => {ver => v3}, paint => {ver => v2}, outlook => {ver => v1}, }, s3 => { msword => {ver =>v1}, paint => {ver =>v3}, outlook => {ver =>v3}, }, s4 => { msword => {ver =>v1}, paint => {ver =>v3}, outlook => {ver =>v2}, }, };

    Read the article

  • Endianness conversion and g++ warnings

    - by SuperBloup
    I've got the following C++ code : template <int isBigEndian, typename val> struct EndiannessConv { inline static val fromLittleEndianToHost( val v ) { union { val outVal __attribute__ ((used)); uint8_t bytes[ sizeof( val ) ] __attribute__ ((used)); } ; outVal = v; std::reverse( &bytes[0], &bytes[ sizeof(val) ] ); return outVal; } inline static void convertArray( val v[], uint32_t size ) { // TODO : find a way to map the array for (uint32_t i = 0; i < size; i++) for (uint32_t i = 0; i < size; i++) v[i] = fromLittleEndianToHost( v[i] ); } }; Which work and has been tested (without the used attributes). When compiling I obtain the following errors from g++ (version 4.4.1) || g++ -Wall -Wextra -O3 -o t t.cc || t.cc: In static member function 'static val EndiannessConv<isBigEndian, val>::fromLittleEndianToHost(val)': t.cc|98| warning: 'used' attribute ignored t.cc|99| warning: 'used' attribute ignored || t.cc: In static member function 'static val EndiannessConv<isBigEndian, val>::fromLittleEndianToHost(val) [with int isBigEndian = 1, val = double]': t.cc|148| instantiated from here t.cc|100| warning: unused variable 'outVal' t.cc|100| warning: unused variable 'bytes' I've tried to use the following code : template <int size, typename valType> struct EndianInverser { /* should not compile */ }; template <typename valType> struct EndianInverser<4, valType> { static inline valType reverseEndianness( const valType &val ) { uint32_t castedVal = *reinterpret_cast<const uint32_t*>( &val ); castedVal = (castedVal & 0x000000FF << (3 * 8)) | (castedVal & 0x0000FF00 << (1 * 8)) | (castedVal & 0x00FF0000 >> (1 * 8)) | (castedVal & 0xFF000000 >> (3 * 8)); return *reinterpret_cast<valType*>( &castedVal ); } }; but it break when enabling optimizations due to the type punning. So, why does my used attribute got ignored? Is there a workaround to convert endianness (I rely on the enum to avoid type punning) in templates?

    Read the article

  • Conversion from C code to CudaC code I get unpredictable results

    - by Abhi
    include include include include define pi 3.14159265359 lo*lo*p-2*mu,freq=2.25*1e6,wavelength=(long double)lo/freq,dh=(long double)wavelength/ 30.0,dt=(long double)dh/(lo*1.5); (1000*dh)); (p*dh),lambdaplus2mudtbydh=(lambda+2*mu)*dt/dh,lambdadtbydh=lambda*dt/dh,dtmubydh=dt*mu/ dh; double**U,long double**V){ for(int k=0,l=0;k<=yno-1 && l<=yno;k++,l++){ U[i+1][l]+=dtbyrhodh*(X[i+1][l+1]-X[i+1][l]+Z[i+1][l]- Z[i][l]); [k+1]-Y[j][k+1]); } double**U,long double**V){ for(int k=0,l=0;k<=yno-1 && l<=yno;k++,l++){ U[i+1][k])+lambdadtbydh*(V[i+1][k+1]-V[i][k+1]); V[i][k+1])+lambdadtbydh*(U[i+1][k+1]-U[i+1][k]); U[j][l]); int main(){ clock_t start,end; long double time_taken; start=clock(); long double **X,**Y,**U,**V,**Z;int n=1; X=Make2DDoubleArray(xno+2,yno+2); Y=Make2DDoubleArray(xno+2,yno+2); Z=Make2DDoubleArray(xno+1,yno+1); U=Make2DDoubleArray(xno+2,yno+2); V=Make2DDoubleArray(xno+2,yno+2); for (n=1;n<=timesteps;n++){ } end=clock(); time_taken=(long double)(end-start)/CLOCKS_PER_SEC; printf("Time elapsed is %Lf\nGRID Size:%Lf*%Lf\nTime Steps Taken:%d\n",time_taken,(xno),floor(yno),n); return 0; }

    Read the article

  • 32bit to 64bit sql server 2008 database conversion

    - by Eric
    We are in the process of moving databases from older 32 bit hardware running sql 2005 to newer hardware with sql 2008 64 bit. My question is if the database is automatically converted to 64bit after it is reattached on the new server or if it is running in 32bit mode on a 64bit instance. Is there a way to tell?

    Read the article

  • easy hex/float conversion

    - by yeus
    I am doing some input/output between a c++ and a python program (only floating point values) python has a nice feature of converting floating point values to hex-numbers and back as you can see in this link: http://docs.python.org/library/stdtypes.html#additional-methods-on-float Is there an easy way in C++ to to something similar? and convert the python output back to C++ double/float? This way I would not have the problem of rounding errors when exchanging data between the two processes... thx for the answers!

    Read the article

  • Data table to Excel conversion leaves my server side button non responsive

    - by Nikhil Vaghela
    We have a web part on which we display some data in a grid. We are exporting grid's underlying datatable to Excel and displaying Open - Save - Cancel dialouge box on click of a server side button. Following is the code we are executing on click of server side button. this.Page.Response.Clear(); this.Page.Response.AppendHeader("Content-Disposition", "attachment; filename=MyTasks.xls"); this.Page.Response.ContentType = "application/ms-excel"; this.Page.Response.Write("...here goes my well formated html...."); this.Page.Response.End(); Problem is that when i click on Cancel in the diaglouge box then dialogue box to Open/Save excel disappears but all the server side buttons placed on my web part becomes non responsive, on click of any of those buttons their server side click event does not get fired !!! Any idea ? Thanks.

    Read the article

  • SVG text parameter changing on conversion to image uri : random dy on tspan element

    - by Kitex
    Sorry that I could not compile jsfiddle because it's jsf application hosted locally and code is dependent on data from jsf application. Although I have arrange part of it and part if it as snippet here. Now Everything's correct in Firefox. Suddenly when I open it in chrome something happened. The text on raphael paper suddenly gets scattered in the paper. It's not where it's meant to be. This happens when I convert svg to image and again generate svg. Everything works fine in Firefox. There is chagne id dy of tspan dy=3.09499999 dy=432.0949999999999 Why is there this change in dy although x and y are same? SVG Correct: The fiddle is here. SVG Incorrect: The fiddle is here. function printMap(){ var svg = $('#map').html().replace(/>\s+/g, ">").replace(/\s+</g, "<"); // strips off all spaces between tags canvg('cvs', svg, { ignoreMouse: true, ignoreAnimation: true }); var canvas = document.getElementById('cvs'); var img = canvas.toDataURL("image/png"); $("#resImg").attr("src",img); $("#resImg").css("display",'block'); //$("resImg").css("display",'none'); $("#map").css("display",'none'); // location.href = img; } Before: Text are above the object: After: Texts are scattered:

    Read the article

  • UTC-8 conversion

    - by leachianus
    Hey guys, I am grabbing a JSON array and storing it in a NSArray, however it includes JSON encoded UTF-8 strings, for example pass\u00e9 represents passé. I need a way of converting all of these different types of strings into the actual character. I have an entire NSArray to convert. Or I can convert it when it is being displayed, which ever is easiest. I found this chart http://tntluoma.com/sidebars/codes/ is there a convenience method for this or a library I can download? thanks, BTW, there is no way I can find to change the server so I can only fix it on my end...

    Read the article

  • python dictionary conversion from string?

    - by shahjapan
    if I've string like "{ partner_name = test_partner}" OR " { partner_name : test_partner } its an example string will be very complex with several special characters included like =, [ , ] , { , } what will be the best way to convert it into a python object - so I can process it I tried with eval but it requires " ' " for string, but how can we add this special character \' before starting and ending of every word, I tried regular express re.findal('\w+') but it fails when my string contains ' _ ' or like characters as it will separate the string by ' _ ' Object of this question is my application needs, user friendly language as input - and I thought Json Dict will be good - but user is lazzy to put " ' " before and after of each string... then I thought for yaml but its also complex, if anybody can suggest better user friendly input which I use as python object - then please help me out.

    Read the article

  • conversion from C++ to C

    - by Dave
    Hi I am interested by converting some code from C++ to C (mostly because i need to use the library with/from other C program and other language) . C is a better gateway for that I am interested to replicate few C++ concept like inheritance for inst . Does anyone know good references or has already work on some similar issues. For inst how to deal with inheritance , adding new members variable/ methods to child class , ... Thx for your help

    Read the article

  • iPhone NSDateFormatter Timezone Conversion

    - by MobileDeveloperTips
    I am trying to create a formatter that will convert the date format shown to an NSDate object: NSString *dateStr = @"2010-06-21T19:00:00-05:00"; NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZ"]; NSDate *date = [dateFormat dateFromString:dateStr]; The issue is the timezone -05:00, which is not parsed properly with the format above. Any suggestions?

    Read the article

  • Xml Conversion "Type mismatch" Error

    - by prema
    I am selecting a query in sql server 2005 SELECT 'Region' AS ELEMENT,(SELECT GeographyName,GeoID from @tmpTable FOR XML RAW, TYPE) FOR XML RAW('Root') This will give the output in xml as <Root ELEMENT="Region"> <row GeographyName="East" GeoID="2" /> <row GeographyName="West" GeoID="3" /> <row GeographyName="North" GeoID="4" /> <row GeographyName="South" GeoID="5" /> </Root> In aspx page, i want to get this function Populatedata(obj, val) { var xmlDom = new JXmlDom(obj, false); --> at this point i am getting error var nodeHeader = xmlDom.selectNodes("//row"); // my code goes here } function JXmlDom (xml,isFile) { this.load=load; this.loadXML=loadXML; this.selectNodes=selectNodes; this.text=text; this.selectSingleNode=selectSingleNode; this.documentElement=documentElement; this.transformNode=transformNode; if (isFile) { this.dom=this.load (xml); }else { this.dom=this.loadXML (xml); } function loadXML (xml) { if (window.ActiveXObject) { var dom=new ActiveXObject("Microsoft.XMLDOm"); dom.async=false; dom.loadXML (xml); } if (document.implementation && document.implementation.createDocument) { var domParser=new DOMParser(); var dom=domParser.parseFromString (xml,"text/xml"); } return dom; } But when i am calling this i am getting an error as Type mismatch.Can anyone help me

    Read the article

  • Array Conversion in Xstream Parser

    - by Avidev9
    Hi am trying to convert the following xml into object using Xstream parser. I tried using the below code to convert the xml but am getting Duplicate field ERRORS ---- Debugging information ---- field : ERRORS class : com.avidev9.Fees.GCSFeesResponse$DebitsWSDS required-type : com.avidev9.Fees.GCSFeesResponse$DebitsWSDS converter-type : com.thoughtworks.xstream.converters.reflection.ReflectionConverter path : /DebitsWSDS/ERRORS[2] line number : 1 version : null The Code I used xstream.alias("DebitsWSDS", GCSFeesResponse.DebitsWSDS.class); xstream.alias("ERRORS", GCSFeesResponse.ERRORS.class); xstream.alias("ERROR_ID", String.class); xstream.alias("TABLE_NAME", String.class); xstream.alias("TABLE_ID", String.class); xstream.alias("ROW_ID", String.class); xstream.alias("ERROR_TEXT", String.class); xstream.alias("ERROR_CODE", String.class); xstream.alias("COLUMN_ID", String.class); xstream.alias("ERROR_TYPE", String.class); GCSFeesResponse.DebitsWSDS gcsFeesResponse =(GCSFeesResponse.DebitsWSDS)xstream.fromXML(result.get_any()[0].getAsString()); XML <DebitsWSDS xmlns=""> <DEBITS> <DEBIT_ID>-1</DEBIT_ID> <ACCOUNT_ID>12321312313</ACCOUNT_ID> <EFFECTIVE_DATE>2012-12-12T00:00:00-06:00</EFFECTIVE_DATE> <DAY_OF_MONTH>12</DAY_OF_MONTH> <DEBIT_TYPE>S</DEBIT_TYPE> <OCCURS_NUM>1</OCCURS_NUM> <DEBIT_AMOUNT>750</DEBIT_AMOUNT> <MEMO>S</MEMO> <ACTIVE_FLAG>Y</ACTIVE_FLAG> <MODIFIED_BY/> <DEBIT_AUTHORIZED/> <DEBIT_AUTHORIZED_BY/> <REMAINING_OCCURRENCES>0</REMAINING_OCCURRENCES> </DEBITS> <ERRORS> <ERROR_ID>1</ERROR_ID> <TABLE_NAME>Debits</TABLE_NAME> <TABLE_ID>-1</TABLE_ID> <ROW_ID>0</ROW_ID> <COLUMN_ID>EXCEPTION</COLUMN_ID> <ERROR_TYPE>E</ERROR_TYPE> <ERROR_CODE>4</ERROR_CODE> <ERROR_TEXT>This debit type is not allowed for this company and policy group</ERROR_TEXT> </ERRORS> <ERRORS> <ERROR_ID>2</ERROR_ID> <TABLE_NAME>Clients</TABLE_NAME> <TABLE_ID/> <ROW_ID>0</ROW_ID> <COLUMN_ID>CLOSE_SCHED_DATE</COLUMN_ID> <ERROR_TYPE>E</ERROR_TYPE> <ERROR_CODE>4</ERROR_CODE> <ERROR_TEXT>Client has been closed. Cannot Authorize Draft.</ERROR_TEXT> </ERRORS> <ERRORS> <ERROR_ID>3</ERROR_ID> <TABLE_NAME>Debits</TABLE_NAME> <TABLE_ID>-1</TABLE_ID> <ROW_ID>0</ROW_ID> <COLUMN_ID>EXCEPTION</COLUMN_ID> <ERROR_TYPE>E</ERROR_TYPE> <ERROR_CODE>4</ERROR_CODE> <ERROR_TEXT>Cannot Schedule a Debit or Draft. Client has been closed.</ERROR_TEXT> </ERRORS> <ERRORS> <ERROR_ID>1</ERROR_ID> <TABLE_NAME>Debits</TABLE_NAME> <TABLE_ID>-1</TABLE_ID> <ROW_ID>0</ROW_ID> <COLUMN_ID>ACTIVE_FLAG</COLUMN_ID> <ERROR_TYPE>W</ERROR_TYPE> <ERROR_CODE>4</ERROR_CODE> <ERROR_TEXT>Creating debit on inactive Client account.</ERROR_TEXT> </ERRORS> </DebitsWSDS> My class structure. package com.avidev9.Fees; import java.util.List; public class GCSFeesResponse { public DebitsWSDS DebitsWSDS; public class DebitsWSDS { public List<ERRORS> ERRORS; public String xmlns; public DEBITS DEBITS; } public class ERRORS { public String TABLE_NAME; public Integer TABLE_ID; public Integer ERROR_ID; public Integer ROW_ID; public String ERROR_TEXT; public Integer ERROR_CODE; public String COLUMN_ID; public String ERROR_TYPE; } public class DEBITS { public String EFFECTIVE_DATE; public String ACTIVE_FLAG; public Long ACCOUNT_ID; public String DEBIT_AUTHORIZED_BY; public Integer DAY_OF_MONTH; public Integer DEBIT_ID; public String MEMO; public Integer REMAINING_OCCURRENCES; public String DEBIT_TYPE; public Integer OCCURS_NUM; public Integer DEBIT_AMOUNT; public String DEBIT_AUTHORIZED; public String MODIFIED_BY; } }

    Read the article

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