psychopyko welcome to psychopyko.com

27Jan/13

Six tips for the Chrome Developer Tools

If you've done any web development, you're probably familiar with the Chrome Developer Tools and how handy it is for debugging those nasty css/js bugs.

You're probably familiar with the bread and butter of the toolbar - inspect element, css tweaking, setting breakpoints in the JavaScript etc. So instead of going through those, I'm going to list a five tips here that you may not yet know and will hopefully make your debugging experience slightly less painful.

1. Super search: Cmd + Opt + F (Mac) / Ctrl + Shift + F (Win)

This shortcut is super useful for the times when you just do a massive "search all" to find a keyword across all your files. It will search through all your source files - html, css, js :) Once you've found what you were looking for, click on the search results to jump to the corresponding file.

Cmd + Opt + F (Mac) or Ctrl + Shift + F (Win) to search all yoru sources

 

2. Dock the toolbar on the right/bottom - the easy way

By default, the dev toolbar docks at the bottom and opens in a new window if you need more screen real estate for debugging. I personally don't like opening the toolbar in a new window - more than one debug session and it's easy to get lost between the windows. Depending on the page layout, what you're debugging etc you may want more vertical space than horizontal... introducing docking the toolbar to the right!

The easiest way is to long-press the bottom left button and select the 'dock to right' icon. You'll notice when the toolbar is docked to right, the icon will change to 'dock to bottom'. You can now easily toggle between dock on bottom and right by clicking on that icon. If you do ever want to open the toolbar in a new window, just long press on the icon and choose the 'new window' icon.

 

3. Clear console: Cmd + K (Mac) / Ctrl + L (Mac/Win)

This shortcut clears the contents of your console - useful when you've got a lot of debug stuff in your console and want to clear it out so there is less stuff to get in the way. You can also type "clear" as a command, but two keystrokes is much better than six.

 

4. Open/close the console: Esc (Mac/Win)

The console is very useful, but sometimes you want to hide it. Alternatively you might be inspecting an element when you want to open the console for a bit of sanity checking. If your hands are already on the keyboard, just hit the "Esc" key when you've got focus on the developer toolbar and it will open/close the console.

 

5. console.log("foo" + bar) vs console.log("foo", bar)

Using console.log("foo " + bar) is primitive, but definitely useful. This works if you're after the value of the variable; but being told that bar is an Object - [object Object] isn't all that helpful when debugging.

However, if you use a comma instead of a plus, Chrome Dev Tools will very kindly print the object and let you inspect the object instead :)

Example of difference

 

6. Make minified code suck less (ie. slightly more readable)

Unfortunately there comes a time when you'll be debugging and you'll step into some minified code which is pretty much completely uncomprehensible. Luckily, you can make the minified code slightly prettier by adding some formatting at the click of a button! The magic button to click is the one that looks like a pair of parenthesis: { }

The variable and function names may still make your head hurt, but at least you can now set breakpoints and make educated guesses as to what is going on.

10Feb/11

Windows to Mac (Part 1)

Making the switch from Windows to Mac can be quite challenging. There are lots of small differences, enough to make it almost annoying to use a Mac. However, once you get used to using your Mac you'll probably find it odd when you go back using a Windows machine. So here are some hints and tips that will hopefully make your experience with Macs less frustrating!

Some common (but confusing) shortcut symbols

Using keyboard shortcuts efficiently is probably one of the most annoying differences you'll experience when you first start using your Mac. The drop down menus generally all have the shortcut combinations displayed, but the symbols can often be quite confusing.

(Command/Apple) - Think of this as the "Control" key for Windows.

Alt/Option key (Alt/Option) - Think of this as the "Alt" key for Windows. The icon does sort of make sense... It's a path that is split... giving you an alternate option...

Control Key (Control) - Doesn't really map to a Windows key, just there so Mac can have lots of finger tangling shortcut combinations

Escape (esc) Key (Escape) - Ok, this isn't a common shortcut key, but it does make an appearance every now and then.

Some useful, generic Mac shortcuts

For many shortcuts you can try replacing "Ctrl" (Windows) for "Command" (Mac) and it should still work. eg. ctrl/cmd+n (new), ctrl/cmd+c (copy), ctrl/cmd+x (cut), ctrl/cmd+v (paste). There are some shortcuts that are more Mac specific, here's a few that I find quite useful and you should be able to use them regardless of what program you're running.

  • cmd+space - Spotlight! (Super useful, I'll explain later)
  • cmd+tab - Switch between applications*
  • cmd+tilda - Switch windows within applications*
    *Note: these both are equivalent to Window's "ctrl+tab", except Mac has the concept of an "active application" which is why you have "cmd+tab" to change your "active application" and then "cmd+tilda" to switch within the application itself.
  • cmd+q - Quits the current application
  • cmd+h - Hides the current application. Re-open the application by "cmd+tab-ing" to it, or select it from the dock. (I generally don't use this, but good to know if you accidentally hit this combo)
  • cmd+w - Closes the current tab (or window if no tabs) of the application, does not quit the application. (Should work for most applications)
  • cmd+shift+w - Closes the current window (ie. closes all tabs) of the application, does not quit the application. (Should work for most applications)
    Note: Unlike windows, closing a window in Mac doesn't necessarily close (quit) the application. So hitting the red circle/cross on the top left of the window or using the shortcut combo will generally only close the window, not the application.
  • cmd+comma - Opens the properties/settings window for that application
  • ctrl+click - Simulates a right click (or if you're using a trackpad you can set two fingers to be 'secondary tap' under System Preferences > Trackpad)
  • cmd+alt+esc - Opens the 'Force Quit' dialog - similar to ctrl+alt+del in Windows.

Spotlight (cmd+space)

Spotlight basically allows you to quickly open any application, file, folder etc that is on your Mac.

  1. Hit "cmd+space" and Spotlight will appear on the top right of your screen.
  2. Start typing in the name of a application, file, folder etc you want to open.
  3. See the results get displayed dynamically and use the up/down arrow keys to select what you want.
  4. Hit "enter" and there you go!
    Note: hitting 'esc' once will clear the text in Spotlight, hitting it again will close Spotlight

I've found Spotlight "learns" what applications/files you use most often, so you'll end up needing to type less :)

Another cool feature of Spotlight is you can use it as a calculator (eg. start typing in 2*21, you should see "2*21 = 42" appear as your first result). If you hit enter now, the calculator will open (unfortunately without the calculation you just entered) or hit escape twice to get back to whatever you were doing.

Mac specific applications

Many people will say that lots of software will only work on Windows, and they are probably right. However, you'll find that more and more programs are now compatible with both Windows and Mac.

Now, if Windows only software exists, there has to be Mac only software too right? Correct! So here are three Mac only applications that I find quite useful (all free of course)

  • Adium - A nice, simple instant messaging application that supports most of the common chat services (Google Talk, MSN etc)
  • Skitch - A cool screen capture tool that lets you take a shot of your screen (or part of it), draw/add text to it, and then share it online or save it to desktop (There is also a paid version available, but I think the free one is already super useful).
  • The Unarchiver - Somewhat like winzip/winrar combined - lets you expand compressed files (.zip, .rar, .gzip, .tar etc).
    ps. if you still have a Windows machine, I recommend 7-Zip for expanding compressed files.

There is one other Mac specific application that definitely deserves a mention - Quicksilver. There are many people that will swear by Quicksilver, saying that it's super powerful and helps them use their Macs super efficiently - I've seen it in action and indeed you can do lots of crazy and cool stuff with Quicksilver. However, I found when I installed it, I never quite got past the "cmd+space, open file/application" use case, so I decided to just stick with Spotlight. Give it a go if you want, it's free too.

So that's Part 1 of my attempt to help those who are new to the Mac world. Part 2 will follow shortly (hopefully) and will contain similar random-ish pointers that appear in no particular order. If you have any questions, please feel free to ask and I'll attempt to help you!

28Nov/09

Firefox Multitouch Gestures

For those of you who are unaware, I have converted to the "dark side" and now own and use a MacBook Pro laptop at home. One of the awesome things about the laptop is the multitouch trackpad. Used as part of the OS it is great - swipe 4 fingers down triggers expose swipe them up show desktop and a couple of others.

Having said that I spend a good chunk of my time on Firefox while using my Mac and there are some very useful multitouch gestures you can add! There are a couple of other tutorials out there already, but for some reason the ones I've found only talk about the twist left/right to move to the previous/next tab. Being curious me, I went exploring and found out how to get some more equally helpful gestures working!

» Continue reading "Firefox Multitouch Gestures"

22Aug/09

Point-and-shoot cameras: 5 useful tips

Sydney Opera House

Sydney Opera House

For those that are unaware, I have an interest in photography and love to just take random shots when I see something that appears interesting. But unlike many avid photographers, I don't have a fancy digital SLR Camera, instead I have a normal point-and-shoot camera (Fuji Finepix J110w).

As with most point-and-shoot cameras you are quite limited to the number of settings you can play around with even if it is in manual mode. Unfortunately this means many "How to take an awesome photo" tutorials out there are quite useless since you can't follow their suggestions of increasing or decreasing the ISO, aperture, shutter speed, exposure etc.

However, all is not lost as you can definitely still take awesome photos with your humble camera. Here are five tips that I find work quite well for me, if you have your own technique/tips I would be very interested to hear them :)

1. No Flash!

This might be a personal preference, but I find when you use flash when taking the photo in a dark/dim place, the light from the flash is usually too strong which makes the whole photo look artificial. The simplest solution is to try and brighten up the place - turn on a light, open the curtains etc. Lighting is quite important in taking a good photo, so the more flexible you can be with your lighting the better.

Another  alternative is to cover your camera's flash with a piece of paper/tissue. This somewhat subdues the flash while still providing a source of light. I've only tried this a couple of times and overall it worked quite well. Of course, you can always take two photos, one with the flash and one without - that way you will have both alternatives and you can pick the best one.

Having said all that, there are always exceptions when using flash and as weird as it may sound, using flash outdoors (where it is nice and bright) can often give you better photos - it lights up your subject just enough to make them clear, but since the surrounding is bright as well the flash doesn't stand out like a sore thumb.

» Continue reading "Point-and-shoot cameras: 5 useful tips"

4Jun/08

effective powerpoint presentations

pacman like pie charts

Recently my friend and I, have for some reason, talked to a lot of people about presentations - and we've been trying to convert them all to use "bullet-point-less" presentations. For those who we've talked to, you've probably already heard this, for those who haven't...welcome to a whole new perspective on presentations!

Late last year, through random blog reading we found a wonderful blog all about presentations: Presentation Zen. There was one post in particular that compared the different presentation styles of Steve Jobs and Bill Gates which I feel is a great introduction and gets straight to the point.

» Continue reading "effective powerpoint presentations"

16Mar/08

three useful sites for group work

Now that University has started, it is getting busier, and assignments are already being handed out - despite having only finished Week 1! When we got the details of the group assignment for the semester, it gave me the idea for this post - useful sites for group work. For pretty much all my group assignments from uni (and group work outside uni) I've used some/all of the below sites and they have definitely helped with working together.

» Continue reading "three useful sites for group..."

16Nov/07

10 useful tips to help with research

"Copy from one, it's plagiarism; copy from two, it's research."
Wilson Mizner

Research is probably something that uni students can't escape from - especially if they're doing honours and have to write up a thesis. Well, recently for one of our subjects which is a bit like preparation for thesis, we needed to write a research proposal. While searching through the Internet for credible sources, I discovered (or got told) a few tips and felt it would be a good idea to share them. So here are my 10 tips to hopefully make research a less stressful task!

» Continue reading "10 useful tips to help..."

15Oct/07

how to save water

Few months ago, I signed up to Blog Action Day...

On October 15th, bloggers around the web will unite to put a single important issue on everyone’s mind - the environment

If you haven't guessed from the title, and from that short intro, this post will be about the environment - namely how to save water.

The reason for this topic is simply because Australia is facing severe drought conditions. A quick Google gives us an article from Wikipedia with the different water restriction levels currently in place:

  • Brisbane: Stage 5
  • Adelaide: Stage 3
  • Canberra: Stage 3
  • Melbourne: Stage 3
  • Sydney: Stage 3
  • Hobart: Stage 1
  • Darwin: none
  • Perth: permanent restrictions

As you can see pretty much all the major cities have some form of restriction in place. I'm not quite sure what 'permanent restrictions' for Perth really means, but either way it doesn't sound good.
» Continue reading "how to save water"

25Sep/07

6 simple tips to help you snack less

If you know me, you'll know that I'm not a picky eater and I can eat a lot - especially when it comes to snacks. And if you're like me once I start eating/snacking I just can't seem to stop! Initially, I tried the approach of no snacks at all with the reasoning that if there are no snacks then there's nothing to snack on.

However, since I hadn't snacked in ages, and knew I didn't have any snacks in my room it failed horribly whenever sweets and junk food were in my reach - I just pigged out on them. Considering this "free food" is semi-regular (team meetings, birthdays etc) it doesn't help with reducing the amount of snacking.
» Continue reading "6 simple tips to help..."

Tagged as: 4 Comments
17Sep/07

Forgot your password?

Not so long ago, I was reading Coding Horror and came across two rather interesting posts: Passwords vs Pass Phrases and Passphrase Evangelism. If you don't want to read those posts (though I highly recommend you read them) the golden rule is "stop thinking of passwords as single words, and start thinking of them as pass phrases".

A few people I know (including myself) have problems coming up with strong passwords and remembering them - and I think this is the solution! From psychology we learnt that on average people remember 7 things - be that 7 letters or 7 words. So that means, a password is usually 7 characters, but if you remember a pass phrase that will be 7 words - which is approximately 28 characters if you average 4 letters per word!
» Continue reading "Forgot your password?"

Tagged as: 3 Comments