Search Results

Search found 14 results on 1 pages for 'glaz666'.

Page 1/1 | 1 

  • What is common architecture of notification system on the web-forum, PMB and etc.?

    - by glaz666
    What I need is - list of new stuff from last visit - when user has already checked out some new entity since his last visit (ex. post on forum), mark this entity as read in the list - count different types of entities - private messages, posts, comments and etc. There are lot of websites using this technique for private messaging, listing new stuff and etc (ex. phpBB, this one and etc). Are there any common pattern, description of the system core which will events, making lists?

    Read the article

  • Algorithm: how to check intersections of recurring events definitions?

    - by glaz666
    The question comes from MS Outlook calendar behavior. Imagine I have two recurring events (starting from today): "each second Monday" and "every odd date". Is there any way to check intersections and/or find the first intersecting date algorithmically without brute-forcing over each date? Definitions can be made in CRON's notations or ICal notation. I think it doesn't matter. Are there any solutions for this in Gregorian calendar?

    Read the article

  • Javascript: Inline function vs predefined functions

    - by glaz666
    Can any body throw me some arguments for using inline functions against passing predefined function name to some handler. I.e. which is better: (function(){ setTimeout(function(){ /*some code here*/ }, 5); })(); versus (function(){ function invokeMe() { /*code*/ } setTimeout(invokeMe, 5); })(); Strange question, but we are almost fighting in the team about this

    Read the article

  • Best solution to wait for all ajax callbacks to be executed

    - by glaz666
    Hi! Imagine we have to sources to be requested by ajax. I want to perform some actions when all callbacks are triggered. How this can be done besides this approach: (function($){ var sources = ['http://source1.com', 'http://source2.com'], guard = 0, someHandler = function() { if (guard != sources.length) { return; } //do some actions }; for (var idx in sources) { $.getJSON(sources[idx], function(){ guard++; someHandler(); }) } })(jQuery) What I don't like here is that in this case I can't handle response failing (eg. I can't set timeout for response to come) and overall approach (I suppose there should be a way to use more power of functional programming here) Any ideas? Regards!

    Read the article

  • Set Hibernate session's flush mode in Spring

    - by glaz666
    I am writing integration tests and in one test method I'd like to write some data to DB and then read it. @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"classpath:applicationContext.xml"}) @TransactionConfiguration() @Transactional public class SimpleIntegrationTest { @Resource private DummyDAO dummyDAO; /** * Tries to store {@link com.example.server.entity.DummyEntity}. */ @Test public void testPersistTestEntity() { int countBefore = dummyDAO.findAll().size(); DummyEntity dummyEntity = new DummyEntity(); dummyDAO.makePersistent(dummyEntity); //HERE SHOULD COME SESSION.FLUSH() int countAfter = dummyDAO.findAll().size(); assertEquals(countBefore + 1, countAfter); } } As you can see between storing and reading data, the session should be flushed because the default FushMode is AUTO thus no data can be actually stored in DB. Question: Can I some how set FlushMode to ALWAYS in session factory or somewhere else to avoid repeating session.flush() call? All DB calls in DAO goes with HibernateTemplate instance. Thanks in advance.

    Read the article

  • Synchronize write to two collections

    - by glaz666
    I need to put some value to maps if it is not there yet. The key-value (if set) should always be in two collections (that is put should happen in two maps atomically). I have tried to implement this as follows: private final ConcurrentMap<String, Object> map1 = new ConcurrentHashMap<String, Object>(); private final ConcurrentMap<String, Object> map2 = new ConcurrentHashMap<String, Object>(); public Object putIfAbsent(String key) { Object retval = map1.get(key); if (retval == null) { synchronized (map1) { retval = map1.get(key); if (retval == null) { Object value = new Object(); //or get it somewhere synchronized (map2) { map1.put(key, value); map2.put(key, new Object()); } retval = value; } } } return retval; } public void doSomething(String key) { Object obj1 = map1.get(key); Object obj2 = map2.get(key); //do smth } Will that work fine in all cases? Thanks

    Read the article

  • Javascript: best solution to wait for all ajax callbacks to be executed

    - by glaz666
    Hi! Imagine we have to sources to be requested by ajax. I want to perform some actions when all callbacks are triggered. How this can be done besides this approach: (function($){ var sources = ['http://source1.com', 'http://source2.com'], guard = 0, someHandler = function() { if (guard != sources.length) { return; } //do some actions }; for (var idx in sources) { $.getJSON(sources[idx], function(){ guard++; someHandler(); }) } })(jQuery) What I don't like here is that in this case I can't handle response failing (eg. I can't set timeout for response to come) and overall approach (I suppose there should be a way to use more power of functional programming here) Any ideas? Regards!

    Read the article

1