Tuesday, November 23, 2010

Msx Roms Metal Gear Englsh

VIM III: Vim hints

In the previous entry enter some basic commands for using VIM, today will expand the number of commands that can be used in this text editor.
  • dd: Delete the line in which the cursor is located.
  • r: Replace the character on which the cursor is positioned.
  • ~: Replace the character on which the cursor is positioned by a capital letter if the character was lower case or lower case if the character was capitalized.
  • u: Undo the last change made to the document.
  • [ctrl] + r: Redo the last change waste.
  • Y: Copy the contents of the line in which the cursor.
  • p: Paste the last cut or copied item, ie you can copy the last line deleted with "dd" or copied the last line with "Y". It is worth mentioning that this copy is in the position following the current cursor location.
  • G: Go to the top of the last line of the document.
  • 1G: Lets go to the top of the first line of the document.
  • w: Lets move from one floor to the start of the next word, ie, you can move from one floor to another. "W" has the same effect.
  • b: You can go back from a word at the beginning of the same word, that is, they can go back one word to another. "B" has the same effect.
  • m: Make a mark on the document at the beginning of the line where the cursor. Ma ie, that position is marked and the name of the brand is a.
  • ': Returns to the location of a brand created earlier. Eg 'a, is accessed that contains the brand position a.
This editor also allows searches on the document, for this you must use the "/" character.
  • / frase_buscada: Allows a search on the document.
  • n: Access to the next position where the word or phrase.
  • N: Access to the previous position where the word or phrase.
is important to mention that VIM also allows you to search with regular expressions.

As mentioned in previous post also can execute commands preceded by ":" then you add new commands.
  • :% s / frase_buscada / frase_nueva / g: You can substitute one phrase for another in the whole document. The "%" indicates that the search should be made throughout the document, the "s" indicates that the operation to be performed is substitution between the first and second "/" is entered the search phrase, between the second and the third "/" is entered new phrase and the "g" at the end of the line indicates that if the phrase is more than once in a line, it replaces all the times you are.
  • : 'a,' bs / frase_buscada / frase_nueva / g: You can substitute one phrase for another in the document between two marks. The "'a,' b 'indicates that the search should be made between the" a "and" b "of the document, the" s "indicates that the operation to be performed is substitution between the first and second" / "Entering the phrase to search, between the second and third" / "new phrase is entered and the" g "at the end of the line indicates that if the phrase is more than once in a line, is replaced All times are.
  • : 'a,' bd: Clears all lines located between the "a" and "b". The marks "'a,' b 'indicates that the lines will be eliminated should be between the" a "and" b ", the letter" d "indicates that the operation to be performed is to remove the lines.
  • : set nosmartindent: Removes autoindexación in the document.
  • : set smartindent: Add the autoindexación in the document.

"Thank you for sharing your knowledge"

Monday, November 22, 2010

Is It Possible To Pop A Syphilis Sore

VIM II: Vim hints

The vast majority of Linux-based operating systems containing the VIM text editor called for many seems very difficult to use, but it also allows it to be very powerful in editing text.

Before writing some commands that are useful considered that I should note that this text editor is separated into two environments where the cursor, the first is the mode where you can enter commands to get this environment must press the Esc key. The other setting is where you can edit the text. Here are some commands that may be useful to begin working with VIM.

  • i: enter text in the above position at which the cursor is located.
  • to: enter text in position after which the cursor is located.
  • I: enter text at the beginning of the line.
  • A: enter text at the end of the line.
  • o: enter text at the beginning of the next line.
  • x: delete the character of the document on which the cursor (button "Delete" or "Del" has the same effect.)
The commands described above must be entered when in command mode, ie after pressing the Esc key. To run some commands in VIM after pressing the Esc key must be pressed before key ":" (colon). Below are some these commands.
  • : w: save the file contents.
  • : q: Exit the document.
  • : q! : Used to exit the document without saving changes have been made. These command
allow text edits pretty basic, but are the starting point for working with VIM.

"Thank you for sharing your knowledge"

Tuesday, November 9, 2010

Headaches Digital Piano Dizziness

PostgreSQL: Extract fields from a PostgreSQL

One of the most stored in the database are the date, there are times when you should get some date fields to be used for this table People created as shown below:

create table people (
   id                     SERIAL      NOT NULL,
   rut                   varchar(15) NULL,
nombre varchar (30) NULL,
apaterno varchar (30) NULL,
amaterno varchar (30) NULL,
fecha_nac dating NULL,
   hora_nac         time NULL,
   sexo                 varchar(1)  NULL,
   direccion         varchar(30) NULL,
   ciudad             varchar(30) NULL,
   telefono           integer     NULL,
   created            timestamp   NOT NULL,
   modified          timestamp   NULL, constraint
pk_personas primary key (id)
)

be rescued from this table each of the fields in the creation of separate registration for others and get the day of the week corresponding date record creation. SELECT


rut,
extract (year from created):: int as anyo,
extract (month from created):: int as month,
extract (day from created):: int as day
extract (hour from created):: int as hour,
extract (minute from created):: int as minute,
extract (second created from):: int as second
CASE extract (dow from created)
WHEN 0 THEN 'Sunday' WHEN 1 THEN
'Monday' WHEN 2 THEN
'Tuesday' WHEN
3 THEN 'Wednesday' WHEN 4 THEN
'Thursday' WHEN 5 THEN
'Friday' WHEN 6 THEN
'Saturday' END


dow FROM
as people
;

With this query you get all the date of creation completely broken, besides giving the day of the week that was created using CASE to choose from among the values \u200b\u200bobtained value and converts it into a string with the name of the day.

extract (field from source)

Retrieves the values \u200b\u200bof a date / time, where the source is a field of data type date / time, in this case including a timestamp, while the field is the type of value recovered from the date the existing fields in the variables of time stamps are:
  • century: the century of the return date, there century 0, only exists from -1 to 1. Eg 2000 is the 20 th century, while 2001 is the 21 st century.
  • day: returns the day of the month, going from 1 to 31 according to the corresponding month.
  • Decade: divide the field year at 10. Ie the year 2001 would be the decade 200.
  • dow: returns the day of the week ranging from 0 to 6, where 0 corresponds to Sunday.
  • I: Returns the day of the year which runs from 1 to 365/366 as appropriate.
  • epoch: returns the number of seconds since 1/1/1970. This value can be negativo.También can be used to obtain the number of seconds in a time interval. Eg SELECT EXTRACT (EPOCH FROM INTERVAL'5 day 3 hours');
  • hour: returns the time of the date, this value is between 0 and 23.
  • microseconds: The time in seconds, including the fractional part multiplied by 1,000,000.
  • millennium: Returns the value of the millennium year. Ie the year 1990 is the millennium 2, 2001 is the millennium 3.
  • milliseconds: Returns the seconds of time field multiplied by 1,000.
  • minute: Returns the minutes of the field, this value is defined between 0 and 59.
  • month: For timestamp values, returns the number of the month without the year, values \u200b\u200bare defined between 0 and 12. It also allows intervals of months. Eg SELECT EXTRACT (MONTH FROM INTERVAL '2 years 3 months');
  • quarter: Divide the year and returns four values \u200b\u200bbetween 1 and 4, as the interval that is the day of the year.
  • second: returns the number of seconds including the fractional part of the field.
  • timezone: UTC time zone, measured in seconds, positive values \u200b\u200bcorrespond to the time zone east of UTC, negative values \u200b\u200bto the time zone west of UTC.
  • timezone_hour: Time for time zone.
  • timezone_minute: The minutes for the zone.
  • week: The number of days of the year.
  • year: returns the year of the date, no year 0, so there years before Christ and after Christ.
"Thank you for sharing your knowledge"