PowerShell Can Browse a Network Share

by percent20 4/10/2008 1:51:00 PM

If you follow me on twitter then you probably know that I like Anime. If you don't follow me, you should, then to let you know. I like Anime.  Recently, a friend in #alt.net channel on freenode.  Was helping me with a script to do some specific renaming to strip out extra crap from anime I download.

Anyway, I have a network share on my anime folder so I can access it from anywhere on my network and watch.  Well last night without thinking I just opened up PowerShell CD'd to the network share and ran the script, since I have full control set on the share.  After the shows were renamed I closed it and went about finishing Bamboo Blade.

Later I realized I browsed a network share in PowerShell.  That is SOOOOO freaking cool that you can do that.  Here is an image proving it:

powershellNetworkShare

Basically, I am starting in my "My Documents" folder on my computer and CD'ing to the remote computer and it works.  Then I do a pwd for the path, and viola it works.

This is cool to me and might allow some cool scripts to be run for copying local files to remote servers with a simple click.

When I get the script a little more refined I'll go ahead and post it up with a blog post.

Here is a silverlight video of it in action. 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Awesome Stuff | powershell

Luanchy the Launcher

by percent20 4/3/2008 10:08:00 AM

For a long time I have been against launchers like Launchy not because I thought they were bad, but because I thought they were useless.  Anyway I decided on day that I would give it a shot.  After figuring out how to use it and using it for a couple of months now I can honestly say.  I like it.  I also miss it when I am on another computer without it.  It has become and main part of how I use the computer without me realizing it.  When I had to redo my computer I didn't have Launchy installed and constantly kept hitting the buttons to use it.  I also realized how much time I save using it.  It is definitely a tool that increases productivity.

So, since I was wrong and I admit it I will do a walk through on setting it up and configuring it for you to use.  Please, download the app and give it a shot it really is a good product.  Best of all it is free.

Install Steps (most are just visual with my config options please read what is typed)

Visit http://www.launchy.net

launchy.net 

When going to download area you will be forwarded to SourceForge to finish the download.

Launchy.net download

Launchy SourceForge Download 

Next is the Install it is just a typical next next next install please these are the screens for it.

CropperCapture[5]

Eula

Install Location

CropperCapture[9]

CropperCapture[11] 

Now we are done so lets configure and use it.

 

Configure

I am just going to show a couple of screenshots and am going to explain basically what they are and what to do.  I'll let you explore the rest.

At this point Launchy should be running.  To use launch all you need to do is:

ALT + SPACE

That will bring up something like this: (could be different as there are different skins)

launchy-1

At this point just right click with your mouse and choose options.

A new window should appear and looking like this:

Launchy options

Basically to configure this to launch you applications in the directories area you need to add all the directories you have have applications you want to use.  I personally do:

  • C:\Program Files\
  • C:\Documents and Settings\Buddy\My Documents\Programs
  • C:\Windows\System32\

Once you are done with that you should go back and on each direcotry you have chosen go to the left and choose file types you want to launch in each.  I usually chose for each.

  • *.exe
  • *.lnk
  • *.pdf

Once you have those done hit the Rescan Catalog button and it will scan all the folders and sub-folders making an index of you applications to launch.  After that just hit ok and you are good to start using Launchy.

Once you get done go ahead and to ALT + SPACE and start typing the application name.  It should look like.

launchy-2

 

If you decide to download and install it please leave a comment with what you think.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Awesome Stuff | Application

Email Account Activation with ASP.NET Membership part 1

by percent20 3/21/2008 10:02:38 AM

This is something that a lot of sites have to verify that the user's e-mail is valid and seems like it would be complex, but there is a very easy way to do it.  This is going to be a 2 part series, maybe a 3rd still thinking about it.  First, I will give you the resources to learn about and setup the asp.net membership system and explain the concept of how we are going to activate the account.  Part 2 will be a re-explanation along with code.

Membership System

I wanted to actually explain all the steps to doing the membership system setup, but I just can't beat 4guysfromrolla.com. Here are the links to there multi-part series on most everything about the membership system.  I use it every time I need to get started with the membership system.

Examining ASP.NET 2.0's Membership, Roles, and Profile:

  • Part 1 - learn about how the membership features make providing user accounts on your website a breeze. This article covers the basics of membership, including why it is needed, along with a look at the SqlMembershipProvider and the security Web controls.
  • Part 2 - master how to create roles and assign users to roles. This article shows how to setup roles, using role-based authorization, and displaying output on a page depending upon the visitor's roles.
  • Part 3 - see how to add the membership-related schemas to an existing database using the ASP.NET SQL Server Registration Tool (aspnet_regsql.exe).
  • Part 4 - improve the login experience by showing more informative messages for users who log on with invalid credentials; also, see how to keep a log of invalid login attempts.
  • Part 5 - learn how to customize the Login control. Adjust its appearance using properties and templates; customize the authentication logic to include a CAPTCHA.
  • Part 6 - capture additional user-specific information using the Profile system. Learn about the built-in SqlProfileProvider.
  • Part 7 - the Membership, Roles, and Profile systems are all build using the provider model, which allows for their implementations to be highly customized. Learn how to create a custom Profile provider that persists user-specific settings to XML files.
  • Part 8 - learn how to use the Microsoft Access-based providers for the Membership, Roles, and Profile systems. With these providers, you can use an Access database instead of SQL Server.
  • Part 9 - when working with Membership, you have the option of using .NET's APIs or working directly with the specified provider. This article examines the pros and cons of both approaches and examines the SqlMembershipProvider in more detail.
  • Email Activation Concept

    The overall concept is fairly simple.  You register then receive an e-mail that you have registered along with an activation URL.  When you click on the URL it goes to the site and activates your account proving that you are real and there is a real e-mail address.

    The easiest way to do this is the following.

    1. User Registers
    2. Once registration guid is created
    3. guid is put into a table associated with a username
    4. E-Mail is sent to user with a url based on the GUID something like ( http://example.com/Activate.aspx?key=1234-1234-1234 )
    5. User Opens Email and click link
    6. Person comes to activation page
    7. Activation page reads querystring and associates the string with guid in db.  If a match executes code to "approve" account for use
    8. User can login.

    There are a few key things:

    1. You need an association table.  Something that will hold the guid and username for later verification.
    2. Create the GUID and get username _after_ account has been created and commit to above table.
    3. Build the activation URL and Send the e-mail
    4. On the activation page read the query string and find association in association table and retrieve the username if association exists between username and guid.
    5. if a username is returned call the membership api and activate the account.

    Remember though that when building the site be sure to set the property where when the user registers the account is not automatically approved.

    Conclusion

    This is a very useful and needed feature in some respects and highly used.  The concept is fairly simple and with the membership system it continues to stay fairly simple.  Please feel free to try this on your own and report back any issues you came across and how you overcame them. 

    I will post part to in a couple of days.  I am hoping on Sunday as a present to you all on my Birthday though we will see how that turns out.

     

    Happy Coding

    Be the first to rate this post

    • Currently 0/5 Stars.
    • 1
    • 2
    • 3
    • 4
    • 5

    Tags:

    Use Examples in your Applications

    by percent20 3/16/2008 4:00:04 PM

    Usability is one thing, for some reason, I continue to pay attention to when I got to sites.  I may not be able design graphically, but I'd like to think that usability is one thing I consistently get right.  The biggest reason I pay attention is because your application is useless unless someone can actually use it.

    Recently I went to pay for my college tuition online and had to enter in my card number and expiration date.  Ok no problem except it took me literally a minute to figure out what I was supposed to do so I took a screen shot.

    DumbExample

    The credit card isn't so hard to figure out, but the expiration date drove me nuts.  I had to read it about 3 times and THINK about it, and I am technology savvy.

    Recently I wrote quick registration app for people coming to our paintball game, and used a bit of my usability knowledge to help users not have to think about anything except there information.

    Lets go through my thought process though first.

    I needed to get 2 key pieces of information.

    1. First and Last Name
    2. Phone Number

    This presented a few problems:

    Do I ask for first and last name in separate text boxes thus being sure to get proper information? Problem here is it puts more work on the user when they only need to add information.

    If I have them do it in one text box how can I guarantee a good clean output in the back end and be reasonably sure they will put in their first and last name?

    When it comes to phone number there are a lot of ways to write your phone number and in a huge list it could get annoying looking at all the different numbers done different ways.  Plus, I need their area code because some are coming from out of state.

    First thing I thought of to do was show them how to do it with an easy to use example.

    GoodExample

    Conclusion

    Using and easy to understand example based on other how many other sites do it.  You can increase the usability quickly of your forms and application in general.  All the people that have registered have all included their first and last name and phone number just like I have as examples above.  So please when writing your applications go ahead and take a few extra seconds and think about how you want the data to look and see if there is a way to literally show the user the format you would like.

    Currently rated 5.0 by 1 people

    • Currently 5/5 Stars.
    • 1
    • 2
    • 3
    • 4
    • 5

    Tags:

    I'm still here

    by percent20 2/24/2008 4:14:00 PM

    So apparently my site hasn't been up for a week, i have known.  I am so busy lately with a lot of personal stuff I was unable to rectify the situation.  The site is back up now and I am ready to start blogging again.

    The main issue was that the dns record on the dns server got wiped out so the internets didn't know where to go :(

    Sorry for the inconvenience.

    Be the first to rate this post

    • Currently 0/5 Stars.
    • 1
    • 2
    • 3
    • 4
    • 5

    Tags:

    BDD story chat - What is BDD?

    by percent20 2/18/2008 10:22:00 AM

    At work me and a friend are about to start a new project and since both of us like agile methodologies we are wanting use our project as a test case.  Joseph knows more about agile than I do; so he is kind of my coach on it.  One of the things we are planning on using is BDD.  Since I am not to familiar with it I engaged in a conversation with him about it and this is the log of the conversation.  I hope others find it useful.  In some respects it is _using_ BDD to learn about BDD, in an abstract theoretical way that is.

    me: yo I was thinking it would be cool to try and use our project as maybe a test case for agile dev work and if successful maybe other projects can move to a more agile dev process.  Like it would be cool to have a CI solution going

    josephholsten: yes

    also, behaviour-driven.org is perhaps better than the alternatives

    me: yeah.  Is there like a 2 paragraph what is BDD so i can understand that more going into reading the site because i am getting confused right now and am only in the intro.

    or maybe i just need to read the intro page 2 or 3 more times

    josephholsten: say that again?

    me: sorry, stream of thought typing isn't really a good idea hehe.

    Was curios if there is like a 2 paragraph description of BDD.  I am reading the intro page and running in circles because I don't get it to well.  Was thinking if i could get a really high level overview i could understand the intro more.

    josephholsten: ah. BDD is a pattern language, which is why you feel that way.

    You'll have that same difficulty with
    "Pragmatic Programmers" and all those other pattern languages

    So, where to begin?

    me: so should I read something on pragmatic programming first?

    josephholsten: no, I was referring to a book with a similar style

    me: ah

    gotcha

    josephholsten: BDD is a process to go from hopes & dreams to a product that fulfils them

    you might call it a design process, but it's also a style of specification, implementation, and verification

    The idea is to start with a sense of what's wrong. Then write some stories of how to solve that problem

    there is a suggested template for the stories

    me: so like literal stories?

    josephholsten: once you have stories, you can look at all of them and say: this one's more important than that one. it should come first

    well, yes.

    but there tends to be a more rigid format, to help turn them into an implementation

    me: ah

    josephholsten: here's the page on stories

    http://behaviour-driven.org/Story

    but don't worry about it much, they use a lot of terms without explaining

    so you want to have a product that can make these stories real

    but you can't do everything at once, so you pick a few to start with

    (it doesn't matter which. some people will tell you it does, and if they're paying you, listen. otherwise: smile, nod, and start where you think you should)

    Once you have a few stories, you want to look at them in more detail

    josephholsten: you write down examples of their behavior. You write examples so detailed that you can be certain of whether the product behaves properly or not

    these are acceptance tests

    josephholsten: they call them acceptance criteria

    you with me?

    me: sorta

    josephholsten: okay

    perhaps I should go slower?

    Ah, right you don't see the point yet, or know where I'm going

    sorry

    me: :)

    josephholsten: so, you start with a hope, then you turn that into a story, then you turn that into acceptance criteria, then you turn that into a behavior specification, then you implement the behavior

    me: sooo turn the behavior into code? just want to be sure.

    josephholsten: sorta

    josephholsten: the thing about bdd is that it emphasizes working implementations over all else

    so very often, every last thing I said you would write would not be as prose, but code

    I write stories, acceptance criteria, and behavior specifications as code

    that way I know if it

    I know if it is real or still being developed

    me: so lets see if i can repeat this how I understand it.l

    josephholsten: sure

    me: So first you start with the idea of your project.  What you want it to be.

    Next you write some stories of how to use and not to use the idea.  Then follow that with what specifically do we need to have to accomplish our stories

    josephholsten: yes

    preferably only spec'ing a little at a time

    josephholsten: then implement

    so while you've got the theory in your head, let's make it real

    'behavior specification' is another name for a unit test

    me: so kind of like we want to be able to copy multiple lines of text would be a concept/theory then we would break that down into how it works as a behavior spec?

    josephholsten: exactly

    your spec begins as a description

    me: so can we expand of the idea above as an example maybe?

    josephholsten: "should print the text 'hello world' to the console"

    me: ok

    josephholsten: then you turn it into a test

    me: gotcha.  so the ShouldUpdateProfileDataOverWebService

    is the story in a unit tests and once we develop that we write the code to accomplish that story?

    josephholsten: http://pastie.caboo.se/153892

    it is a test, but it's of more than a single unit

    josephholsten: working...

    me: k

    i'm still reading on the BDD site

    josephholsten: so look at the updated pastie, and it's just a interaction behavior specification

    you specify the state behavior or interaction behavior before you write the implementation

    the same is true for stories

    you start with a literal story

    start with a title

    "should greet the user"

    then give it a defined narrative:

    as an <English speaking user>,

    I want <to be greeted when the program starts>,

    so that <I know I can start using the program>

    that's a role, feature, and benefit. respectively

    me: ok that makes more sense now

    josephholsten: like it?

    me: yeah

    i do that in my head just not so formally

    josephholsten: exactly!

    that's what I've been telling BJ for months

    me: LOL I do that in all parts of my life actually.

    Like when I want to go on a camp out.  I walk through a typical weekend and pack for each "event" that is going to happen like Getup so i need xyz clothing wise then pack everything.  Then I pack for the extreme cases just in case

    josephholsten: the only reason to do it formally is when you aren't sure what the next step is, you can just do what the framework says

    me: yeah I like it actually. [smile]

    josephholsten: and hopefully not waste energy on things you don't need yet

    me: yeah. and later you can maybe go back and cover the various use cases that are rare if time permits

    josephholsten: which is more what we need from bdd

    me: yeah.  It makes sense to me now.  Do you mind if I make this chat log a blog post?

    josephholsten: well, not necessarily rare, but not as valuable

    yes, please do

    I'm planning on turning it into a presentation for tonight

    me: k [smile] sweet it is a great walk through i think so if it helps someone all the better.

    sweet

    so i guess we helped each other. [smile]

    do you have some info about your presentation I can maybe post on my blog so people in Tulsa if any are reading can go?

    If you are in Tulsa and would like to here Joseph's talk here is the information on it.

    http://tulsarb.org/
    Bank of America building, 24th floor
    Vidoop offices
    6pm

    Address:

    15 W 6th St Suite 2400
    Tulsa, OK 74119

    Be the first to rate this post

    • Currently 0/5 Stars.
    • 1
    • 2
    • 3
    • 4
    • 5

    Tags: ,

    Agile

    Difference between Real World and Open Source

    by percent20 2/8/2008 12:33:00 PM

    I constantly revisit the thoughts on purchased products vs open source products and how they work in the business world.  I like Open Source Software because it is a great resource to learn from, but have noticed that there are applications that are really good with few developers.  That alone causes a support issue when something breaks.

    Purchased Software

    Usually with purchased software you buy the product and expect, and usually get, reasonable timely support when something goes wrong.  If it is from a small ISV usually you get better support and if it is a bug they tend to get an update for the bug fix out relatively quickly.  Since employees there are paid to work on the product there is constant forward movement, usually, on iteratively released software.  Generally you know what to expect with most companies especially when purchasing from a reputable company.

    Open Source Software

    With OSS you generally get a good product, but with one caveat.  You never know what support is going to be like.  I have used several OSS pieces of software and on a few have extremely awesomely cool support.  Most it is generally mediocre at best if you can get the main devs to even listen to the problem you have.

    Then you have the projects that make me hate OSS people where the support is so horrid you don't want to even try to use it even though it is the only option.  Basically, if you have a problem you get an RTFM, learn what you are doing newb, or write something up on it so others can learn.  None of these actually solve the problem at hand and just lead to really piss me off.  And updates from these proejcts are usually a "I'm not paid to do this so you get it when you get it" type attitude.  To me this is bad for the OSS community and why I stay away from a lot of OSS products when considering something for the business world.

    The Communities

    Behind good products are usually good communities that offer support to others, this is good.  However, community support should be backed up by a good core support team whether it be the company/dev team from a purchased product or the dev team of the OSS project.  If there isn't either than you can run into bad attitudes and problems.

    I find that people don't mind purchasing software because they can get good support from either the company and/or a great community, but they will not use OSS software because they can't be guaranteed what type of support they will get.

    Utopia vs Life

    I have noticed an increasing number of people lately who get into the "OSS for all" type attitude and that proprietary software is evil.  While I can understand where they come from this is a dangerous line of thought because it leads to people with bad attitudes towards feature requests or questions on updates and direction of a project.

    On a few projects I have seen people ask if a feature will be implemented and a usual response is "write-it yourself".  Yes, this would be wonderful if people would or even could  do that on their own.  Or they ask what direction a product is going because they are interested in it; then when they find out it doesn't go the way they want it to they ask why not do this.  This sometimes leads to a "You can branch it and take it that way, but we aren't going to bother".  Point being is they were just curios and they got stuck with a "piss off" response.

    Conclusion

    Basically, what I am getting at is with purchased software most people understand what they are getting into, and don't question it because it has always been this way.  However, with the recent push for OSS the last few years to break into the corporate world it is leading to a lot of animosity between business people and OSS dev's.  Honestly, some OSS people need to pull their head out of their asses and realize that OSS isn't a utopia they think it is and isn't going to be.  Business people need to shut the fuck up and realize that you are in a different time when it comes to software, and just because you aren't paying for it doesn't mean it isn't a good product.

    If we can get OSS people to be more reasonable about development and business people to be more patient when dealing with OSS products things could go a lot further and cool things could happen.  We could even get some great "synergy". ;)

     

    p.s. this was a stream of thought post that has been brewing in my mind for the last few months.  Please, leave comments on this if you want.

    Be the first to rate this post

    • Currently 0/5 Stars.
    • 1
    • 2
    • 3
    • 4
    • 5

    Tags: ,

    Open Source

    Web.Config Basics pt 1

    by percent20 2/6/2008 11:59:00 AM

    One things that has always been utterly confusing in ASP.NET is the dang Web.Config file.  For the beginner to ASP.NET it makes next to no sense and Visual Studio adds a whole bunch of stuff to it that I have no idea what it does.  It is also so odd and confusing if I want to do basic config stuff in my application I have no idea how in the world to go about it. 

    Partly out of necessity and partly to rid myself of not knowing how the web.config works I have been spending time learning about it.  I am first starting out with the basics.  Getting something to work.

    Getting Started

    With most things I want to learn I completely bypass the "how" at first and get something basic to work, which is usually a "Hello World".  That is what we are going to work on in this post.  Lets just see something work.  So these are the two objectives:

    1) Set a configuration option we can use in our code
    2) Allow for debugging our ASP.NET application

    Now, we don't "need" a web.config to run basic .aspx pages, but if you want to anything more advanced than a one page site then you will need one.

    Web.Config

    Here is our web.config that we are going to look at today.

    CropperCapture[45]

    This is really all we need to set a configuration option to access in code and to allow for debugging our application.  Please notice that everything is wrapped in:

    <configuration>
    </configuration>

    That is important to note because all your config information should be under the root configuration node.

    Custom Application Configuration

    Next we have where we will set configuration options.

    <appSettings>
         <add key="Hello" value="World" />
    </appSettings>

    In the appSettings is where you will put configuration options that are like global variables to your WHOLE asp.net application.  So in this case you will access the Hello key and it will return the world as its value.  So the code you would use to access the config options is:

    CropperCapture[48]

    You will use ConfigurationManager object which access all the information in your web.config file.  Since the Hello key is in the <appSettings> node then you would use AppSettings collection to access what key value pair you need.  In this case accessing hello and it returns world.

    Why would you ever need to use this? Well one things comes to mind.  You might have a membership system that you want to turn on and off so you could have in the web.config:

    <appSettings>
        <add key="Membership" value="false" />
    </appSettings>

    In your code you might have it check to see if it is true or false if true then it displays login stuff for people to register and login if false it doesn't display it. It might look something like:

    If(ConfigurationManager.AppSettings["Membership"] == "true")
        //display login control

    This is just a possibility of something you might want to do.

    Debug

    <system.web>
        <compilation debug="false" />
    </system.web>

    Here we set whether we want to debug our application or not.  I usually set this to yes as I have yet to write a bunch of code with out a bug.  All you need to do is to change false to true and you will enable debugging in your asp.net application.

    Conclusion

    The web.config file is actually a little more simple than it appears once you understand more of what is going on with it.  If you take learning it slowly and one little step at a time it is quite possible.  I hope to cover a little bit at a time of the web.config as I learn more and more since it is quite important to learn.

    Be the first to rate this post

    • Currently 0/5 Stars.
    • 1
    • 2
    • 3
    • 4
    • 5

    Tags: , ,

    .NET | ASP.NET

    Stormtroopers in Japan

    by percent20 2/1/2008 4:51:00 PM

    I normally don't post stuff like this, but sometimes they are just too good not to. Enjoy.

    Currently rated 5.0 by 1 people

    • Currently 5/5 Stars.
    • 1
    • 2
    • 3
    • 4
    • 5

    Tags:

    Awesome Stuff

    Eval in DataList, DataGrid, and Repeater

    by percent20 1/24/2008 2:09:00 PM

    Yesterday in the "Coolness of SubSonic" post I had a bit of asp.net markup (as I call it) that would display data in a data list from the data source.  It specifically used.

    <%# Eval("Name") %>

    For a long time I have wondered how that worked I could never seem to figure it out until yesterday.  Basically, you have an object that you bind to the data control like a datalist.  In the case yesterday it was a Product class Object:

    Well in the asp.net markup that we have below:

    Notice in the Eval part it uses Name also notice from the product class above there is a name property.  What ever property the object has you can use that in the Eval and it will display the data in there that comes from our collection of objects.  In this case the Name property of our collection of Product Objects.

    I know this wasn't a "cool" post, but it is something I was excited to finally understand so I thought I would post on it to help others understand hopefully.

    Be the first to rate this post

    • Currently 0/5 Stars.
    • 1
    • 2
    • 3
    • 4
    • 5

    Tags: ,

    .NET | ASP.NET

    Powered by BlogEngine.NET 1.3.0.0
    Theme by Mads Kristensen


    My Flare

    AddThis Feed Button

    National Blog Posting Month

    Eagle Scout

    I'm Test Driven

    [Reserved for MVP status I want to earn]

    View Buddy Lindsey's profile on LinkedIn

    Twitter



    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2008

    Sign in