simplify this complex world

December 14, 2015

Zimbra store drive is full?? -Third-

Filed under: accoutre,Catatan Oprekan — effendisusanto @ 4:07 am

It’s the third part of saving the zimbra email system from collapse because of insufficient space as explained at the first part. On the second part, I try to explained how to reserved some free space on emergency situation so we got some time/space privilege to carefully find solutions with minimum risk and minimum downtime.

After do some googling, I finally decide to add new hardisk on the server and move ‘zimbra greediest space part’ to the new hardisk.

The ‘greediest space’ part of zimbra is on /opt/zimbra/store which store the blob email message. So we will move the /opt/zimbra/store to the new hardisk. To minimize down time, we will use rsync to move the data.

Let’s dig deeper how I add the hardisk to the server and how to make it work seamlessly with current system.

  1. Assume we already put hardisk that already ext4 formatted and located in /dev/mapper/VolGroup-lv_data, we will mount it into temporary place let say /data
    – Prepare directory for the new partition

    % mkdir /data
    

    – Change ownership of the directory to zimbra# chown zimbra:zimbra – Change permission of the directory to 755# chmod 755 /data– Check read/write/delete on the new directory for user zimbra

    % su - zimbra
    $ cd /data
    $ touch testfile
    $ rm testfile
    $ exit- Mount the partition to the /data
    % mount -t ext4 /dev/mapper/VolGroup-lv_data /data
    
  2. Ensure that your drive is already mounted in /data
    % df -h
    
  3. Now we copy the /opt/zimbra/store to /data, as stated before, we will use rsync to minimize problem and downtime.
    % rsync -avzHS /opt/zimbra/store/ /data
    

    This action will take time depending on how big is your data. After the sync finished, we will execute the last part, change the /opt/zimbra/store with the /data, this should be done carefully yet quickly.

  4. Stop zimbra service
    % su - zimbra
    $ zmcontrol stop
    
  5. Rsync /opt/zimbra/store to /data, why we have to do another rsync? Because after we did the first sync, there is a big possibility some email in/out from/to the zimbra, and we have to ensure that those data will also moved. We do the second rsync AFTER we stop the zimbra service so the data on /opt/zimbra/store is final.
    % rsync -avzHS /opt/zimbra/store/ /data &
    
  6. Move the current /opt/zimbra/store to another folder and create new /opt/zimbra/store as container to the new partition
    % mv /opt/zimbra/store /opt/zimbra/store_bak
    % mkdir /opt/zimbra/store
    % chown zimbra:zimbra /opt/zimbra/store
    % chown 755 /opt/zimbra/store
    % sudo - zimbra
    $ touch /opt/zimbra/store/testfile
    $ rm /opt/zimbra/store/testfile
    $ exit
    
  7. Unmount /data than mount it to /opt/zimbra/store
    % umount /data
    % mount -t ext4 /dev/mapper/VolGroup-lv_data /opt/zimbra/store
    
  8. Check that the mounting process is done
    % df -h
    
  9. Start the zimbra service
    % su - zimbra
    $ zmcontrol start
    

That all step we need to move the /opt/zimbra/store, after some time, and you already ensure that the system is stable, you may delete /opt/zimbra/store_bak to reserve another ‘huge’ free space.. DONE

December 11, 2015

Zimbra store drive is full?? -Second-

Filed under: accoutre,Catatan Oprekan — effendisusanto @ 10:20 am

On this second part, I want to write out how to reserve emergency free space on zimbra machine as I mentioned on the First Part.

To accomplish this task, we have to find out which files need to be deleted so we can get ’emergency free space’ instantly. The most possible files to be deleted are log files. Zimbra is a stack consist of several technology so it must have several file log for each technology. We can find all zimbra related log files on two directory:

  • /var/log/
  • /opt/zimbra/log

Lets sweep out the first one:

% cd /var/log
% ls -alh | less
% rm -rf maillog.*#rm -rf messages*
% rm -rf zimbra.log*
% ls -alh | less

Then we sweep out the second:

% cd /opt/zimbra/log
% ls -alh | less
% rm -rf audit.log.*#rm -rf zmconfigd.log*
% rm -rf zmlogswatch.out*
% rm -rf mailbox.log*
% ls -alh | less


Huff.. finally I got 2G freespace to keep the engine running. We now have privilege to find the real solution like I posted on the third part.

December 10, 2015

Zimbra store drive is full?? -First-

Filed under: accoutre,Catatan Oprekan — effendisusanto @ 2:09 am

I got a legacy email system on my office, we manage our own email system. The predecessor choose zimbra as our email system.

Because I’am not IT administrator anymore..since..umm 7 years ago :D, I don’t put attention to that mail system. It run atop centos atop VMWare while I use .net C# for developing, research, and/or pre research when creating analyst for system, so searching freebsd/linux skill from my arsenal is quite challenging.

The problem is our IT-support doesn’t know linux well. And suddenly the email is crash because the disk is almost full-99% and no one understand how to overcome this problem.

The show must go on, I’ve to summon linux skill from my arsenal to dance once again, event I’ve to acknowledge that my *nix skill is rusty.

So, how we overcome this problem? I decide to get other drive to move the “zimbra drive greedy part” to another partition..as easy as that. But how to do it?

I split this work into two main task:

  1. Reserve space from unused/unimportant file, so the email will continue to run despite exhaustion and I have enough time to move the data to the new drive (second part).
  2. Move the data to the new drive with minimize downtime.(third part)

I’ll write the detail for both task next time

August 5, 2011

Generic method for CRUD database using LINQ C#

Filed under: Catatan Oprekan — effendisusanto @ 3:09 am

Before all of you move forward read this posting, please ensure that you understand what is generic method in C#.

Ok, let’s move on. When dealing with database, we’re almost certainly dealing with CRUD < Create, Read, Update, Delete >. Therefor, if we can make a generic method code to handle CRUD for any table, we’ll get lot’s of advantage.
The first Generic method we want to explain first is Create < or Insert in database term >,

        public static void Insert<TClass> (TClass item) where TClass :class
        {
            using (var dc = new ApotekDataContext())
            {
                var table = dc.GetTable();
                table.InsertOnSubmit(item);
                dc.SubmitChanges();
            }
        }

The second generic method is Read < or Select in database term >, we separate method for select into 2 method,
SELECTALL and SELECTBYID. Let’s view our SELECTALL method

public static List<TClass> SelectAll() where TClass:class
{
     using(var dc=new ApotekDataContext())
     {
          var table = dc.GetTable().ToList();
          return table;
     }
}

so simple isn’t it. Before we move to the SELECTBYID, let’s imagine what is the complexity of SELECTBYID method.
The trap of this method is “how to get the ID/primaryID”. If we pass this trap, everything will be fine.

public static TClass SelectById<TClass,TId>(TId primaryKey) where TClass : class
{
     using (var dc = new ApotekDataContext())
     {
          var table = dc.GetTable();
          var modelMap = table.Context.Mapping;
          var dataMembers = modelMap.GetMetaType(typeof(TClass)).DataMembers;

          //Get the primary key field name
          var pk = (dataMembers.Single(m => m.IsPrimaryKey)).Name;
          var t = (from selected in table
               where
               selected.GetType().GetProperty(pk).GetValue(selected, null).ToString()==primaryKey.ToString()
               select selected).SingleOrDefault();
          return t;
     }
}

Weks.. time to work.. we have to go, we’ll add the method for update and delete later. Thanks

July 6, 2011

JSON Array Parsing Method in MVC Environment

Filed under: Web Retention — effendisusanto @ 3:01 am

Json usually play as a flexible and convenient form of data collection. In Json form, a collection of data packed as a single string so it’s easily transferred between several environment. With it’s simple form, json should make any transfer system easier. But yesterday I have to fight with array in json form(as I said in the first line – damn “USUALLY”-). I’ll try to explain the case so every one who face the same problem can understand and then solve their problem easily.

In my case I use JSON array to send a bunch of data from Javascript (View in MVC) to Controller. In Js I create a button to send json data


     $('#btnSave').click(function () {

       //var fromView = JSON.stringify(getLockVersion());
       var fromView= "[{"Code":"VER01","IsLocked":true},{"Code":"VER02","IsLocked":false},{"Code":"VER03","IsLocked":false}]";

       $.post('<%= Url.Action("UpdateLockVersion", "Maintenance") %>', { 'queryString': fromView }, function (data) {
           if (data.message != '') {

               alert (data.errorMessage));

                } else {

                    alert("Update Success");

                }

            });
        });

As shown in the source code I send data named ‘querystring’ which value is var string json array.
As all web developer know that JSON form usually like this

{"Code":"VER01","IsLocked":true}

But in this case I have send

     "[{"Code":"VER01","IsLocked":true},{"Code":"VER02","IsLocked":false},{"Code":"VER03","IsLocked":false}]"
     

It means I have to send several json form in serial and packed it in a single string data-type to method UpdateLockVersion in Maintenance controller. Now we have to see the content of this method

        
     public ActionResult UpdateLockVersion(string queryString)
        {
            var message = "";

            var ser = new JavaScriptSerializer();
            
            try
            {

                var versionLocks = ser.Deserialize<List<VersionLock>>(queryString);

                DataRepository.UpdateVersionList(versionLocks, out message);
            }

            catch(Exception ex)
            {

                message = ex.ToString();

                return Json(new { message });
            }

            return Json(new { message });
        }

In that I code there is list of VersionLock model, the content of VersionLock model is below

    public class VersionLock
    {
        public string Code { get; set; }
        public bool IsLocked { get; set; }
    }

As you see I have to use some strange code in my UpdateLockVersion method :


     var ser = new JavaScriptSerializer();
     var versionLocks = ser.Deserialize<List<VersionLock>>(queryString);

this method is .net native code, the JavaScriptSerializer() method is the member of using


System.Web.Script.Serialization;

So don’t forget to include this directive :D.
With this method I can unpack a serial/list of json array, Hope this can help anyone who face the same problem with me 😀

NB : THIS METHOD USE NO [AcceptVerbs(HttpVerbs.Post)] ATRIBUT

November 16, 2010

Achievement : Mitranetra Braille Converter

Filed under: Tumpuk Pinggir (achievement) — effendisusanto @ 5:18 am

What is Mitranetra Braille Converter
Mitranetra Braille Converter  is software to process braille letters easier, in order to produce books and reading materials for people with visually impaired. Although it has ability as an editor, the name “converter” is selected for its ability to convert that is not owned by another editor. Converter means this software able to convert any Ms word or plaintext or rich text document into braille formatted document. With this converter ability, everyone can create a braille formatted document even he/she never read and doesn’t understand the braille system at all. Just create your article in Ms Word, open it with MBC, click the convert button and done, it sound easy isn’t it, and I assure you, it just as easy as that.

This software actually combine the text editor and word processors. Every character in Braille must treated as plain text , even for tab, allign or margin due to braille printer (embosser) can only understand plain text. However, almost every writer prefer to write in “word processors” than text editor due to the ease of use.  That is why MBC provide “berkas cetak” as the word processors and “berkas braille” as the text only editor. And don’t forget, you can convert the “berkas braille” to “berkas braille” in just one easy click the convert button.

MBC Scheme and Feature
When someone ask ” what is MBC’s ability? “, just answer “MBC has abilities”. Let’s se the main design scheme of this software.


mbc grand design

Just as I said before, “MBC has abilities”, it has many features :

  1. Full editor braille
    Full support as braille editor for both the international paper and national paper. And addressed to the needs of children  MBC add ½ pages of national papers. MBC also support the use of six key braille Perkins
  2. One Click Converting
    Just by one click to convert Ms Word/plaintext/rtf files to Braille formatted text.
  3. Multi Language
    Support the conversion of both English and Indonesian language, with the use of grade 2 contraction enable. MBC also owned the flexibility of the use for other languages. MBC also equipped with English and Indonesian language menu.
  4. Multi Page Printing
    Multi copy printing maybe is not an issue commonly. But in braille, it still an annoying issue, so ability of multi copy is a big deal.
  5. Reference Page Enable
    Already equipped with the insertion of a reference page for asynchronous of  “dokumen awas” page with braille books pages.
  6. Multi Embosser
    Fully support various embosser or braille printer as braillo 400,200,comet, ET romeo, Juliet, bookmaker and express
  7. Support MS. Office 2003/2007
  8. Compatible Window XP/Vista/ window 7
  9. Support Braille Font
    Support CBC (Computer braille code) braille with font braille and simbraille true type font

Tampilan Software Mitranetra Braille Converter

Acknowledgements
MBC is my first professional achievement.  We need the full year to complete this software.  I got lots of knowledge like management software developmet, knowledge of Braille, knowledge of dealing with other people. My grateful to Mitranetra Foundation for having entrusted this project to me as the main developer. Especially for Pakdhe Ahyar, Pak Ichsan, Mas Budi and Pak Irwan whose always encourage me and give all their knowledge about Braille system for the sake of MBC software completion.
Very rude if I forget to say a big thank you to my subordinates Wicaksana Trihatmaja and Arie Triono, best friends who always accompany me in finishing this software, late nights together at Saung,working, coding, joking and sharing of each love story ha ha ha.

===================
Visual Studio C# 2005
dot.net framework 2.0
===================

September 24, 2010

create “hello word” application in onyxboox

Filed under: Catatan Oprekan — effendisusanto @ 4:55 pm

“hello word” application, every programmer should always create this kind of application. For desktop application developer, create “hello word” application should be ‘piece of cake’, we can enjoy the sweetness of this ‘piece of cake’ in less then 5 minutes. but now I spend more then 1 day to create my “hello word” application in onyxboox-ebook reader environment. I dont want to lose this knowledge easily so I’ll write my documentation carefully.

Compiler Hardware : lenovo G400
Operating System    : Ubuntu 9.10
==================================

  • 1’st Step : Install compiler
    $ sudo apt-get install cmake build-essential
  • 2’nd Step : Install the toolchain
    $ cd /tmp
    $ wget http://dev.onyxcommunity.com/sdk/freescale-toolchain.tar.gz
    $ sudo mkdir -p /opt
    $ cd /opt && tar -xvzf /tmp/freescale-toolchain.tar.gz
  • 3’rd Step : Downloading example
    $ cd
    $ wget http://dev.onyxcommunity.com/sdk/quickstart.tar.gz
    $ tar -xvzf quickstart.tar.gz && cd quickstart
  • 4’th Step : fixing the bug on the source cmakelist file exampe
    $ vim  CMakeLists.txt
    Edit the –> set(ONYXLIBS…. parts from
    set(ONYXLIBS onyx_sys onyx_ui onyx_wifi onyx_wpa)
    to
    set(ONYXLIBS onyx_screen onyx_sys onyx_ui onyx_wifi onyx_wpa)
  • 5’th Step : edit the main program on this example
    $vim main.cpp
    ———————————————————————————
    #include <QtGui/QtGui>

    #include “onyx/screen/screen_proxy.h”
    #include “onyx/sys/sys.h”

    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);
    execl(“/bin/ls”,”ls”);
    QWidget window;
    window.setWindowTitle(“Simple example”);
    QLabel *label = new QLabel (“Hello World!”, &window);
    window.show();
    onyx::screen::ScreenProxy::instance().flush(&window, onyx::screen::ScreenProxy::GC, true,        onyx::screen::ScreenCommand::WAIT_NONE);
    // Tell system manager that it’s not busy now.
    sys::SysStatus::instance().setSystemBusy(false);
    return app.exec();
    }
    ——————————————————————————————————————-

  • 6’th Step : Create a simple executable bash file
    $ sudo mkdir output
    $ vim build.sh
    ———————————————————————————————–
    #!/bin/sh

    cd output
    rm -rf *

    cmake -DBUILD_FOR_ARM:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE=ON ..
    make
    ———————————————————————————————-
    $ chmod +x build.sh

  • 7’th Step : build the application
    $ ./build.sh

Semestinya sich jalan kalo semua beres 😀

April 14, 2010

catetan malem ini.. c# .. VS2005.. registry

Filed under: Catatan Oprekan — effendisusanto @ 3:20 am

Alhamdulillah malem ini mancing dapat cukup banyak :

1. Add/remove registry windows dengan c#

2. Get/set nilai dari registry windwos

3. Satu masalah konyol yg bikin puyeng csc*.tmp is not a valid Win32 resource file

=================================================================

Kita bahas mulai dari yang pertama dulu, mengakses registry windows,  ga perlu teori aku copas dari source code yang kubuat tadi malem aja

RegistryKey globalKey, localKey;
globalKey = Registry.CurrentUser;
globalKey = globalKey.CreateSubKey(“Software\\Mitranetra Braille Converter 5”);
localKey = globalKey.CreateSubKey(“BerkasBraille”);
Kalo udah dibikin key nya, sekarang kita set sama get valuenya:
— Untuk Set Value —
format untuk set -> namaKey.SetValue(“nama registrinya”, value yang akan disetkan);
localKey.SetValue(“Pengaturan Baris Penerjemah”, PBB.BarisPenerjemah);

atau misalnya:

localKey.SetValue(“Pengaturan Baris Penerjemah”, 50);

— Untuk Get Value —

format untuk set -> variablePenampungNilaiRegistry=(tipe data)namaKey.SetValue(“nama registrinya”, defaultValue);

modeTanda = (int)localKey.GetValue(“ModeTanda”, 1);

sekian tentang registry.. menuju masalah selanjutnya.. tadi pagi habis subuh aku melakukan perubahan beberapa hal.. ternyata muncul error di VS 2005 ku. Peringatannya adalah

csc*.tmp is not a valid Win32 resource file

Setelah berusahaa ubek2 sampe teler di source code nya ga ketemu apa2 alias nihil.. nanya mbah google dijawab :”makane le nek nganggo icon iku sing cilik wae ukurane.. nek gedhe2 VS2005 ra mampu”

March 17, 2010

n introduction to seluk-beluk dunia braille (2)

Filed under: accoutre — effendisusanto @ 3:40 pm

ANGKA ARAB DI HURUF BRAILLE

Pada posting sebelumnya, saya sudah memaparkan bagaimana bentuk huruf braille serta bentuk huruf braille untuk abjad dari A- Z, ada yang perlu ditambahkan bahwa di font braille, tidak ada perbedaan antar huruf kecil(lowerCharacter) dan huruf besar(upperCharacter), umm bisa dibilang juga bahwa braille secara ascii merupakan font yang case Insensitive. Namun secara aturan, akan ada bagaimana huruf besar dan huruf kecil di Braille, semoga dalam satu/dua postingan ke depan saya ada kesempatan untuk membicarakan masalah CASE ini.

Untuk saat ini, saya akan memfokuskan diri pada karakter2 yang sering dipakai, posting sebelumnya tentang abjad, sekarang kita akan membahas angka. Braille mengenal dua jenis angka yaitu angka arab dan angka braille.

Angka arab di braille sangat mudah dihafalkan karena hanya menggunakan abjad a-j ditambah dengan tanda angka didepan angka tersebut.   Tanda angka adalah tanda dengan titik 3-4-5-6.

Bagaimana jika ada beberapa angka berurutan tanpa adanya spasi atau tab??jika terdapat 2 atau lebih angka yang berurutan, maka penulis hanya perlu menuliskan tanda angka satu kali didepan angka yang paling depan. Aturan itu tetap berlaku jika angka-angka tersebut dipisahkan oleh – (dash), titik, maupun koma.

Contoh



Sedang untuk angka romawi aturannya agak lebih ribet, dan masih ada beberapa hal yang rancu, dan membingungkan bahkan bagi  orang2 yang menyusun aturannya :)), piss ya mas budi, pak irwan dan pak bambang :D, jadi kapan2 saja saya jelaskan penggunaan angka romawi di huruf braille.

March 15, 2010

An introduction to seluk-beluk dunia braille (1)

Filed under: accoutre — effendisusanto @ 3:35 pm

PENGENALAN HURUF BRAILLE

Beberapa bulan terakhir, saya iseng-iseng belajar huruf braille.. dari ga ngerti sama sekali sampe sekarang minimal mengerti apa itu huruf braille. Pumpung masih melekat dalam ingatan.. saya ingin berbagi pengetahuan tentang huruf braille, terutama untuk meluruskan persepsi2 yang ada dikalangan orang awas.

Sebelum memulai dengan bentuk huruf braille, terlebih dahulu kubeberkan beberapa persepsi saya sebelum belajar huruf braille:

1. Bentuk huruf braille sama dengan huruf cetak tapi timbul

2. Pembacaan untuk braille dan awas sama

3.  Pembelajaran braille selesai dengan menghafal semua karakternya saja.

Pengenalan huruf braille ini akan saya tulis dalam beberapa postingan, biar ringan dan lebih bertahap :D.

So lets be a brillian eh braillian for a while :

========================================================================

Bentuk : Tidak seperti yang dulu kubayangkan, huruf braille ternyata hanya disusun oleh 6 (enam) titik yang disusun 2×3. setiap titik kemudian diberi nomor tetap 1,2,3,4,5, dan 6 agar mudah di ingat dan diajarkan :D. Sehingga huruf braille jumlahnya terbatas sebanyak 63 karakter hasil kombinasi dari 6 titik tersebut. Karena setiap titik memiliki nomor, maka kita bisa nyatakan suatu huruf dengan cara menyebut nomor dari titik-titiknya. Contoh

(a) titik 1

(p) titik 1-2-3-4

Setelah mengerti bentuk braille, kita beranjak untuk mengetahui abjad-abjad di braille :D.

Kiranya cukup sekian dulu untuk hari pertama :D.. semoga cukup banyak persepsi yang telah berubah dengan sekedar membaca postingan ini :D.

Next Page »

Blog at WordPress.com.