Chrome now comes with an integrated PDF Viewer. But it’s not enabled by default. Here’s how to enable it.
Open the following URL:
Search for “Chrome PDF Viewer” and click onĀ enable.
by Florian Fankhauser
Chrome now comes with an integrated PDF Viewer. But it’s not enabled by default. Here’s how to enable it.
Open the following URL:
Search for “Chrome PDF Viewer” and click onĀ enable.
A useful little shortcut I wasn’t aware of util now: How to cycle thru the windows of the current application
cmd + <
This is useful e.g. to toggle between main application and help window.
I recently found this amazing video with John Cleese on SvN:
http://37signals.com/svn/posts/2539-the-amazing-john-cleese-shares-his-wisdom
If you need a simple way to upload a file to an FTP-server from commandline or from a script, you could use cURL:
curl -v -T file.txt ftp://username:password@myserver/mydir/
The -v turns on verbosity and -T aktivates file-uploads.
Recently in a DDD project I needed a mock implementation of a repository interface for implementing my unit tests. In my first attempt I used a simple HashMap for storing my domain objects in my mock implementation. This worked fine in most situations but didn’t behave like the real database implementation in the following case:
With the real database implementation I would get the object without the changes from the editing process, since the changes never got saved. But in the mock implementation the changes were visible. The reason is simple: Since the mock repository gives me only a reference to the object in the HashMap, all changes to this object are visible to all of the other references.
I found the following solution for this problem: Making deep copies in the mock repository for all objects passed in and out. That way changes to an object are never made to the object in the HashMap until I explicitly save the object.
For making deep copies I used the method described by Philip Isenhour on his website.
A simple mock repository implementation looks like this:
public abstract class MemoryRepositoryBase<K, T> { protected Map<K, T> map = new HashMap<K, T>(); public T findById(K id) { T obj = map.get(id); if (obj != null) { return (T) DeepCopy.copy(obj); } return null; } public void save(T obj) { T copy = (T) DeepCopy.copy(obj); map.put(copy.getId(), copy); }; }