Defcon 17: Here I Come

posted @ Wednesday, July 01, 2009 10:28 PM | Feedback (0), Filed Under General Security

I will be going to Vegas for Defcon 17 this year and it will be my second time attending the conference. I’m going to keep this post updated with some of the tracks I plan on attending. Hope to see you there!

Windows 7 RC

posted @ Monday, May 11, 2009 10:03 PM | Feedback (0),

The Windows 7 RC has been made available to the public last week. I downloaded and installed it on my Dell XPS M1330 laptop and I am loving it. I blogged about the beta in January and it has only gotten better since then. The RC fixed a couple of issues I was having with my hardware, the most annoying being the loss of wireless after coming back from sleep mode.

My favorite new feature would be the new beta version of Windows Virtual PC. I haven’t used it for Windows XP Mode yet but it successfully converted my existing VHDs and worked flawlessly. I’m still working on enabling the ability to run virtualized applications from the VHD directly from the Windows 7 desktop. Even so it added USB support, drive sharing, and many other cool new features. My Vista virtual machine even recognized my laptops integrated webcam.

If you haven’t tried the beta yet I highly recommend giving the RC a try. I can truly say this is my favorite version of the Windows OS to date.

logo_windows

Download the Windows 7 RC - http://www.microsoft.com/windows/windows-7/download.aspx

Killing an Oracle Session on a Windows platform

posted @ Thursday, April 16, 2009 1:59 PM | Feedback (0), Filed Under Oracle

In UNIX, the DBA can use the kill -9 command to kill a rouge process but in the Windows world
the orakill.exe utility provides this capability. Here is the process I use to kill Oracle sessions
on a Windows Oracle machine:

-- first get the SPID/thread to kill by running the following query from sql plus
select sid, spid as thread, osuser, s.program, s.status
  from sys.v_$process p, sys.v_$session s
  where p.addr = s.paddr;
 
-- use the ORAKILL executable located on the database server
-- and execute the following from the command prompt:
orakill <Oracle Instance> <spid/thread>

e.g. orakill databaseName 3456

Finding Locks in an Oracle Database

posted @ Wednesday, April 15, 2009 8:41 AM | Feedback (0), Filed Under Oracle

Here is some DML that will track down locks in your Oracle database:

-- display locked objects
set lines 100 pages 999
col username     format a20
col sess_id     format a10
col object    format a25
col mode_held    format a10
select    oracle_username || ' (' || s.osuser || ')' username
,    s.sid || ',' || s.serial# sess_id
,    owner || '.' ||    object_name object
,    object_type
,    decode(    l.block
    ,    0, 'Not Blocking'
    ,    1, 'Blocking'
    ,    2, 'Global') status
,    decode(v.locked_mode
    ,    0, 'None'
    ,    1, 'Null'
    ,    2, 'Row-S (SS)'
    ,    3, 'Row-X (SX)'
    ,    4, 'Share'
    ,    5, 'S/Row-X (SSX)'
    ,    6, 'Exclusive', TO_CHAR(lmode)) mode_held
from    v$locked_object v
,    dba_objects d
,    v$lock l
,    v$session s
where     v.object_id = d.object_id
and     v.object_id = l.id1
and     v.session_id = s.sid
order by oracle_username
,    session_id
/

-- display sessions that are blocking each other
select    'SID ' || l1.sid ||' is blocking  ' || l2.sid blocking
from    v$lock l1, v$lock l2
where    l1.block =1 and l2.request > 0
and    l1.id1=l2.id1
and    l1.id2=l2.id2
/

-- list locks
column lock_type format a12
column mode_held format a10
column mode_requested format a10
column blocking_others format a20
column username format a10
SELECT    session_id
,    lock_type
,    mode_held
,    mode_requested
,    blocking_others
,    lock_id1
FROM    dba_lock l
WHERE     lock_type NOT IN ('Media Recovery', 'Redo Thread')
/

Setup HTTP Redirection in IIS 7

posted @ Saturday, March 28, 2009 11:44 PM | Feedback (4), Filed Under Windows

Doing some work tonight on one of my Web sites I wanted to use an HTTP redirect. I am very familiar with how to do this in IIS 6 however I had never done it before in IIS 7. I looked and looked in the new IIS manager and could not find the HTTP Redirection option to save my life. Eventually I resorted to Google and found out you have to install the HTTP Redirection role for the IIS Service.

If your system is setup similar to mine you will see that this HTTP Redirect is not configured. To fix the issue go to the Server Manager and click on the Web Server (IIS) role.
 

 

As you can see HTTP Redirection is not installed.  Click Add Role Services on the right hand side.


 

Select HTTP Redirection from the list and continue. Once the service is installed it will be available in the modules list for specific Web sites. From there you can configure HTTP redirection on a site specific basis.

Silverlight: Color Animation using C#

posted @ Wednesday, March 25, 2009 10:42 PM | Feedback (0), Filed Under C# Silverlight

I have searched high and low for an example of how to do this on the net and I couldn’t find a single one. Just about every example I have found creates the animation using the Storyboard in XAML. This didn’t fit my need; I needed to create an animation using a Storyboard from my C#.

In my particular case I wanted to animate the color of dynamically created polygons that were instantiated and added to the layout from my C# code.

The following code will transform a polygon’s fill color from blue to yellow:

   SolidColorBrush transformBrush = new SolidColorBrush(Colors.Blue);
   polygon.Fill = transformBrush;

   ColorAnimation colorAnimation = new ColorAnimation();
   colorAnimation.From = Colors.Blue;
   colorAnimation.To = Colors.Yellow;
   colorAnimation.Duration = TimeSpan.FromSeconds(.5);

   var sb = new Storyboard();
   sb.Children.Add(colorAnimation);
   Storyboard.SetTarget(sb, transformBrush);
   Storyboard.SetTargetProperty(sb, new PropertyPath(SolidColorBrush.ColorProperty));

   sb.Begin();

As you can see, the code is pretty straight forward. The Storyboard allows you to define animations, even across different UI elements. Above, I create a Storyboard and add a ColorAnimation to it. The ColorAnimation defines the starting color, ending color, and amount of time the transition will take. A couple of key things to note with the Storyboard are, the SetTarget() and SetTargetProperty() methods. In this case, our target is the trasformBrush because we want to manipulate the color contained within it. We then specify the particular property we are targeting using the SetTargetProperty() method. Once everything is set, you can kickoff the animation by calling storyboard.Begin().

How to Compact a Virtual PC VHD

posted @ Thursday, March 19, 2009 12:50 AM | Feedback (0), Filed Under Windows

I have been using Virtual PC extensively over the past few months for all of my development. I enjoy having my development environment in a portable format so I can share it with coworkers, keep different environments separate (Visual Studio 2008, Visual Studio 2005, Java, etc), and also keep my host machine clean without bloating it.

After a lot of use of some of my virtual machines I noticed the size of the virtual disks was starting to get quite large. This post will show you the process to compact the virtual disk to improve performance and shrink the size.

Step one is to defrag the virtual machine hard drive

Select Start -> All Programs -> Accessories -> System Tools -> Disk Defragmenter from the task bar.
 

Click the Defragment now button and make sure all drives are selected before continuing.

Step two is to prepare the virtual hard disk for compaction

Within the Virtual PC, select CD -> Capture ISO Image from the menu.
This brings up the Select CD Image to Capture dialog box. Browse to and select C:\Program Files\Microsoft Virtual PC\Virtual Machine Additions\Virtual Disk Precompactor.iso, this may be located somewhere else depending on where you installed Virtual PC.

 

Depending on your machines configuration an AutoPlay dialog may display, simply select Run precompact.exe.
A message box will prompt you with the question, “Would you like to prepare the virtual hard disk(s) for compaction”? Select the Yes button.

When the process has completed, the Pre-Compaction Completed message box will display, click the OK button to continue. The machine will then begin the pre-compact process. When the process completes, shutdown the virtual machine by clicking Start -> Shutdown from the task bar.

The third and final step is to compact the virtual disk

Start or bring up the Virtual PC Console. Select the virtual PC you are working with and click File -> Virtual Disk Wizard.

 

On the Virtual Disk Wizard welcome screen click the Next button.


 
On the next screen select Edit an existing virtual disk and click the Next button.


 
On the next screen browse to the virtual hard disk you are currently working with, select it, and click Next.


 
On the Virtual Disk Information and Options screen select the Compact it radio button and click Next.


 
On the Virtual Hard Disk Compaction screen you can choose to select Replacing the original file or Saving the file as. To be on the safe side I choose to save the hard disk as a new file. Select the option you feel comfortable with and click Next.
 
The next screen, Completing the Virtual Disk Wizard will be the last. Click Finish to begin compacting the disk.

Hitler's nightly build fails

posted @ Saturday, February 21, 2009 7:37 PM | Feedback (0), Filed Under General

Hitler's nightly build fails:

Windows 7 Beta

posted @ Sunday, January 11, 2009 10:01 PM | Feedback (1), Filed Under Windows

Every one of you probably already knows by now that Microsoft has recently released a beta of Windows 7 to the public for download. Although this is already old news I think this is still very worthy of a blog post for a couple of reasons.

First, I have just installed the beta on my primary laptop and it is incredible! I highly recommend everyone reading this post to download and install this on your computer. I’m taking a bit of a risk installing this on my primary machine but I feel you truly cannot get the full experience of an operating system unless you use extensively. I am truly amazed with the job the guys in Redmond have done with this beautiful operating system. And I mean beautiful, the user interface improvements are outstanding. I could go over all of the improvements but by far my favorite is the new task bar. Over all the UI looks very polished something I felt was left a bit half-baked in Vista.
The install process went very smooth. I have a Dell XPS M1130 and I didn’t have to install a single driver. After the first boot, Windows 7 automatically began downloading and installing drivers for my Web cam, graphics card, and other devices. The install process was extremely easy and friendly, it wouldn’t take much for a novice or non-technical user to complete.

Another reason I wanted to talk about the beta is the change in attitude from Microsoft. They are really trying to turn the image of Windows around and this is a great way to do that. By promoting a wide scale beta testing it is clear that they want to fix as many bugs and issues as possible before the official release. It is also a great way for them to build excitement in the community. I hope you all take the time to try out the beta. You won’t be disappointed.

New ASP .NET Charting Control – Data binding Example

posted @ Wednesday, November 26, 2008 8:00 PM | Feedback (1), Filed Under ASP .Net C#

I spent some time last night playing with the new ASP .NET charting control.  So far I like the new control. It has a very rich feature set and it sounds like they will be enhancing the features over time to allow for some richer client side interactions.

To get started with the new control you must first:

Both require the .NET Framework 3.5 SP1.

Now you are all set to use the new Chart control in the toolbox under the Data section.



To create a new chart, simply drag the control on to the page using design or source view. This should add the following to the web.config:

<httpHandlers>
    <add path="ChartImg.axd" verb="GET,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
</httpHandlers>

<handlers>
    <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>

Note: Adding the chart from the toolbox did not add the appropriate handlers to the web.config for me so you may have to edit this yourself. I’m not sure why it didn’t work.

Now the code, in this example I created a pie chart showing a breakdown of referring URLs to my blog.
I made some simple changes to the control markup setting the height, width, and different properties to affect its appearance.

<asp:Chart ID="chartDemo" runat="server"
            Width="600px"
            Height="500px"
            Palette="BrightPastel"
            BackColor="#D3DFF0"
            BorderDashStyle="Solid"
            BackGradientStyle="TopBottom"
            BorderWidth="2"
            BorderColor="26, 59, 105"
            IsSoftShadows="False"
            ImageLocation="~\ChartPic_#SEQ(300,3)">
            <Series>
                <asp:Series Name="Default">
                </asp:Series>
            </Series>
            <ChartAreas>
                <asp:ChartArea Name="ChartArea1">
                </asp:ChartArea>
            </ChartAreas>
        </asp:Chart>

On the page load of the code behind I created a list list of URLs and hit counts using a smiple LINQ to SQL query. I then took the list of referral URLs and bound the list to the chart control. The databinding method takes any IEnumerable data type, in this case I used a List object.

BinaryRealmDataContext db = new BinaryRealmDataContext();

            var referals = (from x in db.subtext_Referrals
                           orderby x.Count descending
                           select new ReferralUrl
                           {
                              Url = db.subtext_URLs.SingleOrDefault(d => x.UrlID == d.UrlID).URL.ToString(),
                              Count = x.Count
                           }).Take(10).ToList();
           
            chartDemo.Series["Default"].Points.DataBindXY(referals, "Url", referals, "Count");

            // Set the Chart Type
            chartDemo.Series["Default"].ChartType = SeriesChartType.Pie;

            // Set labels style
            chartDemo.Series["Default"]["PieLabelStyle"] = "Outside";

            // Explode or offset a piece of the pie
            chartDemo.Series["Default"].Points[9]["Exploded"] = "true";

            // Enable 3D mode
            chartDemo.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true;

chartDemo.DataBind();


The rest of the code is pretty much self explanatory. There is a wide array of properties available to change the look and feel of the charts. I recommend downloading the sample project to take a deeper look at the options available.


See the demo

Article Categories

Archives

Post Categories

Image Galleries

Blog Roll

Blog Stats

  • Posts: 30
  • Comments: 33
  • Trackbacks: 1
  • Articles: 0