Tuesday, October 18, 2016

Delete outlook mails

Unfortunate chain of events during some testing conducted by my colleague led to a full folder in my outlook. When I say full I mean ~7M emails generated during test that lasted a couple of minutes.

Python to the rescue (outlook needs to run during this operation)...
import win32com.client

outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
inbox = outlook.Folders["testnotifications"].Folders["Inbox"]

messages = inbox.Items
for message in messages:
    print("Deleting a message %s" % message.Subject )
deleted = outlook.Folders["testnotifications"].Folders["Deleted Items"]

while True:
    message = deleted.Items.GetLast()
    print("Deleting a message %s" % message.Subject)

Friday, August 5, 2016

Elixir and Phoenix, love at first sight

These days I am reading a lot about Elixir and Phoenix. I still didn't have the time to try them out but I fell in love by just reading the texts. Read this and this and tell me, doesn't it sound beautiful?

I have a bunch of materials that I gathered during the years that would help me switch to functional programming. The only peace from that pile that I invested more time was SICP which I would warmly recommend. That other stuff is just collecting the dust :)
I hope Elixir/Phoenix combination will help transition.

[EDIT:] And apparently, the whole thing is on fire. Just 5 minutes after I published this post it has 5 views. <3 p="">

Wednesday, September 12, 2012

X on windows 7

Install Xming server on your windows platform.
Install putty.
Connect putty to remote machine with these options:

You can start your GUI remotely

Spring embedded FTP server

Here is how to embed apache FTP server in a spring application:

We embedded it in our development application context for spring. Also, we created scheduled thread to periodically generate content for embedded ftp server. It works like a charm.

Monday, August 27, 2012

Deleting many files, ubuntu server terminal vs win7 command line

We created a lot of garbage log files in our last project. ~60k files taking 2GB of space.
Ok, let's delete some of them. I don't need those xml files so I backed them up and I tried:
rm *.xml
Permission denied
Permission denied
sudo rm *.xml
Everything goes ok.
~60k files still here?!? WOOT?
I had to delete them in groups that are smaller than 10k files.
 sudo rm 21*.xml 
It worked
Let's try the same thing with another OS:
Extract backup to win7 machine. Go to console. Try:
del *.xml
Files are gone!

Tuesday, April 17, 2012

Migrating SVN with history to a new Git repository

Thx to stackoverflow.com thread and a post from user Casey I finally did it.

Follow instructions given by Casey and add few steps.

Here are the steps to add to save all branches.
cd dest_dir
git checkout -b local_branch remote_branch
for every branch after step where you cloned:
git clone dest_dir-tmp dest_dir 
before step where you removed temporary dir:
rm -rf dest_dir-tmp

Tuesday, February 7, 2012

Installing skype

I tried to install skype yesterday. It's a nightmare.
  1. Follow "Get skype" link
  2. Follow "Get skype for windows" link
  3. Follow "Download skype" (3rd page and it still does not start!!!)
  4. Site says something like: "You must login/register" WAT?!?
  5. Forgotten your password?
  6. Follow mail link
  7. Enter new password
  8. I enter something like "ExtrAComp1ic4t3dPassvvorD1234"
  9. Site says something like: "Your password is too weak"
  10. I enter "ExtrAComp1ic4t3dPassvvorD1"
  11. Site says something like:"You can download now."
gg skype