Find logo from binary or hex string
HI All ,
I have file 2 strings one with HEX and one binary this to string is contain the value
for attachment (logo) ,which FM or method i should use to see the logo, the picture itself ?
Regards
James
Edited by: James Herb on Feb 28, 2010 5:32 PM
Hi James,
This methods and function modules should work for you.
CALL METHOD cl_binary_relation=>read_links_of_binrel
EXPORTING
is_object = is_object
ip_relation = 'ATTA'
IMPORTING
et_links = et_links.
catch
cx_obl_parameter_error into icx_obl_parameter_error.
exception_string = icx_obl_parameter_error->get_longtext( ).
catch cx_obl_internal_error into icx_obl_internal_error .
exception_string = icx_obl_internal_error->get_longtext( ).
catch
cx_obl_model_error into icx_obl_model_error.
exception_string = icx_obl_model_error->get_longtext( ).
ENDTRY.
SORT et_links BY utctime.
LOOP AT et_links INTO et_links_s.
v_tbx = sy-tabix.
document_id = et_links_s-instid_b.
CALL FUNCTION 'SO_DOCUMENT_READ_API1'
EXPORTING
DOCUMENT_ID = document_id
FILTER = 'X '
IMPORTING
DOCUMENT_DATA = document_data
TABLES
OBJECT_HEADER = object_header
OBJECT_CONTENT = object_content
OBJECT_PARA =
OBJECT_PARB =
ATTACHMENT_LIST =
RECEIVER_LIST =
CONTENTS_HEX =
EXCEPTIONS
DOCUMENT_ID_NOT_EXIST = 1
OPERATION_NO_AUTHORIZATION = 2
X_ERROR = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP.
Similar Messages
-
How could I choose some bytes from HEX string and then convert it to a decimal value?
Hi I am working with an OMRON E5EN temperature controller using VISA serial to get data, I send the Read from Variable Area command and get this string in hexa 0230 3130 3030 3030 3130 3130 3030 3030 3030 3030 3041 3203 71 or .01000001010000000000A2.q in ASCII this string means:
02 STX
3031 3030 Node and subadress
3030 End Code Normal Completion
3031 3031 Command Read from Variable Area
3030 3030 respt code Normal completion
3030 3030 3030 4132 Hexadecimal A2 = 162 (this is the temperature data that I want to show in decimal)
03 ETX
71 Block Check Character
I want to choose the eight bytes for the temperature data and convert it to a decimal number. I have seen the examples to convert a Hexa string to decimal but I do not know how to choose the specifics bytes that I need.
I have look for a driver but i didn´t find any. I am a beginner so please include especific topics for me to study in your answer.
Thanks
Carlos Fuentes Silva Queretaro MexicoIf the response always has the temperature starting with byte 15 and is always 8 bytes in length, you can use the String Subset function to get those bytes out of the string. Then use Hex String to Number to convert to a decimal number.
Well someone already beat me to the solution:
Message Edited by tbob on 01-04-2008 04:42 PM
- tbob
Inventor of the WORM Global
Attachments:
HexStr2Decimal.png 7 KB -
Hi All,
I believe I have configured MAX correctly. I am trying to use the PXI-6229 device via. When I try initialized I receive the following error:
Primary Error: (Hex 0xBFFA003D) Unable to find any channel or repeated capability strings.
Any clues on what the error means?
Thanks
Minesh
Solved!
Go to Solution.First of all you'll get more help in the correct forum. This seems like a DAQmx issue and their forum is here: http://forums.ni.com/t5/Multifunction-DAQ/bd-p/250
Secondly does this help: http://forums.ni.com/t5/Switch-Hardware-and-Software/NI-SwitchExec-with-3499-and-IVIDriver/td-p/1827...
Lastly: Can you communicate with the card from MAX? Or is the error happening in MAX? What language are you using to talk to the card with? Are you using IVI? If you are using LabVIEW or CVI then open the shipping examples and test them out with that card.
Regards,
jigg
CTA, CLA
teststandhelp.com
~Will work for kudos and/or BBQ~ -
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 -
Scan arrays from binary string
I have TCP connection that is sending a great number of fixed size arrays that I need to convert. Is there a simpler way to do that than the one I have attached?
Attachments:
Scan from binary string.vi 16 KBSorry, I didn't write my question clear enough.
I know how to do TCP data transfer. I also know how to unflatten the binary string back to data, but I was hoping there was a clearer way to do it than the way I suggested. For scalar values one can make a cluster containing the data in the binary string and only one "unflatten from string" is needed.
However, if the binary string is composed of arrays (even though they are fixed in size) I need one unflatten string for each array. In my case I have many small arrays. The attached example with only three arrays was only to illustrate what I wanted to do.
I have now found a way using a cluster of clusters. I don't know if this is the ideal way of doing this, but it works, and when enabling "view cluster as icon" I can make the code much more compact and easier to read
Attachments:
2012-07-04_120216.jpg 385 KB -
Finding substring from string.
I'll have to find substring from another string. Substring to find can be example: CVB and the string can be example ACHGVNB.
Give me some hints about what methods I should use.Like this:public class Test {
public static void main (String[] parameters) {
String sub;
String text;
if (parameters.length == 2) {
sub = parameters[0];
text = parameters[1];
} else {
sub = "levi_h";
text = "l e v i _ h";
System.out.println (isSub (sub, text));
private static boolean isSub (String sub, String text) {
int s = 0;
int t = 0;
while ((s < sub.length ()) && (t < text.length ())) {
if (sub.charAt (s) == text.charAt (t)) {
s ++;
t ++;
return s == sub.length ();
}Kind regards,
Levi -
Conversion from hex string to bytes withh out ascii
how to convert hex string to byte numbers without ascii codes,then all the converted bytes should come into a packets
rajkumar5 wrote:
how to convert hex string to byte numbers without ascii codes,then all the converted bytes should come into a packets
What people consider ASCII and Hex with strings varies so much, you pretty much need to supply an example. The best way is to create a VI with default data in the string control and indicator (to show what you want out). -
Help with binary to decimal, binary to hex, and hex to ascii or ascii to hex program
I decided to do a program that will do binary to decimal, binary to hex, and hex to ascii for a project related to a java programming course, which only needs to perform features from chapters 1-6 and 8 of Tony Gaddis's book. The functions work fine as their own main programs out side of this combined effort, so can anyone help me determine why I get the following 41 errrors saying: class, interface, or enum expected as well as any other errors that may show up afterwards because I'm stumped. My flowcharts, which have to be revised after discovering that my previous function were logically incorrect after running them in their own main are attached below as the spec sheet.
My code is as follows and I hope you don't mind the commented lines of unused code because I'm not sure where I want things and what I want at the moment:
import java.util.Scanner;
import java.io.*;
import java.lang.*;
public class BintoDectoHextoAscii
public static void main(String[] args)throws IOException
Scanner input = new Scanner(System.in);
System.out.println("Enter a binary number: ");
String binary = input.nextLine(); // store input from user
if (binary == input.nextLine())
//int i= Integer.parseInt(hex,2);
//String hexString = Integer.toHexString(i);
//System.out.println("Hexa decimal: " + hexString);
//int finaldecimalvalue = binaryToDecimal(hexString);
int finaldecimalvalue = binaryToDecimal(hexString);
if (binary != input.nextLine())
String hexInput; // The variable Bin Input declared as the datatype int to store the Binary value
// Create a Scanner object for keyboard input.
//Scanner keyboard = new Scanner(System.in);
// Get the number of binary files.
System.out.print("Enter the Hex value: ");
hexInput = keyboard.nextLine();
System.out.println("Original String: "+ hexInput);
//String hexEquivalent = asciiToHex(demoString);
String hexEquivalent = asciiToHex(hexInput);
//Hex value of original String
System.out.println("Hex String: "+ hexEquivalent);
String asciiEquivalent = hexToASCII(hexEquivalent);
//ASCII value obtained from Hex value
System.out.println("Ascii String: "+ asciiEquivalent);String finalhexOutput = HextoAsciiConverter(hexEquivalent);
if (binary != input.nextLine() && hexInput != keyboard.nextLine())
BufferedReader binInput = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the Binary number:");
String hex = binInput.readLine();
//String finaldecimalvalue = binaryToDecimal(decimal);
//long finalhexvalue = BinaryToHexadecimal(num);
long finalhexvalue = BinaryToHexadecimal();
public static String BinaryToHexadecimal(String hex)
//public static void main(String[] args)throws IOException
//BufferedReader bf= new BufferedReader(new InputStreamReader(System.in));
//System.out.println("Enter the Binary number:");
//String hex = binInput.readLine();
long num = Long.parseLong(hex);
long rem;
while(num > 0)
rem = num % 10;
num = num / 10;
if(rem != 0 && rem != 1)
System.out.println("This is not a binary number.");
System.out.println("Please try once again.");
System.exit(0);
int i= Integer.parseInt(hex,2);
String hexString = Integer.toHexString(i);
System.out.println("Hexa decimal: " + hexString);
return num.tolong();
//int i= Integer.parseInt(hex,2);
//String hexString = Integer.toHexString(i);
//System.out.println("Hexa decimal: " + hexString);
//} // end BintoDectoHextoAsciil
//public static String HexAsciiConverter(String hextInput)
// Get the number of binary files.
//System.out.print("Enter the Hex value: ");
//hexInput = keyboard.nextLine();
//System.out.println("Original String: "+ hexInput);
//String hexEquivalent = asciiToHex(demoString);
//String hexEquivalent = asciiToHex(hexInput);
//Hex value of original String
//System.out.println("Hex String: "+ hexEquivalent);
//String asciiEquivalent = hexToASCII(hexEquivalent);
//ASCII value obtained from Hex value
//System.out.println("Ascii String: "+ asciiEquivalent);
//} // End function
private static String asciiToHex(String asciiValue)
char[] chars = asciiValue.toCharArray();
StringBuffer hex = new StringBuffer();
for (int i = 0; i < chars.length; i++)
hex.append(Integer.toHexString((int) chars[i]));
return hex.toString();
private static String hexToASCII(String hexValue)
StringBuilder output = new StringBuilder("");
for (int i = 0; i < hexValue.length(); i += 2)
String str = hexValue.substring(i, i + 2);
output.append((char) Integer.parseInt(str, 16));
return output.toString();
public static String binaryToDecimal(String binary)
//Scanner input = new Scanner(System.in);
//System.out.println("Enter a binary number: ");
//String binary = input.nextLine(); // store input from user
int[] powers = new int[16]; // contains powers of 2
int powersIndex = 0; // keep track of the index
int decimal = 0; // will contain decimals
boolean isCorrect = true; // flag if incorrect input
// populate the powers array with powers of 2
for(int i = 0; i < powers.length; i++)
powers[i] = (int) Math.pow(2, i);
for(int i = binary.length() - 1; i >= 0; i--)
// if 1 add to decimal to calculate
if(binary.charAt(i) == '1')
decimal = decimal + powers[powersIndex]; // calc the decimal
else if(binary.charAt(i) != '0' & binary.charAt(i) != '1')
isCorrect = false; // flag the wrong input
break; // break from loop due to wrong input
} // end else if
// keeps track of which power we are on
powersIndex++; // counts from zero up to combat the loop counting down to zero
} // end for
if(isCorrect) // print decimal output
System.out.println(binary + " converted to base 10 is: " + decimal);
else // print incorrect input message
System.out.println("Wrong input! It is binary... 0 and 1's like.....!");
return decimal.toint();
} // end function
The errors are as follows:
----jGRASP exec: javac BintoDectoHextoAscii.java
BintoDectoHextoAscii.java:65: error: class, interface, or enum expected
public static String BinaryToHexadecimal(String hex)
^
BintoDectoHextoAscii.java:73: error: class, interface, or enum expected
long rem;
^
BintoDectoHextoAscii.java:74: error: class, interface, or enum expected
while(num > 0)
^
BintoDectoHextoAscii.java:77: error: class, interface, or enum expected
num = num / 10;
^
BintoDectoHextoAscii.java:78: error: class, interface, or enum expected
if(rem != 0 && rem != 1)
^
BintoDectoHextoAscii.java:81: error: class, interface, or enum expected
System.out.println("Please try once again.");
^
BintoDectoHextoAscii.java:83: error: class, interface, or enum expected
System.exit(0);
^
BintoDectoHextoAscii.java:84: error: class, interface, or enum expected
^
BintoDectoHextoAscii.java:87: error: class, interface, or enum expected
String hexString = Integer.toHexString(i);
^
BintoDectoHextoAscii.java:88: error: class, interface, or enum expected
System.out.println("Hexa decimal: " + hexString);
^
BintoDectoHextoAscii.java:90: error: class, interface, or enum expected
return num.tolong();
^
BintoDectoHextoAscii.java:91: error: class, interface, or enum expected
^
BintoDectoHextoAscii.java:124: error: class, interface, or enum expected
StringBuffer hex = new StringBuffer();
^
BintoDectoHextoAscii.java:125: error: class, interface, or enum expected
for (int i = 0; i < chars.length; i++)
^
BintoDectoHextoAscii.java:125: error: class, interface, or enum expected
for (int i = 0; i < chars.length; i++)
^
BintoDectoHextoAscii.java:125: error: class, interface, or enum expected
for (int i = 0; i < chars.length; i++)
^
BintoDectoHextoAscii.java:128: error: class, interface, or enum expected
^
BintoDectoHextoAscii.java:130: error: class, interface, or enum expected
^
BintoDectoHextoAscii.java:135: error: class, interface, or enum expected
for (int i = 0; i < hexValue.length(); i += 2)
^
BintoDectoHextoAscii.java:135: error: class, interface, or enum expected
for (int i = 0; i < hexValue.length(); i += 2)
^
BintoDectoHextoAscii.java:135: error: class, interface, or enum expected
for (int i = 0; i < hexValue.length(); i += 2)
^
BintoDectoHextoAscii.java:138: error: class, interface, or enum expected
output.append((char) Integer.parseInt(str, 16));
^
BintoDectoHextoAscii.java:139: error: class, interface, or enum expected
^
BintoDectoHextoAscii.java:141: error: class, interface, or enum expected
^
BintoDectoHextoAscii.java:144: error: class, interface, or enum expected
public static String binaryToDecimal(String binary)
^
BintoDectoHextoAscii.java:150: error: class, interface, or enum expected
int powersIndex = 0; // keep track of the index
^
BintoDectoHextoAscii.java:151: error: class, interface, or enum expected
int decimal = 0; // will contain decimals
^
BintoDectoHextoAscii.java:152: error: class, interface, or enum expected
boolean isCorrect = true; // flag if incorrect input
^
BintoDectoHextoAscii.java:155: error: class, interface, or enum expected
for(int i = 0; i < powers.length; i++)
^
BintoDectoHextoAscii.java:155: error: class, interface, or enum expected
for(int i = 0; i < powers.length; i++)
^
BintoDectoHextoAscii.java:155: error: class, interface, or enum expected
for(int i = 0; i < powers.length; i++)
^
BintoDectoHextoAscii.java:159: error: class, interface, or enum expected
for(int i = binary.length() - 1; i >= 0; i--)
^
BintoDectoHextoAscii.java:159: error: class, interface, or enum expected
for(int i = binary.length() - 1; i >= 0; i--)
^
BintoDectoHextoAscii.java:159: error: class, interface, or enum expected
for(int i = binary.length() - 1; i >= 0; i--)
^
BintoDectoHextoAscii.java:166: error: class, interface, or enum expected
else if(binary.charAt(i) != '0' & binary.charAt(i) != '1')
^
BintoDectoHextoAscii.java:169: error: class, interface, or enum expected
break; // break from loop due to wrong input
^
BintoDectoHextoAscii.java:170: error: class, interface, or enum expected
} // end else if
^
BintoDectoHextoAscii.java:174: error: class, interface, or enum expected
} // end for
^
BintoDectoHextoAscii.java:180: error: class, interface, or enum expected
else // print incorrect input message
^
BintoDectoHextoAscii.java:185: error: class, interface, or enum expected
return decimal.toint();
^
BintoDectoHextoAscii.java:186: error: class, interface, or enum expected
} // end function
^
41 errors
----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.so can anyone help me determine why I get the following 41 errrors saying: class, interface, or enum expected as well as any other errors that may show up afterwards because I'm stumped.
Yes - YOU CAN!
My code is as follows and I hope you don't mind the commented lines of unused code because I'm not sure where I want things and what I want at the moment:
Excellent! Commenting out code is EXACTLY how you troubleshoot problems like yours.
Comment out sections of code until the problem goes away. Then start adding back ONE SECTION of code at a time until the problem occurs. When it does you have just FOUND the problem.
If you do that you wind up with code that looks like this:
import java.util.Scanner;
import java.io.*;
import java.lang.*;
public class BintoDectoHextoAscii {
public static void main(String[] args)throws IOException {
Scanner input = new Scanner(System.in);
System.out.println("Enter a binary number: ");
String binary = input.nextLine(); // store input from user
public static String BinaryToHexadecimal(String hex) { } // end function
Notice ANYTHING UNUSUAL?
You have a complete CLASS definition followed by a method definition.
Methods have to be INSIDE the class - you can NOT define methods on their own.
Write modular code.
Write EMPTY methods - just the method signature and maybe a RETURN NULL if you need to return something.
Then add calls to those empty methods.
When everything compiles and runs find you can start adding code to the methods ONE METHOD AT A TIME.
Test compile and run after you add the code for each method. -
I would like to save the WMF file with proper dimensions as they are in the editor (my saved WMFs have the dimensions of my screen resolution). They come from a RichEdit.
Thanks.
Edit:
My goal is to convert the images that appear on a RichEdit to another format.
Here is the fragment of the RTF:
{\pict\wmetafile8\picw7407\pich9259\picwgoal4199\pichgoal5249
010009000003703e020000005a3e02000000050000000b0200000000050000000c022b24ef1c5a
ffffffffffffff030000000000
}\cf2\lang1033\b\f1\fs23\par
For each 2 chars in this string I converted it to hex and saved it through a memory stream. Then I opened it in Paint or GIMP and there is the image. I even can convert it to a PNG file through ImageMagick tool. But the dimensions are wrong. How to fix
this?
I am using Lazarus.
I could guess that the header is not OK, but how they can be opened by Paint and converted? So I guess the dimensions info is wrong in the header. In GIMP even the dimensions are right, here a link to the GIMP's dialogbox confirmation with the dimensions
it has encountered in the file ( http://s13.postimg.org/s536tgo9z/Metafile_in_GIMP.png ).
So the info is there, but is wrong. When I open the images in Paint, they are wrong. Microsoft Office Picture Manager can also open them correctly, but could not convert them so. I need to do it programmatically. TMetafile Delphi class could not open these
files as well in order to be converted. So I could only edit the bytes.
My RichEdit WMF data can not be accepted by ComputeAldusChecksum routine nor get a handle from SetWinMetaFileBits API call, which would convert it to an EMF format.
procedure TMetafile.ReadWMFStream(Stream: TStream; Length: Longint);
var
WMF: TMetafileHeader;
BitMem: Pointer;
MFP: TMetaFilePict;
begin
NewImage;
Stream.Read(WMF, SizeOf(WMF));
if (WMF.Key <> WMFKEY) or (ComputeAldusChecksum(WMF) <> WMF.CheckSum) then
raise EComponentError.Create('Invalid metafile.'); // <<<<<<<<<<<<<<< exception here
Dec(Length, SizeOf(WMF));
GetMem(Bitmem, Length);
with FImage do
try
Stream.Read(BitMem^, Length);
FImage.FInch := WMF.Inch;
if WMF.Inch = 0 then
WMF.Inch := 96;
FWidth := MulDiv(WMF.Box.Right - WMF.Box.Left,25400,WMF.Inch);
FHeight := MulDiv(WMF.Box.Bottom - WMF.Box.Top,25400,WMF.Inch);
with MFP do
begin
MM := MM_ANISOTROPIC;
xExt := 0;
yExt := 0;
hmf := 0;
end;
FHandle := SetWinMetaFileBits(Length, BitMem, 0, MFP);
if FHandle = 0 then
raise EComponentError.Create('Invalid metafile.'); // <<<<<<<<<<<<<< exception here
Enhanced := False;
finally
Freemem(BitMem, Length);
end;
end;Hi Antônio G,
Based on your description, I’m afraid that it is not the correct forum for this issue, since this forum is to discuss:
Visual Studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System, and Visual Studio Editor.
To make this issue clearly, would you mind letting us know more information about this issue? Which language are you using? Which kind of app are you developing?
Reference:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/a9e1857d-dd5b-443b-8633-397aea6e7b8c/help-on-properly-handling-wmf-mmanisotropic-image-in-rtf-file-when-extracted?forum=csharpgeneral
https://social.msdn.microsoft.com/Forums/vstudio/en-US/5b99d331-ef56-4d60-bf12-3e3b70783376/how-to-convert-a-hex-string-save-in-a-rtf-file-into-an-image-jpg-or-bmp?forum=csharpgeneral#a9219408-f73b-4e98-a9d8-7a1e0f20cdd9
Maybe you could select the language development forum for this kind of issue. If not, please let me know more information about it, I will help you find a more appropriate forum.
Best Regards,
Jack
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Non-hex character in hex string after upgrade to Yosemite
Hi,
When I try to open some of my files I get an error: "Acrobat PDF File Format is having difficulties. Non-hex character in a hex string". I could open the files before.
The only thing I've done since I opened the file last was to upgrade to Yosemite. The error occurs on both my Mac Pro (late 2013) and Mac Book Pro with Yosemite. Unfortunately, I have no access to a Mac with Mavericks and CS6 but I will try to fix one to verify that the file works there.
Affected files (Created in Illustrator CS6 on Mavericks):
services.ai
visual guidelines v.0.4.pdf
visual guidelines.ai
Tested steps:
Open previous versions of the same file from our repository
Update Illustrator CS6 to latest version
Download Illustrator CC
Tried to Place the file into another file (same error)
Tried to repair file Enable content recovery mode | Illustrator CS2-CS5Hi svepdesigncenter,
How you are accessing those files from your repository?
There might be chances of getting files corrupted when transferring.
File may have been sent as ascii when it should have been sent as binary or vice versa.
In 99% of transfers it's ALWAYS safest to zip an AI or eps file before sending it anywhere.
Regards,
Sumit Singh -
Non-hex character in a hex string error message
Hi everyone,
I encountered n error message in Illustrator "Acrobat PDF File Format is having difficulties. Non-hex character in a hex string." when trying to open a particular file.
File was originally created on a Windows 7 PC, tried opening file on Mac OS 10.7.5, same Illustrator version 18. Also tried opening in PDF, Distiller, but didn't help.
Did tried to change Illustrator Preferences in both Windows and Mac, following the steps in the TecNote:
http://kb2.adobe.com/cps/500/cpsid_50031.html
When trying to open the file from the File > Open menu, with the keys held down, it did not open a blank file window, neither did it created a duplicate copy in the Finder where the file is located.
The file in question had about 15 artboards, a few embedded images, approx 2.6MB size.
Any suggestions/assistance would be greatly appreciated.
Thank you.Hi Monika,
The file was .ai file, as mentioned earlier, was created in Illustrator ver 18.
Not emailed, stored in the folder, on the Windows PC, not a server. Last saved few days ago, tried to reopen the file from the same computer, but could no longer opened.
No, Illustrator did not crash, just the error message "Acrobat PDF File Format is having difficulties. Non-hex character in a hex string." -
Hex string to 2D picture control
Hi, I'm trying to get a screen capture from an HP8563EC spectrum analyzer with a GPIB-USB-HS interface. I was able to get the data from the spectrum analyzer but I can't figure out how to rebuilt the screenshot from the downloaded data (string of hex). Also, I would like to be able to format the screen shot to bmp or png. I compared the data with what I captured with NI-Spy while using benchlink and the amount and kind of data look similar. I was not able to find information on the analyzer display resolution in pixels, the only available information available is that the screen is the display is approximately 9.6 cm (V) X 13 cm (H). Note that the benchlink screen shot size may add more information (667Kb when bmp type).
I attached two attempts VIs (LabVIEW 2009) and a benchlink screen capture. I saved the string controls with the actual downloaded data as default value.
Hopefully somebody have done something similar before.
Thanks,
Ben
Solved!
Go to Solution.
Attachments:
Untitled 2.vi 35 KB
Untitled 1.vi 15 KB
benchlink test1.PNG 12 KBDarin.K wrote:
Nice!
You follow directions well*.
The next time you are looking for work, make sure you send a resume my way ( if are you a US citizen).
Ben
* I am sure you would have figured that out with my notes.
Message Edited by Ben on 11-04-2009 02:28 PM
Ben Rayner
I am currently active on.. MainStream Preppers
Rayner's Ridge is under construction -
Converting byte from dec to hex
Hi All,
I'm having a problem converting byte from decimal to hex - i need the following result:
if entered 127 (dec), the output should be 7f (hex).
The following method fails, of course because of NumberFormatException.
private byte toHexByte(byte signedByte)
int unsignedByte = signedByte;
unsignedByte &= 0xff;
String hexString = Integer.toHexString(unsignedByte);
BigInteger bigInteger = new BigInteger(hexString);
//byte hexByte = Byte.parseByte(hexString);
return bigInteger.byteValue();
}get numberformatexception because a lot of hex digits cannot be transformed into int just like that (ie f is not a digit in decimal) heres some code that i used for a pdp11 assembler IDE... but this is for 16-bit 2s complement in binary/octal/decimal/hex , might be useful for reference as example though
public static String getBase(short i, int base){
String res = (i>=0)? Integer.toString((int)i,base)
: Integer.toString((int)65536+i,base) + " ("+Integer.toString((int)i,base)+")";
StringBuffer pad= new StringBuffer();
for(int x = 0; x < 16 - res.length() ; x++){
pad.append("0");
res = pad.toString() + res;
return res;
} -
Find and replace value in Delimited String
Hi All,
I have a requirement, where i need to find and replace values in delimited string.
For example, the string is "GL~1001~157747~FEB-13~CREDIT~A~N~USD~NULL~". The 4th column gives month and year. I need to replace it with previous month name. For example: "GL~1001~157747~JAN-13~CREDIT~A~N~USD~NULL~". I need to do same for last 12 months.
I thought of first devide the values and store it in variable and then after replacing it with required value, join it back.
I just wanted to know if there is any better way to do it?for example (Assumption: the abbreviated month is the first occurance of 3 consecutive alphabetic charachters)
with testdata as (
select 'GL~1001~157747~FEB-13~CREDIT~A~N~USD~NULL~' str from dual
select
str
,regexp_substr(str, '[[:alpha:]]{3}') part
,to_date('01'||regexp_substr(str, '[[:alpha:]]{3}')||'2013', 'DDMONYYYY') part_date
,replace (str
,regexp_substr(str, '[[:alpha:]]{3}')
,to_char(add_months(to_date('01'||regexp_substr(str, '[[:alpha:]]{3}')||'2013', 'DDMONYYYY'),-1),'MON')
) res
from testdata
STR
PART
PART_DATE
RES
GL~1001~157747~FEB-13~CREDIT~A~N~USD~NULL~
FEB
02/01/2013
GL~1001~157747~JAN-13~CREDIT~A~N~USD~NULL~
with year included
with testdata as (
select 'GL~1001~157747~JAN-13~CREDIT~A~N~USD~NULL~' str from dual
select
str
,regexp_substr(str, '[[:alpha:]]{3}-\d{2}') part
,to_date(regexp_substr(str, '[[:alpha:]]{3}-\d{2}'), 'MON-YY') part_date
,replace (str
,regexp_substr(str, '[[:alpha:]]{3}-\d{2}')
,to_char(add_months(to_date(regexp_substr(str, '[[:alpha:]]{3}-\d{2}'), 'MON-YY'),-1),'MON-YY')
) res
from testdata
STR
PART
PART_DATE
RES
GL~1001~157747~JAN-13~CREDIT~A~N~USD~NULL~
JAN-13
01/01/2013
GL~1001~157747~DEC-12~CREDIT~A~N~USD~NULL~
Message was edited by: chris227 year included -
Find Replace from Textfile with regex
Hello.
I'm wondering if anyone knows about an existing script that does a find/replace by list like the script "FindChangeByList.jsx" that comes with every InDesign installation.
This consists of tow parts, the script itself with the functionality and a simple textfile where you have simple one-liners capable of find/replace with regex.
the Textfile:
//FindChangeList.txt
//A support file for the InDesign CS4 JavaScript FindChangeByList.jsx
//This data file is tab-delimited, with carriage returns separating records.
//The format of each record in the file is:
//findType<tab>findProperties<tab>changeProperties<tab>findChangeOptions<tab>description
//Where:
//<tab> is a tab character
//findType is "text", "grep", or "glyph" (this sets the type of find/change operation to use).
//findProperties is a properties record (as text) of the find preferences.
//changeProperties is a properties record (as text) of the change preferences.
//findChangeOptions is a properties record (as text) of the find/change options.
//description is a description of the find/change operation
//Very simple example:
//text {findWhat:"--"} {changeTo:"^_"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all double dashes and replace with an em dash.
//More complex example:
//text {findWhat:"^9^9.^9^9"} {appliedCharacterStyle:"price"} {include footnotes:true, include master pages:true, include hidden layers:true, whole word:false} Find $10.00 to $99.99 and apply the character style "price".
//All InDesign search metacharacters are allowed in the "findWhat" and "changeTo" properties for findTextPreferences and changeTextPreferences.
//If you enter backslashes in the findWhat property of the findGrepPreferences object, they must be "escaped"
//as shown in the example below:
//{findWhat:"\\s+"}
grep {findWhat:" +"} {changeTo:" "} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all double spaces and replace with single spaces.
grep {findWhat:"\r "} {changeTo:"\r"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all returns followed by a space And replace with single returns.
grep {findWhat:" \r"} {changeTo:"\r"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all returns followed by a space and replace with single returns.
grep {findWhat:"\t\t+"} {changeTo:"\t"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all double tab characters and replace with single tab characters.
grep {findWhat:"\r\t"} {changeTo:"\r"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all returns followed by a tab character and replace with single returns.
grep {findWhat:"\t\r"} {changeTo:"\r"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all returns followed by a tab character and replace with single returns.
grep {findWhat:"\r\r+"} {changeTo:"\r"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all double returns and replace with single returns.
text {findWhat:" - "} {changeTo:"^="} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all space-dash-space and replace with an en dash.
text {findWhat:"--"} {changeTo:"^_"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all dash-dash and replace with an em dash.
The script:
//FindChangeByList.jsx
//An InDesign CS5.5 JavaScript
@@@BUILDINFO@@@ "FindChangeByList.jsx" 3.0.0 15 December 2009
//Loads a series of tab-delimited strings from a text file, then performs a series
//of find/change operations based on the strings read from the file.
//The data file is tab-delimited, with carriage returns separating records.
//The format of each record in the file is:
//findType<tab>findProperties<tab>changeProperties<tab>findChangeOptions<tab>description
//Where:
//<tab> is a tab character
//findType is "text", "grep", or "glyph" (this sets the type of find/change operation to use).
//findProperties is a properties record (as text) of the find preferences.
//changeProperties is a properties record (as text) of the change preferences.
//findChangeOptions is a properties record (as text) of the find/change options.
//description is a description of the find/change operation
//Very simple example:
//text {findWhat:"--"} {changeTo:"^_"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all double dashes and replace with an em dash.
//More complex example:
//text {findWhat:"^9^9.^9^9"} {appliedCharacterStyle:"price"} {include footnotes:true, include master pages:true, include hidden layers:true, whole word:false} Find $10.00 to $99.99 and apply the character style "price".
//All InDesign search metacharacters are allowed in the "findWhat" and "changeTo" properties for findTextPreferences and changeTextPreferences.
//If you enter backslashes in the findWhat property of the findGrepPreferences object, they must be "escaped"
//as shown in the example below:
//{findWhat:"\\s+"}
//For more on InDesign scripting, go to http://www.adobe.com/products/indesign/scripting/index.html
//or visit the InDesign Scripting User to User forum at http://www.adobeforums.com
main();
function main(){
var myObject;
//Make certain that user interaction (display of dialogs, etc.) is turned on.
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
if(app.documents.length > 0){
if(app.selection.length > 0){
switch(app.selection[0].constructor.name){
case "InsertionPoint":
case "Character":
case "Word":
case "TextStyleRange":
case "Line":
case "Paragraph":
case "TextColumn":
case "Text":
case "Cell":
case "Column":
case "Row":
case "Table":
myDisplayDialog();
break;
default:
//Something was selected, but it wasn't a text object, so search the document.
myFindChangeByList(app.documents.item(0));
else{
//Nothing was selected, so simply search the document.
myFindChangeByList(app.documents.item(0));
else{
alert("No documents are open. Please open a document and try again.");
function myDisplayDialog(){
var myObject;
var myDialog = app.dialogs.add({name:"FindChangeByList"});
with(myDialog.dialogColumns.add()){
with(dialogRows.add()){
with(dialogColumns.add()){
staticTexts.add({staticLabel:"Search Range:"});
var myRangeButtons = radiobuttonGroups.add();
with(myRangeButtons){
radiobuttonControls.add({staticLabel:"Document", checkedState:true});
radiobuttonControls.add({staticLabel:"Selected Story"});
if(app.selection[0].contents != ""){
radiobuttonControls.add({staticLabel:"Selection", checkedState:true});
var myResult = myDialog.show();
if(myResult == true){
switch(myRangeButtons.selectedButton){
case 0:
myObject = app.documents.item(0);
break;
case 1:
myObject = app.selection[0].parentStory;
break;
case 2:
myObject = app.selection[0];
break;
myDialog.destroy();
myFindChangeByList(myObject);
else{
myDialog.destroy();
function myFindChangeByList(myObject){
var myScriptFileName, myFindChangeFile, myFindChangeFileName, myScriptFile, myResult;
var myFindChangeArray, myFindPreferences, myChangePreferences, myFindLimit, myStory;
var myStartCharacter, myEndCharacter;
var myFindChangeFile = myFindFile("/FindChangeSupport/FindChangeList.txt")
if(myFindChangeFile != null){
myFindChangeFile = File(myFindChangeFile);
var myResult = myFindChangeFile.open("r", undefined, undefined);
if(myResult == true){
//Loop through the find/change operations.
do{
myLine = myFindChangeFile.readln();
//Ignore comment lines and blank lines.
if((myLine.substring(0,4)=="text")||(myLine.substring(0,4)=="grep")|| (myLine.substring(0,5)=="glyph")){
myFindChangeArray = myLine.split("\t");
//The first field in the line is the findType string.
myFindType = myFindChangeArray[0];
//The second field in the line is the FindPreferences string.
myFindPreferences = myFindChangeArray[1];
//The second field in the line is the ChangePreferences string.
myChangePreferences = myFindChangeArray[2];
//The fourth field is the range--used only by text find/change.
myFindChangeOptions = myFindChangeArray[3];
switch(myFindType){
case "text":
myFindText(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions);
break;
case "grep":
myFindGrep(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions);
break;
case "glyph":
myFindGlyph(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions);
break;
} while(myFindChangeFile.eof == false);
myFindChangeFile.close();
function myFindText(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions){
//Reset the find/change preferences before each search.
app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences = NothingEnum.nothing;
var myString = "app.findTextPreferences.properties = "+ myFindPreferences + ";";
myString += "app.changeTextPreferences.properties = " + myChangePreferences + ";";
myString += "app.findChangeTextOptions.properties = " + myFindChangeOptions + ";";
app.doScript(myString, ScriptLanguage.javascript);
myFoundItems = myObject.changeText();
//Reset the find/change preferences after each search.
app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences = NothingEnum.nothing;
function myFindGrep(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions){
//Reset the find/change grep preferences before each search.
app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences = NothingEnum.nothing;
var myString = "app.findGrepPreferences.properties = "+ myFindPreferences + ";";
myString += "app.changeGrepPreferences.properties = " + myChangePreferences + ";";
myString += "app.findChangeGrepOptions.properties = " + myFindChangeOptions + ";";
app.doScript(myString, ScriptLanguage.javascript);
var myFoundItems = myObject.changeGrep();
//Reset the find/change grep preferences after each search.
app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences = NothingEnum.nothing;
function myFindGlyph(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions){
//Reset the find/change glyph preferences before each search.
app.changeGlyphPreferences = NothingEnum.nothing;
app.findGlyphPreferences = NothingEnum.nothing;
var myString = "app.findGlyphPreferences.properties = "+ myFindPreferences + ";";
myString += "app.changeGlyphPreferences.properties = " + myChangePreferences + ";";
myString += "app.findChangeGlyphOptions.properties = " + myFindChangeOptions + ";";
app.doScript(myString, ScriptLanguage.javascript);
var myFoundItems = myObject.changeGlyph();
//Reset the find/change glyph preferences after each search.
app.changeGlyphPreferences = NothingEnum.nothing;
app.findGlyphPreferences = NothingEnum.nothing;
function myFindFile(myFilePath){
var myScriptFile = myGetScriptPath();
var myScriptFile = File(myScriptFile);
var myScriptFolder = myScriptFile.path;
myFilePath = myScriptFolder + myFilePath;
if(File(myFilePath).exists == false){
//Display a dialog.
myFilePath = File.openDialog("Choose the file containing your find/change list");
return myFilePath;
function myGetScriptPath(){
try{
myFile = app.activeScript;
catch(myError){
myFile = myError.fileName;
return myFile;
This is a very useful and easy to maintain script which even people who cant write scripts (but know how to use regex) can do complex search replace mass replacements.
Would love to find something like this for FrameMaker 12 (as i can't write scripts myself).
regards
danielI have visited that site. The first item in the external link says: "You can also configure Firefox to automatically search for text when you type any characters outside of a text field. When typing in a text field these characters should show up in the text field and not trigger the Quick Find bar. "
What I am looking for is the exact opposite. Once my first search is entered in the text box, and the info comes back, I want to start typing the next symbol, and have it automatically show up in the text box, not the Quick Find box. That is how it was working up until a couple of months ago.
Maybe you are looking for
-
VPN Problem: Can't route to other network clients
Hi, I can't ping the other clients on the network when I'm connected to VPN from outside. But accessing internet trough VPN works. (Sending all data through VPN). So in fact, I can only ping the VPN server I'm connected to. Maybe someone here has an
-
Easy-to-read link to App Store does not work for iOS 6?
I have followed https://developer.apple.com/library/ios/#qa/qa1633/_index.html to create a link that looks like http://itunes.com/apps/<applicationname> This link work for iOS 5 devices, but not on iOS 6!
-
Import an open office spreadsheet into internal table
hi all, i have one requirment to import excel into sap but i dont have MS office on my system is there any way to import an open office spreadsheet into internal table by using ALSM_EXCEL_TO_INTERNAL_TABLE fm or
-
How we know The usage of Internet in MBP.
G'day, I used the Software ,in Which i know how much usage of my internet uploading And Downloading. Is there anyone know Any Software. I used the Software in my MBP but i lost it. Any one can help me. Thanks Ammar <Edited by Host>
-
Images imported from iPhoto to iDvd are not as sharp as originals. Any solution?
Trying iDVD for the first time. Imported images from iPhoto. However on the DVD, the images are not as sharp as the original files which are very sharp and well-focused. Any solutions or is this kind of degradation just to be expected? Thank you!