Categories
Fixing Stuff Samuel Technology

quick way to limit wp-admin logins on wordpress

this is a really helpful little code snippet to limit logins to your wordpress site.  You put this .htaccess file in your /wp-admin/ directory:

 

# Limit logins and admin by IP
<Limit GET POST PUT>
order deny,allow
deny from all
allow from YOUR IP ADDRESS
</Limit>

Categories
Inspirational Samuel

Great post on empathy

I stumbled upon this post today, not really sure what I was doing or how I came across the link but I loved the post. It hit home for me in a lot of ways and if nothing else just so I have an easy way to find it I wanted to jot it down:

 

http://sivers.org/real

Categories
Fixing Stuff Laravel Samuel

Setting up Laravel 4 for the first time onWAMP server

This post is meant as a helpful guide for setting up laravel 4 on a windows machine with WAMP server installed.  The process is a little cumbersome so I wanted to jot down the steps.  Hopefully these notes on setting up laravel on local windows dev environment help someone out there on the interwebs… and I’m sure I will refer back to these on occasion.

–edit–

for a list of helpful php artisan commands please refer to the bottom of this page

–end edit–

1.) Enable openSSL in wamp server (allows us to install composer which is step #2)

  • From the wamp tray icon hit php > php extensions > php_openSSL (note we also need both php_curl & php_socket enabled for later steps)
  • restart wamp server
  • navigate to and open (C:\wamp\bin\php\php-5.4.3\php.ini).  Search for openssl and remove the comment in front of the line (then save the file)
  • now were ready to install composer

2.) Install Composer.  On windows you can install composer by downloading this setup file (https://getcomposer.org/Composer-Setup.exe)

  • if you did not enable openssl correctly you will get the following error (The openssl extension is missing, which will reduce the security and stability of Composer. If possible you should enable it or recompile php with –with-openssl).  If you get this error go back and re-visit ((C:\wamp\bin\php\php-5.4.3\php.ini).  openSSL needs to be enabled in this file for composer to install
  • now open up the command prompt and navigate to the directory you will store laravel in and install composer.  e.x.  CD C:\wamp\www\laravel) then type “composer install”.  The install will run and provide you feedback on if it was successful or not.

—-helpful note for newer version of wamp server—-
after installing a new version of wamp server you might have an issue using composer (you will have to re-install it and re-setup your environment varialbes to get it to work). Even after that though if your getting the following error when trying to run composer install then the steps below will help: /c/ProgramData/ComposerSetup/bin/composer: line 10: php: command not found

  • : Open git bash
  • go to your work directory like if you have wamp then c:/wamp/www.
  • type “composer” if you can see the composer command list then its installed correctly
  • type “composer self-update”.

Once the update runs you will be able to then navigate to your project directory and run “composer install”.

3.) Add PHP to windows environment variables

  • start > environment variables for your account > Path > edit (now chose the path variable under “user variables”)
  • add (C:\wamp\bin\php\php5.5.12) so full line will look like: (C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\wamp\bin\php\php5.5.12)

4.) Download Sqlite

5.) Download gitbash (http://git-scm.com/downloads).

  • this is not needed but it is a nicer user interface than the default windows command prompt
  • you can navigate to a file, right click > git bash, then command prompt opens up in this directory… no need to cd into the directory manually

6.) Run first local migrations

  • make a local database config file in (app\config\local\database.php)
  • change the default to sqlite (line 29 ‘default’ => ‘sqlite’,)
  • change the directory path to ../storage/database/ (line 51 ‘database’ => __DIR__.’/../../storage/database/production.sqlite’,)
  • open git bash in your laravel directory
  • run “php artisan migrate” (if having problems using local config run php artisan –env-local migrate)

7.) Run laravel on local environment

  • navigate to your laravel directory (either through windows command prompt, or by going to the file right clicking and hitting git bash)
  • type “php artisan serve”
  • go to http://localhost:8000

 

Hopefully these notes help someone out there in the interwebs.  Getting laravel up and running for the first time can feel like a somewhat daunting task, but the rewards of being able to work on a local environment are definitely worth it…. and a real plus to using sqlite is that you technically don’t even have to start wamp server now to test your local site. Once you have the local config files setup, you can open git bash, run php artisan serve and then artisan takes care of serving your actually website on localhost 8000…. which is pretty neat.

 

–random helpful notes & commands —

-runing migrations, open git bash in the laravel directory, and run: “php artisan migrate”

-to detect local and production environments edit bootstrap/start.php

$env = $app->detectEnvironment(array(
‘local’ => array(‘homestead’, ‘computer-name’),
‘production’ => array(‘server-name’),
));

 

//to detect what your server/computer name is locally put this in the top of the starts.php file and navigate to any page

echo gethostname();exit();

-to seed the db run “php artisan db:seed”

  • to do seeds and migrations locally run “php artisan –env-local migrate” and or  “php artisan –env-local db:seed”
  • if getting an error of “cant replicate database seeder” run “composer dump-autoload”

 

 

 

Categories
Samuel Twenty Somethings

Playing Contact Sports

If I ever have a child, and its strange to think I’m technically at the age where having a child is a normal thing to do, but if I do end up having a kid I’m going to make sure they have the opportunity to play a team sport (preferably a contact sport…. and if I’m honest hopefully they choose hockey.)

Playing on a team is such an interesting and enriching experience.  You learn to count on other people, work together with other people.  You learn what if feels like to be part of something larger than yourself, and you also get a first had view of adversity.  Every one of these experiences will help them as an adult, and looking back on my 27 years of life I think a lot of the make up of my personality stems from playing hockey as a kid.  Its so fascinating how much of it is woven into the fabric of my being, take for example:

– I really look down on people who fake things (injuries, emotions, tell lies ect…).  In hockey this is called “taking a dive”, and its one of the worst things you can do.

– When I’m working in a team setting and we fail, my first gut reaction is always to look at myself and think about what I could do better. More so than any professional sport, hockey players don’t pass blame, its part of the culture.  Its a team game, but when something goes wrong look in the mirror, don’t look over your shoulder for someone to blame.  I’m not sure how cultures develop around a sport. Take for example soccer, its part of the game to take dives and roll around pretending you are hurt (probably the main reason soccer has not caught on more in the US).  I’m not sure when or how that started, and I’m also not sure how the culture of toughness started around hockey but both cultures are are large part of both sports.

– I value “assists” more than my own personal goals.  More than any other sport hockey recognizes “assists”.  Some would argue too much so, but in hockey the 2 previous people to touch the puck get credit with an assist when a goal is scored.  In basketball unless you make a pass that leads directly to a point you do not get an assist.  In baseball you can get a throwing assist, but you can’t get 2 on the same play on a long relay.  In football only the QB and Receiver get on the stat sheet for a touchdown…. the list goes on. In hockey the assist is valued more so than other sports

– I have a temper and I will not back down from anyone.  I can credit this one almost directly to playing hockey.  In general I’m a pretty passive or at least non aggressive fun loving person.  But I’m not afraid to get into a situation and mix things up (some credit for this must also go to the years I’ve spent studying kempo karate) but my first memories of mixing things up come from middle school playing hockey and learning to not let someone take advantage of me.  If your too passive in life, people will take advantage of you. If your too much of a dick in life somewhere down the line there will be an enforcer around to tune you up (https://www.youtube.com/watch?v=2xTtkozOvdg)… I never get tired of watching that fight!

 

I’m sure I could sit and write about 2 pages worth of these snippets on how hockey has effected my personality, but the moral of the story is if I have a kid someday (Girl or Boy) I’m going to encourage them to follow their heart and do whatever it is they love… but you can bet I will be encouraging them to play hockey!

 

 

 

 

 

 

Categories
Fixing Stuff Samuel

Troubleshooting laravel white screen of death

This is just a note for myself, so please excuse the lack of polish:

 

If laravel is giving a “no data provided” screen, and turning on debug on does not produce any helpful results. To fix the issue replace whatever is in the .htaccess file with:

 

Options+FollowSymLinksRewriteEngineOnRewriteCond%{REQUEST_FILENAME}!-d
RewriteCond%{REQUEST_FILENAME}!-f
RewriteRule^ index.php [L]

 

Categories
Fixing Stuff Samuel Technology

Fixing Windows 8 VPN Remote Resource Discovery

I ran into an issue today where a new laptop could not connect to remote resources even after connecting through a VPN.  This laptop has windows 8, and by default windows 8 and as it turns out by default windows 8 does not look for or load resources from the VPN connected network.  There is an easy fix for this however:

 

1.) Click on the internet connection bars in the lower right hand corner of your screen (the 4 bars in the bottom task bar)

2.) Click view connection settings

3.) Click on the VPN connection you want to edit, then hit “edit”

4.) Turn on the top option “find devices and content”.

 

After you toggle “find devices and content” on then you will be able to discover any shared resources on your remote network 🙂