Apr
17
Posted on 17-04-2009
Filed Under (Programming Hints) by Steven on 17-04-2009

It is actually very simple, first upload your video to box.net. (If your box.net doesn’t look the same as mine, you might just be on a different account level, but you should find similar tools.)

After it has finished uploading click one the link “Share” to make it change to “Shared”
picture-1
Then, click the arrow to open the drop-down menu of tools for that file and click Link to this File

picture-2

A window will pop-up, you want to use the bottom of the two links (the one that ends with an actual file extension like .swf or .flv or whatever.

picture-3

Then just use that link as the src url in your html for your video. For example, I often like using a .flv and then playing it with the JW video player, the code would look something like this:

<div id="container">
<a href="http://www.macromedia.com/go/getflashplayer">
Get the Flash Player</a> to see this player.</div>
<script type="text/javascript" src="/index_files/swfobject.js"></script>
    <script type="text/javascript">
       var s1 = new SWFObject("/index_files/player.swf",
"ply","480","290","9","#990000");
       s1.addParam("allowfullscreen","true");
       s1.addParam("allowscriptaccess","always");
       s1.addParam("flashvars",
"file=https://spatical.box.net/shared/static/cd4gb5rmjv.flv");
       s1.write("container");
   </script>

Now that code also requires you already uploaded the JW flash video player, so the player.swf and swobject.js src files need to be linked correctly.  But you’ll see I linked the actual video directly to the file off of my box.net account.

Get the Flash Player to see this player.

The code for a .swf file with a built in player (like the ones exported from camtasia) require even less code.  You can just link to them directly in an embed tag or object tags.

For that video I just used this code:

<object width="320" height="240"
data="https://spatical.box.net/shared/static/ebx51dtj5i.swf"
type="application/x-shockwave-flash"><param name="src"
value="https://spatical.box.net/shared/static/ebx51dtj5i.swf" />
</object>

That is it.  You should be able to stream lots of videos.  Of course if you ever start getting a lot of video views you’ll want to make sure you upgrade your box.net account to the highest level so you can make sure to get unlimited bandwidth.

Just another tip from Steven hansen

(1) Comment    Read More   
Apr
14
Posted on 14-04-2009
Filed Under (Programming Hints, School Work) by Steven on 14-04-2009

So today I passed off my chess project in my Computer Science CS 240 class.  I think I finished in a fairly good amount of time.  Only stayed up late one night working on it.  My code isn’t super effective in all aspects, although I did manage to do a few things that helped me simplify things.

  • I used an external XML parser called CMarkup, it is free for non-commercial use and it handles all of the silly cases the TA’s give us just fine (just remember to xml.ResetMainPos(); after parsing the board so it can still parse the history even if it came before the board in the xml file.
  • I only wrote two GetCandidateMoves functions.  One for my Piece class and one for the Pawn class.  I just defined directions for each piece, and the main piece move method just got squares in each direction until piece was found or it went off the board.  The pawn class was special just because it had special cases for the first move and capturing moves
  • I wrote a couple of methods in my main Game class that checked for Check and Checkmate (which also shared some child methods).  Stalemate was simply when it is Checkmate but not Check (with the way I wrote those methods).
  • I had memory issues until I took all pointers out of the MoveHistory.  I ended up just saving the piece type and color in the move history instead of a pointer to the piece.  I had issues leaking memory since sometimes I was putting pointers from the pieces saved in the Board class in the MoveHistory then other times I was putting pointers from the Board class in the MoveHistory.  So, so pointers in the move history.  And I made the board basically be the holder for all of the active piece pointers.  When a piece was captured or created, that is when I called delete or new. ( And the board destructor would clean-up any pieces left on the board when exiting or deleting the board before loading a new file).

Another project done for Steven Hansen, and now I am done with a CS minor and a EE major.

    (2) Comments    Read More   
    Apr
    09
    Posted on 09-04-2009
    Filed Under (Internet Marketing) by Steven on 09-04-2009

    Ideas for future email software. (determine how close current open source email software already comes to doing these tasks)

    Persistent program, checks an outbox or database for messages waiting to be sent.

    Collects emails to be sent in grouped by domain, with a max group size or 3-5.

    Never send to the same domain group twice in a row if possible.

    Have entire email pre formatted and ready send.  The email program should only need to grab the text and send it using the email communication protocols.

    Keep the database local or nearby for quick access to pending email list and data

    For bulk emails to the entire list, another server process should be handling the user list, filtering out emails, then pumping the email queue database full of emails. The email will only pull from the email queue and send, no other filtering logic should be required.

    Bounces, stats, and unsubscribes should be handled by another process (but considered by the email handling process).  Each main process could be scaled out to separate and then even multiple machines.

    Handler would need to setup emails will all appropriate headers to maximize deliveribility.

    A white listing manager would still be needed to make actual communication with email service providers.

    (1) Comment    Read More   
    Apr
    08
    Posted on 08-04-2009
    Filed Under (me) by Steven on 08-04-2009

    So I have always known there are a lot of Steven Hansens in the world. I have started to talk a lot more just about my name in this blog to make sure it is clear that I am one of the top Steven Hansen’s on the internet.

    Thanks to a recent search I found from whitepages, there are at least 688 Steven Hansens in the United States. And I imagine that is just the ones that have listed phone numbers. (click the image to enlarge)

    Steven Hansens in the USA

    Google currently reports 25,700 listings when you search for “Steven Hansen” with the quotations, meaning that only counts pages with Steven Hansen in that order and not pages that just happen to have Steven and Hansen on the same page.

    There are 403 Steven Hansen users currently registered with LinkedIn. There are over 500 Steven Hansen users on Facebook. And intelius found 432 of us.

    (2) Comments    Read More   
    Apr
    08
    Posted on 08-04-2009
    Filed Under (School Work) by Steven on 08-04-2009

    We are doing a chess program so I had to make another super long design document. Chess Design Document And here is an html link to one small part of our EcEN 490 senior project final report. All pretty boring documents that I posted here just to save them online somewhere.

    (0) Comments    Read More   
    Apr
    08
    Posted on 08-04-2009
    Filed Under (Electronics, Engineering, School Work) by Steven on 08-04-2009

    Written by Steven Hansen about our ECEN 490 Senior Project BYU Robot Racer 2009

    A fundamental piece of the project was actually controlling the steering angle and driving speed of the robot in order to successfully navigate the complicated pylon courses. After deciding early in the semester that we would drive directly towards the pylon we simply had to build an algorithm that could use the vision data to perform that principle action. First we created a few principle parameters that would be used throughout the control code. This including the parameters for driving straight speed, turning speed, number of encoder ticks to count per radian, and the distance before pylon to start turning. We were able to first successfully run the control code through the given simulator. Which allowed us to do some initial adjustments to our design and test our idea of driving directly towards the pylon.

    We implemented this design with a simple state machine. During iterations through the main loop it would call the control state machine after analyzing a new frame of data from the camera. The state machine consisted of 6-7 states that the truck could be in at any given moment. The states included:
    1. Pylon searching. During this state it was assumed that the pylon was in the given view. However it would only move out of this state when the vision software successfully recognized a pylon. If no pylon was currently recognized our final design simply had the truck continue straight at a slower speed while giving the vision algorithm more passes to analyze the data.
    2. Pylon following. During this state the truck would make simple steering adjustments in order to maintain the pylon x-coordinate plus the width of a pylon in the center of the truck. Bigger distances from the center of the screen would mean larger adjustments of the steering angle during this state. The truck would continue in this state until the distance from the pylon was calculated to be less the threshold set in the global parameters as the distance before the pylon to turn.
    3. Setting up the turn. There were two hard coded states that depended only on the parameters set for the truck. These two steps including turning slightly away from the pylon in the opposite direction then needed to be turned around the pylon and then driving straight a set distance in order to line up with the pylon nearly perpendicular from the line at which it was driving towards the pylon. If the vision consistently gave accurate values for the distance of the pylon these state worked perfectly every time. We assumed during this state that we would lose site of the pylon and we therefore did not use any of the vision calculations while in these states.
    4. Dead-Reckoning turn around the pylon. Upon entering this state we simply saved the current Encoder value plus the number of ticks we needed to travel to complete the turn. This extra number of ticks was calculated by the angle given in the course description. When we approached a pylon of the same color as the previous pylon we added an extra 10 degrees to every turn due to the manner that we were entering the turns from an angle slightly less the perpendicular to the line straight from the previous pylon. When the truck approached a pylon of a different color then the previous pylon we added an extra 45 degrees to the turn in order to compensate for the fact that in this case the truck was crossing over the straight line between the two pylons and actually entered the turn much further back in the turn. The number of ticks per radian was set by a global parameter that we also could change through our gui. This variable of the ticks per radian needed to be adjusted when we tested new faster speeds navigating the course. When the calculated number of ticks had been completed the truck then moved back into the pylon searching state.

    Full Chronological Review and other files

    (0) Comments    Read More   
    Apr
    04
    Posted on 04-04-2009
    Filed Under (iphone) by Steven on 04-04-2009

    This has been tested and works with iTunes 8.1 and the newest iPhone 3.0 beta r2 update. (for DRM free files only).

    To create custom ringtones using only iTunes:

    1. Right click on the song you are going to make into a ringer and select “Get Info.”
    2. Go to the options tab and go down to the “Start Time” and “Stop Time” check boxes. Check both boxes and input the time you want your ringer to start/stop. The ringer has to be 30 seconds or less. Click OK when you’re done.
    3. Right click on your newly “clipped” song and select “Convert Selection to AAC.” The song will be re-encoded using the start and stop times determined (If your menu item does not read “Convert Selection to AAC” and reads “Convert Slection to MP3? (or some other format) please go to iTunes > Preferences > Advanced > Importing and change the “Import Using” drop down menu to “AAC Encoder”).
    4. After the song is done encoding navigate to your iTunes Music folder, locate your song, and drag it to your desktop. After the song is on your desktop go back to iTunes and delete the clipped version from you iTunes library (It won’t delete it from your desktop, it will only remove it from iTunes).
    5. Go back the song on your desktop and right click on your song and chose “Get info.” Go to the name and extension section and change the extension from .m4a to .m4r (or you can just change the extension right from your desktop)
    6. After the extension is changed simply double click on the file to add it to your iTunes library under the ringtones section. Sync your phone with iTunes and you’re done!

    Remember to go back into iTunes and uncheck your custom start and stop times for the original version of your song.

    Content by theAppleBlog

    (0) Comments    Read More