tag:blogger.com,1999:blog-11980882251128449832024-03-21T18:30:25.945-07:00Newcastle SEO Web, Software & Database DevelopmentWeb Development, SEO, Social Media, Software & Database DevelopmentAnonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.comBlogger59125tag:blogger.com,1999:blog-1198088225112844983.post-81682340170043747312013-04-26T23:51:00.003-07:002013-12-12T05:57:33.693-08:00Boosting Website Success with Web Design Newcastle<br />
<h2 style="text-align: center;">
<span lang="EN-US">Highly
recommended web development and Search Engine Optimization services</span></h2>
<div align="center" class="MsoNormal" style="text-align: center;">
<i><span lang="EN-US"><br /></span></i></div>
<div class="MsoNormal" style="text-align: justify;">
<span lang="EN-US">Online marketing has become the chosen form of advertising the
business. There are many helpful
resources that contribute to the website success which can be chosen from
professional and dependable sources. A
valid service provider would provide services that would focus on maximizing
business at an affordable price.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify;">
<span lang="EN-US">InCodeMedia, a web designing company aims
at providing high-grade web designing and search engine optimization services
that would enhance the visibility of the business to prospective customers
worldwide. The services offered by this
service provider range from web designing, web development, link building, web
hosting and social networking. Being
able to map the website to various sources on the internet would increase the
chances of the business to wade through the competition.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify;">
<span lang="EN-US"><br /></span></div>
<div class="MsoNormal" style="text-align: justify;">
<span lang="EN-US">InCodeMedia operates with a difference
than the rest of the web designing companies.
They provide all the services under roof by highly experienced
professionals. They even aim to educate
the customers in order to make them understand the effectiveness of web
development. Onsite and offsite SEO is
the specialty of the company. The varied
services are created to provide a platform for the business and reach out to
potential customers through the enhanced visibility online. The facilities provided by this web designing
company have been highly recommended by various sources. As a company with extensive experience in web
designing and development, they ensure to create a different outlook to the
website that would in line with the changing technology. All these helpful services are provided for
an affordable price which benefits the business to acquire helpful services
within the budget.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify;">
<span lang="EN-US"><br /></span></div>
<div class="MsoNormal" style="text-align: justify;">
<span lang="EN-US">InCodeMedia is a web designing and SEO
company based in Newcastle upon Tyne and catering to customers across the
UK. Their experience in web development
has enabled them to identify the need for better presentation of websites in
order to stay ahead of their competitors.
They provide value added services that would benefit any kind of
business. With over 10 years of
experience in web designing, InCodeMedia has been able to redesign many
websites to suit the changing needs.
Their services have been recognized to be qualitative and are also an
award winning company for their web designing services and search engine
optimization services.</span></div>
<div class="MsoNormal" style="text-align: justify;">
<span lang="EN-US"><br /></span></div>
<h2 style="text-align: center;">
<span lang="EN-US">For more information
on the services provided visit </span><span lang="EN-US"><a href="http://incodemedia.co.uk/">http://InCodeMedia.co.uk</a></span></h2>
<div class="MsoNormal" style="text-align: justify;">
<span lang="EN-US"><br /></span></div>
<div class="MsoNormal" style="text-align: justify;">
<span lang="EN-US">Email queries can be sent
to </span><a href="mailto:contactus@incodemedia.co.uk">contactus@incodemedia.co.uk</a></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;">
<b><span lang="EN-US">Follow InCodeMedia on:<o:p></o:p></span></b></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;">
<b><span lang="EN-US">Facebook- </span></b><span lang="EN-US"><a href="https://www.facebook.com/NewcastleWebDesign">https://www.facebook.com/NewcastleWebDesign</a></span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;">
<b><span lang="EN-US">Twitter-</span></b><span lang="EN-US"> <a href="https://twitter.com/NewcastleWebSEO">https://twitter.com/NewcastleWebSEO</a></span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify;">
<b><span lang="EN-US">LinkedIn-</span></b><span lang="EN-US"> <a href="http://www.linkedin.com/pub/newcastle-web-design/23/79b/248">http://www.linkedin.com/pub/newcastle-web-design/23/79b/248</a></span><b><span lang="EN-US"> </span></b><span lang="EN-US"><o:p></o:p></span></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<span lang="EN-US">-<b>30-<o:p></o:p></b></span></div>
<div class="MsoNormal">
<b><u><span lang="EN-US">Media Contact:<o:p></o:p></span></u></b></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm;">
<b><span lang="EN-US">InCodeMedia<o:p></o:p></span></b></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm;">
<b><span lang="EN-US">+44 0750 7341320<o:p></o:p></span></b></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm;">
<b><span lang="EN-US"><a href="http://incodemedia.co.uk/">http://incodemedia.co.uk/</a></span></b><b><span lang="EN-US" style="color: blue; mso-bidi-font-family: Calibri;"><o:p></o:p></span></b></div>
Anonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.com0Newcastle upon Tyne, Tyne and Wear, UK54.978252 -1.617780000000038954.8325375 -1.9405035000000388 55.123966499999995 -1.2950565000000389tag:blogger.com,1999:blog-1198088225112844983.post-84991528220174671752013-03-15T10:30:00.001-07:002013-03-15T10:30:27.145-07:007 Simple Rules to Success on Twitter<h2 style="text-align: center;">
7 Simple Rules to Success on Twitter</h2>
<br />
Unless you've been living under a rock, you have probably heard of Twitter. It is a rocking hot social networking site that seems to be to be used by almost everyone today. It's on the news, on the radio and on the minds of thousands of people everywhere, every single day.<br />
<br />
There are many different types of people on Twitter. But, most of these people are on Twitter for a single reason. They want people to know about them. They want to connect with people. Lots of people.<br />
<br />
Did you know that there are Twitter Rules for marketing and business success in what you do. I am a marketer and have been for many years. In the last few years my business has been expanding by leaps and bounds, because of social media and the internet. But, there are rules that all marketers must follow if they are going to have success in the marketplace, especially online.<br />
<br />
Here are the 7 Simple Rules to Success on Twitter:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg24q4E2YvGWOMl4JptV7VKIj1WxvMIVicyoODKI6ezXoL733yJmZDdNPlkuc4gnylqZzVFPAmxSvMe4TWn_wXmtxqEXMFElbGeYn1Zv27bGw3jM4HwO4K-viv2v_3-C2yoWGYZKmsbzIU/s1600/Twitter-for-Business-Ebook-cropped1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Get More followers" border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg24q4E2YvGWOMl4JptV7VKIj1WxvMIVicyoODKI6ezXoL733yJmZDdNPlkuc4gnylqZzVFPAmxSvMe4TWn_wXmtxqEXMFElbGeYn1Zv27bGw3jM4HwO4K-viv2v_3-C2yoWGYZKmsbzIU/s320/Twitter-for-Business-Ebook-cropped1.png" title="Web Development North Tyneside" width="295" /></a></div>
<br />
<br />
<br />
<b>1) The Rule of Visibility on Twitter.</b><br />
<br />
You absolutely MUST be visible on Twitter if you are going to get your message out to the masses. You must spend time on Twitter and get to know people. You must put yourself together a "Twitter Blueprint" and then work that bluprint every day. How many hours a day are you going to be seen on Twitter? How many people are you going to follow this week? How many times are you going to Tweet this week? How many direct replies will you make? All of these things make you "visible" on Twitter. Be seen and be heard. Be there on a daily basis.<br />
<br />
<b>2) The Rule of a Powerful Twitter Profile.</b><br />
<br />
Why would people want to get to know you on Twitter? One of the first things they will check out is your Twitter profile. What does it say, or better yet, what does it do? Does it make people curious and want to get to know you? Does it make them smile? Does it make them think? Does it make them see that you have value for their life and perhaps can help change it?<br />
Powerful Twitter profiles are NOT based on what is said in your profile, but on what your profile DOES. Does it direct them to DO something? Does it tell them you are a person they really need to get to know? Put yourself OUT THERE and tell the world why they need you as a friend, and get them to take some action towards YOU.<br />
<br />
<b>3) The Rule of Twittering.</b><br />
<br />
You MUST use Twitter to market or to share your message. Many people regard Twitter as a communication utility much like an email. It is not! Twitter is a method for you to build - MESSAGE BY MESSAGE - FOLLOW BY FOLLOW - PHOTO BY PHOTO - VIDEO BY VIDEO - your brand on Twitter. Every time something happens with you, Twitter about it. Don't just look at Twitter, get your messages out there and be seen. Answer the messages on Twitter. Thank people for sharing their Tweet with you. This will show up on their Twitter and even more people will see you. This will set you apart from most people on Twitter. Twitter is basically a billboard of what you and your friends are doing on Twitter. So use it often and use it wisely. Don't forget that everyone is watching what you say.<br />
<br />
<b>4) The Rule of Twitter Networking.</b><br />
<br />
You are part of a Twitter and you have access to that huge network of people to become their friend and business partner. You can live anywhere and have access to this huge audience. There are literally thousands of people on Twitter that you could potentially meet and then get to know and connect with. You can find local Twitterers as well. You will find that Twitter is a gold mine of people to connect with and build trust with. This may lead to business down the road. So go Twitter now!<br />
<br />
<b>5) The Rule of Twitter Direct Messages.</b><br />
<br />
This can be an overlooked and rarely talked about Twitter tool. Direct messages are part of your "Twitter System." Go to Direct Messages in your sidebar. This is a list of people who are thinking about you, talking about you, including you and connecting with you. This is a goldmine of people that have proven that they are behind you and willing to make you a part of their Twitter experience. Pay attention to your Twitter messages. Thank them for their thoughts and let them know you appreciate it. Reply back to them whenever possible. The Direct Messages are gold and can be a prospecting Vault of valuable leads. Make sure you stay connected to them.<br />
<br />
<b>6) The Rule of Twitter Pictures and Videos.</b><br />
<br />
Sharing photos and videos on Twitter is HOT. People love photos and videos. The Tweets with photos and videos are the most looked at and watched Tweets on Twitter. Make some videos and upload them. Upload some photographs. Not only will they be seen, but they will also be Re-Tweeted many times. This means that you can pick out Tweets you like and share them with others. Now isn't that cool? It is called exposure! It allows you to post a photo or video that you like and then it sends it out for all of Twitter to see. It shares the image that you want and allows everyone to see a glimse into your personal life. It helps people see you as a real person and not just a website, so share some of your personal life on Twitter. Find interesting photos and videos of others and send them out as well. People love to look at pictures and watch videos. Use this to your advantage.It will build exposure for you.<br />
<br />
<b>7) The Rule of Twitter Search.</b><br />
<br />
When you do a Twitter search, it is going to bring you a list of people who have a lot in common with you. Just go to search.Twitter.com and type in what you are searching for. You'll find a lot of other Twitterers who are Tweeting about what interests you. You can build a list in your own area of expertise and then you can send Twitter direct messages to them. Make sure they are messages of value and interest. Show them that you are an expert in this field. This gives you huge exposure. Whatever you do, like posting a message, uploading a video or photo, writing and publishing an article, or just commenting on another person's message on the Twitter, it will show up on Twitter. Be seen, and be seen often if you are trying to brand yourself on Twitter.<br />
<br />
You need to establish relationships and build a community to market to. But, if you are going to market on Twitter, then you need to at least get a blueprint of how and when to do it. The 7 Rules of Twitter hopefully gave you some ideas in your social media marketing. Please let me know what you think and what ideas you have.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmJheIAed-mQcHjhgE47qN265z2LkbGbfCJsk6YEnlbzp4a4jrjzrgN8HcxNVa9bLtbfXJSDNaRUfPbyZhUhYqFIPEuGS9o_QQVPfRNQam3C2p6wyOtGLPplAo2-9K9VCRKPobGL_PcaE/s1600/images.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Twitter Followers" border="0" height="152" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmJheIAed-mQcHjhgE47qN265z2LkbGbfCJsk6YEnlbzp4a4jrjzrgN8HcxNVa9bLtbfXJSDNaRUfPbyZhUhYqFIPEuGS9o_QQVPfRNQam3C2p6wyOtGLPplAo2-9K9VCRKPobGL_PcaE/s400/images.jpg" title="Newcastle Web Design" width="400" /></a></div>
<br />
<br />
<h2>
<div style="text-align: center;">
3000 Twitter Followers</div>
<div style="text-align: center;">
Only £19.99</div>
</h2>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<div style="text-align: center;">
<input name="cmd" type="hidden" value="_s-xclick" />
<input name="hosted_button_id" type="hidden" value="VRLCJ3DT2TP22" />
<input alt="PayPal — The safer, easier way to pay online." border="0" name="submit" src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_buynowCC_LG.gif" type="image" />
</div>
<br /></form>
Anonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.com0Newcastle upon Tyne, Tyne and Wear, UK54.978252 -1.617780000000038954.8325375 -1.9405035000000388 55.123966499999995 -1.2950565000000389tag:blogger.com,1999:blog-1198088225112844983.post-2083689596252188952013-03-04T02:09:00.001-08:002013-03-04T02:09:38.915-08:00Buy Traffic To Your Site Now<div style="text-align: center;">
<h2>
<span style="font-size: x-large;">Increase Website Traffic, Hits & Qualified Prospects To Your Website Now!
</span></h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeTrZc-7Dubr2AdaYcMds7cIv5WsCQB_Hht_-AZgOUNAtxyLtoRaXPgm4ytYqwt0DOgXhFAbe3GlV4KndkSTnEEyV3VFLk7T-0OMx7pLinV02IjLZKj4YsgIgV8jFK64X8WYsVtHOKKRA/s1600/buy+traffic.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Targeted Traffic" border="0" height="135" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeTrZc-7Dubr2AdaYcMds7cIv5WsCQB_Hht_-AZgOUNAtxyLtoRaXPgm4ytYqwt0DOgXhFAbe3GlV4KndkSTnEEyV3VFLk7T-0OMx7pLinV02IjLZKj4YsgIgV8jFK64X8WYsVtHOKKRA/s400/buy+traffic.jpg" title="Buy Traffic To Your Site" width="400" /></a></div>
<div>
<span style="font-size: x-large;"><br /></span></div>
</div>
<br />
Traffic plays a great role for any kind of website and especially, if the website is related to any kind of business that is online. There is no doubt that sometime an attractive website gets lesser traffic because of any reason, but that doesn’t mean that the administrator cannot increase traffic towards the website. Actually, it is possible and very easy. Targeted traffic helps attract the traffic towards a website and converts that traffic into loyal customers. This is the actual purpose to buy targeted traffic and the majority of people go for it only because of this reason.<br />
<br />
Some people think that the targeted traffic only helps in attracting the traffic towards a new website, but other than this, a lot of other advantages targeted traffic offers and that are probably not known to the majority of the people. There is a unique advantage and that is probably targeted traffic helps increasing the traffic towards a website, and when this happens, the website becomes famous or known amongst the people.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhG5oJo1dB2X4_W6cOxjZPim90HMLMl1kbe_e5_brqLKZ5W4SHZo1fazmjVqhhyV0ObJOmmARv8h0rbDs1ojT2KAMDS6LE7WcWm1hg4c7KfiZ98penqecAzqWzZTS5A1Tgw3UEIVO0w-5o/s1600/paidtraffic.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Buy Targeted Traffic now" border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhG5oJo1dB2X4_W6cOxjZPim90HMLMl1kbe_e5_brqLKZ5W4SHZo1fazmjVqhhyV0ObJOmmARv8h0rbDs1ojT2KAMDS6LE7WcWm1hg4c7KfiZ98penqecAzqWzZTS5A1Tgw3UEIVO0w-5o/s400/paidtraffic.jpg" title="Online Traffic Free" width="400" /></a></div>
<br />
<br />
Visitors we provide are very responsive and stay for LONG to see/read your website's content and your offers<br />
<br />
Certain Features of our traffic:<br />
<br />
<br />
<ul>
<li>Traffic is 100% Adsense and Yahoo safe</li>
<li>Helps in improving your alexa rank</li>
<li>Visitors stay for long on your website to see what you are offering them</li>
<li>Visitors will be coming from many different sources.</li>
<li>Only legal clicks will count. This mean your ad is fully safe</li>
</ul>
<br />
<br />
<br />
<br />
<br />
<div style="text-align: center;">
<span style="font-size: x-large;"> 1,000 Guaranteed Visitors </span><br />
<span style="color: red; font-size: x-large;">Only £19.99</span></div>
<div style="text-align: center;">
<span style="font-size: x-large;"><br /></span></div>
<br />
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<div style="text-align: center;">
<input name="cmd" type="hidden" value="_s-xclick" />
<input name="hosted_button_id" type="hidden" value="MV4VS67JN9R32" />
<input alt="PayPal — The safer, easier way to pay online." border="0" name="submit" src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_buynowCC_LG.gif" type="image" />
<img alt="" border="0" height="1" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" />
</div>
</form>
<div style="text-align: center;">
<b>Allow up to 7 days for delivery</b></div>
<br />
Once received the payment,we will start your campaign right away .<br />
<br />
Note: The website must not contain pornographic, racist, discriminating, vulgar, illegal, or other adult materials of any kind.Anonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.com0Newcastle upon Tyne, Tyne and Wear, UK54.978252 -1.617780000000038954.8325375 -1.9405035000000388 55.123966499999995 -1.2950565000000389tag:blogger.com,1999:blog-1198088225112844983.post-2600787125846686882013-02-14T08:37:00.001-08:002013-02-14T08:38:14.333-08:00Newcastle Database Design And Development With a Custom Database in place, you'll wonder how you ever managed before. There are numerous off the shelf database systems available in the marketplace today to cater for a wide range of generic commercial applications, which usually provide a workable solution to meet around 80% of most businesses needs. But what do you do if you have specific requirements that are unique to your business and your business is being constrained by your database system?<br />
<br />
You can try to adjust your operational processes around the constraints of the database system, although this approach can be very dangerous and costly due to potential pitfalls of allowing software not specific to your business, dictating your business practices and procedures.<br />
<br />
<div style="text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhH2uK9N6jPdCAynTrjPZ_iyaohc47QvReeE-qecbTQkmVuwvIhnLDEhMNVsI8H32fJdTp5wjOBP8ZAXyppLKbgMRMOEy_K7_JMIAXetFM7znujQvvEsEY-bQVN7HgUS5X3C7I-viyv-vo/s1600/Database-Design.jpg" imageanchor="1"><img alt="Developed Database Tyne and Wear" border="0" height="177" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhH2uK9N6jPdCAynTrjPZ_iyaohc47QvReeE-qecbTQkmVuwvIhnLDEhMNVsI8H32fJdTp5wjOBP8ZAXyppLKbgMRMOEy_K7_JMIAXetFM7znujQvvEsEY-bQVN7HgUS5X3C7I-viyv-vo/s400/Database-Design.jpg" title="Newcastle upon Tyne Database Design" width="400" /></a> </div>
<br />
Alternatively, I can consult with you to determine your exact needs and then design and develop a completely customised database system for your Newcastle based business.
As an experienced database developer, I specialise in designing business focused, user friendly and affordable custom database systems to meet your exact requirements.<br />
<br />
I will work closely with your business to ensure we gain a thorough understanding of how you operate, and then translate this information to enable us to design and develop a custom database system which streamlines your daily tasks and improves the way your business operates.
The end result will be a very powerful business tool that will empower your business to operate more efficiently and enable your business to grow at the rate you wish to, supported by your bespoke database system, rather than constrained by it.Anonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.com0tag:blogger.com,1999:blog-1198088225112844983.post-30855296454030229782013-02-14T03:34:00.002-08:002013-02-14T03:35:09.452-08:00Search Engine Optimisation Newcastle upon Tyne<h2 style="text-align: center;">
Websites need search engine optimization. </h2>
<div style="text-align: left;">
Your business website is only effective if it appears in the first few search engine result pages when a potential customer is looking for your products or services. Many business websites fail to perform well in search engines because their pages have not been optimized thoroughly with the right keywords, accurate descriptions, ample text and properly formatted meta-tags.</div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: center;">
<iframe allowfullscreen="" frameborder="0" height="400" src="http://www.youtube.com/embed/-2F0yYOPl6Q" width="520"></iframe></div>
<br />
We make SEO affordable.<br />
We know that businesses cannot always afford high expenses, so we keep our prices low. By offering our customers affordable rates, we provide the means for any business to succeed online.<br />
<br />
Other SEO Companies charge thousands of dollars to optimize your entire website, but we concentrate on generating traffic and only optimize additional pages if requested.<br />
<br />
The best prices in the industry!<br />
With our basic package, your website is carefully analyzed and its code adjusted to get the best results. We utilize innovative tools to measure the quality of optimization prior to releasing your site for search engine and directory submission.Anonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.com0tag:blogger.com,1999:blog-1198088225112844983.post-2486108185734422302013-02-12T01:15:00.003-08:002013-02-12T01:15:43.848-08:00How To Get Facebook Likes<h2 style="text-align: center;">
Some tips of how to get more Facebook likes.</h2>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<ol><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhehHbH_E_6ikiA_ZpIDN2ZnyBuw7tQ5PmtpwsLp0J587_PgTvoDocOWuGPTEGjoL6DC23cha7hwfx790_NazxA0WDKl4fi5P88p63LUJSvAShdT84ABmkYqTek__PRQZGh-qXJ6wxk29g/s1600/FacebookFanspage.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhehHbH_E_6ikiA_ZpIDN2ZnyBuw7tQ5PmtpwsLp0J587_PgTvoDocOWuGPTEGjoL6DC23cha7hwfx790_NazxA0WDKl4fi5P88p63LUJSvAShdT84ABmkYqTek__PRQZGh-qXJ6wxk29g/s1600/FacebookFanspage.jpg" /></a>
<li>Ask the right questions. Focus on the WHY. Why should your audience like, you? Why should they give a rip about anything you say, do, tweet, post or sing? Give them a reason to take action.<br /></li>
<li>Have a plan. This post is not designed to give you a template for a plan. Bottom line you need a business strategy inclusive of a social media strategy and plan. You need goals, objectives and a plan to get there.<br /></li>
<li>Know your audience. Bottom line if you don’t know your audience you won’t know how to inspire them to connect with you, let alone click, like, comment or share. Get in their heads as deep as you can. Know what they like to eat, drink. Know where they hang out. What do they talk about ? Where do they go for work, lunch, fun, dancing, talking, laughing, crying, and support? Where do they share their photos? Where do they talk about business? Talk about family? Talk about the services they like, need and want? The more you can know about them the better you can inspire them to connect with you and your brand. Download our audience analysis worksheet to help you get started on this step.<br /></li>
<li>Polish up your social brand & know who you are. Develop your social brand in support of your corporate or overall personal brand. Everything you say and do online should be a positive reinforcement of your brand promise. Check out these three articles for tips on developing your Facebook and social brand: 15 Must Know Tips to Rock Your Facebook Timeline Business Page, 10 Easy Ways to Rock Your Brand on Facebook, 20 Tips to Build a Brand that is a Sweet Orange in a World of Bitter Apples.<br /></li>
<li>Develop a content plan. You must offer relevant content and conversation that will not only inspire but engage your audience. You must inspire them to take action. They are not going to do it without such. Remember, they are asking themselves how they can get rid of the spam and over hyped Facebook posts while you are figuring out how you can get more of the same in their face. Download our Content Inventory worksheet to help you get a grip and organize your content so you can begin by maximizing what you got and know what content you need to develop or enhance.<br /></li>
<li>It’s what happens after the Facebook like that matters most. Focus on providing value both before and after the like! Check out this article: What Happens After the Facebook Like? 20 Tips To Engage Your Audience After the Like!<br /></li>
<li>Give without expecting anything in return. Ask not what your fans, followers, friends can do for you but what you can do for them. Focus on providing the highest value possible.<br /></li>
<li>Earn their trust. Your first goal should be to earn their trust. The quicker you earn their trust, the better and quicker you can inspire them to connect with you and your brand. Clicking, liking and following should not be a deep thought for them. They should be so engaged in your brand that clicking is natural because they have no reason not to trust you.<br /></li>
<li>Don’t be afraid of the data and insights. Most businesses we work with have never spent more than five minutes looking at their Facebook or YouTube analytics. As I always say “there is gold in them there analytics!” Dig into all the free data and insights available on the social networks. With a little digging you can find data that will help you make the right decisions to do better in the coming year.<br /></li>
<li>Don’t get caught up in the social buzz hype. Don’t get caught up in measuring only the social buzz metrics. You must focus on the right metrics so you can measure real results. Bottom line you need to set measurable goals and objectives and you need to measure them. Goals are nothing without a plan to achieve them and proof you did such!<br /></li>
<li>Don’t forget the fans you already have! The biggest mistake we see brands make is focusing only on numbers and growing their community. A large community should not be your top goal. Instead you should focus on how you can offer the most value to your community. If you focus on value and the fans you already have as a top priority you’ll be amazed how your community will grow and how your results can be more easily monetized. Show those who have already liked your Facebook page or followed you on Twitter that you appreciate them. Offer them insight, knowledge, conversation and data that brings value to their life and business.<br /></li>
<li>Inspire – connect – achieve. Focus on the goals of your audience first. Inspire your audiences to connect with you with a goal of helping them achieve their objectives. If you help them achieve their goals and objectives, you will achieve yours organically. Trust me, this works!</li>
</ol>
<div>
<br /></div>
<div style="text-align: center;">
<span style="font-size: x-large;">OR</span></div>
<div style="text-align: center;">
<span style="font-size: x-large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi01dkdPXbUdO7lXRot_W1bDLGA061daLQouJTI1P7qjg4uALCAqF-IrwzvjaxQHARpjpMTMF0kLCb_X_-0S6XpByFwT6pKdlUpZ0Lv2SmbPve4nsNw84z0Fg76YGlgDDgjAvSk5iiURHM/s1600/buyFacebookLikes.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi01dkdPXbUdO7lXRot_W1bDLGA061daLQouJTI1P7qjg4uALCAqF-IrwzvjaxQHARpjpMTMF0kLCb_X_-0S6XpByFwT6pKdlUpZ0Lv2SmbPve4nsNw84z0Fg76YGlgDDgjAvSk5iiURHM/s320/buyFacebookLikes.jpg" width="320" /></a></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-size: x-large;">1000 Likes</span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-size: x-large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-size: x-large;">Only £19.99</span><br /><span style="font-size: x-small;">(Allow 7 Days to Process Order)</span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-size: x-large;">
</span></div>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<div style="text-align: center;">
<span style="font-size: x-large;"><input name="cmd" type="hidden" value="_s-xclick" />
<input name="hosted_button_id" type="hidden" value="XSLYYSDPWN2D2" />
<input alt="PayPal — The safer, easier way to pay online." border="0" name="submit" src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_buynowCC_LG.gif" type="image" />
<img alt="" border="0" height="1" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" />
</span></div>
</form>
Anonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.com0tag:blogger.com,1999:blog-1198088225112844983.post-75514307070835613512013-02-09T08:41:00.000-08:002013-02-09T08:41:05.387-08:00Newcastle upon Tyne Web Design & SEO<br />
SEO is an abbreviation of Search Engine Optimization. This is the process of structuring a web page so that it is found, read, and indexed by search engines in the most effective manner possible.<br />
<br />
This makes your web site and its content attractive, relevant and visible to search engines and web searchers.<br />
Why is this important? Consider what it would be like if no one could easily find your place of business, or even your telephone number. Most businesses could not continue for long in such a situation.<br />
<br />
The same thing can happen with your web site if people cannot easily locate it. Traffic volume, if it existed at all, slows to a crawl. Potentially valuable customers never even know you are there.<br />
"Wait!" you say. "I had a web site created, and the address is included in all of our advertising. Why wouldn't people be able to find it?"<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhddeXtBF2gkVRR5TZaO3FL1x3uCocLckC7ISRujuKgiDDqE00OYj9SNpfsTw43YnEvAXGnG394vFi50ld9S0Q9d3OfpIZGL2epT_i_bbx6K8h5B9yWjjmALjq_nU675FeavYj_boW8urI/s1600/newcastle-seo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Newcastle Webdesign" border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhddeXtBF2gkVRR5TZaO3FL1x3uCocLckC7ISRujuKgiDDqE00OYj9SNpfsTw43YnEvAXGnG394vFi50ld9S0Q9d3OfpIZGL2epT_i_bbx6K8h5B9yWjjmALjq_nU675FeavYj_boW8urI/s400/newcastle-seo.png" title="Tyneside SEO" width="368" /></a></div>
<br />
<br />
Certainly, existing customers or those who are already familiar with your company should be able to find your site without any great difficulty, but this may not be the case.<br />
Can you be sure that every potential customer has been reached by your advertising? What about the people who don't read the magazines or newspapers where you chose to place advertisements?<br />
<br />
Did they hear the right radio station?<br />
Did they watch the right television show?<br />
Did they get one of the thousands of brochures you mailed?<br />
<br />
So, what about the search engines? Those people could just enter a few words into a text box, click a button, and voila! There is a link to your web site. Aren't search engines wonderful?<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBRSXDH05-_btEjCx7nypDEvWAk6-n5KSoCan6OBuk982q1zDFy0DviMmh9I-BPs13goCyG4IBFbWOb1cd5z7qwUmqRt3cA8TcSuL9OieHQzSpOBLoSkuZzh1N6Up38O-G3xG2Mnh83_0/s1600/newcastle-webdesign.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Tyneside Webdesign" border="0" height="366" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBRSXDH05-_btEjCx7nypDEvWAk6-n5KSoCan6OBuk982q1zDFy0DviMmh9I-BPs13goCyG4IBFbWOb1cd5z7qwUmqRt3cA8TcSuL9OieHQzSpOBLoSkuZzh1N6Up38O-G3xG2Mnh83_0/s400/newcastle-webdesign.jpg" title="SEO Newcastle" width="400" /></a></div>
<br />
<br />
Yes, search engines can be wonderful, and the scenario above can happen, but not without some work. This is where Newcastle Website Design and SEO comes in.<br />
<br />
Anonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.com1tag:blogger.com,1999:blog-1198088225112844983.post-73764932077076373332013-02-08T02:11:00.001-08:002013-02-08T02:11:08.716-08:00Done For You Internet Marketing Services<h1 style="text-align: center;">
Done For You Internet Marketing Services</h1>
Do you have a business website that get’s barely any visits and no sales? This might be because you don’t have the time or the desire to do your Online Marketing yourself…<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiE23ONAkGj8gdfDgoSJpHIV6GGSeOD8JWcWlYcK4D9ih3t2_aC35KaYoMrU2Awna1BMAZUdyfDc4HxDJd99WwigxfQj4rCbFpvnXawvib-XQbJvdXH8kc-DCrufWTjdjIoBMZbC78QNlU/s1600/seo-Newcastle.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Social Media Tyneside" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiE23ONAkGj8gdfDgoSJpHIV6GGSeOD8JWcWlYcK4D9ih3t2_aC35KaYoMrU2Awna1BMAZUdyfDc4HxDJd99WwigxfQj4rCbFpvnXawvib-XQbJvdXH8kc-DCrufWTjdjIoBMZbC78QNlU/s1600/seo-Newcastle.jpg" title="Link building seo newcastle upon tyne" /></a></div>
<br />
<br />
But you probably still want all the benefits and results online marketing can provide you, right? Well then here’s some good news, I can help you…<br />
<br />
If you want to take your online business to the next level, then work 1 on 1 with me. I'll help you map out your plan and give you all the advice you need to execute your plan successfully.<br />
<br />
<br />
We can save you the many hours it requires to build your internet empire<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYhqslX79VKA8vdSb56v6UZocqHYJGA3EsWQgQwU6TzwNOKIq5tcmdmIxwdz1YsiR68NWZqTU465dc6lBv41BQJ_a5JN1f0UkMhWMPoDWkEMnLHqc2VPYokZkf-9QtHcYxtdT5HCPytj8/s1600/tynesideSEO.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Seo newcastle based developer" border="0" height="312" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYhqslX79VKA8vdSb56v6UZocqHYJGA3EsWQgQwU6TzwNOKIq5tcmdmIxwdz1YsiR68NWZqTU465dc6lBv41BQJ_a5JN1f0UkMhWMPoDWkEMnLHqc2VPYokZkf-9QtHcYxtdT5HCPytj8/s320/tynesideSEO.jpg" title="Tyneside Internet SEO Services" width="320" /></a></div>
<br />
<br />
<br />
<div style="text-align: center;">
Below is a list of the done-for-you internet marketing services which I provide…</div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: center;">
Just <a href="http://javaphpmysql.blogspot.co.uk/2013/02/do-you-need-website-seo-facebook-or.html">CLICK HERE</a> to find out more.</div>
<br />
<br />Anonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.com0tag:blogger.com,1999:blog-1198088225112844983.post-826694705694188892013-02-05T15:42:00.004-08:002013-03-11T03:42:58.287-07:00DO YOU NEED WEBSITE, SEO, FACEBOOK OR TWITTER HELP<h2 style="text-align: center;">
DO YOU NEED WEBSITE, SEO, FACEBOOK, TWITTER OR LINKEDIN HELP OR ADVICE.</h2>
<div>
<br /></div>
<div>
Do you have a website, but not enough traffic? Is poor online visibility affecting the growth of your business? Maybe you have already used several internet marketing techniques only to discover how futile they are. </div>
<div>
<br /></div>
<div>
Now, you can use our internet marketing services and improve your company's search engine ranking in a quick turnaround time. </div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjonUs2PeYgTWO6PxBry_wkvu95eUBR3sLGji5saUwpvZ-z5UoYZwaUxhz8XQb4tOTRdBeVMXqvVM9yXx4sXQcI07zInUVa2bmwykUbEG7W-Fhuz5nPaLbTKhQACHsCC0mjQIUrJyQZdUs/s1600/Seo-Creative2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Google Ranking Increase" border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjonUs2PeYgTWO6PxBry_wkvu95eUBR3sLGji5saUwpvZ-z5UoYZwaUxhz8XQb4tOTRdBeVMXqvVM9yXx4sXQcI07zInUVa2bmwykUbEG7W-Fhuz5nPaLbTKhQACHsCC0mjQIUrJyQZdUs/s400/Seo-Creative2.jpg" title="Web Site Development" width="400" /></a></div>
<div>
<br /></div>
<div>
<b>WHO AM I </b><br />
<br /></div>
<div>
I have been working in IT roles near on 25 years and currently live in Annitsford North Tyneside which is approx 15 minutes north of Newcastle upon Tyne, and have worked in internet marketing and web development for the last 6-7 years and have developed many sites, from eCommerce to CMS(Content Management Systems) and all in between, I am now looking to add to a growing client list, the services on offer include.</div>
<div>
<br />
<b>WHAT I CAN OFFER</b></div>
<div>
<ul>
<li>Full Web Design including hosting ( small site to full eCommerce )</li>
<li>IT & Web Consultation</li>
<li>IT & Web Training</li>
<li>Brochure Websites</li>
<li>Blogs</li>
<li>Galleries</li>
<li>Ecommerce stores</li>
<li>Website maintenance</li>
<li>Mobile phone web development</li>
<li>Email newsletters</li>
<li>Email lists of clients in your industry or area </li>
<li>SEO - Keyword research and on site SEO optimization.</li>
<li>SEO - Link building strategies to improve search engine rankings. </li>
<li>Facebook marketing and likes.</li>
<li>Twitter followers and marketing strategies</li>
<li>YouTube marketing strategies. </li>
<li>Email list building and development.</li>
<li>Web development, PHP and MySQL</li>
<li>Facebook likes ( <a href="http://javaphpmysql.blogspot.co.uk/2013/02/how-to-get-facebook-likes.html">CLICK HERE</a> )</li>
<li>Twitter follows</li>
<li>Google + votes</li>
<li>YouTube Views</li>
<li>Buy Targeted Traffic ( <a href="http://javaphpmysql.blogspot.co.uk/2013/03/buy-traffic-to-your-site-now.html">CLICK HERE</a> )</li>
</ul>
<ul>
<li>Database Design and Development - Oracle PLSQL and MySQL</li>
<li>Java development J2EE, J2SE</li>
<li>PHP code development</li>
<li>VB</li>
<li>C</li>
<li>HTML</li>
<li>JavaScript</li>
</ul>
</div>
<div>
<br /></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPho467DdJSg51vdPHCgJVxDFwY32eNpWhyphenhyphenOtUtlAq-wmxj5BwwxKMvk7Do6zvnSNhld9os9tGqiGwMtZvzrhVwAGz21Q5xP4Xjq7I4ZoDi5L1YQsn_KPeAUiBKI-AkylqKVJA9OxLidM/s1600/social-networks-V2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Social Media Help" border="0" height="292" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPho467DdJSg51vdPHCgJVxDFwY32eNpWhyphenhyphenOtUtlAq-wmxj5BwwxKMvk7Do6zvnSNhld9os9tGqiGwMtZvzrhVwAGz21Q5xP4Xjq7I4ZoDi5L1YQsn_KPeAUiBKI-AkylqKVJA9OxLidM/s400/social-networks-V2.jpg" title="SEO Advice" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
CHARITY AND NON PROFIT ORGANIZATIONS OUR SERVICES ARE FREE</div>
<div style="text-align: center;">
( TIME PERMITTING )</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-size: large;"><b><a href="mailto:judosales@live.co.uk">CONTACT ME NOW FOR A QUOTE</a></b></span></div>
Anonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.com0Newcastle upon Tyne, Tyne and Wear, UK54.978252 -1.617780000000038954.8325375 -1.9405035000000388 55.123966499999995 -1.2950565000000389tag:blogger.com,1999:blog-1198088225112844983.post-46432178972362881832013-01-21T14:25:00.004-08:002013-01-21T14:25:46.006-08:00PHP Multidimensional and Associative Arrays Example <h2 style="text-align: center;">
PHP Multidimensional and Associative Arrays Example </h2>
<div>
<br /></div>
<div>
<div>
An array is a data structure that stores one or more similar type of values in a single value. For example if you want to store 100 numbers then instead of defining 100 variables its easy to define an array of 100 length.</div>
<div>
<br /></div>
<div>
There are three different kind of arrays and each array value is accessed using an ID which is called array index.</div>
<div>
<br /></div>
<div>
<ul>
<li><b>Numeric array</b> - An array with a numeric index. Values are stored and accessed in linear fashion</li>
<li><b>Associative array</b> - An array with strings as index. This stores element values in association with key values rather than in a strict linear index order.</li>
<li><b>Multidimensional array</b> - An array containing one or more arrays and values are accessed using multiple indices</li>
</ul>
</div>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5clpiLPyreJyhEsIdjCFpROxGIAZDDh-neS_KLZXFyjWwKark_cqebz7Vw77VN9upByCk11umwmWJKe4e2A169QjlU-j3KMtby_XXZLmV_c7RHf_PeEs4-zQaQKik2xZ5jK4NCzD4qZA/s1600/array.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Array" border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5clpiLPyreJyhEsIdjCFpROxGIAZDDh-neS_KLZXFyjWwKark_cqebz7Vw77VN9upByCk11umwmWJKe4e2A169QjlU-j3KMtby_XXZLmV_c7RHf_PeEs4-zQaQKik2xZ5jK4NCzD4qZA/s400/array.gif" title="Multidimensional" width="400" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
---------------------CODE------------------</div>
<div>
<br /></div>
<div>
<div>
<?php</div>
<div>
<br /></div>
<div>
<b>// SIMPLE ARRAY OF CUSTOMERS NAMES</b></div>
<div>
$customers=array('Mark James','Paul Dodds','Sam Wilson','George Bush');</div>
<div>
<br /></div>
<div>
<b>// LOOP THROUGH THE NAME TO SHOW CONTENTS OF ARRAY</b></div>
<div>
for($x=0; $x<count($customers); $x++)</div>
<div>
echo($customers[$x]."<br>");</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<b>// Associative Array </b></div>
<div>
// The array associates a number to a element of the array, in this case we associate quantity of a product</div>
<div>
<br /></div>
<div>
$products=array('Shoes'=>300,'nails'=>200,'corn flakes'=>500);</div>
<div>
<br /></div>
<div>
<b>//Displays how many pairs of shoes are left in stock</b></div>
<div>
echo('<br><br>Pairs of shoes left in stock : '.$products['Shoes']); </div>
<div>
<br /></div>
<div>
<b>//Multidimensional array</b></div>
<div>
<br /></div>
<div>
$instock=array('cars'=>array('Ford','Vauxhall','VW'),</div>
<div>
'motorcycles'=>array('Suzuki','Yamaha','Honda'.'<br>'));</div>
<div>
<br /></div>
<div>
echo("<br><br>"); </div>
<div>
<br /></div>
<div>
<b>// Display all cars in stock via looping through multidimensional array</b></div>
<div>
echo('Cars in Stock : ');</div>
<div>
for($x=0; $x<count($instock); $x++) </div>
<div>
echo($instock['cars'][$x].', ');</div>
<div>
<br /></div>
<div>
<b>// Display all cars in stock via looping through multidimensional array</b>
</div>
<div>
echo("<br><br>"); </div>
<div>
</div>
<div>
echo('Motorcycles in Stock : ');</div>
<div>
for($x=0; $x<count($instock); $x++) </div>
<div>
echo($instock['motorcycles'][$x].', ');</div>
<div>
<br /></div>
<div>
?></div>
</div>
<div>
<br /></div>
<div>
-----------OUTPUT----</div>
<div>
<br /></div>
<div>
Mark James<br />Paul Dodds<br />Sam Wilson<br />George Bush<br /><br /><br />Pairs of shoes left in stock : 300<br /><br />Cars in Stock : Ford, Vauxhall,<br /><br />Motorcycles in Stock : Suzuki, Yamaha,
</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.com0tag:blogger.com,1999:blog-1198088225112844983.post-53473748961125847092013-01-14T14:56:00.000-08:002013-01-14T14:59:36.523-08:00Java Very Simple Sever / Client Example <h2 style="text-align: center;">
Java Very Simple Sever / Client Example</h2>
<div>
Some basic code to demonstrate the client/sever link up, this code can be simply modified in to a simple chat room application.<br />
<br /></div>
<div style="text-align: center;">
<iframe allowfullscreen="allowfullscreen" frameborder="0" height="315" src="http://www.youtube.com/embed/gqpXDtW_5W4" width="420"></iframe>
</div>
<div>
<br /></div>
<div>
<div style="text-align: center;">
<br /></div>
</div>
<div>
<br /></div>
<h3>
<span style="font-weight: normal;">SERVER.java</span></h3>
<div>
<br /></div>
<div>
<div>
import java.io.DataOutput;</div>
<div>
import java.io.InputStreamReader;</div>
<div>
import java.io.DataOutputStream;</div>
<div>
import java.io.BufferedReader;</div>
<div>
import java.net.ServerSocket;</div>
<div>
import java.net.Socket;</div>
<div>
<br /></div>
<div>
class server</div>
<div>
{</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main(String args[]) throws Exception</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>{</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>String clientSentence;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>String capitalizedSentence;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>ServerSocket welcome = new ServerSocket(6789);</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>while(true)</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>{</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Socket connectionSocket = welcome.accept();</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>BufferedReader inFromClient =</div>
<div>
new BufferedReader(new InputStreamReader(connectionSocket.getInputStream()));</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>DataOutputStream outToClient = new DataOutputStream(connectionSocket.getOutputStream());</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>clientSentence = inFromClient.readLine();</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Received : "+clientSentence);</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>capitalizedSentence=clientSentence.toUpperCase()+"\n";</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>outToClient.writeBytes(capitalizedSentence);<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div>
}</div>
</div>
<div>
<br /></div>
<div>
<br /></div>
<h3>
<span style="font-weight: normal;">CLIENT.java</span></h3>
<div>
<span style="font-weight: normal;"><br /></span></div>
<div>
<div>
import java.io.DataOutput;</div>
<div>
import java.io.InputStreamReader;</div>
<div>
import java.io.DataOutputStream;</div>
<div>
import java.io.BufferedReader;</div>
<div>
import java.net.ServerSocket;</div>
<div>
import java.net.Socket;</div>
<div>
<br /></div>
<div>
class client</div>
<div>
{</div>
<div>
public static void main(String argv[]) throws Exception</div>
<div>
{</div>
<div>
String sentence;</div>
<div>
String modifiedSentence;</div>
<div>
</div>
<div>
BufferedReader inFromUser = new BufferedReader( new InputStreamReader(System.in));</div>
<div>
Socket clientSocket = new Socket("localhost", 6789);<br />
<br /></div>
<div>
DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream());<br />
<br /></div>
<div>
BufferedReader inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));</div>
<div>
</div>
<div>
sentence = inFromUser.readLine();</div>
<div>
outToServer.writeBytes(sentence + '\n');</div>
<div>
modifiedSentence = inFromServer.readLine();</div>
<div>
</div>
<div>
System.out.println("FROM SERVER: " + modifiedSentence);</div>
<div>
clientSocket.close();</div>
<div>
}</div>
<div>
}</div>
</div>
Anonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.com0tag:blogger.com,1999:blog-1198088225112844983.post-9919281348244312992013-01-11T14:46:00.000-08:002013-01-11T14:53:42.518-08:00Java Serializable Simple Example <br />
<h2 style="text-align: center;">
Java Serializable Simple Example </h2>
<br />
Some basic code to demonstrate the power of serialization and deserialization of an object.<br />
<br />
Java provides a mechanism, called object serialization where an object can be represented as a sequence of bytes that includes the object's data as well as information about the object's type and the types of data stored in the object.<br />
<br />
After a serialized object has been written into a file, it can be read from the file and deserialized that is, the type information and bytes that represent the object and its data can be used to recreate the object in memory.<br />
<br />
<div style="text-align: center;">
<iframe allowfullscreen="allowfullscreen" frameborder="0" height="315" src="http://www.youtube.com/embed/MSH_YuH-a0o" width="480"></iframe>
</div>
<div style="text-align: center;">
<br /></div>
Most impressive is that the entire process is JVM independent, meaning an object can be serialized on one platform and deserialized on an entirely different platform.<br />
<br />
Classes <b>ObjectInputStream</b> and <b>ObjectOutputStream</b> are high-level streams that contain the methods for serializing and deserializing an object<br />
<br />
<h3>
start.java</h3>
<br />
class start<br />
{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main(String args[])<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>/<b>/CREATE INSTANCE OF CLASSES BELOW</b><br />
<span class="Apple-tab-span" style="font-weight: bold; white-space: pre;"> </span><b>//CUSTOMER CLASS - SOME SETTERS AND GETtERS TO ACCESS PRIVATE VARIABLE ARRAY</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>customer cust = new customer();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>seridemo seri = new seridemo();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>deseridemo deseri = new deseridemo();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>//POPULATE CUSTOMER CLASS ARRAY WITH SOME DATA</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>cust.setStuff("Jim","Jim@hotmail.com",0);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>cust.setStuff("Paul","Paul@hotmail.com",1);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>cust.setStuff("Jane","Jane@hotmail.com",2);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>cust.setStuff("Clair","Clair@hotmail.com",3);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>cust.setStuff("Andy","Andy@hotmail.com",4);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>//PASS THE CUST OBJECT TO A CLASS TO WRITE THE OBJECT TO FILE</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>seri.seridemox(cust);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>// CALL CLASS TO READ OBJECT FROM FILE </b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>for(int counter=0; counter<5; counter++)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.printf("NAME : %s --- ",deseri.readObj().getName(counter));<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.printf("EMAIL : %s\n",deseri.readObj().getEmail(counter));<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
}<br />
<br />
<br />
<br />
<br />
The <b>ObjectOutputStream</b> class is used to serialize an Object.<br />
<br />
When the program is done executing, a file named
customer.ser is created. The program does not generate any output, but study the code and try to determine what the program is doing.<br />
<br />
<h3>
seridemo.java</h3>
<br />
<br />
import java.io.FileOutputStream;<br />
import java.io.ObjectOutputStream;<br />
import java.io.IOException;<br />
<br />
class seridemo<br />
{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public void seridemox(customer x)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>try<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>FileOutputStream fileOut = new FileOutputStream("customer.ser");<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>ObjectOutputStream objOut = new ObjectOutputStream(fileOut);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>objOut.writeObject(x);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>objOut.close();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>fileOut.close();<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>catch(IOException i)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>i.printStackTrace();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
}<br />
<br />
<br />
<br />
<span style="background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 12px; text-align: justify;">The following </span>deseridemo.java <span style="background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 12px; text-align: justify;"> program deserializes the customer object created in the </span>
seridemo.java<span style="background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 12px; text-align: justify;"> program. </span><br />
<h3>
deseridemo.java</h3>
<br />
<br />
import java.io.FileInputStream;<br />
import java.io.ObjectInputStream;<br />
import java.io.IOException;<br />
<br />
<br />
class deseridemo<br />
{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public customer readObj()<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>customer cust = null;<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>try<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>FileInputStream fileIn = new FileInputStream("customer.ser");<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>ObjectInputStream objIn = new ObjectInputStream(fileIn);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>cust=(customer) objIn.readObject();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>fileIn.close();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>objIn.close();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>catch(IOException i)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>i.printStackTrace();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> }<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> catch(ClassNotFoundException c)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Employee class not found.");<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>c.printStackTrace();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return cust;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
}<br />
<br />
<h3>
customer.java</h3>
<br />
<br />
import java.io.Serializable;<br />
<br />
class customer implements Serializable<br />
{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>private String name[] = new String[5];<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>private String email[] = new String[5];<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public void setStuff(String newName, String newEmail, int pos)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>name[pos]=newName;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>email[pos]=newEmail;<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public String getName(int x)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return name[x];<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public String getEmail(int x)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return email[x];<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
}<br />
<br />
<br />
<br />Anonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.com0tag:blogger.com,1999:blog-1198088225112844983.post-12814258277134687702013-01-09T14:41:00.000-08:002013-01-09T14:41:05.452-08:00Basic Database Normalisation Example<h2 style="text-align: center;">
Basic Database Normalisation Example </h2>
<div style="text-align: left;">
This is a basic example aimed at beginner level for those who are interested in normalisation. In a relational database our aim is to have minimal <a href="http://en.wikipedia.org/wiki/Data_redundancy" target="_blank">redundancy</a>, this can be achieve through normalisation this usually means dividing the database in to several tables and then defining a relationship between then via a <a href="http://en.wikipedia.org/wiki/Unique_key" target="_blank">primary key</a> and a <a href="http://en.wikipedia.org/wiki/Foreign_key" target="_blank">foreign key</a>. The idea behind normalisation is to have one point were data can be deleted or modified in one table, then this is will propagate through the database.</div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: center;">
<iframe allowfullscreen="allowfullscreen" frameborder="0" height="315" src="http://www.youtube.com/embed/bwRV5Wf300I" width="420"></iframe></div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
There are several normal forms but we will focus on the first 3.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
</div>
<ul>
<li><b>1NF</b> (First Normal Form) - Each column would contain different data, a example would be if we had a customer table and the table had the field order_date twice, in 1NF we would need to remove this field.<br /></li>
<li><b>2NF</b> (Second Normal Form) - Attempts to reduce the amount of redundant data in a table by extracting it, placing it in new table(s) and creating relationships between those tables.<br /></li>
<li><b>3NF</b> (Third Normal Form) - No duplicate information is permitted. So, for example, if two tables both require a birthdate field, the birthdate information would be separated into a separate table, and the two other tables would then access the birthdate information via an index field in the birthdate table. Any change to a birthdate would automatically be reflect in all tables that link to the birthdate table.</li>
</ul>
<div>
There are other levels of normalisation such as (<b>BCNF</b> - Boyce Codd Normal Form or 3.5NF), <b>4NF</b> and <b>5NF</b>, these alter normal forms can make the database more complex by dividing th data into more and more tables.</div>
<div>
<br /></div>
<div>
A final note about this process of normalisation, the more tables we have the more joins are needed the more joins the more expensive in terms of disk performance.</div>
Anonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.com0tag:blogger.com,1999:blog-1198088225112844983.post-36230646148606241862013-01-08T15:05:00.000-08:002013-01-08T15:17:57.816-08:00MySQL Database INDEX Example Tutorial <h2 style="text-align: center;">
MySQL Database Index Example Tutorial </h2>
<br />
A database index is a data structure that improves the speed of operations in a table. Indexes can be created using one or more columns, providing the basis for both rapid random lookups and efficient ordering of access to records.<br />
<br />
While creating index it should be considered that what are the columns which will be used to make SQL queries and create one or more indexes on those columns.<br />
<br />
Practically, Indexes are also type of tables which keeps primary key or index field and a pointer to each record in to the actual table.<br />
<br />
The users cannot see the indexes, they are just used to speed up queries and will be used by Database Search Engine to locate records very fast.<br />
<br />
<b>INSERT</b> and<b> UPDATE</b> statements takes more time on tables having indexes where as <b>SELECT</b> statements become fast on those tables. The reason is that while doing insert or update, database need to inert or update index values as well.<br />
<br />
<br />
<div style="text-align: center;">
<iframe allowfullscreen="allowfullscreen" frameborder="0" height="315" src="http://www.youtube.com/embed/Wb7a57zFIWU" width="420"></iframe></div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
An example of a index </div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<b>CREATE INDEX</b> index_name <b>ON</b> table(column);</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
To see the index on the table</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<b>SHOW INDEX FROM</b> table;</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
To remove the index from the table.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<b>DROP INDEX</b> column <b>ON</b> table;</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
</div>
<ul>
<li><span style="background-color: white; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;">The primary key is implicitly indexed for both MyISAM and InnoDB</span>
</li>
<li><span style="background-color: white; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;">Indexes are created on per column basis</span></li>
<li><span style="background-color: white; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;">Indexes can slow down <b>INSERT</b>(s) and <b>UPDATE</b>(s)</span></li>
<li><span style="background-color: white; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;">Indexes increase performance on <b>ORDER BY</b> and <b>WHERE</b> clauses.</span></li>
</ul>
<br />
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<br /></div>
Anonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.com0tag:blogger.com,1999:blog-1198088225112844983.post-13369688484695934952013-01-07T14:50:00.000-08:002013-01-07T14:50:29.917-08:00MySQL Ordering and Math Functions<h2 style="text-align: center;">
MySQL Ordering and Math Functions</h2>
<br />
In this example we have a small table that needs to be sorted in order of the title.<br />
<br />
<b>SELECT</b> * <b>FROM</b> products;<br />
<br />
<br />
+--------+-----------------+----------+-------+<br />
| ProdID | title | quantity | price |<br />
+--------+-----------------+----------+-------+<br />
| 1 | Shoes | 21 | 4.99 |<br />
| 2 | Jackets | 34 | 16.99 |<br />
| 3 | Shampoo | 45 | 1.99 |<br />
| 4 | Windows Cleaner | 78 | 2.49 |<br />
| 5 | Car Magazine | 71 | 1.49 |<br />
| 6 | Eggs | 177 | 1.42 |<br />
| 7 | Tea bags | 237 | 1.29 |<br />
| 8 | Bread | 12 | 0.99 |<br />
+--------+-----------------+----------+-------+<br />
<br />
<br />
The query below sorted the title column in to alphabetical order.<br />
<br />
<b>SELECT</b> * <b>FROM</b> products <b>ORDER BY</b> products.title;
<br />
<br />
<br />
<br />
+--------+-----------------+----------<br />
| ProdID | title | quantity | price |<br />
+--------+-----------------+----------<br />
| 8 | Bread 12 | 0.99 |<br />
| 5 | Car Magazine 71 | 1.49 |<br />
| 6 | Eggs 177 | 1.42 |<br />
| 2 | Jackets 34 | 16.99 |<br />
| 3 | Shampoo 45 | 1.99 |<br />
| 1 | Shoes 21 | 4.99 |<br />
| 7 | Tea bags 237 | 1.29 |<br />
| 4 | Windows Cleaner | 78 | 2.49 |<br />
+--------+-----------------+----------<br />
<br />
If the same query was on the price column it would sort numerically, for example the below query will sort the price column is a descending order from highest price to lowest.<br />
<br />
<b>SELECT</b> * <b>FROM</b> products <b>ORDER BY</b> products.price <b>DESC</b>;<br />
<br />
<br />
<br />
+--------+-----------------+----------<br />
| ProdID | title | quantity | price |<br />
+--------+-----------------+----------<br />
| 2 | Jackets 34 | 16.99 |<br />
| 1 | Shoes 21 | 4.99 |<br />
| 4 | Windows Cleaner 78 | 2.49 |<br />
| 3 | Shampoo 45 | 1.99 |<br />
| 5 | Car Magazine 71 | 1.49 |<br />
| 6 | Eggs 177 | 1.42 |<br />
| 7 | Tea bags 237 | 1.29 |<br />
| 8 | Bread 12 | 0.99 |<br />
+--------+-----------------+---------<br />
<br />
<br />
Similarly you can use the <b>ASC</b> keyword instead of <b>DESC</b> if you need ascending order.<br />
<br />
<br />
Now although this is a very small table and is obvious how many rows we have, but some tables may have tens of thousands of rows of data, if for some reason we need to find of the number of rows in the table we could use.<br />
<br />
<b>SELECT</b> <b>COUNT</b>(*) <b>FROM</b> products;<br />
<br />
8<br />
<br />
Now we need to know the average cost of our products, we would use.<br />
<br />
<b>SELECT</b> <b>AVG</b> (price) <b>FROM</b> products;<br />
<br />
<br />
+------------+<br />
| AVG(price) |<br />
+------------+<br />
| 3.956250 |<br />
+------------+<br />
<br />
<br />
Now for some reason we need to find the total sell price of all what we have in stock, we could add all the rows together or we could use.<br />
<br />
<br />
<b>SELECT</b> <b>SUM</b>(price) <b>FROM</b> products;<br />
<br />
<br />
<br />
+------------+<br />
| SUM(price) |<br />
+------------+<br />
| 31.65 |<br />
+------------+<br />
<br />
From time to time you may need a random number generated, this can be done with the <b>RAND</b> function.<br />
<br />
<b>SELECT RAND</b>();<br />
<br />
<br />
+------------------------+<br />
| RAND() |<br />
+------------------------+<br />
| 0.19249551668064252 |<br />
+-------------------------+<br />
<br />
The above query give a random number from 0 to 1, if we need a larger random number we would use.<br />
<br />
<b>SELECT RAND</b>()*10;
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Anonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.com0tag:blogger.com,1999:blog-1198088225112844983.post-22880342744991755602013-01-05T14:58:00.000-08:002013-01-05T14:58:04.122-08:00MySQL Trigger Example Part 2<br />
<h2 style="text-align: center;">
MySQL Trigger Example Part 2</h2>
<br />
We need a database that records customers, products and the orders taken by a online store, we will have name and contact details in customers table, in the products table we need to know the title of the product, quantity in stock and the price of the product. A orders table will will record who purchased the product and when.<br />
<br />
<br />
<br />
<b>CREATE DATABASE</b> online_store;<br />
<b>CONNECT</b> online_store;<br />
<br />
<b>CREATE TABLE</b> customers<br />
(<br />
custid <b>INT NOT NULL AUTO_INCREMENT</b>,<br />
<b> PRIMARY KEY </b>(custid),<br />
firstname <b>VARCHAR</b>(15),<br />
lastname <b>VARCHAR</b>(15),<br />
email VARCHAR(20)<br />
);<br />
<br />
<br />
<b>CREATE TABLE</b> products<br />
(<br />
prodid <b>INT NOT NULL AUTO_INCREMENT</b>,<br />
<b> PRIMARY KEY</b>(prodid),<br />
title <b>VARCHAR</b>(15),<br />
quantity <b>INT,</b><br />
price <b>DECIMAL</b>(10,2)<br />
);<br />
<br />
<br />
<b>CREATE TABLE</b> orders<br />
(<br />
ordid <b>INT NOT NULL AUTO_INCREMENT</b>,<br />
<b>PRIMARY KEY</b>(ordid),<br />
placed <b>TIMESTAMP</b>,<br />
ocustid <b>INT</b>,<br />
oprodid <b>INT</b>,<br />
<b> FOREIGN KEY</b> (ocustid) <b>REFERENCES</b> customers(custid),<br />
<b>FOREIGN KEY</b> (oprodid) <b>REFERENCES</b> products(prodid)<br />
);<br />
<br />
<br />
Now we need to populate the database with some fictitious data...<br />
<br />
<br />
<br />
<br />
<b>INSERT INTO</b> Customers (FirstName,LastName,email) <b>VALUES</b> ('Mark','Dodds','mdodds@hotmail.com');<br />
<b>INSERT INTO</b> Customers (FirstName,LastName,email) <b>VALUES</b> ('Paul','Clarkson','Pdodds@hotmail.com');<br />
<b>INSERT INTO</b> Customers (FirstName,LastName,email) <b>VALUES</b> ('Jimmy','Paulson','JPaulson@hotmail.com');<br />
I<b>NSERT INTO</b> Customers (FirstName,LastName,email) <b>VALUES</b> ('June','Wilds','AJames@hotmail.com');<br />
<b>INSERT INTO</b> Customers (FirstName,LastName,email) <b>VALUES</b> ('Danny','Armstrong','AJames@hotmail.com');<br />
<b>INSERT INTO</b> Customers (FirstName,LastName,email) <b>VALUES </b>('Andy','Williams','AJames@hotmail.com');<br />
<br />
<b>INSERT INTO</b> Products (Title,quantity,price) <b>VALUES</b> ("Shoes",23,4.99);<br />
<b>INSERT INTO</b> Products (Title,quantity,price) <b>VALUES</b> ("Jackets",34,16.99);<br />
<b>INSERT INTO</b> Products (Title,quantity,price) <b>VALUES</b> ("Shampoo",45,1.99);<br />
<br />
<b>INSERT INTO</b> Orders (OCustID,OProdID) <b>VALUES</b> (1,1);<br />
<b>INSERT INTO</b> Orders (OCustID,OProdID) <b>VALUES</b> (1,2);<br />
<b>INSERT INTO</b> Orders (OCustID,OProdID) <b>VALUES</b> (2,3);<br />
<br />
<br />
What we want to know is which customer has purchased the shoes, this can be found with a simple SELECT statement.<br />
<br />
<br />
<b>SELECT </b> customers.firstname,customers.lastname<br />
<b>FROM</b> Orders,Customers<br />
<b>WHERE</b> customers.custid=orders.ocustid<br />
<b>AND </b>orders.OProdID=1;<br />
<br />
<br />
<br />
Now we have three tables - customers - products - orders, the problem we have is that the if we place a order for shoes in the orders table it will not effect the quantity in the products table, do resolve this issue we can use a trigger.<br />
<br />
<br />
<b>DELIMITER</b> $$<br />
<b>CREATE TRIGGER</b> update_products <b>AFTER INSERT ON</b> orders<br />
<b>FOR EACH ROW</b><br />
<b>BEGIN</b><br />
SET @update = new.Oprodid;<br />
<b>UPDATE</b> products <b>SET</b> quantity=quantity-1 <b>WHERE</b> prodid=@update;<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<br />
<b>END</b>$$<br />
<b>DELIMITER</b> ;<br />
<br />
<br />
Lets give this a try...<br />
<br />
<b>SELECT * FROM PRODUCTS;</b><br />
<b><br /></b>
<br />
<br />
+--------+-----------------+----------+-----<br />
| ProdID | title | quantity | price |<br />
+--------+-----------------+----------+-----<br />
| 1 | Shoes | 23 | 4.99 |<br />
| 2 | Jackets | 34 | 16.99 |<br />
| 3 | Shampoo | 45 | 1.99 |<br />
| 4 | Windows Cleaner | 78 | 2.49 |<br />
| 5 | Car Magazine | 71 | 1.49 |<br />
| 6 | Eggs | 177 | 1.42 |<br />
| 7 | Tea bags | 237 | 1.29 |<br />
| 8 | Bread | 12 | 0.99 |<br />
+--------+-----------------+----------+--------<br />
<br />
<br />
<br />
Now we insert some more data in to the orders table..<br />
<br />
<b>INSERT INTO</b> orders (OCustID,OProdID) <b>VALUES</b> (1,1);<br />
<br />
And now check the table again.<br />
<br />
<b>SELECT * FROM PRODUCTS;</b>
<br />
<b><br /></b>
<br />
+--------+-----------------+----------+-----<br />
| ProdID | title | quantity | price |<br />
+--------+-----------------+----------+-----<br />
| 1 | Shoes | <b>22</b> | 4.99 |<br />
| 2 | Jackets | 34 | 16.99 |<br />
| 3 | Shampoo | 45 | 1.99 |<br />
| 4 | Windows Cleaner | 78 | 2.49 |<br />
| 5 | Car Magazine | 71 | 1.49 |<br />
| 6 | Eggs | 177 | 1.42 |<br />
| 7 | Tea bags | 237 | 1.29 |<br />
| 8 | Bread | 12 | 0.99 |<br />
+--------+-----------------+----------+--------<br />
<br />
<br />
The table above has removed a item from the shoes column.<br />
<br />
<br />
<br />
<br />
<br />
<br />
Anonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.com0tag:blogger.com,1999:blog-1198088225112844983.post-49742812469129733162013-01-04T09:41:00.000-08:002013-01-04T09:43:13.524-08:00MySQL Trigger Example<h2 style="text-align: center;">
MySQL Trigger Example</h2>
<br />
<br />
A trigger is an SQL statements or a set of SQL statements which is stored to be activated or fired when an event associating with a database table occurs. The event can be any event including INSERT, UPDATE and DELETE.<br />
<br />
<br />
<b>DELIMITER</b> &&<br />
<br />
<b>CREATE TRIGGER</b> test_trigger <b>BEFORE INSERT ON</b> clubs<br />
<b>FOR EACH ROW</b><br />
<br />
<b>BEGIN</b><br />
<b>INSERT INTO</b> user(username) <b>Value</b> ('Mark');<br />
<b>END</b> &&<br />
<br />
<b>DELIMITER</b> ;<br />
<br />
<br />
Sometimes a trigger is referred as a special kind of stored procedure in term of procedural code inside its body. The difference between a trigger and a stored procedure is that a trigger is activated or called when an event happens in a database table, a stored procedure must be called explicitly. For example you can have some business logic to do before or after inserting a new record in a database table.<br />
Advantages of using atrigger<br />
<br />
<br />
<ul>
<li>A SQL Trigger provides an alternative way to check integrity.</li>
<li>A SQL trigger can catch the errors in business logic in the database level.</li>
<li>A SQL trigger provides an alternative way to run scheduled tasks. With SQL trigger, you don’t have to wait to run the scheduled tasks. You can handle those tasks before or after changes being made to database tables.</li>
<li>A SQL trigger is very useful when you use it to audit the changes of data in a database table.</li>
</ul>
<br />
<br />
Disadvantages of using a trigger<br />
<br />
<br />
<ul>
<li>A SQL trigger only can provide extended validation and cannot replace all the validations. Some simple validations can be done in the application level. For example, you can validate input check in the client side by using javascript or in the server side by server script using PHP or ASP.NET.</li>
<li>A SQL Triggers executes invisibly from client-application which connects to the database server so it is difficult to figure out what happen underlying database layer.</li>
<li>A SQL Triggers run every updates made to the table therefore it adds workload to the database and cause system runs slower.</li>
</ul>
<br />
<br />
MySQL finally supports one of the most important features of an enterprise database server which is called trigger since version 5.0.2. Trigger is implemented in MySQL by following the syntax of standard SQL:2003. When you create a trigger in MySQL, its definition stores in the file with extension .TRG in a database folder with specific name as follows: /data_folder/database_name/table_name.trg<br />
<br />
The file is in plain text format so you can use any plain text editor to modify it.<br />
<br />
While trigger is implemented in MySQL has all features in standard SQL but there are some restrictions you should be aware of like following:<br />
<br />
<br />
<ol>
<li>It is not allowed to call a stored procedure in a trigger.</li>
<li>It is not allowed to create a trigger for views or temporary table.</li>
<li>It is not allowed to use transaction in a trigger.</li>
<li>Return statement is disallowed in a trigger.</li>
</ol>
<br />
<br />
Creating a trigger for a database table causes the query cache invalidated. Query cache allows you to store the result of query and corresponding select statement. In the next time, when the same select statement comes to the database server, the database server will use the result which stored in the memory instead of parsing and executing the query again.<br />
<br />
All trigger for a database table must have unique name. It is allowed that triggers for different tables having the same name but it is recommended that trigger should have unique name in a specific database. Anonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.com0tag:blogger.com,1999:blog-1198088225112844983.post-15775781756808091892013-01-03T14:58:00.000-08:002013-01-03T14:58:30.901-08:00MySQL Stored Procedure Example<br />
<h2 style="text-align: center;">
MySQL Stored Procedure Example</h2>
<br />
<br />
DELIMITER //<br />
<br />
CREATE PROCEDURE GetAllCustomers()<br />
BEGIN<br />
SELECT * FROM customers;<br />
END //<br />
<br />
DELIMITER ;<br />
<br />
<br />
SELECT name FROM mysql.proc; <b># SHOW NAME OF STORED PROCEDURES</b> <br />
<br />
call GetAllCustomers();<br />
<br />
<br />
<br />
<br />
<br />
Definition of stored procedure<br />
<br />
A stored procedure is a segment of declarative SQL code, which is stored in the database catalog. A stored procedure can be invoked by a program, a trigger or even another stored procedure.<br />
A stored procedure which calls itself is recursive stored procedure. Almost RDMBS supports recursive stored procedure but MySQL does not support it well. You should check your version of MySQL database before implementing recursive stored procedures.<br />
Stored Procedure in MySQL<br />
<br />
MySQL is known as the most popular open source RDBMS which is widely used by both community and enterprise. However during the first decade of its existence, it did not support stored procedure, trigger, event…etc. Since MySQL version 5.0, those features have been added to MySQL database engine to allow MySQL to be more flexible and powerful.<br />
Before starting the tutorial series about stored procedure, it is required that you have MySQL version 5.x+ installed in your computer or server.<br />
Stored Procedures Advantages<br />
<br />
Stored procedure increases performance of application. Once created, stored procedure is compiled and stored in the database catalog. It runs faster than uncompiled SQL commands which are sent from application.<br />
Stored procedure reduces the traffic between application and database server because instead of sending multiple uncompiled lengthy SQL commands statements, the application only has to send the stored procedure's name and get the data back.<br />
<br />
Stored procedure is reusable and transparent to any application which wants to use it. Stored procedure exposes the database interface to all applications so developers don't have to program the functions which are already supported in stored procedure in all external applications.<br />
Stored procedure is secured. Database administrator can grant the access right to application which wants to access stored procedures in database catalog without granting any permission on the underlying database tables.<br />
Besides those advantages, stored procedure has its own disadvantages which you should be aware of before deciding using it.<br />
Stored Procedures Disadvantages<br />
<br />
Stored procedures make the database server high load in both memory and processors. Instead of being focused on the storing and retrieving data, you could be asking the database server to perform a number of logical operations or a complex of business logic which is not the well designed in database server.<br />
Stored procedure only contains declarative SQL so it is very difficult to write a procedure with complexity of business logic like other languages in application layer such as Java, C#, C++…<br />
Stored procedure is difficult to debug. You cannot debug stored procedure in almost RDMBSs and in MySQL also.<br />
<br />
There are some workarounds on this problem but it still not easy enough to do so.<br />
Store procedure is not easy to write and maintain. Writing and maintaining stored procedure is usually required specialized skill set that not all developers possess. This may introduced problems in both application development and maintain phase.<br />
<br />
Stored procedure has it own advantages and disadvantages. Therefore when developing application, you should balance between them to choose whether to use stored procedure or not. In the following tutorials, we will guide you how to leverage stored procedure in your database programming tasks with a couple of practical examples.<br />
<br />
<br />
<br />
Anonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.com0tag:blogger.com,1999:blog-1198088225112844983.post-86851681170014734822013-01-01T12:20:00.002-08:002013-01-01T12:20:57.741-08:00MySQL CONCAT and AS Example<h2 style="text-align: center;">
MySQL CONCAT and AS Example</h2>
<div>
<br /></div>
<div>
Simple example to show how to use CONCAT (concatenate), to join to parts of the table together and name the query.</div>
<div>
<br /></div>
<div>
<div>
<b>SELECT</b> <b>CONCAT</b> (tile," ",quantity) </div>
<div>
<b>AS</b> stock</div>
<div>
<b>FROM</b> products;</div>
</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
OUTPUT</div>
<div>
<br /></div>
<div>
<div>
+------------+</div>
<div>
| <b>stock</b> |</div>
<div>
+------------+</div>
<div>
| Shoes 200 |</div>
<div>
| Soap 2003 |</div>
<div>
| Shampoo 34 |</div>
<div>
| DVD 23 |</div>
<div>
| CD 34 |</div>
<div>
+------------+</div>
</div>
<div>
<br /></div>
<div>
By choosing the columns tile and quantity and using the CONCAT and AS functions, we can have a single column called stock that shows the title of the product and the quantity left in stock.</div>
<div>
<br /></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZbKlNL2Mi32r4PmHTGEDQzBW5-y4pDmowsfcwSVk5Nial_CiRbNvrM4-yifeitF4xf5AyCM1EnlGepQUR_waJ9Xj-k5wbAEoG7oo6o4n6jeYdS2TTvVBVOdj_jh2HEj60zZ89upkC8tg/s1600/mysql-concat-function.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="MYSQL EXAMPLE OF CONCAT and AS" border="0" height="246" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZbKlNL2Mi32r4PmHTGEDQzBW5-y4pDmowsfcwSVk5Nial_CiRbNvrM4-yifeitF4xf5AyCM1EnlGepQUR_waJ9Xj-k5wbAEoG7oo6o4n6jeYdS2TTvVBVOdj_jh2HEj60zZ89upkC8tg/s400/mysql-concat-function.gif" title="" width="400" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.com0tag:blogger.com,1999:blog-1198088225112844983.post-62295135153299793662012-12-31T02:56:00.000-08:002012-12-31T02:56:51.577-08:00MySQL DISTINCT and LIMIT Example<h2 style="text-align: center;">
MySQL DISTINCT and LIMIT Example</h2>
<div style="text-align: center;">
<br /></div>
Another very simple example of a MySQL query using DISTINCT and LIMIT.<br />
<br />
<b>SELECT</b> * <b>FROM</b> customers;<br />
<br />
<br />
+---------+------------+-----------+<br />
| Cust_id | First_Name | Last_Name |<br />
+---------+------------+-----------+<br />
| 1 | Mark | James |<br />
| 2 | Paul | James |<br />
| 3 | Sam | James |<br />
| 4 | Paul | Dodds |<br />
+---------+------------+-----------+<br />
<br />
<br />
If we just want the database to return just the last name, we would use<br />
<br />
<b>SELECT</b> Last_Name <b>FROM</b> customers;
<br />
<br />
<br />
+-----------+<br />
| Last_Name |<br />
+-----------+<br />
| James |<br />
| James |<br />
| James |<br />
| Dodds |<br />
+---------+<br />
<br />
Now we have duplicates, to remove these use<br />
<br />
<b>SELECT</b> <b>DISTINCT </b>Last_Name <b>FROM</b> customers;
<br />
<br />
<br />
+-----------+<br />
| Last_Name |<br />
+-----------+<br />
| James |<br />
| Dodds |<br />
+-----------+<br />
<br />
<br />
<br />
If we had a large database and we just want the first three results.<br />
<br />
<b>SELECT</b> tile <b>FROM</b> products <b>LIMIT 3</b>;<br />
<br />
<br />
+---------+<br />
| tile |<br />
+---------+<br />
| Shoes |<br />
| Soap |<br />
| Shampoo |<br />
+---------+<br />
<br />
<br />
Now we still want 3 results but not the first one..<br />
<br />
<b>SELECT</b> tile <b>FROM</b> products <b>LIMIT 1, 3;</b><br />
<br />
<br />
+---------+<br />
| tile |<br />
+---------+<br />
| Soap |<br />
| Shampoo |<br />
| DVD |<br />
+---------+<br />
<br />
<br />
As the first position in the database starts at 0, we need to state the first item we want should start at 1.<br />
<br />Anonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.com0tag:blogger.com,1999:blog-1198088225112844983.post-8404094520948308842012-12-29T08:34:00.003-08:002012-12-29T08:34:53.755-08:00Java Simple Thread Example<br />
<b>//AUTHOR : THE JAVA GEORDIE</b><br />
<b>// SIMPLE THREAD EXAMPLE</b><br />
<br />
import java.util.Random;<br />
<br />
class Apple implements Runnable<br />
{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>String name; <b>// GIVE THREAD A NAME</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>int time; <b>// SET A TIME FOR THREAD TO SLEEP</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Random r = new Random();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>//BUILD CONSTRUCTOR</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public Apple(String s)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>name =s; <b>// SET NAME OF THREAD</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>time = r.nextInt(999);<b>//DEFINE A RANDOM TIME</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public void run()<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>try<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.printf("%s is sleep for %d\n",name,time);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Thread.sleep(time);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.printf("%s is done.\n",name);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>catch(Exception e)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(e);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
}<br />
<br />
---------------------------------<br />
<br />
<br />
class start<br />
{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main(String args[])<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> <b> </b></span><b>//CREATE THREADS</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Thread t1= new Thread(new Apple("one"));<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Thread t2= new Thread(new Apple("two"));<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Thread t3= new Thread(new Apple("three"));<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>//START THREADS</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>t1.start();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>t2.start();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>t3.start();<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
}<br />
<br />
------------OUTPUT-----<br />
<br />
<br />
one is sleep for 67<br />
three is sleep for 288<br />
two is sleep for 724<br />
one is done.<br />
three is done.<br />
two is done.<br />
<br />
<br />
Anonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.com0tag:blogger.com,1999:blog-1198088225112844983.post-59590083710601801712012-12-28T15:04:00.000-08:002012-12-28T15:04:34.713-08:00Java Very Simple Observer Pattern Example<br />
<h2 style="text-align: center;">
Java Very Simple Observer Pattern Example</h2>
<br />
My attempt to demonstrate the observer pattern..<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjabU-NC_ZAoMdo7mQYZUdt7U6tDvLDuKJOkfwyO0cRSbIxCwJWmzypqlrlB3_dFXdA_Eeb18f3Sgqv1fhLcyYhyphenhyphenejUWmcA7D56iSdsyL_Pt37IUQpqHbL7UZAisxbm1aeyXQ8HHE2Ozsw/s1600/Observer+Pattern.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Java Example" border="0" height="280" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjabU-NC_ZAoMdo7mQYZUdt7U6tDvLDuKJOkfwyO0cRSbIxCwJWmzypqlrlB3_dFXdA_Eeb18f3Sgqv1fhLcyYhyphenhyphenejUWmcA7D56iSdsyL_Pt37IUQpqHbL7UZAisxbm1aeyXQ8HHE2Ozsw/s400/Observer+Pattern.JPG" title="Observer Pattern" width="400" /></a></div>
<br />
<br />
<br />
----------------------------CODE-----------------------------------<br />
<br />
<br />
<b>//AUTHOR : THE JAVA GEORDIE</b><br />
<b>//</b><br />
<b>//SIMPLEST EXAMPLE I COULD THINK</b><br />
<b>//OF TO DEMONSTATE THE OBSERVER PATTERN</b><br />
<br />
class start<br />
{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main(String args[])<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> <b> ///instantiate the watcher (observer) and the </b><br />
<b><span class="Apple-tab-span" style="white-space: pre;"> </span> // being watched(observed) class </b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> <br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>watcher watch = new watcher();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>beWatched bwatch = new beWatched();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> <b> //add a watcher to the being watched (observed) class</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>bwatch.addObserver(watch);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> <b> </b></span><b>// make the being watched (observed) class</b><br />
<b><span class="Apple-tab-span" style="white-space: pre;"> </span>// do something....</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>bwatch.setStuff();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
}<br />
<br />
-----------------------------------------------------<br />
<br />
<br />
<b>//AUTHOR : THE JAVA GEORDIE</b><br />
<b>//</b><br />
<b>//THIS CLASS EXTENDS OBSERVABLE TO IS BEING WATCHED</b><br />
<br />
<br />
import java.util.Observable;<br />
<br />
class beWatched extends Observable<br />
{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public void setStuff()<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>// NOTIFY THE OTHER WATCHERS SOMETHING HAS HAPPEND.</b><br />
<b><span class="Apple-tab-span" style="white-space: pre;"> </span>// IN THIS CASE NOT MUCH</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>setChanged();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>notifyObservers();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
}<br />
-------------------------------------------------<br />
<br />
<br />
<b>//AUTHOR : THE JAVA GEORDIE</b><br />
<b>//</b><br />
<b>// THIS IS A WATCHER (OBSERVER) CLASS</b><br />
<b>// THAT IMPLEMENTS THE OBSERVER INTERFACE</b><br />
<br />
import java.util.Observer;<br />
import java.util.Observable;<br />
<br />
class watcher implements Observer<br />
{<br />
<b><span class="Apple-tab-span" style="white-space: pre;"> </span>// IF SOMETHING HAPPENS TO THE WATCHED CLASS</b><br />
<b><span class="Apple-tab-span" style="white-space: pre;"> </span>// DO SOMETHING</b><br />
<b><span class="Apple-tab-span" style="white-space: pre;"> </span>/////////////////////////////////////////////</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public void update(Observable obj, Object arg)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Something changed!");<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
}<br />
<br />
---------------OUTPUT------------------<br />
<br />
Something changed!<br />
<br />
<br />
<br />
Anonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.com1tag:blogger.com,1999:blog-1198088225112844983.post-70978372188804351222012-12-27T02:18:00.000-08:002012-12-27T02:18:37.152-08:00LOOKING FOR VOLUNTARY / PAID IT WORK<h2 style="text-align: center;">
LOOKING FOR VOLUNTARY / PAID (IT WORK)</h2>
<div style="text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<img border="0" height="299" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNOCh41sO1YwKyQI0x-pvDYuQXHQZMX4bhQjt9RUVQ7cixHCi4o5SIPr7mEyzqyvAp06Rv6w5QWWn0GWHOhw7BQpJCYbx3kr3j0wLZhy-phE15cacDK9DNkrDkpiv9iAPSoGk1h1bdia8/s400/images+(2).jpg" width="400" /></div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: center;">
Looking for new projects IT based and will work voluntary, permanent or contract.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
</div>
I have been working in IT before I left school near on 25 years, I have been involved with many IT projects, I am educated to post grad level from Northumbia University in Applied Computing Technologies.<br />
<br />
<div style="text-align: center;">
I currently live 15 mins from Newcastle upon tyne England as a Internet Marketer / Freelance developer.</div>
<br />
I have experience in the below technologies but would welcome anything new (im a quick learner).<br />
<br />
J2SE<br />
J2EE<br />
Enterprise Java Beans<br />
Servlets<br />
Java Server Pages<br />
J2ME<br />
C# (a little)<br />
<br />
PHP<br />
MySQL<br />
PLSQL<br />
Oracle<br />
VB6<br />
Relational Databases<br />
Object Relational Databases (ORDBMS)<br />
Object Oriented Databases (OODBMS)<br />
<br />
<br />
<div style="text-align: center;">
<a href="mailto:judosales@live.co.uk" rel="nofollow" target="_blank">CONTACT ME</a></div>
Anonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.com0tag:blogger.com,1999:blog-1198088225112844983.post-27294375067565142512012-12-25T13:44:00.002-08:002012-12-25T13:54:28.803-08:00Java Tic Tac Toe Using MVC and Singleton <h2 style="text-align: center;">
Java Tic Tac Toe Using MVC and Singleton</h2>
<div>
<br /></div>
<div>
<br /></div>
<div>
-----------------------------------------CODE--------------------------------------------------</div>
<div>
<br /></div>
<div>
<br /></div>
<div style="text-align: left;">
</div>
<b>//*********************************************</b><br />
<b>//AUTHOR - THE JAVA GEORDIE</b><br />
<b>//CREATES INSTANCE OF CONTROLLER</b><br />
<b>//*********************************************</b><br />
<br />
class start<br />
{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main(String args[])<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>controller cont = new controller();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
}<br />
<br />
--------------------------------------------------------------------------------<br />
<br />
<br />
<b>//*********************************************</b><br />
<b>// AUTHOR - THE JAVA </b><b>GEORDIE</b><br />
<b>// CLASS TO WORK AS THE VIEW</b><br />
<b>// USES SINGLETON PATTERN FOR GUI</b><br />
<b>// </b><br />
<b>// CHECKS TO SEE WHOS GO IS NEXT</b><br />
<b>//*********************************************</b><br />
<br />
import javax.swing.JFrame;<br />
import javax.swing.JButton;<br />
import java.awt.GridLayout;<br />
<br />
<br />
class view extends JFrame<br />
{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>// DEFINE BUTTONS AND GRID</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>private static view firstInstance =null;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>protected JButton but[];<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>protected GridLayout grid;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>protected view()<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>super("Tic Tac Toe Game");<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>but = new JButton[9];<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>grid= new GridLayout(3,3,5,5); <br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>setSize(250,250);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>setLayout(grid);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> <b> </b></span><b>//BUILD BUTTONS</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>for(int loop=0; loop<9; loop++)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>but[loop] = new JButton();<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>add(but[loop]);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>setVisible(true);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<b><span class="Apple-tab-span" style="white-space: pre;"> </span>// RESET TO GUI</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public void resetGame()<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>for(int z=0; z<9; z++)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>but[z].setText("");<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>//USE THE SINGLETON DESIGN PATTERN</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public static view getInstace()<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (firstInstance==null)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>firstInstance = new view();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return firstInstance;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
}<br />
-------------------------------------------------------------------------------<br />
<br />
<br />
<b>//*********************************************</b><br />
<b>// AUTHOR - THE JAVA </b><b>GEORDIE</b><br />
<b>// CLASS TO WORK AS THE GLUE BETWEEN VIEW AND MODEL</b><br />
<b>// PASSES VALUES FROM VIEW TO MODEL</b><br />
<b>// ADDS LISTENERS TO THE VIEW</b><br />
<b>// CHECKS TO SEE WHOS GO IS NEXT</b><br />
<b>//*********************************************</b><br />
<br />
import java.awt.event.ActionListener;<br />
import java.awt.event.ActionEvent;<br />
import javax.swing.JOptionPane;<br />
<br />
class controller extends view implements ActionListener<br />
{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>private model newModel = new model();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>private int result=0;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>private boolean whosGo=false;<b> // SET PLAYER O TO GO FIRST</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public controller()<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>//ADD ACTIONLISTER TO BUTTONS FROM VIEW CLASS</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>for(int x=0; x<9; x++)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>super.but[x].addActionListener(this);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public void goAgain()<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>int reply = JOptionPane.showConfirmDialog<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>(null, "PLAY AGAIN ?", "TIC TAC TOE" , JOptionPane.YES_NO_OPTION);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (reply == JOptionPane.YES_OPTION)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>newModel.resetGame();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>super.resetGame();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>else<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>dispose();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.exit(0);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public void actionPerformed (ActionEvent event)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Object objClicked=event.getSource();<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>for(int x=0; x<9; x++)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if(objClicked==super.but[x])<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (super.but[x].getText()=="")<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (whosGo==false)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>super.but[x].setText("X");<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>newModel.setClick(x,1);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>whosGo=true; <b>// CHANGE TO NEXT PLAYER</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>result=newModel.getResult();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>else<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>super.but[x].setText("O");<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>newModel.setClick(x,2);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>whosGo=false; <b>// CHANGE TO NEXT PLAYER<span class="Apple-tab-span" style="white-space: pre;"> </span></b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>result=newModel.getResult();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if(result!=0)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> goAgain();<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
--------------------------------------------------------------------<br />
<br />
<br />
<b>//*********************************************</b><br />
<b>//AUTHOR - THE JAVA </b><b>GEORDIE</b><br />
<b>//CLASS TO WORK ON THE BUSINESS END OF THE GAME</b><br />
<b>//SETS UP ARRAY AND DEFINES SOME METHODS TO</b><br />
<b>//RESET ARRAY - MODIFY THE ARRAY - CHECK RESULTS</b><br />
<b>//*********************************************</b><br />
<br />
class model<br />
{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>int array[] = new int[9]; <b>// O = 1 - X = 2</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>int numberOfClicks=1;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public void setClick(int position, int XorO)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>array[position]=XorO; <b>// ADD 1 OR 2 TO ARRAY POSITION</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>numberOfClicks++; <b>// INCREMENT GAME TURNS</b><br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<b><span class="Apple-tab-span" style="white-space: pre;"> </span>//RESET ARRAY AND THE NUMBER OF TURNS COUNT</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public void resetGame()<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>numberOfClicks=0;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>for(int z=0; z<9; z++)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>array[z]=0;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<b><span class="Apple-tab-span" style="white-space: pre;"> </span>// THIS METHOD CHECKS TO SEE WHICH PLAYER HAS WON IF ANY AND</b><br />
<b><span class="Apple-tab-span" style="white-space: pre;"> </span>// RETURN A VAULE </b><br />
<b><span class="Apple-tab-span" style="white-space: pre;"> </span>// 1(IF O WINS) - 2(IF X WINS) - 3(IF NO ONE WINS) - 0 BY DEFAULT</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public int getResult()<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>//HORI TEST</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> if (array[0]==1 && array[1]==1 && array[2]==1)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>return 1; <b>// O WINS</b><span class="Apple-tab-span" style="white-space: pre;"><b> </b> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> if (array[0]==2 && array[1]==2 && array[2]==2)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return 2; <b>// X WINS<span class="Apple-tab-span" style="white-space: pre;"> </span></b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (array[3]==1 && array[4]==1 && array[5]==1)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>return 1; <b>// O WINS<span class="Apple-tab-span" style="white-space: pre;"> </span></b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (array[3]==2 && array[4]==2 && array[5]==2)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return 2; <b>// X WINS</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (array[6]==1 && array[7]==1 && array[8]==1)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>return 1;<b> // O WINS<span class="Apple-tab-span" style="white-space: pre;"> </span></b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (array[6]==2 && array[7]==2 && array[8]==2)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return 2; <b>// X WINS</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>// VERT TEST</b><br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (array[0]==1 && array[3]==1 && array[6]==1)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>return 1; <b>// O WINS<span class="Apple-tab-span" style="white-space: pre;"> </span></b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (array[0]==2 && array[3]==2 && array[6]==2)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return 2; <b>// X WINS</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (array[1]==1 && array[4]==1 && array[7]==1)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>return 1; <b>// O WINS</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (array[1]==2 && array[4]==2 && array[7]==2)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return 2; <b>// X WINS</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (array[2]==1 && array[5]==1 && array[8]==1)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>return 1; <b>// O WINS</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (array[2]==2 && array[5]==2 && array[8]==2)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return 2; <b>// X WINS<span class="Apple-tab-span" style="white-space: pre;"> </span></b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>//DIAGONAL TEST<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> if (array[0]==1 && array[4]==1 && array[8]==1)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>return 1; <b>// O WINS</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> if (array[0]==2 && array[4]==2 && array[8]==2)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return 2; <b>// X WINS</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (array[2]==1 && array[4]==1 && array[6]==1)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>return 1; <b>// O WINS</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> if (array[2]==2 && array[4]==2 && array[6]==2)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return 2; <b>// X WINS</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (numberOfClicks==9)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return 3; <b>//NO ONE WINS THIS GAME</b><br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return 0;<b> // NOBODY HAS WON YET</b><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
}<br />
<br />
---------------------------OUTPUT ------------------------------<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiT2u-GidxVNf_1t67-KMknGoafnfDDj1GRHPHelwxqVH2RNtXQnt74aWmiamz9vTzLr7U-nuRNict7Su9LFetSTIJJeu743DcV1srWXmn5QIf7NByQkalwjHEw5fUH98H9vtq95yPp-5s/s1600/untitled.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="JAVA EXAMPLE TIC TAC TOE" border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiT2u-GidxVNf_1t67-KMknGoafnfDDj1GRHPHelwxqVH2RNtXQnt74aWmiamz9vTzLr7U-nuRNict7Su9LFetSTIJJeu743DcV1srWXmn5QIf7NByQkalwjHEw5fUH98H9vtq95yPp-5s/s400/untitled.JPG" title="MVC and Singleton" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0MELOgvvoi3xKGCM3UXHURr3LD8c5R9JrONp_sgrJydFuk6b99gciakhx6oKMAXsdKXnbAwlOSpLibTvF0acBh-0J2HkAqTWLzLajLN8mFYPgHSWxbzUBI1Wib061mN2HnQpMcn0dGT0/s1600/untitled.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0MELOgvvoi3xKGCM3UXHURr3LD8c5R9JrONp_sgrJydFuk6b99gciakhx6oKMAXsdKXnbAwlOSpLibTvF0acBh-0J2HkAqTWLzLajLN8mFYPgHSWxbzUBI1Wib061mN2HnQpMcn0dGT0/s400/untitled.JPG" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<br />
<br />
<br />Anonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.com0tag:blogger.com,1999:blog-1198088225112844983.post-70949563421546174912012-12-23T16:12:00.002-08:002012-12-23T16:12:26.321-08:00Relational Algebra Cartesian Product<h2 style="text-align: center;">
Relational Algebra Cartesian Product</h2>
<div>
<br /></div>
<div>
We will use two example tables</div>
<div>
<br />
EMPLOYEE<br />
<br /></div>
<div>
<table border="1" style="width: 35%px;">
<tbody>
<tr>
<td align="center" width="33%"><b>NAME</b></td>
<td align="center" width="33%"><b>EMP_ID</b></td>
<td align="center" width="34%"><b>DEPT_NAME</b></td>
</tr>
<tr>
<td align="center" width="33%"><div align="center">
James</div>
</td>
<td align="center" width="33%">HR22</td>
<td align="center" width="34%">HR</td>
</tr>
<tr>
<td align="center" width="33%">PAUL</td>
<td align="center" width="33%">HR33</td>
<td align="center" width="34%">HR</td>
</tr>
<tr>
<td align="center" width="33%">Sam</td>
<td align="center" width="33%">FIN22</td>
<td align="center" width="34%">FINANCE</td>
</tr>
</tbody></table>
</div>
<br />
DEPARTMENT<br />
<table border="1" style="width: 35%px;">
<tbody>
<tr>
<td align="center" width="33%"><b>DEPT_NAME</b></td>
<td align="center" width="33%"><b>MANAGER</b></td>
</tr>
<tr>
<td align="center" width="33%"><div align="center">
HR</div>
</td>
<td align="center" width="33%">STEVE</td>
</tr>
<tr>
<td align="center" width="33%">FINANCE</td>
<td align="center" width="33%">CLAIR</td>
</tr>
</tbody></table>
<br />
<br />
<div style="text-align: center;">
EMPLOYEE <b>X</b> DEPARTMENT = (3 x 2) = NUMBER OF ROWS</div>
<div style="text-align: center;">
RELATES EVERY TUPLE TO EVERY OTHER TUPLE<br />
<br /></div>
<div style="text-align: center;">
<iframe allowfullscreen="allowfullscreen" frameborder="0" height="315" src="http://www.youtube.com/embed/tvCIRCbW6m0" width="560"></iframe></div>
Anonymoushttp://www.blogger.com/profile/03506572851516413088noreply@blogger.com0