Skip to main content

Posts

Showing posts from April, 2015

SElinux prevents MSSQL connection from PHP

From PHP.net If someone encounters the interesting problem in which PHP can connect to a MSSQL server from the command line but not when running as an Apache module: SELinux prevents Apache (and therefore all Apache modules) from making remote connections by default. This solved the problem in CentOS: # setsebool -P httpd_can_network_connect=1

Save Attachments in Outlook automatically

For years I have wanted something to do this, and finally found it. Worked perfectly for me in Outlook 2013  In the end it is so simple. Guide from http://www.pixelchef.net/content/rule-autosave-attachment-outlook and https://msdn.microsoft.com/en-us/library/ee814736.aspx Open the VBA IDE in Outlook. Alt-F11 will do this. Insert the following code to the Modules section. On the left side there is a tree, expand until you find Modules. Then, if there is not a Module item under Modules, create one by right clicking on Modules. Or right click and choose Insert -> Module. Now, paste the text below in the main VBA window. Close the VBA IDE. Create a Rule that calls the script. Tools -> Rules and Alerts -> New Rule... In the first screen of the new rule wizard, choose "Check messages when they arrive". In the second, you could specify certain criteria that the message must match. Tip: Try "with specific words in the message header" and &qu

MSSQL database restoration to different database

MSSQL database restoration to different database You can get a range of different problems when trying to restore an MSSQL database to a different database.  There are also a range of different solutions However, the following steps  work for me .  These steps require MS SQL Management Studio.   In MS SQL Management Studio, create the target database, make note of the location of the database file and log file.  Start t he restore process and s elect the appropriate backup file and backup date On the "Restore Database " dialog, on the "General" tab, under "Destination" select the desired target database. Select the "Files" tab.  Within the "Files" tab, you'll see that the data and log file are pointing to the old database, change both the data and log file to be the database you created in step 1 In "Options", select the "Overwrite" option (WITH REPLACE)

Get Number of Rows and Table Size for each table T-SQL

CREATE TABLE #tableSizeInfo (     [tablename] varchar (255),     [rows] bigint ,     [reserved] varchar (255),     [data] varchar (255),     [index_size] varchar (255),     [unused] varchar (255) ) EXEC sp_MSForEachTable         'INSERT INTO #tableSizeInfo EXECUTE sp_spaceused [?];' SELECT * FROM #tableSizeInfo DROP TABLE #tableSizeInfo

Some T-SQL Commands

Shrink a MS SQL database DBCC SHRINKDATABASE ( database_name | database_id | 0      [ , target_percent ]      [ , { NOTRUNCATE | TRUNCATEONLY } ] ) [ WITH NO_INFOMSGS ] Get a list of tables in a database SQL Server 2005, 2008 or 2012: SELECT * FROM information_schema . tables SQL Server 2000: SELECT * FROM sysobjects WHERE xtype = 'U'

Recover a corrupted MS SQL database

I have not tried this, use with caution. There is a manual solution to fix this problem, but you need to have Microsoft SQL Server Management Studio for that. If you have it, you need to follow the steps given below: Open Microsoft SQL Server Management Studio on your system. Now click on New Query button. A new query page will be opened. Write the SQL scripts (shown below) on the page:                     EXEC sp_resetstatus [YourDatabase];                      ALTER DATABASE [YourDatabase] SET EMERGENCY                       DBCC checkdb ([YourDatabase])                      ALTER DATABASE [YourDatabase] SET SINGLE_USER WITH ROLLBACK IMMEDIATE                      DBCC DATABASE ([YourDatabase], REPAIR_ALLOW_DATA_LOSS)                      ALTER DATABASE [YourDatabase] SET MULTI_USER  Now click on Execute . Obtained from https://semnaitik.wordpress.com/2014/02/22/how-to-repair-corrupted-ms-sql-database-file/

Read SMS Messages on a bigpond 4G 760s

Login to the Aircard using Putty on the Aircard's COM port (from a whirlpool post) If you don't mind the inconvenience of AT commands, put the 760S into text-mode : AT+CMGF=1 (this needs doing every time the modem has been reset, eg. by power cycling). The default is PDU-mode (as received, encoded in hex). Then read all messages: AT+CMGL="ALL" Finally, you'll need to eventually clean them up (individually) to make room for more – eg: AT+CMGD=2 where the 2 is the number of the message you want to delete – you'll see those numbers in the read command. The easiest way to clean out all messages is one command with flags. E.g: AT+CMGD=0,4 In this case flag 4 ignores all indexes and deletes everything in all stores including both recieve & sent. Flags 0 to 3 are more selective. A list of other commands at http://bc.whirlpool.net.au/bc/hardware/?action=h_view&model_id=1286