I'm currently working on a tool that looks up related topics with the Wikipedia API.
The idea:
Search for one topic to get back related topics. Then these related topics should also be used in a new search. These words should also send back their related topics.
The next code does only the first part (getting all the results for one keyword):
This code should get the result of the first word, and then uses the results to search again, so every result of the first search should be a keyword to get results from.
For the last weeks, I've been experimenting with visualizing geographical events like sunshine, temperature and earthquakes.
Just finished a video of a tool I wrote to visualize all the earthquakes through the years in 3d, using only color and height to show the magnitude of the earthquakes. The lined square represents the earth surface.
Hope you will enjoy the results in the shape of a
video and images.
Today I wanted to export my GPS reader to JAVASCRIPT + HTML, for placing it online. When I export to HTML with 2.0 stable version, the html doesn't load the sketch.
I know it has something to do with: "
locationTable = new Table("gps.csv");", but I cannot load the csv before the setup.
But I don't know where to start. Because after drawing one year/slice, the next one needs to be drawn as well as the walls of the shape. Can someone help me by showing an example?
Now I want to use the particles, as shown in example, to have the speed based on the getWindSpeed() function. If the windspeed is 20.19, I would like to have to move the particles 20.19/4 in the right direction, already given in the code
import com.onformative.yahooweather.*;
YahooWeather weather;
YahooWeather weather2;
int updateIntervallMillis = 90000;
PVector[] windParticles = new PVector[200];
PVector[] windParticles2 = new PVector[200];
void setup() {
size(400, 400);
// BERLIJN weather = new YahooWeather(this, 638242, "c", updateIntervallMillis);
// AMSTERDAM
weather = new YahooWeather(this, 727232, "c", updateIntervallMillis);
weather2 = new YahooWeather(this, 638242, "c", updateIntervallMillis);
for (int i=0; i<windParticles.length; i++) {
windParticles[i] = new PVector(random(0, width/2), random(height));
}
for (int i=0; i<windParticles2.length; i++) {
windParticles2[i] = new PVector(random(width/2, width), random(height));
I'm trying to make a rotating hexagon with text on every corner. The text should be rotated so that it looks like the text are connected to the centre. I'll visualise it in the next picture:
The code I have now draws the text, but I really don't now how to rote the words as shown above. I've been trying RotateZ with push and popmatrix, but this doesn't work out the way it needs.
String tekst = "Boston Bomber"; String bronnen = "Source";
int een, twee, drie, vier, vijf, zes;
String input;
import processing.opengl.*;
PFont font; int hoekje; int getal = 2;
boolean hoek = false; PGraphics pg;
void setup() {
size(1300, 800, OPENGL); fill(100);
pg = createGraphics(width, 100); font = createFont("Arial", 300);
I'm currently making a sketch to draw your own galaxy's and connect the planets and stars. I was able to hack together the next sketch that draws what I have in mind;
ArrayList<CircleSet> allCircles; // holds all circleSets int maxDistance = 100; //max distance between circles when drawing lines
void setup() { size(1024, 768); //size of window smooth(); //draw circles with anti-aliased edge
allCircles = new ArrayList<CircleSet>(); }
void mousePressed() {
allCircles.add(new CircleSet()); }
void draw() { background(0, 0, 25);
if (allCircles.size()>3) { allCircles.remove(0); } // update all circleSets for (int i=0; i< allCircles.size(); i++) { allCircles.get(i).update(); } // display all circleSets for (int i=0; i< allCircles.size(); i++) { allCircles.get(i).display(); } }
class CircleSet { ArrayList<Circle> circles;
CircleSet() { circles = new ArrayList<Circle>(); createCircles(); }
void createCircles() { int[] colors = new color[5];
I have put together a script that loads a textfile, trims the words, scans the words for specific information, and then let the Minim library speak out the words via Google Speech (last part is taken from an example that I found on this forum).
The problem is that I want to load the new word when the playing of the MP3 file is done, to play the next MP3 (of the new word) right after ending the MP3 that was playing before. Not before that, which is now the case.
Who can help me with this? I've been trying to fix it for the last days, but I cannot seem to find the right sollution.
I would be forever grateful.
Code I have now:
boolean kollom1 = true; boolean kollom2 = false;
import ddf.minim.*; AudioPlayer player; Minim minim; String s = "";
I want this part only to occur when the previous file is done playing, but I cannot seem to get it right. Been allready testing by using -- if (player.isPlaying()), -- and put the code inside this if statement, but that doesn't work. Does anybody knows a good solution for this? Would be great If someone could give me a tip.
I'm working on a code that scans a text for specific words and give the block behind the word a specific color.
example of how I do this:
if ("het".equals(theword) == true) {
fill(0, 150, 0);
}
if ("de".equals(theword) == true) {
fill(0, 150, 0);
}
if ("een".equals(theword) == true) {
fill(0, 150, 0);
}
if ("aan".equals(theword) == true) {
fill(200, 0, 0);
}
It seems a bit weird to call the code for "de"+"het"+"een" 3 times, since the results have to be the same. Is it posible to have a list of these words: list = de, het, een, and then check the whole list at once?
When yplaats is over height-100, I would like to clear the tekstlaag. The only methods I can think of are tekstlaag.background(0) and calling the tekstlaag again by using:
Is there a good way to just clear the layer without starting all over? When I use background, the whole layer just fills itself with the (0)=black color, while I just want a cleared layer.
I gave 2.0a8 a go today, to see if it's working properly with my projects I'm currently working on with 2.0a5. I get this weird message when I try to load an XML this way:
xml = new XML(this, "http://www.witregel.nl/scraper/getall.php?keyword[]="+woorden);
The console says:
Unhandled exception type IOException. Not sure what this means. Bug?
I have a problem with a few null pointer exceptions, comming from XML requests that should not give null pointer exceptions. When I check the data via a browser, there seems to be no problem.
If I change the line:
xml = new XML(this, "http://www.witregel.nl/scraper/getall.php?keyword[]=&keyword[]=assad");
to
xml = new XML(this, "http://www.witregel.nl/scraper/getall.php?keyword[]=&keyword[]=parijs");
I get a null pointer exception. When I check the link via my webbrowser, I can't find any reason to get an error. It all looks good. Do I miss something?
Thanks in advance for the tips.
Here's the code:
String woorden = " ";
boolean aan = false;
int startcount;
XML[] urls; XML[] bron; XML[] artikelen;
int scroll;
String[] wordsArray; int numLines = 0; float textHeight;
String artikel;
XML xml;
int i; PFont font;
int fontSize = 10; int specificWidth = 700-40; int lineSpacing = 5;
void setup() {
size(1300, 800); font = createFont("Arial", fontSize); textFont(font, fontSize); }
void draw() { background(255);
xml = new XML(this, "http://www.witregel.nl/scraper/getall.php?keyword[]=&keyword[]=assad");
//xml = new XML(this, "http://www.witregel.nl/scraper/getall.php?keyword[]=&keyword[]=parijs");
int textboxhoogte(String string, int specificWidth, int fontSize, int lineSpacing) { String[] wordsArray; String tempString = ""; int numLines = 0; float textHeight;
I am currently seeking for methods to visualise a list of keywords I obtained from my webserver. The example I used is from Toxiclibs. I changed some stuff, but I don't know how to delete the "WordLengthComparator" and the "FrequencyComparator". The list I use is allready alphabetical, so I just want the list to be unmodified.
Here's my code:
// start
boolean aan = false;
PFont font;
import toxi.util.*;
import toxi.math.*;
List<HistogramWord> uniqueWords;
ZoomLensInterpolation zoomLens = new ZoomLensInterpolation();
float smoothStep=0.12;
int gap=30;
int labelGap=0;
int wordLimit=1900;
HistogramSorter sortFunction;
void setup() {
size(680, 800);
font = createFont("Arial", 40);
textFont(font, 40);
for (int i=0; i<maxWords; i++) {
float relativePos=(float)i/maxWords;
HistogramWord w=uniqueWords.get(i);
float barHeight=sortFunction.getMetric(w)*normFactor;
int x=(int)zoomLens.interpolate(gap, width-gap, relativePos);
int x2=(int)zoomLens.interpolate(gap, width-gap, (float)(i+1)/maxWords);
int barWidth=max(x2-x-1, 1);
int barCenter=(x+x2)/2;
if (abs(barCenter-focalX)<=barWidth/2) {
fill(0, 0, 255);
// println(w.word);
if (aan == true) {
println("GO"+w.word);
}
font = createFont("Arial", fontSize); textFont(font, fontSize); noLoop(); }
void draw() { String string = "This is where the article that is recieved from the XML should apear. It should automaticly get the right height to fit the text. After this, the next article should be drawn under this textframe";
int textboxhoogte(String string, int specificWidth, int fontSize, int lineSpacing) { String[] wordsArray; String tempString = ""; int numLines = 0; float textHeight;
Now I have the next code for loading news articles from my server:
import simpleML.*;
XMLRequest xmlRequest; XMLRequest keywords;
void setup() { size(200, 200);
keywords = new XMLRequest(this, "http://robotfunk.com/temp/getall.php" ); keywords.makeRequest();
xmlRequest = new XMLRequest(this, "http://robotfunk.com/temp/getall.php?keyword[]=&keyword[]=Amsterdam" ); xmlRequest.makeRequest(); }
void draw() { noLoop(); // Nothing to see here }
// When the request is complete void netEvent(XMLRequest ml) {
// Retrieving an array of all XML elements inside" title* "tags String[] headlines = ml.getElementArray( "artikel"); String[] datum = ml.getElementArray( "datum"); String[] keyword = ml.getElementArray( "keywords");
for (int i = 0; i < headlines.length; i++ ) { println(headlines[i]); println(datum[i]); }
What I want is to draw the found articles like the first sketch.
What I did is combine the text with getting articles:
void netEvent(XMLRequest ml) {
// Retrieving an array of all XML elements inside" title* "tags
String[] headlines = ml.getElementArray( "artikel");
String[] datum = ml.getElementArray( "datum");
String[] keyword = ml.getElementArray( "keywords");
for (int i = 0; i < headlines.length; i++ ) {
println(headlines[i]);
println(datum[i]);
I am making a blob detection sketch using the wonderfull OPENCV library. What I want now, is to label each blob with a number. How can I add this label?
I wanted to experiment with images and rastering images in Processing. What I do is make 4 png files from a CMYK image. I seperate the C, M, Y, K to 4 files. Each file has one color (cyan, magenta, yellow, black).
I load these grayscale files into the processing skechts, that reads the color value for each pixel. I export these renderings to PDF. Later, I bring 4 PDF files together in Indesign and blend the layers.
Hope you guys like the results.
I am still looking for ways to load CMYK images in Processing and read the CMYK values. This seems to be almost imposible. This is why I solved it with seperated color files.
Looking through the old forum I found many posts where people ask for help with CMYK in Processing. There are some tricks to convert colors, but there is still no good way to open a CMYK jpeg and then read the CMYK values, for instance.
Nodebox is able to read and write CMYK files. I sometimes use this software just because I need to make good CMYK documents. Since I use Processing for generating printed matter, and I know other people do as well, it will be a good thing to have this function in Processing.
I hope we can start a discussion that will lead to a solution.
I am trying to visualise actual data. I have made a moving graph, like a heart monitor. What would be the best way to add more values in order to make more graphs? Maybe I can make a class for it, or can I do this more simple?
I am currnetly working with an example of interpolating curves for making typedesigns.
The problem is that the example doesn't use beziercurve shape, but little lines that make the curve. How can I use what I have now to make a bezier path?