Cut out parts of a file and process the copied information
Hello all,
I have a problem as described. There are files with clearly distinguishable start and end markers as well as some characters in-between that need to be replaced. Such files may have e.g. the following structure:
Start of file
... file content here ...
<Start marker>
... file content here ...
<Character_1 that needs to be replaced with another character>
... some more file content ...
<Character_N that needs to be replaced with another character>
... still more file content ...
<End marker>
... and even more irrelevant content ...
End of fileI need to copy the file content between <Start marker> and <End marker> thereby replacing encountered special <Characters> in-between. The so 'cut out' content where characters were replaced needs to be saved to a file or just available as file object for further processing.
I am wondering if there is a way to do the copying of content and substitution of characters simultaneously to speed up the whole process as the files may be quire large. Any suggestions with regard to the described task are most welcome. Thank you very much in advance!
I am wondering if there is a way to do the copying of
content and substitution of characters simultaneously
to speed up the whole process as the files may be
quire large. Any suggestions with regard to the
described task are most welcome. Read the stream until you reach the marker
- read char
- replace char if necessary
- store char
Repeat until you hit end marker
Whether that actually speeds it up needs to be proven, though. I'd guess char-wise reading slows things down.
Similar Messages
-
Cutting out part of a photo and reshaping
Dear illustartors,
this may be a photoshop or illustartor question, I'm not sure. Here's what I want to do:
take part of a photo and cut it out - the shape isn't regular, something of a rough rectangle
take the cut out shape and reshape it, I need to move two oof the corners in to form a rough trapezium
I want the contents of the cutout shape (part of a photo) to shrink appropriately within the reshaped object... Imagine the shape is an old door, The shape wouldn't exactly be a rectangle because it's a bit beaten up; having cut it out I want to make the new shape but still see the edges, coners and panels, he new shap will be the same hieght on the left-hand side but reduced on the right-hand side - as if creating perspective.
Is this possible somehow?
thank you......................... lizThank you wade I will have a go!
UPDATE: yes that's good. I created a "sunray" using a line which I transformed to have as many lines as the mesh I used (actualy it had half the number plus 1 for the lower half of the sunray, then repeated the operation fo an identical line on top of the first but wit the ange of transformation = to 360 - the angle of the first line's transformation) and made the line long enough to get the perspective right, this I then used as a guide to move the mesh lines. The only thing I would have liked is to a) lock the verticalsin the mesh so I didn't move them inadvertently and b) if I could have moved the beginning and end point of a mesh horizontal and said now redrawn the line between these two points it would have been quicker. (I was using illustrator) -
How to cut out part of an image and replace with another?
ok, i'm a newbie to image editing, and i want to cut out a persons face in a picture and put in another face on the picture. i'm sure this is pretty simple, i just have no idea where to start. can someone point me in the right direction? thanks!
Aperture is not a pixel editor, which is what you need. Photoshop is the app used for this, but it's cost is several times that of AP! As suggested in the second post, look into Photoshop Elements, a slimmed-down and much cheaper version of Photoshop. [I don't use Elements, so if someone knows that it can't do area copies from one pic to another, please join the conversation!]
And get a good book on Photoshop or Elements, there's a huge learning curve involved. I'd suggest going to a book shop, pulling a few such books off the shelf and check their index for editing techniques. Sometimes you'll find one book that gives you the exact step-by-step instructions for doing what you want. Then there'll be others that don't get into the topic or do a poor job. -
why is it when i download the software update for iphone an error pops out when downloading is finish and processing file is being done...i've already tried several time but still the same result.
Disasble the computer's security software during the download and update.
-
I recently downloaded an album and two of the songs on it play until about half way through and then cut out! What is happening and how do i get them back?
I'd report the problem to the iTunes Store.
Log in to the Store. Click on "Account" in your Quick Links. When you're in your Account information screen, go down to Purchase History and click "See all".
Find the items that are not playing properly. If you can't see "Report a Problem" next to the entries, click the "Report a problem" button. Now click the "Report a Problem" links next to the items.
(Not entirely sure what happens after you click that link, but fingers crossed it should be relatively straightforward.) -
My fonts are changing in iWed after I publish. I need step by step instructions on how to go to my third party server and clear out all of my files and reload my whole website, the solution I saw posted by another. Please someone help me on this. Urgent
If your fonts are changing when viewed on other computers - epecially those running windows - you need to look at using web-safe fonts...
http://www.iwebformusicians.com/iWeb/Fonts-Colors.html
Also make sure you clear your browser cache before viewing you published files. -
Aperture 3: Deleting raw files and making the jpeg my new master-
Aperture 3 has made some great strides in making the following possible ( I posted this originally in 2007):
What I'd like to do is shoot everything in raw + jpg, and then keep the raw files only for the important shots.
I really like having the option of raw processing, but the storage demands are very heavy. If I could just make a selection of photos in a roll, and have a command to delete any unneeded raw files from the selected photos, while keeping the original jpgs as master, that would be great.
Also, it would be great to be able to manipulate a raw file, and then when I'm satisfied with the image, to render a high-quality jpg from that raw file & make the jpg the new master, and then delete the raw file to free up disk space.
Basically, I want the raw file safety net for everyday images, without gobbling up gigabytes of disk space <<<<<
With Aperture 3, I can finally change the master to the jpg file, which solves part of the problem. But I still want to be able to manipulate my raw file, and render a new high-quality jpg master.
Why don't Aperture / Lightroom do this? To me at least, it seems an obvious feature.I had a chance to talk to product managers from both Apple & Adobe about this at PhotoPlus Expo in NYC a couple years back. Both seemed receptive, but here we are - years later - no progress.
I think part of the problem is that there's a purist mentality about RAW files. One should always shoot them - and then keep them forever- after all- they're your negatives!
But what about event photography? Or weddings, as you pointed out? It makes no sense to burden your workflow & backup system with 4GB of RAW files of people grinning into the camera. Once the adjustments have been made, the RAW files are just a ball & chain on your data management. And let's not forget, once you really know what you're doing, your jpegs should be good most of the time anyway.
I want RAW files as a safety net for errors in exposure and white balance. Once I know I have good photos, I don't need the safety net anymore- at least not at the price of all that hard disk space and transfer time for online backup. Of course, for my fine art stuff and important documentary work, I'll always keep the RAWs permanently. But not for routine parties/events.
You put your finger on the problem with re-importing jpegs as a solution. You lose your metadata- rankings/album memberships, etc. This is no solution!
What I want is simple, and it would be immediately useful to countless photographers:
1) Let me batch-delete RAW files when the jpegs are ok.
2) Let me do adjustments on my RAW file, render out a high-quality jpeg, and make the jpeg my new master.
Whoever does this first - Aperture or Lightroom - that's the product I'll use. -
To retrieve the PRT document (a PDF file) and insert the doc in PM order
Hello guys,
I have a challenging task in from printing as follows,
By using TC: IW3D we get print preview of PM Order Set (PM Print Program: YIPRJT01), currently the PRT document number prints in the PM Order. Now we have to insert the PRT documents (a PDF file) into the PM Order set rather than printing the PRT document number ( By using TC: IW33 by going OPERTIONAL TAB we will get the PRT document(a PDF file))
The requirement is to retrieve the PRT document (a PDF file) and insert the document in PM order set with out navigating separately by using the TC: IW33.
If you run the script in the print preview we can able to see PM the order set along with the PRT document (a PDF file).
Thanks & Regards
VishnuI'm also trying to print PRT document with shop papers and still not able to do so. I selected "P" for print on the control key and it should print but still didn't print.
If I understand it right, I think you are trying to do the same.
Have you resolved this issue ?
Thank you,
Sam -
How can i read the text files and buffer the data in Vector?
hi. I have been running into this problem for days, but with no luck and losing right direction.
The problem is : I am trying to read a text file and buffer the data into a
Queue for each user.
the sample text file is as below:( 1st column is timestamp, 2nd is user_id, 3rd is packet_id, 4th is packet_seqno, 5th is packet_size)
0 1 1 1 512
1 2 1 2 512
2 3 1 3 512
3 4 1 4 512
4 5 1 5 512
5 6 1 6 512
6 7 1 7 512
7 8 1 8 512
8 9 1 9 512
9 10 1 10 512
10 1 2 11 512
11 2 2 12 512
12 3 2 13 512
13 4 2 14 512
14 5 2 15 512
15 6 2 16 512
16 7 2 17 512
17 8 2 18 512
18 9 2 19 512
19 10 2 20 512
20 1 3 21 512
21 2 3 22 512
22 3 3 23 512
23 4 3 24 512
24 5 3 25 512
25 6 3 26 512
26 7 3 27 512
27 8 3 28 512
28 9 3 29 512
29 10 3 30 512
30 1 4 31 512
31 2 4 32 512
32 3 4 33 512
33 4 4 34 512
34 5 4 35 512
35 6 4 36 512
36 7 4 37 512
37 8 4 38 512
38 9 4 39 512
39 10 4 40 512
40 1 5 41 512
41 2 5 42 512
42 3 5 43 512
43 4 5 44 512
44 5 5 45 512
45 6 5 46 512
46 7 5 47 512
47 8 5 48 512
48 9 5 49 512
49 10 5 50 512
50 1 6 51 512
51 2 6 52 512
52 3 6 53 512
53 4 6 54 512
54 5 6 55 512
55 6 6 56 512
56 7 6 57 512
57 8 6 58 512
58 9 6 59 512
59 10 6 60 512
60 1 7 61 512
61 2 7 62 512
62 3 7 63 512
63 4 7 64 512
64 5 7 65 512
65 6 7 66 512
66 7 7 67 512
67 8 7 68 512
68 9 7 69 512
69 10 7 70 512
70 1 8 71 512
71 2 8 72 512
What I wanna do is to read all the data above and buffer them in a queue for each user( there are only 10 users in total).
I already created a class called Class packet:
public class packet {
private int timestamp;
private int user_id;
private int packet_id;
private int packet_seqno;
private int packet_size;
/** Creates a new instance of packet */
public packet(int timestamp,int user_id, int packet_id,int packet_seqno, int packet_size)
this.timestamp = timestamp;
this.user_id=user_id;
this.packet_id=packet_id;
this.packet_seqno=packet_seqno;
this.packet_size=packet_size;
}then I wanna to create another Class called Class user which I can create a queue for each user (10 users in total) to store type packet information. the queue for each user will be in the order by timestamp.
any idea and sample code will be appreciated.Doesn't sound too hard to me. Your class User (the convention says to capitalize class names) will have an ArrayList or Vector in it to represent the queue, and a method to store a Packet object into the List. An array or ArrayList or Vector will hold the 10 user objects. You will find the right user object from packet.user_id and call the method.
Please try to write some code yourself. You won't learn anything from having someone else write it for you. Look at sample code using ArrayList and Vector, there's plenty out there. Post in the forum again if your code turns out not to behave. -
I want to add hyperlink in the illustrator file and want the output in the PDF
I want to add hyperlinks in the illustrator file and want the output in the PDF.
I tried to add the multiple hyperlinks on the text and images in the illustrator by using the attribute panel but the links are not working in the published PDF.
Is there is any other method to create a hyperlink in the illustrator?
Can anybody help me out in this
ThanksInteresting, Carlos.
There's another method by JET: Re: hyperlinks in Ai -
my iPod has not been working for a month now and i was hoping that you could help me.The part where you charge and sync the iPod is not connecting.There is defiantly not the lead as we use it for the iPhone and that works please could you help!
yours sincerly
jackfromsurreyWhat I am saying is ..........
The iPhone HAS to be active making calls on the UK carrier network for the carrier to identify as "theirs" and therefore eligible for the Carrier to unlock
The way to achieve this is to use a PAYG sim making and receiving calls to establish a customer relationship with the Carrier and then follow the Carrier's process to unlock
With a PAYG it usually means adding a specified (by the carrier ) amount usually £15 /£20 depending on the carrier
This is how O2 function and according to Gemma this is how Vodafone work -
Scenario to recevie a message and process the fields
Hi,
I am new to JMS and I have a scenario :
I will be getting a message from MQ queue and I have to read that message object and parse using a delimiter | and process the fields to a POJO class to pass to another program X.java.
Now X.java will pass the parameters to a web service and print a document.
So It would be great if you can help me out on steps to acheive this task. I am reading about JMS and understood that i have to code a MDB class which reads the message object in onMessage method ?
Thanks
MohitHi,
I am new to JMS and I have a scenario :
I will be getting a message from MQ queue and I have to read that message object and parse using a delimiter | and process the fields to a POJO class to pass to another program X.java.
Now X.java will pass the parameters to a web service and print a document.
So It would be great if you can help me out on steps to acheive this task. I am reading about JMS and understood that i have to code a MDB class which reads the message object in onMessage method ?
Thanks
Mohit -
Get the session trace files and also the TKPROF reports for storedprocedure
Hi ,
I am trying to find out the bottlenecks on a storedprocedure, which does a insert into a table, where the target table has lot of indexes/constraints, so i want to see, which indexes/constraints is causing the problem. so in order to do I want to get the session trace files and also the TKPROF reports to see the bottlenecks for a oracle stored procedure,
Could you please give us the list of steps to get the tracefiles and tkprof reports.781649 wrote:
Thanks for input, i am using oracle10g standard edition. i dont think i have these tools available (DBMS_PROFILER or DBMS_HPROF). Did you even bother to try the following?
SQL> DESC DBMS_PROFILER
SQL> DESC DBMS_HPROF
I understand it would be too much to expect you to actually Read The Fine Manual
I am using bulk collect for all in my storedprocedure to insert the rows into a big table. In order to perform analysis on this bulk collect which tool will help me to identify the bottlenecks .
I want to compare background session properties for both runs (like inserting the data with indexes/constraints vs without indexes/constraints). please let me know..I am willing to bet you the problem/slowness is on the SELECT side & not the INSERT!
Just Curious
Handle: 781649
Status Level: Newbie
Registered: Jul 12, 2010
Total Posts: 35
Total Questions: 17 (14 unresolved)
Why so many unanswered questions?
Edited by: sb92075 on Jan 17, 2012 3:13 PM -
How do i delete a part of a clip and rejoin the audio on each side
How (or where in the manual are the instr) l) do i delete a part of a clip and rejoin the audio on each side. This is most frustrating. The join command is never available. If i select an area to delete everything above and below is deleted, whether or not its selected and whether or not its mute. I find in the manual only ways to move entire clips. I need to remove 2 words from a clip in one track.
i'm assuming your working in the multi-track mode since you didn't specify. select the razor blade tool and make two cuts to the audio, one where you want the cut to start, the other where you want the cut to end. select this smaller region that you want to delete and press the delete key.
now you'll have a gap of silence where that unwanted clip was. select the clip(s) to the right of the cut and drag them left. the default behavior is to do a cross fade when the clips overlap. you'll probably have to play with the cross fade amount in order to get it to sound natural.
hope that helps!
scott
PowerMac G5 2.5GHz Mac OS X (10.4.7) MacBook Pro 2.0GHz -
Parsing an EDI file and populating the data into database table
Hi ,
Please help me in parsing an edi file and getting the required columns.
we get an EDI file from a bank. I need to parse that file and populate the db table with the required columns.
the file is '*' delimited and every line ends with '\'.
The record starts with 'ST*' and ends with 'SE*'.
sample edi file is
ISA*00* *00* *ZZ*043000096820 *ZZ*2156833510 *131202*0710*U*00401*000001204*0*P*>\ ignore first 2 lines
GS*RA*043000096820*2156833510*131202*0710*1204*X*003020\
ST*820*000041031\
BPR*X*270*C*ACH*PPD*01*101036669***9101036669**01*031000053*DA*00000008606086714*131202\
TRN*1*101036661273032\
DTM*007*131202\
N1*1U*BPS\
N1*BE*MICHAEL DRAYTON*34*159783633\
N1*PE*BPS*ZZ*183383689C2 ABC\
N1*PR*ABC TREAS 310\
SE*9*000041031\ ST*820*000041032\
BPR*X*686*C*ACH*PPD*01*101036669***9101036669**01*031000053*DA*00000008606086714*131202\
TRN*1*101036661273034\
DTM*007*131202\
N1*1U*BPS\
N1*BE*SAMIA GRAVES*34*892909238\
N1*PE*BPS*ZZ*184545710C5 ABC\
N1*PR*ABC TREAS 310\
SE*9*000041032\
Below is the procedure I am trying to use for parsing that file. but the logic is not working. can you please help me in doing this. its very urgent requirement.
CREATE OR REPLACE package body p1 is
Function parse_spec(p_str varchar2) return t_str_nt is
begin
return regexp_replace(p_str,'\\$',null);
end;
procedure edi( is
l_out_file utl_file.file_type;
l_lin varchar2(200);
field1 number(9);
field2 varchar2(10 byte);
field3 varchar2(15 byte);
field4 varchar2(15 byte);
field5 varchar2(20 byte);
field6 varchar2(20 byte);
field7 varchar2(20 byte);
field8 varchar2(9 byte);
field9 varchar2(15 byte);
field10 varchar2(5 byte);
l_item_nt t_str_nt:=t_str_nt();
begin
l_out_file := utl_file.fopen (file_path, file_name, 'r');
IF utl_file.is_open(l_out_file) THEN
LOOP
BEGIN
l_item_nt:= utl_file.get_line(l_out_file, l_lin);
IF l_item_nt IS NULL THEN
raise no_data_found;
Else
for k in 1..l_item_nt.count loop
case
when l_item_nt(k) like 'ST*%' then
field1:= ltrim(regexp_substr(parse_spec(l_item_nt(k)),'[^*]+',1,3),0);
when l_item_nt(k) like 'BPR*X*%' then
field2 := regexp_substr(parse_spec(l_item_nt(k)),'[^*]+',1,3);
when l_item_nt(k) like 'TRN*1*%' then
field3:= regexp_substr(parse_spec(l_item_nt(k)),'[^*]+',1,3);
when l_item_nt(k) like 'DTM*007*%' then
field4:= regexp_substr(parse_spec(l_item_nt(k)),'[^*]+',1,3);
when l_item_nt(k) like '%*BE*%' then
field5 := regexp_substr(regexp_substr(parse_spec(l_item_nt(k)),'[^*]+',1,3),'[^ ]+', 1, 1);
field6 := regexp_substr(regexp_substr(parse_spec(l_item_nt(k)),'[^*]+',1,3),'[^ ]+', 1, 1);
field7 := regexp_substr(parse_spec(l_item_nt(k)),'[^*]+',1,5);
when l_item_nt(k) like '%*PE*%*ZZ*%' then
field8:= regexp_substr(regexp_substr(parse_spec(line),'[^*]+',1,5),'[^ ]+',1,1)
field9 := regexp_substr(regexp_substr(parse_spec(line),'[^*]+',1,5),'[^ ]+',1,2);
when l_item_nt(k) like 'SE*%' then
insert into t1(field1,field2,field3,field5,field6,field7,field8,field9)
-- values(field1,field2,field3,field5,field6,field7,field8,field9);
else
dbms_output.put_line ('end of line');
end case;
end loop;
end if;
end loop;
utl_file.fclose(l_out_file);
exception
when no_data_found then
dbms_output.put_line('No data found');
end;I would not use regular expressions for parsing as it is CPU intensive - and standard string processing suffices.
I would break the EDI up into lines. I would tokenise each line. I then have 2d array that can be referenced to find a specific field. E.g. line x and token y is field abc.
Basic approach:
SQL> create or replace type TStrings as table of varchar2(4000);
2 /
Type created.
SQL> -- create a parser that tokenises a string
SQL> create or replace function Tokenise(
2 csvLine varchar2,
3 separator varchar2 default ',',
4 enclosedBy varchar2 default null
5 ) return TStrings is
6 strList TStrings;
7 str varchar2(32767);
8 i integer;
9 l integer;
10 enclose1 integer;
11 enclose2 integer;
12 encloseStr varchar2(4000);
13 replaceStr varchar2(4000);
14
15 procedure AddString( line varchar2 ) is
16 begin
17 strList.Extend(1);
18 strList( strList.Count ) := Replace( line, CHR(0), separator );
19 end;
20
21 begin
22 strList := new TStrings();
23
24 str := csvLine;
25 loop
26 if enclosedBy is not null then
27 -- find the ennclosed text, if any
28 enclose1 := InStr( str, enclosedBy, 1 );
29 enclose2 := InStr( str, enclosedBy, 2 );
30
31 if (enclose1 > 0) and (enclose2 > 0) and (enclose2 > enclose1) then
32 -- extract the enclosed string
33 encloseStr := SubStr( str, enclose1, enclose2-enclose1+1 );
34 -- replace the separator char's with zero char's
35 replaceStr := Replace( encloseStr, separator, CHR(0) );
36 -- and remove the enclosed quotes
37 replaceStr := Replace( replaceStr, enclosedBy );
38 -- change the enclosed string in the big string to the replacement string
39 str := Replace( str, encloseStr, replaceStr );
40 end if;
41 end if;
42
43 l := Length( str );
44 i := InStr( str, separator );
45
46 if i = 0 then
47 AddString( str );
48 else
49 AddString( SubStr( str, 1, i-1 ) );
50 str := SubStr( str, i+1 );
51 end if;
52
53 -- if the separator was on the last char of the line, there is
54 -- a trailing null column which we need to add manually
55 if i = l then
56 AddString( null );
57 end if;
58
59 exit when str is NULL;
60 exit when i = 0;
61 end loop;
62
63 return( strList );
64 end;
65 /
Function created.
SQL>
SQL>
SQL> declare
2 ediDoc varchar2(32767) :=
3 'ISA*00* *00* *ZZ*043000096820 *ZZ*2156833510 *131202*0710*U*00401*000001204*0*P*>\GS*RA*043000096820*2156833510*131202*0710*1204*X*003020\ST*820*000041031\BPR*X*270*C*ACH*PPD*01*101036669***9101036669**01*031000053*DA*00000008606086714*131202\TRN*1*101036661273032\DTM*007*131202\N1*1U*BPS\N1*BE*MICHAEL DRAYTON*34*159783633\N1*PE*BPS*ZZ*183383689C2 ABC\N1*PR*ABC TREAS 310\SE*9*000041031\ST*820*000041032\BPR*X*686*C*ACH*PPD*01*101036669***9101036669**01*031000053*DA*00000008606086714*131202\TRN*1*101036661273034\DTM*007*131202\N1*1U*BPS\N1*BE*SAMIA GRAVES*34*892909238\N1*PE*BPS*ZZ*184545710C5 ABC\N1*PR*ABC TREAS 310\SE*9*000041032\';
4
5 lines TStrings;
6 tokens TStrings;
7 begin
8 -- split EDI string into lines
9 lines := Tokenise( ediDoc, '\' );
10
11 -- process line and extract fields
12 for i in 3..lines.Count loop
13 dbms_output.put_line( '***********************' ) ;
14 dbms_output.put_line( 'line=['||lines(i)||']' );
15 tokens := Tokenise( lines(i), '*' );
16
17 for j in 1..tokens.Count loop
18 dbms_output.put_line( to_char(j,'00')||'='||tokens(j) );
19 end loop;
20 end loop;
21 end;
22 /
line=[ST*820*000041031]
01=ST
02=820
03=000041031
line=[BPR*X*270*C*ACH*PPD*01*101036669***9101036669**01*031000053*DA*00000008606086714*131202]
01=BPR
02=X
03=270
04=C
05=ACH
06=PPD
07=01
08=101036669
09=
10=
11=9101036669
12=
13=01
14=031000053
15=DA
16=00000008606086714
17=131202
line=[TRN*1*101036661273032]
01=TRN
02=1
03=101036661273032
<snipped>
Maybe you are looking for
-
VMS Integration with CRM System
Dear All, I need help in the area of VMS Integration with CRM 5.0 system and the necessary settings for this. Here VMS is going to be the Back-end system for CRM and the Data Flow between CRM and VMS vise versa. We are using IC winclient as a chann
-
Show document as thumbnail in jsp
Hi everyone, I want to display the content of my site (doc file) in a thumbnail view. how can i do that? Thanxs in advance
-
Search help F4IF_SHLP_EXIT_EXAMPLE
I have a requirement regarding F4 help. When I click on the zoom button for vendor code, the list of values according to the coding given in serach help exit should get displayed with only company code as input. The list of vendors is picked from LFa
-
Webpage cuts off, no scroll bar.
Hey, I'm a beginner so please take it easy on me. I'm trying to create a website for my wife. Everything is completed and it looks great. The only problem I'm having is that when my wife goes to view the websit on her computer (much smaller size).
-
I made this Oracle cheat sheet as I see so many questions about starting and stoping Oracle: Oracle URL Links Oracle Enterprise Manager: http://host.domain:5500/em/ Oracle IsqlPlus Manager: http://host.domain:5560/isqlplus Oracle IsqlPlus Manager DBA