code

please delete

Sharing code efficiently with Teletype by Github

Github has promoted the new Teletype for Atom, as a new way to dive the right code with remote collaborators. Work in team in real time with different configurations in different programming environment on any file in Atom, is now possible

Taggings:

Simple Hello-World-App on Android

Let's start with what you need first.

  • An Android phone, e.g. Samsung Nexus S or Galaxy Nexus
  • An IDE. Use Eclipse for Java EE.
  • The Eclipse ADT plugin (Android Dev Tools), available from Eclipse's own Package Installer.
  • The Android SDK-Tools, available from here

Install all software named in the upper list in this order. At one point, you'll be asked which Android versions you want to develop for. It is always a good idea to be on top of things, but don't forget to be compatible (more about this later). After you've done this, check whether any Android SDK-components are missing: In Eclipse, open "Window", "Android SDK Manager", and check whether the Android versions chosen by you are there.

The next step is to create the Hello-World-program. For this, in Eclipse: Open "File", "New", "Android Application Project" (might be hidden in "Other" the first time you open it). In this window, you'll have to make two important choices: What SDK-Version should be the "Minimum Required SDK"? What is the oldest Android phone you want your Hello-World-App to be compatible with? And: What is the "Target SDK"? For which SDK-Version do you want to develop this specific app.

Some words to Android-App-anatomy (or physiology): Every App consists of a number of "Activities", which interact wich each other by "Intents" and "Handlers". A lower layer, consisting of the "Service" and "AsyncTasks", is here to bring order to the chaos. Activities can be paused and resumed. Views are defined by XML-Files.

Now to the Hello-World-display: First, create a view in Eclipse. You should see an Android display. Name the resulting XML-file e.g. "activity_main.xml". Drag a Text-Field into the display of the phone. In the code, you should see an XML-particle, like:

< Text View
android:layout_width="wrap_content"
[..]
android:text="Hello World!" />

In the java-File of your main activity, be sure to set the view you've just created to be displayed on start-up. For this, you'll have to add a line of code to the activity's onCreate-method:

protected void onCreate(Bundle savedInstanceState) {
[..]
setContentView(R.layout.activity_main);
[..]
}

That's it. Plug in your phone, if you haven't already, and run the code in Eclipse. It should automatically deploy it to the phone - where an app symbol should appear. Run it, voilà!

Taggings:

Some starteri-help for android?

I would like to learn coding on Android, but Android is difficult and scary. Developing for Android is often described as a cumbersome task - I know Java, but Android is apparently a little more difficult than "mere" Java complexity.

Work with RDF - Solution Redland

The “Redland RDF Libraries” provide support for the Resource Description Framework (RDF). It provides basic functions as well as several bindings to different programming languages (for example: perl, python…). There are also packages for various Linux distributions and other operation systems available that make an installation quite easy (if all necessary additional libraries are already installed). However the Redland libraries provide the possibility to use BerkeleyDB or MYSQL as database storage as well as store the files temporary in the memory. These functions allow you to easily store, access, read or update your data via SPARQL (query language for RDF, similar to SQL) contained in the RDF files.

Taggings:

Howto insert/edit a Yahoo Calendar in your Homepage/Form

First of all i have to say, that i had to remove all "<" from my code, because the "code" tag didn't work and the script-lines weren't displayed ;)

Step 1: Download the package
At first you have to download the calendar sources from http://developer.yahoo.com/yui/calendar/

Step 2: Find a place
Now copy the calendar sources somewhere where you want to use it

Step 3: Insert it into your homepage/form
-) First you have to include the necessary javascripts and css files. For my kind of calendar the following were enough.

script type="text/javascript" src="yui/build/yahoo/yahoo.js">/script>
script type="text/javascript" src="yui/build/event/event.js" >/script>
script type="text/javascript" src="yui/build/dom/dom.js" >/script>
script type="text/javascript" src="yui/build/calendar/calendar.js">/script>
link type="text/css" rel="stylesheet" href="yui/build/calendar/assets/skins/sam/calendar.css">

-) Now you need an empty div-Tag somewhere were you want to add your calendar

div id="calDatumContainer" style="display:none; position:absolute;">/div>

-) Now we simply add the calendar script of our choice, in my case the following

script type="text/javascript">

Here i configured the calendar to use the german specifications.

var navConfig = {
strings : {
month: "Monat",
year: "Jahr",
submit: "OK",
cancel: "Abbrechen",
invalidYear: "G¸ltiges Jahr eingeben!"
},
monthFormat: YAHOO.widget.Calendar.LONG,
initialFocus: "Jahr"
};
var calDatum = new YAHOO.widget.Calendar("calDatum","calDatumContainer",
{ LOCALE_WEEKDAYS:"short", START_WEEKDAY: 1, navigator:navConfig });

// Correct formats for Germany: dd.mm.yyyy, dd.mm, mm.yyyy
calDatum.cfg.setProperty("DATE_FIELD_DELIMITER", ".");
calDatum.cfg.setProperty("MDY_DAY_POSITION", 1);
calDatum.cfg.setProperty("MDY_MONTH_POSITION", 2);
calDatum.cfg.setProperty("MDY_YEAR_POSITION", 3);
calDatum.cfg.setProperty("MD_DAY_POSITION", 1);
calDatum.cfg.setProperty("MD_MONTH_POSITION", 2);

// Date labels for German locale
calDatum.cfg.setProperty("MONTHS_SHORT", ["Jan", "Feb", "M\u00E4r", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"]);
calDatum.cfg.setProperty("MONTHS_LONG", ["Januar", "Februar", "M\u00E4rz", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"]);
calDatum.cfg.setProperty("WEEKDAYS_1CHAR", ["S", "M", "D", "M", "D", "F", "S"]);
calDatum>.cfg.setProperty("WEEKDAYS_SHORT", ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"]);
calDatum.cfg.setProperty("WEEKDAYS_MEDIUM",["Son", "Mon", "Die", "Mit", "Don", "Fre", "Sam"]);
calDatum.cfg.setProperty("WEEKDAYS_LONG", ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"]);

calDatum.render();

Here i added some Event-Listeners:
The "focus" event, so that the calendar shows up when clicking in the field "datum"
The "keypress" event, so that the calendar is hidden when the user wants to insert the date by typing it in

YAHOO.util.Event.addListener("datum", "focus", calDatum.show, calDatum, true);
YAHOO.util.Event.addListener("datum", "keypress", calDatum.hide, calDatum, true);

With this function i add the selected date into the "datum"-field, in the date-format i specify.

function handleSelect(type,args,obj) {
var dates = args[0];
var date = dates[0];
var year = date[0], month = date[1], day = date[2];

document.anlegen.datum.value = year + "-" + month + "-" + day;
calDatum.hide();
}

calDatum.selectEvent.subscribe(handleSelect, calDatum, true);
/script>

It took me some time to figure it out, but once you have a guideline its very easy to use.

Taggings:

Post the code on internet

You have a big project and you are in a team with others. You need a secure host where you can post your work and share it with the others members. We are talking about small projects, not those from the big companies.

Using Git DVCS (distributed version control system) and GitHub to effectively collaborate on an open-source software project

While collaboratively working together on an open-source project (which aims to provide a fresh web app framework in this concrete case) and moves at a fast pace it conseqeuntly turned out that using the standard approach of centralized VCS for it soon hit its limits. Therefore, we jointly decided in the community to switch to a decentralized one, namely Git. This DVCS was originally developed by Linus Torvalds for managing the development of the Linux kernel. Its main concept basically is that everybody has his/her own complete "clone" of the code repository. So there isn't a single centralized code repository as in the structure/architecture of Subversion, but a number of decentralized ones. As a consequence Git was also developed to have very powerful and convenient capabilities of merging branches of code repository clones. This feature which is also one of Git's biggest strengths shall be described and explained in more detail. Git's basic usage is mainly command line based and can especially in the beginning pose quite a steep learning curve on new users. So it should be given a short introduction to Git's main concepts and concrete usages as well. Another very nice companion to Git is the Git code repositories hosting site/service GitHub (github.com) which can make using Git simpler and furthermore improve collaborative development processes and tasks of a programming/development project. This shall also be presented and explained.

Setting up a Subversion repository and corresponding Trac app on a (Debian/Apache) server

So the basic problem here is how to best work together productively in a programming/development project and the question which are good tools providing capabilities to potentially support and improve this. One such tool is a version control systems (VCS) which basically helps to keep the code and especially its progress under (version) control in a code repository (transparently). A specific such VCS is Subversion (a.k.a. SVN). This is at the time one of the most popular and up-to-date systems of its kind (i.e., centralized VCS). Its basic slogan is "CVS done right" (which consequently can be seen as Subversion's indirect predecessor system). There are many tools available to work with Subversion from a client/user perspective like stand-alone client apps, integration in editors, e.g., via special plugins or also complete integration in a full-blown IDE (integrated development environment). Now, what's up to do is to actually setup a Subversion system on a server and to create a code repository for a programming/development project. In this case a Debian-based OS with an Apache Web server is chosen as infrastructure. Additionally a Trac app should be installed which among other things offers nice and convenient Web visualization of the code repository (and its progress) to users. When all this is in place users can take the benefits of using Subversion for version control of the code of the project.
Subscribe to code