Silverlight for everybody
June 22, 2008 on 5:32 pm | In Silverlight, DotNet | No Comments
My fist text for a Polish computer magazine NEXT hast just been published. It is called “Silverlight for everybody”. New publisher new challenge. I hope for a long lasting collaboration. In a mean time you can check my GeoCodedCalcualtor. A simple piece of Silverlight app that calculates the degrees, minutes, seconds form of latitude, longitude notation to a numeric notation and shows the translated coordinates using Google Static Maps Api. Enjoy!
Silverlight dla każdego
June 22, 2008 on 5:15 pm | In Silverlight, DotNet | No Comments
Właśnie ukazał się lipcowy numer Magazynu Next a w nim mój pierwszy tekst dla tego wydawnictwa. Początki są prawie zawsze trudne. Nie inaczej było i teraz. Po pierwsze do tej pory rozmiar artykułu nie stanowił żadnego problemu. Teksty dla wydawnictwa Software – SDJ, Software 2.0, PHP Solutions – miały po kilkadziesiąt tysięcy znaków. Teraz musiało mi wystarczyć marne 10-15 tysięcy! Kompletnie zaskoczyło mnie też tempo pracy redakcji. Mój tekst w wersji beta, przesłany w celu wstępnej oceny, trafił na łamy. Efekty tego są niestety widoczne. Ale co tam! Mam nadzieję, że mimo tych drobnych potknięć będziecie mogli z niego zaczerpnąć tyle, by łatwiej rozpocząć swoją przygodę z Silverlightem.
Kod źródłowy kalkulatora przeliczającego współrzędne geograficzne w postaci stopni, minut i sekund do postaci dziesiętnej bardziej zrozumiałej dla komputerów i pokazujący te współrzędne za pomocą Google Static Maps Api.
A tutaj działający kalkulator (pamiętaj, że potrzebna jest ci wtyczka do Silverlighta!).
Remember to brake your egg at the small end*
June 9, 2008 on 9:53 pm | In Clarion, DotNet | No CommentsSometimes the interoperability between .NET and Win32 could by a pain in the ass. Especially in places you don’t expect it to be. I’ve worked recently on a cryptography algorithm. I had the source code in Clarion and all I had to do was to implement it in C#. No problem I guessed. But… The Clarion algorithm used pointers extensively. I have worked with byte arrays. I read the text as a char array and I copied the bytes into long variables using a binary shift. Lets say we have a
string s = “abcd“;
Its something like this:
If we try to interpret this as a uint variable:
uint ui = (uint)((s[0] << 24) | (s[1] << 16) | (s[2] << 8) | s[3]);
we will get something like this number 1633837924.
Lets look at this from the other side. Our string goes direct into memory:
Using Win32 compiler we want to read it to a ulong variable x from a px address. In Clarion the code to do this will look like this:
x &ulong
long px
x &= (px)
What do we get in x?
1684234849
Hmm, variable ui in C# and x in Wind32 are not the same. Why? Because Intel is using a small endian way to store the numbers. So it means that the highest byte is saved at the right side and the lowest at the left. Like this (small endian):
and not (big endian)
* In Jonathan Swift’s Gulliver’s Travels the Little Endians broke their eggs at the small end, where the Big Endians broke theirs at the large end. And the ones were not very fond of the others ;-)
Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds.
Valid XHTML and CSS. ^Top^


