No matter what you celebrate today, I hope you have a wonderful day.
Category: Blog
-
Quick Tips – SQL Prompt with SSF
I love SQL Prompt, and think it’s a great productivity tool. Even before I worked at Red Gate, I love the tool and had a copy before Red Gate bought the technology from the original developer. Recently I’ve run into a few people that weren’t aware of some of the ways in which it can help you. This is a quick look at one of the ways I use SQL Prompt.
SSF
I probably type SSF more than any other character combination in SMSS. With SQL Prompt installed, I usually quickly type “SSF” and hit “tab” and get this:
SQL Prompt has expanded my “SSF” into “Select * From” and then popped up a list of tables in this database. I could down arrow to select one, or use the cursor, or start typing.
This is a quick way to get data from a table back to your SSMS client without worrying about the columns or rows you need from a table. I use this constantly, though I’ve edited this command to return the top 10 rows only. Here’s how I do that:
Snippet Manager
There’s a dialog for managing these snippets of code, called the Snippet Manager. You can access that from the SQL Prompt menu

Once you select this, you get a dialog that shows all the snippets installed on your system. I scrolled down to the “SSF” snippet that I often use.

If I click the Edit button, then I get a small editor where I can paste in code or edit what’s there. In this case, I add the “TOP 10” keywords, and I also reformat the code slightly. I like my code formatted, so I ensure it’s formatted here.

Once that’s done, I click “Save” and then “close” for the Snippet Manager. Then the next time I type “SSF” and tab, I get this:
Note that there is an st100 snippet that does the same thing I edited with 100 rows, but I find ssf easier to type, so I just edit this snippet.
I’d encourage you to play around with snippets, and also adopt this in your daily work. If you don’t have a copy of SQL Prompt, download the evaluation and I’m sure you’ll realize it’s worth the cost of the tool in time savings quickly.
-
Android is better than iOS
Not in many ways, and certainly not in enough for me to stick with Android over iOS, but here are a few things I do think.
If you’re slightly lost, I’ve written on Android v iOS after moving to a G4, my move back to iOS, and why I left. The other posts in this series are:
It’s been a couple weeks that I’ve been back on iOS. It’s an adjustment, partially because it’s iOS7, and partially that things work differently. I made a few notes of the places where I find myself wishing that iOS had adopted a few things from Android.
Keyboard
The number one complaint I’ve had with iOS is the keyboard. Actually, I bet my wife would consider iOS again if the keyboard was replaceable. The iOS keyboard isn’t a great format, it isn’t customizable, and there’s no Swype. I could forgive the former, but the latter is handy, especially when you’re working one-handed, which I often am. I’m not sure if Apple will get Swype/SwiftKey/etc ever, but that ought to be a priority.
I will say that as I’ve moved to Chrome on iOS, I do appreciate the app showing the “:”, “.”, “-“, “.com” buttons above the keyboard. I wish that more apps might consider adding the “@” and “#” buttons to their keyboards. I use those often.
Update: I noticed the Echofon Twitter app does this.
Back
The back button, which was annoying and inconsistent at times in Android, was still useful. Often I find that I need to change a setting, or I click a link over to some other app and want to return to the previous application.
For example, I hit maps, enter an address, and it tells me I don’t have Location Services on (because that kills my battery). I click settings to turn on LS, and then I need to double click home and pick the previous application. I find myself looking for a back button. The same thing occurs if an email opens a browser link.
As much as the soft back button was a pain in Android, not having one is slightly a pain in iOS. Not a huge one, but it feels like an ommission.
GPS
I don’t use the GPS or Location Services often, mostly because it seems that iOS 7 has a battery drain issue with this. I have to say that having the ability in Android to turn this on/off from the notification window was really, really handy. While I have wi-fi, bluetooth, etc. in iOS, I don’t have GPS.
Android wins here.
Screen
I had a new Android, the Galaxy S4. The screen was amazing, and large. After a day with the S4, I thought the device was big. After a month, I never noticed it. In fact, when I looked at other phones, their screens were small. Going back to the iPhone 4S I was surprised, and still am, by how small the screen is. I’ve looked at a few other old phones I have and the iPhone has a larger screen, but after having the S4, I miss the larger screen. If the iPhone 6 does a wider screen, even if it’s the same height as the 5 series, I’ll upgrade ASAP. I would like a larger screen.
There are so many Android choices here with my kids having LG and HTC devices, that I feel a little left behind. Even my daughter’s 8X with WP8 is larger and nicer.
I know this isn’t an Android OS thing, but the choice and variety of the platform make it a reason I like Android more.
Networking
I don’t know if this is an iPhone issue, an iOS7 issue, or Android is better, but networking seems flakier. Both wi-fi and cellular find some gaps/pauses in how the device works. Coverage was better on Android for me, but that was newer hardware and the cellular radios are always improving. It isn’t horrible, but a few times a week it’s noticeable. I wish I hadn’t upgraded from iOS 6 to 7 as I’d like to know what the issue here is.
That’s It
I haven’t anything else that stands out. I wrote about a few of the reasons I switched and they’re still valid. Music is world class (including iTunes), the camera just works quicker and better. App quality is better overall, and I don’t have crashes. The lock screen runs fast, and I can search the phone instantly.
I have learned in iOS 7 I need to kill some apps at times, and that means the Task Manager and booting a few to protect my battery life at times, but I had to do that on Android.
Overall, I’m glad I switched back, though I do wish I had newer/faster/larger hardware running the OS.
-
Powershell in a Month – Day 6 The Pipeline
This is part of my Powershell Challenge, to learn more about PowerShell (PoSh) using the Learn Windows Powershell 3 in a Month of Lunches book by Don Jones.
Day 6. This is where I found the idea of Powershell getting interested. I used pipes extensively back in my Unix and DOS days, and have heard that these are important in powershell.
The pipeline (|) essentially takes the output of the left command and sends it to the right. The first examples are with exporting data, such as:
Get-Service | Export-CSV services.csv
This command would run the Get-Service command to get a list of services, then send that output to the Export-CSV command, which would create a file, format the data in CSV format, and send all the data from the Get-Service command into the file. Simple, easy and it makes sense. There are also Export-CliXML, -FormatData, etc. commands. On my system I even have an Export-VM command for Hyper-V. I can start to see possibilities.
This is different from the redirector (>), which is essentially running the pipe to Out-File, a command to create a file. There are other Out-* commands that send data other places, like printers, the screen, etc. Why does it matter that you have these commands? Well, mainly because you might want to alter some parameters, like display width, encoding, etc. Having a real command build allows for parameters, and control, and thus, customization.
Powershell is all about customization, and being able to repeat that process. This chapter gives the basics of controlling your flow out output, including to other commands. For example, one of the things the chapter has you do is
Get-Process -name Notepad | Stop-Process
A fancy way to kill a process. It does warn you not to forget the -name parameter, as that would be bad. I was tempted to try it on a VM, but I know what will happen, so I didn’t bother. For commands that might cause problems, the chapter goes over the -confirm and -whatif parameters, which, respectively, ask you questions to confirm your actions, and show you the action without performing it. The lab for the chapter has you dig into other parameters, like appending to files (noclobber) using the default regional settings (useculture) and changing the delimiter for export. I actually found these lab exercises to be slightly challenging, but also handy. I got to use the help system and proved to myself a bit that I’m learning how to use PoSh.
Overall, no great leaps in knowledge here, but I find myself gaining some confidence that I understand how PoSh works, how to manipulate the environment a bit, and I can see the possibilities of using the pipeline to string commands together and manage more than a simple stream of output data.
The next chapter looks at more involved strings of commands, and I’m looking forward to that one.

