Friday, August 6, 2010

Trigger Content

Sql Server:
SELECT TR.NAME, COM.*
FROM SYS.TRIGGERS TR, SYSCOMMENTS COM
WHERE TR.OBJECT_ID = COM.ID
AND TR.NAME='triggerhere'

Oracle:
SELECT *
FROM all_constraints
WHERE table_name='NAME_OF_YOUR_TABLE'
AND constraint_type='C';

Sunday, March 28, 2010

Synclock

"A SyncLock block behaves like a Try...Finally construction in which the Try block acquires an exclusive lock on lockobject and the Finally block releases it. Because of this, the SyncLock block guarantees release of the lock, no matter how you exit the block. This is true even in the case of an unhandled exception." - MSDN
Public Sub Foo()
Dim sText As String
Dim objLock As Object = New Object()
Try
Monitor.Enter(objLock)
Try
sText = "Hello"
Finally
Monitor.Exit(objLock)
End Try
Catch e As Exception
MessageBox.Show(e.Message)
End Try
End Sub
- DeveloperFusion

Friday, March 26, 2010

C: Compiling GNU Projects on Windows

I wanted to port the programs I commonly use on Linux to Windows. In particular I have been working on wdiff. A program that compares the differences word by word of two files.

Currently I have been able to successfully compile the program on windows through Cygwin. I also was able to reproduce it on my colleges Redhat server.

The steps I took were:

wget http://ftp.gnu.org/gnu/wdiff/
tar -xzvf wdiff-0.5.tar.gz
cd wdiff-0.5
./configre
make (install) wdiff

However, I would like to run the program natively on Windows similar to the Project: UnixUtils.

I am currently working on a custom port due to the fact that I cannot run ./configure to establish a make file. Suggestions would be greatly appreciated.

Sunday, January 31, 2010

Python vs Perl

EXTERIOR: DAGOBAH -- DAY
With Yoda strapped to his back, Luke climbs up one of
the many thick vines that grow in the swamp until he
reaches the Dagobah statistics lab. Panting heavily, he
continues his exercises -- grepping, installing new
packages, logging in as root, and writing replacements for
two-year-old shell scripts in Python.

YODA: Code! Yes. A programmer's strength flows from code
maintainability. But beware of Perl. Terse syntax... more
than one way to do it... default variables. The dark side
of code maintainability are they. Easily they flow, quick
to join you when code you write. If once you start down the
dark path, forever will it dominate your destiny, consume
you it will.

LUKE: Is Perl better than Python?

YODA: No... no... no. Quicker, easier, more seductive.

LUKE: But how will I know why Python is better than Perl?

YODA: You will know. When your code you try to read six months
from now.

Taken from: Python Humor

Thursday, January 21, 2010

Wednesday, November 18, 2009

C++ Inheritance

Implicit vs Explicit Calls in C++


(Base&)*this = rhs; // IMPLICIT CALL
(*this).Base::operator=(rhs); // EXPLICIT CALL

Tuesday, October 27, 2009

Categorical Syllogisms

I decided to review my Categorical Syllogisms. Since I am a Philosophy major I think its important to stay current in logic as its crucial in any philosophical discussion; perhaps I can go as far as saying logic is the fundamental of any worthwhile discussion. The next few posts will relate to Philosophy and Argumentative Logic.

Today I am reviewing Categorical Syllogism as there are only 5-7 rules of Syllogisms depending on your source. Some sources like to combine syllogistic rules.

A Categorical Syllogism is represented by three terms, a major term (P), a minor term (S) and a middle term (M). The major term is the predicate of the conclusion and the minor term is the subject of the conclusion. The predicate modifies the subject. Traditionally the major term is written first, followed by the minor term and a conclusion. It can be represented as such.

All M are p
All S are M
________
All S are P

To understand how premises are defined we must understand how they are distributed. I have borrowed the list of distributions from Wikipedia and added my own Venn diagrams for ease of learning.

  • In "All A are B"-propositions the subject (A) is distributed.
  • In "No A are B"-propositions both the subject (A) and the predicate (B) are distributed.
  • In "Some A are B"-propositions neither the subject nor the predicate are distributed.
  • In "Some A are not B"-propositions the predicate is distributed.
Distribution of Terms

Fallacy 1: Undistributed Middle
The middle term must be distributed at least once.
Fallacy 2: Illicit Major/Illicit Minor
If a term is distributed in the conclusion, then it must be distributed in a premise.
Fallacy 3: Exclusive Premises
If a term is distributed in the conclusion, then it must be distributed in a premise.
Fallacy 4: Drawing an affirmative conclusion from a negative premise, or drawing a negative conclusion from an affirmative premise.
A negative premise requires a negative conclusion, and a negative conclusion requires a negative premise. (Alternate rendering: Any syllogism having exactly one negative statement is invalid.)
Fallacy 5: Existential Fallacy
If both premises are universal, the conclusion cannot be particular.


Other useful resources:
Lander Edu
Csunx