Cracking Encrypted Footers in Wordpress Template
I’m all for giving credit where credit is due, but when a Wordpress theme encrypts the footer so they can advertise and siphon off your hard earned pagerank to payday loan and debt reduction websites well that crosses the line in my book. So in this particular Wordpress template I’m working with, when I go to the footer file in this theme I love, all I get is an encrypted file. If I remove the encrypted code, the style of the blog goes all haywire. So how do we get around that encrypted coding? Quite easily in fact. Go to your Main Index Template file under Appearance > Editor in your Wordpress admin panel and wrap the getfooter() element at the bottom of the page in start and end html comment tags. Save it out then go over and refresh your blog. Do a quick View Source then scroll to the bottom of the html. Lo and behold between your start and end comment tags there is the html that has been encrypted from your view. Copy that block out and use it to replace the encrypted block in your Wordpress footer file (make sure you backup that encrypted code in case you would need to revert back to it at a later date). Save that out and your your page should look the same when you go back and refresh. Now go into the footer file and edit out those obnoxious Payday Loan links, but leave in the design credit. Even though the designer was trying to promote their unscrupulous sites on your blog, they did put the time and effort into designing the template used to present your ideas to the world so its only fair to give credit where credit is due.Find All Cookie Values in a Given Application via ASP.Net and c#
Cookies can be especially maddening at times if you don’t know what values are being stored within them. The following simple script is written in csharp and ASP.Net and allows you to see all of the cookies currently hanging around under a given application. Pretty handy when trying to fish yourself out of a problem.
Error Message: Could not find file ‘c:\windows\system32\inetsrv\System.Xml.XmlDocument’.
Someday I’ll free myself from the XML hell I seem to be mired in, but that day is not today. So I’ve got a fun new issue. The previous coder stored all the user entry values in session values without thinking about the fact that this won’t run correctly once it goes live in the web farm. So now I have to switch all those values over to be stored in the cookie and a few in the database that need to be secured. So in my haste to switch everything over, I ran across the error message “Could not find file ‘c:\windows\system32\inetsrv\System.Xml.XmlDocument’.” Huh? All I’ve done is try to store the Xml string into a XmlDocument object like so:
After pondering and tinkering with this for the better part of 30 minutes, it finally occured to me. The Load method of XmlDocument is used to access an Xml file on the server whereas the LoadXml method is used to load a previously defined Xml string. Popped that in, and it worked like a charm. Now what is my next error?
Google US Search Listings Versus Google Canada
I was reviewing my traffic logs this afternoon and I noticed a couple of my sites have risen up the ranks to number 3 on their key respective search term on Google — Canada? Hmmm…when I look at the main Google US site the websites in question are ranking 8 and 11. Not bad mind you, but why would Google Canada think so much more highly of these domains than its US counterpart when they are hosted in the US and there is nothing Canada specific about them (they are pretty generic and all country friendly actually)? Google’s search algorithm is the ultimate black box so who knows for sure, but I did run across this interesting article breaking down what could be influencing its decision at NVI Solutions. Check it out.Navigating to a Sibling Node via XPath
So I’m in an XSLT stylesheet, and I’ve navigated my way down to the node level. Now I’m trying to traverse my way down to the next sibling node and get an attribute out of it. Something like the following:
Not the best XML structure in the world, but what do you do when you have inherited code? After a long time of searching and trying out about 20 different possible iterations, I found the best solution to be:
For a quick translation, we are currently at the question node from the XML sample above, looking to step down into the answer node to get the text value. The second XSLT code block’s select statement tells the routine to get the following sibling node ‘answer’ even more specifically the first answer node following the question node. From there, we just reference the text attribute within the node.
Subtracting Dates in C#
I’ve got an exam application that has a fixed time limit and relays the clock winding down to the test taker via an AJAX call. So we know what time it is now (DateTime.Now), we know when we started the exam (set value in session) and we know the time limit of the exam (pulled from the database). How do we bring it all together? We have to figure out our finish time by running the AddMinutes method against our exam beginning DateTime value, adding our predefined number of minutes set in the time limit. Next, we simply subtract our begin time from our finish time, and that leaves us with a TimeSpan value. The only thing remaining is to do something with that TimeSpan value. It has a host of methods for conversion, but we are going to run the TotalMinutes method this go around to get us the countdown value. Maybe not as simple as VB’s datediff, but simple enough.Get User Name for NT Authentication in C#
Lots of systems sit behind an NT Authentication wall to keep the unwanted users out, but does it really do you any good if you don’t know which user made a given update to a system. Also this is good if you want to give a certain user administrative privledges, displaying certain functionality while hiding it from the rest of your users. The easiest way to get at that piece of information is to jump down into the System.Security.Principal.WindowsIdentity class and hit up the GetCurrent().Name method. Note this will pull back the user name preceeded by the domain they are logged onto so to ditch that you’ll just need to clean it up with a Regex statement (ex: Regex.Replace(sNTUser,”DOMAINNAME.”,”"))
Adding Project to Source Control in Visual Studio
This is probably old hat to most here, but Source Control is still fairly new to me within the context of Visual Studio. Case in point, I was trying to take a local project I had developed on my box and integrate it into a solution already created on the Team Foundation Server. I checked the solution out then I was dead in the water. It seems the key is to right click on the name of your project in the Solution Explorer window then select ‘Add Solution to Source Control.’ Now all you need to do is check in your changes and you are set.SQL Server Noise Words
If you do FULLTEXT searches in SQL Server, you are very aware of the limitations of noise words. Noise words are basically words that get dropped from the query. They are like common articles like ‘a’, ‘an’, etc. These words are contained in the file c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\FTData\noiseENU.txt (path may vary based on your directory setup). Here is the full list if you are looking to see if one of your terms is getting dropped
| about 1 after 2 all also 3 an 4 and 5 another 6 any 7 are 8 as 9 at 0 be $ because been before being between both but by came can |
come could did do does each else for from get got has had he have her here him himself his how if in into is it its just like make many me might |
more most much must my never no now of on only or other our out over re said same see should since so some still such take than that the their them then |
there these they this those through to too under up use very want was way we well were what when where which while who will with would you your |
