Blog Tags

Lab Eleven Blogs

Web design & Programming tutorials

Will iPhone Apps Run On iPad?

Posted by: twmeier

Tagged in: SDK , iPhone , iPad

One big question that iPhone developers have about the iPad, is whether or not existing iPhone app will also work on the iPad. The answer to that question is YES. The iPad in many ways looks like a large iPhone, and in many ways it acts like one too.

The iPad can run all of Apple's iTunes App Store iPhone and iPod touchs apps. And, just like an iPhone, you can upload your existing apps, music, pictures, videos etc. to your iPad.

 When you run your apps in the iPad, you can choose to display them as their original iPhone size (320 x 480) or you can hit a 2x button on the screen and double the size. At 2x the original size, the app will not completely fill the screen. 


How to create a marquee text for an iPhone app

Posted by: twmeier

Tagged in: Programming , iPhone

In this blog, you will learn how to create a moving text field (also know as a marquee). Marquees are very convenient to show news, stock updates, sport scores etc..


In the .h file:
#import
@interface FirstViewController : UIViewController {

UIView *messageView;
UILabel *lblTime;
CGSize messageSize;
}
@end


In the .m file:

- (void)viewDidAppear:(BOOL)animated {    
NSString *theMessage = @"Hello, my name is Enigo Montoya. You killed my father, prepare to die";
messageSize = [theMessage sizeWithFont:[UIFont systemFontOfSize:14.0]];
messageView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, messageSize.width, 19)]; //x,y,width,height
[messageView setClipsToBounds:YES]; // With This you prevent the animation to be drawn outside the bounds.
[self.view addSubview:messageView];
lblTime = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, messageSize.width, 19)]; //x,y,width,height
[lblTime setBackgroundColor:[UIColor darkGrayColor]];
lblTime.font = [UIFont systemFontOfSize:14];
[lblTime setText:theMessage];
[lblTime setTextAlignment:UITextAlignmentLeft];
lblTime.frame = CGRectMake(0, 0, messageSize.width, 19); //x,y,width,height
[messageView addSubview:lblTime];
float duration = messageSize.width / 60; // This determines the speed of the moving text.
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:duration];
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView:messageView cache:YES];
lblTime.frame = CGRectMake(-messageSize.width, 0, messageSize.width, 19); //x,y,width,height
[UIView commitAnimations];
}

Thats all there is too it. Check out the comments in the code for further clues on how it works.


How to Submit Additional Images in Virtuemart

Posted by: twmeier

Tagged in: Joomla , Components

Adding a singe image to a product is easy. Adding additional images can be confusing.

To add additional images to a product, find your product in the Product list in the backend of your website.

 In the "Media" column, you will see a small icon. Click this icon. On the next page, you will be able to add more images to the product. You can also add other types of media such as a PDF.

That is all there is to it.


Using an Image as a Submit Button in HTML

Posted by: twmeier

Tagged in: Javascript , HTML

There are times when you want to use an image as a button to submit a form. One case is when you need to use JavaScript to check the html form was submitted correctly. Here is the code:

<script>
    function checkForm()
    {
        var msg = "Please correct the following: \n\n";
        var error = false;
       
        if(document.formName.elementName.value=="") {
            msg += "You must enter a date.\n";
            error = true;
        }
       
        if(error){
            alert(msg);           
        }else{
            if(confirm("Are you sure you want to submit this form?")){                                               
                document.formName.submit();       
            }                   
        }
    }
</script>

<form name="formName" action="/index.php?&task=something" method="post">
    <input type="text" name="elementName" id="elementId" value="">
    ....
</form>


<a href="#" onclick="checkForm(); return false;"><img src="/images/brown_submit.jpg" /></a>


The method above works in all browsers, and is easy to use. When you click the image, the JavaScript function is called. If there are no errors in the form, the function submits the form. Its that easy.


Joomla 1.5 Custom Breadcrumbs

Posted by: gbluma

Tagged in: Programming , PHP , Joomla , Components

Joomla seems to have everything figured out — Breadcrumb support is no exception.

Recently we were writing some custom component for a client and needed to handle the breadcrumbs in a special way that Joomla couldn't manage automatically.

As a simplified example, imagine we redirect a user to a component that isn't attached to a menu. We would expect the breadcrumbs to simply output "Home" and provide a link back to the index of the site.


Quick and Easy SEO (Search Engine Optimization)

Posted by: twmeier

Tagged in: SEO

There are a few quick and easy ways to improve your website's search engine rankings using a few simple search engine optimizations. By following the simple steps below, you should see an increase in your rankings with the top search engines.

1). Never register your domain for only one year at a time
. Search engines will pick up on this and will assume your website may not be around for the long haul. There is not a specific number of years you should register your domain, but the more the better.

2). Pick your page titles wisely. Search engines seem to weigh heavily on page titles. Especially Yahoo. Pick page titles that match the keywords you would like focus on. I would recommend using Google's keyword tool to find the keywords that people are searching for the most that are relevant to your website:
https://adwords.google.com/select/KeywordToolExternal

3). Content is everything. Search engines now focus on content more then ever before. You need to start writing. All those English classes you took over the years will finally pay off. Again, you need to pick keywords you would like to focus on, and write your articles with using these keywords in the title, meta tags and the articles themselves.

If you do not have the time to write articles (or just hate to do so), you can easy find companies online that will do it for you. Most one page articles will cost you around $12 to $15. All you do is specify the subject and what keywords you would like them to include. For a small fee, these same companies will also post messages on your forum in order to get things moving.

4). Pick to use www or not to use www.
I recently checked the page rank of the homepage of one of my own personal website, first with 'www' in the url, and then without 'www'. I was surprised to find that the page ranks were different. Google was seeing the homepage as two unique pages, one with 'www' and one without. This is a problem since Google penalizes pages with duplicate content. To fix this problem you can place the following code in a file named ".htaccess" in your site's root directory:

Example 1 - Redirect domain.com to www.domain.com

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]

Example 2 - Redirect www.domain.com to domain.com

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^domain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]

5). Avoid the cheats
. A few months back, I actually heard these world: "I am going to throw some hidden text in my site for SEO." I almost died laughing. This may have worked 10 years ago, but not anymore. You will actually be punished for doing this. Just remember, if it seems to easy to work, it is. It will take a lot of work getting to the top of search engines. Just be patient.


Joomla 1.5 Database Functions

Posted by: twmeier

Tagged in: Programming , PHP , Joomla

Sometimes it may be hard to know how to best use Joomla's database class. Here are just a few of the most used database functions.

In Joomla 1.5, include the following line of code inside your php:

<?php
     $database  =& JFactory::getDBO();
?>

Use the $loadObject function when you want to retrieve one row from the database. For example:

$database->setQuery("SELECT * FROM jos_comprofiler WHERE id=125");
$userDetails = $database->loadObject();

You can now access the values as follows:

$userDetails->firstname
$userDetails->lastname
.....

If you want to retrieve more than one row from the database, use the loabObjectList() function. For example:

$database->setQuery("SELECT * FROM jos_comprofiler WHERE id<125");
$userDetails = $database->loadObjectList();

You will now have an array of objects. You can access the values as follows:

$userDetails[0]->firstname
$userDetails[0]->lastname
$userDetails[1]->firstname
$userDetails[1]->lastname
.....

If you want to retrieve a single value from the database, use the loadResult() function. For example:

$database->setQuery("SELECT COUNT(*) FROM jos_comprofiler");
$count= $database->loadResult();

You now have a regular php variable. In this case $count.

There are other Joomla database functions, but these three are the most common.


Changing a New Line to a Break

Posted by: twmeier

Tagged in: PHP

There is a great php function takes a variable and changes the  new lines (\n) into breaks (<br/>).

For example, a user submits a form on your website and used a textarea to submit a couple of paragraphs. You then retrieve this data from the database and echo it out in html. You will notice that it is now just one big paragraph.

To fix this problem, you the function: nl2br

Here is how you might use this:

<?php
     $paragraphs = nl2br($paragraphs);
     echo $paragraphs;
?>


How to Open a Link in a New Window.

Posted by: twmeier

Tagged in: HTML

Opening a link in a new window is very easy. A link in HTML looks like this:

<a href="someurl.com">Link Text</a>

To open the link in a new window add target="_blank":

<a href="someurl.com" target="_blank">Link Text</a>

If you are using a text editor to create you links, you will often times see the option to open the link in a new window.

XMLWriter in PHP

Posted by: gbluma

Tagged in: XML , Programming , PHP

Every now and then I find myself needing to export a set of objects to XML. I usually find a quick way to write a dumb function to do it, but this is usually not the most elegant solution and rarely does it scale up to handle more complex data structures. The other option is to serialize the data into xml, but usually these methods suffer from a large performance overhead and should only be used if you can tweak the serializer to work only the right pieces of data.

I have since added XMLWriter to my toolset. Which, oddly enough, is built right into PHP (as of version 5.1.2) and based on the widely popular libxml engine. I find it to be very quick, both in performance and in ease of programming. Best of all, the code makes more sense than any of any of my own homemade tools.

Here's an example where demonstrate how to export a list of products to xml:


<< Start < Prev 1 2 3 4 Next > End >>

Latest Blogs

Fix Bad Credit With These Helpful Tips
Feb 26th 2013 by: Administrator

Will iPhone Apps Run On iPad?
Jan 29th 2010 by: Trevor M.

How to create a marquee text for an iPhone app
Jan 21st 2010 by: Trevor M.

How to Submit Additional Images in Virtuemart
Aug 7th 2009 by: Trevor M.

Using an Image as a Submit Button in HTML
Jul 31st 2009 by: Trevor M.

Read all blogs