Hello, world!

It's time for Hello, world! programm. Let's select first N records using tools, schema and LINQ.  
MySqlConnection conn = new MySqlConnection("SERVER=localhost; DATABASE=employees;UID=root;PASSWORD=");
conn.Open();
DataSet ds = new DataSet("employees");
MySqlDataAdapter sda = new MySqlDataAdapter("select * from salaries", conn);
sda.Fill(ds, "salaries");

var result = 
    from s in ds.Tables["salaries"].AsEnumerable().Take(10)
    select s;

Listing. 1

Warning! Don't use the example in real application! Please leave a comment why it's bad designed.

Employee Demo Database Description

Demo database is provided by launchpad with Creative Commons license for test and learning purpose.

It contains departments (9), deptartment employees (331603), deptartment managers(24), employees(300024) with titles(443308) and salaries(2844047). The structure is provided below. Schema

Fig. 1 - Schema

   

LINQ Syntax

LINQ Syntax has quite simple BNF (Backus-Naur Form) notation  
query-expression ::= from-clause query-body

query-body ::=

query-body-clause* final-query-clause query-continuation?

query-body-clause ::=
(from-clause
| join-clause
| let-clause
| where-clause
| orderby-clause)

from-clause ::= from itemName in srcExpr

join-clause ::= join itemName in srcExpr on keyExpr equals keyExpr
(into itemName)?

let-clause ::= let itemName = selExpr

where-clause ::= where predExpr

orderby-clause ::= orderby (keyExpr (ascending | descending)?)*

final-query-clause ::=
(select-clause | groupby-clause)

select-clause ::= select selExpr

groupby-clause ::= group selExpr by keyExpr

query-continuation ::= into itemName query-body

Programming LINQ with free tools

I would like to use free and open source tools to learn LINQ programming. You can also take Visual Studio Express, MySQL Server with .NET Connector and some demo database suite. Tools:

HOWTO wipe space on Hetzner Root Server

If your worry about data left on dedicated/hosted root server and want to remove secure all files and bits,
you can clean complete disk slice or even better to overwrite with random bytes.

DATA CAN'T BE RECOVERED ANY MORE! YOU WILL PROCEED AT YOUR OWN RISK!

1. Start Rescue system from Robot.
The Rescue System can be activated from Robot. After choosing the desired server from the server overview (Menu "Server" -> click on the desired server) go to the tab "Rescue". Here you can activate the Rescue System. After activating the Rescue System an automatically generated password is displayed. Please make a careful note of it as this is the root password of the Rescue System.

2. Login into Rescue System using ssh
3a. If you use default server with RAID 1 (example for an EX server) execute
# dd if=/dev/urandom of=/dev/md2 bs=1M


3b. Or if you use a hardware RAID controller has been installed or the server only has one drive (VQ servers) execute
#  dd if=/dev/urandom of=/dev/sda3 bs=1M

Care of your personal data!


Free PHP, HTML, CSS, JavaScript editor (IDE) - Codelobster PHP Edition

Free PHP, HTML, CSS, JavaScript editor (IDE) - Codelobster PHP Edition
For valuable work on creation of sites you need a good comfortable editor necessarily. There are many requiring paid products for this purpose, but we would like to select free of charge very functional and at the same time of simple in the use editor - Codelobster PHP Edition .
    Let us consider some important possibilities and advantages of this program:
  • All code highlights depending on a type, the also mixed code is thus supported, so the area of HTML will be highlighted as HTML, PHP as PHP, and Javascript as Javascript in a the same file. Thre is possibility of choice from color schemes, including popular IDEs.
  • Powerful autocompletion for HTML, PHP, CSS and Javascript, including HTML5 and CSS3. For PHP the structure of project is fully recognized, and the complete list of methods falls out in the proper places.
  • HTML/CSS inspector on the type of Firebug, which allows easily to correlate the selected elements of page with a code and proper style.
  • Context help on all supported languages. By pressing F1 key the page with detailed description for current tag, attribute or function will be opened.
  • PHP debugger. PHP debugger allows to execute PHP scripts incrementally, watching the values of all variables in every line.
  • SQL manager allows to produce all necessary actions with a database - to add, delete, edit a structure and records in tables, to export data, execute SQL queries. Highlighting and autocompletion works for SQL files also.
  • Support of FTP allows to work straight with a remote server and to do all necessary changes with files;
  • The portable option allows to use editor without the preliminary installation.
  • Other useful utilities: pair highlighting, possibility of blocks selection, collapsing, tooltips, navigation on descriptions of functions and included files at withholding of the key of CTRL, viewing of structure of files and project, preview in a browser, book-marks, and all other standard possibilities for work with a code.

Also there are special plugins for work with


  • CMS: Drupal, Joomla
  • PHP frameworks: CakePHP, CodeIgniter, Symfony, Yii
  • JavaScript libraly: JQuery
  • WordPress blogging engine
  • Smarty template engine

Developer Codelobster Software
Web Site http://www.codelobster.com/
Language English, Russian, German, Spanish, French, Portuguese
Supported OS Windows 2000, Windows XP, Windows Vista, Windows 7

[SOLVED] who has locked mysql table?!

Occasionally appears error message “Lock wait timeout exceeded, INSERT INTO table failed.” between 01am and 05am in one of the applications. Can you imagine DBA the whole night long sitting  and waiting for error message? I also can’t, but need to find the reason of locks and discover process. Thus when new record in error log appears it must be performed some necessary SQL commands. In unix world you can use inotifywait/gamin to watch file changes and mysql client to execute sql commands.
 My biggest problem was the mysql server running on windows platform and absence of nice utilities. On my luck windows has FindFirstChangeNotification Win32 API function. I have created small tool which listens a directory for changes and execute

SHOW FULL PROCESSLIST

SHOW OPEN TABLES

SHOW ENGINE INNODB STATUS

 Results will be written to console.

Usage MySql_Monitor.exe -h HOST -u USERNAME -pSOMEPASS -d DBNAME c:\tmp\WATCHED_DIR\

Example: MySql_Monitor.exe -h localhost -u root -p -d somedb c:\tmp\log\ > output.txt

You can take exe file or sources here.
Enjoy!

Asterisk AST_SORCERY function

 AST_SORCERY gets a field from a sorcery object. Sorcery is always created for PJSIP aors, endpoints and identifies in asterisk. It allows y...