Skip to content


BleedingEdge 2012 – recap

Wow! Totalno presenečen sem bil nad obiskom predavanja, ki je vsaj po mojem občutku teklo gladko. Veliko zanimanja je požel projekt Weinre, mislim pa da je bilo poslušalstvo navdušeno tudi nad PhoneGap/Cordova ogrodjem. Se priporočam za kakšen feedback in pa seveda tudi za demonstracijo vaših produktov, ki bodo temeljili na tej tehnologiji. Ob začetku predavanja sem imel kar nekaj težav: najprej Win7 niso hoteli dati iz sebe na projektor več kot 640×480. Očitno so ga nekako napačno prepoznali. Tako da sem uporabil sposojen notebook, na katerem sem odprl Remote Desktop na moj notebook. Druga prepreka pa je bila konfiguracija omrežja, ki je preprečevala da bi iz mobilnega telefona lahko prišel do računalnika in demonstriral Weinre v praksi in v aplikaciji. No, pa drugič, ko bo official Weinre build deloval tudi na Windows Phone.

Posted in Uncategorized.


Bleeding Edge 2012 – Razvoj “native” mobilnih aplikacij za različne platforme

V priponki je na voljo predavanje kot tudi izvorna koda uporabljena in demonstrirana na predavanju. Uporabljeno je ogrodje Apache Cordova (verzija 2.2.0rc1), prikazuje pa urnik konference BleedingEdge 2012.

Posted in Uncategorized.


Ntk2012 – prezentacija in demo

V prilogi je tako prezentacija kot demo koda, ki je bila uporabljena na predavanju. Enjoy!

Posted in Uncategorized.


Android and stack traces

While doing native development for the Android platform, native segmentation faults happen. And they are not very descriptive to the usual developer (which includes me, of course). You would see something along those lines: Continued…

Posted in Uncategorized.


O negibnem dojemanju

Pod roke mi je prišel tekst, ki se mi zdi vreden objave v širšem kontekstu. Gre za Takuanovo pismo Yagiu Tajima-no-Kami. Morda gre v tekstu za pomoto in gre dejansko za pisma Yagyū Munenori, kar pa zares ni toliko pomembno kot dejanska vsebina.

Budistični nauk razlikuje dvainpetdeset stopenj duhovnega razvoja. Eno izmed stopenj imenuje zastoj, ko se človek prilepi na eno samo mesto ne more več naprej. S tvojim mečevanjem je nekaj podobnega: če nasprotnik udari po tebi in so vsi čuti zbrani na njegovem meču, tedaj si pod njegovim vplivom in nisi več gospodar lastnih gibov. Temu pravimo zastoj, ker obstaneš pripeljen na eno samo mesto.

Celoten tekst je na voljo v PDF zapisu.

Posted in general.


Oh really? Password too long?

We are in 2011 after all, so seeing an error message that a password is too long is… well embarasing.

So, given that passwords shouldn’t or should I say must not be saved in a way that enables anyone (even administrators) to retrieve the plaintext version of a password, we’re talking about some sort of hashing. Whether hashing algorithm it is MD5 (avoid) os SHA1 (and in order to avoid precomputed hashes of passwords (known also as rainbow tables) you should use salting techniques with hashing algorithms), the length of a calculated hash does not depend on the length of the plain text password.

So, why is the length of the password limited to 16 characters? Beats me.

Of course, I recommend developers to use bcrypt instead of SHA or MD5. Bcrypt is very slow (compared to SHA or MD5), which is a good property to have for checking passwords — you don’t want to have a super-fast hashing/crypting algorithm thus effectively preventing brute force attacks.

Posted in general, software.

Tagged with , , .


Airport Extreme and PPTP

I was having issues with VPN connection (PPTP to be exact) to my customer. I was connecting with Mac OS X and Windows (tried Windows 7 and Windows XP sp3) and could not make it work. All computers are behind Airport Extreme. When I connected to internet directly (not through Airport), everything worked fine. While googling around, I found many posts referring to a lengthy post describing to enable the default host on Airport base station. I had that configured already, so I was looking for solution elsewhere, since I just could not get the clients to connect. The error I was getting was “PPTP received unexpected message type = 6699“. And that error was printed in the log file after several sent [LCP ConfReq id=0x1 ] messages.
Airport-extreme-config
Since “Default host” setting is sort of dangerous (if don’t use a firewall), I decided to turn it off and to check with tcpdump what goes on on the wire (maybe the /var/log/ppp.log isn’t telling me everything).
To my surprise, PPTP connection was established successfully, so there is a hint for you: if you have problems establishing PPTP connection, try disabling the “Enable default host at” in your Airport configuration.

Posted in general, OS X.

Tagged with , .


Netduino – the beginning

netduino
I’ve received Netduino Plus yesterday. After playing with the on-board LED and button switch, I tried something else today. Since I don’t have a background in electronics, I googled a bit, asked around and connected LED, a couple of resistors and a transistor (BC108C) to control the external LED with the digital output of a Netduino.
The project goal is simple enough for a seasoned electronics guy, but for me, it is quite a challenge:

  • Function as a regular thermostat
  • Which can be controlled remotely via SMS as well:
    • to check current temperature on location
    • to set desired temperature on location
    • to switch power on or off for the oil boiler (heating furnace) and water pumps
    • to alert via SMS when the temperature drops below a defined threshold

The Netduino/Arduino boards are amazing in that they offer a high level language to control them and create your stuff. You can develop & debug with Visual Studio in case of Netduino boards using the familiar interface and software development skills. There are tons of shields (addons, plugins) available for those boards as well. I’m planning on integrating real time clock, digital temperature sensor and a cellular shield (GSM functionality) and a graphical LCD next. Baby steps.

So, how did I wire the external LED?

First, I had to learn some basics:

  1. You have to limit current for the LED, otherwise it will burn
  2. You have to drop the voltage, or the LED will burn

You can limit current by using resistors. I used the 5V pin on the Netduino, and LED needs only 2.5V, so I had to halve the voltage and limit current at the same time. You can do this simply by using two resistors. Smart people call this voltage divider. First, I calculated the maximum current that is allowed for the LED, and that is 20mA. Given the 5V voltage and formula V = R*I, the resistor comes out to 5V / 0.02A = 250Ω (Ohm). Given that, I now needed to lower the voltage, which in my case is simple. The formula for voltage divider is Vout = Vin * R1 / (R1 + R2). Now that I know that R1 + R2 should be 250Ω it is easy to calculate that R1 = R2 = 125 Ohm. I actually used 120Ω resistors as I didn’t have 125Ω ones.
So, the LED was lit, but I wanted to control it via software, so I needed a “switching” mechanism. I asked around used NPN transistor for that. I connected the LED output to collector of a transistor, and connected the emitor part of the transistor to ground. Now, we need to tell the transistor to “open up”. I figured I’ll just connect the digital output to base of transistor, but friendly guys on a Slovenian electronics forum suggested that I use a resistor in between. So I did.
The end result? A program, which turns the LED on whenever I press the button. The final schema looks something like this:
Blinking netduino with external LED
This image was made with Fritzing which looks like a very promising project as well.

Posted in general, Netduino, software.

Tagged with , , , .


Bleeding Edge 2010

Že tretja Bleeding Edge konferenca je za nami. V prilogah najdete tako prezentacijo, ko tudi demo aplikacijo (ki zahteva VS2010 ter nameščen ASP.NET MVC 3 preview 1) ki demonstrira določene tehnike predstavljene med samim predavanjem.

Vesel sem, da ste se odzvali v tako velikem številu in upam, da bo naslednjič tudi tako.

Posted in software.


Using PersistentDictionary for prototyping

Often times, one would find himself in a situation, where you need to temporarily store some data, but don’t wan’t the hassle of configuring a database, a username, etc for it. Maybe even more so, if your development box does not contain SQL Server express or similar database. You can of course use SqlCE, SQLite, BerkeleyDB or something else if your needs are beyond simple prototyping storage. SqlCE, SQLite and BerkeleyDB offer familiar querying interface using SQL to manipulate & query data, whereas PersistentDictionary offers what the name suggests. A persistent (transactions included!) IDictionary<k,v> implementation.

PersistentDictionary implementation is based on Esent, which is a not well-known embedded database included in all major windows version (XP, Vista, Windows Server, etc).  From the Microsoft Windows SDK blog:

ESENT is used by the Active Directory, Windows Desktop Search, Windows Mail and several other Windows services and a slightly modified version of the code is used by Microsoft Exchange to store all its mailbox data. The ESENT API is available through the SDK and can be used on all versions of Windows from Windows Server 2000 on up

There is a managed wrapper for Esent, part of which is also an implementation of PersistentDictionary. Out-of-the box, the PersistentDictionary implementation only stores simple structures and primitive data types, but it is very easy to modify it to support also classes, which are marked with the [Serializable] attribute. One just needs to change the ColumnConverter class. For your convenience, here is the compiled version of EsentCollections, which enable just that. The usage is fairly simple.

var store = new PersistentDictionary<Guid, MyClass>("test-database");
// save an instance of your class
store[Guid.NewGuid()] = new MyClass { PropertyA = "SomeValue" };

// to retrieve and display all elements, you can
foreach(var key in store.Keys) {
  var retrievedInstance = store[key];
  // now do something with this instance
  Console.WriteLine(retrievedInstance.PropertyA);
}

You have to ensure, though, that your custom class is marked for serialization. You can achieve this like so:

[Serializable]
public class MyClass {
  public string PropertyA { get; set; }
}

You can see that it is very easy to implement simple repositories on top of that — for prototyping needs, where the entities are constantly evolving and changing.

Do note, however, that Esent is not limited to PersistentDictionary. You can query it in different ways, add indexes to it, have many columns, etc. The thing is used by large-scale software like Exchange, nontheless.

I will post a simple example of IRepository implementation shortly. Stay tuned!

Posted in software.




WP SlimStat