I'm no professional or even advanced-amateur photographer, but sometimes people ask me to make photos. Since I do suck at that, and I don't have my own studio stuffed with lights, softboxes and stuff, I often take photos of people poorly lit with lots of highlights on their skin. There's a lame way to remove those.
I'm not sure if it's possible to achieve this using just curves or levels, here's how I do it.
1. Go to Levels and move the center slider to the right as far as neccessary so highlighted areas turn white and not-so-highlighted areas turn dark. Sometimes instead of moving center slider, you will need to gather black, white and center slide in the middle.
2. Increase Contrast until you have a dark background with islands of white highlighted areas. Sometimes background is completely black, and you can just delete it after magic wand selection. Sometimes you need to select white by colour and delete inverted selection.
3. Fill alhpa-selection of remaining areas with skin colour you can pick from not-highlighted parts. Depending on different parts of face illumination, you may want to fill highlighted areas with different colours.
4. The next is up to blur and opacity tuning.
May 21, 2008
May 1, 2008
Ubuntu 8.04 Wireless
I googled out the wireless/ndiswrapper problem. The solution, quoting Ankur Srivastava's blog post, is as simple as this:
then put
before
...then
And your wireless is there.
Update: Apparently, these actions aren't needed if you're using kernel 2.6.24-17. After update from 8.04 original 2.6.24-16, wireless had not worked until I removed those lines from
$ nano /etc/rc.local
then put
rmmod ssb
modprobe ndiswrapper
before
exit 0
......then
$ shutdown -r now
And your wireless is there.
Update: Apparently, these actions aren't needed if you're using kernel 2.6.24-17. After update from 8.04 original 2.6.24-16, wireless had not worked until I removed those lines from
rc.local
.
Apr 24, 2008
Last Insert Id Without Extra SELECT in Spring
If you have a table with
The easy way to do this is to perform a
auto_increment
for an id
, you often need to get this id immediately after a new instance has been created.The easy way to do this is to perform a
SELECT LAST_INSERT_ID()
query. However, most of the time you want as less database requests as possible. There is a way to avoid LAST_INSERT_ID()
code using Spring's JDBC support.
final String DEF_INSERT_USER_QUERY = "insert into users (username, password) values (?,?)";
final String firstname = createdUser.getFirstname();
final String lastname = createdUser.getLastname();
KeyHolder keyHolder = new GeneratedKeyHolder();
getJdbcTemlpate().update(new PreparedStatementCreator() {
public PreparedStatement createPreparedStatement(Connection connection)
throws SQLException {
PreparedStatement ps = connection.prepareStatement(DEF_INSERT_USER_QUERY,
new String[] {"firstname", "lastname"});
ps.setString(1, firstname);
ps.setString(2, lastname);
return ps;
}
}, keyHolder);
createdUser.setId(keyHolder.getKey().intValue());
Apr 16, 2008
Change J2EE version of NetBeans Project
A java project I've been working was initially started as J2EE1.4 one, but finally had to be moved to J2EE5. Apparently, there's no GUI way to do this in NetBeans (nor 6 neither 5.5).
When you select Project->Properties->Run, J2EE version is just displayed in a text field which value I couldn't change. Maybe this is a bug of NetBeans, maybe this is an intentional limitation.
Anyway, after some painful hours spent in moving classes and configs into a newly created J2EE5 project and fighting errors popped, I just took an advice of a fellow developer, checked how things are done in
When you select Project->Properties->Run, J2EE version is just displayed in a text field which value I couldn't change. Maybe this is a bug of NetBeans, maybe this is an intentional limitation.
Anyway, after some painful hours spent in moving classes and configs into a newly created J2EE5 project and fighting errors popped, I just took an advice of a fellow developer, checked how things are done in
project.properties
file and put j2ee.version=1.5
instead of 1.4
.
Apr 7, 2008
Firefox Memory Management Mystery
Firefox's appetite for memory is a well-known problem, especially in the latest 2.0.x versions. However, I never experienced it while I was using it on Windows. The browser never ate more than one and a half hundred megabytes.
I started to suffer from it only when I switched to Ubuntu a couple years ago. In fact, latest version with all the plugins (TMP+Firebug+Webdeveloper+DownThemAll) enabled, consumed up to four hundred megabytes of RAM so I even had to switch to Epiphany to be able to keep other greedy processes running.
But now, on the HP laptop with the same Ubuntu 7.10 the same Firefox 2.0.0.13 acts as it did in the Windows days — one and a half hundred megs no matter how many pages are opened.
I guess, this mystery will never be unriddled.
I started to suffer from it only when I switched to Ubuntu a couple years ago. In fact, latest version with all the plugins (TMP+Firebug+Webdeveloper+DownThemAll) enabled, consumed up to four hundred megabytes of RAM so I even had to switch to Epiphany to be able to keep other greedy processes running.
But now, on the HP laptop with the same Ubuntu 7.10 the same Firefox 2.0.0.13 acts as it did in the Windows days — one and a half hundred megs no matter how many pages are opened.
I guess, this mystery will never be unriddled.
Mar 12, 2008
“Not A Fish” Method Actually Works
There's this article on Wired about how you can stop hiccups by “reminding yourself that you're not a fish”. I'm not sure if anyone from comments actually believed in it, but ow-emm-gee, it works perfectly.
Just now I had hiccups which had stopped the second I told myself: “hey, I'm not a fish, I have no gills”. Science indeed works.
Just now I had hiccups which had stopped the second I told myself: “hey, I'm not a fish, I have no gills”. Science indeed works.
Feb 28, 2008
100% Height Div in Firefox
It was a surprise for me to find out that this is actually a problem with tricks and hacks involved.
Once I wanted to make 100% height div, I've found lots of “solutions”, all of which were either ie-only or involved render the div as a table cell or caused it to be exactly 100% of the screen height, ignoring the height of the actual content (which might be bigger), or caused scrollbar to appear even though content was fitting in one screen.
Although none of the solutions was perfect, when properly combined they actually do the thing.
General concepts are:
— Make html and body elements 100% high to allow inner blocks height setup;
— Set container's height to auto and min-height to 100% to avoid content overflow;
— Don't put content in the container itself but use it as a wrapper to allow padding without scrollbar
So here it goes: 100% height div for both IE and Firefox.
View source to see how it's done.
Once I wanted to make 100% height div, I've found lots of “solutions”, all of which were either ie-only or involved render the div as a table cell or caused it to be exactly 100% of the screen height, ignoring the height of the actual content (which might be bigger), or caused scrollbar to appear even though content was fitting in one screen.
Although none of the solutions was perfect, when properly combined they actually do the thing.
General concepts are:
— Make html and body elements 100% high to allow inner blocks height setup;
— Set container's height to auto and min-height to 100% to avoid content overflow;
— Don't put content in the container itself but use it as a wrapper to allow padding without scrollbar
So here it goes: 100% height div for both IE and Firefox.
View source to see how it's done.
Subscribe to:
Comments (Atom)