ManyCodes.com – codes & scripts Get free programming codes and tutorials!

6Aug/091

How to Create a Cydia Repository for the iphone

A Cydia Repository which is much like an Installer source, is also a way to host your own files, like applications, themes, and wallpapers on Cydia. Cydia is the unofficial application distribution app for jailbroken iPhones and iPod touches for applications that could not make it to the official app store managed and run by apple.

Now this is a guide on creating your own repository for cydia, and no, you don't need a website of your own to do it! Note that while the screenshots within this guide were taken on a Mac, you can easily follow this tutorial with Debian (see "What's Needed if you have no idea what the heck I'm talking about).

Important: There are steps in the guide where I'll instruct you to copy text from this page into a Text Editor and into Terminal. Unfortunately, due to this forum's restrictions on the number of images allowed within a post (6), I had to convert about 90% of the guide into one big image, so you'll have to manually type the text in. Sorry about that.

Also, you may have already seen that this guide is pretty long. Don't get scared and decide not to try; it's only long because I wanted to make it as detailed as possible. Doing this is not as hard as it looks.

First off, check out the EverythingiCafe Cydia Repository before you create your own. If all you want is a place to host your files, we'll host your stuff for you. If you want your own repository, carry on.

What's Needed
• Internet Access
• Basic Text Editor
• Either a Virtual Machine with Debian installed, a computer
running Debian, or a Mac with Fink installed.
• Either a website of your own or a free sub-domain with FTP access (Your own website is recommended, but if you're going to use the latter of the two, I suggest using 110mb.com.)

Here is tutorial for how to create a cydia repository for iphone: http://kttns.org/nmuym

6Aug/090

How to Run as Administrator in Vista Command Line?

Recently I wanted to do some actions in Windows Vista command line prompt but with elevated access as an Administrator. You may need this access to do actions like creating symbolic links etc.

So, how to run as administrator in Vista command line?

The easiest way is to use the type cmd in the Vista Start Run box and use the keyboard shortcut Ctrl + Shift + Enter instead of just pressing Enter. This will open the Command Prompt in Administrator mode.

cmd in Vista

You can also right click cmd.exe and click Run as Administrator.

cmd as administrator in Vista

Command Prompt with Administrator access in Windows Vista.

Run Vista Command Prompt as Adminstrator

On the other hand, you can also activate Administrator account in Vista, so that you can login from welcome screen.

6Aug/090

How to 301 Redirect Non-WWW to WWW URLs

Search engines consider http://manycodes.com and http://www.manycodes.com different websites. As a result, if your website has been linked to from other websites using a mix of the two URLs you are effectively splitting the potential benefit of valuable link popularity.

The Solution
Using a 301 redirect on the “non-www” version of the URL, which is essentially a “permanent” redirect in server talk, you can effectively consolidate all of your link popularity to a single URL. This consolidation will serve to increase your website’s chances of obtaining and maintaining top rankings.

How To Enable The 301 Redirect

You need to instruct the server you are hosting your website on to redirect the traffic seamlessly. To do this you need to first establish what type of server your website is hosted on. There are two main types of servers that are in use: Microsoft and Apache (Linux/Unix). Once you have established the server type you need to follow their related instructions below. Please note this is best left to a person with some technical knowledge.


A) Installing the Non-WWW 301 Redirect on a Apache Server

  1. Ensure that your hosting provider has the Apache Rewrite Module turned on; this is a definite requirement for this fix to work. In most cases your hosting provider will not have a problem enabling the module if it isn’t already enabled (it seems to be on in most circumstances).If you have access to the httpd.conf file on your server then you can actually enable the module yourself. Open the httpd.conf file, back it up somewhere in case of error (you cannot be too safe) and then uncomment the following line:LoadModule rewrite_module modules/mod_rewrite.soOnce the line is uncommented, save the file and restart the server then proceed with the following steps.
  2. Download the .htaccess file from your website’s root web folder to a folder on your machine where you can edit it.
  3. Make a copy of the .htaccess file and save it somewhere else for safe keeping in case you need to revert to the old version – do not edit this version.
  4. Open the original .htaccess you downloaded in Notepad
  5. Add the following code (in red) into the .htaccess file. Be sure to substitute “example.com” with your own website information but touch nothing else.RewriteEngine On
    RewriteCond %{HTTP_HOST} ^example.com
    RewriteRule (.*) http://www.example.com/$1 [R=301,L]
  6. Upload the file back to your website in the exact same place you downloaded it.
  7. Once the upload is complete open a browser and try visiting the “non-www” version of your website address. If the .htaccess is working as it should you will be redirected immediately to the proper “www” version of your website. This will be reflected in your browser’s address bar.
  8. To be 100% certain this has worked appropriately I suggest visiting this URL and typing in your “non-www” website address into the HTTP Server Header Checker. This tool will show you whether the 301 redirect is being provided by the server. This is what a search engine will see when it visits the site. The result should look like the following areas in red:
    #1 Server Response: http://example.com
    HTTP Status Code: HTTP/1.1 301 Moved Permanently

    Date: Wed, 14 Mar 2007 22:49:28 GMT
    Server: Apache/1.3.27 (Unix) PHP/4.4.1 FrontPage/5.0.2.2510 mod_ssl/2.8.14 OpenSSL/0.9.6b
    Location: http://www.example.com/
    Connection: close
    Content-Type: text/html; charset=iso-8859-1
    Redirect Target: http://www.example.com/#2 Server Response: http://www.example.com/
    HTTP Status Code: HTTP/1.1 200 OK

    Date: Wed, 14 Mar 2007 22:49:28 GMT
    Server: Apache/1.3.27 (Unix) PHP/4.4.1 FrontPage/5.0.2.2510 mod_ssl/2.8.14 OpenSSL/0.9.6b
    Connection: close
    Content-Type: text/html
  9. If the redirect worked you are done! Congratulations.If this has not worked you need to restore the backup you made of the .htaccess file to your website. After the backup is restored go back and review the revised .htaccess on your computer, compare the information to the instructions above and make sure there were no mistakes. If no mistakes are found your server may require custom programming which is beyond the scope of this FAQ; please contact your hosting provider for more information.

B) Installing the Non-WWW 301 Redirect on a Microsoft IIS Server

Microsoft servers do not have a .htaccess file to alter so we suggest that you contact your hosting provider and request they make this change for you. If they are baffled or need further instructions on how to make the changes you can refer them to the tutorials referenced below:

  1. Using Internet Services Manager create a new IP-based website using the http://example.com URL or alternatively you can avoid using a unique IP by using the host header (virtual website) of www.example.com.
  2. Now verify the server headers for each website using the Server Header Checker. The server response should be 200 OK for both addresses.
  3. Now add your domain-revised version of the following ASP code to the default home page for http://example.com:< %@ Language=VBScript %>
    < %
    Response.Status=”301 Moved Permanently”
    Response.AddHeader “Location”, http://www.example.com
    %>
    Note: do not change the spacing or line placement within the above code; place it as is.
  4. Once the default page is online first visit your website via http://example.com to ensure the redirect is working. Next check the server headers for http://example.com and make sure you see the following code within #1: “HTTP Status Code: HTTP/1.1 301 Moved Permanently”. That code will confirm the 301 redirect is being properly communicated.
6Aug/092

How to enable mod_rewrite in apache 2.2 in Debian and Ubuntu

I am going to describe how to enable mod_rewrite in apache2.2 - specaily for debian.

In default installion of apache2.2 on debian never enable mod_rewrite default. So you may need to enable.

debian user please use “su” before start this process
ubuntu user please use “sudo su” before start this process

  1. First install the apache2.2 with this command :
apt-get install apache2

(it will install apache 2.2)

now use locate to find if the mod_rewrite.so is availble on your server

updatedb
 locate mod_rewrite.so

it will found in “/usr/lib/apache2/modules”

new apache follow some folders to enable and desuable mods.
so now do this:

cd /etc/apache2/mods-enabled
 touch rewrite.load
 gedit rewrite.load

(you may use any editor to edit this file)

now paste this following line

LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so

Then edit /etc/apache2/sites-available/000-default

Find the following

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

and change it to

Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all

and finally restart Apache

/etc/init.d/apache2 restart

OK, you done :D

Don’t forget to comment, if it works or not.

5Aug/093

Stop the Auto Play Pop Up When You Plug In Your iPhone or iPod Touch to a Windows XP Computer

Every single time I plug in my iPhone to my Windows XP computer I get a pop up window asking how I want to handle the images from the iPhone. The most annoying part of this is there is no way from that pop up to tell the computer that you don’t want to be asked every single time. The good news is that it is really easy to tell your computer you do not want to be asked every single time. Follow the instructions below to turn off the pop up every time you plug in your iPhone to your Windows XP computer.

iPhone Pop Up on Windows XP:

iPhone Camera Auto Play Pop Up

Windows XP: Disable Auto Play Pop Up for iPhone

  1. Plug In iPhone:First make sure your iPhone or iPod Touch is plugged into your computer and finished syncing with your iTunes.
  2. Open Control Panel:First open your control panl by clicking on the Start menu and selecting Control Panel from the pop up navigation. A view of the control panel is shown below.

    Windows XP Control Panel

  3. Open Scanners and Cameras: Now double click on the “Scanners and Cameras” link to open a list of the scanners and cameras currently connected to your computer.

    XP Control Panel: Scanners and Cameras

  4. iPhone Camera Properties: Right click on the iPhone in the list of Scanners and Cameras to display a menu as shown below.

    iPhone Camera Properties Menu

    Select Properties from the menu to open the iPhone camera properties configuration window as shown below.

    Windows XP: iPhone Camera Properties

  5. Modify iPhone Camera Events: Click on the Events tab in the iPhone camera properties configuration window as shown below.

    iPhone Camera Auto Play Event

    Select the “Take no action” radial and then click the Apply button to save. OK out of this configuration window and close the Control Panel.

  6. Verify No Pop Up: Now unplug your iPhone and plug it in again to trigger the synchronization process with iTunes. You should no longer receive a pop up from the Windows Auto Play feature.

Now you can plug your iPhone into your Windows XP computer without having to close out the Auto Play prompt every time.

5Aug/090

How to Check Bios Version on a Dell Laptop

There are two easy ways to check the bios version on your Dell laptop.

  1. During Boot: When your laptop boots up the bios version will splash on the screen. A current version of your bios will be something similar to A06.
  2. CPU-Z: Download and run CPU-Z here. Once you download and run this application click on the Mainboard tab which has a BIOS section.

Once you know the bios version you can check Dell’s web site to see if a newer version is available. If a new version is available installing it can resolve possible bugs with your computer.

Filed under: Linux No Comments
5Aug/090

Get the BIOS Version for Windows XP Computer

Getting the BIOS version for a Windows XP PC is easy using the Registry Editor. You will need to start up the Registry Editor and then drill down into the Registry to locate your BIOS version.

  1. Start Windows Registry:Click the Windows Start button followed by Run. Type in “regedit” and click the OK button. This will launch the Windows Registry Editor.
  2. Drill Down to System: Now use the tree menu to expand the following items - HKEY_LOCAL_MACHINE >> HARDWARE >> System. Highlight System which will provide system hardware information.
  3. Read System Variable:There will be variables/settings in the right window once you have highlighted System in the tree menu. One of these items is SystemBiosVersion which will provide the details of your BIOS. Currently my BIOS reads as shown below in the image.

    Windows Registry - HKEY_LOCAL_MACHINE + HARDWARE + System

As you can see in the image above my current BIOS version is 1.10 A07 on a Dell computer. You should always check to see if a BIOS upgrade has been released by your PC manufacturer such as Dell or HP. Upgrading the BIOS can resolve issues with your computer.

5Aug/091

Install the Latest PostgreSQL Yum Repository for CentOS

Keeping PostgreSQL updated via yum should be done via the pgdg yum repository supplied by pgsqlrpms.org.

The latest CentOS PostgreSQL repo can be viewed here.

You will need to download the repo and then install using rpm as shown below.

wget http://yum.pgsqlrpms.org/reporpms/8.4/pgdg-centos-8.4-1.noarch.rpm</span></div>
<div style="width: 506px;">rpm<span> -Uhv</span><span> pgdg-centos-8.4-1.noarch.rpm

wget http://yum.pgsqlrpms.org/reporpms/8.4/pgdg-centos-8.4-1.noarch.rpm
rpm -Uhv pgdg-centos-8.4-1.noarch.rpm

Another helpful postgresql install and management link is located here.

5Aug/090

How to Install the Latest git on CentOS 5 from Source

To install the latest git on CentOS 5 you will need to install from source since the yum repos are typically fairly far behind. Follow the instructions below and installing git will be a snap.

  1. Install Dependencies: First we need to install a couple packages via yum to cover the dependencies for building git from source.
  2. [root@server ~]#yum install curl-devel
    [root@server ~]#yum install expat-devel
    [root@server ~]#yum install gettext-devel
    [root@server ~]#yum install openssl-devel
    [root@server ~]#yum install zlib-devel 
[root@server ~]#yum install curl-devel
[root@server ~]#yum install expat-devel
[root@server ~]#yum install gettext-devel
[root@server ~]#yum install openssl-devel
[root@server ~]#yum install zlib-devel
  • Download git Source: Now download the git source by issuing the below command. Verify the latest source here.
  • [root@server ~]#cd /usr/local/src
    [root@server ~]# wget http://www.kernel.org/pub/software/scm/git/git-1.6.0.4.tar.gz
    

    [root@server ~]#cd /usr/local/src
    [root@server ~]# wget http://www.kernel.org/pub/software/scm/git/git-1.6.0.4.tar.gz
  • Build Source:Unpack the file that has been downloaded and compile the source using the “make” command.
  • [root@server ~]#tar -zxvf git-1.6.0.4.tar.gz
    [root@server ~]#cd git-1.6.0.4
    [root@server ~]#make prefix=/usr/local all
    
    [root@server ~]#tar -zxvf git-1.6.0.4.tar.gz
    [root@server ~]#cd git-1.6.0.4
    [root@server ~]#make prefix=/usr/local all
  • Install git: After successfully compiling the source you need to install git.
  • [root@server ~]#make prefix=/usr/local/ install
    
    [root@server ~]#make prefix=/usr/local/ install
  • Download git Manpages:Now let’s download the manpages. Verify the latest manpages here.
  • [root@server ~]#cd /usr/local/src
    [root@server ~]#wget http://www.kernel.org/pub/software/scm/git/git-manpages-1.6.0.4.tar.gz
    [root@server ~]#cd /usr/local/src
    [root@server ~]#wget http://www.kernel.org/pub/software/scm/git/git-manpages-1.6.0.4.tar.gz
  • Install git Manpages:Now change into the share directory and unpack the git manpages.
  • [root@server ~]#cd /usr/local/share/man
    [root@server ~]#tar -zxvf /usr/local/src/git-manpages-1.6.0.4.tar.gz
    
    [root@server ~]#cd /usr/local/share/man
    [root@server ~]#tar -zxvf /usr/local/src/git-manpages-1.6.0.4.tar.gz
  • Verify:Lets verify that git was installed successfully and the manpages are working properly.
  • [root@server ~]#git --version
    [root@server ~]#man git
    
    [root@server ~]#git --version
    [root@server ~]#man git

    After following the above steps you should be able to successfully use git.

    [root@server ~]#yum install curl-devel
    [root@server ~]#yum install expat-devel
    [root@server ~]#yum install gettext-devel
    [root@server ~]#yum install openssl-devel
    [root@server ~]#yum install zlib-devel

    5Aug/090

    Install istat On a CentOS Linux to Monitor Server from iPhone or Touch

    The istat application is a monitoring application that can be used to obtain basic Linux server information from your iPhone or iPod Touch phone. This application has the ability to monitor CPU Usage, Memory Usage, Disk Usage, CPU Load, and Server  Uptime among many others.

    istat: Linux Server Monitor From iPhone

    To install istat on CentOS Linux follow the directions below.

    1. Download istat: Download istat for Linux here.
    2. Configure istat: Unpack the istat package you downloaded from Google Code and change the directory into the newly created istat directory. Once in this directory type the below command to configure istat for your server.
      1. ./configure
      ./configure
    3. Install istat: Now issue the make and make install commands to compile and install istat on your server.
      1. make
      2. make install
      make
      make install
    4. Create istat User: Now issue the below command to create a istat user to run istat.
      1. useradd istat
      useradd istat
    5. Create istat Directory: Use the below syntax to create a directory to store the istat.pid file which needs to be readable/writeable by the istat user you just created.
      1. mkdir /var/run/istat
      2. chown istat.istat /var/run/istat
      mkdir /var/run/istat
      chown istat.istat /var/run/istat
    6. Configure istat: Now make necessary configuration changes to the /usr/local/etc/istat.conf configuration file. The typical changes include modifying the server_code which is the access code used by your iDevice to obtain the server information, monitor_net which is the interface istat will listen for incoming connections, and monitor_disk which needs to be changed to the proper mounts such as /dev/hdb1, /dev/hdc1, etc.
    7. Launch istat: Now launch the istat daemon by issuing the below command.
      1. /usr/local/bin/istatd &
      /usr/local/bin/istatd &

      The server will automatically launch with the istat user and listen on port 5109.

    8. Connect From iPhone: Now configure the new server within istat on your iPod Touch or iPhone. Once you do so click on the server, type in the password you set in step 6, and verify you are collecting all of the server statistics properly.

    The istat application is a nifty little application to provide you a quick view of servers on your network or servers that you monitor outside of your network. More information about the iPhone version of istat can be located here.