Where to download anime for free

Here’s a list of sources which you can download anime episodes for free:


Zone Anime

image

An anime site where you can both stream and download anime. They mostly host their anime episodes on rapidshare and megaupload.

File Type File Size
rmvb 90Mb
avi 190Mb

 

Anime DLC

image

As the logo suggests, it’s a place where you can download anime. They are quick in uploading files. Anime that usually appear on streaming sites are offered for download the day after. Its really a nice place to go if you want to download the latest anime. The only downside is that its required that you register before you access the downloads.

An added bonus is that, you can actually submit any issues regarding the anime download if its not working.

File Type File Size
mkv 153Mb

 

Cyber 12

image

Yes, the header of their site lacks creativity. But they offer downloads without you having to register. They mostly host the anime episodes on mediafire, megaupload, and fileserve. With downloads classified as high-quality and low-quality. They are also fast at uploading anime episodes. But I think they only host the most recent anime. From 2009-present.

File Type File Size
mkv 256Mb
mp4 56Mb

 

RealityLapse

image

Another nice place to download or stream anime. Registration is required, but its actually pretty fast and you don’t need to verify the email that you have entered in order to download anime. The only downside is that the high-quality downloads are not for free. This isn’t really the choice to make if you are collecting anime episodes.

File Type File Size
mkv 265Mb
avi 171Mb
mp4(ipod) 56Mb

 

AnimePlaza

image

If you are low on bandwidth but still want to download your anime. Then animeplaza is the choice to make. They offer downloads in rmvb format which runs from 50Mb – 90Mb.  Hosting their files on megaupload, wupload, and fileserve.

File Type File Size
mkv 265Mb
avi 200Mb
rmvb 70Mb

 

Animecrazy.net

I think this site also deserve a place in this post. I admit that I was watching anime streaming from this site years ago. But I stopped visiting the site when I discovered sites where I can download anime.
I decided to visit it recently and found out that they’re already have anime downloads aside from the usual streaming. So far I think their site is the fastest to release anime streaming and downloads in high quality. They mostly host the downloads on filesonic and fileserve.

File Type File Size
mkv 100Mb and up

 

Minitheatre

image

The king of awesomeness. They offer high-quality anime episodes in small size. They also have dual-audio, english-dub, and english sub anime episodes. Another awesome thing is that most of the files are hosted on mediafire, which allows the lot of us who has fast internet connection to simultaneously download lots of anime episodes.

File Type File Size
mkv 50Mb – 90Mb

 

 

Conclusion

That’s it for this tension-breaking post. Happy downloading!

 

[image source: minitheatre.org, anime-plaza.nl, realitylapse.com, cyber12.com, animedlc.com, zone-anime.com]

How to add leading zeroes in a php variable

Still couldn’t think of a catchy introduction. Maybe I should just stick to whatever comes to my mind first.
Anyway, in this another episode of my blog. I’m going to tell you how you can prefix a php variable preferably numbers with leading zeroes. Something like this:

00000018029

Well, don’t force your nerves too much. The number above doesn’t actually signify anything. I just used it to illustrate what leading zeroes are in case you came here by accident.

 

Introductory Example

Truth is, you don’t necessarily need to do this. Especially if you’re going to store the variable into a database later.
You know why? Well, just try making a query involving numbers with leading zeroes on it. And see what you get:

SELECT 00000000002

In my case, I get this cute little result:

image

I’m trying to be funny here. Just laugh if you feel like it.

Based on the example that I showed you above, mysql doesn’t actually care about the leading zeroes. And it will always return the number 1 no matter how many leading zeroes are out there.

 

Unsigned Zerofill

So what will we do then? Select the UNSIGNED ZEROFILL attribute when creating/updating a field:

image

Its just as simple as defining a field in phpmyadmin. But this time make sure that the datatype is actually a number. By number I mean any of the data types below:

  • int, tinyint, small int, medium int, big int
  • float
  • double

Also make sure to specify the length carefully.

This will automatically prefix your number with leading zeroes once it is saved to your database:

image

 


Presentation layer

So you don’t actually plan on saving all those zeroes in your database. Instead, you want the user to actually see those zeroes. Because you’re actually in the process of making a program that requires the number to be prefixed with zeroes. Like that in the generating of official receipt number or any transactions which requires numbers to have zeroes on it.

You can make use of the built-in php function called str_pad. As the name suggests, it’s a function which adds any prefix or suffix to any value you supply on it.

So if you want to prefix the word ‘dog’ with the letter ‘V’, you would want to do something like this:

str_pad('dog', 8 'V', STR_PAD_LEFT);

Here’s the format:

str_pad(A, B, C, D);

Where:

  • A – the original string that would be prefixed/suffixed with whatever you want
  • B – Maximum length of the string that would be generated.
  • C – What you actually want to add as a prefix/suffix
  • D – Where you want to append the string. There are 3 possible places (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH)

 


The jquery way

There’s a function that I found on this site. You can go ahead an visit the site. Its pretty straightforward and awesome. The function works like the str_pad in php. You can make use of the function to actually format numbers or any string by appending something to it.

 

Conclusion

Okay, so that’s it for this tutorial. We learned how to use the zerofill attribute for mysql fields. Use php to append something to a string. And lastly we learned how to format a string using jquery from the site which I pointed out above.

How to enhance tables using jquery and css

Lately I have been posting all of this ‘how to articles’. Well, don’t leave me because there’s still more to come. And here comes another one of those.

This time I’m going to show you how you can enhance ordinary html tables using jquery and css. Here’s what were going to do:

  • Fetch records from a mysql table using php
  • Tabulate the fetched records
  • Add functionality to the generated table

 

Let’s go ahead and get started. It’s actually 11:29 PM, and I already want to sleep but there’s someone in the neighborhood who thinks its still morning that’s why I’m still up. Random fact: I don’t really like working late at night especially if I have already worked for 8 hours in the morning.

Requirements

 

Procedure

As usual, do the housekeeping. Prepare your working folder and place all the files you need. Link all the files that you need into the file that you’re going to work with.

PHP Files:

<?php
require_once('db_config.php');
?>

Stylesheets:

<link rel="stylesheet" href="tbl_sorter/themes/blue/style.css"/>
<link rel="stylesheet" href="tbl_sorter/themes/docs/jq.css"/>

And javascript files:

<script src="jq.js"></script>
<script src="jquery.tablesorter.min.js"></script>
<script src="tbl_sorter/addons/pager/jquery.tablesorter.pager.js"></script>

To be safe, just make sure that the jquery core is first to be linked. On the 2nd line we linked the tablesorter plugin. This will add a sorting functionality to the html table. On the 3rd line, we linked the table pager. This will add a pagination functionality to our table.

Next, generate the table using php:

<?php
$taxpayers = $db->get_results("SELECT * FROM tbl_taxpayers");
?>
<table id="test_tbl" class="tablesorter">
<thead>
	<tr>
	     <th>Taxpayer</th>
	     <th>Address</th>
	     <th>Type</th>
	</tr>
</thead>
<tbody>
	<?php
	foreach($taxpayers as $tp){
	?>
	<tr>
	     <td><?php echo $tp->strTaxpayer; ?></td>
	     <td><?php echo $tp->strTaxpayerAddress; ?></td>               <td><?php echo $tp->strTaxpayerType;?></td>
	</tr>
	<?php } ?>
</tbody>
</table>

As you can see, we are actually selecting all of the records from the table. This wouldn’t always be the best option. Especially if you want to add a search functionality to your table later on.

The output will actually look like this:

image

I wasn’t able to download the images for next, back, last , and first buttons that’s why it looks like that.The column with the darker blue header is an indicator that it’s the one being sorted. In this case in descending order.

 

Conclusion

That’s it for this tutorial. You learned how to add pagination, and sorting functionality to an ordinary html table generated from php.
Don’t forget to share this post if you find it useful.

Remember inputted data using jquery cookies

I know what brings you here.
But before that, here’s what were going to do here:

  • Setting up client-side cookies using jquery
  • Using cookies to automatically fill up a form

 

Requirements

 

I decided to ditch the assumptions and proceed with the procedures right away. I figured that most of you doesn’t actually read it.

 

Procedure

As usual, do the housekeeping. Include those 2 files I mentioned in the requirements.

<script src="jq.js"></script>
<script src="jquery.cookie.js"></script>

Create the form:

<form name="x" action="formcookie.php" method="post">
<p>
Remember input?
<input type="checkbox" name="rem" id="rem">
</p>
<p>
name:
<input type="text" name="name" id="name">
</p>
<p>
course:
<input type="text" name="course" id="course">
</p>
<input type="submit" id="btn_submit" value="save">
</form>

Nothing new here, I’m still bad at indenting the code properly. Please bear with me.
The code above is the form that we are going to use. As you can see it has a checkbox which the user can check in order to save his input into a cookie. And uncheck it to delete any existing cookie. That’s just a scenario of what it does, we didn’t actually wrote the code that does what I just said.

Next, write the usual thing to do when using jquery: Initialize elements on page load:

<script>
$(function(){
  //code goes here
});
</script>

Then we assign values to the name and course fields to be equal to the cookies that were going to declare shortly. You can actually check if those cookies exist before assigning it to the textfields. But I didn’t get any error on Firebug so I think this is just fine.

$('#name').val($.cookie('name'));
$('#course').val($.cookie('course'));

Right after the user has clicked on the submit button we want to execute something:

$('#btn_submit').click(function(){
  //something
});

You’re asking what’s something? Here’s the algorithm:

  1. check the if the checkbox is checked
  2. if checked assign the cookies
  3. if not clear the cookies

Next time the page loads: values are automatically assigned to the text fields if the cookies exists.

Okay, so here’s what goes as inside the btn_submit() function. Assign the values which are currently in the text fields into the variables name and course:

var name = $('#name').val();
var course = $('#course').val();

Also assign the status of the checkbox to a variable. The variable cook will have a value of true if the checkbox is checked and false if its not:

var cook = $('#rem').attr('checked');

That’s it! All that is left to do now is to write the code that will assign the cookie if the checkbox is checked. And the code that will clear the cookie if the checkbox isn’t checked:

if(cook == true){
    $.cookie('name', name);
    $.cookie('course', course);
}else{
    //clear cookies
    $.cookie('name', '');
    $.cookie('course', '');
}

 

Conclusion

You have just learned how to use the jquery cookies plugin to create client-side cookies. You can actually use this to add a remember me functionality on your login form or any other kind of form which needs to be automatically filled up based on user preferences.

How to generate mysql fields using php

Welcome to another quick tutorial.
In this tutorial I’m going to show you how to make a php program that can generate mysql fields.

To make this real quick, fire up wampserver and let’s get started!

Procedure

First you have to include your database configuration file on the file that you’re going to work with:

<?php
require_once('randomconfig.php');
?>

In case you don’t know, a database configuration file contains all the stuff needed to connect to your mysql database or any database that php supports. Go check out the basics at w3schools.com if you don’t have any idea what I’m talking about.

After that, go ahead and create the form that will serve as the interface where we are going to add our fields:

<form name="frm_fieldgen" action="genfield1.php" method="post">
    <label for="fieldname">Field:</label>
    <input type="text" id="fieldname" name="fieldname">
    <input type="submit" value="generate field">
</form>

Finally, let’s query the database to add another field into the table that we specified:

<?php
if(!empty($_POST)){

     $field = $_POST['fieldname'];
     $create_field = $db->query("ALTER TABLE tbl_roles ADD $field INT(1) NOT NULL");
}
?>

Of course, you can actually tweak the code above to make something like phpmyadmin. The popular database management application for wampserver users.

How to use html2pdf

In this tutorial..
I couldn’t really think of  a good introduction so bear with me if I’m back to using that boring introduction.
Anyway, here’s what you’re going to learn in this tutorial:

  • Basics of using html2pdf
  • Using css with html2pdf
  • Random stuff – things I found out while trying it on my sandbox/test folder

Html2pdf is a php class which you can use to generate reports or pdf files in your php application.
It’s pretty much like dompdf but I think its simpler and easier to learn. I already created 2 tutorials on dompdf before so if you want to learn how to use it, you can visit the links below:

How to use dompdf

How to use dompdf with css

 

Requirements

 

Assumptions

I assume that you already using php and css.

 

Procedure

As usual, you have to prepare your test folder and put all the files needed in this tutorial.

Next, include the html2pdf class in the file where you’re going to work:

require_once('html2pdf/html2pdf.class.php');

Then declare an object of the html2pdf class.

$html2pdf = new HTML2PDF('P', 'A4', 'en');

As you can see from the above code, it requires 3 arguments:

  • Orientation – page orientation is either landscape or portrait. The example above produces a pdf with the portrait orientation. If you want to produce a pdf in landscape orientation you can use ‘L’.
  • Page size – I don’t know much about this, but I think A4 is the most common.
  • Language – This is an optional argument, you might not as well include it.

 

Next is the actual generating of pdf. Here’s an example of placing an image into the pdf file. Always remember that the writeHTML function in html2pdf takes up 1 argument, and that is the html that you want to output in the pdf file.

$html2pdf->writeHTML("
		<img src=bin.png>
		");

Another is that you can actually use the same object, in this case the variable $html2pdf as many times as you want:

$html2pdf->writeHTML("
		<img src=bin.png>
		");
		
$html2pdf->writeHTML("
		<img src=search.png>
		");

The 2 images will get outputted. As you can see from the screenshot below. Although we can just lump those 2 images together in a single writeHTML() call. I just used it to emphasize that we can actually call the writeHTML() method as many times as we wish.

image

Finally, we specify the filename for the pdf file and render it on the screen:

$html2pdf->Output('random.pdf');

If the browser doesn’t have a pdf plugin, the filename that we specified here will be its filename.

 

Next, we will try to use the knowledge that we got so far to style and position things in the pdf just like a normal html. That is by using css:

$html2pdf->writeHTML("
<style>
	img{
	float:right;
	}
</style>
		
<img src=bin.png>
		");

$html2pdf->writeHTML("<img src=search.png>");

Now, try to guess the output…

I don’t really like taking screenshots in full sized images so here’s a minified version of the pdf rendered in Chrome:

image

Anything which comes after the css is getting styled. So if you try to do it the other way around. That is by placing the second image before the css. It will look like this:

image

You might have guessed but you can pretty much include any html. That includes forms:

image

That’s the output when I did something like this:

$html2pdf->writeHTML("
		
		<fieldset id=crow>
		<p>
		Firstname
		<input type=text name=fname>
		</p>
		<p>
		Course:
		<input type=text name=course>
		</p>
		<p>
		<input type=submit name=btn_submit value=submit>
		</p>
		</fieldset>
		
		");

That’s a really crappy form but you can always style it using css to make it look awesome.

 

Conclusion

I guess that’s it for this tutorial. If you want to learn more be sure to try things out on your own. I assure you that’s the best way to learn. Don’t just randomly copy code from the internet and call it a day.

How to use dompdf with css

I think its about time I create another tutorial on this awesome php library called dompdf.
For the sake of the innocent, dompdf is a php library used for generating… Surprise!
PDF documents using php.

So what the heck am I going to discuss in this article? What’s the relevance of this article?
To get you fired up, were going to create a sample page which has a sample table on it, then a print button and when the user clicks on it. A pdf file pops out of the browser.

So let’s go ahead and get started.

Requirements

  • Dompdf

Assumptions

I assume that you already know how to make use of css. Not the inline css, because that’s a thing of the past. I guess in the 90’s people used that. When I say css, were talking about this:

body{
   background-color:#CC10;
   font:14px Georgia, serif, calibri;
}

And this:

<link rel="stylesheet" href="external.css" type="text/css"/>

Oh,and definitely NOT this:

<th style="height:90px;">Some Header</th>

I also assume that you already know the basics of using dompdf, which I unfortunately tackled here:

How to use dompdf

Unfortunately because I believe that I had not explained the concept of output buffering and the whole dompdf thing in that article. So the article that you’re reading right now can be considered a remake. You can also visit the link above if you want.

And yes, I almost forgot that you must also know the basics of php and programming itself. Variables, echo, dollar signs, loops and every basic thing about php and programming that you can think of.

Procedure

First you have to prepare the table for all the food that were going to eat today.
Yup! I’m saying that you download dompdf, extract it, place it on a testing folder, then create 2 files.

  • One for viewing the output – this page will have the PRINT button on it.
  • Another for generating the pdf

After setting up all the necessary requirements…

Ooops, I guess that’s a little bit redundant, but never mind I’m a little energetic tonight(10:30pm) so please bear with me.
Go ahead and write your own css for the first page(view). But if you want to make your life easier, then just copy the one below.

<style type="text/css">
#btn_print{
	background:url(print.png) no-repeat;
	width:53px;
	height:23px;
	}
</style>

That’s an internal css. You can also make it external if you are the outgoing type.
And sorry if I disappointed you with that stylesheet. I just used it to put a background image on a link disguised as a button(don’t worry, you’ll know what I mean soon enough..)

Next, let’s create the array where we will fetch the data for our table later.

<?php
$x= array(array('name'=>'wern', 'age'=>10),array('name'=>'vongola','age'=>20),
array('name'=>'killua','age'=>30),array('name'=>'Lawliet','age'=>10),
array('name'=>'mikado ryugamine','age'=>15), array('name'=>'pikachu','age'=>50));
?>

When I make tutorials like this, I see to it that I don’t make much effort on naming things. Just like that $x variable. And all the names in the array are anime characters except the wern because that’s my name.

After that, start buffering the output. Any code whether html, php or css which comes after the code below are being stored somewhere I do not know. What’s important is that it is stored with all the format, the markup and everything.

<?php ob_start(); ?>

Then create the header for the table:

<tr>
     <th>Name</th>
     <th>Age</th>
</tr>

Yup, I didn’t include the table tag on purpose just to make sure that the output of those who just copy paste ain’t gonna work.

After that, go ahead and loop through the array that we created a while ago.

foreach($x as $y){
//output
}

That’s yet another incomplete code. Its just basic so go figure out how to do it before you continue.

Then call the ob_get_contents() function that’s built in to php. This function gets all the content that was stored in the ob_start() function. In other words, every single markup, css that came right after calling the ob_start() function. I still haven’t tested if this function also buffers the all the markups (html) that are enclosed in if or switch statement. You go try it out yourself and comment what you got in this post.

<?php
   $out = ob_get_contents();
   ob_end_flush();
?>

After that, you can put the buffered contents on a session array or a cookie. For this tutorial were going to make use of a session even if cookies sounds more delicious.

<?php
   $_SESSION['prints'] = array('table'=>$out);
?>

What we just did is to assign the $out variable which has all the buffered contents, into a session array item called ‘table’. Its important that you remember the name of the session because were going to need it later on. If you’ve not yet decided, the name of the session here is ‘prints’.

You can close the file that you’re working on for a while or just leave it as it is (if you’re not using notepad). Because were gonna work on the SECOND FILE now.

First, do the housekeeping:

require_once("dompdf/dompdf_config.inc.php");
$dompdf = new DOMPDF();

Include the dompdf class into your current file, then initialize the dompdf class by creating an object. The name of the object is not necessarily $dompdf, you can use $puke if you want. Ooops, sorry if you’re eating while reading this.

Then assign the contents of the table session to a variable.

$tbl = $_SESSION['prints']['table'];

Then buffer the current page:

<?php ob_start(); ?>

Put some css:

<style type="text/css">
* {
  margin:0; padding:0;
}
body{
  font:14px Georgia, serif;
}

#page-wrap{
  width:600px;
  margin: 0 auto;
}

table{
   border-collapse: collapse; width: 100%;
}

td{
   border:1px solid #ccc; padding:10px;
}

thead{
   width:100%;position:fixed;
   height:109px;
}
</style>

This really got me on my first try, I didn’t buffer the css along with the html, that’s why the output was a pure html pdf file. Oh and don’t get confuse with the pure html pdf file. It just means that it’s a pdf file without any styling or anything fancy formatting on it.

Then output the contents buffered from the first file that we created:

<?php
  echo $tbl;
?>

Finally, get the buffered contents again. It’s still the same markup we just added a css into it:

<?php
  $out = ob_get_contents();
  ob_end_flush();
?>

Don’t forget the ob_end_flush() function. If I’m not mistaken it’s the function that clears the cache for the output that has been buffered. We don’t need it since we already assigned it to the variable $out.

Okay, so here’s a little function that I created to generate pdf’s:

function generate_pdf($filename){
	global $dompdf;

	$dompdf->load_html(file_get_contents($filename));
	$dompdf->render();
	$dompdf->stream($filename. ".pdf", array("Attachment" => 0));
}

Remember that in every function, whether its  a function declared inside a class or just a plain function in your good old php written in procedural form. You always have to put the word global right before an object of a class. In this case the $dompdf object.

Finally, go ahead and do the last 2 steps. First, put the contents of the $out variable into a file called styled.html

file_put_contents('styled.html', $out);

After that, just call up the function that generates a pdf file from the html file that we just generated.

generate_pdf('styled.html');

Of course, you can be creative and put the current time as the suffix for the filename. But I’m not going to show it here since I also don’t know how to do that.

Shortcut

If you still haven’t noticed. We can actually strip down the process by directly converting the buffered contents into pdf. To cut things really short, here’s what you need in the most basic level:

<?php
require_once("dompdf/dompdf_config.inc.php");
$dompdf = new DOMPDF();
date_default_timezone_set('Asia/Manila');
$tym = date('g:i s');
$filename = 'print'.$tym;
$dompdf->load_html($_SESSION['prints']['table']);

$dompdf->render();
$dompdf->stream($filename. ".pdf", array("Attachment" => 0));
?>

The code above just showed you the answer for the question a while ago. Appending the current time to the filename of the pdf that will be generated.

We then loaded the html from the ‘prints’ session that we created a while ago.

Then we called the render() function from the dompdf class. This will render the html into pdf. By the time you call this function a pdf file already exist somewhere I don’t know, maybe the browser cache, a temporary folder in the server(wampserver if you’re on windows) or anywhere else.

Lastly, we called the stream() function. This will pop out the pdf file into the users face. It takes two arguments: the filename for the file, you also have to place the file extension which is pdf. The second argument is the option, the one above does not force the browser to open a download dialog box(I don’t know the actual name so bear with me). If you place 1 as the value for the attachment, it does the exact opposite.

Conclusion

That’s it! I guess this tutorial has already taken too long for you to be bored to death. As always, I hope that you learned something. Here’s a summary of what we did here:

  • Using output buffering in php
  • Generating html file from the data stored by the ob_start() function
  • Generating pdf from an html file
  • Generating pdf directly from the buffered output or html

Don’t forget to comment if you don’t understand something. Or if you have any suggestions.