среда, 21 декабря 2011 г.

Pay Pal

Why deside to add express to  pay pal express checkout ?
The slowest payment gateway from integration point of view. The pay pal nvp much more simply for integration.

воскресенье, 25 сентября 2011 г.

Methodology vs brain

Follow TDD, BDD, MDA, DDD, DDD again, RDD, some other driven development and simple "Hello world" become "Hell to world". So try to use your brain first.

пятница, 2 сентября 2011 г.

Write custom FaceletFactory. Returns to implementation

    The previous post was incomplete, becaue lack of time. So lets finish. Implementation of DefaultFaceletFactory in mojara jsf2 as well as the whole jsf2 not implies, that DefaultFaceletFactory may be subclassed. The set of changes from 1.x complicate sucj kind of customization - getters for compiler and cache field were removed.

    To achive desirable result and substitute the DefaultFaceletFactory with devived class need to make a small dirty hack. First of all create or use any existing reflection util to access the private field in parent class. Second subclass DefaultFaceletFactory with following constructor

public class MultiStoreFaceletFactory extends DefaultFaceletFactory {

    /**
     * Construct subclass of {@link DefaultFaceletFactory}
     * @param root  parent to decorate
     * @throws IOException  in case of error
     */
    public MultiStoreFaceletFactory(final FaceletFactory root) throws IOException {
        super(
                (Compiler) ReflUtil.getFieldValue(DefaultFaceletFactory.class, root, "compiler"),  
                ((DefaultFaceletFactory) root).getResourceResolver(),
                -1,
                (FaceletCache) ReflUtil.getFieldValue(DefaultFaceletFactory.class, root, "cache") );
        // Your code is here
    }

    // Your code is here

}

пятница, 24 июня 2011 г.

The simplicity in code much more better than complex stupidity covered by enterprise patterns.

The simplicity in code much more better than complex stupidity covered by enterprise patterns.

понедельник, 20 июня 2011 г.

Write custom FaceletFactory

It can be done via following steps:

  1.  Create class, that dirived from DefaultFaceletFactory
  2.  Overwrite logic
  3.  Configure jsf to use created class.
    <context-param>
            <param-name>com.sun.faces.faceletFactory</param-name>
            <param-value>org.yes.cart.web.application.view.MultiStoreFaceletFactory</param-value>
    </context-param>
    




воскресенье, 15 мая 2011 г.

Patch for svnwcrev

Hi there !
For people who use svnwcrev this patch http://dl.dropbox.com/u/26657232/svnwcrev-2011-05-15.diff bring necessary functionality from SubWCRev. I had a few hours to porting C code from one project to another. Nice to try again KDevelop and C. Was impressed by C APR. I hope that patch will be accepted by Oliver (maintainer of svnvcrev)
Cheers

четверг, 12 мая 2011 г.

Verbose hibernate logging

Hi there ! Do you have oververbose hibernate logging and cannot configure it via log4j.properties? If yes - try to remove slf4j-simple and your life will be more easy ... according to logging

вторник, 19 апреля 2011 г.

Dark color theme for jetbrains idea ide

Hi All !
I would like to share dark color theme for day to day  works with jetbrains idea. Tested with 8 and 10 versions on win & lin.


Download xml file from here http://dl.dropbox.com/u/26657232/dark_uptown.xml

And put it to .IntelliJIdeaXX/config/colors folder. Restart idea, open ide settings/color and fonts and select dark-uptown color scheme.

How it looks






Dark theme idea.

пятница, 15 апреля 2011 г.

A few word about jbilling - sux, sux sux.

Im pretty sure, that product can tell about self more, than i can tell about this shit. 95% classes from domain model and main services have not comments at all. But the rest have some ... Sure, this is defenetly case when better keep silence rather than comment something :) ROFL. So lets start

Two classes with name InvoiceLineDTO, both used! Perverted minds, is not it ?



    public InvoiceLineDTO(int id2, String description2, BigDecimal amount,
            BigDecimal price, BigDecimal quantity2, Integer deleted, ItemDTO item,
            Integer sourceUserId2, Integer isPercentage) {
        this.id = id2; //Wow ! 
//And Integer as flag - something crazy





OrderLineBL

/**
     * Returns an order line with everything correctly
     * initialized. It does not call plug-ins to set the price
     * @param language
     * @param userId
     * @param entityId
     * @param currencyId
     * @param precision
     * @return
     */
    public static void populateWithSimplePrice(Integer language, Integer userId,
            Integer entityId, Integer currencyId, Integer itemId, OrderLineDTO line, Integer precision) {


Constants for loosers:


public class BasicLineTotalTask extends PluggableTask implements OrderProcessingTask {


    private static final Logger LOG = Logger.getLogger(BasicLineTotalTask.class);


    public void doProcessing(OrderDTO order) throws TaskException {
        // calculations are done with 10 decimals. 
        // The final total is the rounded to 2 decimals.
        BigDecimal orderTotal = new BigDecimal("0.0000000000");
        BigDecimal taxPerTotal = new BigDecimal("0.0000000000");
        BigDecimal taxNonPerTotal = new BigDecimal("0.0000000000");
        BigDecimal nonTaxPerTotal = new BigDecimal("0.0000000000");
        BigDecimal nonTaxNonPerTotal = new BigDecimal("0.0000000000");
        


Hey !!! Jbilling devs - smudge yourself on the wall, make the world better.

And special note for people who can read this. - Никогда не пользуйтесь этим уебищным продуктом. Редкое гавно.

среда, 6 апреля 2011 г.

среда, 26 января 2011 г.

Speedup unspeedable

    A few days ago i have got some well know e-commerce platform to speed up it. Application use hibernate, solr, spring and spring mvc with apache velocity as view and look like very over optimised, cached everything, that possible. It cached solr results, hibernate use second level cache, web tier use etag, etc. I was frustrated, because no easy way to boost performance. After several hours of investigation some bright idea came to me - if solution cache the result of named query, why not cache the result of page rendering for most very popular pages product and category views ? Of cause not all pages can be cached !
   To achive good result need to hack the VelocityLayoutView. Create a derived class put rendering result into cache. Solution became two times faster. Guess not a bad result.


   1:  public class DerivedVelocityLayoutView extends VelocityLayoutView {
   2:   
   3:  // skipped
   4:   
   5:      private oncurrentMap<String, String> cache;
   6:   
   7:  // skipped
   8:   
   9:      /**
  10:       * Default constructor.
  11:       */
  12:      public DerivedVelocityLayoutView() {
  13:          super();
  14:          this.requestHelper = new RequestHelperImpl();
  15:          this.cache = new MapMaker()
  16:              .concurrencyLevel(16)
  17:              .softValues()
  18:              .expiration(3, TimeUnit.MINUTES)
  19:              .makeMap();
  20:      }
  21:   
  22:  // skipped
  23:   
  24:  /**
  25:       * The resulting context contains any mappings from render, plus screen content.
  26:       * @param velocityContext context.
  27:       * @throws Exception in case of exception
  28:       */
  29:      private void renderScreenContent(final Context velocityContext) throws Exception {
  30:   
  31:          if (logger.isDebugEnabled()) {
  32:              logger.debug("Rendering screen content template [" + getUrl() + "]");
  33:          }
  34:   
  35:          final HttpServletRequest servletRequest = (HttpServletRequest) velocityContext.get("request");
  36:          final String key = getKey(velocityContext);
  37:   
  38:          String renderedPage = cache.get(key);
  39:          if (renderedPage == null) {
  40:              StringWriter sw = new StringWriter();
  41:              Template screenContentTemplate = getTemplate(getUrl());
  42:              screenContentTemplate.merge(velocityContext, sw);
  43:              renderedPage = sw.toString();
  44:              if (isCacheAllowed(servletRequest.getRequestURI())) {
  45:                  cache.put(key, renderedPage);
  46:                  if (logger.isDebugEnabled()) {
  47:                      logger.debug("Cache miss  " + key);
  48:                  }
  49:              }
  50:          } else {
  51:              if (logger.isDebugEnabled()) {
  52:                  logger.debug("Cache hit   " + key);
  53:              }
  54:          }
  55:          // Put rendered content into Velocity context.
  56:          velocityContext.put(this.screenContentKey, renderedPage);
  57:      }
  58:   
  59:  // skipped
  60:   
  61:  }
  62: