Hello, Another quick tip. How many time do we have to check if the supplied value is a function, obejct, number, array, boolean or iterable. I guess the answer will be many times. Most of the time we will use either instanceof or typeof in Javascritp to check on above but ExtJS comes pre-packaged with some function that are really handy in many situations. Lets go through some of the "is" functions This is our skeleton function The skeleton Check if function Check if Object Check if Array Check if Number Check if HTML Element So the above example will work as per normal. As you notice that the functions are very handy and can be found under Ext object. Another handy function with similar checks are Ext.isEmpty() - checks if passed value is empty Ext.isIterable() - check if passed value is iterable Ext.isBoolean() - check if passed value is boolean Ext.isDate() - check if passed value is date I hope that this helps you. ExtJS is an awesome framework. The more you use it more you will love it. I am not a hardcore ExtJS developer but I am using it day in day out without changing the default behaviour of the framework. Hopefully at some stage I will be looking at more detailed understanding of the framework and the more I learn more will be coming out as new posts on my blog. If you have something to add above please do so by using comments. As always your comments are welcomed. Cheers. … [Read more...]
ExtJS 4 check if value is Function, Object, Array or number
Excel 2013 remove duplicates Video tutorial
Hello, While I was working on a spreadsheet where I had to get rid of duplicate values in a column and multiple columns I thought It could be useful for me to do a video on how to remove duplicates so that it may help someone. I hope that you can bear with my English but I assure you that the intentions are to help someone out so putting up with it something you shoudn't complain :) Remove duplicate cell data in Excel 2013 Here is a quick video tutorial httpvh://www.youtube.com/watch?v=C-2MmguSO4w I hope that you will thoroughly understand how to remove duplicates from your spreadsheet columns. If you would like me to write about it with screen shots please let me know. I thought video will be much simpler. I hope that you learn from this post. If you have something to add to what I said please leave your comments and I will add it in this post. Cheers … [Read more...]
ExtJS 4 detect Browser
Hello, A very quick tip if you are looking for browser detection in ExtJS 4 I will show you how you can detect IE Firefox Chrome Opera Safari And also will show you how you can detect Operating systems such as Windows Linux Mac IE detection with ExtJS Here are quick conditional block to detect Internet Explorer For IE as generic or version detection use this Detecting Firefox with ExtJS You can use any conditional block that suits your requirement Detecting Chrome with ExtJS 4 Detecting Chrome is as simple as Detecting Safari with Ext JS 4 Detecting Opera with ExtJS 4 Operating system detection with ExtJS4 As we've seen how we can detect different browsers, lets now check how to detect operating system with ExtJS 4 Detecting Mac Detecting windows Detecting Linux and that's it. As you can see that all these properties are home to Ext object and are very handy. In the end I just wanted to say we would never ever really need these if all browsers do the right thing. IE is a main culprit here and we have to patch work for some features to work nicely on Internet Explorer. If you find any error above please let me know Resource: http://docs.sencha.com/ext-js/4-1/#!/api/Ext I hope that you will find this post useful Cheers … [Read more...]
HTML5 desktop notifications
Hello, Everyday we learn something new, sometimes because we are curious how things work and sometimes because time require us to learn. I did learn how to display desktop notifications a while back but today I end up using them. They are supported by webkit browsers such as chrome. I will go through a simple Object that I've written to give you what;s required. You can't believe your eyes when you see it as simplest thing you may have ever done or learnt Here is a simple JS class The Javascript Lets check the markup for our example code The Markup We have two anchors and we will bind click handlers to both of them as shown in Usage section Usage Here is a quick usage example for the above object. As you can see that its pretty straight forward stuff and is very easy to understand. Its time for a Demo Demo Here is a quick demo http://jaspreetchahal.org/examples/jquery-examples/notifications.html Screenshot Desktop notification will look like this As you can see above that we are making use of all three elements for our notification i.e. Image, Title and description I hope that you will find this post useful. If you have something to add please let me know via comments and I will make corrections or additions based on your input. Cheers … [Read more...]
php force echo output to browser while page is still loading
Hello, This post is very brief and a quick tip. In this age where Ajax has taken over as preferred method for background tasks there are many a time that we still have heavy ended loops that holds the page load till they finish their execution. Well! normal scenarios is when we do reports stuff. In this post I would like to share a PHP way that works. First of the method is to use So your script will look like this But as per some reports such as this one https://bugs.php.net/bug.php?id=23877 The above method may not work. But the one that I use is the one given below Preferred way As you can see that I've called ob_start() as the first line of above example. ob_start() will enable the output buffering for our page. Then you see that I am using function ob_end_flush() and flush() after the echo function. This means that whatever is in the current output buffer, flush it. Thus whatever is printed will appear on your browser. Excercise Copy paste this code into a new file called test.php and save it to the root of your test website's root folder and then run it from browser to see if it works. Lot of people would have loads of problems with this stuff. Its your webserver that has to be set correctly and even then the code above may not work. If the above does not work then its work add the header to the start of the script as shown below Above should print 0 till 9 and with each increment you will notice a delay of 1 second. I hope this helps. If you see any error in whatever I've put above please let me know. If you have something else to add please use the comments section. Your comments are always welcomed. Cheers. … [Read more...]
How to close an app in windows 8 Video tutorial included
Hello, While I was wondering how we can close an app in windows 8 I came to know after playing around with it a little bit. Here is a quick video tutorial just on this topic Video tutorial httpvh://www.youtube.com/watch?v=EY-7NiXonrA If you don't want to watch the above video here are the ways you can close an opened app Same old ALT+F4, CTRL+ALT+DELETE will bring up the task manager and you can force kill your app. This is not very friendly way to do it, right? I use this: Take your mouse cursor right at the top of the opened window. You will notice once the pointer hits the top it will change its shape to a hand cursor. Just when it does that you can hold the LEFT mouse button and start dragging the window right to the bottom of the screen and then leave the mouse button you were holding. You will notice that your app is now closed. Another option is to hold down Windows+TAB keys and you will see thumbnails on left hand side with all the opened windows. You are now free to Right mouse click and close your app. Window+Tab is also used to switch between apps. I would always use the third option where possible. You can watch the video too and put a vote through if you like it. If covers couple of other tricks that you can use to speed up your actions in windows 8 environment. I will come up with some other tips and tricks on this topic. There are hater and there are lovers. I love windows 8 because I think its quite intuitive, but there are certain things that are made difficult to find. But I think when you get used to it, FURN starts then. If you have any other method other than what I mentioned above to close an app please do share it with other readers Cheers … [Read more...]
HTML5 window.sessionstorage
Hi Guys, In my previous post I highlighted how we can make use of localStorage for persisting data on users machine. In this post I will be highlighting localStorage counterpart called sessionStorage If you are interested reading my previous post if can be found here http://jaspreetchahal.org/html5-persistent-storage-using-window-localstorage/ Window.localstorage vs window.sessionStorage There is one basic difference between these two objects window.localStorage persist data permanently whereas data persisted by sessionStorage is only available till the user close his browser. Now that we are sort of clear what these two objects are for, lets now go a little bit deeper to understand how things work with sessionStorage object. Important functions that you should be aware of in sessionStorage object are getItem() - gets value of a stored key setItem() - sets value of a key clear() - clears session You have to remember that sessionStorage maintains a storage that is only available for the duration of the page session. A page session lasts for as long as the browser is open and survives over page reloads or restores. Another thing to note is that if you end up opening the same URL in another tab of the same browsers the session will be re-initiated. Let me try to explain using an example The Markup Here is a basic markup that we will make use of Ok so the above code is really simple to understand I guess. We have a Textarea and a hyperlink and a DIV with ID msg to display a message Idea is that when user will click on the Save button it will send the textarea value to session storage. Note that the saved data is available for currently opened browser tab or window only. Lets make use of the jQuery to handle clicks and make use of sessionStorage The Javascript Here is the javascript that we will be using to store our textarea value Ok so the above code is pretty straightforward to understand. We are … [Read more...]
html5 persistent storage using window.localstorage
Hello, In this post I would like to show a really cool feature that you can make use of in HTML5 that enables us to use local storage on users device such as a PC. As long as the browser supports localStorage you should be good to go. Here is a read about Webstorage standard http://www.w3.org/TR/webstorage/ Ok so lets start. I will divide this post in 3 sections, First I would like to show you the markup that we will be using to demonstrate this functionality and then the Javascript code and then I would like to direct you to the DEMO to try it yourself. The Markup Here is a basic markup that we will make use of Ok so the above code is really simple to understand I guess. We have a Textarea and a hyperlink and a DIV with ID msg to display a message Idea is that when user will click on the Save button it will send the textarea value to local storage container. Note that we are not sending this data to the server itself Lets check the Javascript code. I am making use of jQuery here but the core couple of lines are traditional javascript. The Javascript Here is the javascript that we will be using to store our textarea value Pretty straightforward! right? Ok let me explain the above code. On window.load we are loading value of our stored property called myStoredVal to our textarea. We are also handling click event on our anchor tag and thats when the line below does the magic window.localStorage.setItem('myStoredVal', $("#persistentdata").val()); As you can see that localStorage is an object under window object and I think that's pretty right place to keep it and offers functionality to store and retrieve our stored data. Important functions of localStorage object As you can see above that 2 of the important functions under loadStorage are setItem() - to store a value getItem() - to retrieve a stored value Deleting the storage Use clear() function to clear the localStorage as shown … [Read more...]
HTML5 attribute hidden equivalent to CSS’ display:none
Hello, While I am becoming more and more aware of some of the key features of HTML5 I would like you to know that there is a new attribute that you can make use of which is called This attribute serves exactly the same thing that our old friend display:none does So in CSS we used this And then we apply the above style to an element as Now lets do the exact same thing with our new HTML5 friend "the hidden attribute" We can use hidden attribute 3 ways. As bool As string literal or as an empty string literal Browser support No surprises here that IE does not support it. All other major browser do support it which includes firefox, chrome, opera, safari Using hidden attribute With jQuery This is pretty simple and we will do it the standard way we add attribute to an element Here is a quick example As you can see that the element with ID hide_this_element will not appear on the page as a result of above jQuery code. jQuery with fallback I am in double mind to use it because there are few HTML things that when kept to HTML core looks more syntactically correct but anyone can argue on this point. I will. For the time being though I will still be using my beloved CSS display: property. It will be another few years before we see standards getting adopted by major browsers as soon as they become standards. I hope :) I hope that you find this writeup useful. As always your comments are always welcomed Cheers. … [Read more...]
persisting DIV on scroll with jQuery
Hello, I sometimes find it interesting why many sites want to persist some HTML container while user scrolls. By persisting what I mean to say is that say you got a very useful navigation that applies to a subsection of your page and you want to detach it somehow so that user don't have to scroll up to access it again. This is exactly what I will be showing you today. Idea is simple and we will make use of our friendly jQuery function called scrollTop() There are two things I want to show you today. Persisting Single Element on page scroll Persisting section headers Detaching single Element by ID By this what I mean is that we will be detaching one single element when user scroll reach that element. Ok so lets check out what need to be done The HTML This is not a full page HTML so for demo purposes this should be enough The CSS There is only one class thats required. You can also opt for jQuery(Element).css() if you like. The jQuery Code Above example is pretty straight forward for me to try to explain whats happening. Here is a demo for you to try Demo http://jaspreetchahal.org/examples/jquery-examples/detach-div-single.html Persisting section headers This is a little bit trickier. I came up with a solution and did some research to see how others do it. I then modified my code a little bit to come up with this. Lets check out the required HTML, CSS and jQuery code required for sectioned header persistence The HTML Rather than making it full page HTML lets keep it simple to this Couple of things to note here. First, we have class name detach-container added to the parent Element. In our case it is article and if you noticed I added class detach to the child element We wanted to detach while user scrolls. We did this because this way we always know when to show or hide our Detached element. Idea is to show it only while the article area is visible to the user Lets go ahead and check … [Read more...]






JC WordPress Coupon Revealer Plugin Pro License
Australian Street Names with City, State and Display Names only, Single Server License
Recent Comments