specify P2D on size():
size(1024, 768, P2D);
otherwise you keep getting this exception on mac:
Exception in thread "Animation Thread" java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds!
at sun.awt.image.IntegerInterleavedRaster.setDataElements(IntegerInterleavedRaster.java:416)
at processing.core.PGraphicsJava2D$ImageCache.update(PGraphicsJava2D.java:959)
at processing.core.PGraphicsJava2D.imageImpl(PGraphicsJava2D.java:834)
at processing.core.PGraphics.image(PGraphics.java:2756)
at processing.core.PApplet.image(PApplet.java:8637)
at sketch_may01a.draw(sketch_may01a.java:39)
at processing.core.PApplet.handleDraw(PApplet.java:1631)
at processing.core.PApplet.run(PApplet.java:1530)
at java.lang.Thread.run(Thread.java:680)via http://processing.org/discourse/yabb2/YaBB.pl?num=1232118515
work around
import sys sys.stdout = sys.stderr
http://code.google.com/p/modwsgi/wiki/DebuggingTechniques
or (probably preferable)
WSGIRestrictStdout Off
http://blog.dscpl.com.au/2009/04/wsgi-and-printing-to-standard-output.html
$ defaults write com.apple.versioner.python Prefer-32-Bit -bool yes
or
$ export VERSIONER_PYTHON_PREFER_32_BIT=yes
http://www.jaharmi.com/2009/08/29/python_32_bit_execution_on_snow_leopard http://www.jaharmi.com/2009/09/01/core_graphics_bindings_on_64_bit_python_in_...
Getting exceptions like
-[NSCFString yourAction:]: unrecognized selector sent to instance 0x751be30
System Preferences > Keyboard > Keyboard Shortcuts
/*
based on http://gnufoo.org/macosx/macosx.html
place this at ~/Library/KeyBindings/DefaultKeyBinding.dict
“^” for Control
“~” for Option
“$” for Shift
“#” for numeric keypad http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/index.html
*/
{
"^F"="moveWordForward:";
"^B"="moveWordBackward:";
"~f"="moveWordForward:";
"~b"="moveWordBackward:";
"^D"="deleteWordForward:";
"^H"="deleteWordBackward:";
"~d"="deleteWordForward:";
"~h"="deleteWordBackward:";
/* Escape should really be complete. */
"\033"="complete:"; /* Escape */
}
install pygraphviz via MacPorts
http://code.google.com/p/django-command-extensions/wiki/GraphModels
$ ./manage.py graph_models -a > my_project.dot
$ ./manage.py graph_models -a -g -o my_project_visualized.png
$ ./manage.py graph_models foo bar > my_project.dot
for none-64-bit open source projects:
$ make clean $ CC="gcc-4.0" CXX="g++-4.0" CFLAGS="-arch i386" LDFLAGS="-arch i386" CXXFLAGS="-arch i386" ./configure $ make
install applications
system preference
other configuration
transfer from old environment
#ifdef __cplusplus extern "C" { #endif void audio_setup() { // c++ code } #ifdef __cplusplus } #endif
enctype="multipart/form-data" attribute is required for <form> tag
http://docs.djangoproject.com/en/dev/topics/http/file-uploads/
### to prepare ### arr = [(float(x)/(size-1),float(y)/(size-1)) for x in xrange(size) for y in xrange(size)] arr = np.require(arr, 'f') self.vbo = OpenGL.arrays.vbo.VBO(arr , 'GL_STATIC_DRAW') ### to use ### self.vbo.bind() glEnableClientState(GL_VERTEX_ARRAY) glEnableClientState(GL_TEXTURE_COORD_ARRAY) glTexCoordPointer(2, GL_FLOAT, 0, None) glVertexPointer(2, GL_FLOAT, 0, None) glDrawArrays(GL_POINTS, 0, N_PARTICLE) glDisableClientState(GL_VERTEX_ARRAY) glDisableClientState(GL_TEXTURE_COORD_ARRAY) self.vbo.unbind()
* The last argument for glVertexPointer should be None, not 0.
* do this on 10.5, otherwise the custom icon size / background will be lost.
useful Makefile to build a disk image: http://el-tramo.be/guides/fancy-dmg
update its line 67:
WC_DEV=`hdiutil info | grep "wc" | grep "/dev/" | awk '{print $$1}'` && hdiutil detach $$WC_DEV -quiet -force* override copyWithZone:
@interface MyLayerAnimation : CABasicAnimation { MyItemLayer *relatedLayer; } @property (assign) __weak MyItemLayer *relatedLayer; @end @implementation MyLayerAnimation @synthesize relatedLayer; - (id)copyWithZone:(NSZone *)zone { MyLayerAnimation *newObj = [super copyWithZone:zone]; newObj.relatedLayer = self.relatedLayer; return newObj; } @end
set python in 32bit mode:
$ defaults write com.apple.versioner.python Prefer-32-Bit -bool yes
will generate & play realtime white noise on iphone.
MyAudio.h
#import #define MY_AUDIO_BUFFERS_NUM 4 #define MY_AUDIO_BUFFER_FRAMES 256 #define MY_AUDIO_BUFFER_SIZE (MY_AUDIO_BUFFER_FRAMES * 2 * 2) @interface MyAudio : NSObject { AudioQueueRef queueObject; AudioQueueBufferRef audioBuffers[MY_AUDIO_BUFFERS_NUM]; AudioStreamBasicDescription audioFormat; } - (IBAction)setupAudio:(id)sender; - (IBAction)teardownAudio:(id)sender; @end
MyAudio.m
#import "MyAudio.h" @interface MyAudio () - (void)playbackCallbackWithAudioQueue:(AudioQueueRef)inAudioQueue buffer:(AudioQueueBufferRef)bufferReference; @end static void PlaybackCallback ( void *inUserData, AudioQueueRef inAudioQueue, AudioQueueBufferRef bufferReference ) { [(MyAudio *)inUserData playbackCallbackWithAudioQueue:inAudioQueue buffer:bufferReference]; } @implementation MyAudio - (void)playbackCallbackWithAudioQueue:(AudioQueueRef)inAudioQueue buffer:(AudioQueueBufferRef)bufferReference; { NSUInteger numBytes = MY_AUDIO_BUFFER_SIZE; NSUInteger bytesPerFrame = audioFormat.mBytesPerFrame; NSUInteger channlesPerFrame = audioFormat.mChannelsPerFrame; NSUInteger bytesPerSample = bytesPerFrame/channlesPerFrame; NSUInteger numFrames = numBytes/bytesPerFrame; NSUInteger i=0; while (imAudioData + dstAddr) = (AudioSampleType)(rand() / (float)RAND_MAX * 10); *(AudioSampleType *)(bufferReference->mAudioData + dstAddr + bytesPerSample) = (AudioSampleType)(rand() / (float)RAND_MAX * 10); i++; } bufferReference->mAudioDataByteSize = numBytes; AudioQueueEnqueueBuffer (inAudioQueue, bufferReference, 0, NULL); } - (IBAction)setupAudio:(id)sender { audioFormat.mFormatID = 1819304813; audioFormat.mFormatFlags = 14; audioFormat.mSampleRate = 44100.0; audioFormat.mChannelsPerFrame = 2; audioFormat.mFramesPerPacket = 1; audioFormat.mBytesPerFrame = 4; audioFormat.mBytesPerPacket = 4; audioFormat.mBitsPerChannel = 16; audioFormat.mReserved = 0; OSStatus ret = AudioQueueNewOutput ( &audioFormat, PlaybackCallback, self, CFRunLoopGetCurrent (), kCFRunLoopCommonModes, 0, // run loop flags &queueObject); assert(ret == noErr); assert(queueObject != NULL); assert(audioFormat.mChannelsPerFrame==2); Float32 gain = 1.0; AudioQueueSetParameter (queueObject, kAudioQueueParam_Volume, gain); NSUInteger bufferIndex; for (bufferIndex = 0; bufferIndex < MY_AUDIO_BUFFERS_NUM; ++bufferIndex) { AudioQueueAllocateBuffer (queueObject, MY_AUDIO_BUFFER_SIZE, &audioBuffers[bufferIndex]); audioBuffers[bufferIndex]->mAudioDataByteSize = MY_AUDIO_BUFFER_SIZE; AudioQueueEnqueueBuffer(queueObject, audioBuffers[bufferIndex], 0, NULL); } UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback; AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof (sessionCategory), &sessionCategory); AudioSessionSetActive(true); ret = AudioQueueStart (queueObject, NULL); assert(ret == noErr); } - (void)teardownAudio { AudioQueueStop (queueObject, YES); AudioQueueDispose (queueObject, YES); } @end