Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

« Newer Snippets
Older Snippets »
3 total  XML / RSS feed 

Django and Open-flash-charts

// Found this on the django-users mailing list, need to test
ok, I finally got open-flash-chart to work.

1. create an xhtml-file and insert (something like) this:

    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
        codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/
flash/swflash.cab#version=8,0,0,0"
        width="600"
        height="400"
        id="graph-2"
        align="middle">
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="movie" value="/media/site/chart/open-flash-chart.swf?
width=600&height=400&data=/chart_data/" />
    <param name="quality" value="high" />
    <param name="bgcolor" value="#FFFFFF" />
    <embed src="/media/site/chart/open-flash-chart.swf?
width=600&height=400&data=/chart_data/"
        quality="high"
        bgcolor="#FFFFFF"
        width="600"
        height="400"
        name="open-flash-chart"
        align="middle"
        allowScriptAccess="sameDomain"
        type="application/x-shockwave-flash"
        pluginspage="http://www.macromedia.com/go/getflashplayer"; />
    </object>

2. define the url for the chart, eg: (r'^chart/$',
'www.views.charts.chart'),

3. define the url for the chart-data, e.g.: (r'^chart_data/$',
'www.views.charts.chart_data'),

4. the views:

def chart(request):

   ### nothing really required. whatever you want to do here. points
to the html-file created above

    return render_to_response('site/charts/chart.html', {
        'var': 'var',
    }, context_instance=RequestContext(request) )


def chart_data(request):

    import random

    g = graph()

    data_1 = []
    data_2 = []
    data_3 = []
    for i in range(12):
      data_1.append( random.randint(14,19) )
      data_2.append( random.randint(8,13) )
      data_3.append( random.randint(1,7) )

    g.title('PageViews (2007)', '{color: #999999; font-size: 16; text-
align: center}' );
    g.bg_colour = '#ffffff'

    # we add 3 sets of data:
    g.set_data( data_1 )
    g.set_data( data_2 )
    g.set_data( data_3 )

    # we add the 3 line types and key labels
    g.line_dot( 3, 5, '#333333', 'Page views', 10 )
    g.line_dot( 3, 5, '#666666', 'Visits', 10)    # <-- 3px thick +
dots
    g.line_hollow( 2, 4, '#999999', 'Unique visitors', 10 )


g.set_x_labels( 
'Jänner,Februar,März,April,Mai,Juni,Juli,August,September,Oktober,November,Dezember'.split(',')
 )
    g.set_x_label_style( 11, '0x666666', 2, 1)

    g.set_y_max(20)
    g.y_label_steps(4)
    g.set_y_label_style( 10, '0x666666')

    return HttpResponse(g.render())


OpenOffice.org 2.0 with GTK themes

In order to run OpenOffice 2.0 with GTK themes, you must first export an environment variable. This can be put in your bashrc or some other file that gets executed before OpenOffice.

Props to this site for the answer:

http://readlist.com/lists/lists.debian.org/debian-user/17/89593.html

#!/bin/bash
export OOO_FORCE_DESKTOP=Gnome
oowriter

AppleScript to test if application is running

By name:
tell application "System Events" to (name of processes) contains "iTunes"


By creator type, in case it might have a version # appended:
tell application "System Events" to (creator type of processes) contains "InDn"


Grab creator type dynamically like so:
tell application "Finder" to creator type of (selection as alias)


From http://applescriptsourcebook.com/viewtopic.php?pid=46830

« Newer Snippets
Older Snippets »
3 total  XML / RSS feed