browse by category or date

Today I learned something simple. I apparently didn’t know how to make force a column in a table to wrap its text content. Naturally, a column will wrap if the text contains space. But what happen if the text is simply too long, and you don’t want to manually insert hyphens?

Below is the example of a table with a column that didn’t wrap because it contains a very long word.

Long Text example: Lorem_ipsum_dolor_sit_amet,_consectetur_adipisicing_elit,_sed_do_eiusmod_tempor.Short Text

Source:

<table style="width:400px;">
<tr>
<td style="width:200px;">Long Text example: Lorem_ipsum_dolor_sit_amet,_consectetur_adipisicing_elit,_sed_do_eiusmod_tempor.</td>
<td style="width:200px;">Short Text</td>
</table>

After googling it, apparently this problem can be solved with CSS. Here’s how to do it.

<style type="text/css">
table.tableWrap
{
  table-layout:fixed;
}
.tableWrap td
{
   white-space:normal;
   word-wrap:break-word;
}
</style>
<table style="width:400px;" class="tableWrap">
<tr>
<td style="width:200px;">Long Text example: Lorem_ipsum_dolor_sit_amet,_consectetur_adipisicing_elit,_sed_do_eiusmod_tempor.</td>
<td style="width:200px;">Short Text</td>
</table>

Below is the result.

Long Text example: Lorem_ipsum_dolor_sit_amet,_consectetur_adipisicing_elit,_sed_do_eiusmod_tempor.Short Text

I hope it helps, cheers!

About Hardono

Howdy! I'm Hardono. I am working as a Software Developer. I am working mostly in Windows, dealing with .NET, conversing in C#. But I know a bit of Linux, mainly because I need to keep this blog operational. I've been working in Logistics/Transport industry for more than 11 years.

Possibly relevant:

One of my project is using Node.JS running on Ubuntu Linux server. To send email, I am using email module. This module itself is just a wrapper for Sendmail. So you need to ensure that Sendmail is already installed and working properly in your server.

The usage of email module is quite simple. Here’s how to do it (taken from npm’s page):

//include the module 
var Email = require('path/to/email_module').Email;

//construct the new email message
var msg = new Email({ 
   from: "me@example.com", 
   to:   "you@example.com", 
   subject: "Knock knock...", 
   body: "Who's there?"
});

//send the email and handle any exception
msg.send(function (err){
   if (err){
      console.log('Error sending mail - %s', err.message);            
   } 
   else {
      //do something when email is successfully sent.
   }
});

When testing this module, I can send out email successfully. So I didn’t foresee any issue coming from it. But lately I started to receive reports that emails were not sent out. First, I checked Sendmail’s queue using mailq and sendmail -bp, but I found that the queue is empty.

When I checked Node.JS’s log, I notice this:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: write EPIPE
    at errnoException (net.js:904:11)
    at Object.afterWrite (net.js:720:19)
error: Forever detected script exited with code: 8
error: Forever restarting script for 3 time

It seems the email module was throwing unhandled exception. But I can’t make any sense where the error is actually originated. Hoping that someone already resolve this issue, I visited the module’s github issues page. Lucky me, I found that other people is having the exact same problem as mine.

github-node-email

With that, to solve this issue I just need to add the path to email’s configuration. But first, I need to find out the path of Sendmail:

user@ns3364112:~# which sendmail
/usr/sbin/sendmail

Then add the path to the configuration:

var msg = new Email({ 
   from: "me@example.com", 
   to:   "you@example.com", 
   subject: "Knock knock...", 
   body: "Who's there?",
   path: "/usr/sbin/sendmail"
});

Voila! The emails now sending out successfully.

About Hardono

Howdy! I'm Hardono. I am working as a Software Developer. I am working mostly in Windows, dealing with .NET, conversing in C#. But I know a bit of Linux, mainly because I need to keep this blog operational. I've been working in Logistics/Transport industry for more than 11 years.

Possibly relevant:

Projects and more projects…

There are a few projects concurrently running under my care. The first one is ICSS Warehouse project. Its progress hasn’t been as fast as I expected. I know I am contemplating about some issues which might affect the way the system is used. So yeah, I need to communicate this to the stakeholders. I’ll visit ICSS once I have finished the prototype of my idea.

Another project is MyTank. Since its launch few weeks ago, few bugs and new requirements have surfaced. This week I’ve completed few enhancements and bug fixes. I’ve fixed the bug in Tank Overview filter, allow LCL and FLEXIBAG shipments to sail without any tanks. I also added a feature to ensure MyTank can handle adhoc tanks. Other than Stella’s pending request, MyTank can be considered complete.

Another project that i’ve not started at all is the OCR project for Air Export Factory jobs. I personally owe this project to David 🙂 Hopefully I can get it done by this weekend. If not, that fellow will get whacked left and right. Anyway, this project should be easy as I already completed a very similar project (this sentence could be the very reason i’ve not written any single line of codes :p)

There’s an upcoming project looming on the horizon. It’s. A warehousing project for a potential customer. We haven’t got the contract, so everything is just a blueprint for now. I personally hope that we can get this project because I view it quite challenging. Challenging because the warehousing project will very likely need to interface with customer’s SAP system. Also, the objects to be kept in the warehouse will be more complicated than just pieces, pallets and racks. Interesting times indeed.

My Family

14004299818050This week we visited our paediatrician to give Airen her Hepatitis A vaccine. Unlike many kids before, who cried even when they only just entered the doctor’s room; Airen remains cheerful. She even took a plastic ball from Doc’s table and starts playing with it. As Airen lays on the bed, my wife hold both Airen’s arm and start to distract her with conversation.

In a split of seconds, the nurse pressed the needle against Airen’s right thigh, release the vaccine, then immediately pulled out. Airen surprised for a while, exclaimed “Ouch mommy, it’s hurt”, then continued her conversation with her mother. Wow, Airen did not cry at all 🙂

To reward her not-crying-vaccination achievement, we bought her the colourful clay that she’s been keen on having. So for the whole week, Airen has been busy playing with clay. We do hope that this can nurture any artistry potential that she might have 🙂

About Hardono

Howdy! I'm Hardono. I am working as a Software Developer. I am working mostly in Windows, dealing with .NET, conversing in C#. But I know a bit of Linux, mainly because I need to keep this blog operational. I've been working in Logistics/Transport industry for more than 11 years.

Possibly relevant: