Tuesday, January 11, 2011

PHP list directory and files permission

SkyHi @ Tuesday, January 11, 2011
<?php
$dir = '/var/www/html/test3/';
$dirperm = substr(sprintf('%o', fileperms("$dir")), -4);
if ($handle = opendir("$dir")) {
    echo "Directory handle: " . '<br / >';
    echo $dirperm . ' ' .  $dir . '<br / >';
    echo "Files:" . '<br / >';

    /* This is the correct way to loop over the directory. */
    while (false !== ($file = readdir($handle))) {
                if ($file != "." && $file != "..") {
                        $filelink = "<a href=\"$file\">$file</a>";
                        echo substr(sprintf('%o', fileperms("$file")), -4). ' ' . $filelink . '<br / >';
                }
    }
closedir($handle);
}

?>


OUTPUT:

Directory handle:
2755 /var/www/html/test3/
Files:
0644 perm2.php
0644 getelementby4.html
0644 getelementbytag.html

REFERENCES
http://php.net/manual/en/function.readdir.php
http://php.net/manual/en/function.fileperms.php

Monday, January 10, 2011

Triple Boot: Mac OSX, Windows, and Ubuntu

SkyHi @ Monday, January 10, 2011
REFERENCES
https://help.ubuntu.com/community/MactelSupportTeam/AppleIntelInstallation

Read/Write on Mac OSx partition from Ubuntu

SkyHi @ Monday, January 10, 2011
After dual booting with Ubuntu and Mac OS, I could not write on Mac OS partition. However, I must have to find a way to do that as I will move certain things to ext3 partitions to be seamlessly usable by Ubuntu.

While reading online, somewhere I have read that I will need to disable journaling in Mac OS partition to mount it on Ubuntu with writing permission. I wanted to do the same but I saw the Enable/Disable Journaling button is not enabled in Disk Utility. So, after searching I found a command to do that from command line. It is simple.

# diskutil disableJournal /Volumes/Macintosh HD
That’s it. It disabled journaling on that partition. Later on Ubuntu I mounted the drive and I could write on it.

More Info:

Mounting the partition on Ubuntu

sudo mount -t hfsplus /dev/sda2 /media/mac

REFERENCES
http://hungrycoder.xenexbd.com/tutorial/readwrite-on-mac-osx-partition-from-ubuntu.html
http://superuser.com/questions/84446/how-to-mount-a-hfs-partition-in-ubuntu-as-read-write

What is a CAM, R5, DVDRip, DVDSCR, XviD…?

SkyHi @ Monday, January 10, 2011
CAM

A cam is a theater rip usually done with a digital video camera. A mini tripod is sometimes used, but a lot of the time this wont be possible, so the camera make shake. Also seating placement isn’t always idle, and it might be filmed from an angle. If cropped properly, this is hard to tell unless there’s text on the screen, but a lot of times these are left with triangular borders on the top and bottom of the screen. Sound is taken from the onboard microphone of the camera, and especially in comedies, laughter can often be heard during the film. Due to these factors picture and sound quality are usually quite poor, but sometimes we’re lucky, and the theater will be fairly empty and a fairly clear signal will be heard.

TELESYNC (TS)

A telesync is the same spec as a CAM except it uses an external audio source (most likely an audio jack in the chair for hard of hearing people). A direct audio source does not ensure a good quality audio source, as a lot of background noise can interfere. A lot of the times a telesync is filmed in an empty cinema or from the projection booth with a professional camera, giving a better picture quality. Quality ranges drastically, check the sample before downloading the full release. A high percentage of Telesyncs are CAMs that have been mislabeled.

TELECINE (TC)

A telecine machine copies the film digitally from the reels. Sound and picture should be very good, but due to the equipment involved and cost telecines are fairly uncommon. Generally the film will be in correct aspect ratio, although 4:3 telecines have existed. A great example is the JURASSIC PARK 3 TC done last year. TC should not be confused with TimeCode , which is a visible counter on screen throughout the film

SCREENER (SCR)

A pre VHS tape, sent to rental stores, and various other places for promotional use. A screener is supplied on a VHS tape, and is usually in a 4:3 (full screen) a/r, although letterboxed screeners are sometimes found. The main draw back is a “ticker” (a message that scrolls past at the bottom of the screen, with the copyright and anti-copy telephone number). Also, if the tape contains any serial numbers, or any other markings that could lead to the source of the tape, these will have to be blocked, usually with a black mark over the section. This is sometimes only for a few seconds, but unfortunately on some copies this will last for the entire film, and some can be quite big. Depending on the equipment used, screener quality can range from excellent if done from a MASTER copy, to very poor if done on an old VHS recorder thru poor capture equipment on a copied tape. Most screeners are transferred to VCD, but a few attempts at SVCD have occurred, some looking better than others.


DVD-SCREENER (DVDscr)

Same premise as a screener, but transferred off a DVD. Usually letterbox , but without the extras that a DVD retail would contain. The ticker is not usually in the black bars, and will disrupt the viewing. If the ripper has any skill, a DVDscr should be very good. Usually transferred to SVCD or DivX/XviD.


DVDRip

A copy of the final released DVD. If possible this is released PRE retail (for example, Star Wars episode 2) again, should be excellent quality. DVDrips are released in SVCD and DivX/XviD.


VHSRip

Transferred off a retail VHS, mainly skating/sports videos and XXX releases.


TVRip

TV episode that is either from Network (capped using digital cable/satellite boxes are preferable) or PRE-AIR from satellite feeds sending the program around to networks a few days earlier (do not contain “dogs” but sometimes have flickers etc) Some programs such as WWF Raw Is War contain extra parts, and the “dark matches” and camera/commentary tests are included on the rips. PDTV is capped from a digital TV PCI card, generally giving the best results, and groups tend to release in SVCD for these. VCD/SVCD/DivX/XviD rips are all supported by the TV scene.


WORKPRINT (WP)

A workprint is a copy of the film that has not been finished. It can be missing scenes, music, and quality can range from excellent to very poor. Some WPs are very different from the final print (Men In Black is missing all the aliens, and has actors in their places) and others can contain extra scenes (Jay and Silent Bob) . WPs can be nice additions to the collection once a good quality final has been obtained.


DivX Re-Enc

A DivX re-enc is a film that has been taken from its original VCD source, and re-encoded into a small DivX file. Most commonly found on file sharers, these are usually labeled something like Film.Name.Group(1of2) etc. Common groups are SMR and TND. These aren’t really worth downloading, unless you’re that unsure about a film u only want a 200mb copy of it. Generally avoid.


Watermarks

A lot of films come from Asian Silvers/PDVD (see below) and these are tagged by the people responsible. Usually with a letter/initials or a little logo, generally in one of the corners. Most famous are the “Z” “A” and “Globe” watermarks.


Asian Silvers / PDVD

These are films put out by eastern bootleggers, and these are usually bought by some groups to put out as their own. Silvers are very cheap and easily available.


R5

R5 refers to a specific format of DVD released in DVD Region 5, the former Soviet Union, and bootlegged copies of these releases that are distributed on the Internet. In an effort to compete with movie piracy, the movie industry chose to create a new format for DVD releases that could be produced more quickly and less expensively than traditional DVD releases. R5 releases differ from normal releases in that they are a direct Telecine transfer of the film without any of the image processing common on DVD releases, and without any special features. This allows the film to be released for sale at the same time that DVD Screeners are released. Since DVD Screeners are the chief source of high-quality pirated movies, this allows the movie studios to beat the pirates to market. In some cases, R5 DVDs may be released without an English audio track, requiring pirates to use the direct line audio from the film’s theatrical release. In this case, the pirated release is tagged with “.LINE” to distinguish it from a release with a DVD audio track.


The image quality of an R5 release is generally comparable to a DVD Screener release, except without the added scrolling text and black and white scenes that serve to distinguish screeners from commercial DVD releases. The quality is better than Telecine transfers produced by movie pirates because the transfer is performed usingprofessional-grade film scanning equipment.


Because there is no scene release standard for pirated R5 releases, they were variably tagged as Telecines, DVD Screeners, or even DVD rips. In late 2006, several release groups such as DREAMLiGHT, mVs, and PUKKA began tagging R5 releases with “.R5″ or r5 line (the line meaning it has direct english line audio) and suggesting that other groups do the same.


VCD

VCD is an mpeg1 based format, with a constant bitrate of 1150kbit at a resolution of 352×240 (NTCS). VCDs are generally used for lower quality transfers (CAM/TS/TC/Screener(VHS)/TVrip(analogue) in order to make smaller file sizes, and fit as much on a single disc as possible. Both VCDs and SVCDs are timed in minutes, rather than MB, so when looking at an mpeg, it may appear larger than the disc capacity, and in reality u can fit 74min on a CDR74.


SVCD

SVCD is an mpeg2 based (same as DVD) which allows variable bit-rates of up to 2500kbits at a resolution of 480×480 (NTSC) which is then decompressed into a 4:3 aspect ratio when played back. Due to the variable bit-rate, the length you can fit on a single CDR is not fixed, but generally between 35-60 Mins are the most common. To get a better SVCD encode using variable bit-rates, it is important to use multiple “passes”. this takes a lot longer, but the results are far clearer.


XVCD/XSVCD

These are basically VCD/SVCD that don’t obey the “rules”. They are both capable of much higher resolutions and bit-rates, but it all depends on the player to whether the disc can be played. X(S)VCD are total non-standards, and are usually for home-ripping by people who don’t intend to release them.


DivX / XviD

XviD & DivX are the most commonly encoded movies. DivX used to be the most popular, until it went from open source to a corporation that bought the rights & started charging for it (although the crack can easily be obtained for the DivX encoder, most people have switched to XviD, not only because it is open source, but also because it is superior in many ways). In the last year or so, many stand-alone DVD players have been released that are capable of playing DivX/XviD movies (even on CDRs), which has made this the most popular form of encoding. The majority of XviD/DivX rips are taken from DVDs, and are generally in as good quality as possible that can fit on one 700MB CDR disc, which is why most XviD/DivX movies are almost exactly 700MB, so they can be burnt onto a CDR & played in these new DVD players (which can be purchased just about anywhere for as little as $30-$40 USD). Various codecs exist, the most popular at the moment being the new XviD 1.2 codec. DivX encoded movies will definitely play on these new DVD players, & it only takes a little simple tweaking by the ripper to ensure XviDs will play on them as well, but it is therefore not guaranteed. (If you want to learn more about XviD/DivX encoding so you can make your own DVDrips, just visit doom9.org)


x264

x264 is a free software library for encoding H.264/MPEG-4 AVC video streams. (More to come.)


CVD

CVD is a combination of VCD and SVCD formats, and is generally supported by a majority of DVD players. It supports MPEG2 bit-rates of SVCD, but uses a resolution of 352×480(ntsc) as the horizontal resolution is generally less important. Currently no groups release in CVD.


DVD-R

Is the recordable DVD solution that seems to be the most popular (out of DVD-RAM, DVD-R and DVD+R). it holds 4.7gb of data per side, and double sided discs are available, so discs can hold nearly 10gb in some circumstances. SVCD mpeg2 images must be converted before they can be burnt to DVD-R and played successfully. DVD>DVDR copies are possible, but sometimes extras/languages have to be removed to stick within the available 4.7gb.


MiniDVD

MiniDVD/cDVD is the same format as DVD but on a standard CDR/CDRW. Because of the high resolution/bit-rates, its only possible to fit about 18-21 mins of footage per disc, and the format is only compatible with a few players.

REFERENCES



How to share an internet connection on LAN?

SkyHi @ Monday, January 10, 2011
If you have a fully functional LAN then net sharing is few click away, yes few clicks. I assumed that you have already a broadband connection and account configured on your PC. Just go to “My Network Places” properties, and then select your broadband connection. Now right click on it and select properties. Now broadband properties dialog box should be appear. Here select “Advanced” tab.

Broadband Connection properties selection.


Now check “Allow other network users to connect through this computer" internet connection” and uncheck below two options. Now press “OK” button. This will give you a message stating that IP address of present working PC will be set to “192.168.0.1”, click OK. If you assigned this address to any other computer then change it to something else otherwise it will give IP address conflict error.

Broadband Connection properties.

Now a hand like icon should appear below the broadband connection, indicating that it has been shared.

Broadband Connection after sucessful sharing.

Go to other PC, select “My Network Places” properties, and then select your LAN connection. Now right click on it and select properties. Now LAN properties dialog box should be appear. Here select “Internet Protocol (TCP/IP)” as did during IP address assignment. Now click properties button,” Internet Protocol (TCP/IP) properties” dialog should appear. Here you need to give the “Default Gateway” and “DNS Server” IP as shown in the image. Repeat this step on other PCs too.

Default gateway & DNS server IP assigning.

Connect the internet on server PC where internet connection is physically attached, then try to access internet on other PC. If you see the positive results then Congrats! Else;
Check LAN connection. If you can access Shared Folders then follow next step else you need to check internet sharing from beginning.

You need to check your internet connection again. Try this, press window key + R, now type this without quotes “ping www.google.com -t”. If you get reply as given in below image then net sharing is OK your internet browser corrupted or internet browser setting changed to use proxy address. Please off all proxy address. Now you should able to browse.

Internet connection ping result.



REFERENCEShttp://hubpages.com/hub/How-to-share-an-internet-connection-on-LAN

Connect two computers using a crossover cable

SkyHi @ Monday, January 10, 2011
If you need to connect two computers but you don't have access to a network and can't set up an ad hoc network, you can use an Ethernet crossover cable to create a direct cable connection.
Generally speaking, a crossover cable is constructed by reversing ("crossing over") the order of the wires inside so that it can connect two computers directly. A crossover cable looks almost exactly like a regular Ethernet cable (a "straight-through" cable), so make sure you have a crossover cable before following these steps.
Before buying a crossover cable, check your network adapter. Some newer network adapters automatically "cross over" when they detect that they are connected directly to another network adapter using a regular Ethernet cable.

To connect two computers with a crossover cable

This works best if both computers are running this version of Windows.
  1. Plug each end of the crossover cable into a network port on the back of each computer.
  2. On one of the computers that is running this version of Windows, do the following:
    Open Network and Sharing Center by clicking the Start button Picture of the Start button, clicking Control Panel, clicking Network and Internet, and then clicking Network and Sharing Center.
  3. In the network map at the top of Network and Sharing Center, double-click the Unidentified network‍ icon. (If you have more than one network, this icon will be labeled Multiple networks.)
  4. If network discovery and file sharing are turned off, in Network, click the Information bar containing the following message: "Network discovery and file sharing are turned off. Network computers and devices are not visible. Click to change...," and then click Turn on network discovery and file sharing. Administrator permission required If you are prompted for an administrator password or confirmation, type the password or provide confirmation.
  5. In the Network discovery and file sharing dialog box, select one of the following options:
    • No, make the network that I am connected to a private network
    • Yes, turn on network discovery and file sharing for all public networks
    The first option is usually the best choice because it only affects the network that you are connected to.
Notes

Notes

  • Networks created with crossover cables are automatically set up as "Public place" networks, which means that network discovery, file sharing, and printer sharing are off by default.
  • For Gigabit Ethernet or token ring networks, you will need a slightly different kind of crossover cable. For more information, contact a cable manufacturer.
Icons for both computers should now be visible in the Network window. Double-click each computer icon to share printers and other resources.
Note

Note

If one of the computers is running Windows XP, it can take some time for that computer to appear in the Network window. You might need to move both computers to the same workgroup. You can do that by changing the workgroup on either computer. To change a workgroup, see Join or create a workgroup. You might also need to turn on file and printer sharing on the computer running Windows XP


REFERENCES