fish out of water
Pasting code snippets into a blog is a complete pain. Essentially, code outside of an IDE is like a fish out of water - it looks terrible if it loses syntax highlighting or indentation and disastrous if it looses both. Also - in order to fit it on a thin blog page the code has to be renamed and reformatted to fit into the available space - that ensures additional loss of clarity.
Here's what I mean:
Code snippet pasted directly into blog editor
/**
* This {@link Runnable} will update the models from the data store outside the dispatch thread.
* To avoid race conditions, the swing models are updated within the dispatch thread while the
* querying of the models from the {@link WorkflowStore} happens outside the EDT.
*/
private final class WorkflowRefresher extends RunnableSwingWorker[]> {
@Override
public ActivityModel[] construct() {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
client.startBusyFeedback("Refreshing workflows");
}
});
return getModels();
}
@Override
public void finished() {
refreshPrivate(get());
client.stopBusyFeedback(null);
}
}
Code snippet inside <pre> tags
Code snippet inside <code> tags
Code as it was intended to look

Man - sometimes I feel like such an html newbie.
EDIT!!
I didn't need to look hard to find a nice tool for converting java code to html with nice formatting - complete with convenient applet
Sadly it still doesn't solve my code -> blog problem, but it's nice nonetheless.
Here's what I mean:
Code snippet pasted directly into blog editor
/**
* This {@link Runnable} will update the models from the data store outside the dispatch thread.
* To avoid race conditions, the swing models are updated within the dispatch thread while the
* querying of the models from the {@link WorkflowStore} happens outside the EDT.
*/
private final class WorkflowRefresher extends RunnableSwingWorker
@Override
public ActivityModel
SwingUtilities.invokeLater(new Runnable() {
public void run() {
client.startBusyFeedback("Refreshing workflows");
}
});
return getModels();
}
@Override
public void finished() {
refreshPrivate(get());
client.stopBusyFeedback(null);
}
}
Code snippet inside <pre> tags
/**
* This {@link Runnable} will update the models from the data store outside the dispatch thread.
* To avoid race conditions, the swing models are updated within the dispatch thread while the
* querying of the models from the {@link WorkflowStore} happens outside the EDT.
*/
private final class WorkflowRefresher extends RunnableSwingWorker[]> {
@Override
public ActivityModel[] construct() {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
client.startBusyFeedback("Refreshing workflows");
}
});
return getModels();
}
@Override
public void finished() {
refreshPrivate(get());
client.stopBusyFeedback(null);
}
}
Code snippet inside <code> tags
/**
* This {@link Runnable} will update the models from the data store outside the dispatch thread.
* To avoid race conditions, the swing models are updated within the dispatch thread while the
* querying of the models from the {@link WorkflowStore} happens outside the EDT.
*/
private final class WorkflowRefresher extends RunnableSwingWorker[]> {
@Override
public ActivityModel[] construct() {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
client.startBusyFeedback("Refreshing workflows");
}
});
return getModels();
}
@Override
public void finished() {
refreshPrivate(get());
client.stopBusyFeedback(null);
}
}
Code as it was intended to look

Man - sometimes I feel like such an html newbie.
EDIT!!
I didn't need to look hard to find a nice tool for converting java code to html with nice formatting - complete with convenient applet
Sadly it still doesn't solve my code -> blog problem, but it's nice nonetheless.
0 Comments:
Post a Comment
<< Home