Archive for the 'Tips and Trick' Category

Abbreviations howto

Saturday, December 3rd, 2005

Abbreviations work like code shortcuts. In other words you can assign a list of words (abbreviations) which will be replaced by their expanded text, using a keyboard shortcut

Manage Abbreviations:
Select from menu: Insert/Abbreviation../Manage

A dialog window will open where you can add and remove your abbreviations.
Now click on “Add” and in the upper list will appear a new row with only “new” written into.
Click on that item and give to your abbreviation a name. This name will be used later while you will write into your documents.
In the right column, instead, write the text which will replace your abbreviation, and use the “|” char in order to tell SEPY where to put the caret after the abbreviation will be inserted.

For example, when I wrote XML files I’m used to write many times < ![CDATA[....]]> and for this reason I’ve created an abbreviation which let me to just write “< !". Then, when I expand the abbreviation (menu Insert/Abbreviation../Expand) my new text is " Thus, my abbreviation name is “< !", while its Expansion is "

Into the abbreviations menu you have:
- Expand (which substitue the current phrase with its expansion)
- Insert (which will show you the list of avail abbreviations, double click on one of them to insert into the document current position)
- Manage (open the abbreviation manage dialog)

Recent Addition: Special Shortcuts

Wednesday, November 30th, 2005

One of the last addition in SEPY 1.5 was the “Special Shortcuts” feature.
This allows developers to create their own commands and assign a defid shortcut by selecting one or more commands from a specified list.
You can access from the keyboard shortcuts menu item (under tools).
Once the shortcuts panel has been opened select from the left list “Special Shortcuts”. Now you can add your commands using the “Add” button in the bottom right side of the panel.
Select one or more commands from the list you will see, give a it name (which will be used in the main menu), click ok and then assign it a shortcut.

*The only boring thing is that you must restart the application in order to have your new shortcuts working*

Here an explanation of the Special Shortcut list:

CommandAction
BACKTABDedent the selected lines
CANCELCancel any modes such as call tip or auto-completion list display
CHARLEFTMove caret left one character
CHARLEFTEXTENDMove caret left one character extending selection to new caret position
CHARRIGHTMove caret right one character
CHARRIGHTEXTENDMove caret right one character extending selection to new caret position
COPYCopy the selection to the clipboard
CUTCut the selection to the clipboard
DELETEBACKDelete the selection or if no selection, the character before the caret
DELETEBACKNOTLINEDelete the selection or if no selection, the character before the caret. Will not delete the character before at the start of a line.
DELWORDLEFTDelete the word to the left of the caret
DELWORDRIGHTDelete the word to the right of the caret
DOCUMENTENDMove caret to last position in document
DOCUMENTENDEXTENDMove caret to last position in document extending selection to new caret position
DOCUMENTSTARTMove caret to first position in document
DOCUMENTSTARTEXTENDMove caret to first position in document extending selection to new caret position
EDITTOGGLEOVERTYPESwitch from insert to overtype mode or the reverse
FORMFEEDInsert a Form Feed character
HOMEMove caret to first position on line
HOMEDISPLAYMove caret to first position on display line
HOMEDISPLAYEXTENDMove caret to first position on display line extending selection to new caret position
HOMEEXTENDMove caret to first position on line extending selection to new caret position
LINECUTCut the line containing the caret
LINEDELETEDelete the line containing the caret
LINEDOWNMove caret down one line
LINEDOWNEXTENDMove caret down one line extending selection to new caret position
LINEENDMove caret to last position on line
LINEENDDISPLAYMove caret to last position on display line
LINEENDDISPLAYEXTENDMove caret to last position on display line extending selection to new caret position
LINEENDEXTENDMove caret to last position on line extending selection to new caret position
LINESCROLLDOWNScroll the document down, keeping the caret visible
LINESCROLLUPScroll the document up, keeping the caret visible
LINETRANSPOSESwitch the current line with the previous
LINETRANSPOSEDOWNSwitch the current line with the next
LINEUPMove caret up one line
LINEUPEXTENDMove caret up one line extending selection to new caret position
LOWERCASETransform the selection to lower case
NEWLINEInsert a new line, may use a CRLF, CR or LF depending on EOL mode
PAGEDOWNMove caret one page down
PAGEDOWNEXTENDMove caret one page down extending selection to new caret position
PAGEUPMove caret one page up
PAGEUPEXTENDMove caret one page up extending selection to new caret position
REDORedoes the next action on the undo history
SELECTALLSelect all the text in the document
TABIf selection is empty or all on one line replace the selection with a tab character. If more than one line selected, indent the lines
UNDORedoes the next action on the undo history
UPPERCASETransform the selection to upper case
VCHOMEMove caret to before first visible character on line. If already there move to first character on line
VCHOMEEXTENDLike VCHome but extending selection to new caret position
WORDLEFTMove caret left one word
WORDLEFTEXTENDMove caret left one word extending selection to new caret position
WORDRIGHTMove caret right one word
WORDRIGHTEXTENDMove caret right one word extending selection to new caret position
ZOOMINMagnify the displayed text by increasing the sizes by 1 point
ZOOMOUT Make the displayed text smaller by decreasing the sizes by 1 point
DELLINELEFT:Delete back from the current position to the start of the line
DELLINERIGHT:Delete forwards from the current position to the end of the line
WORDPARTLEFT:Move to the next change in capitalisation
WORDPARTLEFTEXTEND:Move to the previous change in capitalisation extending selection to new caret position
WORDPARTRIGHT:Move caret right one word extending selection to new caret position
WORDPARTRIGHTEXTEND:Move to the next change in capitalisation extending selection to new caret position.

If you have any special shortcut you want to share you’re welcome here :)

Snippets How-To

Sunday, November 20th, 2005

What is a Snippet?
Snippets are little piece of code which are used many times in different projects. The snippets panel will help you to mmage this library (snippets are at least a code library).

How to Use in SEPY?
First you must open the Snippt panel from the panels list.
If you never use this panel you must first set a snippet base directory. This must be a valid directory on your hard disk, where all the snippets will be saved an managed by SEPY.
It is recomended to use a new empty directory for this. (Note that also after deleting a snippet, the file won’t be deleted, but only hidden from the panel and renamed from the filsystem).

Create a Snippet
From the contextual menu you can now manage the snippets panel adding folders and snippets.
Create a new snippet, chose a snippet name and then write into the just created file your snippet code. You can write anything you want in the snippet file (next time you will insert this snippet in a opened file all the code you wrote here will be inserted completely).

There also magic words which can be used in a snippet and they are:
@@variableName@@

This is, any word which start with a double “@@” and ends with a double “@@” is recognized as variable.
Next time you will use the snippet, sepy will ask you with which value you want to replace this variable. So, all the occurrences of @@variableName@@ will be replaced with this new value.

@@variableName=[defaultValue]@@

This is another way to specify a variable.
but in this way you also set a default value, which will be displayed by default in the snippet dialog when you want to insert the snippet.

This is a sample snippet:

var gatewayUrl:String = "@@gatewayUrl=[http://localhost/flashservices/gateway]@@";
NetServices.setDefaultGatewayUrl(gatewayUrl);
var conn = NetServices.createGatewayConnection();
var serv = conn.getService("@@serviceName@@", @@responder=[this]@@);

Which will produce this dialog when you’re going to insert the snippet:
entry dialog

Note
This dialog will appear only if you have set at least one variable in the snippet. For every variable set the value you want to assign, then press “Ok” and all the new code will be inserted in the current document

Using Regular Expressions

Thursday, November 10th, 2005

Some info about using regular expression in SEPY and in the Find&Replace in files:
Regular Expression Syntax

A regular expression (or RE) specifies a set of strings that matches it; the functions in this module let you check if a particular string matches a given regular expression (or if a given regular expression matches a particular string, which comes down to the same thing).

Regular expressions can be concatenated to form new regular expressions; if A and B are both regular expressions, then AB is also a regular expression. In general, if a string p matches A and another string q matches B, the string pq will match AB. This holds unless A or B contain low precedence operations; boundary conditions between A and B; or have numbered group references. Thus, complex expressions can easily be constructed from simpler primitive expressions like the ones described here. For details of the theory and implementation of regular expressions, consult the Friedl book referenced above, or almost any textbook about compiler construction.

A brief explanation of the format of regular expressions follows. For further information and a gentler presentation, consult the Regular Expression HOWTO, accessible from http://www.python.org/doc/howto.

Regular expressions can contain both special and ordinary characters. Most ordinary characters, like “A”, “a”, or “0″, are the simplest regular expressions; they simply match themselves. You can concatenate ordinary characters, so last matches the string ‘last’. (In the rest of this section, we’ll write RE’s in this special style, usually without quotes, and strings to be matched ‘in single quotes’.)

Some characters, like “|” or “(“, are special. Special characters either stand for classes of ordinary characters, or affect how the regular expressions around them are interpreted.

The special characters are:

“.”
(Dot.) In the default mode, this matches any character except a newline.

(more…)

How to add a new Language

Monday, July 18th, 2005

SE|PY support multilanguage i18n, using the standard gettext files (.mo)
Some languages are already available with the standard installation, thanks to various developers who made the translations. But if your language is not listed in the availables languages (under preference panel) you can easily add a new one.
Just follow these steps:

  1. Download and install poEdit from http://poedit.sourceforge.net/
  2. Locate the SEPY installation dir on your hard disk and open SEPY_en.po
  3. Download the mki18n.zip maker ( it’s an executable compiled from a python script )

Now, let’s say you want to translate sepy in “Italian”.

  1. Rename SEPY_en.po file into SEPY_it.po.
  2. Open SEPY_it.po file with poEdit, make all the translations (please note that for some translation such as Overview, PREF_PAGE4_HELP1 and all the others with all CAPS characters, you need to translate not the left side, but the right side)
  3. Save the file and copy it into the same folder where you unzipped the mki18n.zip file.
  4. Open command prompt and go to the folder where you extracted mki18n.exe. Type the command:
    mki18n.exe -m -e -v –domain=SEPY

and if everything works correct you should see a new “locale” directory created with this content:

/locale/it/LC_MESSAGES/SEPY.mo

  1. In this folder create an empty file “tips.txt”
  2. Copy the folder “it” into your sepy installed directory “locale”
    for example: C:\program files\SEPY\locale\ < -- here put the "it" folder
  3. Restart SEPY and see if in the preference panel your language appears.

This article refers to versions above 1.0.6.3

“” Extra characters issue

Friday, June 10th, 2005

If you’re using SEPY to edit files to be included in Flash MX rather than in Flash mx 2004 or above, you maybe noticed that extra characters are saved by default “”.
This is due to the default sepy settings which save files in UTF-8 format adding the UTF BOM header.
Flash mx, even if support utf8 file format, does not support the header BOM. so you need to go into preferences and uncheck option “Write UTF BOM”.

(more…)