I want to transform binary data in string
Hello
I want to convert a binary array of 10 Ai channel into a n array of double in order to be converted in spreadsheet files. I have try everything i could have understood with the LV Help and the NI site but anything is working right . So i have put you my code if you can take a look and tell me why when i simulte a sinus wave and save it in binary file i ca nfind the same wave after transformation in spreadsheet file.
There is to code ( one with one AI channel and another with just an array ) both are save in binary data and after you use the tird VI to converts the files in spreadsheet format .
Thank you if you could help . I f it possible answer me quickly because i'm in hurry but any answer will be he
lpful so thank you !
Attachments:
Save_&_transform_binary_data.llb 99 KB
Hi Romain.
In your DAQ vi, you are writing file essai.dat as
1D array of I16 (1 array per scan)
When reading it, you try to read data as DBL, and that is not correct.
There are different choices. The easiest one: use high level vi to read I16 data as 2D array.
I tested for 5 channels and it works.
Don´t know your Lv version, so see attached doc.
Hope it helps
Alipio
"Qod natura non dat, Salmantica non praestat"
Attachments:
convert.doc 47 KB
Similar Messages
-
Best way to put binary-data into string?
Hi there!
What I want to do is to transfer binary data via HTTP/GET so what I have to do is to transfer binary data into a string.
Currently I do this the follwing way:
byte[] rawSecData = new byte[4]; //any binary datas
ByteArrayOutputStream secBOS = new ByteArrayOutputStream(4);
DataOutputStream secDOS = new DataOutputStream(secBOS);
for(int i=0; i < rawSecData.length; i++)
secDOS.writeByte(rawSecData);
secDOS.flush();
String secData = secBOS.toString();
System.err.println("Lenght of resulting String: "+secData.length());
I know that this way already worked fine, however I now set up my system up again with another linux-distro and now strange things happen.
e.g. the secData string differs in lenght from run-to-run between 2 and 4 and I don know at all why?
Transferring the binary-stuff into string-stuff (e.g. short-binary 255 255, String: 65536) is not possible for me because of various reasons.
The funny thing is that I remeber that this already worked some time ago and I can figure out why it now doesnt...
Please help!First of all thanks a lot for your help!
Yes, I already think its an encoding problem, but how can I specify the encoding in my application in a portable way. I dont have an idea what to do.
My applikation should run as applet on many different 1.1+ VMS (msjvm, netscape-1.1.5, ...).
Thanks again, lg Clemens -
Convert Binary Data to string in MsSQL
Hello,
I am running a query for MSSQL database to get some file content which is stored in Binary data format in the database.
I want to copy that file which is in the binary data format to a file in the text format.
How can I do this?
Regards,
SravanthiThis is the expected result in the file that stores the data.
ResultElement
WshOutputTest
Errors/Failures
1 / -
Incident
Error: some unexpected result
function main()
some additional info; eg. stacktrace
Incident
Warning: some warning message
function main()
some additional info; eg. stacktrace
But I am getting the following stored in my file:::
PK FSH;
output.xmlíT»NÃ@8¥
*Æ)xH) R[ñÅ9AìȾðøy`nÏs1nBY>_vvfÊÏw>±ÄÞ¡Q¢AWà§8ãWÉ1£=%#ôÜá^ü5BC ½+¬©iqËSSßñ-u&Yù:»ÓÒ²À#+9¯A©øDÔ*ù|¯y®E1fôìåNËëì»ü~¼ÕK{ ·0ßKÖ2ÞbÞ*
*©\fW<gRyJk¹Ñ'Ã6?T¦ÍOÈÐÿx[³cwñCÌRÛ0^y¼éù}.y»|ýF(ÚéÐ%fÓÕu]¿Ùõ§§WNdÿLíy)ûq÷¨'ÌáßRnZ"·ªaÃ:ÎßóûÏl?ÍQbm=wk¸ûÙî>[ôÿy_PKÙõ¡¬N PK FSH;Ùõ¡¬N *
*output.xmlPK 8 *
I tried getting the Binary Stream with UTF-8 encoding style and no encoding style too but it didnt work.
Thanks,
Sravanthi. -
Hi,
I am new for ALSB and I have problem with it.
How can I transform binary Data to xml. The binary datas are in a directory and after mapping to xml, I want them to have in other directory or in Oracle DB.
With Query tool I created binary_to_XML.xq file but can't use it in ALSB.
ALSB passes the files with out mapping?!
Thanks,
EmulateThe ALSB forum is http://forums.bea.com/bea/category.jspa?categoryID=600000003
-
Hi,
I want to convert binary value to string format. How can i do that if possible please give me sample code.?
One more question is i want to do reverse thing also that is convert string value to binary format.?
Waiting for replyThere are methods in Integer, Long etc for transforming to binary.
I think there are probably also methods to go from binary to an int. Check out the JavaDoc -
How can I transfer binary data from a database to another database?
Hi all.
I want to transfer binary data from a MS SQL Server 2000 to anohter SQL Server 2000.
I created JDBC(table) to JDBC(stored procedure) scenario,and
I uploaded a JPG image file to the sender table using the java program I developed.
The JPG data was transfered to receiver,but the transfered data was broken.
I can't not open the file correctly.
Can XI transfer binary data using JDBC adapter?
The sender table structure is following.
<b>column (data type)</b>
id (int 4)
binary (binary 8000)
flag (int 4)
The receiver stored procedure parameter is following.
<b>parameter (data type)</b>
id (smallint)
binary (binary 8000)
flag (smallint)
Regards.
YuukiHi,
<i>Can XI transfer binary data using JDBC adapter?</i>
Ans: Yes
Supported JDBC Types
http://help.sap.com/saphelp_nw04s/helpdata/en/16/9dc9ac8bc72a48b80e639abaa2e497/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
Mapping JDBC types to Java types
http://help.sap.com/saphelp_nw04/helpdata/en/7d/79dfa72d1049bc963f4f272bb1638e/frameset.htm
Regards,
Prateek -
Loading large volumes of arbitrary binary data to a clip
It is easy to download external data in XML format to a movie
clip. However, what I need is to load really large volumes of
readonly binary data. In my case, textual representation is not an
option. Is it possible to download an arbitrary array of bytes into
memory then seek this array to read individual bytes?
I don't think that ActionsScript arrays like this one
var data:Array = [1,2,3,...];
could be solution fro my problem either. The reason is that
virtual machine associates so much extra information with every
array member.
The only solution I came so far is to pack binary data as
strings,
var data:String = "\u0000\u1234\uabcd";
two byte per character. There should not be any storage
overhead, and seeking for an individual data member is trivial.
But I doubt is there any better solution?For as2 I don't believe there's any other option other than
to load it in as an encoded string and then decode it internally.
So if you have \u0000 as in the above example you will find it
doesn't work.
var data:String = "\u0000\u1234\uabcd";
trace(data.length) //traces 0 (zero) because the first
character is a string terminator
I think you need an encoding method like base64 in the source
string and an equivalent decoder class for decoding to binary
inside flash. I'm not expert on this stuff... others may know more
or it could be a starting point for your research.
In the past I've used the meychi.com classes for this type of
thing. Couldn't see them online now... but there's something else
here that may be useful:
http://www.svendens.be/blog/archives/8
With as3 - as I understand it - there's no problem because
you can load binary data. -
Hi all,
I have a simple question. I want to reproduce the SET data types (mysql) in Oracle. So I want assign a binary value to a column. I create a column with CHAR(1) type and I want assign for example 00000010 binary value.
It's possible ?
Thanks in advance2) RAW data type is not present in express edition. And I use it for migration testing...Why do you believe that the RAW data type isn't present in the express edition? The UTL_RAW package is included in the express edition and I'm not finding any obvious documentation indicating that RAW columns aren't supported in the express edition.
3) In certain case, I need to store approximately 60 elements. That's why I want to use binary data type. It reduce space to 8 bytes.Unless we're talking about a table with billions of rows, is a difference of at most 52 bytes per row really going to make a difference? Particularly given the extra overhead of doing the binary comparisons? And 52 bytes is an upper limit, since trailing NULL values don't require any storage space
http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/schema.htm#sthref735
Plus, 60 separate flag columns will be a heck of a lot easier for future reporting tools to handle rather than having everyone try to decode the values. And you can use bitmap indexes, regular indexes, etc much more easily.
Justin -
How to set a string input to accept only 1 and 0 (binary data)
Hi
I want to write a program that is supposed to take only binary data from the user. So I put a string control onto the front panel, wanting the user to be able to only type 1 or 0 in it. Is there a way to do that?
ThanksJean-Pierre Drolet wrote:
Another slight flaw is that the string accepts Enter for a new line. It is easily fixed by setting it to "Limit to single line".
True, it allows any non-ASCII through. Another solution would be to use some logical combination of VKey and Char, but it could get complicated. One of the simpler ways is the use of scancode and shift, as in the attached modification. Now ENTER, etc. is also discarded.
I also agree that none of this seems appropriate to enter 4000 "0/1" characters on a fromt panel.
LabVIEW Champion . Do more with less code and in less time .
Attachments:
BinaryStringControl_III.vi 24 KB -
Extracting strings from binary data
Hello,
I am trying to extract string from a binary file.
At the unix command line (sunos) I can just type;
strings <filename>
This is a nice way to get a list of the contents of a directory.
Is there a way in pl/sql to extract strings from binary data ? An equiv to strings on unix/linux ?
Thanks in advance.
BenHi,
If you do want to list the contents of a directory, there are other ways to do it. Here's a base implementation of a utility I wrote:
create or replace and resolve java source named "Util" as
import java.io.*;
import java.sql.*;
import oracle.sql.*;
import oracle.jdbc.driver.*;
public class Util {
public static void listFiles(String directory, oracle.sql.ARRAY[] names)
throws IOException, SQLException {
File f = new File(directory);
if(f==null)
throw new IOException("Directory: "+directory+" does not exist.");
String[] files = f.list(
new FilenameFilter() {
public boolean accept(File dir, String name) {
// List all files
return true;
Connection conn = new OracleDriver().defaultConnection();
ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor("VC_TAB_TYPE", conn);
names[0] = new ARRAY(descriptor, conn, files);
return;
create or replace type vc_tab_type is table of varchar2(255);
create or replace package util authid current_user as
function list_files(p_directory in varchar2)
return vc_tab_type;
end;
create or replace package body util as
procedure list_files (
p_directory in varchar2
, p_filenames out nocopy vc_tab_type
is
language java
name 'Util.listFiles(java.lang.String, oracle.sql.ARRAY[])';
function list_files(p_directory in varchar2) return vc_tab_type
is
l_filenames vc_tab_type := vc_tab_type();
begin
list_files(p_directory, l_filenames);
return l_filenames;
end;
end;
/You can then query the filesystem as follows:
1 select column_value as filename
2 from table(util.list_files('c:\windows'))
3 where column_value like '%.log'
4* and rownum <= 10
SQL> /
FILENAME
0.log
AdfsOcm.log
aspnetocm.log
bkupinst.log
certocm.log
chipset.log
cmsetacl.log
comsetup.log
DtcInstall.log
FaxSetup.log
10 rows selected.cheers,
Anthony -
I want to transform an object into a XML-String
Hallo,
in my BSP I want to transform an object into a xml string to set a server side cookie.
Therefore my code is:
DATA:
lv_xml TYPE string,
lv_username TYPE string.
model ?= get_model( model_id = 'main' ).
lv_username = sy-uname.
Call TRANSFORMATION id SOURCE o = model RESULT XML lv_xml.
cl_bsp_server_side_cookie=>set_server_cookie(
name = 'MODEL'
application_name = runtime->application_name
application_namespace = runtime->application_namespace
username = lv_username
session_id = runtime->session_id
data_value = lv_xml
data_name = 'MODEL'
expiry_time_rel = 3600 ).
But after the command "Call Transformation" the xml-string doesn't contain all the data of my object, only this:
<?xml version="1.0" encoding="iso-8859-1"?>#<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"><asx:values><O href="#o19"/></asx:values><asx:heap xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:abap="http://www.sap.com/abapxml/types/built-in" xmlns:cls="http://www.sap.com/abapxml/classes/global" xmlns:dic="http://www.sap.com/abapxml/types/dictionary"> <cls:ZCL_M_ESS_TRV_OVW id="o19"/
></asx:heap></asx:abap>
What is wrong?
Regards.
Martinsee thread nr.: Re: Call transformation with an object
-
I am facing a strange SQL exception:-
The code flow is like this:
.Net 4.0 --> Entity Framework --> SQL 2008 ( StoredProc --> Function {Exception})
In the SQL Table-Valued Function, I am selecting a column (nvarchar(50)) from an existing table and (after some filtration using inner joins and where clauses) inserting the values in a Table Type Object having a column (nvarchar(50))
This flow was working fine in SQL 2008 but now all of sudden the Insert into @TableType is throwing "string or binary data would be truncated" exception.
Insert Into @ObjTableType
Select * From dbo.Table
The max length of data in the source column is 24 but even then the insert statement into nvarchar temp column is failing.
Moreover, the same issue started coming up few weeks back and I was unable to find the root cause, but back then it started working properly after few hours
(issue reported at 10 AM EST and was automatically resolved post 8 PM EST). No refresh activity was performed on the database.
This time however the issue is still coming up (even after 2 days) but is not coming up in every scenario. The data set, for which the error is thrown, is valid and every value in the function is fetched from existing tables.
Due to its sporadic nature, I am unable to recreate it now :( , but still unable to determine why it started coming up or how can i prevent such things to happen again.
It is difficult to even explain the weirdness of this bug but any help or guidance in finding the root cause will be very helpful.
I also Tried by using nvarchar(max) in the table type object but it didn't work.
Here is a code similar to the function which I am using:
BEGIN
TRAN
DECLARE @PID
int = 483
DECLARE @retExcludables
TABLE
PID
int NOT
NULL,
ENumber
nvarchar(50)
NOT NULL,
CNumber
nvarchar(50)
NOT NULL,
AId
uniqueidentifier NOT
NULL
declare @PSCount int;
select @PSCount =
count('x')
from tblProjSur ps
where ps.PID
= @PID;
if (@PSCount = 0)
begin
return;
end;
declare @ExcludableTempValue table (
PID
int,
ENumber
nvarchar(max),
CNumber
nvarchar(max),
AId
uniqueidentifier,
SIds
int,
SCSymb
nvarchar(10),
SurCSymb
nvarchar(10)
with SurCSymbs as (
select ps.PID,
ps.SIds,
csl.CSymb
from tblProjSur ps
right
outer join tblProjSurCSymb pscs
on pscs.tblProjSurId
= ps.tblProjSurId
inner join CSymbLookup csl
on csl.CSymbId
= pscs.CSymbId
where ps.PID
= @PID
AssignedValues
as (
select psr.PID,
psr.ENumber,
psr.CNumber,
psmd.MetaDataValue
as ClaimSymbol,
psau.UserId
as AId,
psus.SIds
from PSRow psr
inner join PSMetadata psmd
on psmd.PSRowId
= psr.SampleRowId
inner join MetaDataLookup mdl
on mdl.MetaDataId
= psmd.MetaDataId
inner join PSAUser psau
on psau.PSRowId
= psr.SampleRowId
inner
join PSUserSur psus
on psus.SampleAssignedUserId
= psau.ProjectSampleUserId
where psr.PID
= @PID
and mdl.MetaDataCommonName
= 'CorrectValue'
and psus.SIds
in (select
distinct SIds from SurCSymbs)
FullDetails
as (
select asurv.PID,
Convert(NVarchar(50),asurv.ENumber)
as ENumber,
Convert(NVarchar(50),asurv.CNumber)
as CNumber,
asurv.AId,
asurv.SIds,
asurv.CSymb
as SCSymb,
scs.CSymb
as SurCSymb
from AssignedValues asurv
left outer
join SurCSymbs scs
on scs.PID
= asurv.PID
and scs.SIds
= asurv.SIds
and scs.CSymb
= asurv.CSymb
--Error is thrown at this statement
insert into @ExcludableTempValue
select *
from FullDetails;
with SurHavingSym as (
select distinct est.PID,
est.ENumber,
est.CNumber,
est.AId
from @ExcludableTempValue est
where est.SurCSymb
is not
null
delete @ExcludableTempValue
from @ExcludableTempValue est
inner join SurHavingSym shs
on shs.PID
= est.PID
and shs.ENumber
= est.ENumber
and shs.CNumber
= est.CNumber
and shs.AId
= est.AId;
insert @retExcludables(PID, ENumber, CNumber, AId)
select distinct est.PID,
Convert(nvarchar(50),est.ENumber)
ENumber,
Convert(nvarchar(50),est.CNumber)
CNumber,
est.AId
from @ExcludableTempValue est
RETURN
ROLLBACK
TRAN
I have tried by converting the columns and also validated the input data set for any white spaces or special characters.
For the same input data, it was working fine till yesterday but suddenly it started throwing the exception.Remember, the CTE isn't executing the SQL exactly in the order you read it as a human (don't get too picky about that statement, it's at least partly true enough to say it's partly true), nor are the line numbers or error messages easy to read: a mismatch
in any of the joins along the way leading up to your insert could be the cause too. I would suggest posting the table definition/DDL for:
- PSMetadata, in particular PSRowID, but just post it all
- tblProjectSur, in particularcolumns CSymbID and TblProjSurSurID
- cSymbLookup, in particular column CSymbID
- PSRow, in particular columns SampleRowID, PID,
- PSAuser and PSUserSur, in particualr all the USERID and RowID columns
- SurCSymbs, in particular colum SIDs
Also, a diagnostic query along these lines, repeat for each of your tables, each of the columns used in joins leading up to your insert:
Select count(asurv.sid) as count all
, count(case when asurv.sid between 0 and 9999999999 then 1 else null end) as ctIsaNumber
from SurvCsymb
The sporadic nature would imply that the optimizer usually chooses one path to the data, but sometimes others, and the fact that it occurs during the insert could be irrelevant, any of the preceding joins could be the cause, not the data targeted to be inserted. -
i have a string 2012-05-22T23:23:42.263-07:00. so i want to convert in date with indian time zone can any one help me out
What does this have to do with iPhone tech support?
-
Hello,
I have scenario where I need to transform a date string in SQL (from "yyyy-mm-dd" to "dd/mm/yyyy"):
E.g My table EMPTABLE looks like this
EMPNO STARTDATE(string)
1111 2000-11-30
2222 1998-01-22
I need an output of
EMPNO STARTDATE(string)
1111 30/11/2000
2222 22/01/1998
I know that we can user "to_date" and "to_char" functions to do that. The query would look like:
SELECT EMPNO as EMPNO, to_char(to_date(STARTDATE,'yyyy-mm-dd'),'mm/yy/dddd') as STARTDATE from EMPTABLE;
Are there any other ways to achive this? Like just using string manipulation.
Why I'm asking with the above query if there is any data discrepancy (e.g for one record the month value is 25 by mistake), the query fails.
Any help is appreciated.
Thanks.
Edited by: kIDMan on Nov 20, 2009 7:29 AMHi,
Welcome to the forum!
A lot of folks store dates in DATE columns; then it just takes one TO_CHAR call to get them in any format, and invalid data is impossible.
You can use SUBSTR to extact parts of the string, and || to re-assemble them in a different order.
Starting in Oracle 10, you can also use regular expressions, like this:
, REGEXP_REPLACE ( startdate
, '([0-9]{4})-' || -- \1 = year
'([0-9]{2})-' || -- \2 = month
'([0-9]{2})' -- \3 = day
, '\3/\2/\1'
) AS startdate_dmyIf startdate does not contain the pattern (4 digits, hyphen, 2 digits, hyphen, 2 digits), the the expression above will return startdate unchanged.
Edited by: Frank Kulash on Nov 20, 2009 1:11 PM -
Synch Error: String or binary data would be truncated.
I kicked off an inital synch for WebTools 2007 (may also be an issue in 596) and I had 1 synch error for SBOPartner:
String or binary data would be truncated.
The statement has been terminated.
at netpoint.api.data.DataFunctions.Execute(String SQL, IDataParameter[] parameters, String connectionstring)
at netpoint.api.NPBase.MarkSynched(String SynchID)
at NetPoint.SynchSBO.SBOObjects.SBOPartner.SBOToNetPoint(SBOQueueObject qData)
at NetPoint.SynchSBO.SynchObjectBase.Synch()
I traced the sql log and found the problem was related to addresses. The synchid only allows 50 characters but my synchid was 51 characters (COMINF, Communication Infrastructure Corporation, S). Anyway, to fix I modified the table to allow 100 characters and reran the synch. I know an upgrade will set it back to 50 but at least it's working now.
I tried to post this to support as a bug but I couldn't figure out how (as usual) or the authorization stuff changed so I figured I would post it here so hopefully the devs will see this and update the code.
SteveThanks Shawn ... My version of Netpoint is 2007.0.620.0 and the synch manager is 2007.0.620.35247. I'm not sure what patch level this means I am on though.
Steve
Maybe you are looking for
-
Problem with USB travel keyboard on Windows 7 (some letters become a number)
Hi I have an USB Travel Keyboard with trackpoint and touchpad. Have used for years in XP. Now I have bought a new computer, using Windows 7 and Asus P6X58D Premium motherboard. After installing Windows 7 I noticed that when I press some keys I get a
-
i am about to embark on an ambitious project. i want to create a document server that can archive documents such as word, pdfs etc. i would also like to create a feature by which users can compare documents to find how similar they are. how do i go a
-
Does anyone know if there are any code snipits that will close acrobat reader after a print job? I know that 4.0 closes itself, but 5.0 stays open. Any help would be great!
-
Product Code Layou modified?
Hello, I bought yesterday a brand new Nokia N73 here in Brazil. When checking Product Code below the battery I found a string 0539717KN01P4 which is 6 characters longer than the ones I found in my N80 and E61 and has letters, which I never found. Wha
-
Hi, I m creating a report and i have to pick IR related values from EKBE table, but when it's credit memo, I have to show it with negative amount in my report. How to find out that particular invoice is a credit memo. Pls let me know if there any fla