Archive for August, 2006

How to Find Foreign Key Constraints in SQL Server

Thursday, August 31st, 2006

Just use the sp_fkeys stored procedure.

Syntax

sp_fkeys [@pktable_name =] ‘pktable_name’
[,[@pktable_owner =] ‘pktable_owner’]
[,[@pktable_qualifier =] ‘pktable_qualifier’]
{, [@fktable_name =] ‘fktable_name’}
[,[@fktable_owner =] ‘fktable_owner’]
[,[@fktable_qualifier =] ‘fktable_qualifier’]


Full write-up of the syntax

My Search Queries:

  1. “sp_fkeys” OR “sp_foreignkeys”
  2. how to find foreign key (relationships OR constraints) in sql server
  3. script to find foreign key columnscript to find foreign key column
  4. sql script how do you find the column that a foreign key references

SQL Server – What Do Precision and Scale Mean in the Design Table Dialog

Thursday, August 31st, 2006

These properties apply to the numeric and decimal data types.
This useful tutorial provides us with the answer as to what they do:

the Precision number controls the maximum number of digits on the left side of the period. The Scale factor specifies the maximum number of digits used on the right side of the period.

[tags]SQLServer, MSSQL, MSSQLServer, Sql Server, Precision, Scale, Data Types, Design table[/tags]

ValueError: unsupported format character ‘S’ (0×53) at index 14

Tuesday, August 22nd, 2006

Answer, you’ll want to use a lowercase “s” in your string formatting expression:
For example do:
print 'Hi there Mr. %s' % 'test'

and not:
print 'Hi there Mr. %S' % 'test'

Background:
I’m sure this is obvious to everyone but sometimes when you forget to turn off your caps lock key and you don’t really understand unicode and automatically blame all of your errors on that, you may well be stuck on this error for a good bit of time before you notice the case of the %S ;-)

Ubuntu – Deleting an Undeletable File

Saturday, August 19th, 2006

Here’s the story on why I had an undeletable file and how I finally deleted it:
(more…)

How to Run Weka in Linux

Sunday, August 13th, 2006

So you’ve downloaded and installed Weka to your Linux system but when you click on Explorer or Experimenter you get this error:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException ...

Just follow these steps to fix it:

  1. Create a “LookAndFeel.props” file in your home directory:
    Type:touch ~/LookAndFeel.props into system command line.
  2. Type this into the first line of the newly created LookAndFeel.props file:
    Theme=javax.swing.plaf.metal.MetalLookAndFeel
  3. Save the file and exit.
  4. Start WEKA and everything should now work.


Here’s a detailed version of the answer and explains a little bit of the why of this problem.

Here’s the full text of the original error:

chiefinnovator@MAIN1:~$ cd /home/chiefinnovator/weka/weka-3-4-8a/
chiefinnovator@MAIN1:~/weka/weka-3-4-8a$ java -jar weka.jar
 /usr/share/themes/Simple/gtk-2.0/gtkrc:46: Engine "thinice" is unsupported, ignoring
/usr/share/themes/Simple/gtk-2.0/gtkrc:53: Engine "redmond95" is unsupported, ignoring
/usr/share/themes/Simple/gtk-2.0/gtkrc:57: Engine "redmond95" is unsupported, ignoring
---Registering Weka Editors---
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at weka.gui.explorer.PreprocessPanel.addPropertyChangeListener(Unknown Source)
        at javax.swing.plaf.synth.SynthPanelUI.installListeners(SynthPanelUI.java:49)
        at javax.swing.plaf.synth.SynthPanelUI.installUI(SynthPanelUI.java:38)
        at javax.swing.JComponent.setUI(JComponent.java:652)
        at javax.swing.JPanel.setUI(JPanel.java:131)
        at javax.swing.JPanel.updateUI(JPanel.java:104)
        at javax.swing.JPanel.(JPanel.java:64)
        at javax.swing.JPanel.(JPanel.java:87)
        at javax.swing.JPanel.(JPanel.java:95)
        at weka.gui.explorer.PreprocessPanel.(Unknown Source)
        at weka.gui.explorer.Explorer.(Unknown Source)
        at weka.gui.GUIChooser$3.actionPerformed(Unknown Source)
        at java.awt.Button.processActionEvent(Button.java:388)
        at java.awt.Button.processEvent(Button.java:356)
        at java.awt.Component.dispatchEventImpl(Component.java:3955)
        at java.awt.Component.dispatchEvent(Component.java:3803)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

[tags]weka, ubuntu, java, weka Exception, AWT-EventQueue-0, java.lang.NullPointerException[/tags]