Here you can find sample code, parts of programs, software tricks and ways to optimize code. Articles are shown parts of the codes used in our projects. If someone wishes can use the free parts of code. We welcome your comments on various articles, solutions and improvements to the proposed code.

report view current row number

December 14th, 2009 wiley No comments

How to display current row number in report view table.

An expression containing the RowNumber function, when used in a text box within a data region, displays the row number for each instance of the text box in which the expression appears. This function can be useful to number rows in a table.

=RowNumber(Nothing)


Unique visitors to post: 22

Categories: How to Tags: ,

MySql count width if statement grouped

November 21st, 2009 wiley No comments

Table name – firms

Firm Sex
firm1 man
firm2 man
firm2 woman
SELECT Firm, SUM(IF(sex='man',1,0)) AS Man, SUM(IF(sex='woman',1,0)) AS Woman FROM firms GROUP BY Firm;
Firm Man Woman
firm1 1 0
firm2 1 1

Unique visitors to post: 7

Categories: MySQL Tags: , , ,

CSS Transparency Settings for All Browsers

November 16th, 2009 wiley No comments

The transparency set to 50% for all browsers.

.transparent_text {
	filter:alpha(opacity=50);
	-moz-opacity:0.5;
	-khtml-opacity: 0.5;
	opacity: 0.5;
}
  • opacity: 0.5; This will work in most versions of Firefox, Safari, and Opera.
  • filter:alpha(opacity=50); This will work in IE.
  • -moz-opacity:0.5; This will work in Netscape Navigator.
  • -khtml-opacity: 0.5; This will work in Safari (1.x)

Unique visitors to post: 2

Categories: CSS, CSS Tags: ,

MySql integer numeric types

November 14th, 2009 wiley No comments

The following table shows the required storage and range for each of the integer types.

Type Bytes Minimum Value Maximum Value
(Signed/Unsigned) (Signed/Unsigned)
TINYINT 1 -128 127
0 255
SMALLINT 2 -32768 32767
0 65535
MEDIUMINT 3 -8388608 8388607
0 16777215
INT 4 -2147483648 2147483647
0 4294967295
BIGINT 8 -9223372036854775808 9223372036854775807
0 18446744073709551615

Unique visitors to post: 0

Categories: MySQL Tags: ,

How to set caret position on TextBox

November 12th, 2009 wiley No comments
TextBox.SelectionStart = 5;

This set caret position on TextBox to 5 char.


Unique visitors to post: 33

Categories: C#, How to Tags: ,

How to find current active control in a Form

October 27th, 2009 wiley No comments

If you are working within a form you can use this to find it:


if (this.ActiveControl.Equals(testControl)

{

//......

}

Unique visitors to post: 7

Categories: C#, utils Tags: , ,

Like google searchbox VS dotNet Component MaxtradeCombo

August 6th, 2009 wiley No comments

During my work on the VS.NET project It was necessity to use a component such action “Google search ComboBox”. All data bound in the component can be completed by the “DataSource source”.

The component appears in the following way:

MaxtradeCombo dotNet Component

MaxtradeCombo dotNet Component

“UserControl” component is composed of a “TextBox” and a “ListBox”, which combined look like “ComboBox” and working as a “Google searchbox”.
The added component Properties are – How to search the “DataSource”.

This Component is freeware, and you are free to use and change at your discretion.

http://blog.avalonbg.com/wp-content/plugins/downloads-manager/img/icons/winzip.gif download: MaxtradeCombo (122.60KB)
added: 05/08/2009
clicks: 61
description: MaxtradeCombo is a "google searcbox" like dotNet Component


Unique visitors to post: 1

Categories: C#, Dot net components Tags: ,

dot net panel component

July 15th, 2009 wiley No comments

Formed dot net panel component, with several additional options.
The component code is C#.
Additional options are:
1. Rounded corners of the panel.
2. Add frame and manipulation of it color
3. Transparency

Here is the example:

Maxtrade panel

Maxtrade panel

The name of component is: MaxtradePanel
You can download component from here:

http://blog.avalonbg.com/wp-content/plugins/downloads-manager/img/icons/winzip.gif download: MaxtradePanel v.1.0.0.0 (71.87KB)
added: 14/07/2009
clicks: 87
description: MaxtradePanel v.1.0.0.0

The component is freeware.


Unique visitors to post: 4

Categories: Dot net components Tags: , ,

How to get the exact number of characters in a string, if it has a different encoding

June 25th, 2009 wiley No comments

How to get the exact number of characters in a string, if it has a different encoding.
In my php – QCubed project i need to get a exact length of substring from a string. To get a title from a whole string. In the standard way may use php function substr.

<?php echo substr(QApplication::Translate('_NEWS_TEXT1_'), 0, 45) . ' ...'; ?>

Where QApplication::Translate(‘_NEWS_TEXT1_’) is whole string get from a i18n implementation on QCubed. The problem is that string is a UTF-8 encoding, and in different language encoding function substr return different length of substring. The problem is that in UTF-8 encoding different characters have different numbers of bytes.
eg.

echo strlen('здрасти');

This code return 14 instead of expected 7. In other way:

echo strlen('zdrasti');

return exactly 7.
Тhis is so because the first string ‘здрасти’ is in UTF-8 Bulgarian language, where each character is different bytes length, and the second string ‘zdrasti’ is with one byte for one character.

Тo enable the first code example to show 45 characters, it is necessary to use that rate to increase this number to receive the exact number of bytes to 45 displayed characters.

$kUtfString = strlen(QApplication::Translate('_NEWS_TEXT1_')) / mb_strlen(QApplication::Translate('_NEWS_TEXT1_'), 'UTF-8');

The function mb_strlen return the real number of chars in string.

Solving the above problem that happens when the first change function as follows:

<?php echo substr(QApplication::Translate('_NEWS_TEXT1_'), 0, 45*$kUtfString) . ' ...';?>

Unique visitors to post: 0

Categories: PHP, QCube Tags: , ,

Change class onMouseover

June 23rd, 2009 wiley No comments

How to change CSS class onMouseOver event handler:
Create two clases for normal button and for hover button.

One for normal button example:

.button{
  -moz-border-radius: 3px 3px 3px 3px;
  border: 3px double #a9a9a9;
  cursor: pointer;
}

One for hover button:

.button:hover{
  background: #f5f5dc;
}

Second class change background color on button.


Unique visitors to post: 5

Categories: CSS, CSS Tags: , , ,
Google Analytics integration offered by Wordpress Google Analytics Plugin