PHP

Warning: Cannot modify header information – headers already sent by ..

error message:

Warning: Cannot modify header information – headers already sent by (output started at C:\…\…\…\…\filexpto.php:1) in C:\…\…\…\…\….php on line xx

 

resolution:

open file filexpto.php and add ob_start(); like

 
<?php
ob_start();
....

 

ob_startTurn on output buffering

This function will turn output buffering on. While output buffering is active no output is sent from the script (other than headers), instead the output is stored in an internal buffer.

 
more in:
http://www.php.net/manual/en/function.ob-start.php
 

Tips & tricks

Import multiple vCards to Gmail contacts manager

Need to concatenate all the VCFs in to a single file

# get a command prompt
Windows_Key + R
run: cmd
# change to the directory where all your VCFs are located
e:
cd vcf
# Run this command

copy   /B   *.vcf   all.vcf

Then upload the “all.vcf” file to google

IIS

IIS6 and Office 2007 MIME types

Error message:

 

    HTTP Error 404 – File or directory not found.
Internet Information Services (IIS)

Since Office 2007 was released after Windows Server 2003 and IIS6, IIS6 knows nothing about the new MIME types. So you need to manually add them:

Open Computer Management. (Right-click My Computer… Manage…)
Right-click Internet Information Services (IIS) Management… Properties…
Click MIME Types…
Click New… and add the following:

Extension     MIME Type
.xlsx     application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.xltx     application/vnd.openxmlformats-officedocument.spreadsheetml.template
.potx     application/vnd.openxmlformats-officedocument.presentationml.template
.ppsx     application/vnd.openxmlformats-officedocument.presentationml.slideshow
.pptx     application/vnd.openxmlformats-officedocument.presentationml.presentation
.sldx     application/vnd.openxmlformats-officedocument.presentationml.slide
.docx     application/vnd.openxmlformats-officedocument.wordprocessingml.document
.dotx     application/vnd.openxmlformats-officedocument.wordprocessingml.template
.xlam     application/vnd.ms-excel.addin.macroEnabled.12
.xlsb     application/vnd.ms-excel.sheet.binary.macroEnabled.12

Code Snippets SQL

Detect invalid(sintax) emails

Detect invalid(sintax) emails in db

SELECT * FROM people WHERE email NOT LIKE '%_@__%.__%'
Code Snippets SQL

Query to list number of records in each table in a database

sql server 2005



SELECT 
    t.NAME AS TableName,
    s.Name AS SchemaName,
    p.rows AS RowCounts,
    SUM(a.total_pages) * 8 AS TotalSpaceKB, 
    SUM(a.used_pages) * 8 AS UsedSpaceKB, 
    (SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB
FROM 
    sys.tables t
INNER JOIN      
    sys.indexes i ON t.OBJECT_ID = i.object_id
INNER JOIN 
    sys.partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id
INNER JOIN 
    sys.allocation_units a ON p.partition_id = a.container_id
LEFT OUTER JOIN 
    sys.schemas s ON t.schema_id = s.schema_id
WHERE 
    t.NAME NOT LIKE 'dt%' 
    AND t.is_ms_shipped = 0
    AND i.OBJECT_ID > 255 
GROUP BY 
    t.Name, s.Name, p.Rows
ORDER BY 
    t.Name





Databases

DBeaver is free and open source (GPL) universal database tool

DBeaver is free and open source (GPL) universal database tool for developers and database administrators.

  • Usability is the main goal of this project, program UI is carefully designed and implemented.
  • It is freeware.
  • It is multiplatform.
  • It is based on opensource framework and allows writing of various extensions (plugins).
  • It supports any database having a JDBC driver.
  • It may handle any external datasource which may or may not have a JDBC driver.
  • There is a set of plugins for certain databases (MySQL and Oracle in version 1.x) and different database management utilities (e.g. ERD)

http://dbeaver.jkiss.org/about/ read more »

Tips & tricks

Sendy.co, newsletter simple and cheap

Sendy is a self hosted email newsletter application that lets you send trackable emails via Amazon Simple Email Service (SES).

This makes it possible for you to send authenticated bulk emails at an insanely low price without sacrificing deliverability.

Email service Cost per 10,000
MailChimp $200
Campaign Monitor $105
Amazon SES $1

read more »

Linux Tips & tricks

Edit files on the linux command line

To edit files on the command line, you can use an editor such as vi. To open the file, run

vi /path/to/file

Now you see the contents of the file (if there is any. Please note that the file is created if it does not exist yet.).
The most important commands in vi are these:
Press i to enter the Insert mode. Now you can type in your text.
To leave the Insert mode press ESC.
To delete the character that is currently under the cursor you must press X (and you must not be in Insert mode because if you are you will insert the character x instead of deleting the character under the cursor). So if you have just opened the file with vi, you can immediately use x to delete characters. If you are in Insert mode you have to leave it first with ESC.
If you have made changes and want to save the file, press : x (again you must not be in Insert mode. If you are, press ESC to leave it).
If you haven’t made any changes, press :q to leave the file (but you must not be in Insert mode).
If you have made changes, but want to leave the file without saving the changes, press :q! (but you must not be in Insert mode).
Please note that during all these operations you can use your keyboard’s arrow keys to navigate the cursor through the text.

Tips & tricks

Check your newsletter content quality

Low quality content means, a high percentage of your emails did not get pass the ISP’s spam filters and got sent to spam immediately. ISP means the receiving end, eg. gmail, hotmail, yahoo mail, etc.

Try using this tool to check your spam score: http://www.contactology.com/check_mqs.php

Or this tool (you need to paste in full headers of your email: http://spamcheck.postmarkapp.com/

If you’ve been sending emails to people who did not opt-in to receive your emails, most people will mark your emails as spam. Overtime, you’ll accumulated a high spam score.

Exchange Tips & tricks

Exchange 2010 Database size

  1. Review the Purge items from the Recoverable Items folder. For details, see Clean Up the Recoverable Items Folder.
  2. Yes ESEutil /D is the command
  3. Safe?  Yes relatively, however, that said
    1. before you ever run any type of utility against an Exchange database you should back it up just in case something goes sideways.
    2. you will need 110% of the EDB size to perform the defrag and
    3. during the time its being defragged ALL users for that database will be unable to connect.
  4. Time, well this depends upon many factors, i.e. CPU, Disk Speed, Memory, other processes etc.  Basically I would plan to spend at least a full day on it.  But whatever you do you need to be patient because it does take time to complete.
  5. Personally I think you would be better off to create a NEW database and use the New-MoveRequest so check out these two articles  http://technet.microsoft.com/en-us/library/bb124495.aspx and http://technet.microsoft.com/en-us/library/bb124797.aspx since these will allow you to keep the system up and running while the data is being moved, however it does require more disk space until the process is done and then you can drop the old DB to gain all the space back.

http://social.technet.microsoft.com