Feb 07

PS3 YouTube App – unable to contact youtube fix

I was getting “Unable to contact YouTube”. I believe my current version as of writing is 1.0.4.

 

This is how I fixed it.  I change the DNS settings on the PS3, to point to 8.8.4.4, and 8.8.8.8 (google’s DNS servers).  After this change, the youtube app worked just fine.

I gave my PS3 a static IP, and and applied the proper settings. Test the PS3 internet settings, and start the YouTube app.  Everything should work, at least it did fo rme.

 

Hope this helps… drop a line if it did.

Jan 18

Mass VHOST wildcard, mapping to subdomain to folder

The original problem:

Since I jump from project to project a lot, I have lots of project folders.

 

Summary of the solution:

use dnsmasq, and a mass vhost setup.

 

 

Problem in detail:

Normally, you’d have to:

  • create a subdirector for your project
    • all the standard setup stuff for your project.
  • Setup an apache VHOST
  • Edit your hosts file

 

What I wanted to accomplish was avoiding fiddling with the vhost and hosts file, each and every time I setup a new project.

I wanted to map all http://<wildcard>.localhost.com to /www/hosts/wildcard.localhost.com/www

 

 

The solution I found that works for me:

  • Dnsmasq, which will auto resolve *.localhost.com to 127.0.0.1
    • Install
      • OSX: $> sudo port install dnsmasq
      • Debian/Ubuntu: $> sudo apt-get install dnsmasq
    • Dnsmasq Setup
      • Editing the /etc/dnsmasq.conf file (with the appropriate permissions)
        • $> sudo nano /etc/dnsmasq.conf
        • Add the following lines

address=/localhost.com/127.0.0.1

address=/.localhost.com/127.0.0.1

listen-address=127.0.0.1

 

  • Setup your OS
    • Make sure your OS is pointing to 127.0.0.1 as a DNS server.
  • Restart dnsmasq, so that the dnsmasq changes take effect
  • Apache, setup a dynamic mass vhost setup file.

 

# get the server name from the Host: header

UseCanonicalName Off

 

# splittable logs

LogFormat “%{Host}i %h %l %u %t \”%r\” %s %b” vcommon

CustomLog logs/access_log vcommon

 

<Directory /www/hosts>

# ExecCGI is needed here because we can’t force

# CGI execution in the way that ScriptAlias does

Options FollowSymLinks ExecCGI

AllowOverride All

Order allow,deny

Allow from all

</Directory>

 

RewriteEngine On

 

# a ServerName derived from a Host: header may be any case at all

RewriteMap  lowercase  int:tolower

 

## deal with normal documents first:

# allow Alias /icons/ to work – repeat for other aliases

RewriteCond  %{REQUEST_URI}  !^/icons/

# allow CGIs to work

RewriteCond  %{REQUEST_URI}  !^/cgi-bin/

# do the magic

RewriteRule  ^/(.*)$  /www/hosts/${lowercase:%{SERVER_NAME}}/www/$1

 

## and now deal with CGIs – we have to force a handler

RewriteCond  %{REQUEST_URI}  ^/cgi-bin/

RewriteRule  ^/(.*)$  /www/hosts/${lowercase:%{SERVER_NAME}}/cgi-bin/$1  [H=cgi-script]

 

 

 

Make a directory

$> mkdir -p /www/hosts

$> cd /www/hosts

 

Now for each domain you’re going to have repeat below:

 

Lets call say you want to start a project called sandbox.

 

$> mkdir –p sandbox.localhost.com/www

sandbox is the subdomain we are using.

Restart apache, so that the conf file will puck up the new domain.

 

In your browser, navigat to http://sandbox.localhost.com

You should see an empty folder…  the setup portion is not done.  You are now able to start developing your site in your new document root, /www/hosts/sandbox.localhost.com that maps to sandbox.localhost.com

 

NOTES:

mobile devices won’t be able to connect to this site… so you’ll either have to setup your router to use dnsmasq (dd-wrt), or another method.

 

Addition notes:

setup instructions for dnsmasq is available here:

http://inspirix.wikispaces.com/dnsmasq-on-OSX

 

 

http://www.justincarmony.com/blog/2011/07/27/mac-os-x-lion-etc-hosts-bugs-and-dns-resolution/

ignore the stuff below this... as it's more for my own sake... but it's here to share.

sudo port install dnsmasq
sudo cp�/opt/local/etc/dnsmasq.conf /etc/dnsmasq.conf
sudo mkdir -p /System/Library/StartupItems/DNSMASQ
3.) sudo mkdir -p /System/Library/StartupItems/DNSMASQ

4.) sudo nano /System/Library/StartupItems/DNSMASQ/DNSMASQ

#!/bin/sh

. /etc/rc.common

if [ "${DNSMASQ}" = "-YES-" ]; then
  ConsoleMessage "Starting DNSMASQ" 
  /opt/local/sbin/dnsmasq
fi

5.) sudo nano /System/Library/StartupItems/DNSMASQ/Startup\ Parameters.plist

{
  Description = "Local DNSMASQ Server";
  Provides = ("DNS Masq");
  OrderPreference = "None";
  Messages = 
  {
  start = "Starting DNSMASQ";
  stop = "Stopping DNSMASQ";
  };
}

6.) Add line to /etc/hostconfig

DNSMASQ=-YES-

7.) sudo chmod +x /System/Library/StartupItems/DNSMASQ/DNSMASQ

8.) sudo /System/Library/StartupItems/DNSMASQ/DNSMASQ

9.) In network settings make sure 127.0.0.1 is in your dns server list.  If you do:

  dig google.com

  You should see something like this near the bottom (if not, your network settings need to 
  be applied.. try this to flush dns cache: dscacheutil -flushcache ):
    ;; SERVER: 127.0.0.1#53(127.0.0.1)

  # test it.
  ping somewhere.localhost.com
  : PING somewhere.dev (127.0.0.1): 56 data bytes
  : 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.031 ms

add the line to /etc/dnsmasq.conf
$> sudo nano -w /etc/dnsmasq.conf ## or your favourite editor, as root.

address=/localhost.com/127.0.0.1

Clear your dns cache.

dscacheutil -flushcache

Troubleshooting:
You may need to setup your network connection to point your DNS to localhost first.

sudo kill -HUP `cat /opt/local/var/run/dnsmasq.pid`

my vhosts Magic

Alias /phpmyadmin /opt/local/www/phpmyadmin

<directory "/www">
	Options -Indexes FollowSymLinks
	AllowOverride AuthConfig FileInfo
	Order allow,deny
	Allow from all

<directory "/opt/local/www/phpmyadmin">
	Options -Indexes FollowSymLinks
	AllowOverride AuthConfig FileInfo
	Order allow,deny
	Allow from all

UseCanonicalName Off

LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
CustomLog logs/access_log vcommon

# include part of the server name in the filenames
VirtualDocumentRoot /www/hosts/%1/www

Aug 30

Migrating to google apps, from an old mail server.

Here’s was my problem:

I had a gmail email address, and my own domain (lloydleung.com, this site). I never setup lloydleung.com under google apps, as I already had gmail setup to pull from mail.lloydleung.com. Now that I’m leaving my current hosting provider, textdrive/joyent, i needed to migrate mail.lloydleung.com to another place.

Google apps, I’ve already set it up for a few clients, so why not. However, my problem is… how could I consolidate my emails?

I had my @gmail address, which housed my @lloydleung.com emails. While needing to change the DNS MX records at the same time.

Solution

  1. @gmail address, stop pulling from mail.lloydleung.com, and pull from the mail server IP instead. Not the domain name.
    • Reason: While the DNS change is propagating across the net, some emails will still go to the old mail server.
  2. Setup google apps for lloydleung.com. Lets call this @app
    • Make the appropriate MX, and CNAME changes as required by google apps.
  3. @app, setup the mail account to pull from @gmail pop3 account.
    • Ensure @gmail pop3 access is enabled.
    • Reason: any emails going to the old mail server, will be pulled via the IP. Finally, all emails will be pulled from @gmail, to @app.

Lets say you wanted to migrate a webmail account that you already had, this would even be easier:

  1. Setup an google apps account, lets refer to this as @app
  2. Setup the @app, to pull via pop3 to your current mail server’s IP.  Or domain name, if you don’t have a custom mail.<your domain>.<tld> server.
  3. Change you DNS records to what google has asked of you.

So, what would happen if the above case applied to me, any emails going to mail.lloydleung.com on joyent, will be pulled by my google apps account via it’s IP of the mail server (not the hostname, as the DNS records are propagating).   Any mails going to mail.lloydleung.com with the updated MX records, will be going to google apps directly.

 

Simple, tidy… hope this helps people.

 

[Update 2012-08-31 1700 China Standard Time]

#1 Google apps, failed to import about 30% of my emails.  So now I have to use thunderbird, and IMAP to move the remaining.

#2 “Chats” don’t get moved over.

Aug 30

flush clear dns on Mac OSX 10.7+ 10.8+

The following two commands should work in OS X, 10.7+


dscacheutil -flushcache
sudo killall -HUP mDNSResponder

sudo killall -HUP
dnsmasq

Mind you, dscacheutil never worked for me… the second has always worked for me.

 

Update 2012-10-17:

  • Added killall for dnsmasq
  • If you’re pinging something that you’re expecting another ip, check your network configuration, and make sure 127.0.0.1 is one of your dns.

Mar 12

Magento Customer Segments vs Customer Groups

A good primer is located here:

http://gregdemetrick.com/2011/10/06/magento-customer-groups-vs-segments/

 

One thing I really wanted to add to that list so others can know:

Customer groups are related the catalog promotional rules.

vs.

Customer segments are related to shopping cart promotional rules.

Mar 12

Magento customer segment by past purchase history

I wanted to fulfil the following use case:
Create a customer segment based on past purchase history. If a user has purchased SKU-X, they are to belong to a given customer segment.

The problem was, I could not remember why the SKU was not listed in the drop downs while adding a condition in the purchase history.

Enabled “Use for Promo Rule Conditions” on the “SKU” attribute; it allowed “SKU” to show up in the promotional drop downs.

Oct 29

Peacock Lumber, new project.

Just came form Peacock Lumber, in Oshawa. Great friendly bunch. Really helpful, and willing to help.

I would recommend them to anyone needing lumber/wood supplies.

Bought some 3/8″ baltic plywood… secret as to what I’m making for now. :)

Jan 17

What I intend on writing about in the near future

note to self, write about the following:

magento objects. Specifically product and customer objects
magento optimization.
titanium php development.

Nov 23

Windows 7, links not working

If you get an error message like:

“this operation has been canceled due to restrictions in effect on this computer”

Culprit is google chrome.

  1. uninstall google chrome, through it’s uninstaller, not the windows uninstaller
  2. reinstall chrome
  3. restart any application that is still giving you a problem.  Such as outlook.

Drop a line, if this helped.

Jul 31

Inbox zero, years later…

It’s been over three years now, and inbox zero is still happening.

I’m throwing everything into an archive folder, for each year’s quarter seems to be working well.

Does it give me more productivity? In a single word, yes.

Older posts «