Monday, November 1, 2010

Using Java to modify CSS

I'm not a CSS expert, as you might see the search field on this blog has just moved a few pixels down: the shoemaker's son always goes barefoot

Actually I'm doing some stuff related to a tour of polish rock band Buldog.

I cannot find an option in Photoshop to save sliced image in the way I like.

Of course I can do in manually, but with so many divs and many further changes I should automate it somehow :)

Code listing:

public class changeCSS {
public static void main(String[] args) {
try {
ArrayList fileNames = new ArrayList();

for (String fileName : fileNames) {
File file = new File(fileName);
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file)));

String line = null;
StringBuffer sb = new StringBuffer();

while ((line = br.readLine()) != null) {

if (line.startsWith("#poland-background-PSD-div-")) {
int offset = line.indexOf("div-");
String number = line.substring(offset+4, offset+6);
sb.append("\tbackground: url(images/poland-background_PSD_div_" + number + ".png);\n");

} catch (Exception e) {

And some excel as well, it's quick enough and automate anough for me:


  1. Java and to some degree .Net are the main choices because they have been consistently pegged as the “safe” choice to go with for mid-level project managers in the corporate world. No one was ever fired for choosing Java or Microsoft.

    However, there are many large distributed applications these days that run primarily with technologies like Python, PHP, et al. Even companies like Google and Yahoo are heavily invested in these technologies. Java may be the main choice for enterprise development now, but it’s days are numbered as the only stalwart option to go with.

    Let’s face it, many of these so called “enterprise applications” could easily have been written much faster and with less overhead using technologies like Python, PHP, et al.

    html5 training

  2. Sounds like a spam. Working on scalability and efficiency is an honour, same logic applies for spam (to some point).