Untiny & Ubiquity

image Unitny is a web service that does the opposite of what ‘tiny’ sites do. It simply returns the original Url for a given shortened Url. Why? Why not use the shortened URL? The main reason is, in some countries, some ISP’s are blocking this kind of sites (tiny sites) for a claim of security issue.

Here is where Saleh Alzaid came with a legal idea in those ISP point of view, to solve that issue. Simple, convenient and cleaver those words can describe the Unitny service.

Since Unitny’s API makes the development possible and handy, many Unitny’s users have developed add-ons/plug-ins for a variety of OSs and/or software. Because I loved the Idea of Unitny and I like trying something new(like Ubiquity) I made a Ubiquity command (“untiny”) that uses the Unitny service.

image

First of all if you don’t know what Ubiquity is then visit Ubiquity's web site. If you already have Ubiquity, you might notice the subscription notification while you are in this page.

image

On how to use it, there are many ways to use Ubiquity command. The easiest way, is to highlight the link then use the Ubiquity combination, “ctrl+space” is the default, then type “untiny”. The preview of the command will show the original URL. While executing the command will open the original URL.

image

Have a nice Unitny day :D

Continue reading "Untiny & Ubiquity"

Windows Live Installer (WLInstaller) behind proxy!

WLI-Behind Proxy

I know most of you hate Windows Live Installer, Like I do.  Because it dose not work behind a proxy without the ways that will be described in this post.

 

WinHTTP:

After debugging WLInstaller, I found out it uses WinHTTP modules to get MSI information and packages.  And as you might know WinHTTP is a Windows service that can be configure using other utilities.

WinHTTP Configuration Utilities:

  • ProxyCfg (Pre Vista OS, e.g. XP)
  • NetSH  (Vista OS)

 

ProxyCfg:

  • Make sure to configure your Internet Explorer to work with your current proxy and your credential have been saved (if your proxy uses one).
  • Open the Command Prompt
  • Type "proxycfg -u",  then press 'Enter'
  • Close Command Prompt

ProxyCfg

thanks Snakodus

 

 

NetSh:

  • Make sure to configure your Internet Explorer to work with your current proxy and your credential have been saved (if your proxy uses one).
  • Open Command Prompt
  • Type "netsh winhttp import proxy source=ie",  then press 'Enter'
  • Close the Command Prompt

NetSh

 

 

 

And that's it now open WLInstaller and enjoy Micro$oft products :)

WLI- WinHttp

Continue reading "Windows Live Installer (WLInstaller) behind proxy!"

Polygamify Your Windows Live Messenger (Multi-MSN)

Many people out there are using Windows Live Messenger as IM, and for some reason they need to open more than one instance (polygamy).  But that does not work without a patch for Windows Live Messenger.  In this post, I'll explain how to patch your own Windows Live Messenger by yourself.  Some may say there are patches already exist out there, my answer; I don't trust it because it might contain Spyware :) .

 

Tools:

  • Debugger (OllyDbg)  {for the dirty work} :p
  • Hex Editor (xvi32)  {if you know the address for the magic line}

 

The short way (for WLM 8.5):

  • Copy & Rename Windows Live Messenger "msnmsgr.exe" to something else; let say "msnmsgr-multi.exe"
  • Open msnmsgr-multi.exe by Hex Editor (maybe xvi32)
  • Go to Address {8CF06}
  • Replace {0F 84 BA 77 00 00}
  • With {90 90 90 90 90 90}
  • Save it!
  • That's it, enjoy your Window Live Messenger

 

The long way (if you don't know the magic address!):

  • Open OllyDbg
  • then Open then "msnmsgr.exe"
  • Open "intermodular calls"; By right-click on CPU Window --> Search For --> All intermodular calls
  • Sort "intermodular calls" by "Destination", then type "CreateEvent"

 Intermodular Calls

  • Click the first "CreateEvent" to highlight it in CPU Window
  • You will notice Eventname of CreateEvent is "MSNMSGR",  locate the GetLastError that come after our CreateEvent 

image

  • Our magic line is the 2nd line after GetLastError  {JE xxxxxxxx}.   x = hex number
  • Double-Click that line then replace {JE xxxxxxxx} with {nop} and make sure "Fill With NOP's" is Checked then click Assemble then Cancel

image

  • Now we are done, the only thing left is to save the changes; right-click in CPU Window; Copy to executable --> All modification; then select "Copy All"
  • Then from the window that poped up; right-click --> save to file --> rename it if you want ( I usually do, in case I need the original one) , let say "msnmsgr-multi.exe"
  • Close OllyDbg and enjoy your Windows Live Messenger

Continue reading "Polygamify Your Windows Live Messenger (Multi-MSN)"

Firefox3 Version 2.0.0.14!!

image

After click on that it will download Firefox 2.0.0.14 and this the link:

http://www.mozilla.com/en-US/products/download.html?product=firefox-2.0.0.14&os=win&lang=en-US

 

But I have been able to download Firefox3 after modifying the part "product=firefox-2.0.0.14" to "product=firefox-3.0" in the link.

http://www.mozilla.com/en-US/products/download.html?product=firefox-3.0&os=win&lang=en-US

 

/clap Firefox3 Team ;)

Continue reading "Firefox3 Version 2.0.0.14!!"

CheckBox in QComboBox

Qt is one of the best GUI Widget cross-platform libraries that I ever worked with ;).

clip_image002

 

At some point, I was in need for a Combo box with a list of Checkbox item.  And that had not been provided as out-of- shelf widget.  For some reason, one of them as in the following quotes:

 “a combo box is a way to represent a single selection, not to hide other GUI elements”.

First let understand the QComboBox. The Combo box usually has two main parts:  current item view and items view (popup) .  Current view is view displaying the selected item.  While items view display a list of items to be select. 

Now let work with the items view to handle item as checkbox rather than a label ;).  In order to customize our items view we need to assignee an item delegate to the items view.   And that led us to create a customized (inherited) QItemDelegate let called CheckBoxListDelegate:

 

class CheckBoxListDelegate : public QItemDelegate

{

public:

    CheckBoxListDelegate(QObject *parent)

             : QItemDelegate(parent)

      {

            ;

      }

 

      void paint(QPainter *painter, const QStyleOptionViewItem &option,

                          const QModelIndex &index) const

      {

            //Get item data

            bool value = index.data(Qt::UserRole).toBool();

            QString text = index.data(Qt::DisplayRole).toString();

           

            // fill style options with item data

            const QStyle *style = QApplication::style();

            QStyleOptionButton opt;

            opt.state |= value ? QStyle::State_On : QStyle::State_Off;

            opt.state |= QStyle::State_Enabled;

            opt.text = text;

            opt.rect = option.rect;

 

            // draw item data as CheckBox

            style->drawControl(QStyle::CE_CheckBox,&opt,painter);

      }

 

    QWidget *createEditor(QWidget *parent,

             const QStyleOptionViewItem & option ,

             const QModelIndex & index ) const

      {

            // create check box as our editor

             QCheckBox *editor = new QCheckBox(parent);

             return editor;

      }

 

       void setEditorData(QWidget *editor,

                                                             const QModelIndex &index) const

       {

             //set editor data

             QCheckBox *myEditor = static_cast<QCheckBox*>(editor);

             myEditor->setText(index.data(Qt::DisplayRole).toString());

             myEditor->setChecked(index.data(Qt::UserRole).toBool());

       }

 

       void setModelData(QWidget *editor, QAbstractItemModel *model,

                                                            const QModelIndex &index) const

       {

             //get the value from the editor (CheckBox)

             QCheckBox *myEditor = static_cast<QCheckBox*>(editor);

             bool value = myEditor->isChecked();

 

             //set model data

             QMap<int,QVariant> data;

             data.insert(Qt::DisplayRole,myEditor->text());

             data.insert(Qt::UserRole,value);

             model->setItemData(index,data);

       }

 

       void updateEditorGeometry(QWidget *editor,

             const QStyleOptionViewItem &option, const QModelIndex &index ) const

       {

             editor->setGeometry(option.rect);

       }

 };

 

Then we need to tell our combo box to use that delegate as default delegate for the items view that it own.   Also we need to change the way it display the selected item.  Header of our CheckBoxList will look like:

class CheckBoxList: public QComboBox

{

      Q_OBJECT;

 

public:

      CheckBoxList(QWidget *widget = 0);

      virtual ~CheckBoxList();

      bool eventFilter(QObject *object, QEvent *event);

      virtual void paintEvent(QPaintEvent *);

      void SetDisplayText(QString text);

      QString GetDisplayText() const;

 

private:

      QString m_DisplayText;

};    

 

And the implementation:

CheckBoxList::CheckBoxList(QWidget *widget )

:QComboBox(widget),m_DisplayText(0)

{

      // set delegate items view

      view()->setItemDelegate(new CheckBoxListDelegate(this));

     

      // Enable editing on items view

      view()->setEditTriggers(QAbstractItemView::CurrentChanged);

     

      // set "CheckBoxList::eventFilter" as event filter for items view

      view()->viewport()->installEventFilter(this);

     

      // it just cool to have it as defualt ;)

      view()->setAlternatingRowColors(true);

}

 

 

CheckBoxList::~CheckBoxList()

{

      ;

}

 

 

bool CheckBoxList::eventFilter(QObject *object, QEvent *event)

{

      // don't close items view after we release the mouse button

      // by simple eating MouseButtonRelease in viewport of items view

      if(event->type() == QEvent::MouseButtonRelease && object==view()->viewport())

      {

            return true;

      }

      return QComboBox::eventFilter(object,event);

}

 

 

void CheckBoxList::paintEvent(QPaintEvent *)

{

    QStylePainter painter(this);

    painter.setPen(palette().color(QPalette::Text));

 

    // draw the combobox frame, focusrect and selected etc.

    QStyleOptionComboBox opt;

    initStyleOption(&opt);

 

      // if no display text been set , use "..." as default

      if(m_DisplayText.isNull())

            opt.currentText = "...";

      else

            opt.currentText = m_DisplayText;

    painter.drawComplexControl(QStyle::CC_ComboBox, opt);

 

    // draw the icon and text

    painter.drawControl(QStyle::CE_ComboBoxLabel, opt);

}

 

 

void CheckBoxList::SetDisplayText(QString text)

{

      m_DisplayText = text;

}

 

QString CheckBoxList::GetDisplayText() const

{

      return m_DisplayText;

}

 

And that’s it ;) see it in action:

      CheckBoxList list;

      list.addItem("Qt",true);

      list.addItem("CMake",true);

      list.addItem("10.99$",false);

      list.addItem("Da-Crystal",true);

 

clip_image004

clip_image002

 

Continue reading "CheckBox in QComboBox"

CMake & Qt4 Modules

Don't Reinvent the wheel!

After digging in CMake modules, and more specifically Qt once ( FindQ4.cmake , UseQt4.cmake also FindQT.cmake).  I found something really interesting in those modules!! They are smart modules ;).  If you read my previous post CMake & Qt4 (Q3Support) and read this, you will see how stupid I was by "Reinventing the wheel" ;).

 

Let get to the point!!

As we know ( I'm assuming you are familiar with Qt)  that Qt having many Modules e.g. ( Core, GUI ,Qt3Support,Network,SQL,XML,Test )  and lot other. And not necessarily that you need all of them in one project. It depends on the needs of your project.  Anyway, FindQt4 & UseQt4 come with very handy Macros to defined and include those modules with clean and cleaver way.

Basically you need three steps to instruct CMake about Qt.

First step tell CMake what Qt Modules you need. By setting Qt Modules' variable to 'true'. And the following are the available Qt Modules' variable:

  • QT_USE_QT3SUPPORT
  • QT_USE_QTASSISTANT
  • QT_USE_QTDESIGNER
  • QT_USE_QTMOTIF
  • QT_USE_QTMAIN
  • QT_USE_QTNETWORK
  • QT_USE_QTNSPLUGIN
  • QT_USE_QTOPENGL
  • QT_USE_QTSQL
  • QT_USE_QTXML
  • QT_USE_QTSVG
  • QT_USE_QTTEST
  • QT_USE_QTUITOOLS
  • QT_USE_QTDBUS
  • QT_USE_QTSCRIPT

e.g.:

SET(QT_USE_QT3SUPPORT true)

Note that 'Core' and 'GUI' Modules libraries are loaded by default.  In case you don't need to load them you can see the following variable as need to true:

  • QT_DONT_USE_QTCORE
  • QT_DONT_USE_QTGUI

 

Next step is to include the Qt need files. This done by only one statement:

INCLUDE(${QT_USE_FILE})

 

And the last step is the link the libraries need. This done by adding '${QT_LIBRARIES}' to linking statement.

e.g.:

TARGET_LINK_LIBRARIES(CMakifyQt3S ${QT_LIBRARIES} )

 

Example:

If you recall CMakeLists.txt from”CMake & Qt4 (Q3Support) “:

# Qt Includes
    INCLUDE(${QT_USE_FILE})
    INCLUDE_DIRECTORIES(${QT_QT3SUPPORT_INCLUDE_DIR})

# Current Project Include
    INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
    INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})

# Generating UI's
    FILE(GLOB Forms_UIS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} UI/*.ui)
    QT4_WRAP_UI(Forms_UIS_H ${Forms_UIS})

# Sources files
    FILE(GLOB Sources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)

# Qt Definitions
    ADD_DEFINITIONS(${QT_DEFINITIONS})
    ADD_DEFINITIONS(-DQT3_SUPPORT)

# Output
    SET(ALLSRC ${Sources} ${Forms_UIS_H})
    ADD_EXECUTABLE(CMakifyQt3S ${ALLSRC})
    TARGET_LINK_LIBRARIES(CMakifyQt3S
                  ${QT_LIBRARIES}
                  ${QT_QT3SUPPORT_LIBRARY}
     )

So after fully utilizing CMake Qt' Modules, the CMakeLists.txt will be as follow:

# Qt Modules
    SET(QT_USE_QT3SUPPORT true)

# Qt Includes
    INCLUDE(${QT_USE_FILE})

# Current Project Include
    INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
    INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})

# Generating UI's
    FILE(GLOB Forms_UIS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} UI/*.ui)
    QT4_WRAP_UI(Forms_UIS_H ${Forms_UIS})

# Sources files
    FILE(GLOB Sources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)

# Output
    SET(ALLSRC ${Sources} ${Forms_UIS_H})
    ADD_EXECUTABLE(CMakifyQt3S ${ALLSRC})
    TARGET_LINK_LIBRARIES(CMakifyQt3S ${QT_LIBRARIES})

Continue reading "CMake & Qt4 Modules"

CMake & Qt4 (Q3Support)

Updated: this post is obsolete, go to  CMake & Qt4  Modules .

 

Assumption:

Let assume we have a legacy Qt3 system and has been ported to Qt4 with Q3Support Module successfully. Also we want to CMakify it.

 

Problem:

After following the instructions that is available on the Internet like QtNode. We MIGHT end up with the following compilation errors:

* Error(1): 'Q3somthing' : No such file or directory

    • 'Q3MainWindow': No such file or directory

* Error(2) :  'something' : is not a member of "Qt"

    • 'ToolBarDock' : is not a member of 'Qt'
    • 'Dock' : is not a member of 'Qt'

 

Solution:

in CMakeLists.txt

For Error(1) add the following :

# Qt Includes
    INCLUDE(${QT_USE_FILE})
    INCLUDE_DIRECTORIES(${QT_QT3SUPPORT_INCLUDE_DIR})

For Error(2) add the following:

# Qt Definitions
    ADD_DEFINITIONS(${QT_DEFINITIONS})
    ADD_DEFINITIONS(-DQT3_SUPPORT)

 

-DQT3_SUPPORT  almost two days to figure it out ending up with reading QT source-code.  So I hope this will help you.

 

Example:

I made example for this purpose also to show the simplicity and the power of CMake as cross-platform make system.

 

Windows Vista

Windows Vista & NMake(VS2008)

 

image

Linux & Make(gcc)

 

Example File: CMakifyQ3S

Continue reading "CMake & Qt4 (Q3Support)"

كتاب: ابدأ LINQ

 

Start_LINQ

 

          خلال مروري عبر شبكة الانترنت وبالتحديد منتديات الفريق العربي للبرمجة  ، وجدت موضوعاً اثار فضولي ( كتاب " ابدأ Linq "... كتاب باللغة العربية ) .  لان LINQ  من الاضافات الجديد على .Net Framework 3 . 

 

 

 

 

 

 

يحتوي الكتاب على ثلاثة فصول

  1. ميزات C#  وايضاً يشرح الميزات والتحسينات التي تم ادراجها في C# 3.
  2. أساسيات LINQ ، ويتكلم في هذا الفصل عن ماهية LINQ  واساسياتها.
  3. هذا الفصل يهتم بـ "Linq to SQL"

عدد صفحات الكتاب حوالي الخمسون (~50) صفحة ، ولاكنها كثيرة بالفائدة.  و للكتاب طريقة جدا مميزة في الشرح .

الكتاب متوفر بـصيغتين ( PDF  و XPS )

image

فالدعاء لكتاب هذا الكتاب اقل ما يمكن فعله.

لتحميل الكتاب

  • Zip ( يحتوي على PDF و XPS )

 

تابع القراءة "كتاب: ابدأ LINQ"

Welcome Graffiti CMS

Yes, now my site powered by Graffiti CMS (Beta 2). And bye bye Community Server , because it’s huge and I was only use 10% or less of it features. You can manage the site in very clever way. Also the installation is Copy-paste-story. Again, give Graffiti a try ;)...

Continue reading "Welcome Graffiti CMS"

Graffiti CMS Ouch!

oh I mean wow!! While I'm having a break( timeout ) , I downloaded the Graffiti ( public beta 1 ). And that happened after I watched the Quickstart Videos (sp. themes) . It really look promising. I even thought about switching to Graffiti as a replacement of the huge Community server ;). I'll continue...

Continue reading "Graffiti CMS Ouch!"