Webdis installation requires libevent 
cc -c -O0 -ggdb -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o webdis.o webdis.c
In file included from webdis.c:1:
server.h:4:19: error: event.h: No such file or directory
In file included from webdis.c:1:
server.h:14: error: field ‘ev’ has incomplete type
make: *** [webdis.o] Error 1


install libevent-devel

-sh-3.2# yum install libevent-devel


[ add comment ] ( 1 view )   |  [ 0 trackbacks ]   |  permalink  |  related link
CENTOS/RHEL 5, Python and pcapy/pypcap/impacket/dpkt 
to get data from network:
pcapy = interface with the libpcap packet capture library (available in EPEL)
pylibpcap = interface with the libpcap packet capture library

to parse them:
impacket = python packet creation / parsing library
dpkt = python packet creation / parsing library

For RHEL/CENTOS 5 there is EPEL with compiled pcapy module (example). The pypcap is not available via EPEL.

To install componetns for packet decoding on Centos 5 as is not as straigtforward as there is an old version of python (2.4.3). The latest impacket or dpkt (install via pip-python) wont work. The easiest way seems to use older version of dpkt.

You have to get dpkt in version 1.7 (here).

example (monitor arp traffic):

#!/usr/bin/python

import pcapy
import dpkt
import sys
import socket
import struct

SINGLE_SHOT = False

# list all the network devices
pcapy.findalldevs()

iface = "eth0"
filter = "arp"
max_bytes = 1024
promiscuous = False
read_timeout = 100 # in milliseconds

pc = pcapy.open_live( iface, max_bytes, promiscuous, read_timeout )
pc.setfilter( filter )

# callback for received packets
def recv_pkts( hdr, data ):
packet = dpkt.ethernet.Ethernet( data )

print type( packet.data )
print "ipsrc: %s, ipdst: %s" %( \
socket.inet_ntoa( packet.data.spa ), \
socket.inet_ntoa( packet.data.tpa ) )

print "macsrc: %s, macdst: %s " % (
"%x:%x:%x:%x:%x:%x" % struct.unpack("BBBBBB",packet.data.sha),
"%x:%x:%x:%x:%x:%x" % struct.unpack("BBBBBB",packet.data.tha ) )

if SINGLE_SHOT:
header, data = pc.next()
sys.exit(0)
else:
packet_limit = -1 # infinite
pc.loop( packet_limit, recv_pkts ) # capture packets


[ add comment ] ( 2 views )   |  [ 0 trackbacks ]   |  permalink
cdnjs, the JavaScript, CSS, SWF repository 
Everyone loves the Google CDN right? Even Microsoft runs their own CDN.
The problem is, they only host the most popular libraries.
We host it all - JavaScript, CSS, SWF, images, etc!




[ add comment ] ( 1 view )   |  [ 0 trackbacks ]   |  permalink  |  related link
Backbone.js  
Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.




[ add comment ] ( 2 views )   |  [ 0 trackbacks ]   |  permalink  |  related link
vis.js 
Vis.js is a dynamic, browser based visualization library. The library is designed to be easy to use, to handle large amounts of dynamic data, and to enable manipulation of and interaction with the data. The library consists of the components DataSet, Timeline, and Graph.


[ add comment ] ( 1 view )   |  [ 0 trackbacks ]   |  permalink  |  related link
MiK-Music 
The new home of MiK-Music's music electronics DIY site

[ add comment ] ( 2 views )   |  [ 0 trackbacks ]   |  permalink  |  related link
STM32F4 Basics: Timers (Part 1) 
These STM32F4 Basics posts aren't really tutorials so much as they are slightly-organized notes with short and contrived examples. Many aspects and nuances are ignored. Look through the documentation and headers referenced throughout this post to fill in the gaps. The Timer chapters in RM0090 would be a good place to start.


[ add comment ] ( 1 view )   |  [ 0 trackbacks ]   |  permalink  |  related link
Compute prescaler/counter values for a MCU based oscillator, with Python 

'''
this program helps to compute note frequencies for a MCU based oscillator
where the selection of the optimal prescaller and counter value is
needed.

program output is a C array with counter register values.

each next note is larger than the one before it by the same ratio (the
twelfth root of 2, which is 1.05946309435929526456182529494634170077
9204317494... )

please check http://www.math.niu.edu/~rusin/uses-mat ... requencies
for list of frequencies.

to achieve excellent precission you may convert program to use numpy.

with numpy:

>>> def root(n, r):
... from numpy import roots
... return roots([1]+[0]*(r-1)+[-n])
...
root(2, r=12)[0]
(-1.0594630943592918+0j)
'''
DEBUG = False

notes = [
'C ', 'C#', 'D ', 'D#', 'E ', 'F ', 'F#', 'G ', 'G#', 'A ', 'A#', 'B ' ]

default_clock = 84000000.0 # chip clock
start_tone_frequency = 32.703195662574829 # C0
start_tone_midi = 21
stop_tone_frequency = 4186.01 # max desired frequency C8

twelfth_root_of_two = 1.059463094359295264561825294946341700779204317494

clock_frequencies = []
round_list = []
note_list = []

for clock_prescaler in range( 1, int( default_clock ) ):

if default_clock % clock_prescaler == 0:
if default_clock / clock_prescaler > stop_tone_frequency:
clock_frequencies.append( \
( default_clock / clock_prescaler, clock_prescaler ) )

elif DEBUG:
print "frequecy is less than the max desired frequency"

elif DEBUG:
print "divider does not produce round result"

print "---------------------------------------------------------------"
print "suitable frequencies: ", clock_frequencies


for clock_base_hz, clock_prescaler in clock_frequencies:

f = start_tone_frequency
f_midi_note = start_tone_midi

divider_is_less_than_oxffff = True
most_significant_frequency_gap = 0

print "---------------------------------------------------------------"
print "values for osc_base: ", clock_base_hz
print "clock_base_hz octave note f real_frequency tick_counter"

for octave in xrange( 1, 8 ):
for note in notes:

current_note_divider_is_less_than_oxffff = True

if clock_base_hz / f > 0xffff:
current_note_divider_is_less_than_oxffff = False
divider_is_less_than_oxffff = False

counter_value = round( clock_base_hz / f )
real_frequency = clock_base_hz / counter_value
real_frequency_gap = abs( real_frequency - f )

if most_significant_frequency_gap < real_frequency_gap:
most_significant_frequency_gap = real_frequency_gap

print clock_base_hz, octave, note, f, real_frequency_gap, \
counter_value

note_list.append( ( ( clock_base_hz, clock_prescaler ), \
( octave, note, f_midi_note, counter_value, f,
real_frequency, real_frequency - f, \
current_note_divider_is_less_than_oxffff ) ) )

f = f * twelfth_root_of_two
f_midi_note += 1

round_list.append( ( clock_base_hz , clock_prescaler, \
most_significant_frequency_gap, divider_is_less_than_oxffff ) )

suitable_frequencies_sorted = sorted( round_list, key=lambda l: l[2] )

print "---------------------------------------------------------------"
print "suitable frequencies (sorted by total inaccuracy): "
print "True/False shows if 16-bit long counter can be used"
for frequency in suitable_frequencies_sorted:
print frequency

print "---------------------------------------------------------------"
freq_to_list = input("Enter base freq to list notes: ")

print "octave note midi_note divider f real_f frequency_gap"
for record, values in note_list:
if record[0] == freq_to_list:
print values


print "---------------------------------------------------------------"
c_array_legend = ""
c_array_clock_prescalers = ""
c_array_clock_dividers = ""
c_count = 0


''' based on selected frequency create list of counter values '''
for record, values in note_list:
if record[0] == freq_to_list:
c_array_clock_prescalers += "%d, " % record[1]
c_count += 1

print "// osc: prescalers"
print "uint16_t clock_prescaler[%d] = { %s };" \
% ( c_count, c_array_clock_prescalers[:-2] )

''' example of values in note list:

oct note midi countr real_f computed_f f_error 0xffff
(7, 'B ', 104, 506.0, 7902.132820098011, 7905.138339920949, 3.0055198229383677, True)
'''

''' based on selected frequency create list of counter values '''
for record, values in note_list:
if record[0] == freq_to_list:
c_array_clock_dividers += "%d, " % values[3]

print "// osc: counters"
print "uint16_t clock_counter[%d] = { %s };" \
% ( c_count, c_array_clock_dividers[:-2] )

''' based on selected frequency create list of note detailed legends '''
for record, values in note_list:
if record[0] == freq_to_list:
c_array_legend += '"%s%s(%s) c: %s\\nfreq: %s", ' \
% ( values[0], values[1], \
values[2], values[3], \
values[4] )

print "// osc: legends"
print "char * clock_legend[%d] = { %s };" % ( c_count, c_array_legend[:-2] )

print


[ add comment ] ( 2 views )   |  [ 0 trackbacks ]   |  permalink
Running Python on Windows, installing libs requires SETUPTOOLS, PIP and compiler 
Flying in the face of its 'batteries included' motto, Python ships without a package manager. Adding insult to injury, Pip is ironically difficult to install. The official documentation tells users to install Pip and each its dependencies from source. That's tedious for the experienced, and tactless to newbies.


from: http://stackoverflow.com/questions/4750 ... on-windows

Unofficial Windows Binaries for Python Extension Packages


[ add comment ] ( 1 view )   |  [ 0 trackbacks ]   |  permalink  |  related link
Hairless MIDI 
Hairless MIDI<->Serial Bridge is the easiest way to connect serial devices (like Arduinos) to send and receive MIDI signals. 100% Free Software. For Mac OS X, Windows & Linux.

[ add comment ] ( 1 view )   |  [ 0 trackbacks ]   |  permalink  |  related link

<<First <Back | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | Next> Last>>