Disable Auto Lock Computer in Windows
I find myself doing this quite often (like a couple of times in a couple of months
) in Windows servers and workstations.
There are a few ways that I know.
Novice User:
If you are on a Windows workstation, you could uncheck the On resume, display logon screen under the Screen Saver Settings as in the screenshot below.
Expert User:
Though that is not the way I like especially on our development servers. Here’s how to do it via the Group Policy Editor (take a few seconds to take effect)
Start –> Run –> gpedit.msc –> Local Computer Policy –> User Configuration –> Administrative Templates –> System –> Ctrl+Alt+Del Options –> Remove Lock Computer –> Enabled
VB 6.0 Watch window – how to view lengthy string values?
Use the Immediate Window instead.
We are in the beginning or re-writing some VB 6.0 code to the .Net framework. Absolute zero business logic known to anybody but the application itself. All we have to do is to trace the VB code line by line, skim the business logic and validation, the program flow out of it, and then come up with a design for the new .Net equivalent.
We will be sitting with the Microsoft Visual Basic 6.0 IDE’s for some part of the day every day, trying to create a test environment with mock data so we could run the VB 6 executable’s code to completion. While we are at it, we will be watching for local variables’ values. Watch window proved to be really helpful, coming from a .Net background, however, when there is a string that is larger than the size of the Watch window itself, and when you try to copy the value out of that variable from the watch window, you’d be seriously disappointed. No matter what you try, all your efforts to copy the entire string value from the watch window will be futile! [Fig 1]
Immediate Window struck me suddenly, that’s it! [Fig 2] type in print variableName and your lives would be spared
[Fig 1] – VB 6 Watch Window
[Fig 2] – VB 6 Immediate Window
In the new era, Visual Studio, we have so many options. The Locals Window, the Autos Window, the Watch Window (up to 4 numbers), the Immediate Window, the debugger tool tip [Fig 3].
[Fig 3] – Visual Studio 2010 Debugger tool tip
TSQL – Change/Alter password for a Login
One of the security policies from Network Security department of any IT organization are to change the password for a SQL server login (or a Windows AD account) once in a year or 6 months.
With respect to SQL server, if the password for a Login named ‘user4RTWP’ has expired after the stipulated time set by the network policies, and when you try to connect to the SQL server using SQL Server Management Studio with the expired password (for the first time after the password has expired), then the SQL Server Management Studio will prompt you with a change password dialog and you could change the password that way.
However, for all our applications using SQL server authentication (to connect to a database to do their jobs) to work properly, we would plan to change the SQL Login password on a specified data before the expiry. This typically involves a downtime from an application’s perspective because
-
When you have changed the password for a SQL Login, then the applications using that SQL Login would obviously fail with the famous ‘Login Failed’.
-
Later you would have to update the application’s config entries with the new password.
In case you wanted to avoid a downtime, it is possible when your database servers are load balanced via clusters. And your application is load balanced via a web farm.
-
While updating the password for a Login in a database, redirect all the database requests to another database server in the cluster. Once done, you can switch back to the original database server in the cluster.
-
Post which, you could stop a particular instance of the application in the web farm, and redirect all the user requests to other servers in the web farm. Once done, you can switch back to the original application server.
Though this might seem like it doesn’t require a downtime, some user sessions and transactions might be interrupted. So it is advisable to have a downtime.
Now, the in TSQL there are a couple of options for changing the password for a Login. Let’s take ‘user4RTWP’ as a Login that needs it’s password to be changed.
sp_password – MSDN says this procedure is deprecated and will be removed in the future versions of SQL server. Albeit, the documentation for sp_password is pretty helpful than compared to the documentation for ALTER LOGIN, where ALTER LOGIN is the preferred way to change the password for a Login.
You could login to the database server via ‘user4RTWP’ with it’s original password (or old password) ‘passwordisabouttoExPiReS00n’ and execute the ALTER LOGIN command as below
ALTER LOGIN user4RTWP WITH PASSWORD = 'neWP@$$W0rD04-13'; GO
This command would work if ‘user4RTWP’ had CONTROL SERVER permissions or a part of sysadmin role. Otherwise is going to throw
“Msg 15151, Level 16, State 1, Line 1
Cannot alter the login ‘user’, because it does not exist or you do not have permission.”
Normally, only the database administrator has that kind of permissions, but a regular SQL Login that is created for the application and developers to use does not have those permissions. Now you are mandated to run the TSQL below, which will run just fine even if you don’t have CONTROL SERVER permissions.
ALTER LOGIN user4RTWP WITH PASSWORD = 'neWP@$$W0rD04-13' OLD_PASSWORD = 'passwordisabouttoExPiReS00n'; GO
In case you wanted to change the password for ‘user4RTWP’ login under the identity of another Login called ‘user4AppX’ , then you would need ALTER ANY LOGIN permissions on ‘user4AppX’.
Hoof, I have been changing these password quite a bit these days.
re-enable hibernation after disc clean up – Windows Vista
It so happens to be that I get BSOD once in a while. It’s been over two years and I have never reimaged my Vista installation. If I had to it would take a week for me to get things back on track. After the BSOD, the crash dump occupies at least 2 giga bytes of hard drive space and I have to run Disk clean up to clear some room.
Everytime I do a Disk Clean up, that’s it Hibernation gets turned off since the disk clean up deletes the hyberfil.sys file (of course I choose to delete the hibernation data). This is such an annoyance and I end up searched for that one line command to enable hibernation back.
powercfg –h on
run it on the command prompt.
Windows 8 God Mode – nice name btw
All of a sudden my Techrepublic subscription had me stare at something for a while. The techrepublic author says ‘difficult’, Scott Hanselman says, they are ‘right there’. They == control panel settings and other administrative activities.
Unlock the God Mode in Windows 8
http://www.hanselman.com/blog/UnlockingWindows8GodModeAUsefulTrickButAlsoMysteriousNonsense.aspx
everybody’s born, is there a difference?
A rather too nihilistic discernment.
Everybody’s born, is there a difference?
In a broad generalization,
Some babies are genetically engineered,
Some babies are planned, conceived and born,
Some babies are residues of passionate love making,
Some babies are the cursed artifacts of filthy unprotected sex!
-rotandripe
you might also find crowd-cattle-and-breed-rate and infant-sorrow-by-william-blake interesting.
She’s your own
Written back in mid June 2012 and performed live on July 2012 at a Social Impact Volunteers’ Day. This one goes to all those poor souls that are in sex trade. Inspired by The Flock, I know who killed me, Taken, Nirvana’s Polly, Seether’s Love her, Bob Seger’s Turn the page, Neil Young’s Keep on rocking in the free world, and here comes rotandripe’s she’s your own. I wish I could direct a music video.
On dark streets played her nights
Roaming in despair cursing her life
Dancing for loony tunes
Sometimes she earned only fumes
Bearing scars under her clothes
Couldn’t confide insults she loathed
—
There she goes, lost her soul
When I asked, she said ‘I am sold’
—
Neither she liked, she got used
Learned to scrape by, her angst reduced
Always broke, she got torn again,
Society never gave her a second chance
Victim of brutality she wept alone,
When you paid she’s your own
—
There she goes, deprived of her soul
When I asked, she said ‘I am sold’
—
She did it for money,
her choice,
Lone and Self company,
she rejoiced
Had nothing to feed her
kid dinner,
No one to care her,
Was she the sinner?
—
There she goes, cries and howls
Hung herself, Death took its toll
—
rotandripe
Enable WCF help page and exception details in FaultException
via config file
<configuration> <system.serviceModel> <services> <service name="HWService" behaviorConfiguration="metadataAndDebug"> <host> <baseAddresses> <add baseAddress="http://localhost:8080/HWService" /> </baseAddresses> </host> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> <behaviors> <serviceBehaviors> <behavior name="metadataAndDebug"> <serviceMetadata httpGetEnabled="true" httpGetUrl=""/> <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> </configuration>
via code
ServiceHost host = new ServiceHost(typeof(HWService)); ServiceDebugBehavior debug = host.Description.Behaviors.Find<ServiceDebugBehavior>(); // if not found, turn the setting on with a behavior if (debug == null) { host.Description.Behaviors.Add( new ServiceDebugBehavior() { IncludeExceptionDetailInFaults = true }); } else { // make sure setting is on if (!debug.IncludeExceptionDetailInFaults) { debug.IncludeExceptionDetailInFaults = true; } } host.Open();
via code (with attribute)
[ServiceBehaviour(IncludeExceptionDetailInFaults=true)] public class HWService : IHWService { //code}
[Image courtesy of