Posts

jQuery Select change event firing twice

Hmmm...nice one jQuery code: $('#my_dd').change(function(){      alert('hello') ; }) Surprisingly on change the alert was getting fired twice. Solution: Nothing much, this was more or less my ignorance, put the block inside document ready and everything should be fine Final code: $(document).ready(function(){      $('#my_dd').change(function(){          alert('hello') ;      }) }) Hope this helps anyone. Cheers

CodeIgniter, how to make some data from your database available throughout to all of your views

Huh, I know why you are here, welcome and all my compassion. I too spent 2 hours to get this out of the most popular light weight framework online documentation and huge fanbase. CI is more sweeter than a piece of Cake (;)), according to hardcore fans, but certainly their documentation is pain in the...well leave it. To the point: I want some data to be always available to all of my views regardless of which page I'm into in. For example it could be a drop-down of states in the right hand corner of my header menu. How do I do it? Solution: Create a helper file, say my_lil_helper.php and keep it under application/helpers. By the way you can do all the good things loosely, usually you do inside your controller, inside a helper. So it could be loading a model, a library, whatever. So you write a function there like this: function return_states() { //Model call to fetch data from db table and return return $state_array; } In you header file, all you have to do is, us...

Modal window generated, but not draggable, weired problem solved

These days I'm working with the jQuery UI toolkit and facing diversified problems which are quite silly in nature. For example today i was trying to implement modal windows using the UI toolkit, the window was getting generated but it was not draggable. A little investigation revealed that these libraries are not only dependent on other smaller building block files, but also on the order in which the files are included. I altered the following sequence: jquery.ui.draggable.min.js jquery.ui.mouse.min.js to jquery.ui.mouse.min.js jquery.ui.draggable.min.js And it worked like a charm. Hope this helps anyone facing similar problems. Cheers!

d(a).zindex is not a function

Can drive you crazy if it's really in form. Can fuse your every bit of good wits and you can start banging your forehead on your keyboard. To the point: Scenario: I was using jQuery UI datepicker. When I was generating the picker inline to a div, it was working correctly. But the moment I was binding it with a textfield, there you go:- d(a).zindex is not a function Which libraries were used in my header: 1) jquery.min.js 2) jquery.ui.datepicker.min.js The reason: I was selectively using just the datepicker portion from the entire UI library. And the problem was there itself. I overlooked the top portion of the jquery.ui.datepicker.min.js file which clearly stated this file had a dependency with jquery.ui.core.js Solution: I included jquery.ui.core.min.js (it could be jquery.ui.core.js either) among the scripts and there I was escaping the gravitational pull of the black hole namely 'd(a).zindex is not a function' Hope this helps somebody who i...

Rotating an Image on a View by touching it : the Objective C way

What? You want to rotate an Image by touching it? iPhone? iPod touch application? Have googled day and night? Got your spine aching, eyes red? Calm down, help is on its way. But I don't promise its bullet proof, but still, at least its working to some extent, and its done my way, my recipe which I tried over and over again so that it could taste the way it tastes now. As said earlier, it's not perfect, but it serves the main purpose, that is rotating an image around it's center by touching it, to some extent. Scenario: I had a View, UIView object. I called it "canvas". I had another view, UIImageView. I called it "imgobj". I was required to rotate it around it's center by touching. Concept: This is only possible when I know the angle between the straight lines made by by the points, center C (cx, cy) and where I touched P1 (x1, y1) and center (cx, cy) and where I took off my finger from the screen (x2, y2). So basically if we can get the difference o...

Adding file extensions to Dreamweaver

If you have found this post and reading, definitely you're in a situation where you need that one bizarre type of files to be handled by DreamWeaver. There are tons of template engines in the market and each one ideally have their own extension for templates, tpl, stpl, shtml and the list goes on. Open the file /Configurations/Extensions.txt under from your DreamWeaver installation directory. Add the extension which you need to the appropriate group there. A snapshot might look like the following: HTM,HTML,SHTM,SHTML,HTA,HTC,XHTML,STM,SSI,JS,AS, ASC,ASR,XML,XSL,XSD,DTD,XSLT,RSS,RDF,LBI,DWT,ASP, ASA,ASPX,ASCX,ASMX,CONFIG,CS,CSS,CFM,CFML,CFC,TLD, TXT,PHP,PHP3,PHP4,PHP5,TPL,LASSO,JSP,JSF,VB,VBS, VTM,VTML,INC,JAVA,EDML,WML,THTML,STPL:All Documents HTM,HTML,HTA,HTC,XHTML:HTML,STPL Documents SHTM,SHTML,STM,SSI,INC:Server-Side Includes JS:JavaScript Documents XML,DTD,XSD,XSL,XSLT,RSS,RDF:XML Files LBI:Library Files Once done with this file, locate the next extensions.txt which should be a...

Detailed review of Shankarpur and Hotel Nest

Image
For those who stay in West Bengal, India, Shankarpur is no new name, rather a popular one. For those of you who have never heard of the place, this post is going to be your tour co-ordinator. Shankarpur is a beach town in Purba Medinipur district of West Bengal. It is around 185 Km away from Kolkata, one of the metros of India and capital of West Bengal. There are primarily two ways to reach Shankarpur. Both are easy and cool. First one is orthodox bus ride (the 100% common method to reach Digha until recent times), the second being train. The final destination of both the bus and the train is Digha. For me, I took the bus to get to Shankarpur and train while returning. So have had the opportunity to gather both the experiences. The next thing is: where to stay? The answer is "Nest" or the "Hotel Nest". They are sort of running a monopoly out in that place; and rightfully. Cool, now that you have the mode of accessing it set and place to live decided, lets start put...