Creating a Logo in 10 seconds with LogoType

I wanted to play around with the Google WebFonts API for some reason and came up with a somewhat cool little web-based utility called:

logotype

Demo here: http://www.w3portals.com/logotype

Source: https://github.com/bradoyler/LogoType 

It’s a really quick way to create a “draft” logo. 

So after you select your colors and Font, you can simply take a screenshot of the page and copy into your favorite image editor. If I guess enough requests, I may even add some other features and additional fonts.

P.S. I seem to get the best resolution in Firefox.
Happy branding!

 AddThis just published their 2011 stats on “sharing” across the web.

 AddThis just published their 2011 stats on “sharing” across the web.

(Reblogged from staff)

Making Sharepoint your friend…with Powershell

Starting some research for an upcoming project that integrates with Sharepoint (sigh). Although I wasn’t to excited to start developing against a bloated beast of an “Enterprise” application like SP 2010…but, I pushed through the tears.

I first started playing around with webparts and found it quite clumsy to build and deploy stuff that was purely for experimenting with the SharePoint API.

That’s when I came across the site: http://get-spscripts.com/ which demonstrates how to do all kinds of crazy scripting for Sharepoint using PowerShell. Finally, a legit reason to work on my PowerShell chops.

Here’s a couple functions I came up with:(for these to work, you have to launch the Sharepoint Mgmt Shell as Administrator… and also change some refs to “http://yourSPserver”)

# below are some SP scripts that do some basic tricks

function GetDocInfo
{
     #//this checks existence of a file in a specified SPList

  Param ( [parameter(Mandatory=$true)][string]$LibName, 
          [parameter(Mandatory=$true)][string]$DocName 
         )

   $web = Get-SPWeb http://yourSPserver
   $docLibrary = $web.Lists[$LibName]
   $folder = $docLibrary.RootFolder  
   $spFilePath = ("/" + $DocName)
   $spFullPath = $folder.Url + $spFilePath
   write-host $spFullPath "exists: " $web.GetFile($spFullPath).Exists   
}

function GetListFields
{
   #// This returns all the Fields of a given SPList
   #// Also shows how to loop through a collection with 'ForEach'
    Param (  
            [parameter(Mandatory=$true)][string]$ListName 
          )
    
    $ctx = Get-SPServiceContext http://yourSPserver
    $Scope = New-Object Microsoft.SharePoint.SPServiceContextScope $ctx
    $web = Get-SPWeb http://yourSPserver
    $splist = $web.Lists[$ListName]
    $Column = $splist.Fields
	
    foreach($Field in $Column)
	{
	   Write-Host "Field:" $Field
	}
}

function QueryList
{
  #//This queries the "Title" field of a given value in a given SPList
     Param (  
            [parameter(Mandatory=$true)][string]$Title, 
            [parameter(Mandatory=$true)][string]$ListName 
           )

    $web = Get-SPWeb http://yourSPserver
    $splist = $web.Lists[$ListName]
    $spQuery = New-Object Microsoft.SharePoint.SPQuery
    $camlQuery = '$Title'
    $spQuery.Query = $camlQuery
    $spQuery.RowLimit = 10
    $spListItems = $spList.GetItems($spQuery)

    foreach ($item in $spListItems)
    {
      write-host "Name:" $item.Name
      write-host "Title:" $item["Title"]
    } 
}

Hope this was helpful! Cheers.

My addendum to PSL fishbowl

After attending PSL fishbowl last night, I have a few things I’d like to put on the record. I’m not a verbose guy, so this should be rather pithy.

Last night, after I gave my groups 5 min presentation on the chosen topic, “ways to fix the PSL communication/website issues”, I quickly realized I missed an opportunity to really speak my mind about how to make PSL a stronger organization.
So here ya go…

Purpose
Philly Startups Leaders should embrace their name and be an organization for LEADERS. Why not simply support entrepreneurial leaders that are doing awesome things “for” Philadelphia? Fostering this type of environment is exactly what philly needs and can’t be accomplished with monthly happy hours or tech demos. The goal should really be to convince others to step up and earn your stripes in the community.

Challenges
There will always be fragmentation in this type of group simply because of the nature and personalities of its membership. PSL should just accept this reality and stop worrying about the marketing benefits of a “large” mailing list. Why not just FOCUS on finding the next rising leaders the community can rally behind. Do that effectively, and no one will care about maintaining a mailing list. The lesson here, be careful what you measure.

Execution
First off, a strategy has to be formed to recruit members that are leaders in the community. There needs to be a simple process for new members to apply by giving their relevant accomplishments and also a process for existing members to sponsor leaders that should be accepted as members.
Second, a major factor in organizing a group of people that are willing to work with each other and are also be proud of being a part of the group, is having a common bond. So, maybe the only member requirement should be having a major accomplishment in the community (Launching a company, organizing a group or event that helps Philly startups). Also, each member should be somehow recognized for each of their accomplishments. Recognizing members for their work is a great way to inspire others to make contributions and at the same time build a stronger community.
Lastly, a really cool way to strengthen membership is to convince them all to really “work together” once or twice a year. I could see a PSL summit, where all are invited to a 2 or 3 day event of activities that could focus on addressing local issues and team building. This could be an amazingly effective way to form and strengthen relationships amongst members.

That’s all for now…keep the wheels turning.

Google Calendar Reader : jQuery Plugin

I was really surprised that I couldn’t find a plugin or widget that already did this, so I figured I’d make a jQuery plugin to read a public google calendar feed and custom format it so that it can be display on your site and have your own styles applied. Here’s how the gCal reader plugin works.

Here’s a link to the github repo: https://github.com/bradoyler/GoogleCalReader-jquery-plugin

Demo is here: http://w3portals.com/gCalReader/


(function ($) {
    //Add gcal element
    $(document).ready(function () {
        $('body').prepend('Loading...');
    });

    //Resize image on ready or resize
    $.gCalReader = function (options) {
        //Default settings
        var settings = {
            feedUri: 'http://www.google.com/calendar/feeds/en.usa%23holiday%40group.v.calendar.google.com/public/full',
            maxresults: 20,
            displayCount: 1
        };

        var feedUri = options.feedUri;
        if (feedUri.indexOf("public/full") == -1) {
            feedUri = settings.feedUri;
        }

        var options = $.extend(settings, options);

        function _run() {
            var calendarService = new google.gdata.calendar.CalendarService('GoogleInc-jsguide-1.0');

            // The "public/full" feed is used to retrieve events from the named public calendar with full projection.
            var query = new google.gdata.calendar.CalendarEventQuery(feedUri);
            query.setOrderBy('starttime');
            query.setSortOrder('ascending');
            query.setFutureEvents(true);
            query.setSingleEvents(true);
            query.setMaxResults(options.maxresults);

            var callback = function (result) {

                var entries = result.feed.getEntries();
                $('#gcal').html('');
                if (options.displayCount) {
                    $('#gcal').html(entries.length + ' upcoming events');
                }
                $('#gcal').append('');

                for (var i = 0; i < entries.length; i++) {
                    var eventEntry = entries[i];
                    var eventTitle = eventEntry.getTitle().getText();
                    var startDateTime = null;
                    var eventDate = null;
                    var eventWhere = null;
                    var eventContent = eventEntry.getContent().getText();

                    var times = eventEntry.getTimes();
                    if (times.length > 0) {
                        startDateTime = times[0].getStartTime();
                        eventDate = startDateTime.getDate();
                    }

                    var d_names = new Array("Sun", "Mon", "Tues", "Wed", "Thurs", "Fri", "Sat");
                    var m_names = new Array("Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec");

                    var a_p = "";
                    var d = eventDate;
                    var curr_hour = d.getHours();
                    if (curr_hour < 12) {
                        a_p = "am";
                    }
                    else {
                        a_p = "pm";
                    }
                    if (curr_hour == 0) {
                        curr_hour = 12;
                    }
                    if (curr_hour > 12) {
                        curr_hour = curr_hour - 12;
                    }

                    var curr_min = d.getMinutes();
                    curr_min = curr_min + "";

                    if (curr_min.length == 1) {
                        curr_min = "0" + curr_min;
                    }

                    var time = curr_hour + ':' + curr_min + a_p;
                    var day = eventDate.getDay();
                    var month = eventDate.getMonth();
                    var date = eventDate.getDate();
                    var dayname = d_names[day];
                    var monthname = m_names[month];
                    var location = eventEntry.getLocations();
                    var eventWhere = location[0].getValueString();

                    var eventhtml = '' + eventTitle + '  When: ' + dayname + ' ' + monthname + ' ' + date + ', ' + time + Where: ' + eventWhere + eventContent;
           $('#eventlist').append(eventhtml);
                }
            };

            // Error handler to be invoked when getEventsFeed() produces an error
            var handleError = function (error) {
                $('#gcal').html(error);              };            
  // Submit the request using the calendar service object                   
 calendarService.getEventsFeed(query, callback, handleError);          }                
 google.setOnLoadCallback(_run);             
})(jQuery); 

GeoLocate a visitor’s IP address and cache the results. (C#)

First, go over to http://ipinfodb.com , see how it works and get yourself an API key by signing up for free. If you’re looking to convert an visitors IP address into a geographic location, then here’s a quick code nugget in C#. Have fun!


  
  string ip = Request.ServerVariables["X-Forwarded-For"]
      
   public class LocationInfo
    {
        public string Country { get; set; }
        public string RegionName { get; set; }
        public string City { get; set; }
        public string ZipCode { get; set; }
        public float Latitude { get; set; }
        public float Longitude { get; set; }
    }

     public static LocationInfo HostIpToPlaceName(string ip)
        {
            ObjectCache cache = MemoryCache.Default;

            var key = "zzzzzgetyourowncodezzzzzz";
            string url = "http://api.ipinfodb.com/v3/ip-city/?key={0}&ip={1}&format=xml";
            
            url = String.Format(url,key, ip);
            var location = new LocationInfo();
            var result = cache[ip] as XDocument;
            try
            {
                if (result == null)
                {
                    result = XDocument.Load(url);
                    cache.Add(ip, result,
                   new CacheItemPolicy() { SlidingExpiration = TimeSpan.FromDays(1) });
                }

          location = (from x in result.Descendants("Response")
                      select new LocationInfo
                    {
                     City = (string)x.Element("cityName"),
                     RegionName = (string)x.Element("regionName"),
                     Country = (string)x.Element("countryName"),
                     ZipCode = (string)x.Element("zipCode"),
                     Latitude = (float)x.Element("latitude"),
                     Longitude = (float)x.Element("longitude")
                    }).First();
            return location;
        }
    }

One thing to notice is that this caches the result for each unique IP address, so that you don’t have to call this API everytime you need this users location. Cheers!

Uploading an image with AWS SDK for .Net (C#)

I recently started using cloud-based hosting (AppHarbor.com) for my latest project (Mealtik.com) and I needed a remote storage solution for the images that would be uploaded by users. I was already familiar with Amazon’s Simple Storage service (AWS S3), but never actually built a .Net app that used this API for uploading images to S3.

So…here are the steps to simply get an image published\uploaded to S3.

1. First go get an account with AWS at http://aws.amazon.com/ and then go get your accessKey and SecretKey from your account.

2. Download the AWS SDK for .Net here: http://aws.amazon.com/sdkfornet/ and include the assembly AWSSDK.dll in your project.

3. Here’s the markup:
     <input type=”file” id=”fileUpload” name=”fileUpload” size=”23” />

4. Here’s the C#:


HttpPostedFileBase file = Request.Files[0];
if (file.ContentLength > 0) // accept the file
{
string accessKey = "XXXXXXXXXXX";
string secretKey = "122334XXXXXXXXXX";
AmazonS3 client;

using (client = Amazon.AWSClientFactory.CreateAmazonS3Client(accessKey, secretKey))
{
PutObjectRequest request = new PutObjectRequest();
request.WithBucketName("mealtik")
.WithCannedACL(S3CannedACL.PublicRead)
.WithKey("meals/test.jpg").InputStream = file.InputStream;
S3Response response = client.PutObject(request);
}
}



A few things to point out:
  1. I’m uploading my image (“test.jpg”) to folder (“meals”) which is in a bucket called “mealtik”.
  2. I’m setting the image permissions to “public read”.
  3. I’m using MVC, but the code should work for webforms as well.

As you can see, it’s pretty simple to do, but for some reason I couldn’t find an example of this anywhere on the interwebs. Hope this helps!

Startup Weekend is coming to Philadelphia

Startup Weekend is scheduled for January 28th 2011 at Independents Hall (Indy Hall) in old city.  Get more info and register for the event @ http://philly.startupweekend.org 


What it’s about: Startup Weekend is a non-profit organization based out of Seattle, WA USA. Startup Weekend is a small team of three along with community leaders around the world.  The primary mission is to be the most valuable and influential organization in startup communities around the world. Startup Weekend doesn’t have to teach entrepreneurship in a boring classroom setting, we model it in a fun, interactive, and results driven way.  As a result, we have become one of the leading catalysts for startup creation, co-founder dating, and entrepreneurship education in startup ecosystems around the world.

How it works:  It is an intense 54 hour event which focuses on building a web or mobile application which could form the basis of a credible business over the course of a weekend. The weekend brings together people with different skillsets - primarily software developers, graphics designers and business people - to build applications and develop a commercial case around them.

PA Congressman’s response to H.R. 5034 Comprehensive Alcohol Regulatory Effectiveness Act of 2010

Recently, I contacted my local congressman (Jim Gerlach) about my opposition to H.R. 5034, which will make it nearly impossible for small artisan wineries to ship directly to their customers. The bogus argument for this, is that this enables underage kids easy access to alcohol. Anyone with half a brain would realize that no 17-year-old is ordering artisan wines online to get his buzz on. This bill is penned and supported by LARGE multi-state beer distributors…what a shocker. Anyway, here’s Gerlach’s canned, ambiguous, and lame response….

Dear Mr. Oyler:

 

 Thank you for contacting me about H.R. 5034, the proposed Comprehensive Alcohol Regulatory Effectiveness (CARE) Act of 2010. I appreciate the opportunity to respond. 

 

 Since the end of Prohibition in 1933, the authority to regulate the sale and distribution of alcohol has been left to the states. In general, states have required that beer, wine, and spirits be distributed to wholesalers, then to retailers, and finally to the consumer. As such, wholesalers and retailers have been part of the sales and revenue stream and the producers of the products have therefore sought a more direct sales approach. 

 

 This traditional system for sale and distribution of alcoholic beverages has recently been questioned in the courts, most notably when a federal appeals court in Boston struck down a state law restricting direct sale to citizens by wine producers. Wholesalers contend that direct sale is contrary to state law and is a breach of the 21st Amendment which grants the states the power to regulate alcohol sales. On the other hand, producers support an approach that permits wineries and breweries to avoid a multi-layered distribution system that impacts their profitability. 

 

In response to this controversy, a bipartisan group of members have introduced H.R. 5034. The context of the bill is to underscore Congress’ view that the regulation of alcoholic beverages is a state issue.  Nonetheless, its enactment would not prevent individuals from challenging unconstitutional state regulations nor prohibit the direct shipment of wine. In essence, the legislation aims to generally reaffirm that federal laws should not trump state laws.

The bill was introduced on April 15, 2010 and has been referred to the House Judiciary Committee. Should this bill begin moving forward in the process, I will certainly weigh your views in deciding whether how to vote on this bill.

Again, thank you for contacting me regarding this legislation. If I can be of any assistance to you or your family in the future, please let me know.

With kind regards, I am

Sincerely,

Jim Gerlach
Member of Congress

P.S. Please visit me on the internet at http://www.gerlach.house.gov.

2010 Phillies: Another great season is underway

   We are 5 games into the season and the home opening is only 1 game away. The Fightin Phils have had double digit hits in each game and have only lost 1 game so far. 
  Batting: Ryan Howard is leading the NL with 3 homer runs and 10 RBIs, Placido Polanco, who seems to be another great off season acquistion is boasting a solid .538 batting average. However, a lot of the run production has been due to Jimmy Rollins leading the league with 7 walks, which have converted to 7 runs. It’s great to see J-Roll off to a great start.
  Pitching: The team has a combined ERA of 2.00 and each starter has showed promise with their season debuts. Not to mention Hallayday’s 9 K’s in 7 innings and J.A Happ’s 0.00 ERA.

  The anticipation for the home opener this Monday is building up steam like a locomotive. Needless to say, it’s going be an awesome game…and also a more incredible season. Go Phils!

Phillies 2010

Fork me on GitHub