Menu
  • HOME
  • TAGS

Temp Converter Using JavaScript

javascript,converter,temperature

The formulas are: °F = °C x 9/5 + 32 °C = (°F - 32) x 5/9 so: function toFahrenheit() { document.converter.celsius.value = (document.converter.fahrenheit.value - 32) * 5 / 9; } As for the bonus question, I think you need to attach a handler function to each of the 3...

convert 2 php functions into 2 javascript functions

javascript,php,converter

come on? - do you really expect someone to sit down and translate this for you? learn how to program in php, and javascript (basicly the same semantics) try to find out how explode, and ip2long php built in functions work, and what their closest javascript counterparts are.. hint compare...

Python Simple PiggyBank Program

file,python-3.x,input,output,converter

You need to open your file with append mode : f = open("PiggyBanks_Records.txt", "a") ...

Android: Convert Text Input to ASCII and print it as a string

java,android,converter

public static long toAscii(String s){ StringBuilder sb = new StringBuilder(); String ascString = null; long asciiInt; for (int i = 0; i < s.length(); i++){ sb.append((int)s.charAt(i)); char c = s.charAt(i); } ascString = sb.toString(); asciiInt = Long.parseLong(ascString); return asciiInt; } String outputText = toAscii(textInput).toString(); textOut.setText(outputText); This could be helpful for...

How to add a word file content to a crystal report?

c#,visual-studio,crystal-reports,ms-word,converter

I have done this in the past by creating a text box on the report canvas. Copy and paste the contents of your Word Doc into the text box. Maybe 1 text box per Word Doc page as I am not sure if there is a text limit in a...

refer to single character of argument passed by user

c,string,arguments,hex,converter

You can organize a loop for all characters int main(int argc, const char *argv[]) { int i; printf("%s has \n",argv[1]); for (i=0; i < strlen(argv[1]); i++) { printf("%c = %d\n", argv[1][i], (argv [1][i] >= 'A')? (argv [1][i] - 'A' + 10 ) : (argv [1][i] - '0'); } return 0;...

Convert Grid square numbers to coordanates

javascript,arrays,grid,coordinates,converter

Just calculate the division and the module of that number by the array length: 6 / 4 = 1 (6 % 4)-1 = 1 Remember that arrays start at 0, so the 6th position is (1, 1) [][][][] [][^][][] [][][][] [][][][] ...

How to convert time string in milliseconds to DateTime object in c#?

c#,string,datetime,converter

Milliseconds is a duration, not a time. You can convert it to a TimeSpan easily: string ms = "229935440730121"; TimeSpan ts = TimeSpan.FromMilliseconds(double.Parse(ms)); To convert to a DateTime you need to know the reference point from which the span was measured, then just add the TimeSpan to that date: DateTime...

C# Dictionary > multiple keys dictionary

c#,list,dictionary,converter

You can only add each key once in a Dictionary. What you can do is use a List as value (as you tried). Maybe this snippet will help you: var myDict = new Dictionary<string, List<double>>(); var newKey = "newKey"; var newValue = 0.5; if (myDict.ContainsKey(newKey)) { var list = myDict[newKey];...

p:orderList converter getAsObject() doesn't call Object.toString()

jsf,primefaces,converter

Converters basically serve to transform values in 2 directions: Server to client, when the value is rendered. Client to server, when the value is submitted. In your getAsString you established, that the string representation, the one which client uses, is exampleEntity's number. So that's what gets rendered to client as...

Python 3.4 code help - I can't make this work [closed]

python,function,python-3.x,converter,currency

Your code doesn't properly call the functions nor does it assign global variables for conversion. In addition, you shouldn't use the is keyword, which checks for equivalent references in memory, you should use the in keyword which checks for the existence of an element in your tuple. print("Welcome to the...

Convert String to CLLocationCoordinate2D in swift

string,swift,converter,cllocation,cllocationcoordinate2d

Use the doubleValue property. let MomentaryLatitude = (snapshot.value["latitude"] as NSString).doubleValue let MomentaryLongitude = (snapshot.value["latitude"] as NSString).doubleValue ...

EJB and managed bean injections in @FacesConverter and @FacesValidator in JSF 2.3

jsf,converter,jsf-2.3

As you can see in Mojarra 2.3.0-m02's Application#createConverter() implementation, it checks if it's running in JSF 2.3 mode as per faces-config.xml version declaration before trying to grab a CDI-managed one. In other words, in order to get @FacesConverter(managed=true), @FacesValidator(managed=true) and thus @Inject in those classes to work, you need to...

How to transform an .txt file to .csv with Java?

java,eclipse,converter,export-to-excel

you must consider the content you want to transform; usually, with a simple text, you can arrange a renaming of the file in .csv otherwise is preferable to use some libraries to create an excel spreadsheet as Apache POI HSSF provides to with HSSF you can directly work on workbooks,...

Symfony2 fos_rest_bundle param converter not calling entity constructor

php,symfony2,converter,fosrestbundle

I ran into the same problem. If you're sure that the default values won't be overwritten from the request body you can call the constructor explicitly. $application->__construct(); In my case I just wanted to initialize all the ArrayCollection properties to prevent errors trying to access them so I didn't care...

How can I decode base32 to string in mysql

mysql,converter,base32

BASE 64 or BASE 32 are not encrypted, they are just encoded. MySQL does not have a native function to perform encoding/decoding of Base 32 strings as it has for Base 64, FROM_BASE_64 e TO_BASE_64. As an alternative you can try the CONV mathematical function (depending on the content stored...

How do I convert this specific time into the one here?

php,sql,date,time,converter

I Like using PHP's DateTime class, here's an example. $newdate = new DateTime($yourdate); $date = $newdate->format('Y-m-d H:i:s'); $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); $stmt = $mysqli->prepare("UPDATE table SET column = ? WHERE row = ?") $stmt->bind_param("ss", $date, $row); $stmt->execute(); EDIT : So you're not getting a correctly formatted date...

MSVS2008 to MSVS2003 Conversion (Google Protobuf)

visual-studio,converter,protocol-buffers

Apparently it is not possible to run Google Protobuf with the MSVS03 Compiler. The following error occures when trying to do so: ...\include\google\protobuf\stubs\atomicops_internals_x86_msvc.h(46) : fatal error C1189: #error : "We require at least vs2005 for MemoryBarrier Therefore we need at least MSVS05....

How can I convert from hexadecimal string to normal string?

java,android,hex,converter

byte[] bytes = Hex.decodeHex(YourhexString .toCharArray()); String s=new String(bytes, "UTF-8"); ...

How do I convert HTML to a Word document on the fly in ASP.NET MVC? [closed]

c#,asp.net-mvc,ms-word,converter

.NetFiddle In order to build the .doc file (which supports html) you are going to need to format the html to include indicators that office understands, and then you will need to write that format to the response. This approach was inspired by the post at codeproject in vb http://www.codeproject.com/Articles/7341/Dynamically-generate-a-MS-Word-document-using-HTML...

Primefaces selectOneMenu converter called but not working

java,jsf-2,primefaces,converter,selectonemenu

The converter seems to be working, but you didn't post the whole <p:selectOneMenu> code, in particular <f:selectItems>. It should look something like this <p:selectOneMenu id="defid" value="#{abcController.selected.defid}" converter="defConverter"> <f:selectItems value="#{abcController.defs}" var="def" itemLabel="#{def.name}" itemValue="#{def.defId}" /> </p:selectOneMenu> itemLabel is responsible for printing displayed values....

Fortran type conversions

arrays,fortran,converter

High Performance Mark's answer about solves your problem. However, assuming int8 isn't the default kind (which the error messages supports) each element in the array constructor given in that answer should have the same type (they have) and kind (they haven't) parameter. So: iu = [4_int8,3_int8,2_int8,1_int8] is a valid constructor...

IValueConverter with MarkupExtension

c#,wpf,converter,ivalueconverter,markup-extensions

The only (slight) advantage that the markup extension is providing in this case is more concise XAML syntax. Instead of this: <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> ... {Binding SomeBooleanProperty, Converter={StaticResource BooleanToVisibilityConverter}} you can have this: {Binding SomeBooleanProperty, Converter={my:BoolToVisibilityConverter}} In my opinion it's not really worth it. If you were that bothered about...

how to convert date using awk linux

date,awk,converter

Set the field separate to a semicolon or a space: awk -F'[; ]' '{ print $3, $NF }' test.txt I have used the -F switch, which is the standard way to set the input field separator FS. I have also used $NF to print the last field. Also note that...

Windows XAML: Replacement for WPF TextBox's CharacterCasing

c#,xaml,user-interface,windows-store-apps,converter

This is the code I made for it in VB.Net but it should be easy to translate to C# Make a textchanged event for your textboxes and call a method giving it your sender as a textbox Private Sub AnyTextBox_TextChanged(sender As Object, e As TextChangedEventArgs) TextBoxToChange = (CType(sender,Textbox)) TextBoxToChange.Text =...

Byte array to struct

c#,struct,bytearray,converter

The problem is at this line: byte[] stringBytes = GetBytes(text); How are you converting the string to a byte array? You are probably using a Unicode encoding, which will store each character as two bytes, and because your string is in the ASCII set, every other byte will be zero:...

From a Java method, how do I return an entire int converted from a string?

java,methods,converter

You only get one digit from year because you only read one digit. following is a modified version of getYear() which prints all 4 digits. public static void getYear(Object c){ int year_digit=0; String temp; for(int i=0;i<4;i++){ char ch = getInputChar(); temp = Character.toString(ch); year_digit = Integer.parseInt(temp); System.out.println(year_digit); } } I...

Rails: Convert string “04/30/2015” to valid datetime for storing inside postgres

ruby-on-rails,date,datetime,converter

This should do: Date.strptime(params[:interview][:expire_at], '%m/%d/%Y') using .to_datetime will be reduntant at that point, considering it should exactly do what you are trying to achieve. "30-4-2015".to_datetime as well as "2015/30/4".to_datetime will be accepted, so it would need some extra formatting to your string to work. .to_datetime requires the day to be...

Omnifaces - ListIndexConverter, principle of operation

jsf,converter,omnifaces

When and by whom is the list member variable filled? By <o:converter list> attribute, exactly as shown in Usage section at showcase. <p:pickList value="#{bean.dualListModel}" var="entity" itemValue="#{entity}" itemLabel="#{entity.someProperty}"> <o:converter converterId="omnifaces.ListIndexConverter" list="#{bean.dualListModel.source}" /> <!-- ===================================================^^^^ --> </p:pickList> The <o:converter> is a special taghandler which allows setting arbitrary properties on the...

From prototype to real APP

ios,user-interface,prototype,converter

If you use xCode and Interface Builder, no other tool, your prototype is ready to be built and run.

creating multiple .exe files using CX_freeze

python,converter,cx-freeze

Ok so i figured it out. here is the Setup.py file of my program: import cx_Freeze #executables = [cx_Freeze.Executable("SimpleGUI.py", base = "Win32GUI")] executables = [cx_Freeze.Executable("SimpleGUI.py")] Packages = ["pygame","threading", "time", "socket","ConSetup", "Btn0","Btn1","Btn2","Btn3","Btn4","Btn5","Btn6","Btn7","Btn8", "ScnGame","ScnMain-Menu","ScnPause-Menu", "Button","Label","Scenes","TextBoxes","PicBoxes"] Include = ["Pictures","Sounds"] cx_Freeze.setup( name="Side_Scroller",...

How to convert videos to ogg and mp4 and store in the database

html,database,video,converter

Haven't tried this yet, but maybe it works ;) This...

Decimal to Binary within an ArrayList java

java,binary,converter

You're using the same object of Digit to occupy all places in the ArrayList, hence it just shows the last value written to the object. Store clone of the object in the ArrayList to get the desired result....

Convert a number into a name

javascript,html,numbers,converter,names

This will convert the numbers into your chosen names. <script type="text/javascript"> window.onload = function() { var e = document.getElementsByTagName('span'); for (var i = 0, l = e.length; i < l; i++) { if (typeof e[i].className !== 'undefined' && e[i].className === 'convertNumberToName') { e[i].innerHTML = convertToName(e[i].innerHTML); } } function convertToName(n) {...

NAudio File Conversion

c#,converter,naudio

Yes you need to have all your .mp3 files re-sampled to your required rate before converting them to .wav format. This is because the converting method NAudio.Wave.WaveFileWriter.CreateWaveFile(string filename, IWaveProvider sourceProvider) has no parameters that corresponds to rate or frequency. The method signature (as taken from their code in GitHub) looks...

Python convert JSON to CSV

python,json,csv,field,converter

# json_data being the literal file data, in this example import json import csv data = json.loads(json_data)['leaderboard']['$'] with open('/tmp/test.csv', 'w') as outf: dw = csv.DictWriter(outf, data[0].keys()) dw.writeheader() for row in data: dw.writerow(row) ...

Converting 8-length varchar to datetime

sql,converter

If your date is a varchar, then you should be able to use CONVERT(DATE,[date_field], 112) DECLARE @dates TABLE ( [date] varchar(10) ) INSERT INTO @dates([date]) VALUES('20110712'),('20141229'),('20100222'),('20140408'),('20131117'),('20130912'),('20140702'),('20110405') SELECT CONVERT(date,[date],112) FROM @dates ...

f:convertNumber unexpectedly increments/decrements float value

jsf,jsf-2,floating-point,converter

In a nutshell: floating-point-gui.de If you value precision, you should be using java.math.BigDecimal instead of float/double/java.lang.Float/java.lang.Double....

Assining values to numeric factor levels [duplicate]

r,converter

Using your dput data, this works just fine: df = structure(list(SYMBOL = structure(1:6, .Label = c("10-Mar", "10-Sep", "11-Mar", "11-Sep", "12-Sep", "15-Sep"), class = "factor"), PVALUE1 = structure(c(4L, 1L, 3L, 2L, 5L, 1L), .Label = c("0.00167287722066533", "0.00221961024320294", "0.21179810441316", "0.813027629406118", "0.934667427815304"), class = "factor"), PVALUE2 = structure(c(4L, 1L, 3L, 2L, 5L, 1L),...

Converter for JSF passthrough input element (“HTML5 friendly markup”)

jsf,converter,jsf-2.2,passthrough-elements

Just the same way as when you would be using a normal JSF <h:inputText> component instead of plain HTML, with either the converter attribute <input jsf:value="#{...}" jsf:converter="fooConverter" /> or the <f:converter> tag. <input jsf:value="#{...}"> <f:converter converterId="fooConverter" /> </input> Table 8-4 of the Java EE 7 tutorial lists which JSF component...

Java: convert byte[] to base36 String

java,converter,base36

Try using BigInteger: String hash = "43A718774C572BD8A25ADBEB1BFCD5C0256AE11CECF9F9C3F925D0E52BEAF89"; String base36 = new BigInteger( hash , 16 ).toString( 36 ).toUpperCase(); ...

Can't convert string have new line characters to JSONArray

java,json,string,exception,converter

You should just escape the \ as in \\n, and then it will work. Also note you need to escape ' also. String text = "[" + "'test line 1 \\n" + "test line 2 \\n" + "line 3', " + "'255.255.255.240' ," + "'<Not Set>'" + "] "; ...

Python 3.4 tkinter real-time temperature converter

python,tkinter,converter,temperature

You have to type a space because when the <Key> callback triggers, the key that the user most recently pressed hasn't yet been added to the entry. This is probably what you're trying to compensate for by adding event.char, although you're doing it in the wrong place anyway. Change your...

Convert docx to mediawiki and preserve [[Image:]]

converter,mediawiki,docx,libreoffice,soffice

This doesn't appear to be possible, but I have written a workaround found here that solves it. The long and short of it is that I convert the file and manage uploading / linking of images manually.

Convert int textbox input to negative in xaml?

c#,wpf,xaml,textbox,converter

This would be a pure XAML solution: <Image.LayoutTransform> <TransformGroup> <ScaleTransform ScaleX="-1"/> <RotateTransform CenterX="0.5" CenterY="0.5" Angle="{Binding Path=Text, ElementName=testing, UpdateSourceTrigger=PropertyChanged}" /> <ScaleTransform ScaleX="-1"/> </TransformGroup> </Image.LayoutTransform> I would still recommend using a binding converter....

How To Change My Array Format In PHP

php,arrays,date,converter

Extract month from key, and than check if month in output array exists or not. <?php $array = array( array( '2015-05-28', 1 ), array( '2015-05-29', 1 ), array( '2015-06-02', 2 ) ); $output = array(); foreach ($array as $val) { $month = date('m', strtotime($val[0])); if (isset($output[$month])) { $output[$month] += $val[1];...

Construct date for specific day of current month and convert it to epoch

date,converter,epoch

Try backqoutes approach date -d "`date +\"%Y-%m-04 00:00:00\"`" +%s ...

How to count the number of characters in a line in a csv file

java,csv,hex,converter

I suggest you to read the javadoc of String.split. I think that you misunderstood the concept when you did this: String[] f=line.split(","); a[count]=Integer.parseInt(f[2]); //--> java.lang.NumberFormatException here! Avoid using 'magic' numbers in your code like int[] a = new int[24];. Why 24? Well, here comes a version that do what you...

Swift - how to convert hyphen/minus sign into + sign

string,swift,replace,converter

tmpAddress = tmpAddress.stringByReplacingOccurrencesOfString("-", withString: "+") This replaces '-' with '+' The first parameter is the search string, and the second is the replacement string....

What is the better design approach to convert object A to object B?

design-patterns,converter

Firstly take a look at Guava Function class: Function<S, T> converter = ... final T t = converter.apply(s); If your conversion depend on some other parameters you could pass them into a constructor: Function<S, T> converter = new MyConverter(Map params) { private Map params; MyConverter(Map params) { this.params = params;...

How to convert an array with 0(n log k)?

algorithm,converter

In addition to the array maintain a max-heap containing k smallest elements seen so far. Then scan the array from let to right and if the current element from array is less than the top-most element in the heap, then delete the top-most element and insert this new element (in...

Convert DDM to DD Geographic Coordinate Conversion C# [closed]

c#,math,coordinates,converter,coordinate

//Parsing the DDM format is left as an excersize to the reader, // as is converting this code snippet into a usable function. double inputDegrees = 52; double inputMinutes = 37.9418; double latitude = inputDegrees + (inputMinutes/60); // 52.632363 ...

Converting Integer to 32-bit Binary - Output is backwards

c,binary,integer,converter,backwards

You already print the digits individually; just have the j start at i and count down to 0. As for printing spaces: figure out for which values of i you need a space, test for them, and print one only then.

WPF Multibind converter not returning value?

c#,wpf,xaml,converter,multibinding

The value returned by a multi-value converter must exactly match the type of the target property. Hence it must a return a double value, not an int. You will also have to do a correct conversion of the two input values. Your current code assumes that both the MaxFrame and...

Error calling LibreOffice from Python

python,subprocess,converter,libreoffice

This is the code you should use: subprocess.call(['soffice', '--headless', '--convert-to', 'txt:Text', 'document_to_convert.doc']) This is the same line you posted, without the quotes around txt:Text. Why are you seeing the error? Simply put: because soffice does not accept txt:"Text". It only accepts txt:Text. Why is it working on the shell? Your...

af:convertNumber element removes zero in the end of the value

jsf,numbers,converter,oracle-adf

You are using the property maxFractionDigits="2", use minFractionDigits="2" for this: <af:convertNumber groupingUsed="true" type="number" messageDetailConvertNumber="#,###,##" maxFractionDigits="2" minFractionDigits="2"/> Take a look at the JSF Converters Documentation for further information about it....

Input String was not in Correct Format (C#: Radio buttons conversion)

c#,radio-button,format,converter

If you are using Winforms or ASP then you need to do String rad1 = radioButton1.Text; If you are using WPF then you need to do String rad1 = Convert.ToString(radioButton1.Content); ...

how to convert this declaration of variables Oracle to Sql Server

sql-server,oracle,variables,converter

SQL Server doesn't have anchored type declarations-- you can't do the equivalent of <<table>>.<<column>>%TYPE. You'd need to determine the actual data types of the underlying columns and use those. Of course, that means that if you change the data type of some column, you'd need to go through your code...

Python - Read CSV and output to strings

python,string,csv,converter

You got a good start with the csv module. Now you just need to open() another file in "write" mode for output, and write() to it. import csv def csv_dict_reader(file_obj): """Read a CSV file with 2 columns and output a new string. """ reader = csv.DictReader(file_obj, delimiter=',') buf = ""...

How can I convert byte CP-1252 to byte UTF-8 in java [duplicate]

java,utf-8,converter,typeconverter,cp1252

You should use "Cp1252" as code page instead of "CP-1252" public void convert(){ try { byte[] cp1252 = new byte[]{(byte) 0xB5}; byte[] utf8= new String(cp1252, "Cp1252").getBytes("UTF-8"); } catch (Exception ex) { System.out.println(ex.getMessage()); } } Java supported encodings As pointed out 0xB5 you are trying to decode is not code page...

XAML Converter in different namespace

c#,xaml,namespaces,windows-phone-8.1,converter

wow ... after using VS2015 and the same error persisted, I played a little bit around with settings and stuff. I kept being curious, why it would compile and deploy even it triggered so many errors. The problem appeared to be inconsistent. The solution was different than expected: You have...

Why can't I use IMultiValueConverter on Rectangle.Width?

wpf,mvvm,converter,ivalueconverter

Yes. And that's why it didn't work. The problem is that your bindings are evaluated after the Rectangle is rendered. Once evaluated, the TextBlock removes any content elements. I believe TextBlocks consider strings a "special case" and render those directly rather than creating child elements to house the text. So,...

Save dictionary in application settings and load it on start

c#,wpf,dictionary,settings,converter

I had a similar problem a while ago. I ended up using JSON Serialization to serialize the Dictionary as a string, store it in the application settings, and deserialize it back to a Dictionary when I needed it. string strDictionaryAsString = JsonConvert.SerializeObject(dtnDictionary); var dtnDictionary = JsonConvert.DeserializeObject<Dictionary<string, double>>(strDictionaryAsString ); ...

c#: Self referencing object conversion [closed]

c#,converter,infinite-loop,self-reference

The code in the original question should not lead to infinite loop if I understand the user2368215's logic correctly. However, if the circular references are possible, there is a simple way to detect and avoid infinite loops by declaring the Dictionary outside the ToCommentRepo(...) and add new mapping from Comment...

VBA Code to Convert CSV to XLS

excel,vba,csv,converter,xls

Try : this It may help solving your problem, I had one of those sticky debug boxes too for no reason at all and this line helped me. Edit: Here's the code from the website above which solves the problem described. Adding this line in the beggining of one's code...

Converting seconds to Year Hour Minutes Seconds

java,time,converter

I think this statement needs to be changed : From "int remainMin = hours % sec min;" to " int remainMin = minutes % secmin;". Rest all looks good....

How to unpack a struct in Python?

python,file-io,converter,binaryfiles,unpack

To pack two random numbers into a string x: In [6]: x = struct.pack('2q', random.randint(0, MAX_NUM), random.randint(0, MAX_NUM)) To unpack those numbers from the string: In [7]: struct.unpack('2q', x) Out[7]: (806, 736) Saving and reading from a file Even if we save x in a file and then read it...

How to speed up a complex image processing?

php,image,imagemagick,converter,imagemagick-convert

0. Two approaches Basically, this challenge can be tackled in two different ways, or a combination of the two: Construct your commands as clever as possible. Trade speed-up gains for quality losses. The next few sections discuss the both approaches. 1. Check which ImageMagick you've got: 'Q8', 'Q16', 'Q32' or...

How to convert from one type, to multiple types which are identical aside from package name?

java,generics,converter

Dozer is what you are looking for. It is very flexible and convenient for those cases, as supports mappings via annotations, xml mappings. Orika could be another option. Though Dozer is one of the powerful and simplest. For more detailed comparison, check this post...

Converting InkCanvas Strokes to a Byte Array and back again

c#,wpf,bytearray,converter,inkcanvas

My problem was that I didn't serialize the output to the saved file and thus the when I loaded that file deserializing it tripped an error. Here is the correct code: private void SaveByteArrayToFile(byte[] byteArray) { var dialog = new System.Windows.Forms.FolderBrowserDialog(); string filepath = ""; if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) {...

Clean and convert HTML to XML for BaseX

html,xml,converter,xquery,basex

BaseX has integration for TagSoup, which will convert HTML to well-formed XHTML. Most distributions of BaseX already bundle TagSoup, if you installed BaseX from a Linux repository, you might need to add it manually (for example, on Debian and Ubuntu it's called libtagsoup-java). Further details for different installation options are...

PL/SQL convert string to number

oracle,plsql,oracle11g,converter

It looks like you're supposed to convert the initial string, which may/will contain alphabetic characters, to another string containing only numeric characters. Then you've got some other messing around to do, but the following may get you started: FUNCTION CONVERT_STR_TO_NUMERIC(pin_Str IN VARCHAR2) RETURN VARCHAR2 IS strResult VARCHAR2(32767); c CHAR(1); BEGIN...

Convert unix time to specific datetime format with culture info

c#,string,datetime,converter

Your string looks like a Unix Time which is elapsed as a seconds since 1 January 1970 00:00 UTC.. That's why, you can't directly parse it to DateTime. You need to create a unix time first and add this value as a second. That's why you need to add your...

Convert excel file to jpg in c#

c#,excel,converter,spire

I finally use Aspose : http://www.aspose.com/community/files/51/.net-components/aspose.cells-for-.net/category1129.aspx example : http://www.aspose.com/docs/display/cellsnet/Converting+Worksheet+to+Image my sample code : Workbook workbook = new Workbook(@"D:\a.xlsm"); //Get the first worksheet. Worksheet sheet = workbook.Worksheets[12]; //Define ImageOrPrintOptions ImageOrPrintOptions imgOptions = new ImageOrPrintOptions(); //Specify the image format imgOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg; //Only one page for the...

How to avoid 'Invalid date' prefix in result when converting from milliseconds (13 digits)

json,converter,unix-timestamp,epoch

The Invalid Date part comes from the fact that the first date is constructed using a string. It should be a number (obtainable via parseInt()) var timestamp = new Date(parseInt(event.feature.getProperty('updated'))) On a sidenote i don't understand what you use the humanTime variable for... event.feature.getProperty('updated') already seems to be the number...

Is there an existing Java class to convert data stored little-endian to integers by offset and length?

java,converter,little-endian

If your file is a file of raw bytes you can use ByteBuffer to read the file in little endian mode, and then use asIntBuffer() to read out the ints through an IntBuffer. If you need to navigate the file, you can use srcChan.position(targetPosition); to skip to your next "field"....

F# sequence and array2d conversion

arrays,string,f#,converter

To convert array of numbers to string in the way you described, use String.Join: let optionsToStr<'a> (opts: seq<'a>) = System.String.Join( "", opts ) > optionsToStr [0..9] val it : string = "0123456789" > optionsToStr [true;false] val it : string = "TrueFalse" Parsing it back, however, would be only possible if...

How can I convert html.slim files to html or html.erb?

html,converter,erb,slim-lang

You can! First, make sure you have already installed slim-rails. You can install it by calling gem install slim-rails. Then write something in the input.html Finally, you open the terminal and call: echo `slimrb input.html` > output.html NOTE: it is `, not ' or " Open file output.html, that's what...

C# Trying to format datagridview data and pass back through the loop once formatted

c#,arrays,for-loop,datagridview,converter

Flip these lines around: dataset.Tables[tableName].Rows.Add(items.ToArray()); speed = Convert.ToDouble(items[2]); speed = speed / 10; items[2] = speed.ToString(); So that you're changing the values in the items array before adding it to the table: speed = Convert.ToDouble(items[2]); speed = speed / 10; items[2] = speed.ToString(); dataset.Tables[tableName].Rows.Add(items.ToArray()); The Rows.Add() method calls an internal...

How to convert RTF to Markdown on the UNIX/OSX command line similar to pandoc

osx,unix,converter,markdown,rtf

On Mac OSX I can use the pre-installed textutil command for the RTF-to-HTML conversion, then convert via pandoc to markdown. So a command line which takes RTF from stdin and writes markdown to stdout looks like this: textutil -stdin -convert html -stdout | pandoc --from=html --to=markdown ...

Converting Valgrind XML Output to HTML

html,xml,converter,valgrind

Valgrind doesn't directly output as HTML, however there was talk on the Valgrind Users mailing list about 10 years ago about developing a XSLT, however the links in the mailing list appear to be dead - or at least redirected. There is also this question which suggests there are other...

Convert date to string format

vb.net,converter

Your approach doesn't work because you are using ToString on a DataColumn which has no such overload like DateTime. That doesn't work anyway. The only way with the DataTable was if you'd add another string-column with the appropriate format in each row. You should instead use the DataGridViewColumn's DefaultCellStyle: InvestorGridView.Columns(1).DefaultCellStyle.Format...

Calculate AWG from Cross section unit mm² and vice versa

c#,converter

While waiting for a better solution I use this code: double Awg2CrossSection(int awg) { var diameter = 0.127 * Math.Pow(92, (36.0 - awg) / 39.0); return Math.PI / 4 * Math.Pow(diameter, 2); } int CrossSection2Awg(double crossSection) { var diameter = 2 * Math.Sqrt(crossSection / Math.PI); var result = -((Math.Log(diameter /...

What is the fastest way to convert int to char

c#,performance,char,int,converter

Convert.ToChar eventually performs an explicit conversion as (char)value, where value is your int value. Before doing so, it checks to ensure value is in the range 0 to 0xffff, and throws an OverflowException if it is not. The extra method call, value/boundary checks, and OverflowException may be useful, but if...

How to convert SHA1 to array[5] of unsigned long ints?

c++,arrays,converter,sha1,unsigned-integer

SHA1 produces a 20 byte hash-value. In openssl it returns an unsigned char*. I'm guessing you can use a union of unsigned char[20] and uint32_t[5] and use the chars for easy byte access: union mysha1{ uint32_t shaint[5]; unsigned char shachar[20]; }; Add to that a bunch of operators (indexing for...

How convert any record into a map/dictionary in F#?

dictionary,f#,converter,record

In practice, the best advice is probably to use some existing serialization library like FsPickler. However, if you really want to write your own serialization for records, then GetRecordFields (as mentioned in the comments) is the way to go. The following takes a record and creates a map from string...

Arguments against a generic JSF object converter with a static WeakHashMap

jsf,jsf-2,converter

This approach is hacky and memory inefficient. It's "okay" in a small application, but definitely not in a large application with tens or hundreds of thousands of potential entities around which could be referenced in a f:selectItems. Moreover, such a large application has generally a second level entity cache. The...

Convert Double from String

asp.net,vb.net,visual-studio-2012,converter

The result isn't wrong, it only has lower precision than you expected. Floating point numbers have a limited precision by design, and you simply can't expect to get a result that is more precise than its limit. You can use a Decimal to get higher precision. In this case it...

VAADIN: Why I can't set a converter to a ComboBox?

combobox,type-conversion,converter,vaadin7

Your code cannot be compiled because there is no setConverter() method available on class ComboBox that fits your custom converter. Let me explain how converters are used on select components and what is the idea behind the specific method signatures you find for setting converters on a ComboBox. ComboBox provides...

Convert long int seconds to double precision floating-point value

c++,date,datetime,time,converter

There are 86400 seconds in a day, and 25569 days between these epochs. So the answer is: double DelphiDateTime = (UnixTime / 86400.0) + 25569; You really do need to store the Unix time in an integer variable though. ...

Ovftool error “Unsupported value” when convert a virtual maschine

virtual-machine,converter,vmware,vcenter,ovf

I resolve my problem by convert OVA to OFV and after that conversion ovftool create a manifest file and sum control file. I edit manifest in problematic lines and delete the sum control file. After that my vSphere apply changes and successful import vm. If you dont delete sum control...

Converting very large files from xml to csv

c#,xml,csv,converter,large-files

You need to take a streaming approach, as you're currently reading the entire 2Gb file into memory and then processing it. You should read a bit of XML, write a bit of CSV and keep doing that until you've processed it all. A possible solution is below: using (var writer...