Showing posts with label troubleshooting. Show all posts
Showing posts with label troubleshooting. Show all posts

Wednesday, April 7, 2010

You have requested an outdated version of PayPal. This error often results from the use of bookmarks.

Recently started getting this error when linking to paypal:
You have requested an outdated version of PayPal. This error often results from the use of bookmarks.
Solved it by commenting this line on my code (when setting up the paypal form in GWT):
paypalForm.setEncoding(FormPanel.ENCODING_MULTIPART);
Apparently PayPal recently implemented changes to prevent it from accepting posts with encoding type multipart/form-data.

Hope it helps.

Wednesday, July 22, 2009

IPN delivery failed. HTTP error code 405: Method Not Allowed

I was trying to test a servlet I wrote to process payapal IPN notifications (my servlet is very similar to the jsp in this example) and even after enabling all the IPN settings in the paypal test account the IPN was not firing at all after the payment, or at least so I thought because my servlet wasn't logging anything.

I then found out that in the sandbox you can thest IPN notifications through the IPN simulator, which also gives you handy error codes in case of failed transactions, such as:

IPN delivery failed. HTTP error code 405: Method Not Allowed

Thanks to this I then realized that in my servlet I was only implementing the doGet method but not the doPost. Without the doPost method implemented the servlet won't accept any HTML POSTs, thus the error 405. Implementing the doPost (same code as doGet) method solved the problem.

Morale of the story: Paypal integration can be a bitch.

Thursday, December 4, 2008

[SQLServer2005] computer localhost does not exist on the network

This really bugged me out.

Talking about useful error messages from SQL Server, After installing SQL Server 2005 whatever edition on Vista and setting up a few DBs on management studio I tried to access SQL Server Surface Area Configuration and I got the following genial error message:
"computer localhost does not exist on the network (...)"
this is some epic bullshit, obviously followed by some other useless crap which I won't mention.

This obviously gave me no clue - so just out of curiosity I tried to open SQL Server Configuration Manager and I got another happy error message which makes even less sense:
"Cannot connect to WMI provider"
WTF is this supposed to mean? I have no clue what a WMI provider is. Anyway - the only resort I was left was good old Google. So I started googlin' like crazy and I found some crazy SOAB of an MVP on a msdn forum thread who was trying to convince some indian guy to reinstall Windows and SQLServer. 

I kept looking till I found something that did the trick: 



Apparently the problem is due to some SQLServer installation fuckup with some MOF files.

If you run this in your cmd line it should solve it:
C:\Program Files\Microsoft SQL Server\90\Shared>mofcomp "C:\Program Files\Microsoft SQL Server\90\Shared\sqlmgmproviderxpsp2up.mof"


kick it on DotNetKicks.com

Saturday, September 20, 2008

[.NET] How to send debug text to output (or file)

If you landed here because you want to send debug text to the output console do not worry, it's piss-easy:
//////////////////////////////////////////////////////////
// you can choose between this:
// first par: "a description of the importance of the message"
// second par: text 'category'
Debugger.Log(2, "Test", "this text in the output console - 1");
//or this
Debug.Write("this text in the output console - 2");
//or this
Debug.WriteLine("this text in the output console - 3");
//or this
Trace.Write("this text in the output console - 4");
//////////////////////////////////////////////////////////


Obviously you have to build in debug mode to see any output (if you do not know this you're a really lousy developer && human being).

If you feel sophisticated of you have some obscure reason to send your debug text not only to the output console but to a log file, you do like the following:
//////////////////////////////////////////////////////////
// clean-up the mess
Trace.Listeners.Clear();
//create new listener
DefaultTraceListener yourListener = new DefaultTraceListener();
//add new listener to trace
Trace.Listeners.Add(yourListener);
//set log file path
yourListener.LogFileName = @"log_test.txt";
//send text to console && log file like this
Trace.Write("butchers will be butchers"); 
//////////////////////////////////////////////////////////

In the case above you can use the Debug class the same way you use Trace (so you could write Debug.Write instead of Trace.Write and so on). Difference between the two is that Trace is implemented in Release build as well while Debug only in Debug mode (will be ignored if you build in Release).

P.S. Lately I've been to lazy to properly format the code - suck it up


kick it on DotNetKicks.com

Monday, May 19, 2008

Crystal Reports - Request canceled by user

Problem: You get this error message when programmatically printing a Crystal Reports Report "Error in file [filepath].rpt - Request canceled by user"

Solution: This happens because your default printer is not available - make sure it is online and available.

OK, this post sucks, but eventually it will be useful to someone in trouble with Crystal Reports. By the way Crystal Reports sucks too - if you wanna read about the reasons why chek this post out http://dotnetbutchering.blogspot.com/2008/02/net-vc-7-good-reasons-to-hate-crystal.html .

Thursday, April 17, 2008

[eVC++] Breakpoints could not be moved and have been disabled

Problem: debugging embedded VC++ (most versions) code that's running on a Windows CE device you get a dialog bitchin' about breakpoints could not be moved and have been disabled .

Solution: Go to the Settings of the Project that's using the dll on which the breakpoints are. Select the Debug tab and select from there Additional Dlls, in Local Name specify the local path of the dll, in remote Path specify the path of the dll on the device:
Local Name : C:\Whatever\Util.dll
Remote Name : \WhateverToo\Util.dll

The thing was about to drive me crazy and I know for sure I am not the only one. You could get this error if you're not generating the debug information for the dll as well (in this case go to the project settings and roam till you find a checkbox saying Generate Debug Information - or something like that - and tick it). I tested this on eMbedded VC++ 4, but my guess is it's gonna work no matter what. What's tricky about this is that's almost impossible to google the Microsoft article that tells you how to fix it: http://support.microsoft.com/kb/275560/en-us
Enjoy, and be good butchers.

Saturday, April 5, 2008

[SQL Server 2005] SQL Server 2005 hangs on "Setting [File/Registry ] Security"

Prolem: SQL Server 2005 (any edition including express) installation hangs on "Setting [File/Registry ] Security".

Solution: Either remove the network cable and restart or Go out for lunch and enjoy (it takes ages, 2-3 hours for the whole installation for big networks).

This is a very common problem that occurs often in presence of huge networks (global corporate networks are good candidates); the reason why it all happens seems to be related to some domain resolutions. The installation runs smoothly to this point, then it appears to hang for a long time, so long the temptation cancel the installation is almost irresistible. What stops you from doing it is obviously the fact that from taskmanager everything seems to be just fine. If you let it be for a couple of hours it evetually will finish the installation alright. I am at the moment not aware of other solutions rather than disconnect the machine from the network or - my favourite - go out for lunch, and make sure to have a big one.

Thursday, February 14, 2008

[.NET, IIS] Failed to access IIS metabase

After one year of Apache, Java and PHP, last week I installed on my home server IIS on a different port (getting all together with Apache on port 80) just in case, I thought, I'd have decided to learn some ASP.net...and finally I did.
[.Net, J2EE] A walk from J2EE to .NET: impressions and hopes was a preamble to this kind of experiment.
Anyway I left IIS with an orrifying HTML static page with a list of bullshit about me.

When I started learning ASP.net I had no chance to try some of my new language scripts in my brand new web server, and I found that IIS didn't recognize the header of my .aspx page (XML parsing error)!


<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="CurrencyConverter.aspx.cs" Inherits="CurrencyConverter" %>


I found it is a common problem: you should not install IIS before .NET framework, because it will lose the reference to the brand new .NET framework.

Solution (1): uninstall IIS and reinstall it (from Control Panel -> Install applications -> Windows Components -> IIS, of course in Windows XP).

That didn't work, even if after that IIS answered with a bad error:



It is a "Failed to access IIS metabase" error ... Oh my Gosh!!!
Google helped me again , in few searches.

Solution (2): it seems to be a problem of the .NET 2.0 version. You just need to reset all ASP.net 2.0 registry keys, by moving to your framework directory (usually C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727) and executing:
aspnet_regiis -i
And finally all worked perfectly, with my super useful Currency Converter web application! Thanx uncle Bill!

Friday, January 25, 2008

[VS6] Cannot find [ file path ] (or one of its components) - when opening dsw Workspace

Problem: you get a "Cannot find [ file path ] (or one of its components).Check to ensure the path and filename are correct and that all required libraries are available." error when opening a Visual Studio 6 workspace file.

Solution: delete OPT and NCB files with the same name of your workspace (you find them in the same root folder of the workspace - back them up for safety if you feel so), they'll be re-generated as soon as you open the workspace.

This is one of those nasty ones you could spend a couple of hours on without having a clue. Those two kids just get corrupted sometimes/somehow (especially if you move the project, do some changes on some other machine/environment and then go back to yours). I tried to google it but no luck; just found the microsoft error page ( http://support.microsoft.com/kb/166389 ) which won't help you to solve it. I discovered the solution by empirical method (read RANDOM trials).

Talk Ya'll soon.

Thursday, January 24, 2008

[ASP.NET, SQLServer] How to fix Performance Problems - guidelines

Scenario/Problem: You have an ASP.NET (framework x.x.) application and some pages are taking forever to load up.

Guidelines: Follow these steps:
  1. If using DBs: Are you indexing your DB? If not you should consider it (up to 30% speed increase, depending on you DB design)
  2. Check your controls ViewState: are you sending unuseful stuff back and forth? If you're generating/populating dinamically some control you should disable its viewstate. Use ASP.NET trace to check controls viewstate size (DRAMATIC speed increase, depending on your app)
  3. Look at your T-SQL stored procedures: are you abusing temporary tables or dynamic SQL execution? If so it's not a good idea, use SQL profiler to check for stored procedures recompilation-execution time. If you don't have stored procedures you probably should use them
  4. Look at your code behind: are you round-tripping more than you need? Are you sharing open connections to DB when you can (use SQL Profiler to spot how many connections you are opening and closing)? Are you mis-using some controls (huge drop down list can cause major delays)? Use ASP.NET trace to locate hot-spots and long latencies.

Real World Case: I don't feel much of a butcher these days: I was working on a web app [ASP.NET 1.1, SQLServer2000] developed by someone else and i realized butchery is a fine art and I still got a long way to go.

My main task was to speed things up. It was taking 18 seconds to load a single page, with an average amount of data (nothing major). I first tried to put some indexes on the DB (1), which didn't have any, but not having at the time much experience on DB indexing I put my life in the hands of the Enterprise Manager Index Tuning Wizard (painful experience), knowing it would have butchered my DB, but hopefully just a bit, speeding up things for me in the end. It happened, but from 16-18 seconds the guilty page went down to 12-13, which was something but not what I was hoping. The wizard claimed a 28% speed increase: true, but not enough.

After this delusion, I went on inspecting the trace (enable it setting Trace="true" in the top page declaration, or @ app level from web.config) and I noticed KBytes of useless stuff being sent back and forth as ViewState (2). The app had a coulple of user controls dynamically generated every Page.Load, so I just disabled the ViewState for those (EnableviewState = "false") and the app speed dramatically increased (50% in my case). Good, but still it was taking 6-7 goddamn seconds to load. I also took off the SmartNavigation="true" page property: it might be the pre-AJAX coolest thing but it's deprecated and it saved me almost 2 seconds: down to 5.

I started looking at the code, spotting un-necessary open/close operations for connections that could've been shared, loads of butchery in there, of the finest quality, and I noticed ALL the stored procedures were being recompiled (3) because of a massive use of temporary tables and dynamic SQL, even when non necessary (if the stored procedure is being recompiled there's no gain speed, ergo no point in having it as stored procedure). I didn't really want to change the code, a work of art is a work of art, so I decided to roam a little bit more through the trace looking for hot-spots.

I noticed the page was laoding pretty fast looking at the trace latencies. I put some Trace.Warn("HereandThere") but there was nothing major, the whole page was taking only around 1 sec to process and render, but I was still seeing the content trhough the browser after 5 secs. Then again a look at the ViewState and controls sizes and it happened: I saw a 900KB dropdownlist (4). Turned out that drop down was being populated with more than 10.000 record (yes > 10^4) and the browser was obviously taking forever (around 3 secs) to load it. Took that out (set up a popup with only the dropdown for that selection) and EUREKA: loading time went down to 1-3 secs, which considering shitty server and crappy network is more than acceptable (compare it with 18 seconds if you don't agree).

As I said, there was (and there is) a lot more to change and optimize in this app, as per stored procedures code and code behind, but the art is art and I wanna keep this mess untidy as long as I can, to inspire me and to remind me what butchery truly means.

Friday, December 7, 2007

[VS2005] Project Template(s) Missing

Problem: All of a sudden you notice all or some of you Visual Studio 2005 Project Templates are missing.

Solution(s):

  1. run "devenv /InstallVSTemplates" from Visual Studio command prompt
  2. if the above didn't work, log out and log in as administrator then try again solution 1
  3. if all the above didn't help you , this will do it: Open Visual Studio, in the menu, Open Tools->Options->Projects and Solutions->General. At this point you will notice the path of Project Templates is set to "C:\Documents and Settings\[yourUserName]\My Documents\Visual Studio 8\Templates\ProjectTemplates" or something very similar to that. In order to fix it you gotta set that path to C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\Project Templates or the same path according to wherever you installed Visual Studio.

This extremely annoying thing happened to me twice on different systems, and I think is somehow related to the installation of earlier Ajax.NET VS2005 extensions that somehow is messing everything up (bloody butchers). If you're able to spot Viz template directories, your first temptation would certainly be to copy all that zipped stuff over from the installation folders to the other Document and Settings path: just don't do that, it will solve nothing and you'll eventually end up losing all your templates. This 'cause the templates installation process involves more than just copying the stuff over to another directory. I was able to fix it using methods 1/2 on a system, but not on the other. Notice that with method 3 you are detaching Project Templates from your user account, but if it doesn't bother you and you don't know how or you just don't wanna bother messing with windows accounts, then this is your way to go.

Wednesday, October 17, 2007

[VC++ 6.0] Getting 0xC0000005 Access Violation from CFileDialog - Troubleshootin' ain't no joke

Problem: You get an Access Violation when using CFileDialog and you have the February 2003 Platform SDK.
Solution(s):
  1. Uninstall the Platform SDK *
  2. In VS6 go to Tools->Options choose the Directories tab. Remove from the list the Platform SDK includes and libs folders (if you have a mess in there and you are not able to find the PlatformSDK ones you might wanna leave only the VS98 ones, but you should know this would be butchering) *
  3. Instead of using CFileDialog the usual way (at least the most common) use new and delete operators

*Remember to do a good Rebuild All, otherwise it would keep going with the old headers.

Another gift from our MS butchers here. This problem seems to be related to some member of some struct in some header of the Platform SDK which doesn't match with the header shipped with VC++. Quoting from one of the forum buddies "the OPENFILENAME-struct is longer in the header-file of the SDK than in the header-files shipped with VC++. So a memset(&m_ofn, 0, sizeof(m_ofn)); overwrites some data which leads to a crash", or something like that.

This is a tricky one because actually it will take you some time to figure out that the Access Violation is related to the CFileDialog (you wouldn't think of that, why should the CFileDialog stop working like that?). Moreover, if you have the Platform SDK installed since a long time definitely you wouldn't connect the three elements: Platform SDK - CFileDialog - Access Violation. It could be a known issue (it is indeed), but if you google just Access Violation you will obviously get a helluva result set.

A bit of a pain in the ass I'd say.