Software Engineer

Category: Hints

How to drag music and videos onto iPhone/iPad using iTunes

On an iPad I previously simply dragged some videos on to the device in iTunes to copy them onto it. For some reason this did not work for my iPhone when I tried to do the same. You can of course add the media to the iTunes library and select to sync it on to the device that way. But if you don’t want to manage your media through iTunes that’s cumbersome.

To be able to do this without using the iTunes library, the option “Manually manage music and videos” needs to be enabled. You can find it on the Summary page if your device under the Options section at the bottom. be able to simply drag media files from the Finder to your device in iTunes. Click Apply after and now it should work.

Deploying Angular application on Apache server

If you need to deploy an Angular application on a server running Apache, and are making use of routing for navigation, you can’t just upload the built application onto the server and be done with it. As soon as you navigate to another path, the Apache server will try to look for that resource on the server and most likely will give you an 404 Not Found error.

You need to rewrite all the URLs to the index.html so that the Angular application can take care of it. Your server needs to support mod_rewrite for that. If that is the case, you can upload a file .htaccess with the following content to your directory where the Angular application resides in.

RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/assets/(.+)$
RewriteRule ^(.+)$ index.html?path=$1 [L]

This will rewrite all requests to the index.html file and append any extra path to it. Unless, the request is for an existing file or directory on the server, then it will not rewrite it. This is necessary for the additional resources that will need to be loaded, such as CSS and JS files and images.

In order to get the necessary feedback when a resource is requested that does not exist, the third condition excludes to rewrite any request located inside the assets folder.

Using multiple SVN clients with the svn+ssh protocol and a putty profile

When trying to access a SVN repository using the svn+ssh protocol with TortoiseSVN it might happen that the password prompt shows up endless times. One suggested solution is to set up a profile in putty and use a private key for authentication for ssh there. Then in TortoiseSVN the host name just has to be changed to the name of the profile, e.g. svn+ssh://username@puttyProfileName/path/to/repo.

This works well until trying to reuse the stored SVN information of your local working copy in another client, for example your IDE. In my case I am using Eclipse with the Subclipse plug-in and my first approach didn’t work with Subclipse, which meant I couldn’t do any team actions from Eclipse when the projects where checked out using TortoiseSVN. If you are only using either of them it works fine.

The solution is quite simple: Rename the putty profile to the actual hostname and use the regular URL for the repository. That’s it. If you’ve used the putty profile name before just use relocate in TortoiseSVN to change the repository URL. TortoiseSVN will then still use the putty profile with the private key to authenticate. Other clients like Subclipse see it as an actual hostname and are able to use that.

Things discovered in Struts 2

In this post I write about some things I discovered during the development of a project where Struts 2 is used. I note them since I couldn’t find them in the documentation and they were discovered through digging through pieces of documentation, the code and the web.

In general, sometimes more detailed information can be found in the Javadoc of the frameworks classes, e.g. interceptors.

Skipping validation for a specific method in an action class

Continue reading

© 2024 Matthias Schoettle

Theme by Anders NorenUp ↑