Twitter-post-fetcher

Javascript client side method to search Tweets bypassing Oauth.

Uses Twitter Widgets – parsing the ‘JSON like response’ using Jquery.

By Jason Mayes

https://github.com/jasonmayes/Twitter-Post-Fetcher

Here is a sample URL that returns a response for the hashtag #cats using my widget: https://cdn.syndication.twimg.com/widgets/timelines/528661733678657536 If you set up a Twitter widget, just replace the ID number in the URL with the one that shows up when you run your widget.

Here is a derivative project by Alessio Zappa that doesn’t use Jquery: http://www.snip2code.com/Snippet/145533/Customize-twitterFetcher-JS-lib-for-our-

This method is not approved by Twitter. Use at your own risk: https://twittercommunity.com/t/can-i-use-cdn-syndication-twimg-com-widgets-timelines-for-my-website/20134

local version – tkzic/Twitter-Post-Fetcher-master/

 

SecretSpot update

Version 1.1 update to SecretSpot now available in the iOS app store.

http://zerokidz.com/secretspot/Home.html

SecretSpot was written in 2011 as a webApp using SenchaTouch 1.0 and Phonegap 0.94. Both of these frameworks have evolved to the point that the original code is no longer workable. With iOS 6, the app version of secretSpot broke. Audio was only triggering with every other touch.

Instead of upgrading javascript code, I made a few changes to the phonegap library so it would compile in iOS 7, then added new icons and splash screen files – and resubmitted the app.

One change was to alter the way that launch images get loaded during webView initialization, to prevent annoying white flashes. This version also does an extra load of the launch image – instead of just going to a black background while the webView is loading. If this ends up being too slow, then it may be better to go directly black background following initial launch image. See this post: http://stackoverflow.com/questions/2531621/iphone-uiwebview-inital-white-view

bugs

The native app runs only in portrait orientation. This is something the app has had problems with before. Something has changed in the process of detecting current orientation. Its likely to be a Phonegap issue as the Web app version works fine.

I may have a look at this  bug – and apply updates to the Blob app as well. But the real solution is to upgrade to current versions of the frameworks.

notes

This is more a documentation thing: If you don’t touch the canvas when the app starts, then there will be no sound unless you restart the app.

 

Stock market music in Max

Make music from the motion of stock prices.

This program gathers stock prices into a database. It generates Midi data – mapping price to pitch, and mapping trading volume to velocity and rhythmic density. It uses ancient Web technology: HTML/javascript front-end with a php back-end accessing a mysql database.

Case study: http://zproject.wikispaces.com/stock+market+music

To run this project, you will need a server (preferably linux) with the following capabilities:

  • mysql + phpmyadmin
  • php (and ability to run php over the web)
  • netcat (nc)
  • network access

All of this is pretty standard – so I won’t talk about it here. I am running it on Ubuntu Linux. There are many other ways to get the project working, by using the layout described here.

download

https://github.com/tkzic/internet-sensors

folder: stock-market

files

Max

stock_market_music.maxpat

HTML/javascript web client
  • newstock3.html: (web page interface)
  • selectstock3.js:  (front-end)
php server
  • getstock3.php (back-end server to get quotes and save them to a database)
  • play3.php: (back-end server to retrieve quotes, analyze, and map to Midi sequence to send to Max)
  • udp.php: Osc library
Set execute privileges on php files so they can be run from your web server. (chmod +x)

 

database

The selectstock3.php program harvests stock quote data and stores it in a mysql database.

The database name is:  stocks – table is: quotes

Table structure:

The table is basic flat representation of a stock quote, indexed by the ticker symbol. It contains price, volume, high/low/change, timestamp, etc., For our purposes, the price, volume and timestamp are essentially all we need.

SQL to create the table:

 CREATE  TABLE  `stocks`.`quotes` (  `ticker` varchar( 12  )  NOT  NULL ,
 `price` decimal( 10, 2  )  NOT  NULL ,
 `qtime` datetime NOT  NULL ,
 `pchange` decimal( 10, 2  )  NOT  NULL ,
 `popen` decimal( 10, 2  )  NOT  NULL ,
 `phigh` decimal( 10, 2  )  NOT  NULL ,
 `plow` decimal( 10, 2  )  NOT  NULL ,
 `volume` int( 11  )  NOT  NULL ,
 `ttime` timestamp NOT  NULL  DEFAULT CURRENT_TIMESTAMP ,
 `id` int( 11  )  NOT  NULL  AUTO_INCREMENT ,
 `spare` varchar( 30  )  DEFAULT NULL ,
 UNIQUE  KEY  `id` (  `id`  ) ,
 KEY  `ticker` (  `ticker`  )  ) ENGINE  =  MyISAM  DEFAULT CHARSET  = latin1 COMMENT  =  'stock quote transactions';

creating the database, user, and table

  • Log into  phpmyadmin as root
  • Create a new database called ‘stocks’
  • In privileges, add a user called: ‘webdb1′ with a password of ’34door’ (note you can change the password later)
  • In SQL, copy in the above query to create the ‘stocks’ table

Instructions

Web client

The webpage control program allows you to select stocks by ticker symbol, and get either one quote or get quotes at regular time interval. Each quote is inserted into the stock table for later retrieval and analysis.

 

The web front end is quirky so I will describe it in terms of how you might typically use it:

market is open – and you just want to play music based on current stock prices
  1. Enter the ticker symbols for your stocks
  2. Press ‘tracking’ button – so the quotes get saved
  3. Enter the IP address of the computer running Max
  4. Press the ‘auto’ button in the upper left corner – it will run and play forever
market is closed – or you want to play historical data you have saved
  1. Enter the ticker symbols for your stocks
  2. Enter the IP address of the computer running Max
  3. set start end end dates
  4. Press the ‘play’ button to play once or press ‘loop’ to play continuously (using time interval in seconds)
  5. market is open – you just want to collect stock quote data
  6. Enter the ticker symbols for your stocks
  7. Press the tracking button so quotes will get saved
  8. Press the ‘get quotes’ button to get current quote or press ‘loop’ button (on the same line) to retrieve quotes  continuously every 30 seconds.

Instructions

Max patch

  1. Make sure the IP address is set to the address of your server
  2. Select the Midi port for output
  3. Play a few test notes
  4. Select either ‘one instrument’ mode (piano) or multi instrument mode. Each time you click the multi instrument button it randomly selects a new combination 

notes on stock market data

To look at historical trends, you would need access to historical stock data. To use it as a tool for short term analysis, you would need access to real-time quote data in an API. At the time, both of these cost money.

However, it doesn’t cost money to get recent quotes from Yahoo throughout the day and store them in a database – so that’s the approach I took.

If I were to do this project today, I’d look for a free online source of historical data, in machine-readable form – because the historical data provides the most interesting and organic sounds when converted into music. The instant high speeding trading data would probably make interesting sounds as well, but you still need to pay for the data.

notes on local files

Web video streaming in Max

Stream realtime video from a web browser into Max or any program that uses Syphon.

CefWithSyphon (developed by Vibeke Bertelsen) launches a web browser and Syphon server. The Max patch operates a Syphon client that receives a video stream from the server and makes it available to Jitter objects.

 download

https://github.com/tkzic/max-projects

folder: web-video-streaming

patch: jit.gl.syphonclient.maxhelp

externals: 
  • jit.gl.syphonclient.mxo:

Note: externals are included with max-projects but can also be downloaded here: http://syphon.v002.info

other dependencies (app) 
  • CefWithSyphon.app

Download the CefWIthSyphon app from here:  https://github.com/vibber/CefWithSyphon – A Mac OS binary is available and has been tested with Mac OS 10.9.2

Instructions
  • Open the client example /jit.gl.syphonclient.maxhelp in  Max
  • Run the CefWithSyphon app. It will launch a browser
  • The browser content should now stream to the clientcontext window in Max 
  • If not streaming, click the “getavailableservers” message and select the correct server/client from menu objects outlined in red

 

developing iOS apps with javascript and phonegap

Just worked through the first example in a tutorial: http://coenraets.org/blog/phonegap-tutorial/

by Christopher Coenraets.

How to develop using phonegap.build https://build.phonegap.com/

  • Write a javascript web app.
  • Submit to github or zip the folder
  • Upload to phonegap.build
  • Compile (for iOS you need to have previously submitted developer certificates)
  • After compiling, scan a QR code (in the browser) using your mobile device. This installs the app

Don’t yet know the steps to getting it in the app store, but this is amazing.