How can you dump a MySQL database

from the shell command prompt type:

mysqldump -h SERVER_NAME DATABASE_NAME > BACKUP_FILE.sql

where:
- SERVER_NAME – is the database server name (usually localhost)
- DATABASE_NAME – is the name of the database to be dumped
- BACKUP_FILE – is the name of the file (usualy the name of the database plus the backup date)

  • Share/Bookmark

Tags: , , , , ,

Monday, April 21st, 2008 MySQL No Comments

.NET Form Transparency

A little tip on the .NET Form Transparency.
The following code shall provide a simple way to adjust the form transparency using the mouse wheel button.

//=== in the initialization section insert this:

this.MouseWheel += new MouseEventHandler(TransparencyHandle);

//=== in the form’s class :
private void TransparencyHandle(object sender, MouseEventArgs e)
{
if (e.Delta > 0)
{
this.Opacity = this.Opacity + 0.05;
}
else
{
this.Opacity = this.Opacity – 0.05;
}
}
This should do it.

  • Share/Bookmark

Tags: , , , , ,

Friday, April 11th, 2008 .NET No Comments

.NET TEXT-TO-SPEECH example

Some methods to implement text-to-speech in a .NET application:

?View Code CSHARP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
public void Sing(string vMessage)
{
    BackgroundWorker bw = new BackgroundWorker();
    bw.DoWork += new DoWorkEventHandler(bw_DoWork);
    bw.RunWorkerAsync(vMessage);
}
 
private static void bw_DoWork(object sender, DoWorkEventArgs e)
{
    SpVoice voice = new SpVoice();
    voice.Speak(e.Argument.ToString(), SpeechVoiceSpeakFlags.SVSFDefault); 
}
 
Sing("Hello");
  • Share/Bookmark

Tags: , , , , ,

Friday, April 11th, 2008 .NET No Comments

.NET DataSet Creation

private void GetData(string selectCommand)
{
try
{
// Specify a connection string. Replace the given value with a
// valid connection string for a Northwind SQL Server sample
// database accessible to your system.
String connectionString =
“Integrated Security=SSPI;Persist Security Info=False;” +
“Initial Catalog=Northwind;Data Source=localhost”;

// Create a new data adapter based on the specified query.
dataAdapter = new SqlDataAdapter(selectCommand, connectionString);

// Create a command builder to generate SQL update, insert, and
// delete commands based on selectCommand. These are used to
// update the database.
SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter);

// Populate a new data table and bind it to the BindingSource.
DataTable table = new DataTable();
table.Locale = System.Globalization.CultureInfo.InvariantCulture;
dataAdapter.Fill(table);
bindingSource1.DataSource = table;

// Resize the DataGridView columns to fit the newly loaded content.
dataGridView1.AutoResizeColumns(
DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader);
}
catch (SqlException)
{
MessageBox.Show(“To run this example, replace the value of the ” +
“connectionString variable with a connection string that is ” +
“valid for your system.”);
}
}

  • Share/Bookmark

Tags: , ,

Friday, April 11th, 2008 .NET No Comments

OSX COCOA HTTP POST method

For those of you interested in COCOA Objective-C development, here is some code to proper achieve an upload using HTTP POST.
The input data as you can see is provided by some NSTextFields.
The HTTP request is done Synchronously but there is a simple way to do it asynchronously.
So here you go :

————————————————————————-

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
- (IBAction)upload:(id)sender
{
 
    //creating the url request:
    NSURL *cgiUrl = [NSURL URLWithString:@"http://www.testsite.com/upload.php"];
    NSMutableURLRequest *postRequest = [NSMutableURLRequest requestWithURL:cgiUrl];
 
    //adding header information:
    [postRequest setHTTPMethod:@"POST"];
 
    NSString *stringBoundary = [NSString stringWithString:@"0xKhTmLbOuNdArY"];
    NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",stringBoundary];
    [postRequest addValue:contentType forHTTPHeaderField: @"Content-Type"];
 
 
    //setting up the body:
    NSMutableData *postBody = [NSMutableData data];
    [postBody appendData:[[NSString stringWithFormat:@"\r\n\r\n--%@\r\n",stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]];
    [postBody appendData:[[NSString stringWithString:@"Content-Disposition: form-data; name=\"title\"\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
    [postBody appendData:[[NSString stringWithString:[edTitle stringValue]] dataUsingEncoding:NSUTF8StringEncoding]];
 
 
    [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n",stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]];
    [postBody appendData:[[NSString stringWithString:@"Content-Disposition: form-data; name=\"description\"\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
    [postBody appendData:[[NSString stringWithString:[edDescript stringValue]] dataUsingEncoding:NSUTF8StringEncoding]];
 
 
    [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n",stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]];
    [postBody appendData:[[NSString stringWithString:@"Content-Disposition: form-data; name=\"username\"\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
    [postBody appendData:[[NSString stringWithString:[edUser stringValue]] dataUsingEncoding:NSUTF8StringEncoding]];
 
 
    [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n",stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]];
    [postBody appendData:[[NSString stringWithString:@"Content-Disposition: form-data; name=\"password\"\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
    [postBody appendData:[[NSString stringWithString:[edPasswd stringValue]] dataUsingEncoding:NSUTF8StringEncoding]];
 
 
    [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n",stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]];
    [postBody appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"videoFile\"; filename=\"@\"\r\n", [[edFileName stringValue] lastPathComponent]] dataUsingEncoding:NSUTF8StringEncoding]];
    [postBody appendData:[[NSString stringWithString:@"Content-Type: application/octet-stream\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
    [postBody appendData:[[NSString stringWithString:@"Content-Transfer-Encoding: binary/video\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
 
    [postBody appendData:[NSData dataWithContentsOfFile:[edFileName stringValue]]];
 
    [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n",stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]];
    [postRequest setHTTPBody:postBody];
 
 
    NSError *error;
    NSData *searchData;
    NSHTTPURLResponse *response;
    int n = 0;
 
    //==== Synchronous call to upload
    searchData = [ NSURLConnection sendSynchronousRequest:postRequest returningResponse:&response error:&error];
 
    while (1)
    {
        if ([ response allHeaderFields])
        {
            NSString *monster = [[ response allHeaderFields] valueForKey:@"Monstermsg"] ;
            NSAlert *alert = [[NSAlert alloc] init];
            [alert addButtonWithTitle:@"OK"];
            [alert setMessageText: monster ];
            [alert setAlertStyle:NSWarningAlertStyle];
            if ([alert runModal] == NSAlertFirstButtonReturn)
            {
                NSLog(@"%@", monster);
            }
            [alert release];
            break;
        }
        NSLog(@"%d", n++);
    }
}
  • Share/Bookmark

Tags: , , , , , ,

Friday, April 11th, 2008 COCOA 3 Comments

VNC Proxy

Recently I found an annoying problem when I find out that our video conference software cannot do desktop sharing on computers that have no public IP.
We decided to build a VNC Proxy that can be controlled using some commands.
The task got a little bit complicated when you think that this proxy is supposed to support multiple conferences each with multiple clients at the same time.
So, using my good old friend Delphi 7 (especially TServerSocket component) we’ve managed to implement the VNC Proxy. Testing revealed that this solution is viable although the speed is a little bit slower than on direct IP access (as all data is transferred via proxy server).
Ahh … just a remainder for all of you searching the TServerSocket component:
By default this package is not installed in Delphi 7, so:
Component >> install packages >> Add button >> select C:\Program Files\Borland\Delphi7\Bin\dclsockets70.bpl.

Right now, the FLASH videocenferencing application allows desktop sharing(limited or full control) on any computer, public IP or not.
For those of you interested in the real project, you can test the results on http://demo.streamingbase.com.

  • Share/Bookmark
Friday, April 11th, 2008 Delphi No Comments

Blogg for money

Lately I find myself surrounded by people earning good money by writing various articles on their blogs. After snooping around I decided to post here a list of blog advertising companies (companies that would pay decent for an article on a certain theme). The order in this list does not mean anything special (my own preferences are on top).

1. payperpost.com – probably most popular choice around.
2. reviewme.com
3. sponsoredreview.com
4. blogsvertise.com
5. blogitive.com
6. loudlaunch.com
7. bloggerwave.com
8. payu2blog.com
9. creamaid.com

For a successful blogger career you need to focus on interesting topics and of course, you need as many visitors as possible. Obviously, this two requirements are close related.

What can I say? HAPPY BLOGGING !

  • Share/Bookmark

Tags: , ,

Friday, April 11th, 2008 Internet No Comments