July 25th, 2008

How to rename a column in Sybase ASE

Today I needed to rename a column in a Sybase ASE 12.5.1 database, and couldn’t seem to find the right syntax. My first few search results gave me syntax that was not actually relevant for my database. Two different pages led me to believe that some variation of this might work:

ALTER TABLE [table_name] RENAME [old_column_name] TO [new_column_name]

But that did not work for me. Upon closer inspection, I noticed that those two pages were for Sybase ASA, not ASE. I refined my search terms a bit, and found this:

sp_rename ‘[table_name].[old_column_name]’,'[new_column_name]’

Thanks to Rob Verschoor for posting this on dbforums.com!

December 27th, 2007

A couple of lesser-known Windows-key shortcuts

I’m a die-hard keyboard user, and always like to know when there’s a keyboard shortcut to accomplish something that might otherwise take a few strategic mouse clicks. The Windows key, while a bane to gamers’ existence, actually provides us with some useful functions.

I’ve known about several Windows key shortcuts for years, but there are a couple that I learned about more recently (sometime in 2007, I think), which I now use on a daily basis. The title of this post refers to these as ‘lesser-known’, but I base that purely on the fact that *I* did not know about them, not on any sort of user experience testing or published statistics.

Windows-D: Show Desktop

Hides all open windows, bringing the Windows desktop to the front. This duplicates the functionality of the ‘Show Desktop’ icon that exists in the Quick Launch toolbar by default, and the ‘Show the Desktop’ option in the context menu that appears when you right-click the taskbar. It does not actually minimize the other windows, and those windows can be re-focused via Alt-Tab or by clicking their taskbar entries.

Windows-L: Lock Computer

This duplicates the functionality of the ‘Lock Computer’ button in the Ctrl-Alt-Delete Windows Security dialog. On Windows XP systems that use Fast User Switching, it takes you back to the screen that lists user accounts.

I make it a habit of hitting Windows-L whenever I’m done using my PC at home, so that when my wife sits down to use it, she can just click her name and login (or resume her existing session). At work, it’s always a good idea to lock your computer, so I hit Windows-L whenever I get up to leave my desk.


Now, here are a few more well-known (i.e. I’ve known about them for a long time) ones:Windows-M: Minimize AllThis minimizes all open windows. Programs that hide out in the system tray when you minimize them will be sent to the system tray. Everything else will be minimized to the taskbar. This has the same effect of clicking the ‘Minimize’ icon in the top-right corner of all of your open windows.Windows-F: Search for Files and Folders

This pops up the Windows file search feature. This duplicates the functionality of clicking the Start Menu, clicking the ‘Search’ menu option, and clicking the ‘For Files or Folders…’ sub-menu option.

Windows key (by itself): Open the Start Menu

This pops up the Start Menu, just like what happens when you press Ctrl-Esc or click the start menu. I use this all the time.


Please note that I’ve still never used Windows Vista, so I am unfamiliar with any Windows-key shortcuts which may have been introduced with it. The shortcuts I’ve described, above, are valid in Windows XP Professional (and most of them were usable in previous versions of Windows as well). I did read about a change to the way the Start Menu works, in Vista, with the introduction of a smart search box.

If you know of any useful Windows-key shortcuts that I may have missed, for ANY version of Windows, please leave a reply and let me (and other readers) know!

November 25th, 2007

Uniden cordless phones: How to prepend a 1 to a phone number in caller-id

Uniden TRU9280-4 cordless phone

Lacey and I have had a several different sets of cordless phones over the past 8 years or so. They’ve all had caller-id, and we’ve moved from 900mhz->2.4ghz->5.8ghz.

When I say “sets of cordless phones”, I’m talking about cordless phones that come with two or more phones (and charger cradles) in the box, and only one of the bases needs to plug into the phone line wall jack. The other bases just need to plug into the AC power outlet.

Two or three of those sets were made by Uniden, and I recently re-learned how to do something that I haven’t had to do for a long time. When I wanted to dial a long-distance number that was in my caller-id list, I needed to put a ‘1′ in front of it.

So, I first tried using the directional pad, hoping I could just move the cursor all the way to the left, and then push 1. But the left side of the directional pad is a global hotkey that opens the Phone Book.

Next, I opened the phone’s “Settings” menu, and looked for an option to automatically put a ‘1′ in front of long-distance numbers. Some of the other phones we’ve had allowed you to configure that, but this one did not.

After looking through the settings, I decided to try pushing the button that our last set of phones used for toggling the ‘1′ prefix. With our previous set of phones, if you did not configure them to automatically put a ‘1′ before phone numbers in the caller-id when the area code was different from the one you were calling from, you could toggle it by pressing the pound (#) button.

But, that didn’t work. So I went online and googled for something along the lines of ‘uniden tru9280-4 how to add a 1 before calling from caller id’. I did not get (m)any results, though, so I kept trying variations of that, but never ran across the result I was looking for.

Finally, I went to Uniden’s website, and found the manual for the Uniden TRU9280-4. In the manual, in the section called ‘Using Caller ID, Call Waiting, and Redial Lists’, and under the sub-heading ‘Making a Call from a Caller ID Record’, I found the answer I was looking for.

Here is that paragraph, with the information I needed highlighted:

Making a Call from a Caller ID Record
When the phone is in standby, press [ ] to open the Caller ID list.
Use [ ] and [ ] to find the Caller ID record you want to dial.
To add (or delete) a “1” to the beginning of the displayed phone number, press [*/tone].
Press [ /flash] or [ ] to dial the number.
Note: You can also press [ /flash] or [ ] before you open the caller ID list. When you come to the phone number
you want to dial, press [select/ ].

So, the Uniden has a feature to toggle the 1 from the currently selected phone number, just like the VTech. The Vtech uses ‘#’, but the Uniden uses ‘*’.

Hopefully this information will save somebody some time, someday.

**UPDATE** I just noticed that when I copied/pasted that paragraph from the manual, all of the phone button icons disappeared. So, I uploaded a screenshot of the paragraph, with icons intact.

September 23rd, 2007

University of Phoenix Test Scores Contact Information

I was trying to register to take a CLEP exam, to earn some credits and work towards finishing my degree at University of Phoenix, but I had trouble with a couple questions on the registration form. Question #22 on the CLEP registration form asked for information about the “Score Recipient”, which, in my case, is University of Phoenix. But the form asked for a “Code No.” and “Institution Name and Address”.

Here is the appropriate information, according to my academic counselor. She said it’s the only “Code No.” and “Institution Name and Address” that anyone needs, when trying to have any test scores (not just for CLEP tests) sent to UOP:

CLEP TEST CENTER ADMISSION FORM

22. Score Recipient:

Code No. 014593

Institution Name and Address:

Phoenix-Uopc-Student Services AA-K101
1221 N. College Ave
Tempe, AZ 85281


Okay… I just had to share that information publicly, since it was rather difficult for me to find. Now, I’ll discuss how hard it was for me to find it.

Well, I couldn’t find the information in any of the CLEP-related emails and documents that my academic counselors have sent me, over the past few years, so I searched on the UOP student website. I couldn’t find the code number, and did not know which of UOP’s addresses was the one to have test scores sent to. Since UOP has campuses all over the US (and beyond?), as well as a particularly large online presence, I didn’t know whether the scores should be sent to my local campus, or the main Phoenix, AZ campus, or what.

When I looked up UOP on the College Board’s website, I found a code number, and two addresses: some kind of main address, and the admissions office; both of which were in Arizona. I didn’t know which one to have the scores sent to.

So, I emailed my academic counselor, giving her the information I’d found, and asked which address to use. I was feeling impatient, though, because I’ve been procrastinating this CLEP stuff for a *very* long time, and was so close to finally dealing with it. So, I kept looking for the info, myself.

The main UOP website was not very useful, but I did run across some kind of “Chat with someone NOW” link, so I tried that. When I asked the person for the info that I needed, he was not sure, so he asked for my phone number, called me, and conferenced me in with my academic counselor. I felt bad for nagging her, since I had just sent her that email so recently, but she was able to find the information that I needed.

Hopefully the information is correct, and hopefully others will have an easier time finding it, now. I’ll post some sort of follow-up, to let you know how things go with my CLEP registration, as well as the subsequent score reporting.

September 14th, 2007

Regular expressions for converting code-indentation spaces to tabs in TextPad

I’ve never been a fan of using tabs to indent my code; I prefer spaces. Writing code is an art form, and when you use tabs to indent, you can’t assume that it will still look pretty on someone else’s machine, or in another application, etc., since tab sizes are platform-dependent and–although usually user-definable–the default size (typically 8 spaces, I think) tends to be much larger than my own 2-4 space indentation style.

However, some of my co-workers indent with tabs, and others indent with spaces. I’ve found that it’s easier for me to avoid inadvertently messing up existing code when I just bite the bullet and use tabs.

So, what follows are a couple of search/replace regular expressions I’ve recently used in TextPad, to make some existing code more consistent, by converting the spaces to tabs in certain relevant locations.


1. Regular expressions for aligning inline comments with tabs

Find what:   \;( *) {2}(\t*)\/\/
 
Replace with:   \;\1\t\2//

Customization: The number 2, in curly braces (above), should be replaced with the number of spaces that are used for indentation, in the code you’re running this on. In this case, the code was indented in increments of 2 spaces. Sometimes I deal with code that’s indented in increments of 4 spaces, in which case that 2 would change to a 4.

Manner of execution: Run via Replace All, repeatedly, until there are no more matches.

Recommended scope: I used it on a very specific block of selected code. Keep reading for the specific format.

When I used this on a block of code that consisted of variable declarations and //-style comments, it ended up making the comment blocks all line up nicely. Here is an animated GIF1 of a series of screenshots, showing how repeatedly running this expression transformed the comments into tab-indented comments that lined up nicely:

animated progression of screenshots showing comments separated from code with spaces, and eventually just tabs (and all lined up nicely)

I’m not sure how useful this will be, in general, because I think I just kind of lucked out when I got the results that I did. I thought it was worth sharing, though, because it impressed me when it produced results that were better than I had actually envisioned. :)

Two important things to note are:

  • The actual variable declarations (beginning of each line) were already indented with 1 tab.
  • There were a consistent number of spaces between the semicolons ending the variable declarations, and the double slashes starting the comments. While this didn’t help them line up, as spaces, it did make things pretty when the spaces were replaced with tabs.

If you’d like, you can see what my TextPad Replace dialog looked like, so you can see things like which checkboxes are checked, etc. Also, please note that in my TextPad preferences, I have it set to Use POSIX regular expression syntax (as previously mentioned, in another TextPad search/replace expression entry, a couple years ago).


2. Regular expressions for changing leading indentation spaces to tabs

Find what:   ^(\t*) {4}
 
Replace with:   \1\t

Customization: As with the first expression, above, the number in curly braces should be changed to the spacing increment used for indentation, in the code you’re running this on.

Manner of execution: Run via Replace All, repeatedly, until there are no more matches.

Recommended scope: It can be used on a block of selected text, the entire active document, or even on all open documents, if you’re brave and somewhat evil. :)


Footnotes

1 Sorry for using an animated GIF. I’d rather not have something constantly flashing on the page, because it distracts, and resembles an advertisement. I would have preferred another solution, but I racked my brain for over two hours, trying to decide how to present this series of 9 screenshots. I didn’t want to alienate readers who might read this using a feed reader that doesn’t support javascript, and I hate making people click through from the feed to the main site–I strongly prefer full-text rss feeds! Laying the 9 images out horizontally or vertically took up either too much space, or required making the images too tiny to read. In the end, this animated GIF seemed like the best portable way to show the effect I was trying to show. I won’t make a habit of using them, though. :)

[return to top] / [expression 1] / [expression 2]