Archive for July, 2009

Eclipse Galileo and Flex Builder Plugin

Thursday, July 23rd, 2009

If you are a Java and Flex developer, and like me have gotten used to working with Eclipse and the Flex Builder Plugin. If you are having problems installing the Flex Builder Plugin for Galileo, I will try to explain how I got it working.

Here is how to install the Flex Builder Plugin in Eclipse Galileo:

  • Download galileo. Or use the zip file, I recommend you try it on a new eclipse folder first, before doing it on the galileo/eclipse you are currently using.
  • Create a links folder underneath the expanded galileo folder. See image for folder structure.
  • In the links folder create a text file, the name should be:
  • com.adobe.flexbuilder.feature.core.link
  • In the file put the following contents, change the path to your specific environment (I put the default here):
  • path=C:/Program Files/Adobe/Flex Builder 3 Plug-in

I hope it works for you too.

Topics request to un-suspend twitter accounts

Wednesday, July 22nd, 2009

Yesterday some accounts which I had just recently added to Topics were suspended by Twitter. This was the type of emails that I received from Twitter.

Your account has been suspended due to a violation of our Terms of Service.

Account suspended: aussies_
Date of violation: July 20, 2009
Serial and/or multiple account creation without authorization is a violation of our terms of service; as a result, all of the accounts created have been suspended pending more information being provided.

If you would like to contest this suspension, please open a ticket with the following information: a) a list of the accounts that you would like to petition to have reinstated and b) your planned use for the accounts. Please be aware that clearly overlapping names and use cases are not generally approved for reinstatement.

For more information, please see our Terms of Service and Twitter Rules. Please be advised, tickets are answered in the order they are received. Submitting multiple tickets will cause your ticket to be moved to the end of the queue.

Twitter Support

Please do not reply to this message; it was sent from an unmonitored email address. This message is a service email related to your use of Twitter. For general inquiries or to request support with your Twitter account, please visit us at Twitter Support.

So I created a ticket with this message:

Dear Twitter:

I would like to start by introducing myself, my name is Cesar Arevalo, am a software engineer and love twitter. Now let me congratulate you guys for the great service that you have.

I am writing to you because I would like you to re-evaluate your decision to suspend some accounts which I created. I have read the Terms of Service and Twitter Rules, and I believe I have a chance. Before I list the accounts, which I will do at the end of the message, I would like to talk about the application that I am creating.

The application that I am developing, originally started because I wanted to play with the Twitter API and my need to keep on top of opensource news. Because I am reading my twitter feed all the time, I had the idea that I would like to follow an account that sent links about new posts of open source blogs, that is how my first account @opencode (http://twitter.com/opencode) was born.

After a while of @opencode being live I noticed that many people liked the idea, people started following it. So I added more relevant blogs and improved the twitter feed as a whole (status update timing, etc.). Then I realized that, maybe, other people would be interested in other topics. So I created Topics (http://www.arevalos.org/topics), which I describe as:

"Topics is a catalog of twitter accounts, each of which send status updates specific to their topic. The content of the status updates are the title and a link, read from blogs specific to the topic of the account."

Now some points about my application:

- Twitter-ers are following the accounts. They seem to like the idea. Right now in all of topics I have nearly 2000 followers.
- It is done in my free time. I like to learn about the twitter API and try out new programming techniques.
- It does not spam. The status updates are coming from blogs that are specific to the topic of the account.
- It does not advertise.
- It does not pro-actively look for followers. All the accounts have followers which have found the accounts they are following.
- It is non-profit.
- It does not send messages of any kind to other Twitter-ers.

After all this said, the reasons that I am writing this are:

- I belive that am doing Twitter-ers a good because they get to read news about the topics they care.
- People like the accounts, that's why they follow them.
- I believe my application does not harm its followers.
- I would like to continue working on the application because I enjoy doing it.
- I would be more than happy to change my application so it is appropriate to your terms.

I hope you are still reading. The accounts which were suspended are:

aussies_
astronomy_
autism_
_asthma
assn_mgmt
audio_
australia_
asian_food_
audi_
statesman_
astrology_
atheism_

If you still think that I do not have a case and decide to confirm the suspension of the accounts, I would be more than happy to provide the usernames of the rest of the accounts which I created for the application so you also suspend those. The reason being that I would not like to be doing something you do not think is righ.

I appreciate your time. Kudos for your great service.

Best Regards,
Cesar Arevalo
@cesararevalo

http://www.arevalos.org/topics

The help desk support has replied with an automated email, which is more in the same lines as the first email. I am still hopeful that Twitter will un-suspend my accounts.

UPDATE: Today I realized the ticket was deemed solved by twitter staff delbius. However it was not specified any resolution on the ticket, I didn’t receive any comments or anything. So I reopened the ticket and asked for a status or explanation.


Hello delbius!

Would you mind letting me know what was the resolution? It says that it was deemed solved, but I don't see any status or explanation.

Thanks,
Cesar

I hope to get an answer this time.

Dojo Fisheye Strus2 Ajax

Sunday, July 19th, 2009

Today I want to talk about a change in the design of the Topics application. About a week ago I was looking at changing the front page and wanted a way to list the topics alphabetically.

So I thought that it might be nice to implement the same effect as Dojo’s fisheye for the front page. My idea was to put the fisheye in the front page of Topics, the fisheye would display the letters of the alphabet. So when a user clicked on a letter a list of topics which initialize with that letter would show underneath.

I will try to walk you through the steps I did to get things working. An overview of what I did is:

  1. Downloaded Dojo + Dijit + DojoX
  2. Included some of the downloaded scripts and styles.
  3. Created images for each letter in the alphabet. Placed them in the relative path “/topics/images/”. The image file name had the form letter_<lettter>.png ie. letter_a.png
  4. Added the html code for the fisheye to display.
  5. Added event handlers for the fisheye elements to make ajax requests on user clicks.
  6. Created a jsp that would serve as the Ajax response.
  7. Created an action that would handle the Ajax request.

The included scripts and files were:

<link rel="stylesheet" href="styles/fisheye.css">
<script type="text/javascript" src="scripts/dojo/dojo.js"></script>
<script type="text/javascript" src="scripts/src.js"></script>

The files src.js has the following content:

/*
	Copyright (c) 2004-2009, The Dojo Foundation All Rights Reserved.
	Available via Academic Free License &gt;= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/

dojo.require("dojox.widget.FisheyeList");
dojo.require("dojo.parser");
dojo.addOnLoad(function(){dojo.parser.parse();});
function load_app(id){alert("icon "+id+" was clicked");};

The code to get fisheye showing was the following:

	<div class="descr outerbar">
		<div dojoType="dojox.widget.FisheyeList"
			itemWidth="17" itemHeight="35"
			itemMaxWidth="50" itemMaxHeight="80"
			orientation="horizontal"
			effectUnits="1"
			itemPadding="10"
			attachEdge="top"
			labelEdge="center"
			id="fisheye1"
		>

			<s:iterator value="characters" var="ch">
				<div dojoType="dojox.widget.FisheyeListItem"
					id="alpha_<s:property value="ch"/>"
					label="<s:property value="ch"/>"
					class="watermarkForAjax"
					iconSrc="/topics/images/letter_<s:property value="ch"/>.png">
				</div>
			</s:iterator>

		</div>
	</div>

	<div id="ajaxContainer" class="box">
	    <div id="ajaxContent"></div>
	</div>

Notice the div container with id “ajaxContainer”. On load the div will be empty. But when the user clicks on one of the letters in the fisheye it will get populated with content.

Next was adding the events to the fisheye elements to make the ajax request and handle the response, after a user clicks on a letter. The code to do this was:

<script type="text/javascript">
	dojo.addOnLoad(function() {
		dojo.query(".watermarkForAjax").connect("onclick", function(e) {
			var node = this;
			init(node.id.substr(6));
		});
	});

	var init = function(alpha) {
		var contentNode = dojo.byId("ajaxContent");
		dojo.xhrGet( {
			url : "alpha.html?alpha=" + alpha,
			handleAs : "text",
			load : function(data, args) {
				// fade out the node we're modifying
			dojo.fadeOut( {
				node : contentNode,
				onEnd : function() {
					// set the data, fade it back in
				contentNode.innerHTML = data;
				dojo.fadeIn( {
					node : contentNode
				}).play();
			}
			}).play();
		},
		// if any error occurs, it goes here:
			error : function(error, args) {
				console.warn("error!", error);
			}
		});
	};
</script>

Now in struts I had an action defined as follows:

		<action name="alpha" class="welcomeAction" method="alpha">
			<result type="tiles">.alpha</result>
		</action>

As you will notice I am using tiles, at the end it was a jsp that all it did was iterate over a list:

<div class="descr">
	<ul>
		<s:iterator value="accountList">
			<s:url value="/twitter/%{username}.html" var="urlValue"/>
			<li><a href="<s:property value="urlValue" />"><s:property value="%{preffix}" /> (@<s:property value="%{username}" />)</a></li>
		</s:iterator>
	</ul>
</div>

I think those were the major steps. I am mostly writing this so I don’t forget myself. Because right after I had made the change I decided that I was going to remove it. It was not going to work well with SEO because of the ajax requests. I want the pages in my site indexed by search engines, because they are all public. For internal pages though I might use this concept later.

Java Twitter Update Profile Information

Friday, July 10th, 2009

I am developing a Twitter Topics application, a catalog of twitter accounts about specific topics, that manages around 20 twitter accounts. And because I will be adding accounts constantly it became clear to me that I needed to find a way to update the profiles through the app itself.

So I searched around and the twitter api actually does let you update the profile information.

The topics application is written in java. And uses the library provided by java-twitter to communicate with the Twitter API. Fortunately the update profile methods are implemented by the library so I used them.

In order to use the java-twitter library to update profiles you need code similar to the following:

String username = "YourUsernameHere";
String password = "yourPasswordHere";

Api api = Api.builder().username(username).password(password).build();
api.updateProfile()
	.description("Description_Replace")
	.url("URL_Replace").build().post();

So what I did was wrap that code in a method, called the method from inside a loop that iterates over all of my accouns, and there you go. I can update all of the accounts from the application now. I wrote a web interface for sending the updates, so whenever I want I can just click a button that sends the updates.

The prettifier I use in my blog

Wednesday, July 1st, 2009

When I posted Struts 2 ActionMapper Implementation I noticed that the code snippets that I had embedded were just not showing very nicely. So I decided it was time for a change, it was time to revamp the code snippets.

So I googled and found google-code-prettify, and though it greatly increased the look of the snippets, I continued to look around, I thought there might be something better. And I found something, I am a reader of Matt Raible’s blog so I decided to take a look at what he was using in his blog.

Looking through his blog I saw the snippets of code and they literally looked awesome, I poked around in the source of the pages and notices he was using syntaxhighlighter. So I decided to use that since it is prettier than the google-code-prettify.