piątek, 14 stycznia 2011

Eclipse PDT most useful shortcuts

Today I would like to share and keep for the future couple of tricks I found out today after years of working with Eclipse (shame - I know ;).

Incremental search (Ctrl+J)


First of all if you miss "/" command of your favourite vi editor the Ctrl+J is what you need. Once you type pharse you looking for (look at status bar - red color surprisingly means "sorry no match"). But if you are lucky "Up/Down" key buttons allow you navigate back and forth among all found matches (b/n for vi masters ;>).

Open Type (Ctrl+Shift+T)


Immortal Ctrl+Shift+T works as well allows you open any Type available in workspace.

Quick Outline (Ctrl+O)


Ctrl+O invoke nice yellow frame with outline view. Local search ability and "Up/Down" keys allow you handy navigation.

sobota, 4 grudnia 2010

SQLite 3 - cheat sheet

  1. Create new database initialised with given sql script

    sqlite3 -init /path/to/script/centrum2.sql crtest.db
    

    alternativly load script in interactive mode
    sqlite3 crtest.db
    sqlite3> .read /path/to/script/centrum2.sql 
    
  2. Rename particular table
    alter table TBL_PRODUCTS rename to PRODUCTS_OLD;
    
  3. Rename particular column name without loosing data

    Actually it is not possible directly. The workaround can be to create an empty table with new set of columns and populate it with data comes from original table.

    create table PRODUCTS_NEW (..);
    insert into PRODUCTS_NEW select * from PRODUCTS;
    drop table PRODUCTS;
    alter table PRODUCTS_NEW rename to PRODUCTS;
    

    Another workaround can be to use CREATE TABLE .. AS SELECT statement.

    create table PRODUCTS_NEW as select id, name, code as pcode, description from PRODUCTS;
    alter table PRODUCTS_NEW rename to PRODUCTS;
    

piątek, 19 listopada 2010

Eclipse Marketplace and Subclipse (no SVNkit bundled)

Today's morning I had a need to configure brand-new PDT environment (Helios SR1). As I am using SVN for versioning the Subclipse plugin is what I usually use. Couple times before I successfully employed Eclipse Marketplace to do the job. Same was this time, but to my surprise this time I was not able to switch SVN interface to SVNKit. The only available was JavaHL implementation. I hope this will be fixed in future, but for now one need to do additional steps to install SVNKit - traditional way of installing plugins.
Help -> Install New Software -> select Subclipse repository and 
check all the available options

The version I worked with were: PDT (Helios SR1) and Subclipse 1.6.15

niedziela, 7 listopada 2010

ActionScript 3.0 - How to limit frames per second of flash animation

The simples way seems to be use SWF meta tag.
Example:

package myPackage {

import required.imports.*;

[SWF(backgroundColor=0xEEEADB,frameRate="5")]

public class MyClass {
..
}

}

sobota, 30 października 2010

How to set human readable address for your facebook profile

It may be not very obvious how to make your profile has human readable address, but actually it is quite easy.
Account -> Account Settings -> Settings -> Username

Note: After setting chosen username you can not change it again!!

HTML site layout with DIV tag and CSS - 1st attempt



ITEM1 | ITEM2 | ITEM3 | ITEM4

How to build simple site layout with DIV tags


In order to see implementation details please look at source of this site ;>.

wtorek, 17 sierpnia 2010

Menu based on commands (org.eclipse.ui.menus - menuContribution)

Extension point: org.eclipse.ui.menus

In order to add new menu menuContribution entry is used.

locationURI property determines where menu will be added.

Examplary locationURI:
→ popup:org.eclipse.ui.popup.any?after=additions
→ toolbar:org.eclipse.ui.views.ContentOutline?after=additions
→ popup:org.eclipse.jdt.ui.PackageExplorer?before=additions

→ menu:sourceMenuId?before=sourceBegin
→ popup:sourcePopupMenuId?before=sourceBegin
→ menu:sourceMenuId?after=sourceBegin
→ popup:sourcePopupMenuId?after=sourceBegin
→ menu:org.eclipse.ui.main.menu?after=sourceMenuId


Where in that cases sourceMenuId and sourcePopupMenuId are menus registered with org.eclipse.ui.actionSets extension point.

Typically menuContribution entries contain command entries.

Command entries can define visibleWhen and properties.
Example:
<menucontribution locationURI="menu:sourceMenuId?before=sourceBegin">
 <command commandId="org.eclipse.php.ui.edit.text.add.description"
  id="AddDescription" mnemonic="%command.mnemonic" style="push">
 <visiblewhen checkEnabled="false">
 <reference definitionId="org.eclipse.php.ui.phpContentType.definition" />
 </visibleWhen>
 </command>
 </menuContribution>
VisibleWhen among others allow to specify reference property which references to definition regristered with org.eclipse.core.expressions.definitions extension point.

Example:
<extension point="org.eclipse.core.expressions.definitions">
<definition id="org.eclipse.php.ui.phpContentType.definition">
<with variable="activeContexts">
<iterate operator="or">
<equals value="org.eclipse.php.core.phpsource" />
</iterate>
</with>
</definition>
</extension>
Other option can be specifying with property.

Example:
<visiblewhen>
<with variable="selection">
<iterate>
<or>
<instanceof value="o.e.editors.OutlineContentProvider$Sources">
</instanceof>
<instanceof value="o.e.editors.OutlineContentProvider$Targets">
</instanceof>
</or>
</iterate>
</with>
</visibleWhen>
or:
<with variable="selection">
<iterate>
<instanceof
             value="c.c.model.VisualizableBlock">
</instanceof>
</iterate>
</with>