I’ve found this great GraphML reader and writer library: Blueprints. There is also a good documentation on how to use the GraphML library for reading XML-encoded graphs. Anyway, I think my example is better. …weiterlesen![]()
Last time I declared this Maven dependency in my pom.xml:
<dependency> <groupId>com.tinkerpop.blueprints</groupId> <artifactId>blueprints-core</artifactId> <version>1.2</version> </dependency>
I then requested the download of this dependency and got blueprints-core-1.2.jar. But where has this dependency been saved? I then found out that the dependencies are saved to the user’s Maven home directory (e.g. C:\Users\bennyn\.m2).
Finally I found the file here:
C:\Users\bennyn\.m2\repository\com\tinkerpop\blueprints\blueprints-core\1.2\blueprints-core-1.2.jar
You can also specify the location yourself. To do that, you just have to change the Maven local repository in the settings.xml:
<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <localRepository>C:\dev\temp</localRepository> ... </settings>
If you want to set your NetBeans Editior formatting preferences to default, then just go to your NetBeans user directory (e.g. C:\Users\bennyn\.netbeans) and delete all files you can find in the “Editors” folder (e.g. C:\Users\bennyn\.netbeans\7.1\config\Editors). Your settings will be then reset.
To work with the Facebook API you have to load the Facebook JavaScript SDK, initialize your Facebook application, authenticate the user and request an access token to then send the final Facebook API calls. In this long process chain much can go wrong. Especially because the calls happen all asnychron. You have to work with the correct callback mechanisms to reach the goal. To hide this mechanism and to make the Facebook API easier to use, I have created an abstraction, with which you can work much easier, as you can see here:
<script src="./js/simple-facebook.js"></script> <script> // Setup var fb = new SimpleFacebook(); fb.setAppId('255100001240698'); fb.setLocale('de_DE'); fb.setPermissions('email,user_about_me,friends_about_me,publish_actions'); // Usage fb.showUsersName(); fb.showUsersLink(); </script>
Doesn’t it look great? No more need to include a …weiterlesenfb-root tag or many JavaScript snippets. All you need is the simple-facebook.js file, which can be expanded depending on your needs. Here is a basic version, which illustrates the concept:
If you authenticated a user with the Facebook JavaScript SDK, then you can do the following to get the ID, name and email address of a user:
FB.api('/me',function(response){alert(response.id);}); FB.api('/me',function(response){alert(response.name);}); FB.api('/me',function(response){alert(response.email);});
This is a good example to dynamically include a header file in JavaServer Pages (JSP):
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>JSP Page</title>
</head>
<body>
<c:set var="userAgent" scope="page" value="${header['User-Agent']}"/>
<c:choose>
<c:when test="${fn:contains(userAgent,'iPhone')}">
<%@include file="header_iphone.jsp" %>
</c:when>
<c:when test="${fn:contains(userAgent,'iPad')}">
<%@include file="header_ipad.jsp" %>
</c:when>
<c:when test="${fn:contains(userAgent,'Android')}">
<%@include file="header_android.jsp" %>
</c:when>
<c:otherwise>
<%@include file="header_other.jsp" %>
</c:otherwise>
</c:choose>
</body>
</html>
0