dotMH

  • Archive
  • RSS
  • Ask me anything

Ruby Weekly

I wanted to share this with you because I look forward to reading it every week. As the name suggests its a Ruby Weekly Email newsletter. Published by the Cooper Press it contains a tonn of news articles , tutorials , discussions and more regarding one of my favourite languages Ruby , and of course its most famous framework Rails. They also publish a few other newsletters including one on Javascript and one on HTML 5.

I Highly recommend that you sign up to them, links are below. 

Ruby Weekly : http://rubyweekly.com

Javascript Weekly : http://javascriptweekly.com

HTML 5 Weekly : http://html5weekly.com

    • #javascript
    • #rails
    • #ruby
    • #html 5
    • #news letters
    • #newsletter
  • 3 months ago
  • Comments
  • Permalink
  • Share
Sorry for the massive delay in posting, been very busy with work over the last few months , as well as some side projects. I am also doing a complete redesign and rebuild of DotMH see image above. 
Pop-upView Separately

Sorry for the massive delay in posting, been very busy with work over the last few months , as well as some side projects. I am also doing a complete redesign and rebuild of DotMH see image above. 

    • #new
    • #redesign
    • #blog
    • #new dotmh
  • 4 months ago
  • Comments
  • Permalink
  • Share

New Learning Goal

I keep telling myself that I will post, and then I forget to do it, and a month goes by. So here is this months post. 

A while ago I posted my learning goals for 2012 on here. This has some what changed in the last couple of weeks. Basically I have got interested in Audio , Audio Creation and synthesisers. This means that I got interested in learning how to write virtual instruments and effects, especially Audio Units ( Mac OSX Instruments and effects). This means learning Objective C. 

So that is where my learning has started to head. Objective C , C , Audio units and cocoa.

Like with most new skill I intend to pick up it starts with a book, well in this case 3 books,

  • Objective-C Programming: The Big Nerd Ranch Guide
  • Cocoa Programming for Mac OS X
  • Learning Core Audio: A Hands-on Guide to Audio Programming for Mac and iOS

opened up Xcode and began my journey into the mystical world of the Mac OSX development. 

I am also trying to launch a nice new shinny version of this website, with a lot more information on it. So keep your eyes on the horizon.

    • #learning
    • #c
    • #objectiveC
    • #audio
    • #audio programing
  • 8 months ago
  • Comments
  • Permalink
  • Share

invalid byte sequence in UTF-8

Dealing with this in ruby is relatively easy. This assumes that you just want to discard the invalid characters. This is from an artical by Paul Battley http://po-ru.com/diary/fixing-invalid-utf-8-in-ruby-revisited/  I let him explain the ins and outs of how it works this is more a note for me so I have it for the future. 

So in rails , I create an new application helper method with the following 

  def scrub string 
    require 'iconv'
    ic = ::Iconv.new('UTF-8//IGNORE', 'UTF-8')
    ic.iconv(string + ' ')[0..-2]
  end

UPDATE:

so if you need to keep the UTF characters on this error , then you can use the following instead of the function above.

  def scrub string 
    string.force_encoding("ISO-8859-1").encode("utf-8", replace: nil)
  end

Non destructive fix thanks to stack overflow http://stackoverflow.com/questions/9607554/ruby-invalid-byte-sequence-in-utf-8

and thats it , when ever you want to scrub a string for invalided UTF-8 characters in a view or controller just do 

scrub invalid_string

Of course the scrub method above can be used in any ruby app. 

    • #rails
    • #ruby
    • #utf-8
    • #string
    • #iconv
  • 9 months ago
  • 1
  • Comments
  • Permalink
  • Share

A popdown menu

Following on from my really simple web server , I have created a really simple pop down menu. I am sure this has a better name but I am not sure what it is. It is basically the menu that appears when you have scrolled past a certain point on the page at which the normal navigation isn’t visible. I didn’t intend to come up with a simple peace of code but it turned out that with jQuery it is not so hard to do.

Ok so the way this works is that you create 2 menus in the markup. Now I am not to sure that this is the right approach as really only one navigation is present just 2 copies of it. I may at some point create a version which clones the navigation , the issue with that is the styling for each navigation may need to be different , or you may want more items on one menu than the other. This although feels the more dirty way is the most customisable way and in a lot of CMS and site generators having the same menu twice isn’t all that hard. 

Ok so you need to wrap your popdown menu in something say a div so you end up with something that may look like this. 

<div class="topdown">
  <ol>
    <li><a>Home</a></li>
    <li><a href="/link1">Link1</a></li>
    <li><a href="/link2">Link2</a></li>
    ....
 </ol>
</div>

ok no apply the following CSS to the .topdown class 

  .topdown {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
  }

Please note: the CSS is only to make the add-on work not to added any style you will need to style the markup to match your site. 

now get and include jQuery and download the following… for ease I have also created a gist with it in here https://gist.github.com/2889716.

(function($){

  $.fn.popdown = function( trigger_at ) {

    var element = this;
    var trigger = trigger_at;

    $(document).scroll(function(e){
      var spos = $(document).scrollTop();
      if (spos >= trigger) {
        element.fadeIn();
      }
      else if (spos <= trigger) {
        element.fadeOut();
      }
    });

  };

})(jQuery);

Last at the end of your page just before the </html> create the following 

<script type="text/javascript">
//<![CDATA[
  $(function(){
	$('.topdown').popdown(75);
  })
//]]>
</script>

And that is it hardly anything for that effect that is popular on the net.

note: This isn’t the one in use on this site, rather it is one for the new version of dotMH coming soon

    • #jquery
    • #html
    • #web design
    • #web developement
    • #javascript
  • 11 months ago
  • Comments
  • Permalink
  • Share

A Really Stupidly Simple Web Server

From time to time I want to test static html sites in a server. This is normally a requirement of using services such as typekit or when I have a complex build script running with jekyll. I thought I would share it on here as more of an FYI and a note to myself in the future. It is REALLY simple and stupid. All you need to do is change the constant PUBLIC_FOLDER to which ever folder contains your static html and your basically there. 

Please note: you will need ruby, gems and sinatra installed

#!/usr/bin/env ruby
require 'sinatra'

PUBLIC_FOLDER = File.join(File.dirname(__FILE__) , 'site')

set :public_folder , PUBLIC_FOLDER
set :static , true

get '/' do 
    File.open(File.join(PUBLIC_FOLDER , 'index.html') , 'r').read.to_s
end
    • #ruby
    • #web design
    • #sinatra
  • 11 months ago
  • 1
  • Comments
  • Permalink
  • Share

Learning Goals

Learning

over the last couple of days I have been thinking about what I want to try and learn, and I thought I would make a note of it here.

Scala

“Scala is a general purpose programming language designed to express common programming patterns in a concise, elegant, and type-safe way.”

Scala website http://www.scala-lang.org/

The main drive for learning Scala is work. We are currently using Scala in a number of core projects and so having a working knowledge of Scala would be an advantage. The next is career , Scala is been adopted by a number of high profile web companies , including Twitter and LinkedIn as well as some other big names like Sony. So been able to write it would be a massive advantage in my future endeavours. Then there is the more personal aspects. I find Scala exciting because it compiles to Java byte-code, It can therefore be used with existing Java libraries this opens up a whole world or possabilities such as game server development. Been a fast language and with the use if the actor pattern it is also massively scalable. This will in turn make it useful for my interests in areas outside network programming such as Artificial Intelligence.

Typesafe stack

Scala forms the base of something called the typesafe stack which include

  • Akka - [Website] Is a java / Scala implementation of the Actor Model for concurrent IO. This is exciting as it makes applications that are build to use Akka instantly more scalable. In all the areas that I am interested in learning Scala for scaleability is a massive advantage whether it is an API server or a Game Server.

  • Simple Build Tool (SBT) [website] is a build tool that uses a Scala DSL to describe building tasks. It does the basics well and can handle mixed Scala / java applications. This last feature is off interest to me as I would of thought that I will end up writing a fair few mixed projects.

  • Play Framework [website] is a framework for building highly scalable Scala web applications fast. As a web developer I would of course be interested in learning any web framework that might help me build these highly scalable sites quickly. I am happy to learn as many frameworks as I can therefore been able to turn my hand to any codebase that I may come across in the future. Disclaimer I have NO intention of learning any .net language

There is a couple more items that relate to the typesafe stack, I have not listed them here though as I feel they are not needed for what I want to do and my workflow.

Python and Django

I have grouped python [website] and Django [website] together. The main reason is that I want to learn python to be able to use Django. Django is another web framework used by a range of smaller development projects. Knowing python would also be useful in that I would be able to create my own plugins for the awesome sublime text 2 which is my editor of choice for all language. Python does have some appeal for game development with a number of games been written in it. The most notable is Eve Online which is written using stackless python. Lastly it can be used to write GUI applications that will run on any platform. I don’t tend to need to write these style of applications, tending to build command line tools to help with my workflow. Command Line tools can be written in any language including Ruby ( My preferred choice ) , Java , Bash Shell Script and Python.

NodeJS

Node [website] is a javascript server side platform. It is very exciting for a number of reasons , one is that it is Event based this makes Concurrency and locking issues a thing of the passed. The most exciting prospect though is been able to write in one scripting language for an entire web project. This is exciting because it makes it easier and faster to write good code because your brain doesn’t need to swap from one language on the front-end to another on the back. Node is still very young but because of the reasons above has already got ALOT of people talking including big names such as eBay , Microsoft , Yahoo and more ( there is a complete list here). With the adoption of HTML5 and CSS3 this makes browser based gaming a reality because of exciting features such as canvas and web-sockets. Having node as well means that Massive Multiplayer games could go entirely browser based in the not to distance future. A big part of me things that Node and projects like node are the future of web development been fast , scalable and one language. I have already started playing with Node but want to take my knowledge of it a lot further.

Unity

Unity [website] is an Awesome cross platform 3D game engine and development platform. Unity is exciting because it is an awesome starting point for amateur game developers as well as in my case using a language that I am already familiar with in the form of Javascript. It is also completely cross platform allowing development for the web , mac , windows, IOS and Android as well as with special arrangement Playstation 3 , Xbox 360 and Wii. This makes it a very exciting platform to know as it will allow you to turn your hand to any type of game development. It also has a vast community been Free to start to learn. This brings with it a wealth of guides, tutorials, code snippets and the unity asset store.

MongoDB

MongoDB [website] is a nosql database awesome for storing and accessing flat data fast. It has a number of advantages in the type of applications that I am interested in because of its speed and flexibility. I already know how to use the basics and the ruby driver but I want to learn more especially learning the server parts of it , setting up and managing servers. The awesome thing about Mongo is that it has a driver for most languages including ruby , java and Scala , javascript , and python. It even uses a JSON syntax for managing and accessing data which is awesome. Mongo is an exciting prospect and is backed and used by a large number of companies including , SAP , Craig’s List , IGN , Disney and the British government a larger list can be found here.

So that is what I plan to learn over the next year / 18 months as well as working for Videojuicer , building site projects and developing ideas and building on my current skillset with the exception of PHP which for now I do not intend to learn or do anymore with.

    • #development
    • #learning
    • #goals
    • #programming
    • #web development
    • #scala
    • #java
    • #node
    • #nodejs
    • #python
    • #unity
    • #ruby
  • 11 months ago
  • Comments
  • Permalink
  • Share
Hey there, 
 
I just joined something called the Internet Defense League &#8212; and I&#8217;m hoping you will, too. I joined because it&#8217;s important to stand up against the powerful industries that are tyring hard to lock down the net. Remember SOPA and PIPA? The people who wrote them are working on more bills to censor the internet, spy on users, chill innovation and generally wreak havoc with the web.
 
The Internet Blackout helped kill SOPA/PIPA with nothing more than websites and individuals working together to broadcast messages and actions. The Internet Defense League uses the tactics of the Blackout, but supercharged and ready to take on anything that corrupt congresspeople and big business can throw at us.
 
Join me in the League. Take your place in the fight for internet freedom.
 
The Internet Defense League works like this: organizers and members monitor Congress and industry for threats to internet freedom. When there&#8217;s a grave threat or unmissable opportunity, people use their websites, Twitter, Facebook or other social network accounts to display action messages about the threat and tools for taking action. When we rise up together, we&#8217;ll be impossible to ignore.
 
With SOPA and PIPA, internet users found a new ability to take a stand together when our rights are at stake. Our powerful protest surprised everyone, especially the congresspeople and lobbyists who wrote the bills. We made them see the internet in a new light, but they still don&#8217;t know what we&#8217;re really capable of. The next time internet freedom is threatened, we will be able to use the League to come out even stronger than we did last fall.
 
The Internet Defense League can be the strongest network in the fight for internet freedom - but it will only work if large numbers of people get on board. It would be great to have you standing with us.
 
Click here to get started.
 
There&#8217;s more about future threats, targets, and The League on the site. I hope you&#8217;ll join me.


&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-
 
One last thing. The Internet Defense League depends on its members to donate to our efforts. Our tiny staff works behind the scenes to launch campaigns that defend the internet. Will you donate now to keep us fighting for internet freedom? 
 
Please consider donating by clicking here - it makes a difference. https://fftf.actionkit.com/donate/idl-donate/
 
Thank you!
 
Learn more about Fight for the Future. http://fightforthefuture.org/
Pop-upView Separately

Hey there, 
 
I just joined something called the Internet Defense League — and I’m hoping you will, too. I joined because it’s important to stand up against the powerful industries that are tyring hard to lock down the net. Remember SOPA and PIPA? The people who wrote them are working on more bills to censor the internet, spy on users, chill innovation and generally wreak havoc with the web.
 
The Internet Blackout helped kill SOPA/PIPA with nothing more than websites and individuals working together to broadcast messages and actions. The Internet Defense League uses the tactics of the Blackout, but supercharged and ready to take on anything that corrupt congresspeople and big business can throw at us.
 
Join me in the League. Take your place in the fight for internet freedom.
 
The Internet Defense League works like this: organizers and members monitor Congress and industry for threats to internet freedom. When there’s a grave threat or unmissable opportunity, people use their websites, Twitter, Facebook or other social network accounts to display action messages about the threat and tools for taking action. When we rise up together, we’ll be impossible to ignore.
 
With SOPA and PIPA, internet users found a new ability to take a stand together when our rights are at stake. Our powerful protest surprised everyone, especially the congresspeople and lobbyists who wrote the bills. We made them see the internet in a new light, but they still don’t know what we’re really capable of. The next time internet freedom is threatened, we will be able to use the League to come out even stronger than we did last fall.
 
The Internet Defense League can be the strongest network in the fight for internet freedom - but it will only work if large numbers of people get on board. It would be great to have you standing with us.
 
Click here to get started.
 
There’s more about future threats, targets, and The League on the site. I hope you’ll join me.

—————————————-
 
One last thing. The Internet Defense League depends on its members to donate to our efforts. Our tiny staff works behind the scenes to launch campaigns that defend the internet. Will you donate now to keep us fighting for internet freedom? 
 
Please consider donating by clicking here - it makes a difference. https://fftf.actionkit.com/donate/idl-donate/
 
Thank you!
 
Learn more about Fight for the Future. http://fightforthefuture.org/

  • 11 months ago
  • Comments
  • Permalink
  • Share

This is rather funny , though can be hard to catch sometimes. 

  • 11 months ago
  • Comments
  • Permalink
  • Share
'\x3cdiv id=\x22photoset_23600710150\x22 class=\x22html_photoset\x22\x3e \x3ciframe id=\x22photoset_iframe_23600710150\x22 class=\x22photoset\x22 scrolling=\x22no\x22 frameborder=\x220\x22 height=\x2286\x22 width=\x22500\x22\x0a style=\x22border:0px; background-color:transparent; overflow:hidden;\x22 src=\x22http://dotmh.com/post/23600710150/photoset_iframe/dotmh/tumblr_m4gw97JxqD1qhasp4/500/false\x22\x3e\x3c/iframe\x3e\x3c/div\x3e'

Site of the month , yeap its been a while but it is back. So the site for this month is, drum roll please GeekList (http://geekli.st). Geeklist is a social network style site aimed at well geeks. Its slogan is build by geeks for geeks which is awesome. It revolves mainly around cards, a card is an achievement by you, you can list what it was you did , what technology was involved with doing it and what tasks you completed to do it. Other users then can read your cards and high five them. You can also add status updates called micros. It is integrate with twitter so that you can login using your twitter details and post to twitter. It still in its beta stage but there are some awesome people on it already including spotify , joynet , mongodb and amazon. So if you are geek go signup for the beta and start displaying your geek for all to see. 

    • #Site of The Month
    • #geeklist
    • #Social media
  • 12 months ago
  • Comments
  • Permalink
  • Share
← Newer • Older →
Page 1 of 9

Portrait/Logo

About

Hello weary internet traveler to the temporary internet home of Martin Haynes. This is a blog about web development and design , I have it here on tumblr until I get my site up and running again. Here I will chronicle my adventures in Ruby , HTML , XHTML , Javascript , PHP , Mysql , Linux and anything related to web development and / or design. Any code type stuff will be in my GitHUB which is at https://github.com/dotmh, you will be able to find all manor of things on there in the not so distant future.


Syntax Highlighting is provided by the awesome JS syntax highlighter by Alex Gorbatchev. you can find the scripts at alexgorbatchev.com/SyntaxHighlighter
promote JS Member of The Internet Defense League

Pages

  • About Me
  • Privacy Policy
  • Labs License

Me, Elsewhere

  • DotMH on Dribbble
  • @martinhaynes on Twitter
  • cnwhitedragon on Last.fm
  • Linkedin Profile
  • dotmh on github

Twitter

loading tweets…

  • RSS
  • Random
  • Archive
  • Ask me anything
  • Mobile

© Martin Haynes. Effector Theme by Carlo Franco. With hacks by DotMH

Powered by Tumblr