I'm writing a program (in Python for now) for reading PSD files. I'm using this specification: http://www.fileformat.info/format/psd/egff.htm
Here it says
BYTE Name[]; /* Even-length Pascal-format string, 2 bytes or longer
*/
Um, 2 bytes or longer? How am I supposed to find out how ling it is? I don't know what "Pascal-format string" means either.
Thanks in advance.
EDIT: Heres a direct link to the official PSD specification (pdf): http://forums.adobe.com/servlet/JiveServlet/download/2923119-45984/Photoshop%20File%20Formats.pdf;jsessionid=21F2DBA32AB9E56882065663C10A1EBF.node0
Look in page 9, under "Image Resource Blocks"
Please help.
"Pascal-format string" could mean string that have length encoded on first position IIRC.
Related
I'm converting my total amount into words using bi publisher. Btw, the amount is base on the data from the data set. Can someone help me what to do? Thanks
<?xdofx:to_check_number,sum(COLUMN_NAME, ‘EUR’, ‘CASE_UPPER’, ‘DECIMAL_STYLE_WORDS’)?>
I expect the output to be in words but the actual ouput is blank.
Use the function xdoxslt:toCheckNumber
Like this:
<?xdoxslt:toCheckNumber($_XDOLOCALE, sum(COLUMN_NAME), ‘EUR’, ‘CASE_UPPER’, ‘DECIMAL_STYLE_WORDS’)?>
For a detailed explanation, check this page. But bear in mind, this is an undocumented function.
In E-Business Suite r12, the XML file from the "out of the box" payments module has amount in text: OutboundPaymentInstruction/OutboundPayment/PaymentAmountText
<?xdofx:to_check_number(sum(COLUMN_NAME), 'EUR', 'CASE_UPPER', 'DECIMAL_STYLE_WORDS')?>
should work with fixed quotes and converted part ,sum(COLUMN_NAME,... into(sum(COLUMN_NAME),....
You can try this one which is working for my case.
<?xdoxslt:toWordsAmt(2300)?>
CASE_INIT_CAP
I have a list of the following codes and their corresponding codes in format code_128. I want to given a string, be able to generate the corresponging code in CODE_128 format. Based on this list, how could I generate a code_128 number to the string A4Y9387VY34, for example?
code code in code_128
A4Y9387VY34 ????
ADN38Y644YT7 9611019020018632869509
AXCW99QYTD34 9622019021500078083444
A9YQC44W9J3K 9611083009710754539701
AT8V7T3G3874 9622083021255845940154
A7K444N4FKB8 9622083033510467186874
AYCHFW448HTQ 9611005019246067403120
AY63CWBMTDCC 9622005028182439033426
ANY7TF46NGQ3 9622005031345848081170
AYY48TBVQ3FH 9611200003793988696055
AT8Q4CF4DQ9Q 9611200021606968867090
A764WYQFJWTT 9622200022706968919275
AC649ND7N8B6 9622148007265209832185
A4VDPTJ99YN4 9611148013412173923039
AHDYK498BD6T 9622148021309216149530
A4YYYNY7C3DJ 9611017021934363499071
AYG6XWVCCQ89 9622017031009914238743
A68YJHGQKCCM 9622017031138587166053
APMB7XG9XQC9 9611021011608391750002
AGP8C44Y8VYK 9622021021608111646113
A7C68B9T69XB 9622021021958603678086
AJYYWKR6BDGN 9611010022528724015883
AKMNVXDT9PYN 9622010027475034102229
AXPXMK9QMDFD 9622010031475028243694
I read a lot about it, but I didn't come to any solution. Thanks in advance!!
Well, this is a pretty open question, I will give you my suggestions:
If it is a finite list, you can use a Hash or a Dictionary, where
the keys are the Codes and map them to the corresponding value, in
your case, Code_128
Some scanners have software installed that allow you to change what
has been read to a new value, format it, etc.
If you need a bigger insight please, give us more detail about the environment you are using.
Hope that helps,
I decided to create a new answer because now I get your point. Well, if you are talking about a GS1-128 Code (please see www.gs1.org) please do not start without visiting Wikipedia info about it. as you can see, there is a thorough explanation about how to work with that type of code. That code is composed by several application identifiers followed by their corresponding values. There is a better way of encoding them by using special characters as parenthesis. Here is other info that may help you.
Hope it helps,
The below code was in a proc which is included in my job under the DD name sort.controls.
This step was executed with the sort program, Syncsort. I can understand that the START in the below code indicates the starting position of the field used for sorting and LENGTH denotes the length of the field for sorting. But I can't understand what is ID TYPECODE=1. Can anyone please explain this?
ID TYPECODE=1,LRECL=00302,FORMAT=FB
CF1 START=00038,LENGTH=023
ID Type code 1 is system-specific. In my experience it normally means it's a disk file vs a cart or carddata or something but I'd have to know more about your environment.
LRECL is the defined length of the record for that file (302 bytes)
Format=FB means it is Fixed Block - the length is always 302 bytes and does not vary.
Hopefully that's helpful.
I have a barcode scanner implemented using "Zxing" library. I wanted to know how can I identify the type/format (like if it's UCC / Code 128 or EAN or any other) and extract Lot no. etc from the read string? Is there any algorithm to do it?
IntentResult scanningResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
Here scanningResult.getFormatName(); gives code format of scanned barcode.
Yes. See the Result object you get from a successful decode. It has the format and contents. I am not sure what "lot no." is but you can parse the result further however you like.
I'm trying to read unsigned integers from a file (stored as consecutive byte) and convert them to Integers. I've tried this:
file = File.new(filename,"r")
num = file.read(2).unpack("S") #read an unsigned short
puts num #value will be less than expected
What am I doing wrong here?
You're not reading enough bytes. As you say in the comment to tadman's answer, you get 202 instead of 3405691582
Notice that the first 2 bytes of 0xCAFEBABE is 0xCA = 202
If you really want all 8 bytes in a single number, then you need to read more than the unsigned short
try
num = file.read(8).unpack("L_")
The underscore is assuming that the native long is going to be 8 bytes, which definitely is not guaranteed.
How about looking in The Pickaxe? (Ruby 1.9, p. 44)
File.open("testfile")
do |file|
file.each_byte {|ch| print "#{ch.chr}:#{ch} " }
end
each_byte iterates over a file byte by byte.
There are a couple of libraries that help with parsing binary data in Ruby, by letting you declare the data format in a simple high-level declarative DSL and then figure out all the packing, unpacking, bit-twiddling, shifting and endian-conversions by themselves.
I have never used one of these, but here's two examples. (There are more, but I don't know them):
BitStruct
BinData
Ok, I got it to work:
num = file.read(8).unpack("N")
Thanks for all of your help.
What format are the numbers stored in the file? Is it in hex? Your code looks correct to me.
When dealing with binary data you need to be sure you're opening the file in binary mode if you're on Windows. This goes for both reading and writing.
open(filename, "rb") do |file|
num = file.read(2).unpack("S")
puts num
end
There may also be issues with "endian" encoding depending on the source platform. For instance, PowerPC-based machines, which include old Mac systems, IBM Power servers, PS3 clusters, or Sun Sparc servers.
Can you post an example of how it's "less"? Usually there's an obvious pattern to the data.
For example, if you want 0x1234 but you get 0x3412 it's an endian problem.