Showing posts with label Code Samples. Show all posts
Showing posts with label Code Samples. Show all posts

Thursday, January 26, 2017

Fixing Domain Trust issues without a reboot

We recently had a domain trust issue involving a production box. Nothing that impacted active users, but a damn annoyance as it restricted access to the server if anything DID go wrong. A reboot would have fixed it, but this is a production box. A reboot wasn't happening during the day.

Fortunately, our network admin had this handy PowerShell command to run to rectify the issue with no service interruptions whatsoever.
Open PowerShell as administrator. Run this command sequence:
$credential = Get-Credential
A window will pop up, type in a Domain administrator account and password.
Then type
Reset-ComputerMachinePassword -Server (Active Directory name).local

Where (Active Directory name) is replaced with the name of your active directory. This required having a local admin account on the system having domain connectivity issues

MSDN has more details on Reset-ComputerMachinePassword.

Monday, December 24, 2007

rsync and cygwin on 2003 Server

I encountered the following error when trying to use rsync to copy data from a Linux server to a Windows 2003 Server running Cygwin:

rsync: Failed to exec ssh: No such file or directory (2)
rsync error: error in IPC code (code 14) at /home/lapo/packaging/tmp/rsync-2.6.9
/pipe.c(86) [receiver=2.6.9]
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: error in rsync protocol data stream (code 12) at /home/lapo/packagi
ng/tmp/rsync-2.6.9/io.c(453) [receiver=2.6.9]


I did a bit of research into running 2003 server and rsync and getting this error. At first I thought it was a security issues, as 2003 server does start off locked down in a way that 2000 server just didn't do.

The search for a security or firewall related cause of the problem was fruitless. I stumbled across a few posts where people were using the Windows command prompt and got rid of the error when they set the appropriate environment variable to point to the SSH binary.

Sure enough, I tried typing ssh at the Cygwin prompt, and it wasn't in the path.

I'd made the newbie mistake of forgetting to install Openssh.

I installed open ssh and the copy command started working just fine.

Thursday, November 1, 2007

Resolving -2147467259 (0x80004005)

I was having a problem. Every time I tried to load an ASP page under IIS in Windows XP, I got the following, obtuse error message:

-2147467259 (0x80004005)

If I ran an iisreset, I would get the following error once, and then the numerical error would resume:

The remote procedure call failed and did not execute.

I used filemon to watch the network traffic, but the closest I came to anything useful was a Buffer Overflow on the ASP page, even when it was nothing more than a Response.Write.

I did some digging and found a reference to this being a problem after installing PHP under Windows. This piqued my interest, because I'd just installed PHP. I tried to unistal it, but got an error that there was a problem with the installer.

Great.

Finally I stumbled across a solution that has restored my ability to run ASP pages locally.

I ran the following commands from the command line:

regsvr32 C:\WINDOWS\system32\vbscript.dll
regsvr32 c:\WINDOWS\system32\inetsrv\asp.dll

Does the PHP install damage the registration of these DLLs? I don't know. I do know things are working and I can move on with my day.

Wednesday, July 25, 2007

Well that was disappointing, I expected better from Yahoo

My Wife and I have a Yahoo group we use for coordinating various family activities, including a Yahoo Calendar. We both have Yahoo accounts we use to log into this shared calendar.

Being the greedy SOB I am, I decided that I wanted to sync this calendar with iCal on my Mac, thus allowing me to sync the calendar data with my cell phone and iPod. The convenience of having the family calendar handy at all times is obvious.

Sadly, I did not find a quick and easy way to automate this process. Sure, I could export the Yahoo Calendar to a CVS file and import it into iCal, but that's a manual process prone to creating duplicates should I do it more than once. I wanted a smooth, seamless integration.

At first I was stymied. The only solution for syncing iCal and Yahoo Calendar data required a cell phone and a "Yahoo 2 go" program which is, sadly, no longer available. Yahoo seems to have dropped support for the utility to sync Nokia S40 phones in favor of a service to sync the higher end "iPhone competitor" phones with Yahoo data. As a result, my phone was too low powered and cheap for Yahoo to deem worthy of syncing.

A little more research turned up plaxo.com, a free service whose goal is to sync data form multiple sources including Yahoo Calendar and iCal data. They claim support for Google contacts and calendar, services, but that appears to be down at the moment.

The problem is that Plaxo only syncs your personal calendar, NOT any group or shared calendars. This is true even if you used the Yahoo Calendar "Time Guides" feature to add other groups to your personal calendar. I can view the calendar data for the shared group just fine, but none of the shared data syncs to Plaxo. I've submitted a bug report on this issue, but have not yet heard back form Plaxo support.

Having gotten thoroughly disgusted with the lack of existing programs, I did what any self respecting programmer would do. I set out to write my own.

Naturally, finding documentation on the Apple Syncing Services, and interacting with the Trusted Data Store used by iCal and other applications was easy. There's a whole SDK for it. It looked like it would be EASY to ahndle this as far as Apple was concerned.

I went to developer.yahoo.com and tried to sign up for an application ID. I was denied.

Even after extensive searching, I couldn't find a Yahoo SDK for interacting with Yahoo Calendar data. While I did find information on a "Desktop" API, Yahoo only makes it available for widget development, and is planning to lock down the API so only signed Yahoo applications can even use it.

Google has a Calendar AIP that's easy to find. Yahoo on the other hand seems determined to keep anyone form doing ANYTHING with Yahoo Calendar data, unless they're using a web browser.

I Could try and write a Yahoo Widget, but it took most of an evening to find out that the Widget API MAY be able to do what I need. I have no interest in investing the time and effort needed to write such a widget only to find Yahoo locks down the API so I can't even use it.

It's clear that Yahoo only wants major players like Nokia to dabble in syncing Calendar data, and even then, they're content to let all but the higher end users with the most expensive phones get to play.

Getting my Google Calendar data into iCal took about ten minutes. After five hours, all I have to show for my efforts to do the same with Yahoo is the hint that it MAY be possible if I write a Yahoo widget to do the work.

If Yahoo only wants users like me to dump CVS files to disk, then they shouldn't be surprised when that feature gets used to switch to Google's Calendar.

Wednesday, April 13, 2005

"Encrption.txt (sic)" in the wild

Regular readers (Do I even HAVE any of those? I doubt it.) Will remember this post about an amusing file found in the IntraLearn LMS.

Here are a couple examples of "Encrption.txt (sic)" in the wild. To check for it on your IntraLearn install, just add /cgi-bin/Encrption.txt to the end of the URL itself, deleting /home/ or other information at the end of the URL.

Why does this file matter? Because it consists of the IntraLearn corporation admitting that it distributes software for which it has lost the source code, and as a result, has no way to know what's really in the files they distribute. Seems the perfect place for someone to have put a back door or logic bomb, doesn't it?

The sad thing is, the code isn't compiled, it's encrypted using the cfencrypt utility that comes with Cold Fusion. A quick web search for cfdecrypt would lead them to a command line utility that would allow them to recover the source code of the offending files.

That's right folks, a quick Google is too complicated for IntraLearn developers.

Please note, an absence of the warning about the files does not mean your version of IntraLearn is magically running code for which IntraLearn has the source.

SiteIntraLearn SiteLink to file
UMass Roxbury http://roxburycc.umassonline.net/home/ View the sample
Enbanet Powered Boston University Site http://216.234.48.127/home/ View the sample

Wednesday, September 1, 2004

List Indexes in SQL Server

Useful Usenet post I found while looking up a problem.

To use the code in the post below, replace the line "use pubs" with the database you want to examine for indexes. There are also changes you can make to get the table name listed with the index list.

Before the Usenet post, I've listed my modified SQL query. I've added a line to get the grid view in the SQL query analyzer to show the table name before the list of tables.


use pubs

DECLARE GetTables CURSOR READ_ONLY
FOR
SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'
AND OBJECTPROPERTY (OBJECT_ID(TABLE_NAME), 'IsMSShipped') = 0

DECLARE @TableName sysname
OPEN GetTables

FETCH NEXT FROM GetTables INTO @TableName
WHILE (@@fetch_status = 0)
BEGIN
select @TableName as table_name
EXEC sp_helpindex @TableName
print 'Table Name =' + @TableName
FETCH NEXT FROM GetTables INTO @TableName
END

CLOSE GetTables
DEALLOCATE GetTables
GO


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

From: BP Margolin (bpmargo@attglobal.net)
Subject: Re: List Indexes
View: Complete Thread (4 articles)
Original Format
Newsgroups: comp.databases.ms-sqlserver
Date: 2001-07-21 13:37:41 PST

Joshua,

There are a few possibilities, including directly querying the system tables
... sysindexes, for example.

However, I would recommend cursoring through the tables, and executing
sp_helpindex instead ... something like:

use pubs

DECLARE GetTables CURSOR READ_ONLY
FOR
SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'
AND OBJECTPROPERTY (OBJECT_ID(TABLE_NAME), 'IsMSShipped') = 0

DECLARE @TableName sysname
OPEN GetTables

FETCH NEXT FROM GetTables INTO @TableName
WHILE (@@fetch_status = 0)
BEGIN
EXEC sp_helpindex @TableName
FETCH NEXT FROM GetTables INTO @TableName
END

CLOSE GetTables
DEALLOCATE GetTables
GO

Note that the sp_helpindex in SQL Server 7.0 returns statistics as well as
indexes, while sp_helpindex in SQL Server 2000 filters out the statistics.

-------------------------------------------
BP Margolin
Please reply only to the newsgroups.
When posting, inclusion of SQL (CREATE TABLE ..., INSERT ..., etc.) which
can be cut and pasted into Query Analyzer is appreciated.

"Joshua Goodstein" wrote in message
news:924a90f8.0106190436.7511c24b@posting.google.com...
> How can i list all particular indexes for a single database. I just
> can't nail it. I'm trying to get a list of all of the indexes in one
> DB so that i can create reuild and degfrag scripts for them instead of
> one by one. Any help would be greatly appreciated
>
> Joshua Goodstein

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