Artem's blog

Mainly .NET (C#, ASP.NET) and my projects

Archives for Old clizware.net blog

Tips of the day 21 November 2011

Welcome to Tips of the day! Here our some css components people asks about.
Code 1:

/* This code will effect the whole page */

*
{
/* Code here*/
}

Code 2:

/* This will place an object in center */

margin:auto;
padding:auto;

Code 3:

/* This will reset basic browser stuff */

margin:0;
padding:0;
border:0;

/* usually placed between *{ /* here */} */

School Website

Hi again, everyone!
It was a long time ago I wrote something here, so now I will present my new school website I have made. This website is basically done by using JS and CSS, as a normal website. You may find the website at http://www2.katedral.se/~ib11loar/

Regards,
Artem

IB at Katedralskolan

This week was amazing, I’ve started the school! Actually, I’ve nothing to add, only that the school rocks!

Kaliningrad

Currently, I´m in Russia, the city of Kaliningrad. It´s an old city, and it has a very rich history. In meantime, I´m there, I will try to create some posts at my swedish blog here. You are always welcome!

Straddling Checkerboard [Java Script]

This tutorial will show you how you can encrypt/decrypt text (string) with Java Script or JScript.

First we need a table, even called for matrix. To create a matrix I chose to combine three array-lists into one single. (Note that it also works without the combining of arrays!)

        //generating 3 arrays
        var _matrixA = new Array();
        var _matrixB = new Array();
        var _matrixC = new Array();
        var _mA, _mB;

        _matrixA = new Array("A", "", "", "B", "C", "D", "E", "F", "G", "H");   // 0
        _matrixB = new Array("I", "J", "K", "L", "M", "N", "O", "P", "Q", "R"); // 1
        _matrixC = new Array("S", "T", "U", "V", "W", "X", "Y", "Z", ".", "/"); // 2

        //assign values of columns
        _mA = 1;
        _mB = 2;

        //combining matrix
        var _matrix = new Array(_matrixA, _matrixB, _matrixC); //this is the table, to get data, use _matrix[x][y]

Encryption Method:

        // Encryption method
        function encrypt(_text) {
        	var _returnVal = "";
            for (i = 0; i < _text.length; i++) {

                if (_matrixA.indexOf(_text.charAt(i)) != -1) {

                    _returnVal += (_matrixA.indexOf(_text.charAt(i)));

                }
                if (_matrixB.indexOf(_text.charAt(i)) != -1) {
                    _returnVal += (_mA); //default 1
                    _returnVal += (_matrixB.indexOf(_text.charAt(i)));

                }
                if (_matrixC.indexOf(_text.charAt(i)) != -1) {
                    _returnVal += (_mB); //default 2
                    _returnVal += (_matrixC.indexOf(_text.charAt(i)));

                }

            }
            return _returnVal;

        }

Decryption Method:

        // Decryption Method
        function decrypt(_text)
        {
        	var _returnVal = "";
        	for (i=0; i < _text.length; i++)
        	{
        		if (_text.charAt(i) != _mA || _text.charAt(i) != _mB )//the char has to be in 'first' matrix, _matrixA
        		{
        			_returnVal += _matrixA[_text.charAt(i)];
        		}

        		if (_text.charAt(i) == _mA) //the char has to be in 'secend' matrix, _matrixB
        		{
        			i++;
        			_returnVal += _matrixB[_text.charAt(i)];
        		}

        		if (_text.charAt(i) == _mB) //the char has to be in 'third' matrix, _matrixC
        		{
        			i++;
        			_returnVal += _matrixC[_text.charAt(i)];
        		}

        	}

        	return _returnVal;
        }

Copyright (C) 2011 Artem Los

CRC32 Method [VB.NET]

Please take a look over the code I’ve founded at http://dotnet-snippets.com/dns/calculate-crc32-hash-from-file-SID587.aspx.
The author of this code is Tim Hartwig. If you want to read more about the code/algorithm, please go here!

' This code have to be included in the header of file
Imports System.IO
Public Function GetCRC32(ByVal sFileName As String) As String
    Try
        Dim FS As FileStream = New FileStream(sFileName, FileMode.Open, FileAccess.Read, FileShare.Read, 8192)
        Dim CRC32Result As Integer = &HFFFFFFFF
        Dim Buffer(4096) As Byte
        Dim ReadSize As Integer = 4096
        Dim Count As Integer = FS.Read(Buffer, 0, ReadSize)
        Dim CRC32Table(256) As Integer
        Dim DWPolynomial As Integer = &HEDB88320
        Dim DWCRC As Integer
        Dim i As Integer, j As Integer, n As Integer

        'Create CRC32 Table
        For i = 0 To 255
            DWCRC = i
            For j = 8 To 1 Step -1
                If (DWCRC And 1) Then
                    DWCRC = ((DWCRC And &HFFFFFFFE)  2&) And &H7FFFFFFF
                    DWCRC = DWCRC Xor DWPolynomial
                Else
                    DWCRC = ((DWCRC And &HFFFFFFFE)  2&) And &H7FFFFFFF
                End If
            Next j
            CRC32Table(i) = DWCRC
        Next i

        'Calcualting CRC32 Hash
        Do While (Count > 0)
            For i = 0 To Count - 1
                n = (CRC32Result And &HFF) Xor Buffer(i)
                CRC32Result = ((CRC32Result And &HFFFFFF00)  &H100) And &HFFFFFF
                CRC32Result = CRC32Result Xor CRC32Table(n)
            Next i
            Count = FS.Read(Buffer, 0, ReadSize)
        Loop
        Return Hex(Not (CRC32Result))
    Catch ex As Exception
        Return ""
    End Try
End Function

Precision Helper 2.0

Precision Helper 2.0 is very useful when you want to create a CHM (Windows Help) files. You can create new, import websites (directory), decompile an existing CHM file, etc. It can also convert your project into a single webpage, or ePub Book. It’s freaky awesome, and it’s why i’m creating a Swedish translation of it! This program has a good language support.  It has both English, Czech, French, Hungarian, Polish, Russian and soon enough Swedish! 😛

Obviously is this software full of more nicer features, such as scripting interface and a very easy to use GUI (Graphical User Interface). I won’t list all features, but I strongly recommend you to visit its official website http://www.be-precision.com/products/precision-helper/.

The design of the program is much similar Microsoft Word’s, but I think it does not matter! With few words, this software is freaky awesome tool for creating CHM files! Try it out!

Regards, Artem Los

Working on translation

Currently, is my new mission, to translate a software, called “Precision Helper”. It’s very nice software, and it’s why i’m translating it! With few words, it’s free and awesome. The software can be downloaded from http://www.be-precision.com/

More information will come soon!
Artem Los, Head of CliZ Ware

My Silverlight Application

Microsoft Silverlight is like Adobe Flash, but not so popular.

Please take a look of my application!

Straddling Checkerboard

Page 7 of 9:« First« 4 5 6 7 8 9 »