Sunday, July 31, 2011

Windows 7 : The user profile service failed the logon. User profile cannot be loaded

If there is another administrator account that you can log into, then jump to step 7 after logging into that account.
However, if you can't get to any accounts at all, then start at step 1.

1. Restart your computer and hit F8 multiples times until you see a menu-like screen, if you see the Windows splash screen then repeat this step
2. Highlight and hit enter on Safe Mode with Command Prompt. Try logging in there. If it still doesn't work, then go to step17
3. If you are able to login, once a command prompt pops up, type: net user administrator password /active:yes (you can specify whatever password you want for the administrator account.)
4. If you get a message saying "The command completed successfully", then restart your computer by typing: shutdown -r
5. Boot up again pressing F8, but this time choose just Safe Mode.
6. You will be able to login as Administrator with the password you set in Step 3
7. Hit (windows logo)+R
8. Type regedit
9. Once the registry editor opens up, look for HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
10. In the left pane, find the one that starts with S-1-5..... and ends with .BAK; if you don't find one, skip to step 15
11. Right click it and click Rename, then change the .BAK to .BK
12. Right click the one with the same numbering but without the .BAK and add .BAK add the end
13. Right click the one that you renamed to .BK and clickRename, delete the .BK
14. Eventually, you have switched the .BAK from the end of the second entry to the first. That should probably fix your problem.
15. If you didn't find a .BAK then try this: Open Windows Explorer to C:\Users\Default\AppData\Local\Application Data
16. If you find another Application Data below the one you're on, then delete it. That should probably also fix your problem.
17. If you can't login in Safe Mode, then reboot and hit F8 until you see the menu again, then hit enter highlightingRepair Your Computer
18. Wait until all Windows Files finish loading, then hitNext when it asks keyboard language.
19. Try logging in here also, choose your user from the dropdown menu, and type the password, then jump to step 23
20. If that still doesn't work, then if you have your Windows Installation CD still, put it in and restart your computer.
21. Hit F12 until you see a menu of boot options, choose Boot from CD
22. Choose keyboard language then hit next. Find Repair Your Computer from a little below the center left.
23. Choose Open Command Prompt and type: net user administrator password /active:yes (here again you can specify a password)
24. Close the command prompt and click Restart and jump to step 5

To disable the administrator account, type this in an elevated command prompt: net user administrator /active:no

Source:
http://answers.microsoft.com/en-us/windows/forum/windows_7-security/i-receive-error-message-the-user-profile-service/38844b82-a2c1-4fa2-9802-a5318d6f7831

Friday, July 29, 2011

ORACLE 10G: drop tablespaces

 Dropping a Tablespace: Example

The following statement drops the tbs_01 tablespace and drops all referential integrity constraints that refer to primary and unique keys inside tbs_01:

DROP TABLESPACE tbs_01
    INCLUDING CONTENTS
        CASCADE CONSTRAINTS;

Deleting Operating System Files: Example
The following example drops the tbs_02 tablespace and deletes all associated operating system datafiles:

DROP TABLESPACE tbs_02
   INCLUDING CONTENTS AND DATAFILES;

Source:
http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_9004.htm

Friday, July 22, 2011

Windows XP Batch : reading .ini files

-- settings.ini
; anything after a semi-colon is a comment
; some implementations do not recognize comments, some start them with #
; start a section with a line beginning with a text string inside square brackets
[general] 
key=value  ; data is stored in key/value pairs around an equal sign
; some methods to read INI files require quotes around values with spaces
anotherkey="a value with spaces"
[settings]
force=no
outputlevel=-terse 
 

-- initest.bat
@ECHO OFF
rem %0 is the script file name (with path), %~0 removes the surrounding " " ("%~0" == %0)
rem Adding dp returns the drive and path to the file, instead of the file name itself
set INIFILE="%~dp0settings.ini"
call:getvalue %INIFILE% "outputlevel" "" OUTPUTLEVEL
call:getvalue %INIFILE% "force" "" FORCE
echo outputlevel: %OUTPUTLEVEL%
echo force: %FORCE%
goto:eof
:getvalue
rem This function reads a value from an INI file and stored it in a variable
rem %1 = name of ini file to search in.
rem %2 = search term to look for
rem %3 = group name (not currently used)
rem %4 = variable to place search result
FOR /F "eol=; eol=[ tokens=1,2* delims==" %%i in ('findstr /b /l /i %~2= %1') DO set %~4=%%~j
goto:eof

(Pay special atention to the  @ECHO OFF that the initest.bat file has, because the reference link doesn't have it.)

The result printing is :
outputlevel: -terse
force: no

Reference:

Windows XP Batch: get current directory

Windows XP Batch: getting current batch file name

-- myBatchFile.bat

ECHO %0
ECHO %~n0
ECHO %~nx0
the result when I put in the console C:\test>myBatchFile.bat

Javascript: integer validation

Very useful validation:

 function isInt(x) {
   var y=parseInt(x);
   if (isNaN(y)) return false;
   return x==y && x.toString()==y.toString();
 }

Source:

Wednesday, July 13, 2011

Windows Server 2003: MSVCR71.dll was not found. Trying to start sqldeveloper

Error: This application has failed to start because MSVCR71.dll was not found. Re-installing the application may fix the problem.
Solution:
1. Go to C:\Windows\Microsoft.NET\Framework\v1.1.4322
2. Copy the MSVCR71.DLL to C:\windows\system32

Reference:
http://blogs.msdn.com/b/laurenbo/archive/2009/11/03/php-on-windows-workaround-for-a-command-line-error-msvcr71-dll-is-missing.aspx

Tuesday, July 12, 2011

Windows Server 2003: add remote user

1. Go to start > control panel > system
2. Select the "Remote" Tab and click the "Select Remote Users..." button
6. Click the "Add" button
7. Select the user (remember that you have to put MYDOMAIN\MYUSER)

Windows Server 2003: Set Administrador permissions to remote user

1. Go to start > control panel > system
2. Select the "Remote" Tab and click the "Select Remote Users..." button
3. Click the link "User Accounts"
4. Select the groups Folder (left tree)
5. Double click on the Administrator item on the right.
6. Click the "Add" button
7. Select the user (remember that you have to put MYDOMAIN\MYUSER)