Monday, April 15, 2019

Where is the Template MRU in VS 2109?

In the latest version of Visual Studio, there is a new bug called the Start Window. It is a modal dialog, which is a bad thing, but not the subject of this post. This post is about the list of most recently used templates. If you want to try out some of the new things this release offers, you make projects you would never make otherwise. All these templates get added to the MRU list, thus obscuring the templates you normally use day in and day out. And guess what. There is no way to remove them. There is no right-click option to "remove from this list."

So I wondered where VS keeps this list. I remember from several years ago that the MRU files were kept in the registry. So I looked in the registry.

The registry for VS 2019 (v16.0) is almost empty. Whereas, earlier versions had a full 1.5 tons of stuff, there is almost nothing in the registry anymore. So after poking arount on the Internet for a while, I came up with this procedure for finding that list. It is not nearly as easy to edit this list as it was to edit the older ones. But anyway, here is what I did:

Close all instances of Visual Studio

Open Regedit

Select HKEY_USERS

Select File -> Load Hive...

Navigate to this file and select it:

"C:\Users\weblum\AppData\Local\Microsoft\VisualStudio\- 16.0_d9ee1292\privateregistry.bin"

or its equivalent on your machine.

Name it something. E.g., VS2019Private

It appears in the Regedit window. Navigate to this key

HKEY_USERS\VS2019Private\Software\Microsoft\VisualStudio\- 16.0_d9ee1292\ApplicationPrivateSettings\VS\IDE\Platform

This key has one value named ProjectTemplateMru. Its data is a REG_SZ containing a JSON object like this:

1[{...}, {...}, {...}]

The objects in that array are the entries. I don't know what the leading "1" is.

While you have this hive mounted, you cannot use Visual Studio. Select the key you added, (e.g., VS2019Private) and select File -> Unload Hive...

Reopen any Visual Studio instances you want.

Monday, July 09, 2012

Too Much of a Good Thing

Hello. I would like to thank the spammer who has been hitting this blog repeatedly from three to five times per day for the past month or so. Of course, this thanks is "in absentia" because naturally the spam is automated, and no human related to the spammer will actually read this post.

So anyway, the reason I am grateful is because without this priceless spam, I probably would have gone even longer without posting here.

However, I have taken bold action to stem this beneficial tide of comments. Now nobody is allowed to comment on this blog unless they log in. At least, I think that is what the radio button means. I do not know whether this will really do any stemming or not, but I expect to find out soon enough.

That is all. Over and out, ten-four.

Sunday, September 19, 2010

Common Web Site Errors

In a recent article at simple-talk, the author, Jeremy Jarrell, says this:

Earlier this year the SANS Institute released its 2010 edition of the Top 25 Most Dangerous Software Errors…sort of a ‘Greatest Hits’ of epic failures in software security. What’s so disturbing about this list is that even though it’s updated every year, the vast majority of errors can easily be avoided with just a bit of forethought.
Then he mentions one of the top errors:

...would it surprise you to know that the #11 programming error of 2010 was “Use of Hard-Coded Credentials”?
"Use of hard-coded credentials?" But I always hard-code the MySQL user's password in my Python CGI scripts. Maybe I should fix that. So, since this error should "easily be avoided with just a bit of forethought," I decided I would try to avoid hard-coding the MySQL user's password in a Python CGI script.

My conclusion: The reason this is such a common error is that all the advice on the Internet urges you to do it this way. In fact, there does not appear to be any alternative to doing it this way.

Here are some of the sites I visited, and how they suggest connecting to a MySQL database in a Python CGI script.

Of course, I am probably just too simple-minded to find the real answer. So you guys out there that know how to do it should let me know. Thanks.





The following sample is provided at
http://www.tutorialspoint.com/python/python_database_access.htm
The password is "test123"

#!/usr/bin/python

import MySQLdb

# Open database connection
db = MySQLdb.connect("localhost","testuser","test123","TESTDB" )





The following sample is provided at
http://mysql-python.sourceforge.net/MySQLdb.html
The password is "moonpie"

#!/usr/bin/python
import MySQLdb
db=MySQLdb.connect(passwd="moonpie",db="thangs")





The following sample is provided at
http://www.devshed.com/c/a/Python/MySQL-Connectivity-With-Python/2/
The password is "secret"

#!/usr/bin/python
# connect
db = MySQLdb.connect(host="localhost", user="joe", passwd="secret",
db="db56a")





The following sample is provided at
http://www.palewire.com/posts/2008/04/26/python-recipe-connect-to-mysql-
database-execute-a-query-print-the-results/
The password is "password"

#!/usr/bin/python
host = 'localhost'
user = 'user'
password = 'password'
conn = MySQLdb.Connection(db=database, host=host, user=user, passwd=password)
mysql = conn.cursor()





The following sample is provided at
http://www.cs.wisc.edu/twiki/bin/view/CSDocs/MySQLDatabaseServiceInfo#Python
The password is "database user password"

#!/usr/bin/python
#!/s/python-2.5.2/bin/python
import MySQLdb
db=MySQLdb.connect (host='mysql.cs.wisc.edu', user='database user',
passwd='database user password', db='database')





The following sample is provided at
http://www.howtoforge.com/creating-advanced-mysql-based-vhosts-on-lighttpd-debian-etch
The password is not evident from this code. However, it will only be secure if executed from the command-line, where a real human being can supply the password as the third argument to the script. If this script is called from a CGI script, then the third argument will have to be embedded in the CGI script code. So this sample does not really solve the problem; it just pushes it back by one layer.

#!/usr/bin/env python
import sys
import MySQLdb

# load configuration data from the database
db=MySQLdb.connect(host='localhost', db=sys.argv[1], user=sys.argv[2], passwd=sys.argv[3])
cur = db.cursor()
cur.execute("SELECT * FROM domains")
rs=cur.fetchall()
db.close()





The following sample is provided at
http://www.devshed.com/c/a/Python/Database-Programming-in-Python-Accessing-MySQL/1/
The password is "adm1n"

db= MySQLdb.connect(host=’Demo’, user=’root’ , passwd=’adm1n’, db=’test’)





The following sample is provided at
http://docs.webfaction.com/user-guide/databases.html
The password is "averysecurepassword"

import MySQLdb
db = MySQLdb.connect(host='localhost',
user='user123_mysql_db',
passwd='averysecurepassword',
db='user123_mysql_db',)
cursor = db.cursor()
cursor.execute("""SELECT * FROM names""")
result = cursor.fetchall()
print result





The following sample is provided at
http://bytes.com/topic/python/answers/868294-encrypt-password

The password is not evident from this code. Unfortunately, this code does not actually work unless a .my.sql file is set up for user "root", and the current user is named "root". This example is taken from a Tkinter GUI app, not a CGI web app.

import MySQLdb
import _mysql_exceptions as DB_EXC
from hashlib import md5
cxn = MySQLdb.connect(user ='root')
cur = cxn.cursor()

For example, if you set up a specific user for the database, and code this in your CGI script:

conn = MySQLdb.connect(host='localhost', user='expense_user')

The script fails with the following message in the Apache error.log:

1045, "Access denied for user 'expense_user'@'localhost' (using password: NO)"





P.S. added at 1:45, Monday, September 20. Of course, almost as soon as I posted this I happened across a book with the answer:

MySQL Stored Procedure Programming, 1st Edition

Look in section 16.2.1, Creating a Connection. I have not tried the suggestion, but it looks promising.

Tuesday, November 10, 2009

Your Computer Has Just Crashed

I'm up to the tenth day of Windows 7. Windows 7 is pretty good. There is one new feature that annoyed me a lot at first. Now it is beginning to entertain me. Which new feature? Show Desktop.

They've move the Show Desktop feature from near the left edge of the task bar to the extreme lower right-hand corner of the screen. I'm sure the acceptance of that change will be vitally linked to how each user deals with his computer.

I, for example, have a tendency to start typing in a window and finding that the mouse cursor is in my way. In fact, I am so accustomed to finding the cursor to be in my way that I automatically hurl the mouse off to the side so I can type without the distraction. I no longer even think about it ... as soon as I start to type, the mouse gets thrown out of the way.

In past operating systems, the mouse would end up in the extreme lower right-hand corner of the screen, where it would not cause anybody any trouble. In Windows 7, that is still partially the case. That is, it still ends up in the extreme lower right-hand corner of the screen. The difference is that it now causes me a lot of trouble.

Since the extreme lower right-hand corner of the screen has become the Show Desktop location for Windows 7, as soon as I start to type, my window disappears. In fact, all the windows disappear. My gut reaction (and I do mean my gut) is that all the windows have gone away, so the computer must have crashed. In fact, my stomach usually does a little bounce when this happens. The first time it happened, I was sure for probably 30 seconds that all my work for the past week had been deleted.

Nowadays, after about 900 milliseconds, I realize what has happened. It is getting to the point that I actually chuckle at my reaction. Then I nudge the mouse back up out of the corner and go on about my business.

I have experimented with turning off this feature. But I still find it useful to be able to make all the windows transparent. So I end up turning it back on again. Then I'll get snookered again, and the cycle continues.

Labels:

Wednesday, February 04, 2009

Microsoft Makes Me Want to Puke

Rapacious, greedy, self-serving, anti-social company. Microsoft has thousands of developers out there who are selling their products. I was recently told by a prospective client that he would prefer to have his web service coded in LAMP, but he would consider a Microsoft platform. I told him I would prefer to code on a Microsoft platform.

To me, that is selling for Microsoft. But what happens when I want to go to VSLive! San Francisco? I'm told I have to cough up $1695 for the privilege of learning the product line. For the privilege of selling for Microsoft. That makes me want to puke. End of rant.

Thursday, June 12, 2008

My Neurons Lack those Synapses

Well, Mousketeers, here's a little Wpf 'n' Proof you probably didn't ever think about. What does hit testing have to do with moving the mouse? I just got a strong Wpf of illogicalitude, to me anyway.

There is on any Wpf control a method called OnMouseMove. You get this event "when the mouse pointer is moved over the control," is says in the docs. It doesn't mention any time when you might not get this event when the mouse moves.

There is a property of UIElement called IsHitTestVisible. This determines "whether this element can possibly be returned as a hit test result from some portion of its rendered content." So, you might call canvas.InputHitTest(mousePoint) to see what control the mouse is over. If there were some controls you did not want this method to return, you could set IsHitTestVisible false on them, and then you would not have to write the extra logic in your code.

Well, surprise. If a control is not hit-test visible, it also does not generate mouse move events. So if you have mouse-tracking code running, it is as if the mouse disappears whenever it is over those controls you don't want the InputHitTest to see.

To me, those two things are (or should be) separate concepts. Mr. Gates disagrees.

Tuesday, April 15, 2008

Best Company in the World, Part 2

In Part 1 you will remember that I was telling you that Microsoft was a great company because they actually answered my question. That was nothing. Anybody can answer your question when you ask one.

This time they did one better. They answered me when I didn't even ask the question. In my post last night I was grousing about Cider and how I couldn't drag a control onto a form. I did not do what a normal programmer would do and search the Microsoft forums to see if there was an answer to this problem. I just kinda sat there and bawled.

But Microsoft was not content with that. They sought me out and fixed my problem despite my own infantile attitude. Two separate Microsoft employees posted comments on my blog. One was a member of the WPF & Xaml Language Team, and the other was the lead developer on the WPF Designer (Cider). You can read their comments yourself on my previous post. Rob Relyea and Marco Goertz.

Now I want to know how they found the post so quickly. The Google bots would have to be awfully quick to pick it up so soon. No, I have to believe that my blog is required reading for all Microsoft employees. I'm on all their RSS aggregators. Bill Gates asks about me every morning. He says, "Well, how's Bill doing this morning. I mean the other Bill."

So clearly I'm going to have to raise the bar here. Next problem I have, I'm not even going to blog it. I'll just close my eyes and think real hard and see if I get an E-mail from Microsoft the next day. Course, that's not nearly as much fun as moaning on my blog.