-
Hackathon For Authism
Posted on March 26th, 2013 by alfredo
The Bing fund in seattle organized and event called Hackathon for Authism. I participated this past weekend and just wanted to mention that it was awesome. While the food was kinda meh. Everything else rocked.
The talks from experts and the testimonials from families afflicted were moving and gave us laser focus before starting. The space on the surf incubator its pretty neat and made me feel extremelly comftable.
This is my third hackathon in the seattle are and the feeling of cooperation here even between opposite teams was great. People were willing to stop by and give you feedback in the middle of the day.
We worked on a tool to help kids learn to type since its such an important skill in this day and age.
Our approach was to use open data sources to be able to provide the biggest range of content possible for images and for rewards video when the user completes an action. For more advanced levels we connected with Soddiio a mit project that lets people create stories(aba) so that kids can understand how to handle situations. We also gave the options to indicate if they were bored or if they got scared by the content and used twilio to notify the parents in these occasions. The architecture was a single html5 page doing the work with an azure backend

The project is open source so if you want to come help us drop by https://github.com/DevHuertas/typeit
-
Validating if a Sudoku solution is valid
Posted on November 19th, 2012 by alfredo
I got this problem today has part of a conversation that I was having and thought I was interesting. Basically how can you in O( n ) validate that a 9×9 soduku is valid.
There are 3 rules that need to be followed for a validation to return true:
- For each row there can only be and instance of each numbers.
- For each column there can only be and instance of each numbers.
- For each cluster of 9 there can only be and instance of the set of numbers.
The trivial solution that comes to mine is to go and count for each of this different conditions but that would require at least 3 passes tru the grid. For my solution i decided to just store a hashset for each of the conditions that need to be valid and stop on a negative. We use the numbers has distinct markers and not has numbers in particular since being number has no properties that help us. Solution is below:
using System.Collections.Generic; namespace Algorithms
{
public class SudokuPuzzleValidator
{
readonly int[,] _board;public SudokuPuzzleValidator():this(newint[9, 9])
{}
public SudokuPuzzleValidator(int[,] board)
{
_board = board;
}
public bool Validate()
{
const int integersInGame = 9;
var rowSet = new HashSet<int>[integersInGame];
InitializeSet(integersInGame, rowSet);
var columnSet = new HashSet<int>[integersInGame];
InitializeSet(integersInGame, columnSet);
var subGridSet = new HashSet<int>[integersInGame];
InitializeSet(integersInGame, subGridSet);for (var row = 0; row < integersInGame; row++)
{
for (var column = 0; column < integersInGame; column++)
{
var cval = _board[row, column];
if (rowSet[row].Contains(cval))
{
return false;
}
rowSet[row].Add(cval);
if (columnSet[column].Contains(cval))
{
return false;
}
columnSet[column].Add(cval);
var subGridNumber = FigureOutSubGrid(row, column);
if (subGridSet[subGridNumber].Contains(cval))
{
return false;
}
subGridSet[subGridNumber].Add(cval);
}
}
return true;
}private static void InitializeSet(int integersInGame, HashSet<int>[] rowSet)
{
for (var i = 0; i < integersInGame; i++)
{
rowSet[i] = new HashSet<int>();
}
}private static int FigureOutSubGrid(int row, int column)
{
return column/3 + row/3*3;
}
}
} -
Today my mind got blown
Posted on November 3rd, 2012 by alfredo
While coding randomly because i was stuck in a starbucks a friend of mine told me i should read the following articles after reviewing my github code. They kinda blew my mind and made me realize i have been doing a clustermess when i write javascript(Node i don’t do it professionally almost ever).First mistake using the top level namespace for all my functions. Thefore he pointed me to the following article which made a pretty deep impact and solved my problem.
http://markdalgleish.com/2011/03/self-executing-anonymous-functions/
Second one was my bit of code could be imported and would work sometimes. He pointed me to this article on writing modular js that honestly points to what im doing from now on.
http://addyosmani.com/writing-modular-js/
Not adding much new here but recommending this as must read.
Will post my code from before and after applying this. -
Finding All empty tables in SQL db
Posted on August 17th, 2012 by alfredo
Had to do this at work figured this script might be useful to some around here. If you are and tester and gets a new system is a good way to find out what tables are getting no activity.
DECLARE @Tables TABLE
(
Name nvarchar(100)
)
DECLARE @EmptyTables TABLE
(
Name nvarchar(100)
)
DECLARE @AlmostNoRowsTables TABLE
(
Name nvarchar(100)
)INSERT INTO @Tables
SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.TABLESDECLARE @controlVariable nvarchar(100)
DECLARE @counter int
DECLARE @rowsleft int
SELECT Top 1 @controlVariable = Name FROM @TablesDeclare @SQL nVarChar(1000)
Declare @ex nVarChar(1000)
SELECT @SQL = ‘SELECT @counter=COUNT(*) FROM ‘WHILE(@rowsleft > 0)
BEGIN
SELECT @ex = @SQL + @controlVariableEXEC SP_EXECUTESQL @ex,N’@counter INT OUTPUT’,@counter OUTPUT
if(@counter = 0)
BEGIN
SELECT ‘Empty Table’ +@controlVariable
ENDif(@counter > 0 AND @counter <10)
BEGIN
SELECT ‘Table has almost no rows’ +@controlVariable
END
DELETE @Tables WHERE Name = @controlVariable
SELECT Top 1 @controlVariable = Name FROM @Tables
SELECT @rowsleft = COUNT(*) FROM @Tables
PRINT @rowsleft
END -
Learning a new mocking framework what you should learn (1 out 3)
Posted on June 26th, 2012 by alfredo
Over the past six month depending on the workplace that I went I had to unit test. Most of the places where using Dynamic mock frameworks. After learning one or two I came up with a list of what one should learn from a framework to make life easier.
What you need to learn of a mocking framework
· -Return values for interfaces
· How to fire events
· How to mock properties set and get
· How to register params
· How to ignore args
· Work with generics
· Work without parameters
· Register handlers
· Work with out parameters
· Have a mock implement two interfaces
In the next article I will use a moq framework to show examples of each.
-
I survived burnout just barely
Posted on May 29th, 2012 by alfredo
Hi blog readers I have recently read a bunch of posts regarding Work life balance. Starting with people trying to achieve it:
http://www.hmans.io/2012/04/23/the-501-developer-manifesto/
Followed with some tips to survive the burnout and detect it:
http://www.codingninja.co.uk/logout-before-you-burnout/
And quite a few who don’t believe is an issue an most of us talking about this are a bunch of whiners.
I’m just going to state this I did not believe in burnout, it happened and I almost did not made out of it. I see there are two types of engineers in big companies those that make programming their lifestyle and those that just see it has a skill they have for work and two earn money. To the second kind I really can’t tell you much about burn out since except for the last 4 months I have never behave that way.
To the first kind listen if you want even though has you read it its probably going to sounds has rubbish since you know better
. You are not going to see it coming unless someone lets you know. Second its not about the time you spend in the office but about the time you are in the office but the time you spend connected to the problems that you need to solve. Especially those that drain your energy (In my case solving political or build issues).So how does burnout feel. You know when you have those days that you look at the screen and no code wants to come out and your mind is like lets go look at reddit for a few more hours is like that but 24/7 and your mind seems to want to stay consuming instead of producing.
So how do you get to that point. First and foremost its your fault. In my personal case I was having confidence issues because I had tried to move to another team in the company and got rejected and decided to try to improve myself. If you feel at work that you have something to prove that is one of the early signs. Second things start getting overcomplicated and you can’t really justify it therefore you try to fix (this is normally not a real problem talk to your boss). Third you feel like you need to be in this job since getting out would be admitting failure at this point I would say that you know that you are in trouble. 4th very close to the end I felt like everyone was doing something wrong around me(Normally I never think that).
So what happened next I stopped functioning got to the point that I could not do anything and decided I had to quit.
So how did I get back on my feet quite a few things:
- Family and gf support -Can’t say how important this was
- Changing my lifestyle to focus on financial security
- Watching tv for 3 whole weeks.
- Reconsidering my career choices and if being a developer was a good choice.
- Last but not least getting to work in a place where i was able to work in the part that i enjoyed of the job without all the other ones(This is the one that is hard to find).
If you are wondering what im doing forward to avoid a repeat I will tackle that in a following post later this week since its rather lenghty. The one thing I would like to mention is that is all in your control burnout has nothing to do with bosses or what not in all honesty people should not have much power over you if they do. The first thing that you need to do is fix your living situation to help avoid burnout. Hopefully this experience helps some people out there. If there is anything you guys want to discuss let me know.
-
Writing my first windows 8 Metro App
Posted on April 23rd, 2012 by alfredo
Hi Everyone,
Today I got started building my first windows 8 app. Decided that I wanted to write a standard WPF MVVM app and try the javascript interactions later. Loaded my windows 8 image created a project and downloaded Prism to get started. I was surprised while adding the dll’s to prism that they do not work with windows core which is the framework that metro apps run on that. Realized that I’m going to have to be crafty and just take the exact part of Prism and adapt them.
Opened expression blend created a project from a template to get started.
First thing to surprise me was to see that the toolbar is completely gone replaced by the appbar. They work the same way therefore more of an inconvenience of recognizing what the name of the component is.<appbar grid.column="0" grid.row="0">
<stackpanel>
<button horizontalalignment="Left" verticalalignment="Top">
<ellipse
Height=40tWidth=40
StrokeThickness=3
Stroke={StaticResource ApplicationTextBrush}/>
</button>
</stackpanel>
</appbar>
After that the next item that stomped me was when I tried to look for icons clicling on any picture takes me to a full screen method in which at the moment scrolling did not work on the folder that I was. Weird behavior kept me having go back and forth between the folders on the desktop and the metro start page…
While doing this I had my ui freeze causing a restart. Which is okay since its a beta preview.
A cool thing that I noticed is the new standard template breaks your app into folders Assets, Common, DataModel. If you add a xaml resource into the Common folder gets automatically added has a merged dictionary on the app level.
After adding the shared dictionary I wanted to add a textblock surrounded by a circle I tried to copy some old code using the label type to discover that it no longer exists.
Got the same effect from using:
<button>
<border horizontalalignment="Center" verticalalignment="Center" width="40" height="40" borderbrush="{StaticResource ApplicationTextBrush}" borderthickness="3" cornerradius="20"><textblock horizontalalignment="Center" verticalalignment="Center">40 F</textblock>
</border>
</button>
Since I was using it a bunch of places decide to make it a global resource to find out that the syntax for declaring types has changed from:
{StaticResource {x:Type Button}}"
To be more similar to what is used in Silverlight which can be read on this link:
Which requires to either create and converter for similar functionality or reference directly from the based template of the controls which is what I did by doing:
BasedOn="{StaticResource AppBarButtonStyle}"At the end in order to substituthe contentcontrol behavior that I would normally use a label for used a contentcontrol which made the button look the way I desired.
Another point to make to change the application loaded frame you want to go to app.xaml.cs -> protected override void OnLaunched(LaunchActivatedEventArgs args);
Overall so far got quite some progress on this. Like the new setup for the project. Feel like sometimes while testing the os crashes a bit much and I need to more exploration of all the controls(ToggleButton rock). Added some resources on the button and will keep making post has the application progress and post some images later. At the end some links to a few resources.
-Alfredo Out
Icon Resource
I’m using the ones from this website but you can also use the ones from the phone.
http://www.iconsforwindows8.com/ -
Xaml DataBinding to current datacontext
Posted on March 21st, 2012 by alfredo
My new job has me doing a ton of xaml i have a few interesting cases that i believe i should document before i forget how to do them.
First one was how do i Bind to the current Context after a few attempts couple of bings search got to this page and he had an answer for my problem.
http://www.developmentalmadness.com/archive/2009/08/26/xaml-binding-to-the-current-datacontext.aspx
Its pretty simple you just do {Binding} with nothing else in it.
Come next day to work realize that now i need a converter since we want different text to the one provided by the enum. To my surprise what i would expect {Binding, Converter={StaticResource myconverter}} would not work. So i started trying different possibilities made an explicit binding. Then Started thinking and decided well i’m just binding to my datacontext. So ended up with the following.
RelativeSource="{RelativeSource Self}"
Path="DataContext"
Converter="{StaticResource myconverter}"
ConverterParameter="Parent" />I feel like this is a case in which the xaml its really ambiguose and in future generations maybe the should create a keyword like context or what not to be able to change it.
Hope this helps.
-
How things are going current projects and sorry for the lack of update
Posted on March 7th, 2012 by alfredo
Hi Everyone,
How come I have dissapeared for a few well the new contractor life and settling into the new pace has taken a bit more of me than I expected. On the good news Im a lot happier than I was in the sept – january time frame and gainfully employed.
I’ve been doing a lot of WPF for two reasons one i’m studying for a cert and second its what i’m currently doing at work.
I’m hoping to be a lot more active this month and bring some update to my old projects
- There is no place for gnomes needs a new scoreboard and want to do an add based version
- Reddit Screensaver needs and update and i want to transform it into a MMVM app
- HDR raw want to try out some new formats in particular for the new sony lines is anyone still using this paint.net plugin??
I have been working on a Platform game aussie puncharoo probably for almost a year this weekend im going to commit to getting some progress and uploading a demo. Hoping to finish this project in the month of march to move to some ideas that i have to start my own business.
In terms of the blog im going to install win 8 today and then start describing the construction of an app that i will be work on a bit each day is going to be called contract manager and the purpose its to help you be a contractor on yourslef and keep track of everything that is going on in the life without a mother company
Happy Coding
-
New Year And Interesting Changes
Posted on January 23rd, 2012 by alfredo
The new year came in and few things have changed in my life for once. I decided to resign at Microsoft to take care of some personal issues. At the moment i ‘m still dealing with the change of moving from the workforce into a more personally driven situation.
In part due to my new found time I have been taking a look around at the new technologies that are coming and I’m convinced that this year is going to be the the year that html 5 blows up our minds. Perusing the web I found this two web sites and they did just that.
http://www.kevs3d.co.uk/dev/
He shows his 3d library and creates some interesting demos is worth looking at it.http://apps.nahklick.de/cnc/
This one on top recreated c&c in html 5 showing off the possible gaming capabilities of the environment.Seeing this type of technology advancements have made me question two things
First – What the heck have I been doing in this last couple of years since it made me realize I’ve been not contributing much.Second – As software developers we might actually be a bit out of focus with what is needed to advance society. We are spending our time creating software for advertisement, games and advancing it day to day but leaving behind many fields like infrastructure creation, economics , resource distribution , medicine with only a few advancements.
In a lot of cases when we have approach this field due to the constraint of money we have become part of the system. Like in medicine a lot of the Emr or bi systems are not for the betterment of the patient or to help the provider make less mistakes. But to enforce that correct billing is being done to the Insurance companies.Which brings me to the point maybe for the next year computer engineer / scientist should spend at least some of their time helping another industry that is not their own
. Best of wishes on the new year.
Alfredo