Tuesday, April 23, 2013

Developing Betasac.org, an open source app for the beta testing community

Betasac is an open source Node.js using Express.js 3.x, MongoDB, Redis. See it on GitHub.

It is a free online community for sharing and promoting apps while they are in alpha or beta testing.

Getting setup

You'll need Redis, hosted locally or in the cloud. 

Suggested Redis providers

You'll also need MongoDB, again hosted locally or in the cloud.

Suggested MongoDB providers


Node.js version 8.x+ must be installed.

Clone the repository from github:
git clone https://github.com/ruffrey/betasac.git && cd betasac

Make sure the packages are installed.
(sudo where applicable) npm install

Put your settings in the betasac/config.js file.

Start the app:
node app.js

You should see a printout of the configs and then after a few seconds an indication of a successful MongoDB connection.

That's it!

Monday, April 22, 2013

Is dnndev.me safe for local development?

Local DotNetNuke Development

When developing DotNetNuke on your local machine, it can be easier to use the domain dnndev.me or anysubdomain.dnndev.me. The official DNN instructions call for this setup.

Safety? Do they see my traffic?

It's safe.

No, they cannot see your traffic.

DNS resolution

The Domain Name *.dnndev.me simply resolves back to 127.0.0.1 - in other words, when your browser does a request for funkychicken.dnndev.me, it goes to your DNS service and the DNS service tells you which IP address to send you to. Everything at dnndev.me is set to point to 127.0.0.1 - which is always your local machine's IP address.

Once your browser knows the IP location of dnndev.me, it will send all future requests to 127.0.0.1.

Saturday, April 20, 2013

Betasac community is live: check out apps before they are released

Connecting early adopters and developers

Betasac provides a simple online format for developers and others to post classified notices about their app while it is beta.

Developers win because they can get publicize their app in a fair environment. It's fast and free to post a beta test on Betasac.

Early adopters win because they can find apps before they go live and give them a test run. You do not need an account to browse apps.

Betasac is open source

The source for Betasac is hosted on github. Anyone can get involved. Fork it!

Check it out

Go to betasac.org to check it out.



Friday, April 19, 2013

How to solve HTTP 500.12 Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list

Your ASP.NET may not be configured properly for IIS if you see this message:


HTTP Error 500.21 - Internal Server Error
Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list




Resolution


  1. Navigate to C:\Windows\Microsoft.NET\
  2. Open a terminal here.
  3. Type aspnet_regiis.exe -i and then enter.
  4. You should see the following if it finished correctly:
    1. Start installing ASP.NET
    2. ..........
    3. Finished installing ASP.NET
  5. Restart the IIS server.

Troubleshooting

Check the path to make sure it actually exists.

C# and JavaScript - Inheritance Examples

JavaScript uses prototypal inheritance, which is different from what we are used to in C#, Java, etc.

You can accomplish the same thing in Javascript, but with different syntax.


// JS Inheritable Class
function Animal(){
 
 this.animal_name = "";
 
 this.lengthOfToes = [];
 
 this.hasClaws = false;
 
}

// JS Inheritable Class, alternative format
var Animal = function(){};  // empty function
Animal.prototype.animal_name = "";
Animal.prototype.lengthOfToes = [];
Animal.prototype.hasClaws = false;


// creating an instance of an object
var Lion = new Animal();

// extending it
Lion.prototype.hasMane = true;

// JS Object Literal, NOT inheritable
var Animal = {

 animal_name: "Simba",
 
 lengthOfToes: [2,3,3,3,2,3,2,4,2,3],
 
 hasClaws: false
 
};

// C#
public virtual class Animal
{
 public string animal_name { get; set; }
 int[] arrProp = new int[]();
}

public partial class Lion : Animal
{
 public bool hasMane = new bool();
}


JSON in 5 minutes


JSON = JavaScript Object Notation

  • lightweight data-interchange format
  • is literally javascript code - valid data types: Objects, Arrays, Numbers, Strings (includes Date), Boolean
  • keys must be in quotes, unlike in javascript code the keys do not need quotes.
  • Supports unlimited nesting 

Example

 {
 "key1": "I like cheese",
 "key2": ["An","array","of","strings","with",1,"number"],
 "keyForAnObject": {
   "Cheeses": ["Blue","Swiss","Cheddar","Jack"],
   "NumberOfCheese": 2,
   "FavoriteCheeseIndex": 1,
   "isThereAFavorite": true
 }
}
Accessing the data in Javascript:
var JsonDataString = {
 "key1": "I like cheese",
 "key2": ["An","array","of","strings","with",1,"number"],
 "keyForAnObject": {
   "Cheeses": ["Blue","Swiss","Cheddar","Jack"],
   "NumberOfCheese": 2,
   "FavoriteCheeseIndex": 1,
   "isThereAFavorite": true
 }
};

var data = JSON.parse(JsonDataString); // JSON is a global function

data.key1 // "I like cheese"
data.key2[3] // "strings"
data.key2[5] // 1
var internalObject = data.KeyForAnObject;
internalObject.Cheeses[1] // "Swiss"
data.KeyForAnObject.Cheeses[1] // "Swiss"

Most important Javascript JSON functions

JSON.parse( JsonDataString )
Safer than eval(). Returns a javascript object/type.
JSON.stringify( Object )
Returns a JSON string from any non-function javascript object. 

Cross platform

These Javascript JSON functions are available in some form for basically every programming language.
See http://json.org/ and scroll down for all of the supported libraries. 
Note: JSON.stringify() is often "serializeAsJson" or something similar.

C# Pseudo-code Example

using System.Web.Script.Serialization;
class SomeClass
{
 class JsonResponse
 {
  public bool TrueOrFalse = true;
  public string Hi = "hi!";
  public List = new List();
 }
 
 public static string Responder()
 {
  JavaScriptSerializer jss = new JavaScriptSerializer();
  JsonResponse resObj = new JsonResponse();
  
  return jss.Serialize(resObj);
 }
 
}

Use cases

JSON can be used wherever XML is used, but is more human readable and has a smaller footprint. More easily supports typed data than XML.
Returning JSON from a server to a client browser during AJAX. Since JSON maps directly to a javascript object it can be manipulated as native code.
Multidimensional arrays or arrays of objects are common, representing database rows and columns.
Example response from server:
Content-Type: application/json
[[
 1,"Jim","yeeee"
],[
 2,"Wilson","I like cheese"
]]

as XML, it might look like:

 
  1
  Jim
  yeeee
 
 
  2
  Wilson
  I like cheese
 


Convincing your manager to use Node.js

It can be tough to adopt new technologies in the enterprise. How do you convince your enterprise leadership that Node.js is the future? How do you let them know they are missing the next big thing?

Open source is the future

If you must convince your leadership of this, well, good luck. Developers want to work places that support open source, not simply use open source. Node.js is changing the face of the open source community because it is relatively young but has the most active community of any platform. This point needs to be underlined: Node.js has thousands of actively maintained packages of high quality open source software. Already. It took years for Java to get that far. 

In the coming years, if a company strategy does not include open source development, they can kiss their devs goodbye. To remain competitive candidates, developers must be plugged into open source, maintain their GitHub and StackOverflow.com profiles, and stay on top of new libraries for their given platform. Quite honestly your tech manager or director is in danger of being obsolete if they don't grasp open source. Help them out!

Async and HTTP APIs

Everybody has an HTTP JSON API now. The entire web uses this communication standard. Developers expect to be able to communicate with your platform using JSON over HTTP. It's secure, fast, distributed, cloud-friendly, etc. New applications use a distributed grouping of cloud services from different providers, from Redis or Memcached session storate, message queues, databases - especially replication-friendly NoSQL ones like CouchDB and MongoDB. Static resources are hosted on different servers. SMTP sending is handled by third party senders "transactional" services like Amazon SES, Mandrill, or SendGrid. And even the SMTP packages are sent as JSON.

Quite honestly, Node.js is perfectly poised to communicate as JSON over HTTP. JSON is (obviously!) native to the JavaScript language. The Node.js networking libraries, plus numerous open source NPM packages, make it insanely easy to communicate over any network protocol.

Now that we've established the ubiquity of JSON APIs, do you really want to develop synchronous programs and block your application execution thread while you wait for a reply? Probably not. Node can handle tens of thousands of concurrent connections on a single thread with modest resources due to the asynchronous nature of the language and the geniuses at Google who develop the V8 engine. It is extremely good at linking web services together.

Other languages add asynchronous functionality as an afterthought. In Node.js and JavaScript as a language, it is a core component.

Less ramp up time

Your developers already code JavaScript on the frontend. They likely have only a marginal understanding of the power of JavaScript's object-oriented features and the callback paradigm, but that can be grasped quickly. Once they do "get it" they will reach new levels of productivity with their web service development. An understanding of JavaScript's functional prototypical inheritance pattern and the use of asynchronous callbacks makes it easier to leverage these features in other languages.



How have you had success getting your company to adopt Node.js?





Tuesday, April 16, 2013

List of free/unpaid Twitter Bootstrap theme websites

What's Bootstrap?

Bootstrap is a beloved responsive CSS and javascript framework.

Github repository for bootstrap »

Bootstrap themes for free

WrapBootstrap

WrapBootstrap has 12 free and awesome themes. They are fully built out and beautiful. Just download the CSS and go.

Bootstrap Free

BootstrapFree.com lists several free themes. Some of them include example pages.

Jobpixels

They offer three free themes.

Roots theme for Wordpress

You can check to the github repo to get the bootstrap styles.

WPBootstrap

Also a Wordpress theme, but you can extract the styles from github, too.

Bootstrap themes for almost free

Portnine

Three nice themes, but they require a linkback and are limited to one server.



Simple. Mobile.
Forever free plan for lots of contacts.