The slowest payment gateway from integration point of view. The pay pal nvp much more simply for integration.
среда, 21 декабря 2011 г.
Pay Pal
The slowest payment gateway from integration point of view. The pay pal nvp much more simply for integration.
воскресенье, 25 сентября 2011 г.
Methodology vs brain
пятница, 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.
понедельник, 20 июня 2011 г.
Write custom FaceletFactory
- Create class, that dirived from DefaultFaceletFactory
- Overwrite logic
- 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
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
вторник, 19 апреля 2011 г.
Dark color theme for jetbrains idea ide
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
пятница, 15 апреля 2011 г.
A few word about jbilling - sux, sux sux.
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");
And special note for people who can read this. - Никогда не пользуйтесь этим уебищным продуктом. Редкое гавно.
среда, 6 апреля 2011 г.
среда, 26 января 2011 г.
Speedup unspeedable
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: