Python pip – How to get around Fatal error in launcher: Unable to create process using ‘”‘

On some Windows machines pip has a problem caused by spaces in the Python installation path.
When you try:

Note: replace tweepy with the Python package you are trying to install. You will not receive the same output as in this example tweepy is already install via pip!

pip install tweepy

or any other package you get the following error returned:

Fatal error in launcher: Unable to create process using ‘”‘

The first thing you want to do is make sure you update pip:

python -m pip install -U pip

Now if you run:

python -m pip install tweepy

Your package should install.

If that fails, type python into your Windows command prompt to bring up the python command prompt. When you have the python command prompt displaying >>> type:

>>> import pip

Then when the python prompt returns >>> type:

>>>pip.main([‘install’,’tweepy’])

This should workaround the issue an give you back the power of Python pip

C Programming Quick Reference

Program Structure / Functions

type func(type1, …); //function prototype
type name; //variable declaration
int main(void){ //main routine
declarations //local variable declarations
statements
}
/* */ /*Original C comments (block/multiple line comments*/
// //single line comments recognized by most all compilers
int main(int argc, char *argv[]) //main with args
exit(arg); //terminate execution

C Preprocessor

#include <filename> include library file
#include “filename” include user file
#define name text replacement text
#define name(var) text replacement macro Ex: #define max(a,b) ((a)>(b) ? (a) : (b))
#undefine name undefine
# quoted string in replace Ex: #define msg(a) printf(“%s = %d, #a, (a))
## concatenate args and rescan
#if, #else, #elif, #endif conditional execution
#ifdef, #ifndef is name defined, not defined?
defined(name) name defined?
\ line continuation char

Data Type / Declarations

char character (1 byte)
int integer
float, double real number (single, double precision)
short short (16 bit integer)
long long (32 bit integer)
long long double long (64 bit integer)
signed positive or negative
unsigned non-negative modulo 2m
int*, float*,… pointer to int, float,…
enum tag {name1=value1,…}; enumeration constant
type const name; constant (read-only) value
extern declare external variable
static internal to source file
static local persistent between calls
struct tag {…}; Structure
typedef type name; Create new name for data type
sizeof object size of an object (type is size_t)
sizeof(type) size of a data type (type is size_t)

Initialization

type name=value; initialize variable
type name[]={value1,…}; initialize array
char name[]=”string”; initialize char string

Constants

65536L, -1U, 3.0F Long, unsigned, float
4.2e1 exponential form
0, 0x or 0X octal, hexadecimal Ex: 031 is 25, 0x31 is 49 decimal
‘a’, ‘\ooo’, ‘\xhh’ character constant (char, octal, hex)
\n, \r, \t, \b newline, cr, tab, backspace
\\, \?, \’, \” special characters
“abc…de” string constant (ends with ‘\0’)

Pointers, Arrays and Structures

type *name; declare pointer to type
type *f(); declare function returning pointer to type
type (*pf)(); declare pointer to function returning type
void * generic pointer type
NULL null pointer constant
*pointer object pointed to by pointer
&name address of object name
name[dim] array
name[dim1][dim2]… multi-dimensional array

Structures

struct tag { structure template
declarations declaration of members
}
struct tag name create structure
name.member member of structure from template
pointer -> member member of pointed-to structure Ex: (*p).x and p->x are the same
union single object, multiple possible types
unsigned member: b; bit field with b bits

Operators By Precedence

name, member struct member operator
pointer -> member struct member through pointer
++, — increment, decrement
+, -, !, ~ plus, minus, logical not, bitwise not
*pointer, indirection via pointer, address of object
(type) expr cast expression to type
sizeof size of any object
*, /, % Multiply, divide, modulus (remainder)
+, – Add, subtract
<<, >> left, right shift [bit op]
>, >=, <, <= relational comparisons
==, != Equality comparison
& And [bit op]
^ exclusive or [bit op]
| or (inclusive)
&& logical and
|| logical or
expr1 ? expr2 : expr3 Conditional expression
+=, -=, *=, … assignment operators
, Expression evaluation separator

Unary operators, conditional expression and assignment operators group right to left; all others group left to right

Flow Control

; Statement terminator
{} Block delimiters
break; exit from switch, while, do, for
continue; next iteration of while, do, for
goto label; go to
label: statement label
return expr return value from function

Flow Constructions

if (expr1) statement1
        else if (expr2) statement 2
        else statement3
if statement
while (expr)
        statement
while statement
for (expr1; expr2; expr3)
        statement
for statement
do statement
        while (expr);
do statement
switch (expr) {
        case const1: statement1 break;
        case const2: statement2 break;
        default: statement
switch statement

ANSI Standard Libraries

<assert.h>
<ctype.h>
<errno.h>
<float.h>
<limits.h>
<locale.h>
<math.h>
<setjmp.h>
<signal.h>
<stdarg.h>
<stddef.h>
<stdio.h>
<stdlib.h>
<string.h>
<time.h>

Character Class Test <ctype.h>

isalnum(c) Alphanumeric?
isalpha(c) Alphabetic?
iscntrl(c) Control character?
isdigit(c) Decimal digit?
isgraph(c) printing character (not including space)?
islower(c) Lower case letter?
isprint(c) Printing Character (Including space)?
ispunct(c) Printing Character except space, letter, digit?
isspace(c) space, formfeed, newline, cr, tab, vtab?
isupper(c) Upper case letter?
isxdigit(c) Hexadecimal digit?
tolower(c) Convert to lower case
toupper(c) Convert to upper case

String Operations <string.h>
s is a string; cs, ct are constant strings

strlen(s) length of s
strcopy(s, ct) Copy ct to s
strcat(s, ct) Concatenate ct after s
strcmp(cs, ct) compare cs to ct
strcmp(cs, ct, n) compare cs to ct, only first n chars
strchr(cs, c) Pointer to first c in cs
strrchr(cs, c) Pointer to last c in cs
memcpy(s,ct,n) Copy n chars from ct to s
memmove(s,ct,n) Copy n chars from ct to s, may overlap
memcmp(cs,ct,n) Compare n chars of cs with ct
memchr(cs,c,n) Pointer to first c in first n char of cs
memset(s,c,n) Put c into first n chars of s

Input / Output <stdio.h>
Standard I/O

stdin Standard input stream
stdout Standard output stream
stderr Standard Errros stream
EOF End of file (type is int)
getchar() Get a character
putchar(chr) Print a character
printf(“format”, arg1, …) Print formatted data
sprintf(s, “format”, ard1, …) Print to string s
scanf(“format”, &name1, …) Read formatted data
sscanf(s, “format”, &name, …) read from string s
puts(s) Print string s

File I/O

FILE *fp; Declare file pointer
fopen(“name”, “mode”) Pointer to named file modes: r (read), w (write), a (append), b (binary)
getc(fp) Get a character
putc(chr, fp) Write to character
fprintf(fp, “format”, arg1, …) Write to file
fscanf(fp, “format”, arg1, …) Read from file
fread(*ptr, eltsize, n, fp) Read and store n elts to *ptr
fwrite(*ptr, eltsize, n, fp) Write n elts from *ptr to file
fclose(fp) Close file
ferror(fp) non-zero if error
feof(fp) non-zero if already reached EOF
fgets(s, max, fp) read line to string s ( < max chars)
fputs(s, fp) Write string s

Codes for Formatted I/O “%-+ 0w.pmc”

Left justify
+ Print with sign
space Print space if no sign
0 Pad with leading zeros
w Min field width
p Precision
m
        h short
        l long
        L long double
Conversion character:
c
        d,i integer
        c Single Char
        f Double (printf)
        f Float(scanf)
        o Octal
        p Pointer
        g,G same as f or e,E depending on exponent
        u Unsigned
        s Char string
        e,E Exponential
        lf Double (scanf)
        x,X Hexadecimal
        n Number of chars written
Conversion character:

Variable Argument Lists <stdarg.h>

va_list ap; Declaration of pointer to arguments
va_start(ap,lastarg); Initialization of argument pointer /* lastarg is last named parameter of the function*/
va_arg(ap,type); Access next unamed tag, update pointer
va_end(ap); Call before exiting function

Standard Utility Functions <stdlib.h>

abs(n) Absolute value of int n
labs(n) Absolute value of long n
div(n,d) Quotient and remainder of ints n,d returns structure with div_t.quot and div_t.rem
ldiv(n,d) Quotient and remainder of longs n,d returns structure with ldiv_t.quot and ldiv_t.rem
rand() Pseudo random integer [0,RAND_MAX]
srand(n) Set random seed to n
exit(status) Terminate program execution
system(s) Pass string s to system for execution

Conversions

atof(s) Convert string s to double
atoi(s) Convert string s to integer
atol(s) Convert string s to long
strtod(s,&endp) Convert prefix of s to double
strtol(s,&endp,b) Convert prefix of s (base b) to long
strtoul(s,&endp,b) Convert prefix of s (base b) to unsigned long

Storage Allocation

malloc(size), calloc(nobj,size) Allocate storge
newptr = realloc(ptr,size); Change Size of storage
free(ptr); Deallocate storage

Array Functions

bsearch(key,array,n,size,cmpf) Search Array for key
qsort(array,n,size,cmpf) Sort Array ascending order

Time and Date Functions <time.h>

clock() processor time used by program Ex: clock()/CLOCKS_PER_SEC is time in seconds
time() Current calendar time
difftime(time2,time1) time2-time1 in seconds (double)
clock_t,time_t Arithmetic types representing times
struct tm Structure type for calendar time comps
        tm_sec Seconds after minute
        tm_min Minutes after hour
        tm_hour Hours since mindnight
        tm_mday Day of month
        tm_mon Months since January
        tm_year Years since 2000
        tm_wday Days since Sunday
        tm_yday Days since January 1
        tm_isdst Daylight savings time flag
mktime(tp) Convert local time to calendar time
asctime(tp) Convert time in tp to string
ctime(tp) Convert calendar time in tp to local time
gmtime(tp) Convert calendar time to GMT
localtime(tp) Convert calendar time to local time
strftime(s,smax,”format”,tp) tp is a pointer to a structure of type tm

Mathematical Functions <math.h>
Arguments and returned values are double

sin(x), cos(x), tan(x) Trig functions
asin(x), acos(x), atan(x), atan2(y,x), atan2(y,x) Inverse Trig functions
sinh(x), cosh(x), tanh(x) Hyperbolic trig functions
exp(x), log(x), log10(x) Exponentials & logs
ldexp(x,n), frexp(x,&e) Exponentials & logs (2 power)
modf(x,ip), fmod(x,y) Division & remainder
pow(x,y), sqrt(x) Powers
ceil(x), floor(x), fabs(x) rounding

Interger Type Limits <limits.h>
32bit Linux system

CHAR_BIT Bits in char (8)
CHAR_MAX Max value of char (SCHAR_MAX or UCHAR_MAX)
CHAR_MIN Min value of char (SCHAR_MIN or 0)
SCHAR_MAX Max signed char (+127)
SCHAR_MIN Min signed char (-128)
SHRT_MAX Max value of short (+32,767)
SHRT_MIN Min value of short (-32,768)
INT_MAX Max value of int (+2,147,483,647)(+32,767)
INT_MIN Min value of int (-2,147,483,648)(-32,767)
LONG_MAX Max value of long (+2,147,483,647)
LONG_MIN Min value of long (-2,147,483,648)
UCHAR_MAX Max unsigned char (255)
USHRT_MAX Max unsigned short (65,535)
UINT_MAX Max unsigned int (4,294,967,295)(65,535)
ULONG_MAX Max unsigned long (4,294,967,295)

Float Type Limits <float.h>
32bit Linux system

FLT_RADIX Radix of exponent rep (2)
FLT_ROUNDS Floating point rounding mode
FLT_DIG Decimal digits of precision (6)
FLT_EPSILON Smallest x so 1.0f + x ≠ 1.0f (1.1E-7)
FLT_MANT_DIG Number of digits in mantissa
FLT_MAX Max float number (3.4E38)
FLT_MAX_EXP Max Exponent
FLT_MIN Min float number (1.2E-38)
FLT_MIN_EXP Min Exponent
DBL_DIG Decimal digits of precision (15)
DBL_EPSILON Smallest x so 1.0 + x ≠ 1.0 (2.2E-16)
DBL_MANT_DIG Number of digits in mantissa
DBL_MAX Max double number (1.8E308)
DBL_MAX_EXP Max Exponent
DBL_MIN Min double number (2.2E-308)
DBL_MIN_EXP Minimum exponent

Compiling a C Program from Visual C++ 2015 Command Prompt

For quick compiling of C/C++ programs on a Windows PC,  the Visual C++ 2015 Command Prompt is your go to program. Many programs have no need for development in an IDE.

Before you can compile a c/c++ program you will need to install the Microsoft Visual C++ Build Tools 2015.

Once installed you will have a new list of shortcuts in your Start Menu.

Visual C++ Build Tools Start Menu Shortcuts
Visual C++ Build Tools Start Menu Shortcuts

If you right click on any one of the Visual C++ 2015 Programs and choose Open File Location you will also see the extensive list of tools.

Visual C++ Build Tools Explorer Shortcuts
Visual C++ Build Tools Explorer Shortcuts

Depending on what system architecture you are running, open one of the programs. If in doubt select:
Visual C++ 2015 x86 Native Build Tools  Command Prompt
or
Visual C++ 2015 x64  x86 cross Build Tools  Command Prompt

The following window will appear:

Visual C++ 2015 Build Tools Command Prompt
Visual C++ 2015 Build Tools Command Prompt

To verify that the prompt is functioning property, type cl and the prompt will output the exact same information again.
Note: You can use the Visual C++ 2015 Build Tools Command Prompt the same way you would use the standard command prompt for directory navigation.

  1. To test a simple C program, first create a test directory to hold your test program. md c:\test to create a directory, and then enter cd c:\test to change to that directory. This is where your source files and executable will be stored.
  2. Type notepad test.c  When the  Notepad alert dialog  pops up, choose Yes to create the new test.c file in your current working directory.
  3. In Notepad, enter the following code and save as test.c:
#include <stdio.h>
int main()
{
printf("Hello World!\n");
getchar(); //used to prevent executable from closing when double clicked
return ;
}
  1. Now from the Visual C++ Build Tools Command Prompt type: cl test.c. If the program compiled successfully you will see: /out:test.exe and test.obj. In your test folder you will now have the test.c source file along with test.obj and test.exe
  2. To run your newly compiled program simply type test and your program will run in the command prompt. You can also double click the test.exe executable.

To compile a program with more than one source file simply type:

cl test.c test2.c test3.c

The compiler will output a single file called file test.c
To change the name of the output program, add an /out linker option:

cl test.c test2.c test3.c /link /out:mynewprogram.exe

test.c source file

WordPress Appearance Editor Disappeared – Fix

Many people have had issues with their appearance editor disappearing. If this has happened to you, please follow these steps:

  1.  Fire up your favorite ftp client and connect to your WordPress site.
  2.  Navigate to wp-config.php which will be in your web site root www folder by default.
  3.  Search for the following line of code:
            define(‘DISALLOW_FILE_EDIT’, true);
    and change it to:
            define(‘DISALLOW_FILE_EDIT’, false);
  4.  Save and re upload the wp-config.php file.
  5.  Now Editor should be back in your Appearance menu. If not refresh the page.

Microsoft SQL Server Quick Reference

String Functions
Exact Numerics
bigint
bit
decimal
numeric
money
smallint
tinyint

Approximate Numerics
float
real

Date and Time
datetime
smalldatetime
timestamp

Strings
char
text
varchar

Unicode Strings
nchar
ntext
nvarchar

Binary Strings
binary
image
varbinary

Misc
cursor
sql_variant
table
xml

Type Conversions
CAST(expression AS datatype)
CONVERT(datatype, expression)

Ranking Functions
DENSE_RANK
NTITLE
RANK
ROW_NUMBER

Grouping Aggregate Functions
AVG
BINARY_CHECKSUM
CHECKSUM
CHECKSUM_AVG
COUNT
COUNT_BIG
GROUPING
MAX
MIN
SUM
STDEV
STDEP
VAR
VARP

Table Functions
ALTER
CREATE
DROP
TRUNCATE

Date Functions
DATEADD(datepart, number, date)
DATEDIFF(datepart, start, end)
DATENAME(datepart, date)
DATEPART(datepart, date)
DAY(date)
GETDATE()
GETUTCDATE()
MONTH(date)
YEAR(date)

Dateparts
Year                                yy, yyyy
Quarter                        qq, q
Month                           mm, m
Day of Year                 dy, y
Day                                  dd, d
Week                             wk, ww
Hour                               hh
Minute                          mi, n
Second                          ss, s
Millisecond                ms

Mathematical Funcations
ABS
ACOS
ASIN
ATAN
ATN2
CEILING
COS
COT
DEGREES
EXP
FLOOR
LOG
LOG10
PI
POWER
RADIANS
RAND
ROUND
SIGN
SIN
SQUARE
SQRT
TAN

String Functions
ASCII
CHAR
CHARINDEX
DIFFERENCE
LEFT
LEN
LOWER
LTRIM
NCHAR
PATINDEX
REPLACE
QUOTENAME
REPLICATE
REVERSE
RIGHT
RTRIM
SOUNDEX
SPACE
STR
STUFF
SUBSTRING
UNICODE
UPPER

Create a Stored Procedure
CREATE PROCEDURE name
@variable AS datatype = value
AS
–Comments
SELECT * FROM table
GO

Create a Trigger
CREATE TRIGGER name
ON
table
FOR
DELETE, INSERT, UPDATE
AS
–Comments
SELECT * FROM table
GO

Create a View
CREATE VIEW name
AS
–Comments
SELECT * FROM table
GO

Create an Index
CREATE UNIQUE INDEX name
ON
table(columns)

Create a Function
CREATE FUNCTION name
(@variable datatype(length))
RETURNS
datatype(length)
AS
BEGIN
DECLARE @return datatype(length)
SELECT @return = CASE @variable
WHEN ‘a’ THEN ‘return a’
WHEN ‘b’ THEN ‘return b’
ELSE ‘return c’
RETURN @return
END

 

Arduino Programming Quick Reference

Structure
void setup()
void loop()

Control Structures
if (x<7){} else{}
switch (newvar) {
case 1:
break;
case 2:
break;
default:
}
for (int i=0; i <=255; i++){}
while (X<7){}
do {} while (x<7);
continue;                                              //Go to next in do, for, while loop
return x;                                               //Or return; for voids
goto                                                       //potentially harmful

More Syntax
// Single line comment
/* MultiLine comment */
#define COUPLE 2
#include <avr/pgmspace.h>

General Operators
= Assignment Operator
+ Addition
– Subtraction
* Multiplication
/ Division
% Modulo
== Equal to
!= Not equal to
< Less than
> Greater than
<= Less then or equal to
>= Greater than or equal to
&& And
|| Or
! Not

Pointer Access
& Reference operator
* Dereference operator

Bitwise Operators
& Bitwise and
| Bitwise or
^ Bitwise xor
~ Bitwise not
<< Bitshift left
>> Bitshift right

Compound Operators
++ Increment
— decrement
+= compound addition
-= compound subtraction
*= Compound multiplication
/= Compound division
&= Compound bitwise and
|= Compound bitwise or

Constants
HIGH | LOW
INPUT | OUTPUT
true | false
143                                                   //Decimal number
0173                                               //Octal number
0b11011111                            //Binary
0x7B                                              //Hex number
7U                                                  //Force unsigned
10L                                                //Force long
15UL                                            //Force long unsigned
10.0                                               //Forces floating point
2.4e5                                           //240000

Data Types
void
boolean                                                                                //0,1,false,true
char (‘a’ -128 to 127)
unsigned char (0 to 255)
byte (0 to 255)
int (-32,768 to 32,767)
unsigned int (0 to 65,535)
word (0 to 655word (0 to 65,535))
long (-2,147,483,648 to 2,147,483,647)
unsigned long                                                                 //0 to 4,294,967,295
float                                                                                    //-3.4028235E+38 to                                                                                                                   3.4028235E+38
double                                                                              //same as float)
sizeof(newint)                                                            //returns 2 bytes

Strings
char S1[15];
char S2[9]={‘s,’y,’s’,’r’,’e’,’c’,’o’,’n’};
char S#[9]={‘s,’y,’s’,’r’,’e’,’c’,’o’,’n’,’\0′};               //included \0 null termination
char S4[] = “sysrecon”;
char S5[9] = “sysrecon”;
char S6[15] = “sysrecon”;

Arrays
int newInts[6];
int newPins[] = {2,4,8,3,6};
int newSensVals[6] = {2,4,-8,3,2};

Conversions
byte()
char()
float()
int()
long()
word()

Qualifiers
static                                //persists between calls
volatile                           //use RAM
const                               //make read only
PROGMEM               //use flash

Digital I/O
pinMode(pin, [INPUT,OUTPUT])
digitalWrite(pin, value)
int digitalRead(pin)                                        //Write high to inputs to use                                                                                                 pull up res

Analog I/O
analogReference([DEFAULT, INTERNAL, EXTERNAL])
int analogRead(pin)                                    //call twice if switching pins from                                                                                       high Z source
analogWrite(pin, value)                          //PWM

Advanced I/O
tone(pin, freqhz)
tone(pin, feqhz, duration_ms)
noTone(pin)
shiftOut(dataPin, clockPin, [MSBFIRST, LSBFIRST], value)
unsigned long pulseIn(pin,[HIGH, LOW])

Time
unsigned long mills()                               //50 days overflow
unsigned long micros()                         //70 min overflow
delay(ms)
delayMicroseconds(us)

Math
min(x,y)
max(x,y)
abs(x)
constrain(x, minval, maxval)
map(val, fromL, fromH, toL, toH)
pow(base, exponent)
sqrt(x)
sin(rad)
cos(rad)
tan(rad)

Random Numbers
randomSeed(seed)                               //Long or int
long random(max)
long random(min,max)

Bits and Bytes
lowByte()
highByte()
bitRead(x,bitn)
bitWrite(x,bitn,bit)
bitSet(x,bitn)
bitClear(x,bitn)
bit(bitn)                                                   //bitn: 0-LSB 7-MSB

External Interrupts
attachInterrupt(interupt, function, [LOW,CHANGE,RISING,FALLING])
detachInterrupt(interrupt)
interrupts()
noInterrupts()

Libraries
Serial.
begin([300, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 115200])
end()
int available()
int read()
flush()
print()
printIn()
write()

EEPROM (#include <EEPROM.h>)
byte read(intAddr)
write(intAddr, newByte)

Servo (#include <Servo.h>)
attach(pin, [min_uS, max_uS])
write(angle)                                                           //0-180
writeMicroseconds(uS)                                //1000 – 2000, 1500 is midpoint
read()                                                                       //0-180
attached()                                                            //Returns boolean
detach()

SoftwareSerial (#include <SoftwareSerial.h>)
SoftwareSerial(RxPin, TxPin)
begin(longSpeed)                                           //up to 9600
char read()                                                          //blocks till data
print(newData)                                              //or printLn(newData)

Wire (#include <Wire.h>) //For I2C
begin()                                                                //Join as master
begin(addr)                                                     //Join as slave @ addr
requestFrom(addr, count)
beginTransmission(addr)                       //Step 1
send(newByte)                                             //Step 2
send(char * newString)
send(byte * data, size)
endTransmission()                                    //Step 3
byte available()                                           //Num of bytes
byte receive()                                               //Return next byte
onReceive(handler)
onRequest(handler)

Python Quick Reference

sys variables
argv                                                  Command line args
builtin_module_names         Linked C modules
byteorder                                     Native byte order
check_interval                           Signal check frequency
exec_prefix                                  Root directory
executable                                   Name of executable
exitfunc                                         Exit function name
modules                                        Loaded modules
path                                                 Search path
platform                                        Current platform
stdin, stdout, stderr                File objects for I/O
version_info                                Python version info
winver                                            Version number

sys.argv for $python map.py loc -c zip –h
sysargv[0]                                   map.py
sysargv[1]                                   loc
sysargv[2]                                   -c
sysargv[3]                                   zip
sysargv[4]                                   –h

os variables
altsep                                             Alternate sep
curdir                                             Current dir string
defpath                                         Default search path
devnull                                          Path of null device
extsep                                            Extension separator
linesep                                           Line separator
name                                               Name of OS
pardir                                             Parent dir string
pathsep                                         Path separator
sep                                                   Path separator

Class Special Methods
__new__(cls)
__init__(self, args)
__del__(self)
__repr__(self)
__str__(self)
__cmp__(self, other)
__index__(self)
__hash__(self)
__getattr__(self, name)
__getattribute__(self, name)
__setattr__(self, name, attr)
__delattr__(self, name)
__call__(self, args, kwargs)
__lt__(self, other)
__le__(self, other)
__gt__(self, other)
__ge__(self, other)
__eq__(self, other)
__ne__(self, other)
__nonzero__(self)

String Methods
capitalize()                                  //locale dependent for 8-bit strings
center(width)
count(sub, start, end)
decode()
encode()
endswith(sub)
expandtabs()
find(sub, start, end)
index(sub, start, end)
isalnum()                                  //locale dependent for 8-bit strings
isalpha()                                   //locale dependent for 8-bit strings
isdigit()                                    //locale dependent for 8-bit strings
islower()                                 //locale dependent for 8-bit strings
isspace()                                 //locale dependent for 8-bit strings
istitle()                                    //locale dependent for 8-bit strings
isupper()                               //locale dependent for 8-bit strings
join()
ljust(width)
lower()                                   //locale dependent for 8-bit strings
lstrip()
partition(sep)
replace(old, new)
rfind(sub, start, end)
rindex(sub, start, end)
rjust(width)
rpartition(sep)
rsplit(sep)
rstrip()
split(sep)
splitlines()
startswith(sub)
strip()
swapcase()                        //locale dependent for 8-bit strings
title()                                   //locale dependent for 8-bit strings
translate(table)
upper()                              //locale dependent for 8-bit strings
zfill(width)

List Methods
append(item)
count(item)
extend(list)
index(item)
insert(position, item)
pop(position)
remove(item)
reverse()
sort()

File Methods
close()
flush()
fileno()
isatty()
next()
read(size)
readline(size)
readlines(size)
seek(offset)
tell()
truncate(size)
write(string)
writelines(list)

Indexes and Slices (of a=[0,1,2,3,4,5])
len(a)               6
a[0]                   0
a[5]                   5
a[-1]                 5
a[-2]                 4
a[1:]                  [1,2,3,4,5]
a[:5]                  [0,1,2,3,4]
a[:-2]                [0,1,2,3]
a[1:3]               [1,2]
a[1:-1]             [1,2,3,4]
b=a[:]               Shallow copy of a

Datetime Methods
today()
now(timezoneinfo)
utcnow()
fromtimestamp(timestamp)
utcfromtimestamp(timestamp)
fromordinal(ordinal)
combine(date, time)
strptime(date, format)

Time Methods
replace()
isoformat()
__str__()
strftime(format)
utcoffset()
dst()
tzname()

Date Formatting (strftime and strptime)
%a                 Abbreviated weekday (Tues)
%A                Weekdday (Tuesday)
%b                 Abbreviated month name (Nov)
%B                Month name (November)
%c                 Date and Time
%d                Day (leading zeros) (01 to 31)
%H               24 hour (leading zeros) (00 to 23)
%I                 12 hour (leading zeros) (01 to 12)
%j                 Day of year (001 to 366)
%m              Month (01 to 12)
%M             Minute (00 to 59)
%p               AM or PM
%S               Second (00 to 61) //range takes account of leap and double
leap seconds
%U              Week number (00 to 53) //Sunday is start of week. All days
in a new year preceding the first Sunday are considered to
be in week 0.
%w              Weekday (0 to 6) //0 is Sunday, 6 is Saturday
%W             Week number (00 to 53) //Monday as start of week. All
days in a neew year preceding the first Monday are
considered to be in week 0.
%x                Date
%X               Time
%y                Year without century (00 to 99)
%Y               Year (2016)
%Z               Time zone (GMT)
%%              A literal “%” character (%)

PHP Quick Reference

Array Functions
array_diff (arr1, arr2 …)
array_filter (arr, function)
array_flip (arr)
array_intersect (arr1, arr2 …)
array_merge (arr1, arr2 …)
array_pop (arr)
array_push (arr, var1, var2 …)
array_reverse (arr)
array_search (sysrecon, arr)
array_walk (arr, function)
count (count)
in_array (sysrecon, phpquickrefference)

String Functions
crypt (str, salt)
explode (sep, str)
implode (glue, arr)
nl2br (str)
sprints (frmt, args)
strip_tags (str, allowed_tags)
str_replace (search, replace, str)
strpos (str, sysrecon)
strive (str)
strstr (str, sysrecon)
strtolower (str)
strtoupper (str)
substr (string, start, len)

Filesystem Functions
clearstatcache ()
copy (source, dest)
fclose (handle)
fgets (handle, len)
file (file)
filetime (file)
filesize (file)
file_exists (file)
fopen (file, mode)
fread (handle, len)
fwrite (handle, str)
readfile (file)

fopen() Modes
r         Read
r+      Read and write, prepend
w       Write, truncate
w+    Read and write, truncate
a        Write, append
a+     Read and write, append

Regular Expression Functions
ereg (pattern, str)
split (pattern, str)
ereg_replace (pattern, replace, str)
preg_grep (pattern, arr)
preg_match (pattern, str)
preg_match_all (pattern, str, arr)
preg_replace (pattern, replace, str)
preg_split (pattern, str)

Regular Expression Syntax
^                    Start string
$                     End String
.                       Any single character
(a|b)              a or b
(…)                Group section
[abc]              Item in range (a,b or c)
[^abc]           Not in range (not a,b or c)
\s                     White space
a?                     Zero or one of a
a*                     Zero or more of a
a*?                   Zero or more of a, ungreedy
a+                    One or more of a
a+?                  One or more of a, ungreedy
a{3}                 Exactly 3 of a
a{3,}                3 or more of a
a{,6}                Up to 6 of a
a{3,6}             3 to 6 of a
a{3,6}?           3 to 6 of a, ungreedy
\                        Escape character
[:punct:]       Any punctuation symbol
[:space:]       Any space character
{;blank:]        Space or tab

PCRE Modifiers
i         Case insensitive
s         Period matches new ine
m       ^ and $ match lines
U       Ungreedy matching
e        Evaluate replacement
x        Pattern over several lines

Date and Time Functions
checkdate (month, day, year)
date (format, timestamp)
getdate (timestamp)
mktime (hr, min, sec, month, day, yr)
strftime (formatstring, timestamp)
strtotime (str)
time()

Date Formatting
Y         4 digit year (2016)
y          2 digit year (16)
F          Long month (November)
M        Short month (Nov)
m         Month (01 to 12) //with leading zeros
n          Month (1 to 12)
D         Short day name (Fri)
l           Long day name (Friday) (lowercase L)
d         Day (01 to 31) //with leading zeros
j          Day (1 to 31)
h        12 Hour (01 to 12) //with leading zeros
g        12 Hour (1 to 12)
H       24 Hour (00 to 23) //with leading zeros
G       24 Hour (0 to 23)
i         Minutes (00 to 59) //with leading zeros
s        Seconds (00 to 59) //with leading zeros
w      Day of week (0 to 6) //0 is Sunday, 6 is Saturday
z        Day of year (0 to 365)
W      Week of year ( 1 to 53) //Week that overlaps two years belongs to the year that contains the most days of that week. date(“W”, mktime(0,0,0,12,8,$year)) always gives correct number of weeks in $year.
t         Days in month (28 to 31
a         am or pm
A        AM or PM
B        Swatch Internet Time (000 to 999)
S         Ordinal Suffix (st,nd,rd,th)
T         Timezone of machine (GMT)
Z         Timezone offset (seconds)
O        Difference to GMT (hours) (e.g., +0200)
I           Daylight saving (1 or 0)
L          Leap year (1 or 0)
U         Seconds since Epoch //The Epoch is the 1st of January 1970
c           ISO 8601 (PHP5) //2016-06-09T08:54:23+1:00
r           RFC 2822 //Thu, 09 June 2016 08:54:23 +0100

How To Delegate Power Permissions In Windows XP

To grant the ability to change power management settings to limited users, edit the PowerCfg registry key.
This will set their power permissions similar to Power Users and allow limited users to adjust their own Power Options.

  1. Log in as Administrator
  2. Click Start then run
  3. In the run box type regedit
  4. In the registry editor search or drill down to:

HKLM\Software\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg

  1. Right click on the PowerCfg folder anc click permissions
  2. Click the Advanced button to set special permissions
  3. Select Users under the Name column then click edit
  4. Set the permissions to look like the image
Windows XP Power Permissions
Windows XP Power Permissions
  1. Log Back in as limited user

Limited Users can now change their power options without bothering the Administrator.

With Windows XP past its end of life…it’s still going strong!

Estimates indicate Windows XP is still running on 160 – 250 million machines, around 14% of the world market share (6 % in the USA).

The reasons for running Windows XP are vast but most companies have hung on to Windows XP due to:

  • Application incompatibility with later versions of Windows.
  • The time involved in migrating thousands of XP machines.
  • The shear cost of such a migration.
  • Having to train employees and support staff on later versions of Windows.

Application compatibility is the one I witness most often. There is a large amount of custom enterprise software that will only run on Windows XP. Most software of this nature does not play well in Windows XP mode on Windows 7 and XP mode is not supported in later versions of Windows. Windows XP mode is basically a virtual machine running Windows XP inside another version of Windows. This can be accomplished on any version of Windows with any virtualization software. If a machine is currently running Windows XP its a waste of effort for System Administrator to setup a new PC with Windows 8 or 10 and then setup a virtual machine running Windows XP.

Most companies that fall into incompatibility area are utilities and other industrial companies. 75% of water utilities still have to run Windows XP.

Many manufacturing companies simply cannot afford the downtime of $100,000 to $1 million and hour. These companies need a Windows XP machine to run their production machines and their general view is that not being connected to an outside network, the security risk is minimal.

Kiosks and ATM machines make up another large portion of systems that run software that will only work on Windows XP machines. 95% of ATM machines run Windows XP and I would say that’s a fair estimate for kiosks as well

Even the United State’s Navy pays Microsoft $9 million (with a contract ceiling of $31 million) to continue to support Windows XP. The Navy is not the only branch of the armed forces or the United States Government to continue running Windows XP

Companies running Windows XP shouldn’t be a shock to any System Administrator, there are plenty of Government and financial institutions still running Windows 2000 and earlier Operating Systems. Windows 2003 Server is past it’s end and still commands 50% of Windows Servers in production.

At 14 years old, Windows XP continues to go strong. It is only #2, behind Windows 7 in world wide operating systems. Though unsupported and a huge security risk, I can see Windows XP living on for the next five to ten years.