Categories
Fixing Stuff Laravel

Link to PDF document in laravel 5 blade file

this is a pretty simple issue but just wanted to jot down this note in case anyone out there is trying to link to an image or pdf asset in their laravel blade file and its not working. The process to do this looks like:

a href="{{ asset('/assets/folder-name/filename') }}" target="_blank"> Link Name

so for example if you had a PDF that you wanted to link to it would look like:

a href="{{ asset('/assets/folder-name/file-name.pdf') }}" target="_blank"> File Name

Categories
Fixing Stuff Julia

How to stop a Brinks/ADT alarm from beeping…even when it’s not active

So, for the past several weeks my landlord has said he would call about fixing the unused Brinks alarm system in our apartment. We’ve got two keypads and for the most part they were an eyesore when we moved in but otherwise worthless. Until they started beeping. Once every 12-18 hours long, loud beeps would occur until we pressed the cancel button on the keypad; in the middle of the night, as I was getting home from work and when I was home alone in the shower and thought maybe I was under attack…

Since my landlord was not moving fast enough (though apologetic) I decided to take matters into my own hands. In case anyone is running into the same issue, here’s how to disarm a disconnected alarm that won’t shut up!

1. Get a Phillips screw driver.

2. Locate the power box for the alarm. For me this was in a closet in my entryway. It looks like this:

image

3. Use the screwdriver to open the box, and once opened locate the battery. Pull the black cord off the battery (mine was pretty stuck, don’t be afraid to yank on it). Here’s what it looks like with the black cord unplugged from the top of the battery:

image

4. Look down from the box, or in my case if a hole with wires is drilled into the wall then look on the other side of the wall. You should see something that looks like a small white speaker plugged into an outlet. It’s screwed in, so grab that screw driver and unscrew it and the 4 wires on its backside once it’s free from the outlet/wall. Here’s what the box looks like.:

image

5. Push any wires into the wall, close up the power box and pour yourself a drink as you celebrate the lights on your alarm keypad going dead. No more beeping!! Your partner and nighbors will thank you.

And I thought I wasn’t handy. Boo-ya. Next up, trying not to die as I get a step stool at the top of my porch steps to figure out how to replace the light bulb in the Fort Knox of sconce lighting.

Categories
Books Julia

A good book

I just finished reading a book about a young girl whose grandmother dies and leaves the girl to find out about her life before she was a grandmother; and to learn the lesson of how this girl and her mother and grandmother are connected to the people who live in their 6 flat building. The way this kid (she’s 7) who’s a wise “old soul” does this is through realizing that the fairy tales her grandmother told her growing up had elements of truth to them. Left for her to decode on her own. It was reminiscent of the movie Big Fish, if you’ve seen that, where the dad tells fantastical stories that don’t turn out to be totally untrue. This kid is hilarious and way smarter than other kids her age and she gets picked on for it. Her grandmother used their stories so she’d have an escape and took her to imaginary lands where she could be the hero.

This book about the little girl and her grandma was about loss and love, how people are rooting for you when you don’t even know it, and it even tied in some magic and love for Harry Potter. When the dog dies, who from the girl’s vantage point is as big as a human, I cried so hard I couldn’t breathe. Not because I’m an animal lover but because it was the moment in the book when the girl realizes how much people (and not people) are trying to protect her despite their own lives they are trying to live. She learns that she isn’t the only one reeling from the loss of her grandmother, that other people knew her grandmother from another time and grieve her too. Like how my mom’s college roommate walks in a 5k for breast cancer every year with her daughter in memory of my mom, but from a time before my mom was a mom, and when she meant so much to this woman as a roommate and a friend. This book reminded you you of the power of a good story – both through the tales the grandmother created for her granddaughter and through the story of the girl finding truth in them.

go read: My Grandmother Asked Me To Tell You She’s Sorry.

 

Categories
Laracast Series Notes Samuel

Notes from Laracast PHP series

php -v in gitbash shows version of php installed on the server

php -h shows a bunch of help options

php -S localhost:8888 (this starts a web server, similar to the php artisan server option)

sublime text is cheaper alternative to phpstorm (we might want to look at this once our phpstorm license expires)
atom is another editor Jeff likes and this open source, seems like a very cool program.

Categories
Fixing Stuff Laravel Samuel

Fixing Local Laravel Migration On Wamp 3.0.6

So We ran into an issue today when trying to migrate an old project on a newer version of wamp. The error we kept getting is:


[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default val
ue for 'created_at' (SQL: create table `marketing_sources` (`id` int unsign
ed not null auto_increment primary key, `name` varchar(100) not null, `note
s` text null, `created_at` timestamp default 0 not null, `updated_at` times
tamp default 0 not null) default character set utf8 collate utf8_unicode_ci
)

This error is caused by mysql not accepting a timestamp of 0 as the default set time. To fix this issue open up:

app > config > local-environment-folder > database.php

Then add the following line:
'strict' => true

*please note if you are using mysql then add this line to the mysql array.

Categories
Code Academy php unit Samuel

PHP Unit 11 advanced Arrays and Maps

lesson 1 Review of Arrays:


$fruits = array ('bananas', 'apples', 'pears');
echo $fruits[1]; /* Your code here! */

Lesson 2 Associative Arrays


// This is an array using integers as the indices...
$myArray = array(2012, 'blue', 5);

// ...and this is an associative array:
$myAssocArray = array('year' => 2012,
'colour' => 'blue',
'doors' => 5);

// This code will output "blue"...
echo $myArray[1];
echo '
';

// ... and this will also output "blue"!
echo $myAssocArray['colour'];

Lesson 3 Using Arrays as Maps


// This is an array using integers as the indices.
// Add 'BMW' as the last element in the array!
$car = array(2012, 'blue', 5, 'BMW');

// This is an associative array.
// Add the make => 'BMW' key/value pair!
$assocCar = array('year' => 2012,
'colour' => 'blue',
'doors' => 5,
'make' => 'BMW');

// This code should output "BMW"...
echo $car[3];
echo '
';

// ...and so should this!
echo $assocCar['make'];

**this lesson errors out when you try to submit it. Add a line after the ‘make’ line, something like ‘make’ => ‘BMW’);+ and hit submit. When it errors out then delete the + after the ; and hit submit again. Seems to be a bug with code academy validation.

Lesson 4 Accessing Associative Arrays


// This is an array using integers as the indices...
$myArray = array(2012, 'blue', 5, 'BMW');

// ...and this is an associative array:
$myAssocArray = array('year' => 2012,
'colour' => 'blue',
'doors' => 5,
'make' => 'BMW');

// This code will output "blue".
echo $myArray[1];
echo '
';

// Add your code here!
echo $myArray[1];
echo $myAssocArray['make'];

Lesson 5 Iterating Over Associative Arrays


$food = array('pizza', 'salad', 'burger');
$salad = array('lettuce' => 'with',
'tomato' => 'without',
'onions' => 'with');

// Looping through an array using "for".
// First, let's get the length of the array!
$length = count($food);

// Remember, arrays in PHP are zero-based:
for ($i = 0; $i < $length; $i++) { echo $food[$i] . '
';
}

echo '

I want my salad:
';

// Loop through an associative array using "foreach":
foreach ($salad as $ingredient=>$include) {
echo $include . ' ' . $ingredient . '
';
}

echo '

';

// Create your own array here and loop
// through it using foreach!

$hockeyTeams = array (
'blues' => 'great',
'hawks' => 'bad',
'wings' => 'worst');

//loop through array using "foreach"
foreach ($hockeyTeams as $team=>$include) {
echo $include . ' ' . $team . '
';

}

Lesson 6 Multidimensional Arrays

$deck = array(array('2 of Diamonds', 2),
array('5 of Diamonds', 5),
array('7 of Diamonds', 7),
array('8 of Hearts', 8));

// Imagine the first chosen card was the 7 of Diamonds.
// This is how we would show the user what they have:
echo 'You have the ' . $deck[2][0] . '!';

Lesson 7 putting it all togather


// On the line below, create your own associative array:
$myArray = array (
'cubs' => 'should hopefully be out soon');

// On the line below, output one of the values to the page:
echo $myArray['cubs'];

// On the line below, loop through the array and output
// *all* of the values to the page:

foreach ($myArray as $baseballTeam=>$list){
echo 'the' . ' ' . $baseballTeam . ' ' . $list;
}