In Loki We Trust The many projects of Lokkju, Inc

handbook
21May/110

MobileSaver: an Applications For Good contest entry

MobileSaver was first concieved of as an idea during a discussion about challenges to the successful completion of IDA programs. A basic design mockup was done prior to the Portland code camp. At the code camp, the UI design was greatly improved, the python code and templates were written, and by the end of the day it existed as a working, usable, application.

MobileSaver is currently a fully working web application, with complete support for iOS, Android, and similar devices. It falls back to basic HTML on more limited mobile browsers, and while not as nice looking is still fully functional. In the future, we'd like to add device capability detection, and specially format the output for some older devices, such as classic Nokia or Motorola browser equipped cell phones. In addition, deposit reminders and notifications; and a communications portal to ask questions of the program manager are in the works.

Voting/Project Page: http://applicationsforgood.org/solutions/mobilesaver/
Presentation (Including demo video): https://docs.google.com/present/view?id=ddp5twq5_76hpp9pwg3
Demo Video: http://www.youtube.com/watch?v=X_16m3jr2pc
Source Code Link: http://bitbucket.org/lokkju/mobilesaver
Live Beta Link (Outcome Tracker account required): http://mobilesaver.lokkju.com/

30Mar/110

Accessing Facebook Fan Page Video tagging settings

If you run a fan page, you probably already know you can allow your fans to tag photos you post (and also control if they can post pictures to your page). But did you know you can do the same for Videos? You can, but it is hidden.

Steps to access your video settings:

1) go to your Facebook Page
2) Click the "Edit Info" link near the top of the page
3) Click the "Apps" item on the left hand menu
4) Click "Go To App" under the "Photos" section
5) (this is the trick) - look at your URL bar - you should see a section that says "aid=2305272732". Replace it with "aid=2392950137", hit enter... and now you can manage the ability of your fans to tag and post Videos.

2Feb/119

New wordpress plugin published

I've just released a small wordpress plugin for showing paypal funds received vs a target amount (with time periods, so, monthly for instance).

You can find it here

tour
international
31Jan/110

Configuring a FDCServers.net Ubuntu 10.04 VPS from scratch

In my last post, I mentioned I recently picked up a cheap VPS. Though the UFW configuration worked, I quickly decided it was overkill for what I wanted to do - I'd rather do my own iptables rules. So, here is a *from scratch* set of commands to configure your new server. It will change your hostname, set up a new (sudo capable user), and set up basic ssh and http firewall rules.

Anywhere you see "[HOSTNAME]" replace it with your hostname.
Anywhere you see "[USERNAME]" replace it with your selected new username.

echo -e "127.0.0.1\t[HOSTNAME]" >> /etc/hosts
echo [HOSTNAME] > /etc/hostname
hostname [HOSTNAME]

useradd -d /home/lokkju -U -G sudo -m -s /bin/bash lokkju

passwd [USERNAME]

echo "*filter" > /etc/iptables.rules
echo ":INPUT ACCEPT" >> /etc/iptables.rules
echo ":FORWARD ACCEPT" >> /etc/iptables.rules
echo ":OUTPUT ACCEPT" >> /etc/iptables.rules
echo "-A INPUT -i lo -j ACCEPT" >> /etc/iptables.rules
echo "-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT" >> /etc/iptables.rules
echo "-A INPUT -i eth0 -p tcp -m tcp --dport 22 -j ACCEPT" >> /etc/iptables.rules
echo "-A INPUT -i eth0 -p tcp -m tcp --dport 80 -j ACCEPT" >> /etc/iptables.rules
echo "-A INPUT -m limit --limit 5/min -j LOG --log-prefix \"iptables denied: \" --log-level 7" >> /etc/iptables.rules
echo "-A INPUT -j DROP" >> /etc/iptables.rules
echo "COMMIT" >> /etc/iptables.rules

iptables-apply /etc/iptables.rules

echo -e "\tpre-up iptables-restore < /etc/iptables.rules" >> /etc/network/interfaces
faq
Filed under: Configuration No Comments
copyright
30Jan/110

OpenVZ, Ubuntu 10.04, and UFW

I've recently gotten a new VPS ($9/mo, 256MB RAM, 300GB Disk, 10Mbps/unmetered) from FDC Servers. It's running OpenVZ for it's containers, and the first step, as always, is to get the firewall up and running... which can be a pain under OpenVZ.

So, lets do another walkthrough:

  • Install ufw:
    apt-get install ufw
  • Edit /etc/ufw/after.rules
    # don’t log noisy broadcast
    #-A ufw-after-input -m addrtype --dst-type BROADCAST -j ufw-skip-to-policy-input
  • Edit /etc/ufw/ufw/before.rules
    # if LOCAL, RETURN
    #-A ufw-not-local -m addrtype --dst-type LOCAL -j RETURN

    # if MULTICAST, RETURN
    #-A ufw-not-local -m addrtype --dst-type MULTICAST -j RETURN

    # if BROADCAST, RETURN
    #-A ufw-not-local -m addrtype --dst-type BROADCAST -j RETURN

  • “Fix” modprobe
    mv /sbin/modprobe /sbin/modprobe_disabled
    ln -s /bin/true /sbin/modprobe
  • “Fix” sysctl
    mv /sbin/sysctl /sbin/sysctl_disabled
    ln -s /bin/true /sbin/sysctl
  • Fix logging
    apt-get -y purge rsyslog
    apt-get install -y syslog-ng
  • Edit /etc/init/ufw.conf
    start on startup
    #console output
  • Enable ssh & ufw
    ufw allow ssh
    ufw enable

You're Done! now you can safely add more ports for inbound access - but use the port number, not the service name.

Thanks to bodhi.zazen for some of the information above.

handbook
Filed under: Configuration No Comments
24Sep/101

Making jQuery-UI work in the Django Admin

Problem: Django's Admin moves the jQuery namespace into a custom one, django.jQuery, to prevent conflicts. But what if you want to use the provided jQuery, with jQuery-UI? jQuery-UI, and many other jQuery plugins, expect there to be a "jQuery" namespace.

Quick Fix - lets move it back to the jQuery namespace:


<script>(function($){jQuery = $.noConflict(true);})(django.jQuery);</script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js"></script>

And that's it!

Filed under: Uncategorized 1 Comment
17Sep/103

Installing Mono and ASP.Net on Bluehost (and other shared hosting providers)

I get a request from a friend the other day to get Mindtouch working on Bluehost. It's not working yet, but Mono, XSP, and mod_mono are all fully working... and I thought I'd share the process. It's pretty basic to get compiled and running, and only takes a few modifications to the build files.

details after the break...

27Aug/100

Flex SWC class parser

Quick tool that prints out all the available classes exported by a SWC file.

Usage swfinfo.py [file [...]]

#!/usr/bin/python
# Filename: swc-info.pl
# Author : Lokkju Brennr <lokkju@lokkju.com>
# License : GPL
# Copyright 2010 

import sys
import getopt
import zipfile
from xml.etree import ElementTree

def usage():
  print "%s <swcfile>" % (sys.argv[0])
  print "  Prints all classes exported by the provided swc(s).  Supports wildcard globbing"
  sys.exit(2)

def main():
  # parse command line options
  if len(sys.argv) < 2:
    usage()
  files = sys.argv[1:]
  for swcfile in files:
    z = zipfile.ZipFile(swcfile,'r')
    catalog = z.open("catalog.xml")
    catalogxml = catalog.read()
    catalog.close()
    z.close()
    tree = ElementTree.XML(catalogxml)
    defs = tree.findall(".//{http://www.adobe.com/flash/swccatalog/9}def")
    for d in defs:
      id = d.attrib.get("id")
      type = d.attrib.get("type")
      if type is None:
        print "%s:%s" % (swcfile,id)
if __name__ == "__main__":
    main()
tour
international
26Aug/101

A Question of legal standing: Perhaps end users can sue for GPL violations?

A question of legal standing: I take for granted that generally, only a copyright holder has the right to sue over a GPL licence/copyright violation. Assuming that to be true, most people do not have legal standing to go after a licence/copyright violator.

But what if instead of suing for licence/copyright violations, you sued for (willful or not) fraud? As an example, lets say you had bought a "device" that was made by Acme, Inc. By whatever means, you discover that the device came with GPL licensed binaries: Linux, busybox, and mtd.
You look, but can't find an offer of source, or even a recognition of the GPL licensed software on the device.

You have now purchased a device running software that Acme had no right to sell - in essence, they sold you stolen property. Also, without that software, the device is useless. Do you have standing to sue for fraud? or something else? or do you still have no standing?

As a bonus, if you have standing, are you only eligible for reimbursement, or might you get punitive damages? Also, could you do this in small claims court?

faq
handbook
25Aug/100

Supporting dynamic FlexFileSets in Flex’s compc and mxmlc Ant tasks

If you are using the mxmlc and compc tasks in Ant to compile flex code, there is no documented way to make the fileset-like children accept a dynamic include pattern - that is, one you set based on conditionals.

In my case, I need to have a list of included libraries in my build.properties, and only include those ones in my compc task. The solution is to use patternsets and a custom ant macro. See the source below, but essentially you do the following:

  1. Create a new patternset, assigning it an id
  2. Use the append.to.patternset macro to add a new patternset for each pattern in your list of library patterns (as defined in you build.properties, or dynamically, or...)
  3. assign that patternset to the library-path of compc



Important: All the patterns must decend from the same root directory as set in the library-path. If you need multiple root directories, you must use multiple library-path directives and multiple patternset refids.


build.xml:

<?xml version="1.0" encoding="utf-8"?>
<project name="My Component Builder" basedir=".">
  <taskdef resource="flexTasks.tasks" classpath="${basedir}/flexTasks/lib/flexTasks.jar" />
  <property file="build.properties"/>
  <property name="FLEX_HOME" value="C:/flex/sdk"/>
  <property name="DEPLOY_DIR" value="c:/jrun4/servers/default/default-war"/>
  <property name="COMPONENT_ROOT" value="components"/>

  <macrodef name="append.to.patternset">
    <attribute name="patternset"/>
    <element name="nested" optional="yes" implicit="true"/>
    <sequential>
      <patternset id="tmp">
        <patternset refid="@{patternset}"/>
        <nested/>
      </patternset>
      <patternset id="@{patternset}"><patternset refid="tmp"/></patternset>
      <patternset id="tmp"/>
    </sequential>
  </macrodef>
  <patternset id="compc.library-path" />
  <for list="${compc.libraries}" param="lib">
    <sequential>
      <append.to.patternset patternset="compc.library-path">
        <patternset>
          <include name="@{lib}" />
        </patternset>
      </append.to.patternset>
    </sequential>
  </for>
  <target name="main">
    <compc
      output="${DEPLOY_DIR}/MyComps.swc"
      include-classes="custom.MyButton custom.MyLabel">
      <source-path path-element="${basedir}/components"/>
      <include-file name="f1-1.jpg" path="assets/images/f1-1.jpg"/>
      <include-file name="main.css" path="assets/css/main.css"/>
      <library-path append="true" dir="${compc.libdir}">
        <patternset refid="compc.library-path" />
      </library-path>
    </compc>
  </target>
  <target name="clean">
    <delete>
      <fileset dir="${DEPLOY_DIR}" includes="MyComps.swc"/>
    </delete>
  </target>
</project>

build.properties:

compc.libdir=${rootdir}/libs/
compc.libraries=lib1.swc,plib*.swc,**/type.swc
trademarks