Tumblelog by Soup.io
Newer posts are loading.
You are at the newest post.
Click here to check if anything new just came in.

August 09 2010

webspinnerinc
09:57
Other Guys Credits... awesome message.

August 08 2010

webspinnerinc
18:14

Answer by Gabriel for Jquery Drag n Drop Stage

jQuery-ui Draggable Droppable event handler

You need to get the droppable dom object from the event arguments passed to the drop method.

$( ".selector" ).droppable({
  drop: function(event, ui) { 
    // $(this) represents the droppable.
    alert($(this).attr("id"));
  }
});

the draggable object can be referenced through ui.draggable. Most of this was taken from the jQuer-ui documentation found at the jQuery-ui Website

webspinnerinc
03:54

Answer by Gabriel for How to overlay an image over another image?

from the code you posted, it appears you are passing an img element into another the src attribute of another img element. Is there a reason you are doing this?

<style type="text/css">
  .imgA1 {position:absolute;
          top:0px;
          left:0px;
          z-index:2;
          width:1300px,
          height:283px;}
  .imgB1 {position:absolute;
          top:0px;
          left:0px;
          z-index:1;
          width:1300px,
          height:1000px;}
</style>
<img class="imgA1" src="images/home_nav.png" alt="home_nav" />
<img class="imgB1" src="images/paperbackground.png" alt="Background" />

A similar code mockup can be seen at http://jsfiddle.net/gBPBd/3/ with my images to prove the concept and it is funcitoning in chrome, ie8.

webspinnerinc
03:35

Answer by Gabriel for Elegant workaround for JavaScript floating point number problem

This function will determine the needed precision from the multiplication of two floating point numbers and return a result with the appropriate precision. Elegant though it is not.

function multFloats(a,b){
  var atens = Math.pow(10,String(a).length - String(a).indexOf('.') - 1), 
      btens = Math.pow(10,String(b).length - String(b).indexOf('.') - 1); 
  var result = (a * atens) * (b * btens) / (atens * btens); 
  return result;
}

August 07 2010

webspinnerinc
15:52

Answer by Gabriel for What's your way of learning a language?

I have gotten into new languages by coming up with a project. Maybe something you have already done in another language or something you would find useful(like a programming tool). Then try to write it in the language you wish to learn, at first using just what you understand about the language and can glean from books and websites. As you get the project to completion start asking in the community for someone to look at your code and ask questions for what appear to be problem areas.

It is important to realize that a language is usually very general while a problem will give it context. For instance I may know how to develop Java applications, but that does not mean I know how to develop J2EE applications. Same language, different context; so you may wish to think about that while coming up with the learning project or projects.

I also highly recommend building the project with very heavy unit testing. Writing unit tests is going to give you a solid set of tools that they will not be showing you in the books, your code will improve and more importantly any unexpected language idioms will stick out like a ... well like a failed test.

August 06 2010

August 05 2010

webspinnerinc
07:36

Palindrome Algorithm

You ever get a question that just bugs you until you solve it every way you can think. Today I was asked to write in pseudo-code a short algorithm for determining if a string was a palindrome. I wrote ECMAScript like scrawl and short a couple of important things that I missed I basically made a working palindrome function. But then I got home and wanted t actually test my code so I did and these are what I came up with. If you know a better way of have a language implementation I would love to see it to have some fun:
// JavaScript
function pal(w){
return w.substr(0,((w.length / 2))).split('').reverse().join('') == w.substr(((w.length / 2)+((w.length % 2 == 0)?0:1)));
}

#Python
def pal(w):
c = w.count('')
x = int((c-1)/2)
z = c%2
return w[x-z::-1] == w[x::1]

August 03 2010

July 30 2010

webspinnerinc
22:44
Play fullscreen
California's Great America Summer 2010
Older posts are this way If this message doesn't go away, click anywhere on the page to continue loading posts.
Could not load more posts
Maybe Soup is currently being updated? I'll try again automatically in a few seconds...
Just a second, loading more posts...
You've reached the end.