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

September 08 2010

webspinnerinc
04:39

Answer by Gabriel for Http request for js and css file

The suggestion to reduce the number of http requests is valid. Speed will suffer generally because many browsers will only download two files from the same domain at a time, and since Google has announced that speed does now effect their rankings it is wise to address the issue. You can combine your js and css files, use a compression like gzip on the server to reduce their size or even "compress" them using a number of free tools online.

September 07 2010

webspinnerinc
20:10
Play fullscreen
Brian Kennish - Chrome Developer Tools - 8/8 - 8/4/2010
webspinnerinc
19:25
Play fullscreen
Brian Kennish - Chrome Developer Tools - 7/8 - 8/4/2010
webspinnerinc
18:41
Play fullscreen
Brian Kennish - Chrome Developer Tools - 6/8 - 8/4/2010
webspinnerinc
17:57
Play fullscreen
Brian Kennish - Chrome Developer Tools - 5/8 - 8/4/2010
webspinnerinc
17:12
Play fullscreen
Brian Kennish - Chrome Developer Tools - 4/8 - 8/4/2010
webspinnerinc
16:24
Play fullscreen
Brian Kennish - Chrome Developer Tools - 3/8 - 8/4/2010
webspinnerinc
15:40
Play fullscreen
Brian Kennish - Chrome Developer Tools - 2/8 - 8/4/2010
webspinnerinc
14:31
Play fullscreen
Brian Kennish - Chrome Developer Tools - 1/8 - 8/4/2010
webspinnerinc
03:08
Play fullscreen
Brian Kennish: GTUG 8-4-2010 Part 1/8 Chrome Developers Tools

September 06 2010

webspinnerinc
15:19

Answer by Gabriel for What is the difference between .psd (photoshop) and .xcf (gimp) file types?

XCF supports saving each layer, the current selection, channels, transparency, paths and guides. However, unlike the native file format for Adobe Photoshop, PSD, the undo history is not saved in an XCF file.

The .PSD (Photoshop Document), Photoshop's native format, stores an image with support for most imaging options available in Photoshop. These include layers with masks, color spaces, ICC profiles, transparency, text, alpha channels and spot colors, clipping paths, and duotone settings

September 05 2010

webspinnerinc
17:23

Answer by Gabriel for Replace string in URL with javascript

window.location is an object containing the following properties:

.hash
.host
.hostname
.href
.pathname
.port
.protocol
.search

You likely want to parse the href string. I did a preliminary test where I stubbed the url expectation and the replace worked except that you do not indicate what url is. Otherwise try the following in a console:

x = window.location.href
url = "SomeValue"
y = x.replace(/sort:.*\/direction:.*/g, 'sort:' + url + '/direction:asc')

you should get the result you are expecting assuming you inspect y and not x, since a replace operation returns a result and does not change the object itself.

August 30 2010

webspinnerinc
08:15

Answer by Gabriel for How to find the list
  • number using jquery?
  • As pointed out below there are a couple of ways to add the event handlers. .bind is one, .click another. You can also create the function with your logic separately and refer to it in you bind or click event attachment.

    <script type="text/javascript">
    // version 1 with bind
      $(function(){
        $("li").bind("click", function(){alert(this.id);});
      })
    </script>
    
    <script type="text/javascript">
    // version 2 with click and the separated method
      $(function(){
        $("li").click(listClickHandler);
      })
      function listClickHandler(){
        alert(this.id);
      }
    </script>
    

    separating your handler methods from your handler assignments makes a lot of sense when you are assigning event handlers on the fly or at different points in the page life cycle. The reason I use bind more often then click is that bind can be used for a lot of different events so it would be easy to imagine creating an event assignment factory:

    <script type="text/javascript">
    // version 3, event assignment factory
      function assign(selector, event, method){
        $(selector).bind(event, method);
      }
      $(function(){
        assign(".menu li", "click", listClickHandler);
        assign(".menu li", "mouseover", listHoverHandler);
      })
      function listClickHandler(){...};
      function listHoverHandler(){...};
    </script>
    

    hopefully this is more then you will ever need.

    webspinnerinc
    07:50

    Answer by Gabriel for Calling a function to define a variable

    Unless the function is being set inside a closure, or it is part of a jQuery call back that explicitly sets the this to the event handler element you will want to avoid relying on this inside the function since it will refer to itself.

    function setMyType(obj){
      myType = ($(obj).is(".whatever"))?typeOne:(($obj).is(".something"))?typeTwo:null;
      return myType;
    }
    

    --a little ternary for good measure-- Mind you it would be just as easy in this case, if the object does contain this in a closure to simply set this.myType = setMyType(this) and if you return the value you will have it as an object property.

    August 29 2010

    August 28 2010

    webspinnerinc
    07:26

    Answer by Gabriel for Jquery script don't work on loaded page

    as Inrbob points out the problem is that loading content into an element will not load nor execute script elements. The appropriate way to apply a new script to the page is to implement:

    var s = $("<script src='" + script_location_for_validation + "'/>");
    $("body").append(s);
    

    This will lazy load the javascript and keep your code out of your page (important if you want to use caching to improve speed on later page loads).

    As an aside it is very good practice to put your libraries and scripts at the end of your page so they do not block other downloads or rendering.

    August 24 2010

    webspinnerinc
    09:07

    Answer by Gabriel for Parsing incoming mail with google app engine?

    from google documentation here:

    Receiving Mail

    Your app can receive email at addresses of the following form:

    string@appid.appspotmail.com
    

    Note that even if your app is deployed on a custom domain, your app can't receive email sent to addresses on that domain. Email messages are sent to your app as HTTP requests. These requests are generated by App Engine and posted to your app. In your app's configuration, you specify handlers that will be called to handle these HTTP requests. In your handlers, you receive the MIME data for email messages, which you then parse into its individual fields.

    Email messages are sent to your app as HTTP POST requests using the following URL:

    /_ah/mail/address
    

    where address is a full email address, including domain name. The ability to receive mail in your app is disabled by default. To enable your app to receive mail, you must specify that you want this service enabled in your app.yaml file by including this:

    inbound_services:
    - mail
    

    The Python SDK defines InboundMailHandler, a webapp class for handling incoming email. To use InboundMailHandler, you subclass it and override the receive() method. The receive() method is called with an argument of class InboundEmailMessage, another class defined by the Python SDK.

    InboundMailHandler is in the google.appengine.ext.webapp.mail_handlers package. You can create an instance of InboundEmailMessage like this:

    import logging, email
    from google.appengine.ext import webapp 
    from google.appengine.ext.webapp.mail_handlers import InboundMailHandler 
    from google.appengine.ext.webapp.util import run_wsgi_app
    
    class LogSenderHandler(InboundMailHandler):
        def receive(self, mail_message):
            logging.info("Received a message from: " + mail_message.sender)
    

    August 22 2010

    webspinnerinc
    06:06

    August 19 2010

    webspinnerinc
    20:50

    Self Help Quotes from Old G's

    Self-improvement has been a topic of the times throughout history, with famous individuals including Ben Franklin and Buddha commenting on the benefits of self-investment and analysis.
    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.