Author Archive

$_SERVER[‘PATH_INFO’] not working!

Written by leif. Posted in PHP, Programmering

<?php
if (isset($_SERVER['PATH_INFO'])) {
    $request_uri = trim($_SERVER['PATH_INFO'], '/');
} elseif (isset($_SERVER['ORIG_PATH_INFO'])) {
    $request_uri = trim(str_replace($_SERVER['SCRIPT_NAME'], '', $_SERVER['ORIG_PATH_INFO']), '/');
} else {
    $request_uri = '';
}


echo "PATH_INFO = " . $_SERVER['PATH_INFO'] . "<br>"; 
echo "\$request_uri = ".$request_uri . "<br>";
echo "All server vars<br>";
echo "<pre>";
print_r($_SERVER);
echo "</pre>";
echo "tested with: http://localhost:8080/wordpress/leif.php/asd/qwe<br>";
echo "Output:<pre>";
echo "

PATH_INFO = /asd/qwe
$request_uri = asd/qwe
All server vars
Array
(
    [HTTP_HOST] => localhost:8080
    [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    [HTTP_CONNECTION] => keep-alive

Hosts

Written by leif. Posted in Tips

Modify your hosts file

Last updated on: 2016-06-08 Authored by: Rackspace Support

Modifying your hosts file enables you to override the DNS for a domain, on that particular machine. This is useful when you want to test your site without the test link, prior to going live with SSL; verify that an alias site works, prior to DNS changes; and for other DNS-related reasons. Modifying your hosts file causes your local machine to look directly at the IP address specified.

To modify the hosts file, you add two entries to the file that contains the IP address that you want the site to resolve to and the address. Adding the following two lines, for example, point www.domain.com anddomain.com to our current PHP5-ITK (“Refreshed” PHP5) cluster:

64.49.219.194 www.domain.com 64.49.219.194 domain.com

Things To Do After Installing Elementary OS Freya

Written by leif. Posted in Linux

Update your system

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

elementary Tweaks

sudo add-apt-repository ppa:mpstark/elementary-tweaks-daily
sudo apt-get update
sudo apt-get install elementary-tweaks

Install VLC Media Player

sudo apt-get install vlc

Install Plugin Flash Player and Pepper Flash

sudo apt-get install flashplugin-installer pepperflashplugin-nonfree

Install Additional Web Browser

sudo apt-get install chromium-browser firefox

Install Graphic Editor

sudo apt-get install gimp inkscape

 Install Indicator Synapse

sudo add-apt-repository ppa:elementary-os/daily
sudo apt-get update
sudo add-apt-repository ppa:elementary-os/unstable-upstream
sudo apt-get update
sudo apt-get install indicator-synapse
sudo killall wingpanel

Or

Install Synapse

sudo add-apt-repository ppa:synapse-core/ppa 
sudo apt-get update
sudo apt-get install synapse

Execute Synapse from the slingshot launcher

 

Install Cloud Storage

Download DropBox : https://www.dropbox.com/install?os=lnx

Install Google Drive :

sudo add-apt-repository ppa:alessandro-strada/ppa
sudo apt-get update
sudo apt-get install google-drive-ocamlfuse

 For Laptop : Install TLP for Improve Battery Life and Reduce Overheating

sudo add-apt-repository ppa:linrunner/tlp
sudo apt-get update
sudo apt-get install tlp tlp-rdw
sudo tlp start

Disktools:

sudo apt-get install gnome-disk-utility

Autologin – windows 7

Written by leif. Posted in Diverse, Tips

Autologon enables you to easily configure Windows’ built-in autologon mechanism. Instead of waiting for a user to enter their name and password, Windows uses the credentials you enter with Autologon, which are encrypted in the Registry, to log on the specified user automatically.

Autologon is easy enough to use. Just run autologon.exe, fill in the dialog, and hit Enable. To turn off auto-logon, hit Disable. Also, if the shift key is held down before the system performs an autologon, the autologon will be disabled for that logon. You can also pass the username, domain and password as command-line arguments:

autologon user domain password

Note: When Exchange Activesync password restrictions are in place, Windows will not process the autologon configuration.

Download: Autologon.zip

Source: https://technet.microsoft.com/en-us/library/bb963905.aspx

 

How to reset your Mac OS X 10.4 – 10.6 password without an installer disc

Written by leif. Posted in OS X, Tips

Reset 10.5 Leopard & 10.6 Snow Leopard password

  1. Power on or restart your Mac.
  2. At the chime (or grey screen if your chime is turned off), hold down Command+S on your keyboard to enter single-user mode.
  3. This step is optional, but it’s a good idea because it checks the consistency of the hard disk before moving on. At the prompt, type fsck -fy and press Enter/Return. Wait for the checks to complete before going to the next step.

Secure directory (Linux)

Written by leif. Posted in Linux, Tips

Follow up by setting up the user authorization within .htaccess file. Copy and paste the following text in:

AuthType Basic
AuthName "Restricted Files"
AuthUserFile /path/to/passwords/.htpasswd
Require valid-user

Batch script, find hverdag og weekend

Written by leif. Posted in Dos, Programmering


@echo off

FOR /F "skip=1" %%A IN ('WMIC Path Win32_LocalTime Get DayOfWeek' ) DO (
set DOW=%%A
goto :continue
)
:continue

if %DOW% EQU 0 goto :week
if %DOW% EQU 6 goto :week
echo Det er hverdag
goto :end

:week
echo Det er weekend

:end