data-conversion

Input an integer, find the two closest integers which, when multiplied, equal the input

余生颓废 提交于 2019-12-03 20:59:53
问题 Ok my problem is of mathematical nature. I have an array of bytes whose length is X, i need to find the two closest numbers which multiplied together equal X. I need to do this because i am bulding a bitmap from an array of bytes and i need to make the bitmap look like a square as much as possible. I am coding this in C# but don' t worry about syntax, any algorithm or pseudo-code will do. Thanks in advance for your help 回答1: There's probably a better algorithm for this, but off the top of my

Converting NSString to NSData and vice versa

爷,独闯天下 提交于 2019-12-03 19:52:20
问题 I am having an issue while trying to convert NSString to NSData and vice versa. I am trying to store encrypted string to my database. For that I am using AES algorithm. Now what I am doing is I get encrypted NSData and I am converting this to NSString using following: // Not woking NSString *strTemp = [[NSString alloc] initWithData:encData encoding:NSUTF8StringEncoding]; // Working NSString *strTemp = [[NSString alloc] initWithData:encData encoding:NSASCIIStringEncoding]; Why NSData is not

Python: Convert string (in scientific notation) to float

六眼飞鱼酱① 提交于 2019-12-03 19:20:54
问题 I'm trying to import a large .csv file containing text and numbers using genfromtxt in numpy. I'm only interested in two columns. I have most of the import sorted out with: def importfile(root): data = root.entry.get() atw = np.genfromtxt(data, delimiter=",", skip_header=1, skip_footer=2, autostrip=True, usecols=(25,26), dtype=("|S10")) elem = atw[:,0] concs = atw[:,1] print(elem) print(concs) With output for elem and concs respectively: ['Na2O' 'MgO' 'Al2O3' 'SiO2' 'P2O5' 'SO3' 'Cl' 'K2O'

How to get the original python data from QVariant

主宰稳场 提交于 2019-12-03 16:32:04
问题 I am just learning python and Qt these days. So please consider that this will be a newbie question, but I am stuck here. import sys from PyQt4.QtCore import * data1 = 'string' data2 = QVariant(data1) data3 = data2.toPyObject() I expected data3 is the same as data1, 'string'. However in my system data3 is PyQt4.QtCore.QString(u'string') It is not a big deal if the data I want to handle is simple like example, but I want to handle 'dict' type data so I need to fix this problem. I think this is

RTF Format in Web Text Editor

拟墨画扇 提交于 2019-12-03 15:45:34
Is there a text editor on the web that supports input from RTF-formatted documents? I know it is a bit of an odd request for webdev, but I need to read RTF documents from the database and edit them in a web-based text editor and store it back in RTF. Before I invest too heavily in a conversion tool, I thought I would ask if any of the many web text editors supported RTF. My research is showing that they don't. Additionally, since this is an MVC 4.6 application, would it be a huge effort to write a two-way RTF-HTML conversion tool in C#? Sample input that would be received by the editor: "{

How to improve Dart performance of data conversion to/from binary?

淺唱寂寞╮ 提交于 2019-12-03 07:08:36
问题 Doing some consulting work for a bigger German companies Future Technologies Group I have ported about 6000 lines of Java server side software to Dart. This should help to answer the question whether Dart can efficiently be used on the server. (Which itself would give a green light for Dart due to the searched for advantage of having one language for client and server side programming.) Learning about Dart (which I really enjoyed working with) gave me an expectation of a performance penalty

How to get the original python data from QVariant

三世轮回 提交于 2019-12-03 05:46:19
I am just learning python and Qt these days. So please consider that this will be a newbie question, but I am stuck here. import sys from PyQt4.QtCore import * data1 = 'string' data2 = QVariant(data1) data3 = data2.toPyObject() I expected data3 is the same as data1, 'string'. However in my system data3 is PyQt4.QtCore.QString(u'string') It is not a big deal if the data I want to handle is simple like example, but I want to handle 'dict' type data so I need to fix this problem. I think this is encoding problem, but can't find how to fix it. *In every document I am declaring that: #-*- coding:

PHP decrypting data with RSA Private Key

我的梦境 提交于 2019-12-02 21:19:05
问题 I have a program that encrypts passwords using a c# rsa public key which outputs a byte array. In order for me to transport it easily and maintain data I am converting the bytes directly to a Hex string. Now this is where I am having issue. I send the post data to my script and am now unsure what to convert it to and how to decrypt it. I am attempting to use http://phpseclib.sourceforge.net/ which I was pointed to by this post RSA decryption using private key The documentation on this is very

Converting COMP-3 columns in Mainframes to readable format using Record Editor tool

为君一笑 提交于 2019-12-02 17:07:37
问题 This is the file which we received as Binary from Mainframes which includes COMP-3 columns as well along with other columns And when we tried loading this Binary file into Record Editor, It is displaying Special Characters Kindly let us know step by step process from Starting to Ending on How to process COMP-3 columns and load into Record Editor. 回答1: So what have you tried ???, In the last question I suggested: You will have to update RecordEditor/JRecord The font will need to be ebcdic

Converting data from .csv file to .json - Python

試著忘記壹切 提交于 2019-12-02 04:18:11
I need to convert data from my csv file to the one i am gonna use which is .js . Lp.;Name;Surname;Desc;Unit;Comment 1;Jan;Makowski;Inf;km; 2;Anna;Nowak;Pts;km;Brak reakcji If you can see column 'comment' does not always have record and I need to keep it that way. Also between data there is amount of tabs I need to set as well. I've a file,i am working on right now but It show's me data in row like : [{"Lp.;Name;Surname;Desc;Unit;Comment": "1;Jan;Makowski;Inf;km;"}, {"Lp.;Name;Surname;Desc;Unit;Comment": "2;Anna;Nowak;Pts;km;Brak reakcji"...] I am new to python and I have no idea how to define