jqGrid doesn't have very good documentation. You have to get everything from the demos, but the actual demo files are hidden in ajax code. This file is the data file used to build the demo navigation menu on the left. It has the name of the individual demo .html files along with the visible text. There is a corresponding .js file for each demo. All the files are in the http://trirand.com/blog/jqgrid/ directory.
Example: http://trirand.com/blog/jqgrid/searching.html http://trirand.com/blog/jqgrid/searching.js
The first thing I did was create a "gvoice.py" module with several helpful classes. These allow you to:I am by no means a seasoned Python developer, but what I have created works well for my purposes. I tried to make the classes as loosely coupled with the UI as possible in case I want to put a GUI around it sometime, but for now I am doing everything at the command line (which I often prefer).
- Log in
- Gather all Google Contacts into separate groups
- Selectively narrow down the contacts in a group
- Gather the phone numbers that you have entered
- Send SMS messages
- Place Calls
# Server program from socket import * # Set the socket parameters host = "localhost" port = 21567 buf = 1024 addr = (host,port) # Create socket and bind to address UDPSock = socket(AF_INET,SOCK_DGRAM) UDPSock.bind(addr) # Receive messages while 1: data,addr = UDPSock.recvfrom(buf) if not data: print "Client has exited!" break else: print "nReceived message '", data,"'" # Close socket UDPSock.close()
# Client program
from socket import *
# Set the socket parameters
host = "localhost"
port = 21567
buf = 1024
addr = (host,port)
# Create socket
UDPSock = socket(AF_INET,SOCK_DGRAM)
def_msg = "===Enter message to send to server===";
print "n",def_msg
# Send messages
while (1):
data = raw_input('>> ')
if not data:
break
else:
if(UDPSock.sendto(data,addr)):
print "Sending message '",data,"'....."
# Close socket
UDPSock.close()
/*send the packet*/
send_result = sendto(s, buffer, ETH_FRAME_LEN, 0,
(struct sockaddr*)&socket_address, sizeof(socket_address));
if (send_result == -1) { errorhandling... }
Example 1.6. Receive a RAW ethernet frame
void* buffer = (void*)malloc(ETH_FRAME_LEN); /*Buffer for ethernet frame*/
int length = 0; /*length of the received frame*/
...
length = recvfrom(s, buffer, ETH_FRAME_LEN, 0, NULL, NULL);
if (length == -1) { errorhandling .... }
* is Unix
Jacob Kaplan-Moss
October 7, 2009
via http://twitter.com/programmingjoy Javascript as Compiler Target: Clamato, GWT Smalltalk, Python, Scheme http://www.infoq.com/news/2009/09/javascript-compilation-target (require moby/stub/world) (define WIDTH 320) (define HEIGHT 480) (define (render w) (place-image (text "Hello World" 10 "Black") 20 20 (empty-scene WIDTH HEIGHT))) (big-bang WIDTH HEIGHT 10 0) (on-redraw render)
After a few minutes of poking around, I was able to compile this to Java and then run it on the Android Emulator:
//dirt cheap wireless TX
//generates 38kHz carrier wave on pin 9 and 10
//sends data via TX every 500ms
void setup()
{
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
// Clear Timer on Compare Match (CTC) Mode
bitWrite(TCCR1A, WGM10, 0);
bitWrite(TCCR1A, WGM11, 0);
bitWrite(TCCR1B, WGM12, 1);
bitWrite(TCCR1B, WGM13, 0);
// Toggle OC1A and OC1B on Compare Match.
bitWrite(TCCR1A, COM1A0, 1);
bitWrite(TCCR1A, COM1A1, 0);
bitWrite(TCCR1A, COM1B0, 1);
bitWrite(TCCR1A, COM1B1, 0);
// No prescaling
bitWrite(TCCR1B, CS10, 1);
bitWrite(TCCR1B, CS11, 0);
bitWrite(TCCR1B, CS12, 0);
OCR1A = 210;
OCR1B = 210;
Serial.begin(2400);
}
void loop()
{
Serial.println("testing testing testing");
delay(500);
}
To decode what the remote was sending, I used an oscilloscope and a small photodiode. The photodiode generates a small amount of voltage when light hits it, and responds to changes in light level quickly enough that the oscilloscope can draw a really nice plot of the signal. I have a Parallax USB oscilloscope, which is perfect for showing the command pulses and is just fast enough to find the modulation frequency. As an aside, I’m really happy with the Parallax oscilloscope for projects like this. It is simple to use and I love being able to save images to share with people.
Here’s what two of the commands from the dimmer remote look like. The top signal is the “fade lights up” command, and the bottom one is “fade lights down”:
![]()
I'm working on a project that uses data in JSON format (www.json.org). It took me a while to get it going in processing, so I thought I'd post what I did here. If there's a better way (which undoubtedly there is!), please let me know.
Andrew Odewahn
--
Here are the steps I took (on Windows):
1. Download http://www.json.org/java/json.zip from json.org. Save it in a some directory, which I'll call %DOWNLOAD_HOME%.
2. Unzip it. Be sure you preserve the archive's directory structure (/org/json/) when you unzip the file.
3. Change directory into %DOWNLOAD_HOME%orgjson