Wednesday, December 20, 2006

Bleeping Computer - rundl132.exe - File Information

Bleeping Computer - rundl132.exe - File Information: "Name: [not used]
Filename: rundl132.exe
Command: C:\Windows\rundl132.exe
Description: Added by the W32/Looked-A EXE virus.
File Location: %WinDir%
Startup Type: This program uses either the Load= entry in the win.ini or the registry key HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows\Load to load the program."

Slashdot | Google Deprecates SOAP API

Slashdot | Google Deprecates SOAP API: " {look;gawk;find;sed;talk;grep;touch;finger;find;fl ex;unzip;head;tail; mount;workbone;fsck;yes;gasp;fsck;more;yes;yes;eje ct;umount;makeclean; zip;split;done;exit:xargs!!;)}


So is that why nerds are getting acused of rape? (Not checking return codes...)
The semicolons should be double ampersands, so that execution will stop if a command fails."

O'Reilly Radar > Google Deprecates Their SOAP Search API

O'Reilly Radar > Google Deprecates Their SOAP Search API: "Update #2: Tim writes: On the other hand, SOAP has always been a political football shaped by big companies who were seeking to use it to turn web services back into a controllable software stack. (I remember the first web services summit we did, where a Microsoft developer who I won't name admitted that SOAP was made so complex partly because 'we want our tools to read it, not people.') And it could be that innovation in web services is what we need. However, backwards compatibility is worth preserving, at least for a notice period so people can make an orderly transition. However, it sounds like they are doing that."

Wednesday, December 13, 2006

How To Change The Screen Resolution in C#: "


How To Change The Screen Resolution in C#
By Joshy George

Introduction

This is a sample program that will demonstrate how to change resolution at runtime.

All programmers are facing common problem is how to change screen Resolution dynamically. In .Net 2005 it's very easy to change the screen resolution. Here I will explain you how can we get the Screen resolution and how we will change the resolution at dynamically and while unloading the page it will come as it was before. In dot net we can access the values of user's screen resolution through the Resolution class. It also affects all running (and minimized) programs.

Important Functions

No Functions

Page_Load

Screen Srn = Screen.PrimaryScreen;
tempHeight = Srn.Bounds.Width;
tempWidth = Srn.Bounds.Height;
Page.ClientScript.RegisterStartupScript(this.GetType(), "Error", "");
//if you want Automatically Change res.at page load. please uncomment this code.

if (tempHeight == 600)//if the system is 800*600 Res.then change to
{
FixHeight = 768;
FixWidth = 1024;
Resolution.CResolution ChangeRes = new Resolution.CResolution(FixHeight, FixWidth);
}
Change Resoultion
  switch (cboRes.SelectedValue.ToString())
{
case "800*600":
FixHeight = 800;
FixWidth = 600;
Resolution.CResolution ChangeRes600 = new Resolution.CResolution(FixHeight, FixWidth);
break;

case "1024*768":
FixHeight = 1024;
FixWidth = 768;
Resolution.CResolution ChangeRes768 = new Resolution.CResolution(FixHeight, FixWidth);
break;
case "1280*1024":
FixHeight = 1280;
FixWidth = 1024;
Resolution.CResolution ChangeRes1024 = new Resolution.CResolution(FixHeight, FixWidth);
break;

}

Thursday, December 07, 2006

Varlena, LLC | PostgreSQL General Bits Newsletter: "Turn off triggers for bulk load
[GENERAL] Turning off triggers ? 25-Nov-02

Another issue with bulk loading is triggers firing with each row inserted. If you are sure your data is trustworthy and already meets your referential integrity requirements, you can turn off triggers for the bulk load and turn them back on immediately afterward. You should not use this option when your data is not completely clean.

The reltriggers field in the pg_class table contains the number of triggers active for each table. It can be set to 0 the disable the triggers, but will need to be reset to the proper number of triggers to have them re-enabled.

UPDATE 'pg_class' SET 'reltriggers' = 0 WHERE 'relname' = 'tablename';

UPDATE pg_class SET reltriggers = (
SELECT count(*) FROM pg_trigger where pg_class.oid = tgrelid)
WHERE relname = 'table name';

Contributors: Glen Eustace geustace at godzone.net.nz, Stephan Szabo"

Wednesday, December 06, 2006

should this blog still be called .NET Webservices?

for some program's performance reason, i will recode dataset retuning webservices to .NET Remoting.


-----------------------------

the proxy(stub) code for middletier



using System;
using System.Data;

namespace SyerDll
{
public abstract class RemoteObjectDef : MarshalByRefObject
{
public abstract string Test();

public abstract DataSet ReturnHeader();
}
}

----------------------------------


-----------------------------

sample Client Code:

using System;
using System.Data;

using SyerDll;


class Mate
{


public static void Main()
{

Console.WriteLine("Creating Remote Object.");

string url = "tcp://192.168.10.254:8076/RemoteObjectXXX";
/*RemoteObjectDef ro = (SyerDll.RemoteObjectDef)Activator.GetObject(
typeof(SyerDll.RemoteObjectDef), url );*/

RemoteObjectDef ro = (SyerDll.RemoteObjectDef)Activator.GetObject(
typeof(SyerDll.RemoteObjectDef), url );


DataSet rs = ro.ReturnHeader();


for(int i = 0; i < rs.Tables[0].Rows.Count; i++)
Console.WriteLine(rs.Tables[0].Rows[i]["Lastname"].ToString());

Console.WriteLine("Remote Object says " + ro.Test() );
}

}

-----------------------------------------

sample Server Code:

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using SyerDll;
using System.Data;


using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels.Tcp;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Ipc;


namespace TheServer
{
public class RemoteObject : SyerDll.RemoteObjectDef
{
public override string Dancer()
{
return "UMD";
// throw new Exception("The method or operation is not implemented.");
}

public override DataSet ReturnHeader()
{
DataSet ds = new DataSet();
DataTable t = new DataTable();

t.Columns.Add("Lastname", typeof(string));

t.Rows.Add("Lennon");
t.Rows.Add("McCartney");
t.Rows.Add("Harrison");
t.Rows.Add("Starr");

// ds.Tables[0].Rows[0][0]
ds.Tables.Add(t);



return ds;

//throw new Exception("The method or operation is not implemented.");
}

public override string Test()
{
return "Hello mike" + DateTime.Now.ToString();
// throw new Exception("The method or operation is not implemented.");


}

static void Main(string[] args)
{


// Set up the configuration parameters through a dictionary
IDictionary properties = new Hashtable();
properties.Add("port", 8076);
properties.Add("secure", false);
// properties.Add("impersonate", false);

// Create an instance of a channel
TcpServerChannel serverChannel =
new TcpServerChannel(properties, null);
ChannelServices.RegisterChannel(serverChannel,false);
// ChannelServices.RegisterChannel(new TcpChannel(8076));
Type RemoteType = Type.GetType("TheServer.RemoteObject");

// RemotingConfiguration.RegisterWellKnownServiceType(RemoteType, "RemoteObjectXXX", WellKnownObjectMode.SingleCall);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(TheServer.RemoteObject), "RemoteObjectXXX", WellKnownObjectMode.SingleCall);

//while(true)
Console.WriteLine("Michael Buen");
Console.ReadLine();
}
}
}

Saturday, December 02, 2006

restore postgresql database

raw backup and restore of postgresql, ala-mssql's sp_attach_db.


copy the whole c:\program files\postgresql

:D


then copy to other computer, set the necessary permission(note: NTFS) , like the windows username: postgres-acct. note that postgres-su (superuser), has no bearing in windows usernames, you must not look for this user

Friday, December 01, 2006

FAQ: Technical - Mono: "What is a 100% .NET application?

A '100% .NET application' is one that only uses the APIs defined under the System namespace and does not use P/Invoke. These applications would in theory run unmodified on Windows, Linux, HP-UX, Solaris, MacOS X and others. Note that this requirement also holds for all assemblies used by the application. If one of them is Windows-specific, then the entire program is not a 100% .NET application. Furthermore, a 100% .NET application must not contain non-standard data streams in the assembly. For example, Visual Studio .NET will insert a #- stream into assemblies built under the 'Debug' target. This stream contains debugging information for use by Visual Studio .NET; however, this stream can not be interpreted by Mono (unless you're willing to donate support). Thus, it is recommended that all Visual Studio .NET-compiled code be compiled under the Release target before it is executed under Mono."

Howto Backup PostgreSQL Databases | nixCraft

Howto Backup PostgreSQL Databases

Posted by LinuxTitli in Linux, Howto, UNIX, Data recovery, Backup

I rarely work on PostgreSQL database. Recently I had received a request to backup PostgreSQL databases as one of our client want to reformat server. PostgreSQL is a one of the robust, open source database server. Like MySQL database server, it also provides utilities for creating backup.

Login as a pgsql user$ su - pgsqlGet list of database(s) to backup$ psql -lBackup database using pg_dump command. pg_dump is a utility for backing up a PostgreSQL database. It dumps only one database at a time. General syntax:
pg_dump databasename > outputfile

To dump a payroll database:
$ pg_dump payroll > payroll.dump.outTo restore a payroll database:
$ psql -d payroll -f payroll.dump.outOR$ createdb payroll
$ psql payroll
However, in real life you need to compress database:$ pg_dump payroll | gzip -c > payroll.dump.out.gzTo restore database use the following command:$ gunzip payroll.dump.out.gz
$ psql -d payroll -f payroll.dump.out
Here is a shell script for same task:#!/bin/bash
DIR=/backup/psql
[ ! $DIR ] && mkdir -p $DIR || :
LIST=$(psql -l | awk '{ print $1}' | grep -vE '^-|^List|^Name|template[0|1]')
for d in $LIST
do
pg_dump $d | gzip -c > $DIR/$d.out.gz
done
Another option is use to pg_dumpall command. As a name suggest it dumps (backs up) each database, and preserves cluster-wide data such as users and groups. You can use it as follows:$ pg_dumpall > all.dbs.outOR$ pg_dumpall | gzip -c > all.dbs.out.gzTo restore backup use the following command:
$ psql -f all.dbs.out postgresReferences: