I’ve been playing a little with Facebook API and I run into problems when trying to use the facebook.feed.publishStoryToUser
api call. That call always return 0 (permissions error) for me. I realized that there’s a difference between “Added applications” and “Authorized applications”. So if you just direct the user to the login page (http://www.facebook.com/login.php?api_key=YOUR_API_KEY&v=1.0
) from you application your app will end up in the Authorized Applications side. You have to direct the users to your application page in facebook first (http://www.facebook.com/apps/application.php?id=xxxxxxxx&ref=s
).
After spending a bunch of time with the graphviz utilities (neato, dot, circo and twopi) trying to create a graph to understand the software dependencies between modules in a project I’ve been I assigned I realized that those tools don’t work well with large graphs. I tried and tried with no luck, I thought that the old linux kernel map poster used graphviz to create the poster but after googling a bit and reading the code for the FCGP project I found that they write PostScript directly. I was looking for something simpler.
I’ve run into a very strange problem.
Every time I run setup.exe and try to upgrade bash package

setup.exe crashes with the familiar “setup.exe has generated errors and will be close by windows. you will need to restart the program. An error log is being created”. The solution I found is for bash package but I guess it also work for other packages as well

After googling a bit I found the this mail thread . But there was no solution posted into the thread so I tried to contact the Mario Frasca (one of the participants in the mail thread) to see if he found any solution to the problem. Well, he did. He sent me a mail telling me that William Crosmun resolved his problem.
It’s not easy to get information on derby keys once you created them. I was looking for a command like “SHOW CREATE TABLE ” but no luck. I realized that the answer should lay in SYS tables. After googling a while I found the following bit of wisdom:
The following query will give you the UNIQUE constraints on a table:
select c.constraintname, c.constraintid
from sys.systables t, sys.sysconstraints c
where t.tablename = ‘FOO’
and t.tableid = c.tableid
and c.type = ‘U’;
One way to pass parameters to you Axis2 service:
- write a tag inside your services.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file was auto-generated from WSDL -->
<!-- by the Apache Axis2 version: 1.3 Built on : Aug 10, 2007 (04:45:47 LKT) -->
<serviceGroup>
<service name="xxxxxxx" class="MyServiceLifeCycleImpl">
....
<parameter name="jdbcConnectionString">jdbc:derby:c:/demoderby2b;create=true;user=a;password=b;</parameter>
<parameter name="jdbcDriver">org.apache.derby.jdbc.EmbeddedDriver</parameter>
...
</service>
</serviceGroup>
- Write a ServiceLifeCycle class
public class MyServiceLifeCycleImpl implements ServiceLifeCycle {
private Log log = LogFactory.getLog(MyServiceLifeCycleImpl.class);
public void startUp(ConfigurationContext confCtx, AxisService axisService) {
try {
String jdbcConnectionString = (String) axisService.getParameterValue("jdbcConnectionString");
String jdbcDriver = (String) axisService.getParameterValue("jdbcDriver");
Class.forName(jdbcDriver).newInstance();
Connection connection = DriverManager
.getConnection(jdbcConnectionString);
axisService.addParameter("jdbcConnection", connection);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
....
- Add init method to your service
....
private ServiceContext serviceContext;
public void init(ServiceContext serviceContext) {
this.serviceContext = serviceContext;
}
....
- Access the parameter jdbcConnection from your service through serviceContext
....
Connection conn = (Connection) serviceContext.getAxisService()
.getParameterValue("jdbcConnection");
....
I just realized that to be able to open/share the same Derby database from two different web applications running in the same Tomcat instance (same JVM) you’ll need to put derby.jar in the $TOMCAT_HOME/common/lib and remove it from your applications WEB-INF/lib. I got the clue from this RIFE web page
the jarfiles you need are derby.jar and derbytools.jar . Due to classloader peculiarities, don’t copy them to your application’s web/WEB-INF/lib/ subdirectory, or to Tomcat’s shared/lib/ directory. Tomcat’s common/lib/ directory works, and probably common/endorsed/ does too.
I’ve been trying to use XStream to generate JSON to be consumed by Dojo. But I can’t find the way to generate the right JSON from XStream, it keeps adding extraneous {} around. I even tried this but no luck . For example I want to generate this JSON output (taken from Dojo FilteringSelect example) :
{"identifier":"abbreviation",
"items": [
{"name":"Alaska", "label":"Alaska","abbreviation":"AK"},
{"name":"Wyoming", "label":"Wyoming","abbreviation":"WY"}
]}
My attempt usign XStream:
package com.rubenlaguna.json;
import java.util.ArrayList;
import java.util.Collection;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver;
class ItemCollection {
public String identifier;
public Collection<Item> items = new ArrayList<Item>();
public ItemCollection(String identifier) {
this.identifier = identifier;
}
public boolean add(Item arg0) {
return items.add(arg0);
}
}
class Item {
public String name;
public String label;
public String abbreviation;
public Item(String name, String label, String abbreviation) {
this.name = name;
this.label = label;
this.abbreviation = abbreviation;
}
}
public class WriteXStreamDojoTest {
public static void main(String[] args) {
ItemCollection itemCollection = new ItemCollection("abbreviation");
itemCollection.add(new Item("Alaska","Alaska","AK"));
itemCollection.add(new Item("Wyoming","Wyoming","WY"));
XStream xstream = new XStream(new JettisonMappedXmlDriver());
String erroneousJsonStr = xstream.toXML(itemCollection);
System.out.println(erroneousJsonStr);
}
}
resulted in the following JSON Output (i added some space and breaklines for readability):
If your are getting “bash: clear: command not found” on you first install of cygwin you have to make sure that you include ncurses packages in your cygwin installation. clear.exe doesn’t come in the standard installation. You must include ncurses to get clear.exe in your system. If you are using bash you can use Ctrl-L and get the same result though.
UPDATE: ncurses is a cygwin package in libs category in Utils category. You can install it using the the Cygwin Setup utility (just run setup.exe again). See screenshot below
I’ve submitted a patch (Attachment #77777 and a couple of screenshots ( Attachment #77774 y Attachment #77776) to Bug #201116. It’s only a preliminary work but it enables the user to select with contentMergeViewer to use with each FileType/ContentType. Now it’s only useful if you use my java formatting compare plugin. Currently the org.eclipse.compare subsystem will allow only one contentMergeViewer per fileType or contentType and you cannot tell which one it will be as Szymon Brandys comments. With this patch the user can select/switch which one he wants to use among all viewer registered for a given file extension/content type.
If you tried (like me) to redirect your / (root) web directory to a subfolder (like /wp/) modifying .htaccess in this way:
Redirect 301 / http://rubenlaguna.com/wp/
You probably found that it didn’t work. The browser will end up in an endless loop of redirections. Firefox will complain with this error message:
The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
This problem can sometimes be caused by disabling or refusing to accept cookies.
The right way to accomplish the root to subfolder redirection is the following: