Oct 30, 2007

Get Physical File Path, Virtual Directory

oFSO = Server.CreateObject("Scripting.FileSystemObject")
sPath = Server.MapPath("Moozik\")
fRoot = oFSO.GetFolder(sPath)


(web paths, not full physical)

My file: /Test/Myfile.aspx
Virtual directory: /Test/VirtualDir/
Code: Server.MapPath("VirtualDir/")

or if you are in a higher directory:

MyFile: /Test/Something/MyFile.aspx
Virutal: /VirtualDir/
Code: Server.MapPath("../../VirtualDir/")

You are probably just getting the virtual path (the one that gets sent into
MapPath) wrong.

How To Change Vista Desktop Icon Size

Just start using Windows Vista and found the desktop icon is too large which to allow me to put more items on desktops.

so... any of you face the same ?


Solution:

Right-click the desktop, choose View, and choose between "Classic icons", "Medium icons" and "Large icons" (the default is medium).

=)

Crystal Report VS Microsoft Report

Now I develop under Visual Studio 2005 and I use only Microsoft report system.

Those are the benefits I found:

- xml structure, so you can programmatically modify report structure;

- built in support for DataSets as data source;

- good parameters system;

- much faster than CR in rendering (i have reports > 1.000 pages).


Microsoft report system have some never fixed bug, as visual studio 2005, but for my experience is much better than Cr.


Win App Local Application Path

LocalReport.ReportPath = _

My.Application.Info.DirectoryPath & "\Reports\" & "myReport.rdlc"



Where myReport.rdlc is located under Reports folder in my win app program.



Oct 29, 2007

Using Microsoft Report Viewer

Create a Microsoft report:

1. add in a list.
2. add in table
3. drag data from data source to table

Dim voucher As New Voucher
DataGridView1.DataSource = voucher.FillVoucherHeader
DataGridView1.AutoResizeColumns()

DataGridView2.DataSource = voucher.FillVoucherItems
DataGridView2.AutoResizeColumns()

DataGridView3.DataSource = voucher.FillVoucherTotal
DataGridView3.AutoResizeColumns()

Me.VoucherTotalTableAdapter.Fill(Me.cpvdbDataSet.VoucherTotal)
Me.VoucherItemTableAdapter.Fill(Me.dsCheque.VoucherItem)
Me.VoucherHeaderTableAdapter.Fill(Me.dsCheque.VoucherHeader)

Me.ReportViewer1.RefreshReport()

Using VBC Command Line Compiler

Do you ever compile with command line ?

Just recall back Java Learning during university lab.

Let's try:
  1. From the Start menu, click on the Accessories folder, and then open the Windows Command Prompt.

  2. At the command line, type vbc.exe /imports:Microsoft.VisualBasic,System sourceFileName and then press ENTER.

    For example, if you stored your source code in a directory called SourceFiles, you would open the Command Prompt and type cd SourceFiles to change to that directory. If the directory contained a source file named Source.vb, you could compile it by typing vbc.exe /imports:Microsoft.VisualBasic,System Source.vb.

  3. To compile with reference file:
    vbc /reference:metad1.dll,metad2.dll /out:out.exe input.

Oct 28, 2007

Enable Windows Vista Administrator Account

Introduction

If for whatever reason you must login Windows Vista with the Administrator account this guide will show you how it’s done.

Warning: Running as Administrator in Windows Vista bypasses all security (UAC) and is NOT recommended. If you decide to use the Administrator account don’t complain when you start having problems.

Enable the Administrator Account

  1. Open the command prompt with Administrative privileges by opening the Start Menu, type cmd in the search box, and then press Ctrl+Shift+Enter to open cmd with admin rights.
  2. Type the following in the command prompt and press Enter after:

    net user administrator /active:yes

  3. Restart your computer and logon as Administrator.

Note: You might want to set a password for the administrator’s account for at least a little protection.

Disable the Administrative Account

To disable the Administrative account run the Net User command demonstrated above while logged on an account with administrative privileges but not as the Administrator account and replace yes with no.

or

Disable the User Account
To disable the user account run the Net User command demonstrated above while logged on an account with user privileges but not as the Administrator account and replace yes with no.

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

Here is another way!

Remember that cute "Administrator" account you see when you login to safe mode in XP? That's the built-in administrator account that's installed by default, and disabled by default too, after a little digging-in I made this tutorial that'll let you enable and use this account in normal mode, and with a little other tweak, enjoying an XP-like administrator experience, while UAC is left ON (or off, it doesn't matter), but with no prompts or right clicks.


For Windows Vista Ultimate/Business/Enterprise:
1- Click Start, and type "secpol.msc" in the search area and click Enter.
(You may receive a prompt from UAC, approve/login and proceed)

2- In the left list, choose "Local Policies", then "Security Options"

3- Set "Accounts: Administrator account status" to Enabled.

4- Set "User Account Control: Admin Approval Mode for the Built-in Administrator account" to Disabled.


For Windows Vista Home Basic/Home Premium:
1- Click Start, and type "cmd" in the search area, right click on "Command Prompt" and select 'Run as Administrator".

2- In the command prompt type "net users Administrator /active:yes" (Note the capital "A" in Administrator) and press Enter, you will get a confirmation as "The command completed successfully".

3- Click Start, and type "regedit" in the search area and click Enter, navigate to: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]Double click on "FilterAdministratorToken" and set it to "0"

*************************************

Now log-off, and you'll see new account named "Administrator" is available, click on it to login.
Now you are the master of your domain! I recommend if you're going to use this method is to apply it as soon as you do a fresh install of Windows, so you can simply delete whatever administrator you've created in the setup process, and make this one the "real" administrator for your PC, also you can rename this new admin account or change its password like any other account from "User Accounts" in the Control Panel.

A last note/disclaimer:
Please note that disabling UAC and using the built in Adminstrator account will also disable IE7 "Protected Mode", fore more information and a work around please see this post.
Please apply this procedures only if you know what you're doing. Disabling security features in the operating system is not something recommended to the average Joe, and for sure I won't be held accountable for any damaging happens to your system or files resulting from running a full administrator account all the time.


Special thanks to:

- Farstrider for providing the location of the relevant register keys that made applying this method to the home versions of Vista possible!.

- bradavon for his comment/solution of IE7 protected mode.