Showing posts with label inconsistencies. Show all posts
Showing posts with label inconsistencies. Show all posts

2013/12/02

#37. Firefox and other browser blocks insecure content

You have a website and firefox or other browsers block your ads or other content?
And it also shows an alert about insecure content?

Maybe you are using https in your website, then probably the cause is that you are serving this content without security (http) and browsers usually complain about it.

A simple way to fix this common mixed content error is removing the protocol from the url, so if you have an url to your content like src="http://yourcontent/contentpage" leave it like src="//yourcontent/contentpage". This way the browser will connect using the same protocol as the container page and allowing the content.

2013/08/27

#36. BlockUI fires ready event in the message content

After playing a little with BlockUI I found out a strange behavior, in my opinion. BlockUI fires the ready event in the elements of the message, if the element contains the typical ready event handler of jquery it may cause some problems as happened in my case.

Here you can check an example of the problem.

You can solve it easily extracting the javascript code of the element to use as message, and, of course, not use javascript inline as the best practices say.




2012/07/28

#25. For a less painful development

I was repairing a component that automatically historifies changes in datasets through an abstraction, found out some problems with wrong assumptions in a rushy development. As this code was not made by me, it felt like in this comic, and repairing the component give me the inspiration to take some guide patterns for future developments in our current project at work.

- make functions as test friendly as possible, decompose when you can
- use tests to assure you do not break anything and even it costs more, make tests that build the data they use, don't depend on a DB that may change in the future, so favor functions that receive simple data so they can be easily testable.
- favor composition over inheritance, it gets simpler to make a change of behaviour and extend it
- put code where should go, if you use an instance in a function too many times to access its fields maybe you should consider to put this function inside the class of the instance, if it is your code.

Follow these simple rules and you will be happier at your work also read Refactoring: Improving the Design of Existing Code, a must read.

2012/03/06

#21. Java generics, type erasure and lazyness

I've been doing a little personal app in Java, and recently found out that generics in Java erase type information so generics would have retro-compatibility (or at least it's what I learnt from reading this post). I can’t deny that I don’t understand the idea and the drawbacks aren’t much but what’s the meaning of doing something halfway. I was just trying to get the type of a generic variable. I don’t think that this was the only option but probably was the easiest.

2012/03/05

#20. Sorry tumblr, ifttt rules

I’ve been thinking of changing the blog to try another blog management site, currently I don’t want to host it myself so one of my options was tumblr, it’s a simple and easy to manage blogging site but as I was going to try couldn’t use windows live writer with it, searching for a solution found out that they don’t use a standard API, so I won’t be using their site directly, I’ll probably use ifttt a service to post indirectly through conditions.

2011/11/04

#9. W0t...Awww...

Why I need to cast this?¿ Awww...those are the frustrations of programming that sometimes I can’t understand.
image
If getItemList returns a List<I> why .get returns an object?