.NET Corso Base HTML5

This entry is part 1 of 1 in the series .NET Corso base

Descrizione del corso:
Introduzione ad Html5 basata su WebForms
Target: certificazione corso 20480B
Repository delle slide e del codice di esempio:
https://github.com/daitangio/html5
Lingua: Italiano
Tecnologia: Visual Studio 2013 (Trial Supported)
Extra software required: SQL Express

Esempi

Scaricabili da https://github.com/daitangio/cqrs-journey-code

Code Example speciali

  1. Localization API
  2. Documentazione Localization API

Arduino EggBoxLamp

This entry is part 2 of 3 in the series Arduino the Egg Box Lamp

IMG_1783.JPGProgrammare Arduino è molto divertente, ed in questo articolo voglio mostrare come creare una semplicissima lampada luminosa. Questo esempio sarà anche il pretesto per mostrare differenti implementazioni software dello stesso progetto (in prossimi post)

Questo progetto è volutamente molto semplice, e non si serve di nessun sensore.

Trovate il codice su github:

https://github.com/daitangio/egg_box

Continue reading “Arduino EggBoxLamp”

I hate XML, but now less then before thanks to SimpleXMLParser

I admit it: I hate xml square brackets dancing orgy, even in Java.

Anyway, all is xml-ized around me. So in 2006 I developed a small XML parser based on SAX. It was a shitty dirty code for JDK 1.4 which let you parse xml stuff defining a method and forgetting about selectors, XPath,  XWing, Tie fighters and so on…

I called it UltraSmartParser, a shitty name too.
Now I have revivied it from the tomb of darkness, and dressed with fancy super powers. It is on github: https://github.com/daitangio/SimpleXMLParser

To give you a tast of its power, let look at this code:

public class WordPressExportReader extends SimpleXMLParser {
	public static void main(String[] args) throws SAXException, IOException {
		BasicConfigurator.configure();

		XMLReader sax2Parser = XMLReaderFactory.createXMLReader();
		SimpleXMLParser parser = new WordPressExportReader();
		parser.getLog().setLevel(Level.INFO);
		sax2Parser.setContentHandler(parser);
		File f = new File("c:/jjsoft/gioorgicom.wordpress.2012-08-07.xml");
		FileInputStream is = new FileInputStream(f);
		InputSource s = new InputSource(is);
		sax2Parser.parse(s);
		parser.getLog().info("DONE");
	}

	private String currentTitle,pid;

	public void do_RSS_CHANNEL_ITEM_TITLE(String title) {
		this.currentTitle = title;
	}

	// Catch <wp:post_id>1551</wp:post_id>
	public void do_RSS_CHANNEL_ITEM_POST_ID(String idz){
		pid=idz;
	}

	// Catch stuff like
	// <category domain="category"
	// nicename="software"><![CDATA[Software]]></category>
	// <category domain="series" nicename="version-control"><![CDATA[Version
	// Control]]></category>
	public void do_RSS_CHANNEL_ITEM_CATEGORY(Map catAttribs, String cdata) {
		if(catAttribs.get("domain").equals("series")){
			getLog().info(" POST:"+ pid+":"+ currentTitle+":" + cdata+ ":"+catAttribs.get("nicename"));
		}
	}

}

The orginal code targeted JDK 1.4, so it is a bit “vintage”.
The revamped revision you found on github spots:

  1. Support for attributes, missed in the original version
  2. Optimized algorithm
  3. Stored on Github, for sharing with you
  4. Better logging & class/method naming

The first version is called “karmak” because will be your path to enlightment…

 

Git Tips

This entry is part 1 of 3 in the series Version Control

In the last seven months I learned git, working for a dozen of projects. On some of them I was the master&commander, on others I only set up the streams and let the young Jedi find the way to the delivery. Via trial and error I find out a bunch of userful commands.

I present here in order of priority, from the most important to the least…let’s start

 Userful monitoring / configuration  commands

  1. This is the first tip I suggest you:
    git config --global merge.ff false

    This configuration force git to register
    a commit object even if the merge is a fast forward merge.
    Git has a “smart” what of acting, consisting in not registering fast-forward merges. This can be very annoying if you try to track down an evil sith commiting random stuff on your system. Belive me. Sith are so evil!

  2. Find out what happen while you was on holidays…
    git whatchanged  master...my/great-release

    It is the most userful command to check differences between branches/tag/commits.
    If you have a huge project, you can also specify a directory like in

    git whatchanged  master...my/great-release test-scripts-dir

    The standard report is quite good, listing commit comment, and files.
    Even better if you want to recover the previous file’s version,  issue

    git show HEAD^1:parser/src/main/MyStuff.Java >OldStuff.java
    #For two version before try...
    git show HEAD^2:parser/src/main/MyStuff.Java
  3. Resync with remote is always a pain if you forget a branch…
    git remote update

    Without special configuration, this command will fetch updates for all your remotes.
    Very useful if you need to know the status of all your branches

  4. Logs are good, but logs with branch description are better:
    git log --decorate

    Will show you also the branches or the tag

  5. Sometimes you need to erase what you have just commited. An easy way to do it  is
    git reset --soft HEAD^

    This will revert your last commit, leaving it as “Changes to be committed”. Very userful if you do a wrong merge.For instance, if you are on branch “stable” and issue

    git pull origin instableStuff

    you will wrongly issue a merge of the  instableStuff into your stable branch. It is quite subtle.
    Sometimes there is a better option. It is called “revert”:

     git revert HEAD

    is better because will register a “revert” commit on the history, and it is useful when you already pushed your deadly stuff.

    Anyway, “git reflog” will keep in the trashcan the old commit, in case you need it. But be careful,m because reflog is compacted from time to time.

     

Team Caffeine Stats

git shortlog -s -n

Will give you fast stats on your team: is fomeone has a very huge commit rate, reduce free coffe meetings :)

Useful scripting commands

git ls-files
can be used with xargs to kill all your nasty binaries.
For instance
git ls-files workarea/workspace103 | grep /classes/ | xargs git rm
will save your days

Nice to know advices

  • Git 1.7.10 supports utf-8 encoding. I strongly encoruage you to use it instead of older version.
  • –dry-run option
    It is your best friend during a pull or a risky commit. Even if you are better then Yoda (or Linux) at git, you should definitely try it out sometimes.
  • git pull --rebase

    It should avoid merge linearizing input history.
    I am not sure it is a good idea, but can avoid repeating merges if you needn’t. Anyway, do a lot of testing before proceeding in this way.

Subversion to Git migration guide

This Good article
will save your days.

Known weird errors

  • can’t resolve proxy ‘null’ for https
    Do a

    $git var -l | grep http
    http.sslcainfo=/bin/curl-ca-bundle.crt
    http.proxy=

    If you have  the empty http.proxy config, here is the problem.

    Do a look at your $HOME/.gitconfig for the blank http.proxy  configuration, and zap it.

Here you can find other tips.
Hub is a replacement script for git, but I disagree with this approach: anyway, you can decide by yourself if it deserve your attention.