I have created my first application in Processing, which visualizes real-time data from Twitter. I am thankful to everyone in this forum who helped me a lot in learning this programming language.
Hi, I have a few controls on my sketch. I didn't change any code in gui.pde (except places where editing is allowed). However, now when I try to open GUI Builder, it gives me this error:
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1331)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1969)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1893)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1775)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1327)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:349)
and so on......
When I try in a new sketch, the GUI builder works.
I searched on the forum for the same problem, but couldn't find a solution.
What could be wrong in here?
**update: if I add an options group, and then add Option controls, I don't get any error.
BUT, if I add an options group, and click on the options group (just to rename or simply click on it) and then add the option controls, it gives error. I am surprised, I didn't even change anything. Only clicking on the OptionsGroup creates this problem?
I would like to compare keywords of various strings and then assign similarity score to each string. This score shall then be used to create clusters of these strings.
Does anyone have any idea on how to implement this? My approach may be wrong.
I will be glad if someone could help.
In my sketch, I haven't set up any new font. It uses the default Sans Serif font (if I am not mistaken). But when it comes to Japanese or Arabic, it just gives empty blocks. I am trying to upload a screenshot, but it doesn't work here. Please follow this
link to see the screenshot.
I will really appreciate to read your responses on this.
I am using the following code in a function that is called in Draw() method, but in each frame, the cursor is blinking. I just want the cursor to be HAND when it is in the area of the rectangle below:
I have got a lot of functions and classes in my application. When I exported it to Mac and Windows, everything works except one user-defined function. I don't really understand why? It works just fine in Processing IDE.
When this function is called, the entire sketch becomes to a halt. It looks like noLoop() is called. But there isn't any function that would stop execution of the code.
I know it would be sensible to post the code here, but believe me it is a very big application. I am afraid I cannot share it at this time.
I would love to hear the common problems in such cases and how to fix them. I would be glad to provide more information if needed.
I am using Wordcram to create tag clouds based on text from many different languages. It works fine for almost every language, but when it comes to Arabic, it displays broken words - letters are shown from left to right. Whereas, the letters should be placed from right to left.
I am accessing TagDef API. A sample piece of code is:
String[] s = loadStrings("http://api.tagdef.com/one.FollowMeKendall.json");
println(s);
But when the URL is not accessible, it gives me errors. But I don't have any other choice, I have to submit requests even if the URLs are not valid. I just want this code to stop giving me errors like below:
null
The file "http://api.tagdef.com/one.FollowMeKendall.json" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
even when I use if(s!=null) , the error is still thrown.
I would like to call draw() of wordcram in the main draw() method of my sketch. But the problem is that wordcram is drawn only once and disappears after being drawn. If I call noLoope() right after calling wordcram's draw() method, then the entire program stops, but wordcram remains there.
As the reference says, code inside mousePressed block is executed only once if it is in Draw, but I see it driven by frameRate. The higher the frame rate, the more the times it is being executed. Please look into the example below:
void setup() {
}
void draw() {
println("...");
if (mousePressed) {
println("mouse is pressed");
}
}
Its result (just after clicking mouse only ONCE!):
...
...
...
mouse is pressed
...
mouse is pressed
...
mouse is pressed
...
mouse is pressed
...
...
...
...
I want to call twitter search API inside Draw() but apparently I want the code to be executed only once when a user clicks. Otherwise, the method will hit rate limits of the API.
Below is the actual code I am using in Draw() method, but everytime I get Rate Limit hits from Twitter:
if (mousePressed) {
//country selection
int px = constrain(mouseX, 0, width);
int py = constrain(mouseY, 0, height);
int v = mapImage.pixels[py*mapImage.width + px];
v = int(red(v) / 2);
v = (int) constrain(v, 0, countries.length-1);
lastselection = countries[v] + "";
//country selection ends here
//chooseing country and returning woeid of the location
for (int j = 0; j<trendingLocations.size();j++) {
if (lastselection.equals(trendingLocations.get(j))==true) {
I have a lot of code that retrieves streaming statuses from Twitter, does search, retrieves trends, and a lot more. Each one is wrapped in class and has methods to be called. However, all of these have to be manipulated with mouse clicks. for example, if user clicks somewhere on a worldmap (on homescreen), he should see another window that shows search results. But if the user clicks on a particular button on the screen, he should be able to see a completely different window with its own controls (like mouse events).
But now everything is manipulated only by draw method, and I have to use a lot of if statements and flags to control everything. Yet, I fail somehow.
I am going through the methods in Status of Twitter4j. When I try to retrieve favorites count for a tweet, it gives an error that this function does not exist. I googled it as well, no one reported it until now. Is it me who is making any mistake or it doesn't exist at all?
I am using twitter4j and I have already implemented the Search. Now I can retrieve only 100 results, how can I add pagination to retrieve more than this?
I use the following code:
try{
QueryResult result = twitterSearch.search(new Query().geoCode(new GeoLocation(lat,lon), res, resUnit).query(queryString).count(100));
I am using code from Till Nagel to project a world map and then plot data based on lat and lon coordinates. But now I would to retrieve lat and lon coordinates of mouse position. By giving mouseX and mouseY, it should return longitude and latitude on the map. Can someone please help? Below is the code that I use:
/**
* Utility class to convert between geo-locations and Cartesian screen coordinates.
* Can be used with a bounding box defining the map section.
*
* (c) 2011 Till Nagel, tillnagel.com
*/
public class MercatorMap {
public static final float DEFAULT_TOP_LATITUDE = 80;
public static final float DEFAULT_BOTTOM_LATITUDE = -80;
public static final float DEFAULT_LEFT_LONGITUDE = -180;
public static final float DEFAULT_RIGHT_LONGITUDE = 180;
/** Horizontal dimension of this map, in pixels. */
protected float mapScreenWidth;
/** Vertical dimension of this map, in pixels. */
protected float mapScreenHeight;
/** Northern border of this map, in degrees. */
protected float topLatitude;
/** Southern border of this map, in degrees. */
protected float bottomLatitude;
/** Western border of this map, in degrees. */
protected float leftLongitude;
/** Eastern border of this map, in degrees. */
protected float rightLongitude;
private float topLatitudeRelative;
private float bottomLatitudeRelative;
private float leftLongitudeRadians;
private float rightLongitudeRadians;
public MercatorMap(float mapScreenWidth, float mapScreenHeight) {
I am using twitter4j to retrieve streaming tweets and I need to detect language of each tweet. Twitter has added an attribute 'lang' to its tweets, but twitter4j hasn't implemented it yet.
Is there any other way to detect a tweet's language?
I am trying to read json from a URL, but when the link is not found, the sketch prints errors (though the program is not interrupted). How can I check if the URL is accessible or not? I am using the following code, but it doesn't work:
I created the file "twitter4j.properties" and placed it inside the sketch folder where my sketch accesses Twitter. But still the authentication doesn't work.
I am displaying tweets on a static map. The tweets are plotted over time on the map, so I don't set any background color in the Draw() method. Otherwise it will refresh the screen and plotted points will disappear.
However, I want to move a small circle from one location to another (based on plotted tweets) without drawing a line. Is there anyway to do so without setting background in the Draw()?
I am using the following code to store keywords and coordinates for tracking locations and keywords in the Filter of Streaming API via twitter4j but it seems like the keywords are not taken into consideration. Twitter gives all the tweets (based on location).
I have been consuming the Streaming API via twitter4j (using a filter to retrieve only geo-tagged tweets), but when I try to determine the retweet count for each tweet, it always returns 0. Is there any solution to this?