Skip to main content

Posts

Showing posts from 2015

Four Things about linux as a PPTP client

The connection info is stored at /etc/ppp/peers/ The filename in this directory is the name of the connection  The pptp options file, which should be listed in the connection file is typically stored at /etc/ppp/options.pptp The secrets file, that contains your username and password, is stored at /etc/ppp/chap-secrets To start the connection, type  pppd call [connection name]

IPEdge - Access someelse's mailbox

To manage someone else's mailbox on IPEdge, do the following Dial the voicemail service number, normally 250 Press * Press # and then the number of the extension you want to manage Enter the password for the mailbox.  If you don't know the Voicemail Service Number, select  System the number should be listed under "Central VM Callback"

doctype jquery dialog

I had a problem where a jquery dialog box performed strangley most browsers . In Internet Explorer, IE, would always position itself top left corner and omit, not display, the title bar. In chrome and other browsers, had strange onclick highlighting and positioning problems. was all solved with  <!DOCTYPE HTML>

Pivot Tables and SQL

http://www.artfulsoftware.com/infotree/queries.php http://stackoverflow.com/questions/7674786/mysql-pivot-table http://anothermysqldba.blogspot.de/2013/06/pivot-tables-example-in-mysql.html http://www.codeproject.com/Articles/363339/Cross-Tabulation-Pivot-Tables-with-MySQL http://datacharmer.org/downloads/pivot_tables_mysql_5.pdf http://buysql.com/mysql/14-how-to-automate-pivot-tables.html

WiFi Site Maps

If you need to do a WiFi site map / analysis, the following tools are essential:  http://www.inssider.com/ http://www.metageek.com/products/wi-spy http://www.flukenetworks.com/enterprise-network/wireless-network/AirMagnet-WiFi-Analyzer http://www.solarwinds.com/network-performance-monitor.aspx http://www.tamos.com/products/

Why didn't anyone ever let me know that these posix classes existed ?

http://www.regular-expressions.info/posixbrackets.html POSIX Description ASCII Unicode Shorthand Java [:alnum:] Alphanumeric characters [a-zA-Z0-9] [\p{L&}\p{Nd}] \p{Alnum} [:alpha:] Alphabetic characters [a-zA-Z] \p{L&} \p{Alpha} [:ascii:] ASCII characters [\x00-\x7F] \p{InBasicLatin} \p{ASCII} [:blank:] Space and tab [ \t] [\p{Zs}\t] \h \p{Blank} [:cntrl:] Control characters [\x00-\x1F\x7F] \p{Cc} \p{Cntrl} [:digit:] Digits [0-9] \p{Nd} \d \p{Digit} [:graph:] Visible characters (i.e. anything except spaces, control characters, etc.) [\x21-\x7E] [^\p{Z}\p{C}] \p{Graph} [:lower:] Lowercase letters [a-z] \p{Ll} \p{Lower} [:print:] Visible characters and spaces (i.e. anything except control characters, etc.) [\x20-\x7E] \P{C} \p{Print} [:punct:] P

Just say you wanted a csv file with dimension details of your image library - doing this with powershell

Get-ChildItem -Recurse C:\yourphotosdir -Filter *.jpg | % {     $image = [System.Drawing.Image]::FromFile($_.FullName)     if ($image.width -t 500 -and $image.height -gt 500) {         New-Object PSObject -Property @{         height_pixels = $image.Height         width_pixels = $image.Width         megapixels = ($image.Height * $image.Width)/1000/1000         megabytes = (($_.Length)/1024)/1024         name = $_.Name         fullname = $_.Fullname         date = $_.LastWriteTime         }     } } | Export-Csv 'C:\yourphotosdir\img.csv' -NoTypeInformation

Good guide on getting output from a stored procedure

https://technet.microsoft.com/en-us/library/ms187004(v=sql.105).aspx The sp itself.. USE AdventureWorks2008R2; GO IF OBJECT_ID('Sales.uspGetEmployeeSalesYTD', 'P') IS NOT NULL DROP PROCEDURE Sales.uspGetEmployeeSalesYTD; GO CREATE PROCEDURE Sales.uspGetEmployeeSalesYTD @SalesPerson nvarchar(50), @SalesYTD money OUTPUT AS SET NOCOUNT ON; SELECT @SalesYTD = SalesYTD FROM Sales.SalesPerson AS sp JOIN HumanResources.vEmployee AS e ON e.BusinessEntityID = sp.BusinessEntityID WHERE LastName = @SalesPerson; RETURN GO the call to get the value  -- Declare the variable to receive the output value of the procedure. DECLARE @SalesYTDBySalesPerson money; -- Execute the procedure specifying a last name for the input parameter -- and saving the output value in the variable @SalesYTDBySalesPerson EXECUTE Sales.uspGetEmployeeSalesYTD N'Blythe', @SalesYTD = @SalesYTDBySalesPerson OUTPUT; -- Display the value returned by the procedure.

SQL Notifications

Some good information on SQL notifications. Step 1, Create a Database Mail Profile https://msdn.microsoft.com/en-AU/library/ms187605.aspx#SSMSProcedure Step 2.  Define an operator and create the alert https://www.mssqltips.com/sqlservertip/1523/how-to-setup-sql-server-alerts-and-email-operator-notifications/

Adding security on a mssql file, when moving backups or data files around

Every now and then you need to move a MSSQL database file around. However, how to do you put the MSSQL security attributes back on the file. Turns out it is real easy, all you need to do is put "NT Service" in front of  the database name ie: NT Service\MSSQL$ InstanceName For me, that was NT Service\MSSQL$PBSQL

Adobe Digital Editions

I think that Adobe Digital Editions is the worse excuse for drm in documents. I'm always having one problem or another in the thing. This link seems to fix key problems https://helpx.adobe.com/digital-editions/kb/error-e-adept-internal-download.html#

I'm blown away by this command, get calendar appointments from Office 365 using REST

Invoke-RestMethod -Uri "https://outlook.office365.com/api/v1.0/me/calendarview?startDateTime=$(Get-Date)&endDateTime=$((Get-Date).AddDays(7))" -Credential $o365cred |  ForEach-Object { $_.value } |  Select-Object -Property Subject, Start , End It returns the date in universal time format, ie:  2015-08-27T00:00:00Z However, it also includes the time zone and any language should be able to convert the time directly into local time

Tip to create an underline on a heading shorter than the heading itself

You can use a pseudo element with :before (or :after ): h1 { font - weight : 300 ; display : inline - block ; padding - bottom : 5px ; position : relative ; } h1 : before { content : "" ; position : absolute ; width : 50 %; height : 1px ; bottom : 0 ; left : 25 %; border - bottom : 1px solid red ; } http://jsfiddle.net/9e27b/ This is another solution that centers the heading, the problem here is that the underline gets shorter as the column gets shorter. h2 {   display: inline-block;   padding-bottom: 15px;   position: relative;   width: 100% ;   text-align: center; } h2:before{     content: "";     position: absolute;     width: 8%;     height: 1px;     bottom: 0;     left: 46%;     border-bottom: 1px solid red; }

squarespace

Questions How do I or can I convert a page to an index ? It appears that styles are applied to text, but it is not clear how these styles are actually activated.  eg, sometimes text appears large or with borders, but the edit box gives no real indication that this is happening. How do I create hero bars and sliders ? How are images licensed, is there really stock images that can be used ? Squarespace galleries don't seem to want to sit within an index- you can only add pages to an index. How do you add a background image for a page When doing testing thursday night, 20/8, it appeared that additional pages had a left hand side menu, that isn't going to work for me.  Events, I need to test that out. Notes An index contains pages in one long view Q's for 8sw The footer background on the home page is black, do you really want it black ?, I used #ada1ab (a slightly red grey)  Tell Ness wwe wont need the developer edition. I seem to be achieving everythign I n

Outlook - POwerShell - Getting message headers

# Get Internet headers from MailItem in PowerShell Add-type -assembly "Microsoft.Office.Interop.Outlook" | out-null $OutlookApp = new-object -comobject outlook.application $MAPI = $OutlookApp.GetNamespace("MAPI") $Message = $MAPI.GetDefaultFolder([Microsoft.Office.Interop.Outlook.OlDefaultFolders]::olFolderInbox).Items.GetLast() $Message.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x007D001E") $OutlookApp.Quit()   More information here   https://msdn.microsoft.com/en-us/library/bb176395%28v=office.12%29.aspx  

Great Article on using powershell to extract information about Outlook Items

https://gallery.technet.microsoft.com/scriptcenter/af63364d-8b04-473f-9a98-b5ab37e6b024 To get a list of all the recipients of a message, you could type something like $folder.items | Select Recipients -First 1 | foreach {$_.Recipients} | Select Address, Name # -----------------------------------------------------------------------------   # Script: Get-OutlookInbox.ps1   # Author: ed wilson, msft   # Date: 05/10/2011 08:34:36   # Keywords: Microsoft Outlook, Office   # comments:   # reference to HSG-1-29-09, HSG-5-24-11   # HSG-5-25-11   # -----------------------------------------------------------------------------   Function  Get - OutlookInBox  {     <#     .Synopsis      This function returns InBox items from default Outlook profile     .Description      This function returns InBox items from default Outlook profile. It      uses the Outlook interop assembly to use the olFolderInBox enumeration.      It creates a custom object consisting of Subject, ReceivedTime, Import

Set permissions in a directory using powershell and a CSV file

import-csv "C:\useraccounts.csv" | ForEach-Object {    $directory = "D:\Personal\" + $_.SAM    $domainAccount = "COMP\" + $_.SAM    $rule=new-object System.Security.AccessControl.FileSystemAccessRule( $domainAccount ,"FullControl","Allow")   $acl=get-acl $directory   #Add this access rule to the ACL   $acl.SetAccessRule($rule)     #Write the changes to the object   set-acl $directory $acl } This however, wont set permissions recursively,  you'll need something like this from technet.  Notice the "for each file" https://technet.microsoft.com/en-us/magazine/2008.02.powershell.aspx #ChangeACL.ps1 $Right="FullControl" #The possible values for Rights are # ListDirectory, ReadData, WriteData # CreateFiles, CreateDirectories, AppendData # ReadExtendedAttributes, WriteExtendedAttributes, Traverse # ExecuteFile, DeleteSubdirectoriesAndFiles, ReadAttributes # WriteAttributes, Write, Delete # ReadPermissions, R

Get permissions for a directory using powershell

 get-acl .\directoryname | format-list   Results looks something like Path   : Microsoft.PowerShell.Core\FileSystem::D:\Personal\ directoryname  Owner  : BUILTIN\Administrators Group  : IAENG\Domain Users Access : BUILTIN\Administrators Allow  268435456          BUILTIN\Administrators Allow  FullControl          NT AUTHORITY\SYSTEM Allow  FullControl          BUILTIN\Administrators Allow  FullControl          COMP\Managers Allow  FullControl Audit  : Sddl   : (a bunch of strange characters)

PowerShell Script to create new ActiveDirectory Users

This assumes you have a CSV file with three columns FirstName,LastName,SAM John,Doe,jdoe The script... import-module activedirectory import-csv "C:\....\useraccounts.csv" | ForEach-Object {   $newUPN = $_.SAM + "@ad.somewhere.com"   New-ADuser -SamAccountName  -GivenName $_.FirstName -Surname $_.LastName -Path "OU=YourCompany,DC=ad,DC=somewhere,DC=com,DC=nz" -Name $fullname  -DisplayName $fullname  -AccountPassword (ConvertTo-SecureString -AsPlainText "P@$$w0rd" -Force)  ## you may also want to set the UserPrincipalName at the same time  ## ie: include it above instead of down here. # set-aduser -identity $_.SAM -UserPrincipalName  $newUPN   }

Moving ZFS pools

Moving data from one pool to another - zfs. Method 1: Assumes you are using the same disks You can create a pool and use the zpool export option on the system you create the pool on. Once the disks are attached to the final destination host, you can use the zpool import command to import the dataset. See: Migrating ZFS Storage Pools Method 2: Assumes you are using zfs with snapshots. http://docs.oracle.com/cd/E18752_01/html/819-5461/gbchx.html#gbinw   Method 3: Using rsync rsync -av --log-file=/mnt/PoolA/rsync.log /mnt/PoolA/Data /mnt/PoolB/Data   The v switch is verbose, the a switch is "archive" -a, --archive This is equivalent to -rlptgoD. It is a quick way of saying  you want recursion and want to preserve almost everything  (with -H being a notable omission). The only exception  to the above equivalence is when --files-from is specified, in which case -r is

Tips in Installing Toshiba Network eManager

Tip 1: Unpack the ZIP file and execute the main file (normally something like NetworkeManagerV5.20C01.exe) and let it do it's thing.   It will install everything it needs. I've run into problems when I've tried to run setup or launch from the unpacked files. Tip 2: Make sure you put http://localhost in the "local intranet" zone

How to use Linux to create an ISO of a CD/DVD

Linux creating CD-ROM ISO image key: use dd    Do not mount CD. If cd was mouted automatically unmout it with umount command Create CD-ROM ISO image with dd command: # dd if=/dev/cdrom of=/tmp/cdimg1.iso Where, if=/dev/cdrom : Read from /dev/cdrom (raw format) of=/tmp/cdimg1.iso : write to FILE cdimg1.iso i.e. create an ISO image

regex with grep

The trick with using regex with grep is that no // slashes are needed, you simply quote the text and use regex controls. ie: something like this would list everyline ending in exactly no grep '^.* no$' sshd_config  However, for the same task, this would be more helpful... grep '^[^#].* no$' sshd_config As it excludes the leading # (comment)

Grep equivalent in powershell

This one uses a file as the regex Get - Content . \doc . txt | Select - String - Pattern ( Get - Content . \regex . txt )     This one prints the line before as well   Get - Content . \doc . txt | Select - String - Pattern 'test' -context 1  

Windows Auto Login

In the registry editor go to HKEY_LOCAL_MACHINE>SOFTWARE>Microsoft>Windows NT>CurrentVersion>Winlogon    On right side pane look for these values AutoAdminLogon, DefaultPassword and DefaultUsername.  If the above values aren’t there, then right click on empty area in the right pane select New>String Value and enter the value name such as AutoAdminLogon. Repeat this step for each value.

Mounting a Clonezilla Image

Prepare a large disk in Linux Say if your image is /home/partimag/YOURIMAGE/, and the image is /home/partimag/YOURIMAGE/hda1.ntfs-img.aa, hda1.ntfs-img.ab... run   file /home/partimag/YOURIMAGE/hda1.ntfs-img.aa to see it's gzip, bzip or lzop image. Say it's gzip, then you can run   cat /home/partimag/YOURIMAGE/hda1.ntfs-img.* | gzip -d -c | ntfsclone --restore-image -o hda1.img - Then you will have a "hda1.img" which you can mount it by   mount -o loop -t ntfs hda1.img /mnt Then all the files are in /mnt/

Find a field in a MSSQL database

looking for a database field and you're not sure where it is ? Try this, the stuff in yellow highlight needs to be changed for your situation.... USE AdventureWorks GO SELECT t.name AS table_name , SCHEMA_NAME ( schema_id ) AS schema_name , c.name AS column_name FROM sys.tables AS t INNER JOIN sys.columns c ON t. OBJECT_ID = c. OBJECT_ID WHERE c.name LIKE '%EmployeeID%' ORDER BY schema_name , table_name ;   From http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/

Ever need to reset a password in Bonobo Git Server ?

So, you've forgotten your password to bonobo git. Step 1: Get access to the sqlite file, probably called something like  Bonobo.Git.Server.db, sitting in the "wwwroot\Bonobo.Git.Server\App_Data" directory. Step 2: Using another tool, generate an md5 hash of your new desired password (as far as I know, sqlite does not have md5 capability) Step 3: Back in sqlite, using SQL, update the relevant user record, something like update User set Password = UPPER( 'thenewMD5hash') where Username = 'admin' ; Step 4: That's it, you are done, log in with your newly found password.

Pauls Draytek tips

To enable SIP ALG sys sip_alg 1 To disable SIP ALG  sys sip_alg0 To View SIP ALG status  sys sip_alg ? To commit sys settings to flash sys commit ===== To view open ports srv nat openport -v To view port mappings ( open ports in most instances preferred to port mappings ) srv nat portmap table

Check if column exists in MSSQL

if exists ( select * from sys . columns where Name = N 'columnName' and Object_ID = Object_ID ( N 'tableName' )) begin -- Column Exists end     The following does not look in fields   select * from sys.all_objects where name like '%[what you are looking for]%'