---------- Post updated at 08:02 AM ---------- Previous update was at 07:55 AM ----------
You have "\n" in the java script, so will not get what you want!
--ahamed
Okay, I get "awk: cmd. line:1: warning: escape sequence `\/' treated as plain `/'" when I run the command but I do get the text insertion.
You are correct though. I do not get "\n" in the insertion. This script is for printing a specific section of a web page when clicking a print button. If I remove the \n's it still works, however, it seems to print in landscape rather than portrait. Am I correct in assuming \n indicates newline? Any way to circumvent the \n situation?
I am iterating record by record through a file as below,
A,B
A,C
A,D
B,E
B,F
E,G
E,H
The same file should look like in the final output as below,
A,B
B,E
E,G
E,H
B,F
A,C
A,D (10 Replies)
Hi all,
I need to insert new text and change existing text in a file. For that I used the below line in the command line and got the expected output.
sed '$a\
hi...
' shell > shell1
But I face problem when using the same in script. It is throwing the error as,
sed: command garbled:... (4 Replies)
Hi ,
This is my first thread ; facing some issues withmy sed script
I need to insert the code from my log file which is between two keywords.
content is like this ........
log
############################
log1 log2
231 "Ban" "tom" and the line one of the cross line
friend... (2 Replies)
Hi All ,
Given a file , I need to delete , modify and insert lines matching certain patterns in that file using shell scripting.
e.g. If a file FILE1 has following content :
CUST.ABC.DEF = CUST.ABC.DEF * CUST.ABC.DEF
PRINTF(CUST.ABC.DEF)
CUST.ABC.DEF = mid(CUST.ABC.DEF,10.34)... (5 Replies)
Hi,
For the text file let us say t.txt having the statements as below.
filename : t.txt.
Contents :
This is first string1
This is first string2
This is first string3
The output of the file should have newline. How to introduce the new line so that the output be as follows
... (5 Replies)
Hello,
I have two text files (txt1 and txt2). txt1 contains many lines with a single number in each line. txt2 (xml format) contains information about the numbers given in txt1. I need to insert one line in txt2 within the scope of each number taken from txt1.
Sample problem:
txt1:
12
23... (1 Reply)
I have a huge file with record length around 5000 characters.
There is an ETL tool datastage which is writing this data to the file(AIX server). At position 4095 i have seen NULL Character(^@).
when i am using this command "head -1 file_nm | sed 's/\000//g'" --- the output is displaying... (3 Replies)
Hi There,
I am trying to load data from a csv file into a DB during our DB migration phase. I am successfully able export all data into a .csv file but those have to rewritten in terms insert statement which will allow for further population of same data in different DB
My exiting csv record... (6 Replies)
I have a script which is extracting data from a database in an excel file in below given format,
date_time calling_app1 count of requests
date calling_app x 34
date calling_app y 1034
I want to write a script which will write data into a file like this ... (3 Replies)
Discussion started by: TNT47
3 Replies
LEARN ABOUT DEBIAN
jifty::manual::jquerymigrationguide
Jifty::Manual::jQueryMigrationGuide(3pm) User Contributed Perl Documentation Jifty::Manual::jQueryMigrationGuide(3pm)NAME
jQueryMigrationGuide - How to migrate your code to use jQuery.
Migrate your jifty app to jquery
Application developers may start the migration by modifying config.yml, setting the "ConfigFileVersion" to 4. If you did not write any
custom javascript code for your app, then you're done. Everything should just work.
If you did write some javascript code, but you did not use any of the functions defined in jifty*.js, prototype.js or scriptaculous.js,
then you're still good to go.
Otherwise, your code might need to be modified a little bit. Since both prototype.js and scriptaculous.js are removed by default, one
trivial choice is to simply bring them back. That is as easy as adding the Prototypism plugin to your Jifty application.
If you dislike Prototypism like we do, you can choose to re-write your code with jQuery. In the section "From Prototype to jQuery" below,
we provide some common patterns that can be applied to rewrite Prototypism code with jQuery, or with just normal javascript.
If you hack on Jifty's internals, please make sure you've read the following "Jifty API" section and Jifty::Manual::JavaScript to catch the
Javascript API updates since the removal of "prototype.js".
Although we've removed "prototype.js", we still prefer to use the non-conflict mode of jQuery. That is, "$" function is now undefined
instead of an alias to jQuery. This is to ensure that it's not conflicting with Prototypism anywhere. If you'd like to use "$" function,
create that alias in your "app.js" like this:
$ = jQuery;
However, instead of making a global alias, it's always recommended to localize this alias within a closure:
(function($) {
// $ is an alias to jQuery only inside this closure
$(".message").show();
})(jQuery);
Jifty API
We re-architected Jifty's javascript libraries to use jQuery. Especially the internal functions to process form elements.
The old, Prototype-based way is to extend Form object and the Form.Element object. Since the removal of the Prototype library, it is
dangerous to name those functions under Form because loading the Prototype library can destroy those Jifty functions.
The new jQuery-based way is to always extend internal functions under the Jifty object. "Form" becomes "Jifty.Form", "Form.Element" becomes
"Jifty.Form.Element", and so on. The detailed list of these functions are given in Jifty::Manual::Javascript. Most of those functions are
internal functions that you probably should not use directly.
From Prototype to jQuery
If you've ever written javascript code for your Jifty applications, and you'd like to remove the PrototypeJS library, here are some
mechanical rules to re-write prototype.js-based javascript code with jQuery.
Array iteration
From:
A.each( function( $_ ) { ... } )
To:
jQuery.each(A, function(index, value ) {
// "this" is an alias to current value.
})
Hash key iteration
From:
H = new Hash({...});
H.each(function( pair ) {
// pair.key is the key
// pair.value is the value
});
jQuery.each is designed to work on both "Array" and "Object" in the same way. So there's not much difference.
To:
// H can be any kind of "Object"
jQuery.each(H, function(key, value) {
// "this" is an alias to current value.
})
Object extend
From:
obj.extend({ ... }}
To:
jQuery.extend( obj, { ... } )
JSON
jQuery does not ship with the JSON stringify function, but since it neither altered the native Array, nor defined its own Hash, it's
acceptable and preferred to just use "JSON.stringify" from "json.js".
From:
// obj need to be one of those objects defined in C<prototype.js>
obj.toJSON();
To:
JSON.stringify( obj )
Effects
jQuery has a small set of default effects built into its core. They have different names then those defined in "scriptaculous.js". The
internal way to specify effects is using the "Jifty.Effect" method. Please see the detailed usage documentation in
Jifty::Manual::JavaScript.
perl v5.14.2 2010-12-08 Jifty::Manual::jQueryMigrationGuide(3pm)