Friday, September 24, 2010

Javascript Pagination with JQuery

This script has been adapted from some other jquery pagination code found on the web.


function Pagination(){
// alert('created')
this.showPerPage = 10;
this.currentPage = 0;
this.lowestPage = 0;
this.highestPage = 2;

}

Pagination.prototype.paginate = function( content ){
this.content = content;
this.numberOfItems = content.children().size();

this.numberOfPages = Math.ceil(this.numberOfItems/this.showPerPage);

var navigation_html = '';
var current_link = 0;
while(this.numberOfPages > current_link){
navigation_html += ''+ (current_link + 1) +'';
current_link++;
}

$('#pages').html(navigation_html);
$( content ).children().css('display', 'none');
$( content ).children().slice( 0, this.showPerPage ).css('display', 'inline');
$('.page_link').css('display','none');
$('.page_link').slice(this.lowestPage, this.highestPage+1 ).css('display','inline')
$('#pages .page_link:first').addClass('active_page');
}


Pagination.prototype.goToPage = function (page_num){

if( page_num==this.lowestPage && page_num!=0 ){
// shift right
this.lowestPage = this.lowestPage - 1;
this.highestPage = this.highestPage -1 ;

}else if( page_num==this.highestPage && page_num // shift left
this.highestPage = this.highestPage + 1;
this.lowestPage = this.lowestPage + 1;
}

var start_from = page_num * this.showPerPage;
var end_on = start_from + this.showPerPage;
this.content.children().css('display', 'none').slice(start_from, end_on).css('display', 'inline');
$('.page_link[longdesc=' + page_num +']').addClass('active_page').siblings('.active_page').removeClass('active_page');
this.content.val(page_num);

$('.page_link').css('display','none');
$('.page_link').slice(this.lowestPage, this.highestPage+1 ).css('display','inline')
}
]]>



div.gadget h3{font-size:0.7em;font-weight:normal;margin-bottom:2;}
div.gadget p{font-size:0.7em;}
div.footer{position:absolute;bottom:0;display:none;}
div.footer p{line-height:70%;}
#count{font-weight:bold; }
#terms{ overflow:hidden;height:70px;font-size:.7em;overflow-y:auto; }
#terms em{float:right;}
#pages{position:absolute;right:0;bottom:2;}
#pages a{padding:1px;border:1px solid gray;margin:1px;color:black;text-decoration:none;}
.active_page{background:darkblue;color:white !important;}



Friday, September 17, 2010

No more iPhone

A little History
Around 2006 I started carrying the iphone, the first version. I loved the iPhone. There was nothing else that could even compare. The iPhone created a new standard for smart phones in my opinion.

However, once the new purchase momentum slowed it was apparent that a couple things were missing. The main thing for me was cut/copy/paste. The other issue was getting use to the paradigm of using iTunes to manage everything. It felt a little strange at first to managing photos, podcast, music, movies etc.. through an application I originally thought of as a music application. Also managing updates to my phones OS, addresses, calendar events and the rest of the stuff got shoved in to iTunes as well.

The iTunes application was a great way for me to slowly get use to the new communication channels available from the Internet. Before the iPhone I really didn't spend anytime with podcast or organizing my music. I also only dabbled with RSS readers. iTunes feels like a bike with training wheels.

I hung tight to my iPhone up till now. As of late I was carrying and still own an iPhone 3GS. The new iPhone 4GS came out and I was slowly getting device envy again. At the same time I have seen several respected colleagues move to the Android platform. Looking at all the devices that are in the market for Android I wasn't convinced that anyone had figured it out on the Android side yet.

Then this last month I received a $263 phone bill from AT&T. This is based on a plan that is suppose to be $140. If this had been the first time then I wouldn't had a problem. But this has become a repeating bill. Now the issue is with texting and admittedly was squarely my fault. My options were to add unlimited texting for something like $20 more per month or manage my texting and my wife's texting to make sure we don't ever exceed the 200 messages. Sounds like a fun problem to solve but one that I didn't feel like dealing with yet. Besides the plan is suppose to be unlimited data, why are you charging me for a text? I don't really need an answer for that question. I know why they are charging me because they can! They don't believe it matters because they have the iPhone and they know( or so they thought they did) that I wouldn't give up my phone!? Would I??? Well that is a question that I had to answer. For the past 5 years I have experienced intermittent service issues and some that have been fairly annoying and obvious.

The point of this entry
While I love Apple's products and they do a great job of making things just work, I am ready for a cheaper plan. Enter the EVO HTC Android phone from Sprint. Spring has unlimited text, data, and voice (mobile to mobile any carrier) for ....$69.95! Yep, that is right. Now how does the service coverage compare? Well I am still on my 30 day trial but I will say not one dropped call yet. I have also spoke to several other Sprint customers in the area and they have no complaints to register.

So I compromised to move from and iPhone to Android EVO? No, not at all. At first this is how I felt but after I started using the phone I couldn't put it down. The phone is so customizable! I love the idea of the widgets. I have several roles in my life ranging from father, business owner, choir bass player that the Android allows me to customize my phone to fit all these roles better. The idea of the widget allows for more practical use of front page real-estate, very important to me. So there are 100k+ apps on the iPhone market and 50k+ on Android, so what? I reasonably need about 5 applications.

The maps application on Android blows away the maps on iPhone. The FM radio is a novelty but still pretty cool. The integration with my Gmail contacts and Google Calendar are first class. No more worries about how to keep my address book and calendar on the Mac in sync with my Google products. This is done as soon as you login to the phone. Because my Google contacts have mostly been used for emailing the contact manager has always been a distant second thought. This caused duplicate entries to be created in my Google contact list. On Android when you pull the person's information up to call or message the number of other matching records get shown as possible links. A quick review of the links and "BAM!" they are all easily consolidated into one contact record. Google Contacts will no longer be a second rate contact management solution for me.

No more am I restricted by what iTunes (the bicycle with training wheels) decides to provide for me. No more will I not have the latest podcast because I forgot to sync last night with my laptop. Now the primary unit to manage my phone is my phone. I was able to use an application called doubleTwist that provides a way of importing existing iTunes resources into Android. I am still learning how to use all the features on the phone. Each day the phone becomes more customized and there by feels more like "My" phone.

On the downside, the touch keyboard and text editing could take a couple lessons from the iPhone. But definitely not that big of a deal. It would also be nice to have a hardware switch to disable sound and one other thing a better battery. The battery issue may be resolvable since I can easily pop the back off and replace it. I am contemplating buying an additional battery that I can keep charged. Not even and option for the iPhone. : )