Subscribe: Rob Chartier ~ Contemplation...
http://weblogs.asp.net/rchartier/rss.aspx
Added By: Feedage Forager Feedage Grade B rated
Language: English
Tags:
background color  background  color csharpcode  color  csharpcode color  csharpcode  dotnetnuke  imp  margin csharpcode  net  new 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Rob Chartier ~ Contemplation...

Rob Chartier ~ Contemplation...



.NET, C#, Work, etc.



 



Electric Imp–A Simple LED, but on what Pin?

Wed, 15 Jan 2014 04:37:58 GMT

  My Electric Imp decided to show up in the mail the other day, so I decided to start the hacking adventures.  This post is intended to document my initial experience and steps follows to get a working prototype in place in order to turn on and off a LED. Parts List: imp card April Development Board MiniB (yes a MiniB, not A) USB Cable 5V USB Power Supply Breadboard 330 Ohm Resistor (orange, orange, brown, gold) I actually purchased a pack similar to this, which comes with a whole line up of resistors for all your hacking fun. LED Again, shop around for a pack of LED’s on the cheap.   Getting Online & the IDE The first thing you need to do is get your imp online via your WiFi network.  In order to make this happen you need to have an iOS or Android device.  The kind folks at Electric Imp have provided a “BlinkUp” app for each platform, which essentially allows you to point the Imp at your screen, and with a series of flashes it will program your device. Download the iOS App or download the Android App now. In my instance, my dev Android device has a fairly cracked screen, which simply did not work to flash the Imp, luckily I had an iPhone around, and it just worked out of the box, first try.  The Imp uses a cloud based development environment, found here, and in order to pair your shiny new Imp with your online account, you will need to setup an account on their website, and enter those credentials into the BlinkUp App prior to flashing your imp. Now lets flash the imp: Launch the BlinkUp app, Enter your credentials, and select the correct Wifi AP. Be sure to set your WiFi password in the UI; it is not automatically provided for you. Plug the Imp into the April Development Board Plug the MiniB USB cable into the Development board Plug the other end of the USB Cable into your 5V USB Power supply, and then that into a receptacle. At this time you should see the Imp blinking yellow This means it is ready to be flashed Hit the “Send BlinkUp” button on your mobile device At this time you have about 3 seconds to point the Imp to the screen of the mobile device.  I pointed them about 1 inch apart, with the LED on the Imp pointing towards the screen.  I noticed that once the pairing was in progress the internal LED light on the imp stuttered and blinked at a different rate.  Give it time. Eventually the Imp’s LED will stop blinking yellow, and go through a few different colors until it reaches a nice green color.  This means it is now online! Now that your Imp is online, lets get going on the IDE.  On the left you have a list of your Imp Devices (New Devices) and Inactive models.  Your new Imp should be showing up as device on the left.  Along with devices, you also have the concept of “Models”.  Models are a way to describe the applications you will write.  Each Model can be active on a device, or in the “Inactive Models” section.  This allows you to share Models (Apps) across Imp Devices, and to be able to swap in and out different apps per Imp.  Simple and easy to use. Each Model consist of two blocks of code. One which rums on the Electric Imp’s Cloud Server (Agent), and another block which runs on the Imp (Device) itself.  Both of these code blocks run code using the Squirrel language, a high level and lightweight language. Take time now to setup the hardware and software based on this guide and then this guide. At the end of these samples you will be able to control your Imp, from a URL on the Electric Imp’s Cloud server. Lets Code! I decided to hack the second guide, and allow to be able to send the Pin which the LED is sitting on, via the URL as well!  Here is my[...]



Halloween 2013 Build using a Raspberry Pi

Thu, 28 Nov 2013 20:23:21 GMT

  This year for Halloween I wanted to start to scratch the surface of what I could do with a Raspberry Pi in order to bring a “haunted” experience to my front yard. My guidance/inspiration was from here. Overall, I wanted to have a single motion sensor trigger a sequence of scenes where each scene would incorporate one or more lights, one or more audio tracks and be limited to about 30 seconds or less. Parts List I broke the parts list up into two groups, the first is the items you probably would need to buy online, the second you should be able to get most of them from your local Home Depot, Lowes or other hardware store. Online parts list: 1 x Raspberry Pi, Model b 1 x USB Powered Speakers (externally powered) 1 x PIR Motion Sensor 1 x Breakout board/Extension wires, Male->Female, 4 to 6 inches in length 5v 1 x 1Amp USB Port power supply with an A/Micro B cable 1 x 4GB SDHC MicroSD Memory Card 1 x Low-Profile microSD card adapter for Raspberry Pi 6 x Solid State Relays, 3v to 110v+ Essentially you apply 3 volts to one pair of terminals, which will turn on the 100v pair. Optional online parts: You may need a HDMI (Male) to VGA Adapter if you do not have an HDMI compatible TV or Monitor.  To initially install the Pi OS, you will need a way to output the video. You may also need some sort of USB keyboard, wired or wireless, most just work.  If you don’t have one one hand, you should consider getting one of the smaller form factor wireless keyboards which you can reuse and is portable along with your Pi’s. Finally you also need a way to give this device access to your network.  If you have a router with a spare LAN port you can use it, just be sure you have a Cat5e networking cable (male on both ends) available for the project.  Otherwise a hub will be just as suitable.  As an alternative you can find many mini WiFi USB dongles that are compatible for the Pi. I chose to NOT use the WiFi dongle because it is an additional cost.  I will not cover of WiFi configuration in this post, there are many online articles outlining the process. You can buy most of these from adafruit.com, dx.com, or any other favorite retailer.    Hardware store parts list: 4 x (double) receptacle wall sockets [NEMA 5-15 (15A/125V earthed) Type B] 3 x electrical boxes 1 x single width 1 x double width 1 x triple width 1 x double electrical face plate, “blank” or cover 1 x single receptacle wall socket face plate 1 x triple receptacle wall socket face plate     20 x twist-on wire connectors 1 x 50 feet of electrical cable, of appropriate gauge for your country 1 x Bag of electrical cable staples, probably need 50 to 60 1 x bag of wood screws, 3” long, at least 24 screws 1 x bag of wood screws, 2” long, at least 12 screws 1 x Plywood, 2 feet squared, about 1” thick  (bottom base) 2 x 2x4, 2 feet in length (sides of base) 1 x 1x2 2 feet in length (front) 1 x Plywood, 1.5 feet squared, (back / relay anchor) Box Construction: Take the base plywood (2x2x2) and secure the 2x4’s to each opposite side.  Add the 1x2 to one end, and finally the 1.5 foot squared plywood to the back.  This will form an awkward sided box without a lid.  This is by design.  It will provide enough room for you to secure the two larger electrical box’s to the front left and right, and the smaller box on the left side, in the middle.  Finally each relay can be secured to the back / relay anchor piece. Since a picture is worth a thousand words, here are a few to help out. Notice the smaller receptacle box on the left.  It is “Always On”, meaning we hardwire power directly to both of those receptacles.  The larger box on the right, with the three pairs of receptacles, those are[...]



Extending your Home Automation network with Raspberry Pi

Thu, 14 Nov 2013 21:40:55 GMT

  Just thought I would share that last night I decided to throw some code together which will mash up the Raspberry Pi along with the zVirtualScenes server.  In reality you could deploy the scripts to any machine capable of running python (OSX, Windows, *nix, etc..).  All communication is done via UDP using Multicast groups, so every node on the network will send to this single group, and all other nodes will receive the events. Interesting idea.   Here are some screen grabs from zVirtualScenes connected to a Raspberry Pi, with a PIR motion sensor: 1. Enabling the “SensorNet” adapter   2. Auto-discovery working.  The server sends a “RegisterRequest” message to the group, and each node starts to report in with their capabilities.   3. All motion values are stored in zVirtualScenes server, and can be used for triggering events   4. Triggering an event based on motion detected on the RPI:     The idea here is that you can use the Raspberry Pi (base cost of $35) to setup a sensor network, a command network, etc.. on your LAN for all of your Home Automation needs.   Some examples Have your garage door wired with a Pi and a Solid State Relay Switch (http://dx.com/p/ssr-10da-solid-state-relay-white-silver-230994), and have that device/switch show up in zVirtualScenes and also to be able to easy control it.     You could setup a series of cheap Sensors in your home wired to a single or many Pi's, and have each readable/actionable in zVirtualScenes.  Some examples: Triple-axis analog accelerometer - for measuring motion and tilt Force sensitive resistor - for sensing pressure/force Temperature sensor - for measuring from -40 to over +125 degrees C 10K breadboard potentiometer Hall effect sensor - for sensing a magnet Piezo - can be used as a buzzer or a knock sensor Ball tilt sensor - for sensing orientation Photo cell sensor - for sensing light IR sensor - for sensing infrared light pulsing at 38KHz IR LED - for use with the IR sensor FYI, you can by ALL of those sensors, for $35 right now: http://www.adafruit.com/products/176   Have XBMC announce what’s playing information, and to be able to control XBMC via zVirtualScenes Monitor and control remote OSX, Windows, Linux desktops via zVirtualScenes    Disk SMART status, watch dog for apps & services, etc.. and trigger events in your Home Automation network based on these events. Have a different device in your network Monitor zVirtualScenes events and respond accordingly.  This really allows us to break out of just controlling z-wave enabled devices, to being able to control ANY device on your network.  There is really no limit of the possibilities here.   Show me the code! Right now it is a bit too early to share all of my code. I do plan on opening it all up under some no-limit license, once it gets to an acceptable point for publishing. With that said, here is the gist of getting a PIR Motion sensor on a PI on the network - it is in python, so tread lightly... :) import GPIO from App import App app = App("RPI-Upstairs"); ##give this device a unique name on your network ##Import your sensors from sensors.zMotionSensor import zMotionSensor as MotionSensor ##register your sensors pin7pir = MotionSensor("Main Entry Motion Sensor (PIR)", #unique display name for this sensor on this device 7, ## GPIO port used GPIO, app ) ##just ignore these, we are injecting our dependencies pin7pir.monitor() #setup this sensor to start monitoring for input app.wait() ## setup our wait loop for our daemon, to allow for the magic to happen   .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpc[...]



Getting started with Developing for the AGENT SmartWatch

Fri, 21 Jun 2013 03:06:59 GMT

Updated to include screenshots from the read Agent Installer, and project templates, and a few Amazon book references. Prerequisites : Tools and SDK’s Now that the AGENT : The World’s Smartest Watch has been successfully funded with Kickstarter its time for the developer community to kick into gear and start writing watch faces and apps so when the time comes for the release of the store we can have hundreds of not thousands of available applications ready for mass consumption! If you are a hobbyist, or a new developer that has that killer idea for a face or app for the AGENT, or you just want to tweak someone else's idea this post is for you! First and foremost you will need a Windows machine.  I prefer Windows 8 but Windows 7 will do just fine.  If you already have Visual Studio .NET (VS.NET) installed, skip over this step.  Otherwise Download Visual Studio Express 2012 from here. (Direct) –Start it now and then read on… A bit of nomenclature: VS.NET is an IDE (Integrated Development Environment – picture notepad on steroids).   It allows you to author applications using a variety of languages (most common is C#) for a variety of scenarios. .NET is a Framework.  It provides a comprehensive and consistent programming model for building applications – a set of APIs.  It can be consider it as an abstraction above other lower level API’s. .NET Micro Framework is a tiny subset of the .NET Framework which is targeted and streamlined for Micro (tiny) devices.  It does not include many, many features, and API’s from the larger .NET Framework - keep this in mind when you are reading online documentation; you will soon find out that the .NET Framework supports a much needed API call but find out that it has NOT been ported to the .NET Micro Framework.  This can be confusing for many folks that are new to the .NET Micro Framework. C# is a programming language. Essentially you will use VS.NET, write code in C#, and target the .NET Framework and in our case here we will be targeting the .NET Micro Framework. If you are looking for an introduction to C#, consider these resources: MSDN Introduction to C# Introduction to the C# Language and the .NET Framework CSharp Book by Christoph Wille CSharp Station’s Tutorial Pluralsite : C# Fundamentals Part 1 Embedded Programming with the Microsoft® .NET Micro Framework Expert .NET Micro Framework (Expert's Voice in .NET) More specifically if you want a beginners guide to C# and the .NET Micro Framework here is a PDF to download. So by now your download should be finished.  At the time of writing this, the download was an ISO.  Since I’m using Windows 8 I’m able to right click that ISO and mount it as a DVD right there.  For Win 7 users you may need to download a tool like UltraISO, Gizmo, or Virtual CloneDrive which will be able to take that ISO that you downloaded and “mount” it (or treat it) as a DVD drive on your system.  If that doesn’t work for you, go old school and burn the ISO to a DVD. Start the installer by double clicking the wdexpress_full application on the DVD.     Once the installer is ready you will be prompted with the installation tool: Be sure to hit the “I agree…” checkbox and optionally check the checkbox to Join the Customer Experience Improvement program if you like and the hit INSTALL.   Now its time to go for a coffee, or you could use the time that it takes to install VS.NET to review the sites above get (re)acquainted with C# and the .NET Micro Framework! Eventually…. Hi Launch. Click the “Register Online” button to launch your browser for registration.  You will be required to have a Microsoft Live account to proceed, so either login or create a new account. Once you are logged in, fill out the required information in their registration tool and finally you will be g[...]



AGENT: The World's Smartest Watch

Mon, 17 Jun 2013 00:24:23 GMT

AGENT: The World's Smartest Watch by Secret Labs + House of Horology Disclaimer: Most if not all of this content has been gleaned from the comments on the Kickstarter project page and comments section. Any discrepancies between this post and any documentation on agentwatches.com, kickstarter.com, etc.., those official sites take precedence. Overview The next generation smartwatch with brand-new technology. World-class developer tools, unparalleled battery life, Qi wireless charging. Kickstarter Page, Comments Funding period : May 21, 2013 - Jun 20, 2013 MSRP : $249 Other Urls http://www.agentwatches.com/ https://www.facebook.com/agentwatches http://twitter.com/agentwatches http://pinterest.com/agentwatches/ http://paper.li/robchartier/1371234640 Developer Story The first official launch of the preview SDK and emulator will happen on 20-Jun-2013.  All development will be done in Visual Studio 2012, using the .NET Micro Framework SDK 2.3.  The SDK will ship with the first round of the expected API for developers along with an emulator. With that said, there is no need to wait for the SDK.  You can download the tooling now and get started with Apps and Faces immediately.  The only thing that you will not be able to work with is the API; but for example, watch faces, you can start building the basic face rendering with the Bitmap graphics drawing in the .NET Micro Framework.   Does it look good? Before we dig into any more of the gory details, here are a few photos of the current available prototype models.   The watch on the tiny QI Charter   If you wander too far away from your phone, your watch will let you know with a vibration and a message, all but one button will dismiss the message.   An app showing the premium weather data!   Nice stitching on the straps, leather and silicon will be available, along with a few lengths to choose from (short, regular, long lengths). On to those gory details…. Hardware Specs Processor 120MHz ARM Cortex-M4 processor (ATSAM4SD32) with secondary AVR co-processor Flash & RAM 2MB of onboard flash and 160KB of RAM 1/4 of the onboard flash will be used by the OS The flash is permanent (non-volatile) storage. Bluetooth Bluetooth 4.0 BD/EDR + LE Bluetooth 4.0 is backwards compatible with Bluetooth 2.1, so classic Bluetooth functions (BD/EDR, SPP/AVRCP/PBAP/etc.) will work fine. Sensors 3D Accelerometer (Motion) ST LSM303DLHC Ambient Light Sensor Hardware power metering Vibration Motor (You can pulse it to create vibration patterns, not sure about the vibration strength - driven with PWM) No piezo/speaker or microphone. Other QI Wireless Charging, no NFC, no wall adapter included Custom LED Backlight No GPS in the watch. It uses the GPS in your phone. AGENT watch apps are deployed and debugged wirelessly from your PC via Bluetooth. RoHS, Pb-free Battery Expected to use a CR2430-sized rechargeable battery – replaceable (Mouser, Amazon) Estimated charging time from empty is 2 hours with provided charger 7 Days typical with Bluetooth on, 30 days with Bluetooth off (watch-face only mode) The battery should last at least 2 years, with 100s of charge cycles. Physical dimensions Roughly 38mm top-to-bottom on the front face 35mm left-to-right on the front face and around 12mm in depth 22mm strap Two ~1/16" hex screws to attach the watch pin The top watchcase material candidates are PVD stainless steel, brushed matte ceramic, and high-quality polycarbonate (TBD). The glass lens is mineral glass, Anti-glare glass lens Strap options Leather and silicon straps will be available Expected to have three sizes Display 1.28" Sharp Memory Display The display stays on 100% of the time. Dimensions: 128x128 pixels Buttons Custom "Pusher&qu[...]



The Store : Observations from the first week after the release.

Wed, 15 Feb 2012 16:58:34 GMT

  In order to start this post I want to take a big step back first talk about communities. Communities, at the base level, really boil down to social interactions of organisms with each other. These organisms coexist in a society. Societies can be thought of people that are related to each other, that share common expectations and/or authority. Seems simple enough, right? If we dig a bit deeper into the social interactions of organisms we can begin to get an idea that there are a variety of types of people – as defined by their behaviour. Typically there are 4 types that really stick out, at least for me. Socializers This is the biggest group of any community. Usually about 80% of the population. They are seeking light-weight, non-confrontational easy to reciprocate social interactions with other people. Achievers These folks go to great lengths to achieve rewards simple for the prestige of having it. Explorers They are involved in the community for the social credit of having discovered something. They love to discover an unknown glitch or a hidden Easter egg. Killers These types thrive on competition with others in the community, in order to win and their expense. Think of each community you belong to and what type of behaviour you typically exhibit. How your actions/interactions impact the overall state of the community.  What is your typical tone within those communities.  Also, are you typically a positive person or do you “bring the hammer” with negativity?  Maybe your a realist?  No matter your behaviour type and the tone you use, you do impact the community.   So why all the preamble? Its important to understand the nature of our community - DotNetNuke and the smaller/sub community of The Store.  As, essentially, the “authority” for The Store we must keep our eyes and ears open to all input from the community.  We must adapt and change with the “expectations” of our community.  We must learn from each other.  The very second we stop listening to the community (to you) we all lose. While doing so we are sensitive to the fact that there will always be those people that are very positive – they are looking out for the community and want to see it foster and grow; and then there are the negative types.  I would almost always agree that they too are looking out for the greater good of the community they just express themselves in a slightly different manner. You must develop a pretty thick skin for those that exhibit a very high level of negativity about any change (good or bad) within the community – after we all cant put our biggest smile on every day, right? Both of those types serve a huge purpose for the Community and do play an essential role to our collective success. In this past week, since we launched what we are calling version 2 (v2.0) of The Store we have directly come into contact with pretty much every type of personality out there: Socializers, Achievers, Killers, Positive types, negative types, etc..   Everyone is coming out of the woodworks… This is awesome! The most encouraging thing for us right now is that feedback.  Have confidence that we are tracking all items and triaging/fixing the high priority issues as soon as humanly possible.  Gemini (bug tracker) and TFS (source control) are very active with frequent changes.  We are doing our best to keep on top of the list and publishing to production as soon as it makes sense.  Based on twitter there are many of you out there that have directly experienced the fast turn around we strive for, we will do our best to keep that pace going. Right now, the best way for us to receive feedback is to either email us at  store [at] dnncorp [dot] com, or by using our Help Desk.   We need[...]



SnowCovered.com finally gets an upgrade

Thu, 09 Feb 2012 18:38:48 GMT

When we (DNNCorp) originally took ownership of SnowCovered.com from Brice Snow it was running on DotNetNuke 2.1.2 (Release date was June 14, 2004), v1.0 of the .NET Framework and on a low-end hosting provider. Looking back, I recall that we were lucky to get 80% to 90% uptime in any given month. It was on its last legs. We knew, the community knew, we HAD to take action. Fast forward a little while, and just over a year ago we launched an internal “Upgrade” project for SnowCovered.com. Here is how that story played out… Our first initiative was to upgrade from the low-end hosting to our own infrastructure which brought up our stability immediately to 99.9% uptime. This was a huge gain for us and the community as a whole. It was nice to be able to rely on solid infrastructure. All of the negativity around the amount of downtime simply fizzled. Our first significant win! The next step was to tackle the DNN 2.1.2 issue. For those of you that don’t recall the history of DNN, 2.1.2 was release before the ASP.NET Team release the (then) new Personalization and Membership pieces. The team here spent hours ensuring that every single user in the SnowCovered membership database was upgraded. Countless tests and dry runs were performed, and in the end we prevailed. All users can and will be upgraded fully. Another win for the team. The largest task was the actual code base itself. There was a significant amount of rework and simply replacing much of the codebase (VB.NET to C#) as we transitioned it all to the 6.x family of the core framework. At that time we had just hired Nathan Rover and put him on this challenge. He gladly accepted and took the lead. For those of you want have not yet met Nathan, he is a marathon runner – just the man suited for this marathon upgrade and release schedule. Over the year they took inventory of the feature points, upgraded code, reviewed artwork & designs, cried/yelled/screamed, held design meetings, drank a few gallons of redbull/monster/beaver buzz, QA, upgrade meetings, daily scrums, Unit Tests, more QA, frequent vendor reviews & demos. Project plans were scraped, created and scraped again. We have had churn in almost every aspect of the project. The team kept running. There were a few points over the past year were we almost gave up. The stress was high; the light at the end of the tunnel was just barely visible. Nathan and the team pushed on. We persisted. The team kept running. Finally the light was blinding. We invited many (~100) of the vendors in for a private Beta; received well over 40 issues, all of which were addressed with great care and attention, and finally accepted the final list of bugs in for the initial RTM release. The team worked day and night nailing these issues down in order to meet our aggressive release schedule, without sacrificing the level of quality we demanded in this release. As of 3:00AM PST February 9th, 2012 we crossed the finish line! We are proud to announce that we have released initial public release of "DotNetNuke, The Store" Congrats goes out to the entire team! Here is a before screenshot, as of July 19, 2012:     and now…       ..we are just getting started…[...]



Getting DotNetNuke to render correctly in IE9

Wed, 29 Sep 2010 19:12:00 GMT

As we all download the Beta of IE9 we are faced with the challenge of many sites having breaking changes to the UI.  This becomes more apparent when you have rich functionality provided by vendors such as Telerik, the FCK Editor, or whatever you have chosen internally.

For example, here is a screen shot of DotNetNuke, using our default skin, breaking under IE9 when using the default “IE9 Standards” mode.

 

(image)

 

What you see above is the Telerik Editor Provider when editing content using the Text/HTML module.  In order to correct the above issue, you must switch IE9 to use a more compatible mode. 

If you bring up the IE9 Developer tools, which are standard now as part of the browser installation, by hitting the F12 key.

You will see the tool shown at the bottom of the browser:

 

(image)

 

 

Notice the “Browser Mode: IE9” and the “Document Mode: IE9 standards”.  You only need to change the “Document Mode:” drop down to “IE8 Standards”:

 

(image)

 

You page will refresh with the new Document Mode, and it should now properly be showing the right UI.

 

 




.NET BC : A Lap around WebMatrix; With a dash of Razor

Wed, 25 Aug 2010 17:26:00 GMT

  Last night most of the DotNetnuke team and I traveled into Burnaby, to the BCIT campus where I gave a real quick (1 hour) presentation on the WebMatrix Beta, and Razor Syntax. I was happy to see that we had over 60 people attend.  It was awesome to see the turn out on a hot summer evening.  Download the Slide Deck There were a number of questions which came up, I will try to remember them all here.   Working with Data – the db.Query() execution, can it be parametrized? @{ var db = Database.OpenFile("SmallBakery.sdf"); var selectQueryString = "SELECT * FROM Products ORDER BY Name"; }@foreach (var row in db.Query(selectQueryString)){ @row.Id @row.Name @row.Description @row.Price } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }Yes, you can.  Here is an example. @{ var db = Database.OpenFile("SmallBakery.sdf"); var Name = Request["Name"]; var Description = Request["Description"]; var Price = Request["Price"]; var insertQuery = "INSERT INTO Products (Name, Description, Price) VALUES (@0, @1, @2)"; db.Execute(insertQuery, Name, Description, Price);} .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } What and Who is WebMatrix and Razor targeted to? Essentially the breadth developer.  Those folks that possibly come from a PHP background or even are new to the development world.  This will allow for them to onboard with a few minor tweaks to existing projects to get up and running as fast as possible.   Why is Web Matrix even needed when we have Visual Studio? The initial thoughts are that this product is going to be free.  It will have a bare minimum feature set targeted to the scripter.  The UI is far simpler than what VS.NET Users are used to.  You could consider it as a a stepping stone into VS.NET.   There was some discussion around Razor Syntax and MVC.  Using it as a view engine.  Here are some resources to help with this answer. http://gurustop.net/blog/2010/07/06/thoughts-on-razor-microsofts-new-asp-net-mvc-view-engine/ and http://www.dotnetcurry.com/ShowArticle.aspx?ID=561 The topic of LightSwitch came up as well.  Here is the product page http://www.microsoft.com/visualstudio/en-us/lightswitch SIMPLEST WAY TO BUILD BUSINESS APPLICATIONS FOR THE DESKTOP, WEB AND CLOUD Microsoft Visual Studio LightSwitch gives you a simpler and faster way to create professional-quality business applications for the desktop, the web, and the cloud. LightSwitch is a new addition to the Visual Studio family. Vis[...]



Sql Scripts - Delete all Tables, Procedures, Views and Functions

Fri, 20 Aug 2010 18:41:00 GMT

In a shared environment you typically don't have access to delete your database, and recreate it for fresh installs of your product.  I managed to find these scripts which should help you clean out your database. Use at your own risk.   Delete All Tables --Delete All KeysDECLARE @Sql NVARCHAR(500) DECLARE @Cursor CURSORSET @Cursor = CURSOR FAST_FORWARD FORSELECT DISTINCT sql = 'ALTER TABLE [' + tc2.TABLE_NAME + '] DROP [' + rc1.CONSTRAINT_NAME + ']'FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS rc1LEFT JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc2 ON tc2.CONSTRAINT_NAME =rc1.CONSTRAINT_NAMEOPEN @Cursor FETCH NEXT FROM @Cursor INTO @SqlWHILE (@@FETCH_STATUS = 0)BEGINExec SP_EXECUTESQL @SqlFETCH NEXT FROM @Cursor INTO @SqlENDCLOSE @Cursor DEALLOCATE @CursorGOEXEC sp_MSForEachTable 'DROP TABLE ?'GO .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } Delete All Stored Procedures declare @procName varchar(500)declare cur cursor for select [name] from sys.objects where type = 'p'open curfetch next from cur into @procName while @@fetch_status = 0 begin if @procName <> 'DeleteAllProcedures' exec('drop procedure ' + @procName) fetch next from cur into @procName endclose curdeallocate cur .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }   Delete All Views   declare @procName varchar(500)declare cur cursor for select [name] from sys.objects where type = 'v'open curfetch next from cur into @procName while @@fetch_status = 0 begin exec('drop view ' + @procName) fetch next from cur into @procName endclose curdeallocate cur .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }   Delete All Functions   declare @procName varchar(500)declare cur cursor for select [name] from sys.objects where type = 'fn'open curfetch next from cur into @procName while @@fetch_status = 0 begin exec('drop function ' + @procName) fetch next from cur into @procName endcl[...]



A Lap around WebMatrix – Vancouver on August 24th.

Tue, 10 Aug 2010 03:03:00 GMT

 

I just checked and it looks like the folks at .NET BC have managed to get around to post my up-coming presentation. 

(image)

Topic: A Lap around WebMatrix
Please join Rob Chartier, VP of Engineering & Support at DotNetNuke, in a brief Lap around the new WebMatrix tool from Microsoft. Rob will cover most of the high-level features of the tool and even dig into the new Razor syntax.

http://netbc.ca/DNCal/EventDetail.aspx?date=2010/08/24

(image)

 

See you then!




More on Dynamic Language Execution within DotNetNuke

Tue, 10 Aug 2010 00:57:14 GMT

A few weeks ago I ripped out a module over the weekend which allowed a Content Editor for DotNetNuke to be able to actually start scripting content within the UI.  Imagine being able to embed scripts within (a) the Text/Html module which is complied+interpreted on the server; a Text/Html/Script module. That is essentially what this Dynamo module allows you to do; Dynamic Language Execution within DotNetNuke.  It doesn’t use Reflection.Emit so it is safe in Medium Trust. I wanted to do a follow-up post to highlight some of the changes that I have made over the past few weeks and to request feedback from you folks. Context Switching The first revision of my module did not allow you to switch between HTML and Script in a single script block.  In fact it took the entire input you gave it and treated it as Script.  Thus you had to hard code all HTML blocks within “echo” statements (aka Response.Write).  This was one of my goals for the first release, but I decided to move ahead without it.  I spent a decent amount of time figuring out the best way to handle this, and here is what I came up with: By Default the script will treated as HTML.  You must enclose actual Script within @{  …..  }@ tags. It will process each Context in order and append that to a string builder Finally, once all Context blocks are complete, emit a LiteralControl with the final content. I have this working in the recent builds (past 1.5.0), and working quite well.   Error Handling There are two core areas around Error Handling that I had defaulted to (poorly) in the past.  The first was when the Jint (the internal mechanism that handles the Dynamic Scripting Support) throws/returns an error I added it to the module output and emitted it to the page along with the rest of the content.  This is now being suppressed.  I also break out of step execution of all of the context switching.  That is, the step which threw the exception will be the last one to execute.  This is for a normal user.  For a SuperUser it will Append() the exception and continue the execution. Second, I set Jint’s debug mode to that of the HttpContext.Current.IsDebuggingEnabled flag.  So it aligns Jint’s debugging with what you have set in web.config. Security The last piece that I still have left to take care of is Security.  Ultimately the Jint engine relies on two methods to handle security.  The first of which is to completely Disable the security and the second is to utilize the System.Security.Permissions Namespace in order to control access.  For this release I have just completely Disabled Security.  My next set of work will be dedicated to creating an Host->Scripting menu item which allows you to control Security on a per Portal basis.   Finally, if you are using the module for anything or if you have any feature enhancements or changes, please let me know.  I plan on contributing to this module for the coming months. I just updated to 1.6 on Codeplex.  Go upgrade now![...]



Sprite and Image Optimization Framework & DotNetNuke

Mon, 09 Aug 2010 19:50:49 GMT

Introduction The folks over at Microsoft recently pushed a open source release of their Sprite and Image Optimization Framework onto Codeplex last week.  And after a few tweaks I was able to get it running within DotNetNuke, here is how… Download the Sprite and Image Optimization Framework.  Unzip it and open up the ImageOptimizationFramework.sln file using Visual Studio .NET 2010.  Getting it 3.5 Compatible If you are still running your DotNetNuke installation on 3.5, you will need to change the “Target Framework” for both the “Web Forms Control” and the “Image Optimization Framework” down to 3.5.  This can be achieved by right clicking the project and under the “Application” Tab / Target Framework choose “.NET 3.5 Framework”, save and close both property windows. Next you will notice that when you attempt to build (now that we are on 3.5) you will get a compiler error.  In ImageOptimization.cs I changed the following method to look like: private static void RebuildFromCacheHit(string key, object value, CacheItemRemovedReason reason) { var data = (object[])value; string path = (string)data[0]; IEnumerable cachedDirectoriesBelowCurrentFolder = (IEnumerable)data[1]; .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } That is, I replaced their use of the Tuple class with the generic object[] The second method that needed to be changed is: private static void InsertItemIntoCache(string path, IEnumerable directoriesBelowCurrentFolder) { string key = Guid.NewGuid().ToString(); //var value = Tuple.Create(path, directoriesBelowCurrentFolder); var value= new object[]{path, directoriesBelowCurrentFolder}; HttpRuntime.Cache.Insert(key, value, new CacheDependency(path), Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.NotRemovable, RebuildFromCacheHit); } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } Notice again, it was converting the Tuple to use an object[].  I’m sure there is a more optimal way available but this is good enough for this round of testing. The solution should compile now.  DotNetNuke If you navigate to the folder”  %My Download Directory%\sprite-image-optimization-framework\WebFormsControlSample\Bin\   you will see the 2 compiled DLLs and PDB files. XCopy deploy these into your local (testing) DNN installation’s bin folder. You will now need to crack open your web.config for your DNN installation and add the following line, under the “System.Web/httpModule[...]



Introducing… Dynamo – A Scriptable DotNetNuke module

Wed, 21 Jul 2010 17:31:00 GMT

Introduction Imagine, for a second, you have a server sided JavaScript interpreter built right into a Content Management System. It should have full access to the entire Server sided API’s, depending on security requirements of course. You could literally treat source code as content. That is what this post is about. If you have ever created a module for DotNetNuke you probably have spent (wasted) countless hours mucking around with Visual Studio, IIS, the file system, packaging, deploying, etc. It didn’t matter if they were the most complex modules, or a simple Hello World module. In the end you probably have come to the conclusion that there just has to be an easier way of doing this. Enter Dynamo.. (Sorry for the lame name…) Essentially Dynamo is a DotNetNuke Module which uses Jint under the covers. Dynamo allows you to completely skip Visual Studio, the debugger, IIS, deployment, packaging, etc... Install this single module and open your DNN installation to the world of dynamic language interpretation. Since DotNetNuke is a content management system, Dynamo brings your source code directly into the DNN UI. It allows you to create code, on the fly, and manage that code within DNN itself. A screenshot might help clarify… As you might not be able to interpret from the above screen shot, this is a server sided scripting language built right into DotNetNuke. In the Scripting Window you edit your script and either Preview or Save it. Notice the fancy syntax highlighting, just no intellisense. When viewing the module it will interpret and render the script at the server side. So the above example produces:   The echo method will emit text to the output container directly. Anything return’ed out of the function will also get slapped into the output container automatically. So you can either use a StringBuilder to append up your content, or just echo content directly. Watch out for Page.Response.Write, it will emit the content at the top of the page; which is consistent with ASP.NET’s rendering. Examples Another real world example would be to reproduce (at a very rudimentary level) the Feedback Module which ships with DotNetNuke. Here is the code block: 1: echo("
Provide Feedback"); 2: echo("Your Email:

"); 3: echo("Subject:

"); 4: echo("Body:

"); 5: echo("
"); 6: echo("
");  7: if(Page.IsPostBack) { 8: var fromemail = get("fromemail"); 9: var subject = get("subject"); 10: var body= get("body"); 11: if(fromemail!="" && subject!="" && body!="") 12: return DotNetNuke.Services.Mail.Mail.SendMail(fromemail, "toemail@localhost", "", subject, body, "", "", "", "", "", ""); 13: else 14: return "" 15: } 16: else { 17: return ""; 18: } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpco[...]



DotNetNuke 2010 - Firefox Persona

Wed, 14 Jul 2010 22:37:13 GMT

Show your DotNetNuke passion by using the DotNetNuke 2010 Firefox Persona, found here.

(image)




So which password manager do you use?

Tue, 15 Jun 2010 19:19:35 GMT

I’m sure you, like myself, have a few hundred passwords which I use on a fairly regular basis.  I sure hope that you shy way from a single password across all sites or a template based password where you reuse the same password but switch up a single digit or two.  Both of which are generally considered a very bad idea, especially when dealing with your online banking or similar sites.

In the past, I tried to move my entire life and toolset onto a Pen drive.  I have had a varying level of success across the board with it failing miserably with the larger tools like Visual Studio, Microsoft Office, and similar applications.  Typically those that have a heavy dependency on the registry.  In my perfect world everything would be local configuration files -this push to the registry (away from ini files) was a mistake IMHO.

For the longest time there was really only a single solution in the marketplace for reliable and safe Password Management tools.  That was RoboForm from Siber Systems.  It was so vital for me that I purchased their USB Version “RoboForm2Go”.  Over these past few years it treated me quite well and I still highly recommend using it for those that want an offline/portable installation-free solution.  For example if your one of those paranoid (safe) types that don't want some external site hosting your credentials…

A few months ago I realized that the majority of my daily use of my “Portable environment” was specifically for RoboForm and nothing else.  The ole 80-20 rule applies.  I took a good long look at that fact and decided that I wanted to minimize the hassle of carrying around the USB Pen drive, getting it running, etc.. on a daily basis.  I also noticed that I would have liked to share this data with a few machines, simultaneously.  This forced me into looking into an online solution.  At a minimum it would plug into Firefox and store all passwords (safely) on a remote site; and be reliable/available 24x7.  A colleague recommended me to check out LastPass.  Since this met my minimum requirements, and then some I decided to give it a run for its money.

I can safely say that I have managed to completely make the transition to LastPass with no issues.  The online service is extremely reliable and their FireFox and IE integration is stellar.

I also find myself using the Windows Mobile version of their product.  It needs work but it provides easy access to my data with a few clicks – you will need to upgrade to their premium product for this to work – its only $1 per month and you get a bunch of devices supported plus a few other “features”.

Great job done by the LastPass team.




DotNetNuke 5.4.2 - Folder Structure

Fri, 21 May 2010 18:34:35 GMT

A pretty big request we are seeing in our support department is for our customers to have a better understanding of the folder structure of the DotNetNuke Product.  Here is a document which I was able to put together with help from the team.

PDF Download: 5.4.2 Install Folder Structure

I hope you find it useful as well and please let me know if you have anything to add.




DotNetNuke Canadian Office gets a new home (6 Photos)

Mon, 10 May 2010 23:59:56 GMT

As of few weeks ago some of you may have noticed the slight update in our Canadian office address – and yes I’m just getting around to blogging about it now.   The new address is… 211 - 9440 202nd street Langley, BC V1M 4A6 Canada [map] We had the opportunity to come view the place while the contractors were doing some improvements…   Candice, Charles, Jenni and Jaspreet admiring the building directory in the lobby.   Our support department is getting a serious upgrade!  Those support folks, always so demanding!  :)   Here is a good shot from reception across most of the space.  What you don’t see is the few offices on the left side, and a boardroom to the immediate left.  Pretty much the full Canadian group present and accounted for!   Our soon-to-be and much-awaited-for kitchen space!  Server room is just to the left, and its actually in its own room.  Konstantine is so happy now!   Joe and Shaun in deep contemplation…   Keivan, overly excited about a place to work out.   So that’s the tour.  Ill try to take some new photos now that we are all moved in and post them up once I’m back from my mini-vacation.[...]



DotNetNuke Boston User Group

Thu, 06 May 2010 18:52:20 GMT

Eric, over at the Boston DNN User Group has graciously invited me to give a presentation to his User Group on May 17th. 

Come join me for an open discussion on “DotNetNuke – A look inside”.  I will cover topics like how we are adopting the Agile methodologies at a corporate level, how we are best utilizing Scrum, a sneak peek at the roadmap for 2010, and how YOU can participate with the future direction of the product.

If you are currently a partner or a customer of DotNetNuke please feel free to attend and reach out, I’m sure Eric would love the extra attendance!  I would love to start putting faces to the names of so many of you.




DotNetNuke is hiring – Are you qualified?

Thu, 06 May 2010 18:42:38 GMT

We just posted up two positions for the Vancouver/Lower Mainland area:

Engineering - Senior Developer
https://www.bctechnology.com/scripts/show_job.cfm?id=78592

 

Engineering - Test/QA Manager
https://www.bctechnology.com/scripts/show_job.cfm?id=78591

 

If you feel you are qualified feel free to apply now!