Emil Genov

Learn, Practice & Share

Monday, January 10, 2011

Forwarding AFTER filtering in Gmail

The problem: I want to forward all of my mail to other email account (for example my cell phone Email2SMS address). I want to be able to filter some of the messages using gmail filters, and I do not want to forward those filtered messages.

Problem is that gmail, first forwards messages and after that applies filters, just the opposite of what I need.

Solution: Well it's a little convoluted but it works. What I needed, was a forwarding filter that will will forward mail coming from any address, except those from a specific list.

As it took me some time to figure out the right syntax (try and error), I decided to write it down for someone who will need it too.

You can use two filters, first filters unwanted mail, second forwards wanted ones:

1) Matches: from:(not_wanted1@mail.com | not_wanted2@mail.com | not_wanted3@mail.com)
Do this: Skip Inbox, Mark as read, Delete it

2) Matches: from:(-not_wanted1@mail.com,-not_wanted1@mail.com,-not_wanted1@mail.com)
Do this: Forward to you-address@sms.mtel.net

So syntax for filter that matched mail send from any address, except those from a specific list is like this: put a minus in front of address and use comma as list separator. Hope this will help someone, write comment if this got the things done.

Tuesday, December 28, 2010

IM History Converter Application

When transitioning to a new job, I got faced with problem of what to do with chat histories I have amassed in my last job. We have used pidgin for communication with jabber servers, and I have also used pidgin for my facebook chat, so all my work related history along with my private history was there.

I really wanted some central storage for this information. After pounding on solutions, I realized that it was there, already existing, waiting for me. Google stores it chat logs inside gmail. Wonderful idea, chats there are safe, easy accessible and what is most important completely search-able.

So I looked through Interwebs, for existing solution, but could not find one. Then I looked at format of pidgin history, and it was simple enough. Text file with each chat, and index files in xml.

I decided I will write this translator myself. Started with defining core objects, such as Contacts, IM Account and chat history logs. Also I decided to make it extensible for other input formats and also for other storage backends. Decision which plugin to use is taken in runtime based on configuration file or user entered parameters.

Gmail storage plugin uses IMAP to directly put chat histories as gmail messages with their original dates.

So If anybody needs it, source code is available. On project page there are descriptions how to run the program. Also you can see how to make and run additional plugins to import chat from other systems. If anybody finds application useful, or have added additional plugins, please write a comment here or contact me on project page. Gracias

Friday, October 29, 2010

Tagging maven build with SVN version, and using this version inside application

To do this, you need to take following steps:
  1. Add build-number plugin to your project main POM
    ...
          <build>
                  ...
                  <plugins>
                      ...
                      <plugin>
                          <groupId>org.codehaus.mojo</groupId>
                          <artifactId>buildnumber-maven-plugin</artifactId>
                          <version>1.0-beta-3</version>
                          <executions>
                              <execution>
                                  <phase>validate</phase>
                                  <goals>
                                      <goal>create</goal>
                                  </goals>
                              </execution>
                          </executions>
                          <configuration>
                              <doCheck>false</doCheck>
                              <doUpdate>false</doUpdate>
                          </configuration>
                      </plugin>
                      <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-release-plugin</artifactId>
                          <version>2.0</version>
                      </plugin>
                      ...
                  </plugins>
              ...
          </build>
          ...
    
  2. Change your current jar plugin (or add one if such is missing):
    ...
                       <plugin>
                          <artifactId>maven-assembly-plugin</artifactId>
                          <version>2.2-beta-2</version>
                          <configuration>
                              <archive>
                                  ...
                                  <manifest>
                                      ...    
                                      <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                      ...
                                  </manifest>
                                  <manifestEntries>
                                      <Implementation-Version>${pom.version} (SVN version:${buildNumber})</Implementation-Version>
                                      <SVN-Version>${buildNumber}</SVN-Version>
                                  </manifestEntries>
                                  ...
                              </archive>
                              ...
                          </configuration>
                          <executions>
                              <execution>
                                  <goals>
                                      <goal>single</goal>
                                  </goals>
                                  <phase>package</phase>
                              </execution>
                          </executions>
                      </plugin>
                      ...
    
  3. To get version inside your code use:
    public String getVersion() {
        return <some class inside jar, that is created by maven>.class.getPackage().getImplementationVersion();
    }
    

  4. To get version from running program (server) using only command line:
    1. Create an JMX interface, with method getVersion() exposed, expose this interface in JMX on host XXX.YYY.ZZZ on port PPP
    2. Download cmdline-jmxclient utility jar from it's site
    3. Issue this:
      java -jar cmdline-jmxclient-0.10.3.jar a:a  XXX.YYY.ZZZ:PPP <name of your JMX bean> Version
      

Friday, November 6, 2009

Team time

The river was not really nasty this time, but it was a quite an adventure. After safely got on land, we celebrated this with a big lunch :)

Thursday, July 9, 2009

Robots at work


This might be the future of MFC technology we work now with. Worth a try.

Monday, November 26, 2007

Wednesday, October 24, 2007

Sunday, October 14, 2007

Classes vs. Ids

Today, while trying to fix broken rendering of aero-bg.com on Firefox, I delved deeper in CSS of site. Interesting though the css, almost randomly used in some cases ids and in other classes. I almost forgot, what the difference between those selectors are, so I refreshed myself, reading this incredible peace of info. To make things short, this is what are important differences:

1. Repeated use within a document
  • Classes can be used as many times as needed within a document.
  • IDs can only be applied once within a document.
So, if you need to use the same specific selector more than once, classes are a better choice.

2. Combining class selectors

You can use multiple classes to style an HTML element but you can only use one ID when styling an HTML element. This means that class selectors have a wider range of applications.

3. IDs have higher specificity than classes

There may be times when a declaration conflicts with another declaration. These conflicts are resolved using the Cascade rules. In simple terms, if a class selector and ID selector were to be in conflict, the ID selector would be chosen.

Also following article has it's controversal way to detach scripts for handling DOM events, from presentation.

Exploits For A Mom

Recently SQL injection is a next big thing. So let's see an up side of it :)



So, do You SANITIZE?

Blog Archive