links · people · groups · tags | My: links · tags · groups · watchlists · notes login · sign up now! | help · blog
Simpy simpy
 
Michael Shook, member since May 27, 2004
.
Search Everyone: "code",

Top "code" experts: glassesofkekkonen, myspacelayoutgraphics, fredb, adski, brillig, yabbas,

Groups about "code": codes, Medical coding, mobile Unlock codes, Success Code, Programming, House Info,

1 - 50 of 60 next »   Watch mshook
 

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
by mshook 2009-12-15 16:23 jqgrid · jquery · tip · demo · code · javascript · html · how · howto · mynote · grid · plugin
http://trirand.com/blog/jqgrid/tree.xml - cached - mail it - history
The first thing I did was create a "gvoice.py" module with several helpful classes. These allow you to:
  1. Log in
  2. Gather all Google Contacts into separate groups
  3. Selectively narrow down the contacts in a group
  4. Gather the phone numbers that you have entered
  5. Send SMS messages
  6. Place Calls
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).
by mshook 2009-11-26 20:13 python · google · voice · gvoice · api · code · voip · telephone · phone · howto · csv · gdata · sms · cli
http://everydayscripting.blogspot.com/2009/08/python-google-voice-mass-sms-and-mass.html - cached - mail it - history
# 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()
by mshook 2009-11-14 18:27 test · python · udp · example · code · simple · useful · works
http://www.evolt.org/node/60276 - cached - mail it - history
/*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 .... }
by mshook 2009-10-15 22:15 ethernet · 802 · packet · howto · code · mac · ip · c · example
http://aschauf.landshut.org/fh/linux/udp_vs_raw/ch01s03.html - cached - mail it - history

* is Unix

Jacob Kaplan-Moss

October 7, 2009

by mshook 2009-10-08 00:07 c · ruby · python · example · code · minimal · server · viapopular · good · linux · perl · how · network · socket · process
http://jacobian.org/writing/star-is-unix/ - cached - mail it - history
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:

by mshook 2009-10-01 16:40 scheme · android · javascript · compiler · lisp · java · mobile · example · code · interesting
http://benjisimon.blogspot.com/2009/03/plt-scheme-meets-android-platform.html - cached - mail it - history
//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);
}


by mshook 2009-09-27 21:21 arduino · avr · code · timer · ir · infrared · receiver · transmitter · serial · howto · circuitled · modulation · c
http://tthheessiiss.wordpress.com/2009/08/05/dirt-cheap-wireless/ - cached - mail it - history
via http://tinyurl.com/ir-remote-control
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”:
oscilloscope image of 2 commands
by mshook 2009-09-22 22:48 ir · howto · oscilliscope · modulation · avr · arduino · project · code · infrared · control · wishlist · remote · usb
http://zovirl.com/2008/11/12/building-a-universal-remote-with-an-arduino/ - cached - mail it - history
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
by mshook 2009-09-22 10:48 processing · howto · json · java · code · library · emon
http://processing.org/discourse/yabb2/YaBB.pl?board=Integrate%3Baction=display%3Bnum=1163101573 - cached - mail it - history
SELECT CONCAT( "[", GROUP_CONCAT( CONCAT("{name:'",`name`,"'"), CONCAT(",email:'",`email`,"'}") ) ,"]") AS json FROM users; CREATE TABLE `user`( `id` int not null auto_increment, `name` varchar(100), `email` varchar(50), PRIMARY KEY(id) ) ENGINE = InnoDB; INSERT INTO `user` (`name`, `email`) VALUES ('Cesar', 'cesar@craftyman.net'), ('Maria', 'maria@gmail.com'), ('Jose', 'j0s3@hotmail.com'), ('Albert','albertpr@yahoo.com');
by mshook 2009-08-10 08:54 via · json · popular · mysql · sql · howto · code · example
http://craftyman.net/mysql-to-json/ - cached - mail it - history
Left to right: John Maloney (MIT/Scratch), Golan Levin (CMU), Tom McMail (Microsoft Research), Ira Greenberg (Miami U. Ohio), Hans-Christoph Steiner (NYU/ Pure Data), Evelyn Eastmond (MIT/Scratch), Casey Reas (UCLA/Processing), Zachary Lieberman (Parsons/openFrameworks), Theodore Watson (openFrameworks), Ben Fry (Seed Visualization Lab/Processing), Arturo Castro (openFrameworks), Sebastian Oschatz (Meso/VVVV), Daniel Shiffman (NYU), Luke DuBois (NYU/Cycling74), Dr. Woohoo (ExtendScript), Why the Lucky Stiff (Hackety Hack). Not pictured but also presenting: Don Slater (CMU/Alice), Wanda Dann (CMU/Alice).
by mshook 2009-08-07 16:55 adobe · art · code · conference · march · 2009 · mit · cpp · photo · javascript
http://www.flickr.com/photos/golanlevin/3344190502/ - cached - mail it - history
1. $(document).ready () All The Way
2. Use $(window).load ()
3. Load Only What You Really Need
4. Learn What The ‘data’ Method Is And Use It
5. Built-In Custom Selectors
6. Flag With Classes
7. Don’t Call the Same Selector Hundreds of Times
8. Chain (Almost) Everything
9. toggleClass Utility
10. Store jQuery Results

var $p = $('p.hello');
$p.css ('color', '#000000');
$p.text ('hello');
$p.addClass ('paragraph');
$p.fadeTo (1000, 1);

$('p.hello').css ('color', '#000000').text ('hello').addClass ('paragraph').fadeTo (1000, 1);
                  
by mshook 2009-08-05 18:46 jquery · javascript · useful · tips · tip · example · code · short
http://www.myinkblog.com/2009/08/04/10-tips-for-writing-better-jquery-code/ - cached - mail it - history
<?xml version="1.0" encoding="UTF-8"?>
<Module>
  <ModulePrefs title="simple image gadget" />
  <UserPref name="myname"
    display_name="Module title"
    default_value="Image"
    required="true"/>
  <UserPref name="targetimg"
    display_name="URL of your image"
    default_value="http://www.google.com/images/logo_sm.gif"
    required="true"/>
  <UserPref name="imgwidth"
    display_name="Width"
    default_value="100%"
    required="true"/>
  <Content type="html"><![CDATA[
<!-- Simplification of bashennekam.googlepages.com/google_gadget_image.xml -->
<div align="center">
<a href="__UP_targetimg__" target="_blank">
<img src="__UP_targetimg__" border="0" align="center" width="__UP_imgwidth__">
</a>
</div>
]]></Content>
</Module>
by mshook 2009-07-09 10:55 google · gadget · howto · xml · code · image · simple
http://mshook.appspot.com/z/d4m.htm?/mshook/9+july+2009+b - cached - mail it - history
  1. Use HTTP
  2. Use your verbs
  3. Keep Your URL/URIs Consistent
  4. Use Your Status Codes
  5. Expose (And Accept) Multiple Data Formats
  6. Protect Your Users with OAuth
  7. Don’t Shut Off HTTP Authentication Entirely
  8. Document, Document, Document
by mshook 2009-07-05 22:14 rest · api · tips · howto · example · code · xml · json · emon
http://wonderfullyflawed.com/2009/07/02/get-your-api-right/ - cached - mail it - history
void httpRequest()
{
  byte theByte;

  xPortSerial.print("GET ");
  xPortSerial.print(PHP_PAGE_LOCATION);

  // value0 = 123 and value1 = 456
  // You should change these to be your sensor values or whatever you want to send
  // (see php code if you want to add more values or change the names value0/value1
  xPortSerial.print("?value0=123&value1=456");
  xPortSerial.print(" HTTP/1.1n");
  xPortSerial.print(WEB_HOST);

  while(!xPortSerial.available()) {} // Just loop until available
  theByte = xPortSerial.read();
  if (theByte != 0)
    Serial.println("Passed.");
  else
    Serial.println("Failed.");
}
by mshook 2009-07-02 05:44 arduino · ethernet · server · client · avr · howto · code · php · c · sheild
http://www.glacialwanderer.com/hobbyrobotics/?p=15 - cached - mail it - history
.nolist			; We don't want to actually include defs in our listing file.
.include "m168def.inc"	; m168def.inc defines all the pins on the Mega168 so we can
			; use them by their names rather than addresses (not fun).

.list			; We DO want to include the following code in our listing ;D

	rjmp	main 	; You usually place these two lines after all your
main:			; directives. They make sure that resets work correctly.

	ldi	r16,0xFF ; LoaD Immediate. This sets r16 = 0xFF (255)
	out	DDRB,r16 ; Out writes to SRAM, which is one way of accessing
			 ; pins. DDRB controls PORTB's in/out state.

	ldi	r16,0x00 ; r16 is where we'll store current LED state
			 ; 0x00 means all off. This is preserved over loops.
...
by mshook 2009-06-28 19:50 avr · arduino · minimal · blink · assembler · howto · example · code · asm · linux · good
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1218921378 - cached - mail it - history
hardware/tools/avrdude -Chardware/tools/avrdude.conf -v -v -v -v -pm328p -cstk500v1 -P/dev/ttyUSB0 -b57600 -D -Uflash:w:/home/michael/arduino/BlinkArduinoLED.hex:i
by mshook 2009-06-27 18:20 example · c · blink · asm · assembler · avr · arduino · code · howto · upload
http://code.google.com/p/tinyprojects/source/browse/trunk/avr/ - cached - mail it - history
You need to tell subversion what mime-type to use. Just use the command:

svn propset svn:mime-type 'text/html' FILENAME

or

svn propset svn:mime-type 'image/jpeg' FILENAME

For more info: http://svnbook.red-bean.com/en/1.4/svn.advanced.props.file-portability.html#svn.advanced.props.special.mime-type

It's also possible to configure your Subversion client to automatically set
each file's mime-type. For example, by modifying ~/.subversion/config to resemble

[miscellany]
enable-auto-props = yes

[auto-props]
*.html = svn:mime-type=text/html

For more info: http://svnbook.red-bean.com/en/1.1/ch07.html#svn-ch-7-sect-1.3.2 
by mshook 2009-06-25 10:47 svn · html · howto · serve · server · google · code · image · jpg · subversion
http://code.google.com/p/support/wiki/FAQ - cached - mail it - history

Using a device called a trampoline, a function could return a function which needs to be called. Observe:

function add ($x, $y) {
if ($y > 0) {
return array (”add”, $x + 1, $y - 1);
} else {
return $x;
}
}
$f = array (”add”, 6, 5);
do {
$func = $f[0];
$f = $func($f[1], $f[2]);
} while (is_array ($f));

It’s hardly pretty (though implicit evaluation improves this drastically over other methods) but it’s not awful and makes some things in PHP possible that would otherwise require writing an extension in another language.

by mshook 2009-06-23 09:29 php · recursion · how · example · code · ugly · tail
http://www.alternateinterior.com/2006/09/tail-recursion-in-php.html - cached - mail it - history
google.visualization.Query.setResponse({
    version: '0.6',
    status: 'ok',
    sig: '202289222',
    table: {
        cols: [{
            id: 'A',
            label: 'Name',
            type: 'string',
            pattern: ''
        },
        {
            id: 'B',
            label: 'Value',
            type: 'number',
            pattern: '#0.###############'
        }],
        rows: [{
            c: [{
                v: 'One'
            },
            {
                v: 1.0,
                f: '1'
            }]
        },
        {
            c: [{
                v: 'Ten'
            },
            {
                v: 10.0,
                f: '10'
            }]
        }]
    }
});

( pretty printed by http://jsbeautifier.org/ )

by mshook 2009-06-20 00:23 javascript · pp · google · gadget · visualization · api · query · code · how · spreadsheet · data · source · datasource · json
http://spreadsheets.google.com/tq?key=rYdmpMlO1sGo3OBxv6SusWA&range=A1:B3&gid=0 - cached - mail it - history
Here's an example: http://spreadsheets.google.com/tq?key=rYdmpMlO1sGo3OBxv6SusWA&range=A1:B3&gid=0 and the spreadsheet it came from: http://spreadsheets.google.com/ccc?key=rYdmpMlO1sGo3OBxv6SusWA&hl=en

google.visualization.Query

Represents a query that is sent to a data source.

Constructor

google.visualization.Query(dataSourceUrl, opt_options)

Parameters

dataSourceUrl
[Required, String] URL to send the query to. The data source should expose this URL in some way; for example, to get the dataSourceUrl from a Google Spreadsheet, do the following:
  1. In your spreadsheet, select the range of cells.
  2. Select 'Insert' and then 'Gadget' from the menu.
  3. Open the gadget's menu by clicking on the top-right selector.
  4. Select menu option 'Get data source URL'.
by mshook 2009-06-20 00:05 google · gadget · spreadsheet · javascript · json · callback · visualization · api · howto · code · data · source · datasource
http://code.google.com/apis/visualization/documentation/reference.html - cached - mail it - history
Username:  	 joe.gregorio
Type the characters you see in the picture below.


Letters are not case-sensitive
Project ownership: 	feedvalidator
robaccia
mimeparse
httplib2
uri-templates
atompub-mulitpart-spec
google-app-engine-samples googleappengine gae-sqlite google-app-engine-codelab app-engine-tutorial Project membership: feedparser gdata-python-client doctype skia
by mshook 2009-06-19 23:47 joegregorio · code · example · atom · rest · wiki · google · gae · good · sqlite
http://code.google.com/u/joe.gregorio/ - cached - mail it - history
  • Here's the spreadsheet: http://spreadsheets.google.com/ccc?key=r3nTy-cjddJFXh6ZmpmxcaA&hl=en#
  • Here's where I set up the page: http://www.google.com/webelements/docs/spreadsheets/
  • How is this different from a Google Gadget?
by mshook 2009-06-15 11:15 google · gadget · elements · iframe · spreadsheet · 15 · june · 2009 · a · test · code
http://mshook.appspot.com/z/d4m.htm?/mshook/15+june+2009+a - cached - mail it - history

This scheme produces a sampled sine waveform with 12 samples per cycle. In addition to the desired frequency component, f0, this waveform contains higher-frequency components at (12k+1)f0 and (12k−1)f0, k=1,2,3, and so forth. The lowpass filter comprising IC2B, R7, R8, C3, and C4 easily filters out these undesired components of smaller amplitude. Listing 1 is the assembly-program code that implements the Bell 202 FSK standard. When the control input Data In is high, the output frequency is 1200 Hz; when the control is low, the output frequency is 2200 Hz. The transition from one frequency to the other occurs in a manner that retains phase continuity.

by mshook 2009-06-14 19:27 modulation · saved · fsk · modem · pic · how · circuit · code · schematic · pdf · audio · bell
http://www.edn.com/index.asp?layout=articlePrint&articleID=CA6662631 - cached - mail it - history
; LEDblink.asm - M. Covington 2006 
; For ATtiny13. 
; Blinks the LEDs attached to PB0 and PB1. 

.include "tn13def.inc" 

.def temp = R16 
.def temp1 = R17 
.def temp2 = R18 
.def mask = R19 

start: ldi temp,0b00000010
       out PORTB,temp ; initialize port B 
       ser mask 
       out DDRB,mask ; port B all outputs 
blink: 
       ; Delay 0.1 sec (1.2 MHz) 
       ldi temp1,200 ; outer loop count 
L1:    ldi temp2,199 ; inner loop count 
L2:    dec temp2 
       brne L2 
       dec temp1 
       brne L1 
       ; Toggle PB0 and PB1 
       ldi mask,0b00000011 
       eor temp,mask 
       out PORTB,temp 

       rjmp blink 
; End of program
by mshook 2009-06-14 17:36 avr · assembler · example · code · pdf · led · arduino · microcontroller · minimal
http://www.ai.uga.edu/mc/microcontrollers/avr/AVRnotebook.pdf - cached - mail it - history
void setup(){
  pinMode(13, OUTPUT);
}
 
void loop(){
  digitalWrite(13, HIGH);
  delay(500);
  digitalWrite(13, LOW);
  delay(500);
}

First, we configure pin 13 for output by setting a bit in Data Direction Register B. Then we turn pin 13 by setting its bit in PORTB. Then we delay 500 milliseconds by marking the current value of timer0, converted into milliseconds, and letting the counter be incremented repeatedly at each clock cycle and overflowed into ever larger holders until the new value of timer0 represents an elapsed time of 500ms. Next we set the bit for pin 13 in PORTB low to turn the LED off. We do the delay dance again and we're home.

by mshook 2009-06-14 16:18 arduino · avr · how · code · c · microcontroller · good · long · macro
http://www.urbanhonking.com/ideasfordozens/2009/05/an_tour_of_the_arduino_interna.html - cached - mail it - history
void branch(float h) {
  
  h *= (float) $('#val_size_1').val();
  
  // All recursive functions must have an exit condition!!!!
  // Here, ours is when the length of the branch is 2 pixels or less
  if (h > 5) {
    pushMatrix();    // Save the current state of transformation (i.e. where are we now)
    rotate(theta);   // Rotate by theta
    line(0,0,0,-h);  // Draw the branch
    translate(0,-h); // Move to the end of the branch
    //ellipse(0, 0, 40, 40);
    branch(h);       // Ok, now call myself to draw two new branches!!
    popMatrix();     // Whenever we get back here, we "pop" in order to restore the previous matrix state
    
    // Repeat the same thing, only branch off to the "left" this time!
    pushMatrix();
    rotate(-theta);
    line(0,0,0,-h);
    translate(0,-h);
    branch(h);
    popMatrix();
  }
}
by mshook 2009-06-09 12:01 via · group · processing · recursive · tree · jquery · cool · howto · code · javascript
http://lab.deytec.net/processingjs/ - cached - mail it - history
// just type here
// and click "submit" when done


void setup(){
  size(301,301);
}

  void draw() {
 background(290, mouseX, 50);
 noStroke();

 fill(mouseX, 139, mouseY);
 rect(45, 45, 45, 45);
 fill(20, mouseY, mouseX);
 rect(50, 50, 35, 35);

fill(mouseX, 139, mouseY);
 rect(100, 100, 100, 100);
 fill(mouseX, 20, mouseY);
 rect(50, 50, 35, 35);

fill(mouseX, mouseY, 139);
 rect(200, 200, 200, 200);
 fill(20, mouseY, mouseX);
 rect(50, 50, 35, 35);

fill(mouseX, mouseY, mouseY);
 rect(100, 100, 100, 100);
 fill(20, mouseY, mouseX);
 rect(50, 50, 35, 35);


} 
by mshook 2009-06-09 09:23 processing · graphics · language · flash · question · twitter · code · example
http://mshook.appspot.com/z/d4m.htm?/mshook/9+june+2009+a - cached - mail it - history
  1. Flot
  2. Flotr
  3. fgCharting
  4. PlotKit
  5. JavaScript Diagram Builder
  6. Emprise JavaScript Charts
  7. Dynamic Drive Pie Graph
  8. Dynamic Drive Line Graph
  9. Canvas 3D Graph
  10. Dojo Charting Engine
by mshook 2009-06-08 15:07 graph · javascript · library · code · chart · list
http://sixrevisions.com/javascript/graph_chart_plot_data_javascript/ - cached - mail it - history
Drag this link to your browser toobar:
del.icio.us linkback
javascript:location.href='http://del.icio.us/url?v=1&url='+encodeURIComponent(location.href)
by mshook 2009-06-05 19:07 javascript · code · bookmarklet · del.icio.us · link · url · hypertext · 6 · june · 2009 · a
http://mshook.appspot.com/z/d4m.htm?/mshook/5+june+2009+a - cached - mail it - history
(define db (quote (
((content)(tags))
((here is an example of content) (example content))
((an entry is a list containing two lists. The first list is the content. The second list is tags) (explanation tags))
)))

(define get-content (lambda (entry) (car entry)))

(define get-tags (lambda (entry) (cadr entry)))

(define subset? (lambda (keys lat)
  (cond ((null? keys) #t)
        ((memq (car keys) lat) (subset? (cdr keys) lat))
        (#t #f))))

(define tag-query (lambda (tags db)
  (cond ((null? db) '())
        ((subset? tags (get-tags (car db))) (cons (car db) (tag-query tags (cdr db))))
        (#t (tag-query tags (cdr db))))))
by mshook 2009-05-22 16:02 lisp · scheme · code · tags · example · short · query · search
http://code.google.com/p/tinyprojects/source/browse/trunk/tag-query/tag-query.scm - cached - mail it - history
% /home/cs1721/bin/emu /home/cs1721/public_html/05s2/emu/examples/iota.hex
Emu Reference Implementation v0.?
> program
0000: e000 LDI R16,0
0001: e081 LDI R24,1
0002: 2fa0 MOV R26,R16
0003: e7f0 LDI R31,112
0004: e0e0 LDI R30,0
0005: 9509 ICALL
0006: e011 LDI R17,1
0007: 0f01 ADD R16,R17
0008: e614 LDI R17,100
0009: 1b10 SUB R17,R16
000a: f7b1 BRBC 1,-10
000b: e080 LDI R24,0
000c: e7f0 LDI R31,112
000d: e0e0 LDI R30,0
000e: 9509 ICALL
> registers
PC=0000 SP=1100 SR=[C=0,Z=0,N=0,V=0]
r00-r0f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
r10-r1f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> step
0000: e000 LDI R16,0
PC=0001 SP=1100 SR=[C=0,Z=0,N=0,V=0]
r00-r0f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
r10-r1f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> run
0
1
...
8
9
> restart
> run
0
1
...
9
> registers
PC=000f SP=1100 SR=[C=0,Z=1,N=0,V=0]
r00-r0f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
r10-r1f 0a 00 00 00 00 00 00 00 00 00 09 00 00 00 00 70
by mshook 2009-05-17 20:08 up · assembler · how · code · example · debug · dump · emulator
http://www.cse.unsw.edu.au/~cs1721/05s2/emu/emu.html - cached - mail it - history

Example: sum of first 4 integers.

sum = 0;
for (i = 1; i <= 4; ++i)
   sum += i*i;
can be translated to
sum = 0;
i = 1;
loop:
   if (i == 5) goto end;;
   sum = sum + i;
   i = i + 1;
goto loop;
end:
can be translated to
; sum in R16
; i in R17
; R18,R19 used for temporary values
    LDI R16, 0
    LDI R17, 1
    LDI R18, 5
    SUB R18, R17
    BRBS 1, 22
    ADD R16, R17
    LDI R19, 1
    ADD R17, R19
    JMP 2
    SLEEP

by mshook 2009-05-16 22:45 slides · assembler · c · compile · howto · avr · up · arduino · example · code
http://www.cse.unsw.edu.au/~cs1721/05s2/lectures/slide52.html - cached - mail it - history
(define (eval exp env)
  (cond ((self-evaluating? exp) exp)
        ((variable? exp) (lookup-variable-value exp env))
        ((quoted? exp) (text-of-quotation exp))
        ((assignment? exp) (eval-assignment exp env))
        ((definition? exp) (eval-definition exp env))
        ((if? exp) (eval-if exp env))
        ((lambda? exp)
         (make-procedure (lambda-parameters exp)
                         (lambda-body exp)
                         env))
        ((begin? exp) 
         (eval-sequence (begin-actions exp) env))
        ((cond? exp) (eval (cond->if exp) env))
        ((application? exp)
         (apply (eval (operator exp) env)
                (list-of-values (operands exp) env)))
        (else
         (error "Unknown expression type -- EVAL" exp))))
  • http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-26.html
by mshook 2009-05-16 17:56 sicp · eval · lisp · scheme · code · 16 · may · 2009 · b
http://mshook.googlepages.com/d4m.htm?/mshook/16+may+2009+b - cached - mail it - history
// Regular Expressions function main() { var re = /(w+)(s+)(w+)/; var out = input.match(re); for(i = 0;i < out.length;i++) { print(i + " = [" + out[i] + "]n"); } }
  • There is a pseudo-function called "print()" (not part of javaScript) that allows data to be placed in the output window. See examples for its use.
by mshook 2009-05-16 14:40 javascript · test · example · good · useful · regex · re · interactive · code · 1999
http://www.arachnoid.com/javascript/interactiveJavaScript.html - cached - mail it - history
We want to write a function that generates accumulators-- a function that takes a number n, and returns a function that takes another number i and returns n incremented by i.

JavaScript

function foo(n) { return function (i) { return n += i } }

Scheme

(define (foo n) (lambda (i) (set! n (+ n i)) n))

Try

JavaScript

function main() { function foo (n) { return function (i) { return n += i } } ; a = foo(5); print(a(1)); print("n"); print(a(4)); }

Scheme

(define (foo n) (lambda (i) (set! n (+ n i)) n)) (define a (foo 5)) (a 1) (a 4)
by mshook 2009-05-16 14:30 lisp · scheme · javascript · 16 · may · 2009 · a · example · code · theory · comparison · good · closure
http://mshook.googlepages.com/d4m.htm?/mshook/16+may+2009+a - cached - mail it - history
by mshook 2009-05-12 09:56 saved · z80 · very · cool · emulator · javascript · game · code · demo
http://matt.west.co.tt/spectrum/jsspeccy/ - cached - mail it - history
	TITLE 'DEMOAST1 - READ AND PRINT'
*
* AUTHOR.  DON HIGGINS.
* DATE.    12/30/82.
* REMARKS. PC/370 DEMO TO ILLUSTRATE ASSIST DUMP AND LOG OUTPUT.
*
* THIS PROGRAM READS CARDS FROM DEMOAST1.DAT AND LISTS THEM ALONG
* WITH SELECTED DUMPS OF REGISTERS AND STORAGE ON DEMOAST1.LOG.
*
* MAINTENANCE
*
* 05/18/87 CONVERTED TO R2.0 XFILI/XFILO PATH/FILENAME FORMAT
*
*
DEMOAST1  CSECT
	USING *,R15
	XFILI =C'DEMOAST1.DAT'
	XFILO =C'DEMOAST1.LOG'
	XDUMP
LOOP     EQU   *
	XREAD CARD
	BNZ   EOF
	XPRNT CARD,80
	B     LOOP
EOF      EQU   *
	XDUMP CARD,80
	XDUMP CARD
	SVC   EXIT
R15      EQU   15
EXIT     EQU   0
CARD     DC    CL80' '
	END   DEMOAST1
/pre>
                  
by mshook 2009-05-10 21:30 ibm · assembler · emulator · cool · nostalgia · editor · simulator · code · example · dos · pc · 10 · may · 2009 · f · tinyurl · pyvh2k
http://mshook.googlepages.com/d4m.htm?/mshook/10+may+2009+f - cached - mail it - history
  • "The PC/370 package provides the capability to assemble, link, and execute IBM 370 assembler programs on any 80x86 MSDOS 2.0+ micro computer such as the IBM PC, XT, AT, PS/2, Compaq, etc. " ~1988
  • A more detailed description in an ACM abstract
  • Based on ASSIST which was implemented as a batch 360 system ~1974
  • includes lots of short example programs
  • includes the source for a working full screen character-based editor
  • I found it at http://www.ibmmainframes.com/downloads/PC-370.zip
  • I put a copy at http://mshook.googlepages.com/PC-370.zip
by mshook 2009-05-10 21:10 ibm · assembler · emulator · cool · nostalgia · editor · simulator · code · example · dos · pc · 10 · may · 2009 · e
http://mshook.googlepages.com/d4m.htm?/mshook/10+may+2009+e - cached - mail it - history
    1      SEE DEMO                 invoke full screen editor to
                                    create DEMO.ALC 370 assembler
                                    source file.
    2      DEMO CSECT               first line - define section
    3           USING *,15          second     - define base register
    4           LA    2,=C'HELLO$'  third      - address of msg. text
    5           SVC   209           fourth     - request console msg.
    6           BR    14            fifth      - exit to MS-DOS
    7           END                 sixth      - end of program

    8                          enter escape key to save DEMO.ALC
                                    and exit to MS-DOS
    9      A370 DEMO/LX             assemble DEMO.ALC and create
                                    DEMO.OBJ object code file and
                                    DEMO.PRN listing with symbol
                                    cross reference.
by mshook 2009-05-10 01:06 ibm · asm · howto · code · assembler · nostalgia · emulator · word · doc
http://bcs.solano.edu/workarea/pc370/full/DOC/INTRO.DOC - cached - mail it - history
by mshook 2009-05-10 00:48 flickr · badge · code · html · css · photo · how · howto · example · swcycle · outline · format
http://mshook.googlepages.com/d4m.htm?/mshook/10+may+2009+b - cached - mail it - history
by mshook 2009-05-10 00:36 flickr · badge · code · html · css · javascript · photo · how · howto · example · swcycle
http://mshook.googlepages.com/d4m.htm?/mshook/10+may+2009+a - cached - mail it - history

Figure this out before taking on JSONT

by mshook 2009-05-04 22:26 javascript · template · how · code · crockford · json · regex
http://mshook.googlepages.com/supplantdemo.htm - cached - mail it - history
by mshook 2009-05-03 20:01 php · mysql · cache · howto · code · emon
http://pureform.wordpress.com/2008/05/21/using-memcache-with-mysql-and-php/ - cached - mail it - history
POG is certainly more complicated
by mshook 2009-04-06 08:38 php · orm · oo · comparison · code · example · generator · crud · declarative · mynote
http://www.phpscaffold.com/ - cached - mail it - history
http://www.qsl.net/py4zbz/DSP/softw.htm "My first SDR is a software demodulator SSB (USB and LSB) with AGC, to be used in conjunction with a hardware SDR such as SDRZero. The I and Q signals produced by SDRZero are applied at the entrance of the stereo sound card, I being in the right channel and Q in the left. Comentarei, com ilustra ões feitas com o próprio BasicDSP, o programa exemplo. Comment, with ilustraões made with the very BasicDSP the program example."
by mshook 2009-04-02 09:43 good · sdr · brazil · basicdsp · code · radio · modulation · how · dsp
http://translate.google.com/translate?prev=_t&hl=en&ie=UTF-8&u=http%3A%2F%2Fwww.qsl.net%2Fpy4zbz%2FDSP%2Fsoftw.htm&sl=pt... - cached - mail it - history
by mshook 2009-04-02 09:27 saved · sdr · gmail · radio · modulation · pdf · detailed · interesting · good · code · schemaitc · why · how
http://www.ece.jhu.edu/~cooper/SWRadio/ - cached - mail it - history
1 - 50 of 60 next »  
Related Tags
 
- exclude ~ optional + require
Add Dates