We are an information technology and business services company located in Calgary, Alberta. Our mission is to provide creative solutions that fit our customer's budgets and add to their bottom line. Our people take pride in our creativity, tenacity, honesty, and commitment in solving our client's problems in a way that adds to their bottom line. We are Etopian, nice to meet you!
 
 
 

Javascript persistence

It's an ORM for HTML5 / Gears. The author also has some ideas about syncing with a remote database.

http://github.com/zefhemel/persistencejs

Models

I have been thinking of a model for an application. Ideally I think applications should support the following features:

local (user, database, files)
remote (user)
remote (user, database, files)

Reading the visisted URLs with a firefox extension

I wanted to write an extension that would log all the URLs that I visited in Firefox. The goal of this exercise was to create a search engine that searches and caches all the information that I personally access and perhaps generates citations for that information as well.

This document exists for me to personally document the progress of such an extension:

http://stackoverflow.com/questions/873071/firefox-3-extension-javascript...

https://developer.mozilla.org/en/NsIWebProgress

Checkout Apache Solr Trunk

This will checkout apache solr trunk to the apache-solr-trunk directory.

svn co http://svn.apache.org/repos/asf/lucene/solr/trunk/ apache-solr-trunk

Also if you need to view the code:
http://svn.apache.org/viewvc/lucene/solr/

Python DBus Example

Here is an attempt to read the messages being sent out as notifications by DBUS. I was not successful in actually reading the messages as it doesn't seem like the messages are being sent directly over DBUS. Anyhow, I thought I would post it here, perhaps someone might find it being useful.

# You must initialize the gobject/dbus support for threading
# before doing anything.
import gobject
gobject.threads_init()
from pprint import pprint

from dbus import glib
glib.init_threads()

# Create a session bus.
import dbus
bus = dbus.SessionBus()

from dbus.mainloop.glib import DBusGMainLoop

DBusGMainLoop(set_as_default=True)


import gobject


def dump(obj):
  '''return a printable representation of an object for debugging'''
  newobj=obj
  if '__dict__' in dir(obj):
    newobj=obj.__dict__
    if ' object at ' in str(obj) and not newobj.has_key('__type__'):
      newobj['__type__']=str(obj)
    for attr in newobj:
      newobj[attr]=dump(newobj[attr])
  return newobj


# Create an object that will proxy for a particular remote object.
remote_object = bus.get_object("org.freedesktop.Notifications", # Connection name
                               "/org/freedesktop/Notifications" # Object's path
                             )

# Introspection returns an XML document containing information
# about the methods supported by an interface.
print ("Introspection data:\n")
print remote_object.Introspect()


# Get the power management object
power = bus.get_object('org.freedesktop.Notifications',
                       '/org/freedesktop/Notifications')
iface = dbus.Interface(power, 'org.freedesktop.Notifications')

# Hibernate the system
if iface.GetCapabilities():
    print iface.GetCapabilities()

def play(a, b, member=None):
  pprint(dump(a))
  pprint(dump(b))
  pprint(dump(member))

def catchall_signal_handler(*args, **kwargs):
    #pprint(dump(kwargs))

    print kwargs['message'].get_args_list()
 
    #print ("Caught signal (in catchall handler) " + kwargs['dbus_interface'] )
#    for arg in args:
#        print "        " + str(arg)


#bus.add_signal_receiver(catchall_signal_handler, interface_keyword='dbus_interface', member_keyword='member')
#bus.add_signal_receiver(my_func,
bus.add_signal_receiver(catchall_signal_handler, dbus_interface = "org.freedesktop.Notifications", signal_name='Notify')
#dbus_interface = "com.example.TestService", message_keyword='dbus_message'
iface.connect_to_signal(None, catchall_signal_handler,  message_keyword='message', sender_keyword = 'send', destination_keyword = 'dest', interface_keyword 
= 'iface', member_keyword = 'mem', path_keyword = 'path')


loop = gobject.MainLoop()
loop.run()

Amazon Product API

There is an example of this already online, but I don't like it.


from amazonproduct import API
from lxml import objectify

AWS_KEY = ''
SECRET_KEY = ''

api = API(AWS_KEY, SECRET_KEY, 'us')
node = api.item_search('Books', Keywords='0824832752')

# node object returned is a lxml.objectified element
# .pyval will convert the node content into int here
total_results = node.Items.TotalResults.pyval
total_pages = node.Items.TotalPages.pyval

print total_results


#get all books from result set and
#print author and title
for book in node.Items.Item:
    print '%s: "%s"' % (book.ItemAttributes.Author,
                        book.ItemAttributes.Title)
    print objectify.dump(book)

Create a self signed certificate using PHP

<?
$dn = array("countryName" => 'XX', "stateOrProvinceName" => 'State', "localityName" => 'SomewhereCity', "organizationName" => 'MySelf', "organizationalUnitN
ame" => 'Whatever', "commonName" => 'mySelf', "emailAddress" => 'user@domain.com');
$privkeypass = '1234';
$numberofdays = 365;

$privkey = openssl_pkey_new();
$csr = openssl_csr_new($dn, $privkey);
$sscert = openssl_csr_sign($csr, null, $privkey, $numberofdays);
openssl_x509_export($sscert, $publickey);
openssl_pkey_export($privkey, $privatekey, $privkeypass);
openssl_csr_export($csr, $csrStr);

echo $privatekey; // Will hold the exported PriKey
echo $publickey;  // Will hold the exported PubKey
echo $csrStr;     // Will hold the exported Certificate
?>

Getting festival to work with PulseAudio in Ubuntu, etc.

Start up festival and enter the following commands, if it works open up /etc/festival.scm and append to the end of that. Works well enough for we me with other audio playing.

(Parameter.set 'Audio_Command "paplay $FILE")
(Parameter.set 'Audio_Method 'Audio_Command)
(Parameter.set 'Audio_Required_Format 'snd)