Thursday, 5 November 2009

Windows 7: System crashed, lost administrative privileges to exfat drive

I'm running Windows 7 RTM, computer just crashed an hour ago and have noticed that I've lost write access to my D drive formatted in exFat, what gives??

Seems like the entire partition has been reset with a readonly flag.

Seen a couple of solutions on the net.

Try running a new command window in elevated mode, change to drive and run "chkdsk /f".

Or try using diskpart > select disk xx > select vol xx > att vol clear readonly

The diskpart didn't work for me, but chkdsk worked!! Sigh... haven't had to do chkdsk since windows98.

Wednesday, 21 October 2009

MS Outlook: Not retrieving your style sheet

Scenario:

Have created a tool that generates a HTML email.
HTML email has references to Custom Style Sheets hosted on the corporate intranet.
The email is sent company wide to own domain and also to a child company with its own domain.
Cross domain trust is limited but the child company is able to access the parent intranet.
The email renders correctly on parent domain, but on child domain none of the styles came through.

Fix:

Seems like outlook was the culprit, and was blocking scripts on the email. This includes my reference to the stylesheet on the parent domain.

Needed to modify outlook to add sender as a safe sender in the junk mail filter list.

Steps to do this are outlined here:


Once the sender was added to the safe sender list, the email renders correctly.

If you double click on the email and click on "View" > "View in internet zone" the styles should also become visible.

Thursday, 8 October 2009

Active Directory: Query convention

Using ADs path format:
LDAP:<//server/o=organization/ou=site/cn=recipients>;
(objectClass=*);ADsPath,objectClass,cn;subtree"

Attribute name format:
<LDAP://server/cn=recipients,ou=site,o=organization>, _
(objectClass=*);ADsPath,objectClass;subtree

SAMPLE CODE:

Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset

Set conn = New ADODB.Connection
conn.Provider = "ADSDSOObject"
conn.Open "ADs Provider"

Set rs = conn.Execute( _
"<LDAP://server/o=organization/ou=site/cn=recipients>;" _
& "(objectClass=*);ADsPath,objectClass,cn;subtree")

While Not rs.EOF
Debug.Print rs.Fields(0).Value, rs.Fields(1).Value, _
rs.Fields(2).Value
rs.MoveNext
Wend

conn.Close

Thursday, 1 October 2009

Javascript: Prevent editing in file input fields

add the following properties:

oncontextmenu='return false' onkeydown='this.blur()'

Wednesday, 30 September 2009

Flash: Allows flash to layer under div elements

You can do it by placing

<param name="wmode" value="transparent">

in your flash area. You will also need to add

wmode="transparent"

to the "embed" area of your flash.

Friday, 18 September 2009

CSS: Z-Index law

Z-index will only work if a position attribute is applied to its elements.

CSS: Z-Index and getting around IE6 lack of support for this property

This is an interesting post to get around IE's bug when applying z-index to elements.

http://www.macridesweb.com/oltest/IframeShim.html

The idea is to wrap an Iframe around your element where z-index is required.

For transparency apply the alpha filter to make the actual iframe transparent. Even though its transparent, it will still hide IE's window elements e.g. select boxes away from view.

iframe.style.filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';

Wednesday, 16 September 2009

Batch Scripting: Environment Dates

Encountered a funny issue in our staging environment.
Seems like the environment date - %date% is user profile dependant.

If I run echo %date% using my account - I get 16/09/2009
If I run echo %date% using a service account - I get Wed 16/09/2009

Workaround is to strip the dayofweek from the above dates and then split each day, month and year component from the and reassemble each component manually.

For /F "tokens=1-4 delims=/ " %%i in ('date /t') Do (
Set _1=%%i
Set _2=%%j
Set _3=%%k
Set _4=%%l
)
:: Assign to datestamp and split out each date component to associated variable
:: Check for case when date stamp doesn't include day of week
If (%_4%)==() (
Set _datestamp=%_3%%_2%%_1%
Set _year=%_3%
Set _month=%_2%
Set _day=%_1%
) else (
Set _datestamp=%_4%%_3%%_2%
Set _year=%_4%
Set _month=%_3%
Set _day=%_2%
)

Monday, 10 August 2009

IIS: Resyncing Anonymous User Account Password

This error can occur if the password for the user account that is used for anonymous access in IIS is not synchronized with one of the following passwords:
  • The password for the user account in Active Directory
  • The password for the user account in Local Users and Groups
To synchronize the IIS password with the password that is used in Active Directory or in Local Users and Groups, follow these steps:

1. Click Start, click Run, type cmd, and then click OK.

2. Use the cd command to connect to the folder where the Adsutil.vbs file is located. By default, the Adsutil.vbs file is located in the following folder:
drive:\Inetpub\Adminscripts
Note drive is the folder where Windows is installed.

3. At the command prompt, type Cscript adsutil.vbs get w3svc/anonymoususerpass, and then press ENTER. Note the password that is generated.

Note You may have to set the Issecure property in the Adsutil.vbs file to False before you generate a password. To do this, follow these steps:

a. In Notepad, open the Adsutil.vbs file.
b. On the Edit menu, click Find, type IsSecureProperty = True, and then click Find Next.
c. Change “IsSecureProperty = True” to “IsSecureProperty = False”.
d. Save the changes, and then close Notepad.

4. Click Start, click Run, type Dsa.msc, and then click OK.

Note If the Web server is a stand-alone server, type Lusrmgr.msc.

5. Expand the domain that you want, and then click Users. If the Web server is a stand-alone server, click Users.

6. Right-click the user account that you want, and then click Reset Password or Set Password.

7. Type the password that you obtained in step 3 two times, and then click OK.

http://support.microsoft.com/kb/909887