Showing posts with label dynamic. Show all posts
Showing posts with label dynamic. Show all posts

Saturday, February 25, 2017

Dynamic Dispatch in Java

Dynamic Dispatch in Java


It is a concept in java to achieve the Dynamic / Run-time polymorphism. It is the process of assigning sub-class object in super type reference later if needed that sub-class object can be type-caste into its super type. Dynamic dispatch can be achieved only with the instance member.

Important point regarding dynamic dispatch

1. If we are trying to access instance member with dynamic dispatch concept then it will access sub-class overridden method.

2. If we are trying to access static member with the dynamic dispatch concept then it will access super-class method as because compiler internally replace the super-class reference variable with its class name.

Example showing dynamic dispatch with instance and static method.

class B {

public static void display(){
System.out.println("super-class static method");
}
public void add(){
System.out.println("super-class instance method");
}
}

public class A extends B{

public static void display(){
System.out.println("sub-class static method");
}
public void add(){
System.out.println("sub-class instance method");
}

public static void main(String[] args) throws Exception {

B b = new A(); // Dynamic dispatch
b.display(); // Calling static method
b.add(); // Calling instance method
}

}

In the above code the statement B b = new A() is used to store sub-class in its super-class and tried to access static method " display " which will super-class display() method as because compiler internally convert the b.display() into B.display() but in case of instance it will access with the object only thats why it call the overridden method in sub-class. 

Note : The same will happen with the static and instance variable. With dynamic dispatch concept accessing static variable will access super-class static variable but accessing instance variable will access sub-class instance variable.  


Available link for download

Read more »

Friday, February 17, 2017

Dynamic Expression Evaluation In NET

Dynamic Expression Evaluation In NET


Many applications need to evaluate expressions at run-time. This can be done using a dynamic expression evaluator. Examples of such applications are data analysis applications that perform calculations from user-defined expressions, spreadsheet software like Excel which allows users to define formulae, etc.

There are several ways of doing it in .NET, each one having its own pros and cons. This post covers the various approaches and at the end compares their performance along with code examples for each one of them. These approaches can be categorized as follows

Parsing

One of the most common ways of achieving this is by writing a parser. The parser can parse the input expression, generate data structures and eventually evaluate the sub-expressions to find the result of the expression.

Developers can either write their parser or use one of the already available parsers. The biggest challenge with developers writing their own parser is that building a parser is quite complicated and requires a lot of coding effort. The advantage of using parsers for expression evaluation is that it doesnt require any external processes and the implementation can be pure managed .NET code.

Here is an expression evaluator from Code Project written in 100% Managed .NET. As the article points out, the expression goes through various phases like tokenization, parsing and interpretation before the final result is obtained. Fast Lightweight Expression Evaluator (Flee) is another expression evaluator from CodePlex. It uses a custom compiler, strongly-typed expression language and lightweight codegen to compile expressions directly to IL.

Runtime Compilation

Instead of building a custom parser, another alternative is using the .NET compilers. They can parse expressions in all the .NET languages and generate IL code. The best thing about compiled code is that execution of the code is quite fast but on the other hand it takes a significant time to compile the code.

The .NET framework includes a mechanism called the Code Document Object Model (CodeDOM) for this requirement. The System.CodeDom.Compiler namespace defines types for generating source code from CodeDOM graphs and managing the compilation of source code in supported languages. The .NET framework includes code generators and code compilers for C#, JScript and Visual Basic. Here is a tutorial on how CodeDom can be used for compiling C# code.

CodeDOM uses the compiler to compile the code, so it expects the compiler to exist on the clients system. The problem with CodeDom is that a new assembly is created and loaded into the AppDomain; and since we cannot unload an assembly in .NET, we end up with several unnecessary assemblies in memory. There are two solutions for this

  • Another temporary AppDomain can be created where the assemblies are loaded and the AppDomain can be disposed at a later time
  • Using DynamicMethod to create a method at runtime. The IL code for this can be obtained from the CodeDOM. Here is a tutorial for this

The Eval Function

Eval is a function which evaluates a string as though it was an expression and returns a result. Most of the languages that support eval are scripting languages like JavaScript, Python, etc. This is because most of the scripting languages are interpreted, not compiled. This provides these languages enormous capability to evaluate dynamic expressions since an eval call is nothing but another line to interpret at runtime. Compiled languages like Java and the .NET languages (like C# and VB.NET) dont have this flexibility since they have to generate IL/Byte code before they run. However some of the .NET language do support eval even though they are compiled.

JScript.NET is Microsofts implementation of ECMAScript in the .NET initiative. JScript.NET contains an eval function which can evaluate dynamic expression. It compiles the code every time eval called and then runs it, so there definitely is a performance hit. The downside of eval has been explained in this article.

IronPython and IronRuby are the .NET implementations of the Python and Ruby scripting languages. These are dynamic scripting languages unlike C# and VB.NET which run on the Dynamic Language Runtime. With the DLR, several dynamic constructs like eval could be implemented and since it is based on .NET, it is interoperable with C# and VB.NET. Here is a tutorial on embedding IronPython in C#.

Microsoft Roslyn

Microsoft Roslyn is Microsofts biggest change in compilers since the advent of .NET. However this is currently in CTP and isnt available in .NET 4.0. Roslyn provides the compiler as a service (library). This is better than CodeDOM since it wont create new processes. Roslyn has wonderful features especially for Dynamic Compilations, Code Reviewers, etc. Here is a tutorial on using Roslyn with C#.

The performance benchmarks of these approaches are as follows. The code used to obtain these benchmarks is available here.


Available link for download

Read more »

Friday, February 10, 2017

Dynamic Lock Screen 2 1 4 APK Android

Dynamic Lock Screen 2 1 4 APK Android


Dynamic Lock Screen 2.1.4 APK Android - To download application Dynamic Lock Screen 2.1.4 APK Android for free in apk.hipandroid.net, your android phone must been rooted for can run all apps in this blog, all apps in my blog is full version, and you will get .Apk or .zip file, Downloading is very simple: select the desired file and click “Download Dynamic Lock Screen 2.1.4 APK Android“ Just a few easy steps and you are enjoying Android application Dynamic Lock Screen 2.1.4 APK Android

Dynamic Lock Screen 2.1.4 APK Android


A cool new dynamic lock screen, replacing the generic lock screen and allowing you to add widgets and content from your favorite source such as Facebook, Twitter, news and RSS feeds.

UNLOCK

You can slide the unlock button to unlock the screen or to unlock directly to your camera.

SCREENS AND WIDGETS
On the right side of the default lock screen you will find a blank screen with a big plus sign on it. This is where the real fun begins and you can start adding your lock screen widgets and content.
Another screen allows you to signup to Facebook and add your feed.

CUSTOMIZE AND SHARE
You can fully personalized your dynamic lock screen with your photos and sounds, so no more boring generic lock screens – from now on your lock screen is personal to reflect who you really are.
You can customize the background, unlock icon and unlock sound – upload your own and use the gallery, to create a combination that is creative and cool.
Click the share icon to share your lock screen design with your family and friends, through Facebook, Twitter, SMS or any other media.

SUPPORTED DEVICES
Dynamic lock screen supports all devices.

To more information, Please visit Google Play

Version: 2.1.4
Size: 4.4 MB
Requires Android: 2.2 and up

Download From: BILLIONUPLOADS | HUGEFILES



Source : apk[dot]hipandroid[dot]net

Available link for download

Read more »

Saturday, February 4, 2017

Dynamic DNS client v2 1 0 Apk

Dynamic DNS client v2 1 0 Apk


Dynamic
Dynamic DNS client v2.1.0 Apk

Requirements: Android 1.5+
Overview: This application assigns a fixed domain name to your Android phone even though the IP address can change.

This application assigns a fixed domain name to your Android phone even though the IP address can change.
Works with all dynamic DNS providers, including no-ip.com, changeip.com, zoneedit.com, joker.com, enom.com, namecheap.com.
for the official dyndns.com app please see my other app.
For more information see website.
I cant see or reply to all your comments in Market, so please email me at android@L6n.org

Download

Available link for download

Read more »