Computer Magic
Software Design Just For You

Ruby Tutorial

June 26th, 2008

I found a crazy tutorial on the Ruby language. The guy is totally nuts, but the tutorial is quite good. Take a look at

For those interested in writing Ruby, you might consider downloading the latest NetBeans IDE as it has Ruby support. You can get NetBeans at

Dynamically Loading Python Modules

May 30th, 2008

Python is a great language. One of the projects that I am using Python for is on a game server. The Python engine is embedded into a C++ server. One of the main advantages to this is that you can change the Python code without having to re-compile the C++ code.

An even bigger advantage is that Python code can be reloaded without even shutting the Python engine down. Python can reload changed code on the fly.

Python can load code in two different ways.
> Load a string
> Load a module

Loading a String
To load a string, you simply put your code into a string variable and tell Python to run it. In this way you can run a function or class declaration without actually having it execute (unless you place a call to it). This will cause the Python engine to replace the current definitions (if there are any) with the new code.

The Pros: This is very easy. We used this for a while. Our server stores the Python code in a database, so this was the easiest way to extract the code and load it into the Python engine. To reload the changes, you simply re-ran the same load code.

The Cons: This method will over write global variables in your code which began to cause some tricky bugs after a reload. Also, there is no way to UNLOAD the code. It is loaded into the global name space and therefore writing an unload function would be quite difficult. Lastly, because everything is loaded in the same name space, you end up with possible name conflicts.

Load a module
With this method, you tell python to load the module. The only problem is that Python likes to look to the file system for modules. This makes it impossible to load a module from a database. That is what this article is about. We had to override some of the functionality to get it to pull from our database. By doing so, we can now load modules from both the file system (e.g. built in modules) and the database.

The Pros: We can now put our code in one or more modules. The modules have their own name space and can be loaded and unloaded completely with ease. Since modules have their own name space, they don’t trash global variables in the main area. Most importantly, we can have our modules stored in a database. This is important as it allows us to keep all our changes and code in one spot and makes the install and backup easier and allows us to have multiple people work remotely through our custom GUI interface.

The Cons: Reloading on the fly always has the potential to introduce bugs. I am sure we will find more as we go.

The code
Here is the code I use. Note that there is a function called GetModuleCode() that loads the module. This is just a stub here, so replace its code with the code you need to load the module. If you have no problem loading from modules on the hard drive, you might consider just putting them in the Python folder and saving yourself the trouble.

компютри втора употреба
# ========================================================================
# Custom Module Loader
# ========================================================================
# Install the custom module loader, this loader can pull DB modules from the server
import __builtin__
bi = __builtin__.__import__ # Save old import function
import new
import sys
import StringIO

#module loader code references

# Redefine the __import__ function
# (self, name, globals=None, locals=None, fromlist=[]):
def __import__(name, *args):
# Has this module already been loaded? If so, move on
for mod in sys.modules.keys():
if (mod == name):
# module found
#print "Module already loaded (" + mod + ")"
return sys.modules[mod]

code = GetModuleCode(name)
if code == '':
# Didn't find the module in the database, look for it in the normal python system
return bi(name, *args)

# Found code in the database, load it here
mod = new.module(name)
exec code in mod.__dict__
# Module failed to load? Unload it?
#d = self.hooks.modules_dict()
#if name in d:
# del d[name]
del sys.modules[name]
return mod

#Set __import__ to our __import function
__builtin__.__import__ = __import__

def LoadModule(name):
# Call the import function

def ReloadModule(name):
#print "Reload Module (" + name + ")"

def UnloadModule(name):
if (sys.modules.has_key(name)):
#print "Remove Module (" + name + ")"
del sys.modules[name]

def ReloadAllModules():
# Get the list of modules from the database and load them all
sql = "SELECT * FROM your_module_table"
rs = database.Query(sql)
for i in rs:

def GetModuleCode(name):
# Check the database for this module - put your code to retrive your module here
return "python code"

MSSQL 2000 – Merge Replication Errors

November 14th, 2007

The ProblemOn a recent project, merge replication was required. Any one who has seriously tried to use MSSQL Merge replication knows that it can be a total pain. It sounds nice, but in practice it can be a real bear. It gets worse if you have had to break the replication manually for any reason.Replication le poker en ligne françaistexas holdem casinotélécharger jeux poker gratuitstexas holdem pocket pctelecharger world pokerstrip poker gratuitementtélécharger le jeu de poker gratuiteswam pokerlegislation poker en lignetexas holdem poker onlinesalle de poker onlinejuego texas holdemjuegos poli pokerpoker roompoquer comworld series of pokerstrep poker on linedraw pokerjugar omaha poker en lineawww poquerjugar poquer webcaribbean stud pokercartas poker gratisjugar omaha pokercartas onlineencuentros pokercaribbean poker pagina internetreglas poker texas holdem,poker texas holdem gratis,poker texas holdemcomo jugar poker texasinformatica pokerjuego del poker librestrep poker gratisstreap poker onlinetexas holdem gameonline poker gamedescarga de juegos de pokerjugadas de pokerpoker paginas internetpai gow poker internetjuegos de poker para descargarjugadas pokerjugar poker texasreglas poker juegojugar poker sin dineroreglas texas holdemjugar poker omahapolly pokertorneos de pokerpoker pc gamespoker gratis descargar doesn’t clean up nice. We used sp_removedbreplication ‘dbname’ on the subscriber to clear out all replication settings. It did a fairly nice job, but there were still a few things left behind.Once merge replication was setup again properly, updates would flow from the publisher but not from the subscriber. There was an error: “tsvw_FB…”What happend?There were leftovers in the database. When you setup replication, the system adds triggers to your replicated tables. When those triggers fire, they add the changes to your replication queue so that they get pushed to the other servers. The TSVW and CSVW errors are generally leftovers from past replication configurations.The SolutionWhen you setup replication, a new set of TSVW and CSVW triggers are created. You could end up with multiple triggers (e.g. 2 update triggers). To find out which one you SHOULD keep, look in your views and you will see some TSVW and CSVW views created. Look at those numbers. They are followed by big hashes. Now go back to the problem table and remove the triggers that do NOT have those numbers. After that, your problem should be solved.Ray PulsipherInstant approval online credit cards
Credit report .com
Free instant credit report
Verizon Lg Vx6000 Free Ringtones
No anual fee instant approval credit cards
Download Ringtones Sprint
Low interest apr credit cards
Download Free Midi Ringtones
Zero interest balance transfer credit cards life
Copy of my credit report
Instant approval credit cards
Zero percent balance transfer credit cards
Canadian credit cards instant approval online
Free online credit report check
Feat Lil Lloyd Ringtones Wayne
Low apr interest credit cards
Guaranteed instant approval credit cards for poor
Free instant credit reports
How do i get a free credit report
Dont Eminem Know Ringtones
Free credit report on line
Annual credit report request
Free instant credit report status
Online credit report
Free credit report no card
Consumer credit report
Instant approval low apr credit cards
Credit report dispute
Mosquito Ringtones Silent
Free Phone Real Ringtones Sprint
Uk credit reports online
Free Verizon Ringtones
Instant approval credit cards fair
0 balance transfer credit cards
My credit report com
Trw free credit report
Fair credit reporting act litigation settlement
Time instant approval credit cards
Instant online approval credit cards fleet
Explaining credit report scores
Fixed apr business credit cards
Allstate fair credit reporting act
No interest ever balance transfer credit cards
Free credit reports without a credit card
Instant approval credit cards for people
Improve credit report
Balance transfer credit cards uk
Compare credit cards instant approval
Download Free Hindi Ringtones
Loans instant approval credit cards
Low interest fixed apr credit cards
Free Pink Floyd Ringtones
Free annual credit report
Polyphonic Spree Ringtones
Credit bureau reporting
Get a credit report
Free Lil Wayne Ringtones
Repair credit improve credit get aaa credit report
Real Music Ringtones For Verizon Wireless
Instant approval credit cards for bad
Absolutely free online credit reports
Free Music Nextel Ringtones
Clean credit report
Best credit cards for balance
Verizon Wireless Lg Vx3100 Ringtones
Credit rating reports
Credit reporting act litigation settlement
Credit reports no
Get a free credit report
Credit reporting service
Instant credit reports uk
0 interest balance transfer credit cards
Immediate credit cards balance transfer
Get your credit report

CSS positioning made easy

September 25th, 2007

I saw this page the other day. It is great. It shows you very simple examples of CSS positioning in an easy to understand format with visible examples.

When student loans go bad – Sallie Mae

August 21st, 2007

In the last ten years, I have noticed a disturbing trend. The deregulation of the loan and credit industry has left many americans hurting. I, like many others, have had to take on student loans in the past to pay for the skyrocketing costs of education.

I borrowed from two companies, Sallie Mae and Wachovia. Getting money is easy, its how they act when you miss a payment that shows the true colors.

I simply put the student loan payment cupons in the wrong pile and they didn’t get paid one month. Wachovia never called. They sent me a letter notifying me that I was late and as such had lost certain benifits (e.g. lower interest rates for paying on time). Otherwise, they said that I owed a double payment (may or may not have been a small service fee). No biggie, I cut a check for the full ammount, problem solved.

Sallie Mae on the other hand began a barrage of phone calls and letters. Keep in mind that I was about ready to write a check for the current month so I am only one month behind… not 3 or 6 or 9 months. From the time of the first call until today (7 days) I have recieved 4 letters, and been called upwards of 24 times. The first time I explained that I would have a check in the mail with a day or so. The next call, I explained again and said I had already talked to some one. On the third call in 2 days I started to loose my patience.

This third call is special. I got a little upset and told them that calling every day would not speed up the US post office and that a check was in the mail. She informed me that I would get calls EVERY day until they got their payment. Keep in mind, that this is the first payment I have missed, and the first payment that has been late, and that from the beginning I promised to catch up and pay in full. I have not disputed the fact that I needed to pay nor have I ever refused to do so.

Here I am a week later and still getting calls and being harrassed by Sallie Mae while Wachovia has been both polite and quite reasonable in its efforts to inform me of my mistake.

I might also add tha Sallie Mae is charging me the highest interest rates and that they refused to release my loans when I consolodated them (otherwise I would only be paying Wachovia now). The federal government obviously isn’t looking out for college students these days. I would STRONGLY advise any one who needs to take student loans to stear clear of Sallie Mae at all costs.

Sallie Mae has made themselves into a joke around my place. When they call, we try to think of new ways to mess with their collections people. I truly hope that the calls really are monitored.

UPDATE: 8/22/2007 – They broke their record. I had a total of 5 calls from them in one day! You would think I was a hardened crimial or something.

Home | My Blog | Products | Edumed | About Us | Portfolio | Services | Location | Contact Us | Embedded Python | College Courses | Quick Scan | Web Spy | EZ Auction | Web Hosting
This page has been viewed 664153 times.

Copyright © 2005 Computer Magic And Software Design
(360) 417-6844
computer magic