Start Diskpart from the command prompt.
|
1 |
select vdisk file="<path>" |
|
1 |
compact vdisk |
Start Diskpart from the command prompt.
|
1 |
select vdisk file="<path>" |
|
1 |
compact vdisk |
Oh man, the post, Winning is the worst thing that can happen in Vegas, names and calls out a tendency of which I’ve gradually been gaining self-awareness.
Future coding is a lot like playing the roulette. If you can guess where the requirements of tomorrow will land today, you’ve just scored the ultimate programmer’s prize: looking like a wizard. You saw the future and you were right! High five, brain!
That’s the almost irresistible draw of “flexibility”—often just a euphemism for building half or whole features before you know how they’re supposed to work or whether you need them. Just like in Vegas, the worst thing that can happen is to be right about this once in a while.
Relating to technical debt:
Running up the debt on your code is not just about the quick hacks and dirty commits you know you really should clean up (but just don’t). No, the far more insidious kind of debt is that acquired in the name of “flexibility”.
Equating this to technical debt never crossed my mind before but really resonates with me. Before hearing this talk, I had been thinking a lot about the role of code comments. Over this past year my conviction that comments bring more of a liability than benefit 99% of the time has been deepening. They take time to write (which could be spent on writing clearer code to begin with), and when they aren’t maintained (which seems to happen a lot), the code is much harder to understand than if there were no comments at all. It’s not much of a leap for me to agree that coding for unknown future requirements is a bad thing. It becomes a liability that must be understood and maintained and rarely outweighs the benefits of getting it right once in a while.
I really enjoyed this talk, Grasping Complexity with Both Hands (outline), by Glenn Vanderburg. Here are a couple of his ideas that I found really thought-provoking:
New idea doesn’t have to be perfect to be good. Don’t dismiss them as soon as you find a single flaw.
How to make decisions in the face of truly complex problems:
A while ago, we started having trouble updating our wordpress plugins (and wordpress itself). Updating a plugin would fail with a “Could not remove the old plugin”. The plugin directory is there, but empty, and strangely cannot be deleted. We’ve found that restarting the app pool seems to resolve everything, even allowing the auto-update to work correctly.
We finally found the root cause. It’s a known issue with wordpress and the version (1.1.630.0) of wincache we’re using. Updating to the latest development build (1.2.1209) seems to have resolved the issue.
I started getting bad_record_mac errors when TeamCity would try to connect to our SVN repository hosted on beanstalkapp.com. Here is the fix:
From: http://devnet.jetbrains.net/thread/434355;jsessionid=D5DF978AB09E2CD1E16F9C8B65482E94?tstart=-2
If you want to show a message in the Admin area of wordpress, add the following to your functions.php of your theme:
|
1 2 3 4 5 6 |
add_action( 'admin_notices', 'warning_method' ); function warning_method() { echo '<div>Message here.</div>'; } |
This is the process I used to pull campaign tracking code click throughs programatically through the Omniture Reporting API. While you can start with code, I found it to be much more productive to use Omniture’s API Explorer to figure out exactly what I wanted first. The API Explorer is nice because it shows you the available methods with their parameters and gives you immediate feedback as to whether it worked or not. The first section below goes through the API Explorer. The second half contains the code I wrote and is specific to C# and Visual Studio 2010.
First, you need web service access to Omniture. This creates a Share Secret key which is used instead of your password when making API calls. The username passed to the API is a combination of your company and your Omniture username: <username>:<company>. Your username and shared key should look something like this:
You’ll want to verify that your username and shared secret actually work. The best way to do that is with the API Explorer. Enter your username and shared secret in the first section.
In the next section, choose “Company” for the API and “GetTokenCount” for the Method. This is a great Method to start with because it doesn’t require any parameters. Click “Get Response”.
The response shows up in a box below. If there are any problems, the error will appear here. If all is well, you’ll see the data you requested. In this case, we asked for the Token Count and got back 9978. Omniture gives you an allotment of API tokens. Each call you make (regardless of the response size) consumes 1 token.
Now that we know that we can successfully access the API, the next step is figuring out the API calls you want to use and the parameters that they take. In my case, I wanted to get a Ranked Report containing the number of Click-throughs for each Campaign Tracking Code. The Report API documentation explains most of the parameter fields and options. I selected “Report” for the API, and “GetRankedReport” for the Method. This populates the parameter section with a template for all possible options (it can be a bit overwhelming, but fortunately, you don’t need most of it most of the time).
After quite a bit of trial and error, I ended up with this:
Which results in this response:
![]()
Once you figure out how to pull the data you need through the API explorer, it’s time to move on to the code.
Omniture has created guides for a number of different platforms. You can search for them on the Omniture Developer Connection. In my case, I’m building the project in Visual Studio 2010, which has a guide and some libraries that Omniture created. I followed steps 1-4 of the guide to get started as they are. Their API client class follows the request structure you used in the API Explorer pretty closely. You need to create a reportDescription object within which you will put the parameters you need.
I decided to create an Extension method to populate the reportDescription object for me. Here it is:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
public static class reportDescriptionExtensions { public static reportDescription PopulateWith(this reportDescription reportDescription, string reportSuite, string startDate, string endDate, string filter, int top, int startingWith) { reportDescription.reportSuiteID = reportSuite; reportDescription.dateFrom = startDate; reportDescription.dateTo = endDate; reportDescription.metrics = new reportDefinitionMetric[] { new reportDefinitionMetric() { id = "instances" } }; reportDescription.elements = new reportDefinitionElement[] { new reportDefinitionElement() { id = "trackingCode", search = new reportDefinitionSearch() { type = reportDefinitionSearchType.and, keywords = new string[] { filter } }, top = top, startingWith = startingWith, } }; return reportDescription; } } |
Note that the reportDescription object is created outside of this method and is passed in. I’ve both hardcoded some of the values and passed in others as arguments. I ended up adding in a few extra parameters that I didn’t have in the API Explorer example above: I added a search and split the results into pages (top & startWith). Note how the values and structure here are pretty close to what we had in the API Explorer.
Here is the client I created to pull down the report and convert it to my own reporting format. I’ll break each section down below.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
public class SiteCatalystClient { private string url; private string username; private string password; private int top; public SiteCatalystClient(string url, string username, string password) { this.url = url; this.username = username; this.password = password; top = 10000; } public ClickthroughReport GetClickThroughsReport(string reportSuite, string filter, string startDate, string endDate) { using (var client = OmnitureWebServicePortTypeClient.getClient(username, password, url)) { ((CustomBinding)client.Endpoint.Binding).Elements.Find<TransportBindingElement>().MaxReceivedMessageSize = int.MaxValue; var startingWith = 0; var report = new ClickthroughReport(); var executionCount = 0; do { var trackingCodeReportDescription = new reportDescription().PopulateWith(reportSuite, startDate, endDate, filter, top, startingWith); var reportResponse = client.ReportGetRankedReport(trackingCodeReportDescription); foreach (var dataPoint in reportResponse.report.data) { report.AddRecord(new ClickthroughReportRecord() { Name = dataPoint.name, ClickThroughs = (int)dataPoint.counts[0] }); } startingWith += top; if (reportResponse.report.data.Count() < top) break; } while (++executionCount < 10); return report; } } } |
Let’s break this down. The constructor takes the API url (https://api.omniture.com/admin/1.3/), username (the combined username from above), and password (shared secret). I also set top to the number of records I want to fetch each time.
|
1 2 3 4 5 6 7 |
public SiteCatalystClient(string url, string username, string password) { this.url = url; this.username = username; this.password = password; top = 10000; } |
The only method that this class has at this time is to pull the Compaign Tracking code click-throughs. It takes the reportSuite, filter (filters on the actual tracking code to narrow the results down), and startDate and endDate. It returns a ClickthroughReport object which is my own object I use elsewhere in my project.
|
1 |
public ClickthroughReport GetClickThroughsReport(string reportSuite, string filter, string startDate, string endDate) |
Next I instantiate the client that Omniture provided in the library we downloaded earlier, then I overrode the MaxReceivedMessageSize to the largest possible value. This sets how large the messages can be coming back from Omniture. The messages for my reports were quite large, so I just set this limit as high as it could go.
|
1 2 3 |
using (var client = OmnitureWebServicePortTypeClient.getClient(username, password, url)) { ((CustomBinding)client.Endpoint.Binding).Elements.Find<TransportBindingElement>().MaxReceivedMessageSize = int.MaxValue; |
|
1 2 3 |
var startingWith = 0; var report = new ClickthroughReport(); var executionCount = 0; |
We go into a do while loop. Our result set is paged, so each time through the loop pulls the next range of data. I have it limited to 10 loops though because I don’t want this report to run for too long.
|
1 2 3 4 |
do { ///..... } while (++executionCount < 10); |
I create the reportDescription object (this was provided in the Omniture library) and populate it with my extension method, PopulateWith, that I showed above.
|
1 |
var trackingCodeReportDescription = new reportDescription().PopulateWith(reportSuite, startDate, endDate, filter, top, startingWith); |
|
1 |
var reportResponse = client.ReportGetRankedReport(trackingCodeReportDescription); |
The reportResponse object contains a property called report which contains a property called data. Data is an array with the values we want. I loop through each item and place it in to my own report record object:
|
1 2 3 4 5 6 7 8 |
foreach (var dataPoint in reportResponse.report.data) { report.AddRecord(new ClickthroughReportRecord() { Name = dataPoint.name, ClickThroughs = (int)dataPoint.counts[0] }); } |
|
1 2 3 |
startingWith += top; <span style="color: #0000ff;">if</span> (reportResponse.report.data.Count() < top) <span style="color: #0000ff;">break</span>; |
Here are the queries to view the char and nchar character set settings:
select value from nls_database_parameters where parameter = ‘NLS_CHARACTERSET’;
select value from nls_database_parameters where parameter = ‘NLS_NCHAR_CHARACTERSET’;
These return AL32UTF8 for me, which apparently supersedes UTF8 (which is an older setting in Oracle for an older unicode specification which is missing some XML specific characters).
Here’s an old post I just found that I had started a long time ago but apparently never finished. Posting as is…
We use SVN for our versioning, and TortoiseSVN on the client.
Since there is only one person working on the project, we’ve opted for a simple version control strategy. We use a simplified stable trunk strategy and release from /trunk. The goal is to keep /trunk releasable at any given moment. All development is done against a long-lived branch: /branches/_dev. When a feature is done (tested, documented, etc), it is merged to /trunk. Here is the complete process with each piece explained below:
Feature development is done against the development branch:
When a feature is done, it is merged into the trunk
If a feature is partially completed and a different story or bugfix needs to be worked on, the partially completed feature is shelved to a branch (/branches/<username>-<story number>. Once the other work has been completed and checked in, the shelved branch is merged back in with the developer’s working copy of the development branch.
When we are ready to release, we the latest revision in /trunk and tag it.
If we find a bug in production that must be fixed immediately, we create a new branch from the last release tag (which means that we’re branching what we’re currently running in production) and call it /branches/hotfix-<hotfix story #>. We deploy to staging from the hotfix branch to verify that the hotfix worked, and then deploy to production from the hotfix branch. Once everything is confirmed to be working, the hotfix branch is tagged then removed.
Also, once the hotfix is confirmed to be working, it is merged back into the other branches (/trunk and /dev)
I frequently forget these.
sp_who2 shows you the processes that are currently running. Using sp_who2.
(Code for a better sp_who2 sproc: http://sqlserverplanet.com/dmv-queries/a-better-sp_who2-using-dmvs-sp_who3/)
Shows you the last statement sent from a client:
Kill process:
|
1 |
KILL <spid> |
Show IO statistics for query:
SET STATISTICS TIME ON
Show how long parse, compilation, and execution of a query takes:
|
1 |
SET STATISTICS IO ON |