data-conversion

Convert XML to CSV with PHP, with different fields in some itens

梦想与她 提交于 2019-12-14 03:21:28
问题 I want to convert a XML to a CSV. That's OK, but in some itens, I have extra fields or less fields than other itens. A example of my feed is: EDIT: The top of the XML is: <rss xmlns:g="http://base.google.com/ns/1.0" version="2.0"> <channel> <item> Item with less fields: <item> <title> <![CDATA[ Resident Evil Revelations 2: Raid Mode: Throwback Map Pack ]]> </title> <link> https://www.nuuvem.com/item/resident-evil-revelations-2-raid-mode-throwback-map-pack </link> <description> <![CDATA[ Novas

how to convert bool array in one byte and later convert back in bool array

五迷三道 提交于 2019-12-13 15:05:18
问题 I would like to pack bool array with max length 8 in one byte, send it over network and then unpack it back to bool array. Tried some solutions here already but it didn't work. I'm using Mono. I made BitArray and then tried to convert it in byte public static byte[] BitArrayToByteArray(BitArray bits) { byte[] ret = new byte[Math.Max(1, bits.Length / 8)]; bits.CopyTo(ret, 0); return ret; } but I'm getting errors telling only int and long type can be used. Tried int instead of byte but same

Python3 - convert csv to json using pandas

主宰稳场 提交于 2019-12-13 11:26:34
问题 I've got a .csv files with 5 columns but I only need the json file to contain 3 of these how would i go about doing it? csv file: Ncode Ocode name a b c 1 1.1 1x 1a 1b 1c 2 2.2 2x 2a 2b 2c 3 3.3 3x 3a 3b 3c Json output: {"1.1":[{"a":"1a"},{"b":"1b"},{"c":"1c"}],"2.2":[{"a":"2a"},{"b":"2b"},{"c":"2c"}]} 回答1: txt = """Ncode Ocode name a b c 1 1.1 1x 1a 1b 1c 2 2.2 2x 2a 2b 2c 3 3.3 3x 3a 3b 3c """ df = pd.read_csv(StringIO(txt), delim_whitespace=True) json.dumps( {'{:0.2f}'.format(r.Ocode): [{

PostScript: Does `cvs` terminate the string buffer?

淺唱寂寞╮ 提交于 2019-12-12 16:48:36
问题 One idea when using cvs is to help the garbage collector by re-using a string buffer, like /s 5 string def s 2 cvs %... s 66 cvs %... However when doing such a thing in a loop, the strings actually found in the buffer were: (-40.0) (-30.0) (-20.0) (-10.0) (0.0.0) (10.00) (20.00) (30.00) (40.00) So it seems the strings are not terminated when conversion ended (Found in GhostScript 9.26). Unfortunately the GhostScript reference manual is somewhat silent about whether the string will be

How to convert Apache Derby database to MySQL

萝らか妹 提交于 2019-12-12 11:22:44
问题 I would like to convert an existing Derby database to MySQL. 回答1: Try the DBCopy Plugin for SQuirreL SQL Client if you only need to convert the database once. There are other tools that may work. I you need to convert regularly, then I would use CSV export / import (for the data). 来源: https://stackoverflow.com/questions/3744770/how-to-convert-apache-derby-database-to-mysql

Passing a integer through command line in C?

一个人想着一个人 提交于 2019-12-12 05:48:32
问题 I was wondering if someone could explain how passing arguments through command line works? I'm really confused by how it works. Right now I'm trying to pass one integer into the main program. How would I go about doing this? EDIT: keep getting the initialization makes integer from pointer without a cast [-Wint-conversion] error? #include <stdio.h> #define PI 3.1416 int main (int argc, char *argv[]) { double r,area, circ; char a = argv[1]; int num = a - '0'; printf("You have entered %d",num);

Reading a file of lists of integers in Fortran

最后都变了- 提交于 2019-12-11 21:09:58
问题 I would like to read a data file with a Fortran program, where each line is a list of integers. Each line has a variable number of integers, separated by a given character (space, comma...). Sample input: 1,7,3,2 2,8 12,44,13,11 I have a solution to split lines, which I find rather convoluted: module split implicit none contains function string_to_integers(str, sep) result(a) integer, allocatable :: a(:) integer :: i, j, k, n, m, p, r character(*) :: str character :: sep, c character(:),

I want to parse String into java date object [duplicate]

旧城冷巷雨未停 提交于 2019-12-11 20:28:41
问题 This question already has answers here : convert string into date format (5 answers) Closed 6 years ago . Hello i have date in this format 2013-10-31T19:00:00Z now i want to display this date into yyyy/mm/dd this format.i have used this code but its giving me exception kindly help me String startDateString = "2013-10-31T19:00:00Z"; DateFormat df = new SimpleDateFormat("yyyy/mm/dd"); Date startDate; try { startDate = df.parse(startDateString); String newDateString = df.format(startDate);

How to convert a string to CCSID 37 in java

房东的猫 提交于 2019-12-11 12:39:50
问题 I want to convert a java string say "HelloWorld" to numerical CCSID 37 numbers. But I can't find any API in java to do this. CCSID37 回答1: You can try like this: String.getBytes(System.getProperty("com.ibm.cics.jvmserver.local.ccsid")) String(bytes, System.getProperty("com.ibm.cics.jvmserver.local.ccsid")) Refer Data encoding from IBM for details The JCICS API uses the code page that is specified in the CICS region and not the underlying JVM. So if the JVM uses a different file encoding, your

Convert Excel to CSV - Properly Convert Date Fields [duplicate]

纵饮孤独 提交于 2019-12-11 11:26:07
问题 This question already has answers here : Python xlrd read as string (3 answers) Closed 5 years ago . So, I now have my Excel2CSV function working, but encountered another problem wherein the Date Fields in my Excel File ('Date Opened', 'Date Closed') which are formatted as Date in Excel are being written as an integer value when converted to the CSV (ex. 5/1/1995 converts to 34820). I'd like it to just write those dates out as plain text (ie. 5/1/1995 -or- May 1, 1995, or something along