Wednesday, November 26, 2008

Install sqlite3-ruby for Rails on Windows XP

A little bit of trouble when installing sqlite3-ruby on Windows. I get this error message:

C:\ruby\bin>gem install sqlite3-ruby
Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3-ruby:
        ERROR: Failed to build gem native extension.

C:/ruby/bin/ruby.exe extconf.rb install sqlite3-ruby
checking for fdatasync() in rt.lib... no
checking for sqlite3.h... no

nmake

Microsoft (R) Program Maintenance Utility   Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.

NMAKE : fatal error U1073: don't know how to make 'ruby.h'
Stop.


Gem files will remain installed in C:/ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4 for inspection.

Results logged to C:/ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4/ext/sqlite3_api/gem_make.out

Here are the steps I followed to install it:
1. Download sqlite-3 and sqlitedll-3 from sqlite download.
2. Unzip the files to c:\ruby\bin. Total of 3 files, sqlite3.exe, sqlite3.dll, sqlite3.def.
3. In command line: gem install --version 1.2.3 sqlite3-ruby

C:\ruby\bin>gem install --version 1.2.3 sqlite3-ruby
Successfully installed sqlite3-ruby-1.2.3-x86-mswin32
1 gem installed
Installing ri documentation for sqlite3-ruby-1.2.3-x86-mswin32...
Installing RDoc documentation for sqlite3-ruby-1.2.3-x86-mswin32...
Enjoy...

Nice Introduction to REST

I'd like to take note of this link to a video by Joe Gregorio. It's a nice introduction to REST architectural style.

jQuery notes

Looking into jQuery. Some of my notes as I go...

It is interesting to note that for the $() function, it removes the need to do a for loop to access a group of elements since whatever put inside the parentheses will be looped through automatically and stored as a jQuery object.

Common examples on using the $() factory function:

Element Sample jQuery Meaning
tag name $('p') gets all paragraphs in the document.
id $('#some-id') gets the single element in the document that has the corresponding some-id ID.
class $('.some-class') gets all elements in the document that have a class of some-class.

Thursday, November 20, 2008

In search of... Latin Phrases

We use common phrases that are really not english but are well understood. Where do those come from really? And what do they actually mean? Next time if you encounter "et al.", "e.g.", "carpe diem", "alter ego", "alma mater", "de facto", "pro bono", they are what's called 'Latin Phrases'. Some of them are really very interesting. I listed some phrases that are very common.

If you want to access more, look at wikipedia.

Latin Phrase Literal Translation Meaning
ad hoc to this Generally means "for this", in the sense of improvised on the spot or designed for only a specific, immediate purpose.
ad interim for the meantime As in the term "chargé d'affaires ad interim" for a diplomatic officer who acts in place of an ambassador.
affidavit he asserted A legal term from Medieval Latin referring to a sworn statement. From fides, "faith".
alma mater nourishing mother Term used for the university one attends or has attended. Another university term, matriculation, is also derived from mater. The term suggests that the students are "fed" knowledge and taken care of by the university. The term is also used for a university's traditional school anthem.
bona fide in good faith In other words, "well-intentioned", "fairly". In modern contexts, often has connotations of "genuinely" or "sincerely". Bona fides is not the plural (which would be bonis fidebus), but the nominative, and means simply "good faith". Opposite of mala fide.
carpe diem seize the day An exhortation to live for today. From Horace, Odes I, 11.8. By far the most common translation is "seize the day," though carpere normally means something more like "pluck," and the allusion here is to picking flowers. The phrase collige virgo rosas has a similar sense.
caveat emptor let the buyer beware The purchaser is responsible for checking whether the goods suit his need.
circa around In the sense of "approximately" or "about". Usually used of a date.
de facto in fact Said of something that is the actual state of affairs, in contrast to something's legal or official standing, which is described as de jure. De facto refers to the "way things really are" rather than what is "officially" presented as the fact.
e.g. 'for the sake of example' Abbreviation for exempli gratia, below.
et al. 'and others' Used similarly to et cetera ('and the rest'), to stand for a list of names. Alii is actually masculine, so it can be used for men, or groups of men and women; the feminine, et aliae (or et aliæ), is appropriate when the 'others' are all female. Et alia is neuter plural and thus properly used only for inanimate, genderless objects, but some use it as a gender-neutral alternative.[4] APA style uses et al. if the work cited was written by more than two authors; MLA style uses et al. for more than three authors.
habeas corpus having the body A legal term from the 14th century or earlier. Refers to a number of legal writs to bring a person before a court or judge, most commonly habeas corpus ad subjiciendum (you may have the body to bring up). Commonly used as the general term for a prisoner's legal right to challenge the legality of their detention.
in absentia in the absence Used in a number of situations, such as in a trial carried out in the absence of the accused.
modus operandi method of operating Usually used to describe a criminal's methods.
per annum "through a year" Thus, "yearly"—occurring every year.
per capita "through the heads" "Per head", i.e., "per person". The singular is per caput ("through a head").
per diem "through a day" Thus, "per day". A specific amount of money an organization allows an individual to spend per day, typically for travel expenses.
persona non grata "person not pleasing" An unwelcome, unwanted or undesirable person. In diplomatic contexts, a person rejected by the host government. The reverse, persona grata ("pleasing person"), is less common, and refers to a diplomat acceptable to the government of the country to which he is sent.
prima facie "at first sight" Used to designate evidence in a trial which is suggestive, but not conclusive, of something (e.g., a person's guilt).
pro bono "for the good" The full phrase is pro bono publico ("for the public good"). Said of work undertaken voluntarily at no expense, such as public services. Often used of a lawyer's work that is not charged for.
qui pro quo literally qui instead of quo Unused in English, but common in other modern languages (for instance Italian, Polish and French). Used as a noun, indicates a misunderstanding.
quorum "of whom" The number of members whose presence is required under the rules to make any given meeting constitutional.
re "[in] the matter of" More literally, "by the thing". From the ablative of res ("thing" or "circumstance"). Often used in e-mail replies. It is a common misconception that the "Re:" in correspondence is an abbreviation for regarding or reply; this is not the case. The use of Latin re, in the sense of "about, concerning", is English usage.
semper fidelis "always faithful" Motto of Exeter and several other cities; more recently has become the motto of United States Marine Corps and the Swiss Grenadiers. Also the motto of the Rot-Weiss Oberhausen and Plymouth Argyle football clubs. The US Marines often abbreviate it to Semper Fi.
sic "thus" Or "just so". States that the preceding quoted material appears exactly that way in the source, despite any errors of spelling, grammar, usage, or fact that may be present. Used only for previous quoted text; ita or similar must be used to mean "thus" when referring to something about to be stated.
status quo "the situation in which" The current condition or situation. Also status quo ante ("the situation in which [things were] before"), referring to the state of affairs prior to some upsetting event (cf. reset button technique).
sub poena "under penalty" Commonly rendered subpoena. Said of a request, usually by a court, that must be complied with on pain of punishment. Examples include subpoena duces tecum ("take with you under penalty"), a court summons to appear and produce tangible evidence, and subpoena ad testificandum ("under penalty to testify"), a summons to appear and give oral testimony.
verbatim "word for word" Refers to perfect transcription or quotation.
veto "I forbid" The right to unilaterally stop a certain piece of legislation. Derived from ancient Roman voting practices.

Wednesday, November 12, 2008

Lock request time out period exceeded

Got this error today from one of my databases I'm working on. Last night I added an index to one of my tables not realizing that it may result to slow inserts. Well, as my SSIS package ran early in the morning, it's taking time for it to finish. So I had to resort to brute force to stop it. Problem is when I did that, lock for that particular table wasn't automatically released, so how do I release it? Here's how...

-- list processes which are locked
exec sp_lock

-- find out dbid of database
-- try each of the dbids to find out
-- in this case '9' is the dbid of my database
select db_name(9)

-- look for the 'TAB' (table) type
-- then kill that process
-- to find the table, try ObjId's
USE <YourDb>
SELECT OBJECT_NAME(<ObjId>)

-- now kill
kill 57