Posts

Tech Companies tech blog

Tech Companies tech blog http://techblog.netflix.com/ http://instagram-engineering.tumblr.com/ http://nerds.airbnb.com/page/2/ https://blog.twitter.com/engineering http://backstage.soundcloud.com/ http://engineering.foursquare.com/ http://engineering.linkedin.com/blog http://engineering.indeed.com/blog/ https://tech.dropbox.com/ http://engineeringblog.yelp.com/ http://engineering.chartbeat.com/ http://eng.yammer.com/blog/ https://engineering.twitter.com/ http://codeascraft.com/ https://www.simple.com/engineering/ http://code.flickr.net/ http://conflatedthoughts.blogspot.ca/ http://don.blogs.smugmug.com/ https://github.com/blog/category/engineering http://engineering.webengage.com/ https://engineering.groupon.com/

Creating Overlay Icons - Table Viewer

Sometimes in table viewer icon decoration is not possible. We can create overlay icons and return them in class ITableLabelProvider method's - public Image getColumnImage(Object element, int columnIndex) will be enough ImageDescriptor desc = Activator.getImageDescriptor(....); // It take String (Image Path) if (desc != null) { DecorationOverlayIcon decoratedImage = new DecorationOverlayIcon(image, desc, IDecoration.BOTTOM_LEFT); if (decoratedImage != null) { return decoratedImage.createImage(); } }

Getting Started with NatTable

Image
Sample code to create Nat table with dummy data private NatTable createNatTable(Composite parent) { DummyGridLayerStack dummyLayer = new DummyGridLayerStack(4, 10); DataLayer rowHeader = (DataLayer) dummyLayer .getRowHeaderDataLayer(); rowHeader.setColumnWidthByPosition(0, 20); return new NatTable(parent, dummyLayer ); } Output :

Alpha-Beta Pruning Algorithm

Alpha–Beta Pruning is a search algorithm that seeks to decrease the number of nodes that are evaluated by the minimax algorithm in its search tree alphabeta(origin, depth, -∞, +∞, TRUE) Pseudocode alphabeta(node, depth, α, β, maximizingPlayer) if depth = 0 or node is a terminal node return the heuristic value of node if maximizingPlayer for each child of node α := max(α, alphabeta(child, depth - 1, α, β, FALSE)) if β ≤ α break (* β cut-off *) return α else for each child of node β := min(β, alphabeta(child, depth - 1, α, β, TRUE)) if β ≤ α break (* α cut-off *) return β

Git Commands

Git Pull git pull will gets all from a remote and it instantly merge it into the branch you are in when you make the request. Pull is a request that runs ‘fetch’ then a ‘merge’ by default. Git Fetch Fetch is similar to pull, except it won’t do any merging. Download objects and refs from another repository Git Init command: git init Create an empty Git repository or reinitialize an existing one Git Status command: git status Show the working tree status Git Commit command: git commit -m "Message" Record changes to the repository Git Push command: git push Update remote refs along with associated objects Git add     Add file contents to the index Git bisect      Find by binary search the change that introduced a bug   Git branch      List, create, or delete branches     Git checkout    Checkout a branch or paths to the working tree     ...

SQLite Dialect

Few days ago I worked with Hibernate and SQLite. I found that Hibernate doesn't provide dialect for SQLite Here is SQLiteDiaect: import java.sql.SQLException; import java.sql.Types; import org.hibernate.JDBCException; import org.hibernate.dialect.Dialect; import org.hibernate.dialect.function.AbstractAnsiTrimEmulationFunction; import org.hibernate.dialect.function.NoArgSQLFunction; import org.hibernate.dialect.function.SQLFunction; import org.hibernate.dialect.function.SQLFunctionTemplate; import org.hibernate.dialect.function.StandardSQLFunction; import org.hibernate.dialect.function.VarArgsSQLFunction; import org.hibernate.exception.ConstraintViolationException; import org.hibernate.exception.DataException; import org.hibernate.exception.GenericJDBCException; import org.hibernate.exception.JDBCConnectionException; import org.hibernate.exception.LockAcquisitionException; import org.hibernate.exception.spi.SQLExceptionConverter; ...

Implement Auto-Hide Scrollbar in SWT Text Component

Text textControl = new Text(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); Listener listener = new Listener (){ @Override public void handleEvent(Event event) { Text t = (Text)event.widget; Rectangle r1 = t.getClientArea(); Rectangle r2 = t.computeTrim(r1.x, r1.y, r1.width, r1.height); Point p = t.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); t.getHorizontalBar().setVisible(r2.width <= p.x); t.getVerticalBar().setVisible(r2.height <= p.y); if (event.type == SWT.Modify){ t.getParent().layout(true); t.showSelection(); } }}; textControl.addListener(SWT.Resize, listener); textControl.addListener(SWT.Modify, listener);