Skip to main content

Home/ ProgrammingPages/ Contents contributed and discussions participated by Navneet Kumar

Contents contributed and discussions participated by Navneet Kumar

Navneet Kumar

Synchronization and the Java Memory Model - 3 views

    • Navneet Kumar
       
      Assignment to a long, double, float variables are not Atomic.
  • as-if-serial property of these manipulations shields sequential programmers from needing to know if or how they take place. Programmers who never create their own threads are almost never impacted by these issues
  • All changes made in one synchronized method or block are atomic and visible with respect to other synchronized methods and blocks employing the same lock, and processing of synchronized methods or blocks within any given thread is in program-specified order. Even though processing of statements within blocks may be out of order, this cannot matter to other threads employing synchronization.
  • ...6 more annotations...
  • atomicity alone does not guarantee that you will get the value most recently written by any thread. For this reason, atomicity guarantees per se normally have little impact on concurrent program design
  • you will obtain either its initial value or some value that was written by some thread, but not some jumble of bits resulting from two or more threads both trying to write values at the same time
  • releasing a lock forces a flush of all writes from working memory employed by the thread, and acquiring a lock forces a (re)load of the values of accessible fields. While lock actions provide exclusion only for the operations performed within a synchronized method or block, these memory effects are defined to cover all fields used by the thread performing the action.
  • If a field is declared as volatile, any value written to it is flushed and made visible by the writer thread before the writer thread performs any further memory operation (i.e., for the purposes at hand it is flushed immediately). Reader threads must reload the values of volatile fields upon each access.
  • Thread.start has the same memory effects as a lock release by the thread calling start, followed by a lock acquire by the started thread
  • As a thread terminates, all written variables are flushed to main memory.
Navneet Kumar

SitePoint CSS HTML DOM Reference - 1 views

  •  
    SitePoint Reference
Navneet Kumar

Generics in C#, Java, and C++ - 1 views

  • And really all they're doing in their implementation is automatically inserting those type casts for you. So you get the syntactic sugar, or some of it at least, but you don't get any of the execution efficiency
  • because Java's generics implementation relies on erasure of the type parameter, when you get to runtime, you don't actually have a faithful representation of what you had at compile time. When you apply reflection to a generic List in Java, you can't tell what the List is a List of.
  • C# does the instantiation at runtime.
Navneet Kumar

Bruce Eckel's MindView, Inc: 3-10-04 Generics Aren't - 0 views

  • Generics seem to only solve the problem of automatically casting in and out of containers.
  • So if we write generic code that actually takes a "type of anything," that type can only be an Object, and our generic code must only call Object methods on it.
  • generics have no advantage. In fact, it's confusing if you see them used, because you scratch your head and wonder "why does he need a generic here? What is the advantage?" Answer: none.
  • ...3 more annotations...
  • Java Generics use "erasure," which drops everything back to Object if you try to say "any type." So when I say <T>, it doesn't really mean "anything" like C++/ADA/Python etc. does, it means "Object."
  • So generics are really "autocasting."
  • That's the way of the Java world, and we are going to miss out on latent typing (it's actually possible to simulate latent typing using reflection, as I do once or twice in Thinking in Java, but it's messy and much less elegant).
  •  
    bruce Eckel article on java generics, and how it does  nothing more than  autocasting. Also templating or parameterized type in C++, Ruby, Python
Navneet Kumar

XSS (Cross Site Scripting) Cheat Sheet - 0 views

  •  
    various ways of XSS
Navneet Kumar

Javascript - Introduction to Events - 0 views

  •  
    event handling in javascript
Navneet Kumar

JavaScript tutorial - 0 views

  • for your own objects, you may wish to provide a special string that may provide more useful information. To do this, simply define the 'toString' method:
  • not have to store individual copies of the methods for each instance of the object, so it may require less memory, but it will require the browser to search the current and parent scopes to find the methods. This may cause a marginal delay
  • Saying 'this.propertyname' as I did above will create a public property. Any script can create an object then use and modify its properties directly. Using 'var' to define a variable in the constructor will create a private property.
  • ...7 more annotations...
  • Private variables can only be accessed from methods that are declared inline, and not externally referenced or created using the prototype construct. Methods of this kind are also known as privileged methods
  • prototype chain.
  • That also means that if the mycircle prototype is changed (properties are added or deleted, etc.), these changes are replicated down the chain, so the mysphere also inherits these changes.
  • mysphere.prototype.constructor = mysphere;
  • I will take all of the methods out of the constructor, and add them later using the prototype. That way, the mycircle prototype methods will always be available without me needing to create a new mycircle. Unfortunately, this also means that public and private properties are very hard (or impossible) to use. It's a trade off - one functionality for another.
  • When running the method, we need to tell JavaScript that even though we are referencing a method for a different prototype, we want to run it as if it were a method of the object we are creating (to make sure that any properties it creates are added to the object we are creating). This could be done using the 'call' method or 'apply' method
  • Note that when assigning the mycircle object to the mysphere prototype, it also overwrites the mysphere prototype constructor property
  •  
    complete Javascript tutorial
Navneet Kumar

Blacktree - 0 views

shared by Navneet Kumar on 01 Nov 07 - Cached
  •  
    UuSER INTERACTION
Navneet Kumar

www.dontclick.it - 0 views

shared by Navneet Kumar on 23 Oct 07 - Cached
  •  
    ui design without mouse click
Navneet Kumar

MySQL Performance Blog » MySQL Query Cache - 0 views

  • It does not cache the plan but full result sets
  • so it looks at first letter of the query and if it is “S” it proceeds with query lookup in cache if not - skips it.
  • Might not work with transactions
  • ...15 more annotations...
  • uses non-deterministic functions such as UUID(), RAND(), CONNECTION_ID() etc it will not be cached.
  • If table gets modification all queries derived from this table are invalidated at once
  • if you have high write application such as forums, query cache efficiency might be pretty low due to this.
  • all queries are removed from cache on table modifications - if there are a lot of queries being cached this might reduce update speed a bit
  • Qcache_free_memory and Qcache_lowmem_prunes
  • number of your selects - Com_select and see how many of them are cached. Query Cache efficiency would be Qcache_hits/(Com_select+Qcache_hits).
  • One portion of query cache overhead is of course inserts so you can see how much of inserted queries are used: Qcache_hits/Qcache_inserts Other portion of overhead comes from modification statements which you can calculate by (Com_insert+Com_delete+Com_update+Com_replace)/Qcache_hits
  • want to set query cache
  • means it is much more efficient as query which required processing millions of rows now can be instantly summoned from query cache
  • It also means query has to be exactly the same and deterministic, so hit rate would generally be less
  • full page caching
  • not using query_cache_wlock_invalidate=ON locking table for write would not invalidate query cache so you can get results evenif table is locked and is being prepared to be updated
  • it can serve responses very fast doing no extra conversion or processing.
  • but it is still not as fast as specially designed systems such as memcached or local shared memory.
  • It is not distributed If you have 10 slaves and use query cache on all of them cache content will likely be the same, so you have multiple copies of the same data in cache effectively wasting memory
  •  
    mysql query caching
Navneet Kumar

mysql query cache - 0 views

  •  
    tuning mysql performance with query caching
Navneet Kumar

MySQL Performance Blog » What to tune in MySQL Server after installation - 0 views

  •  
    tuning mysql server for perfornmance
Navneet Kumar

Pythian Group Blog » MySQL: Tuning filesorts and temporary tables - 0 views

  •  
    filesort and temporary tables in query
Navneet Kumar

SQL Server Data Structure - 0 views

  •  
    MS SQL Server Data structures. how data is stored in ms sql  server
1 - 20 of 87 Next › Last »
Showing 20 items per page