Issue with Joomla! – Administrator links redirecting to site root

I was setting up a Joomla! site for a client when I kept having an issue with the Administrator site. Every link in the administrator areas would redirect me to /index.php. I just about went crazy trying to find the answer.

It turns out that the $live_site variable in the configuration.php file had a value in it. I set this variable to be a blank string and everything started working as it should.

Refactoring some common VB.NET Code

One of my tasks at work is to maintain a few VB.NET applications written before I started working here. I’ve had the opportunity to learn a lot about large websites using VB.NET.

I thought I’d take a few moments to point out some common refactoring that you can do to shorten your code when dealing with If statements and boolean assignments.

Let’s start with a line of code that appends some text to an existing string if certain conditions are true.

This is simple enough, but it’s a bit redundant. Let’s look at another way of expressing this.

This uses the &= operator which just tells VB to append whatever follows to the variable on the left. We use IIf to determine what value to set based on the state of the checkbox.

Another common situation is using the value of a variable to determine the state of a boolean property. Here is some code to illustrate the “old” way:

This has some redundant code in it that is begging to be refactored. Let’s take a look at how we can accomplish this same amount of logic in a single line of code:

This tells VB to set the Visible property to the boolean value of the result of the expression to the right of the first = sign. VB will then evaluate the expression Mid(C1, 40, 1) = “Y” to come up with either True or False, which it will then assign to the Visible property. So, if Mid(C1, 40, 1) = “Y”, then the Visible property will be set to True.

Instead of using “Flags” (Dim myFlag as String = “Y”), try using Boolean values instead. “Y” and “N” are strings and must be manually converted to a boolean when setting properties. I’ve never seen a control use a “Y” or “N” as a property setting. They use True and False.

If you need a flag with multiple values, create an Enumeration like so:

Then, just use it in your If statements:

Check out Microsoft’s documentation on Enumerations. They are very useful.

http://msdn.microsoft.com/en-us/library/8h84wky1.aspx

VB.NET brings with it so many improvements to the Visual Basic language of days-gone-by. It’s worth it to get out there and experiment a little. Try something new. Don’t settle on what you remember doing from your old VB 6 days.

Remote Debugging Issue with ASP.NET – Unable to attach to the process

I have been trying to get remote debugging working on one of our servers so we can share the development work on a WebAPI and I kept getting the following error message on my Visual Studio 2013 Attach to process dialog:

“Unable to attach to the process. The RPC Server is unavailable”

It turns out that all I had to do was add C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe to the Firewall allow list.

I knew it had to be something with the firewall, but I was trying to discover which ports the remote debugging RPC was using so I could open them. All I had to do was add the whole process and everything worked.

Now I can happily debug the code on my server.

X-Wing

X-Wing Miniatures Game

I finally bought my own copy of the X-Wing miniatures game yesterday.

Laurie was kind enough to play with me last night. It turns out she really enjoyed the game so I’ll probably get to play more of it in the future.

There’s an active community of X-Wing players here in Savannah and an even bigger group in Statesboro, GA (about an hour away) near Georgia Southern college.

There are a few tournaments each year as well if I ever get good enough for competitive play. I’m still learning the full rules but so far I really enjoy the game.

random musings

Follow

Get every new post delivered to your Inbox.