Tuesday, October 29, 2013

How to increase your VirtualBox disk size for Windows

A lot of times that I blog, it's made up of things I want to remember for future issues. This is one of those times.

For my Crystal development contracting, I utilize Oracle's VirtualBox. It's a great free tool you can check out here. One of the issues I'd encountered was that, like most people, when I configure a VM I'll usually pick the smallest HD size I think I can get away with, somewhere like 40gb or so. However, that goes away quickly once Windows, MSSQL, Crystal, and the application I develop for are all installed, not including the size of customers' data that I restore for testing.

Today, I had a customer deliver a 33gb database for development. Not huge, by most standards, but very large for this application. I was out of space. Creating a secondary drive wasn't an option, as it needs to be restored to SQL. So, I shut the VM down and got into the settings console.

There was no option to change disc size. Crap. What now? New VM? I'm a fixed-bid contractor, so every extra hour I have to waste on this is money out of my pocket. So, using some Google-fu, I found a few people discussing using the VBoxManage command.

Problem for me was that my VM's are stored on a massive drive, not the OS drive where VirtualBox is installed. So, with some modification, here are the steps and commands I used:
  1. Close your VM. 
  2. Open a command prompt, and cd into the directory where VirtualBox is installed (usually C:\Program Files\Oracle\VirtualBox) cd C:\"Program Files"\Oracle\VirtualBox
  3. run the modify hd function with the new size (this needs to be in MB). You must specify the location of the .vdi file you wish to increase. I choose 70GB (70 * 1024mb = 71600MB)
    VBoxManage.exe modifyhd G:\VirtualBox\VMName\VDIName.vdi --resize 71600
    
  4. VirtualBox will start the process of resizing your hard drive and you will see the a percentage progress bar telling you how far along the process is.
  5. Now start up your Virtual Windows Machine. Right Click on "Computer" and choose "Manage"
  6. Click on the "Disk Management" option on the left panel under Storage. You will notice some "unallocated" black space next to your C:\ drive if everything was done correctly.
  7. Right Click on the C drive and choose "Extend Volume" Follow the Windows wizard and you will have successfully increased the size of your VirtualBox disk.

Mad props to this guy for getting me about 80% of the way.

Saturday, September 28, 2013

Drag and Drop Broken - Windows 7/2008 r2

Ever had drag and drop stop working on you?

Oh yeah? Me either. Until this week. I work on a remote computer for some of my contracting (hence the multiple posts on RDP here), and drag and drop is crucial for what I do. So, when it stops working? Yuck.

Well, with some google-fu and some "I can't believe the fix is this simple", here's the solution:

Left-Click on a file in windows explorer. Hold the left-click. Click Esc. Seriously. That's it.

I love it when fixes are easy.

Wednesday, October 24, 2012

Conditionally hide SSRS expand/collapse button

Over the last year and a half, I've transitioned into a full-time BI role at my new job. Among the many changes I've had to deal with, learning the differences between Crystal Reports and SSRS (Microsoft SQL Reporting Services) has been one of the most interesting.

Each tool has its' own nuances and issues. I've found that each has significant pros and interesting cons. Take for instance SSRS:
Significant pro:

  • Horizontal grouping. Let's not talk about cross-tabs in CR, as I don't consider that horizontal grouping - too many weird formatting and display issues. It's a hack, at best. It's ugly, users don't like it, and I hate developing them. 
Significant con:

  • Multi-item editing. You mean to tell me you don't support me clicking on a number of items, right clicking and having all the similar formatting tools at my disposal? Wow. Sure, I can click them all, then go into properties and format, but I'd have to remember the SSRS code for a percent or a standard currency format. It's just strange.

So, with knowing that each tool has great features, and great quirks, here's one of the quirks I found in SSRS, and how I worked around it.

Situation: Users request a high-level report detailing how much each support call costs, at each support level (tier 1, tier 2, and tier 3). Summary totals are presented at the top, and detail assumptions and data that drive the total is presented at the bottom. 

Gotcha/caveat: Detail data (which includes avg headcount cost/salary per level) should be hidden by default, toggled on request. Detail data also should only be shown to specific users. Basically, only managers can see the report, but only a subset of said managers can see the detail data.

There is no way to conditionally show a toggle item in SSRS that I know of (this is using SSRS 2008 R2). 

Workaround: It's very simple, almost silly really. I placed the matrix table containing the detail data inside a rectangle. The rectangle's visibility options are set to hide on load, and are set to be toggled by another text box in the summary data.

Great, that gets me to the point where the user can toggle, but how can I control who toggles the switch? You can't. But, you can control who sees the textbox the toggle is in. Simple answer, make the visibility settings on the toggle textbox change based on the user.

SSRS has a built in user parameter that tells you who is attempting the access the report, so we can use that parameter to know who is coming in. 

Here you have two options:
1. Hard code the users in the expression of the toggle text box (tb76 in my case. Original, I know. Terrible naming conventions). 
2. Pull from a table.

I chose route 2. I built a Dom_ReportUsers table in my database that stores the name, credentials, reportname, and type (is it an entire report, a subsection of a report, etc) for any report with special permissions. I've found it very useful.*

So, I have a 2nd dataset in the report called "Users" that pulls everything from that table, filtered with the hardcoded report name and where the credentials match the aforementioned Users parameter.

Then, on tb76, I set the visibility property to "Show or hide based on an expression" and set the expression to =IsNothing(First(Fields!Name.Value, "users"))

This way, if the user isn't in that Dom table for this report section, they don't see that box, and can't toggle.

It's pretty simple, and works well.



* The table is probably only needed if you want to control permissions for multiple reports or sections from a single place. I didn't want to have to spin up visual studio and redeploy to give someone new access to that section, plus I'm using this table to control security on 3 reports currently. Additionally, with this report, we're doing 2 levels of filtering, one where only managers can see the report, and then section filtering where only certain managers can see the details, if that makes sense.

Thursday, April 7, 2011

Crystal Reports 2008 SP3 upgrade hangs

I know, it's been a LONG time since my last post. During this time, Crystal FINALLY rolled out a SP3 build, thus replacing the need to go SP0 (who does an SP0 anyway?), SP1, SP2, and then SP3. It also should fix the issue I detailed here.

But, in rolling to the new build on a fresh install, my installer froze on the "Determining disk space requirements" screen. For hours.

I tried everything. Cleaning my registry with CCleaner. Rebooting. Etc and etc. Nothing worked.

Until I tried to most unlikely thing of all:
1. Check the French language pack during install.
2. Instead of selecting "Typical", choose "Custom" and don't click anything, just click "Next"

Voila! It's installing.

What the? Why in the world would that fix it? Checked some SAP forums, and it looks like I'm not the first to figure that out, so hopefully they'll get that fixed too....

Until next time.

Monday, November 15, 2010

Get RGB values from Excel cells

I do custom Crystal reports for customers as a side-job and was presented with an interesting challenge this last week.

The issue was that the customer wanted to color-code fields in their Crystal report based on pre-defined fields. They provided a spreadsheet with the colors, and it was my job to get them somewhere that the report could use.

In the end, I had to use some VBA and some new SQL tables, but it works, and works well.

The first challenge was this - in Crystal reports you really only have a couple of conditional formatting options for color, either their color constants or an RGB scheme:
// This conditional formatting formula must return one of the following Color Constants:
//
// Color (red, green, blue)
// crBlack
// crMaroon
// crGreen
// crOlive
// crNavy
// crPurple
// crTeal
// crSilver
// crRed
// crLime
// crYellow
// crBlue
// crFuchsia
// crAqua
// crWhite
// crNoColor

Since the customer was providing the colors, I knew I had to go with RBG. But how to pull those values out of the provided spreadsheet? Enter VBA.

Thanks to the power of the Google, I took and modified some VBA code to pull the unique R code, G code, and B code (since Crystal expects 3 distinct strings, not a single string in their RBG formula) for each cell:

Function showR(rcell)
Dim myStr As String
Application.Volatile

myStr = Right("000000" & Hex(rcell.Interior.Color), 6)
showR = Application.Evaluate("=Hex2dec(""" & Right(myStr, 2) & """)")

End Function

Function showG(rcell)
Dim myStr As String
Application.Volatile

myStr = Right("000000" & Hex(rcell.Interior.Color), 6)
showG = Application.Evaluate("=Hex2dec(""" & Mid(myStr, 3, 2) & """)")

End Function

Function showB(rcell)
Dim myStr As String
Application.Volatile

myStr = Right("000000" & Hex(rcell.Interior.Color), 6)
showB = Application.Evaluate("=Hex2dec(""" & Left(myStr, 2) & """)")

End Function

That worked like a charm. I then dumped those values into the database, where I was able to use conditional formatting to push those values out of the database into the field.

After a large amount of work, it works like a charm.

Friday, June 25, 2010

Getting better battery life out of your HTC Evo

Yes, I am nerdy. And I'm okay with it. So, when I read the specs on the HTC Evo that was to be released on Sprint in June, I knew (since my contract was up) that I was going to preorder, and then upgrade.

I mean, let's be honest, these specs rock.
Display - 4.3" screen - 800 x 480 resolution
Processor - 1 GHz Snapdragon
Size - 4.8" tall, 2.6" wide, .5" thick
Weight - 6 oz
OS - Android 2.1
Storage - 8GB MicroSD included
Camera - 8MP in back, 1.3MP in front for video conf
Video Recording - 720p @ 25fps
GPS, Compass, accelerometer, ambient light sensor, proximity sensor

And it's worth every penny. I'm not naive though, and I'm not blind to its' shortcomings. That said, here are my issues with it:

- The screen size is gorgeous, but the resolution could be higher without losing much of anything.
- The screen is a fingerprint magnet. Thank heavens for Boxwave anti-fingerprint screen protectors. Check them out at here.
- Battery life. It's not nearly as bad as some reviews make it seem, and comparing it to the iPhone's battery life is downright stupid, considering that you can do true multitasking on the Evo. Of course the iPhone has better battery life, it allows one thing at a time. That's another rant.

That said, I have made a couple small tweaks and have been able to get much better battery life out of my phone. I mean consistently unplugging the phone around 7-8 AM, and not plugging it in until 10:30-11 PM and still having 40% battery life. And the best part is? I didn't stop using my phone at all. Some reviews I've read advocate that restricting phone use will save battery life. Duh. I didn't spend $200 on a paperweight. So, here are a few of the things I've done:

1. Turn off the GPS. It's on all the time, and it's a battery suck. Anything that needs the GPS (like Google Maps, for instance) can turn it on automatically anyway, so there's no reason to leave it on all the time. They have a bunch of widgets for these, so tap the + button and then go to Widget / Settings and find the one for the GPS. Then turn it off.

2. Turn off Wifi and 4G. Similar to above - especially if 4G isn't quite up or is spotty in your area. If you leave these on, they'll constantly be scanning for networks. For instance, I can get 4G at work, but not home. So the only time it's on is at work. There are widgets for these in the same place as the GPS one above.

3. Disable "Always On" mobile data. I have no idea what this does, but haven't noticed a single problem/issue with turning it off, and my battery savings jumped with this one. Go to Settings / Wireless & networks / Mobile networks. Tap "Enable always-on mobile data" to uncheck the box.

4. Turn off the background updates/sync. There are a lot of things that sync of update on a regular basis, like Gmail, Facebook, News, Weather, etc. You should either turn these off, or turn back the update time. For instance, I have News and Facebook set to not sync, weather is set to 3 hours, and Gmail is real-time (I like getting email as soon as it comes in). This is changed in Settings / Accounts & sync. Your accounts will be listed here. Tap the "Account Settings" box once in an account to change this.

5. Use an App Killer. This is a sensitive subject for a lot of people, as there are many in the Pro-AK camp and many in the Anti-AK camp. I think, if used wisely and correctly, AK's can work well. I use Advanced Task Killer, only have it set to auto kill the random Sprint Apps (like navigation, TV, stocks, etc) that I know for sure I don't want, and then only have it auto-kill when I turn off my screen. I would not recommend auto-killing any services or apps that you aren't sure about, as you can royally mess things up. For instance, when I had my HTC Hero, I unknowingly killed the SMS service, and it took me 2 days to wonder why I wasn't receiving any texts (and none were going out either).

6. Run an app like OverclockWidget. This one is complex, because it requires rooting your phone (another post in and of itself), but once done, this widget can actually slow down your processor to any speed when the screen is off. I have my 1GHz processor slowed down to 200MHz when my screen is off.

Additionally, there are some more obvious things like lowering your screen timeout, removing the sync-heavy widgets (like FriendStream) or other things like that, but those have all had a minimal battery impact. The ones above (for me) had by far the most impact.

Good luck!

Thursday, June 24, 2010

It's been awhile....

I realized the other day that's been 6 months since I updated this blog. That's shocking, to be honest. I've done a ton of blog-worthy stuff the last few months, but finding the time to do the blog-worthy activities and finding the time to blog about those blog-worthy activities are two very different things.

Here's a brief overview of the things I've done that are blog worthy these past 6 months (so expect blogs dealing with them at some point):

- Finished our basement (I did all the low-voltage wiring - gigabit network, in-wall surround speakers, in-wall HDMI, etc)

- Bought a WDTV Live HD, and hacked it with custom firmware (thanks B-Rad!)



- Found out 1.5 months after I bought the WDTV Live HD that WD released a new product called the WDTV Live HD Plus. Not only did this suck because the Plus product contained the firmware to stream Netflix (but not Hulu, so I don't feel too bad), but it obviously drove the price of my version down.

- Was pleasantly surprised at the response my last post about upgrading Crystal 2008 has received. I've literally gotten emails from all over and found my blog linked in a number of Crystal-related forums. Not surprised that I'm not the only one with those issues, just more surprised that even now, SAP has shown no desire to fix the issue. Odd, to say the least.



- Upgraded to an HTC Evo on Sprint. Love it. Absolutely love it. With a few tweaks and changes, I have great battery life on an amazing smartphone. Combine that with my plan pricing, and I'm in cell phone heaven for not a lot of dough. I'll do a post tomorrow about all the ways I've figured out to save some serious battery life and still use my phone as often as I'd like.

- Bought a 40GB Apple TV with the intent of hacking it with either Boxee or XBMC. The laziness in me took over, however, as I found a unit pre-hacked for a great price, and bought it instead. :)