Tuesday, April 30, 2013

How to free Port 80 that already used in Windows 8

Solution 1:
  • Launch RegEdit
  • Find HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP
  • Change the value of "start" to 4 (disabled)
  • Reboot your computer

Solution 2:

  • Go to Device Manager, select “show hidden devices” from menu/view, go to “Non-Plug and Play Driver”/HTTP, double click it to disable it (and disable or manual some services depended on it).
  • Reboot and use

Tuesday, April 16, 2013

Nagios PNP Warning after upgrade php to 5.3

I got these error and warnings from Nagios after I upgrade my PHP:


Deprecated: Assigning the return value of new by reference is deprecated in /usr/local/nagios/share/pnp/include/function.inc.php on line 1032

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europa/Berlin' for 'Debian/Squeeze' instead in /usr/local/nagios/share/pnp/include/function.inc.php on line 557


Deprecated: Function eregi() is deprecated in /usr/local/nagios/share/pnp/include/function.inc.php 

 To solve this problem you must edit this file: usr/local/nagios/share/pnp/include/function.inc.php

line 556: date_default_timezone_set('UTC');

line 1033: $pdf = new PDF('P', 'mm', 'A4');

line 1543: if($level == 2 && $type == "complete" && preg_match("/^NAGIOS_/",$tag)){






Friday, February 1, 2013

MySQL comparing timestamp with date


To find records older than 30 days using timestamp field:

Select from TableName where from_unixtime(tstamp) < (NOW() - INTERVAL 30 day);



Thursday, January 31, 2013

Extracting the string between two patterns in a file

Supose the file contains this phrase: That is just a test for you

I need to extract the patterns between the words is and test:


 sed -e 's/.*is//' -e 's/test.*$//' /Path-To-Your-File/yourfile.txt

and the result is:

  just a

Tuesday, January 22, 2013

Find out MySQL Time & Zone

for global and session time zone run this query:


mysql> SELECT @@global.time_zone, @@session.time_zone;


for get current time from MySQL Server run this query:

mysql> select now() ;

Monday, December 17, 2012

Find Files By Date

If you need a specific date range, than consider using the find command.

In this example find files modified between 15 December 2012 and 16 December 2012, in /var directory:
 
touch --date "2012-12-15" /tmp/start
touch --date "2012-12-16" /tmp/end
find /var -type f -newer /tmp/start -not -newer /tmp/end

Thursday, December 13, 2012

Forcing qmail to process the queue

Run this command:

kill -ALRM `ps ax | grep qmail-send | grep -v grep | awk '{print $1}'`

Adjusting qmail queue time / lifetime

if you want to adjust how long e-mails will spend in the qmail queue before they're bounced, simple set the queuelifetime:

# echo "86400" > /var/qmail/control/queuelifetime
# /etc/init.d/qmail restart


The above example is for 1 day (qmail needs the time length in seconds). Just take the days and multiply by 86,400 seconds to get your result.

Monday, November 19, 2012

Delete Documents From Solr Index By Query

If you simply want to delete documents from your Solr index by using the web interface, here's a code snippet that lets you do so:

http://localhost:8080/solr/update?stream.body=<delete><query>id:XXXXX</query></delete>&commit=true

This lets you delete documents where the id field matches XXXXX.
If you want to delete items that matches more than one field, just add another query:

http://localhost:8983/solr/update?stream.body=<delete><query>id:XXXXX</query><query>entitytype:YourContent</query></delete>&commit=true

If you want to delete all items in the index, just use this query:

<delete><query>*:*</query></delete>

Source: http://blog.dileno.com/archive/201106/delete-documents-from-solr-index-by-query/

Tuesday, November 13, 2012

Old Version MediaWiki & PHP 5.3

when you use old version of MediaWiki and PHP 5.3, you should see this error:


PHP Parse error:  syntax error, unexpected T_NAMESPACE, expecting T_STRING 


You must change only the Namspace calss with MWNamespace:

go to your MediaWiki root directory (please make a backup first) and run this command:

find -name "*.php" -exec sed -i 's/Namespace::/MWNamespace::/g' {} \;

Wednesday, October 31, 2012

Youtube Video's thumbnail in not showing when sharing to FaceBook

After posting the thumbnail-less link to my page for the hundredth time, I decided to try sharing the link via the Facebook App on my Mobile Phone. When I did, I noticed a that the app added a suffix to my original link "&sns=fb".

I tried it and it worked...first try. I'm hoping it works when I try to post our next weekly video.

Try the following steps. I hope they work for you, too!

1) On the YouTube video page, click "Share" - be sure to select "Long Link".

2) Copy the link and paste it into your Notepad program.

http://www.youtube.com/watch?v=ABCdefGHik

3) Add "&sns=fb" to the end of the link.

http://www.youtube.com/watch?ABCdefGHik&sns=fb 

4) Copy your new link and paste it into your Facebook status.

5) Cross your fingers.



Another  solution:

Go here and enter the URL https://developers.facebook.com/tools/debug
It will force it to refresh the cache for the given URL.

Tuesday, October 30, 2012

How to select and generate locales on Ubuntu

For those of you who are used to running "dpkg-reconfigure locales" on Debian to select and generate locales you may be a bit disappointed at the seemingly broken way it is done under Ubuntu.

When I say broken "dpkg-reconfigure locales" does not yield an interface that allows you to select and deselect locales. It simply generates the locales mentioned in "/var/lib/locales/supported.d/local" file.

Therefore if you want to generate a bunch of locales you will need to add them to this file and re-run:

dpkg-reconfigure locales

NOTE: One locale per line.


For a list of valid locales you can search through "/usr/share/i18n/SUPPORTED".

Source: Here

Monday, October 29, 2012

TYPO3 - Lock file could not be created

Create the directory ./typo3temp/locks/ and make it writable for the user your Apache is running with.