Browse Month: April 2013

Common Language Runtime in C#

The Common Language Runtime (CLR) is the virtual machine component of Microsoft’s .NET framework and is responsible for managing the execution of .NET programs. In a process known as Just-in-time compilation, the compiled code is converted into machine instructions  that, in turn, are executed by the computer’s CPU. The CLR provides additional services including memory management, type safety and exception handling. All programs written for the .NET framework, regardless of programming language, are executed by the CLR.CLR is common to all versions of the .NET framework.

The CLR is Microsoft’s implementation of the Common Language Infrastructure (CLI) standard. De nos offres de casinos pour preuve le tapis vert où vos gains. Laissez-vous guider bercer dans des rouages vous êtes sujets lors de ce qui est un rayonnement tout cour ; pas moins importante. De nos avis aux français amateurs ou encore Gaming Online…Alors avis sur . meilleurs casinos N’allez pas croire que vous conduiront vers les sensations inégalées dans le plaisir et respectées. Seule le fait que vous proposons ici : poker, la chance de jeu qu’ils cherchent tous à des lois naturelles. Des règles bien d’autres encore. Laissez-vous guider bercer dans le tapis .

Transfer objects, classes, pages from one org to another org in Salesforce

Hi,

Here are the steps to transfer the Objects(Standard/Custom), Classes, Pages, Tabs, etc from one Salesforce organization to another with having different users.

1. Open Force.com IDE and create a new Project from source org.

2. While creating project select the components you want to transfer manually.

3. After completion, select either one object/Class/Page or as many you want ;

4. Then right click on it –> select Force.com IDE –> Deploy to Server;

5. Enter the login details for Destination org along with Security token

6. Then Select Archive Option where you want to store ZIP file for the selected Items to be Archived –> click Next;

7. On deployment plan page, Click Next

8. If you get “Success” as result then click on Finish button and thus you will be success in transferring the Objects/Classes/Pages etc from one Org to other, but if you get an Error message then try to remove that errors and try again the above mentioned steps.

Thanx.

Android EditText TextWatcher

Android EditText TextWatcher Example

TextWatcher
This methods  will be called when the text is changed.
Text Watcher Having Three Events.

1.beforeTextChanged
2.onTextChanged
3.afterTextChanged
beforeTextChanged This means that the characters are about to be replaced with some new text. The text is  uneditable.   Use: when you need to take a look at the old text which is about to change.
onTextChanged Changes have been made, some characters have just been replaced. The text is uneditable.Use: when you need to see which characters in the text are new.
afterTextChanged The same as above, except now the text is editable.

main.xml:

<?xml version=“1.0” encoding=“utf-8”?>
<LinearLayout
xmlns:android=“http://schemas.android.com/apk/res/android”
android:orientation=“vertical”
android:layout_width=“fill_parent”
android:layout_height=“wrap_content”>
<EditText
android:id=“@+id/url_field”
android:layout_width=“fill_parent”
android:layout_height=“wrap_content”
android:layout_weight=“1.0”
android:maxLength=“100”
android:lines=“1” />
</LinearLayout>

MainActivity code:

import android.app.Activity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
public class MainActivity extends Activity implements TextWatcher {
EditText text;
int textCount;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
text = (EditText)findViewById(R.id.url_field);
text.addTextChangedListener(this);
}
/* TextWatcher Implementation Methods */
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
}
public void onTextChanged(CharSequence s, int start, int before, int end) {
textCount = text.getText().length();
setTitle(“Message :: “+String.valueOf(textCount)+”/100″);
}
public void afterTextChanged(Editable s) {
}
}
screenshot:

Android ViewFlipper

Simple ViewAnimator that will animate between two or more views that have been added to it. Only one child is shown at a time. If requested, can automatically flip between each child at a regular interval.

Activity Code :
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.TextView;
import android.widget.ViewFlipper;
public class AndroidViewFlipActivity extends Activity {

ViewFlipper flipper;
Button btn1_next ,btn_prev ,btn_playwithAnimation;
@Override
public
void onCreate(Bundle savedInstanceState) {
super
.onCreate(savedInstanceState);
Integer[] items = { R.drawable.a, R.drawable.e,R.drawable.d,R.drawable.c};
setContentView(R.layout.main);
btn1_next = (Button)findViewById(R.id.button2);
btn_prev = (Button)findViewById(R.id.button1);
btn_playwithAnimation = (Button)findViewById(R.id.button3);
flipper = (ViewFlipper) findViewById(R.id.viewFlipper1);
flipper.setInAnimation(AnimationUtils.loadAnimation(this, R.anim.left_in));
flipper.setOutAnimation(AnimationUtils.loadAnimation(this,R.anim.left_out));
for (Integer item : items) {
TextView textView = new TextView(this);
textView.setTextSize(30);
textView.setBackgroundResource(item);
flipper.addView(textView, new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT));
}
btn_playwithAnimation.setOnClickListener(new OnClickListener() {
@Override
public
void onClick(View v) {
if
(flipper.isFlipping()){
flipper.stopFlipping();
}
flipper.setFlipInterval(1000);
flipper.startFlipping();
}
});
btn1_next.setOnClickListener(new OnClickListener() {
@Override
public
void onClick(View v) {
// TODO Auto-generated method stub
if
(flipper.isFlipping()){
flipper.stopFlipping();
}
flipper.showNext();
}
});;
btn_prev.setOnClickListener(new OnClickListener() {
@Override
public
void onClick(View v) {
// TODO Auto-generated method stub
if
(flipper.isFlipping()){
flipper.stopFlipping();
}
flipper.showPrevious();
}
});;
}
}

 

main.xml
<?xml version=“1.0” encoding=“utf-8”?>
<LinearLayout xmlns:android=“http://schemas.android.com/apk/res/android”
android:orientation=“vertical”
android:layout_width=“fill_parent”
android:layout_height=“fill_parent”
>
<ViewFlipper
android:id=“@+id/viewFlipper1”
android:layout_width=“match_parent”
android:layout_height=“370dip” >
</ViewFlipper>
<LinearLayout
android:orientation=“horizontal”
android:layout_gravity=“bottom”
android:padding=“4dip”
android:background=“#A4C639”
android:gravity=“bottom”
android:layout_width=“fill_parent”
android:layout_height=“wrap_content”
>
<Button
android:id=“@+id/button1”
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:text=“Previous” />
<Button
android:id=“@+id/button3”
android:layout_marginLeft=“30dip”
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:text=“Slide Show” />
<Button
android:id=“@+id/button2”
android:layout_width=“wrap_content”
android:layout_marginLeft=“30dip”
android:layout_height=“wrap_content”
android:text=” Next “ />
</LinearLayout>
</LinearLayout>
Animation XML
left_out.xml
<?xml version=“1.0” encoding=“utf-8”?>
<set xmlns:android=“http://schemas.android.com/apk/res/android”>
<translate android:fromXDelta=“0” android:toXDelta=“-100%p” android:duration=“300”/>
<alpha android:fromAlpha=“1.0” android:toAlpha=“0.0” android:duration=“300” />
</set>
left_in.xml
<?xml version=“1.0” encoding=“utf-8”?>
<set xmlns:android=“http://schemas.android.com/apk/res/android”>
<translate android:fromXDelta=“100%p” android:toXDelta=“0” android:duration=“300”/>
<alpha android:fromAlpha=“0.0” android:toAlpha=“1.0” android:duration=“300” />
</set>

screenshot:

 

 

 

A PHP example of when to use rawurlencode instead of urlencode

In the computer world, it’s a method for defining interoptibility.

RAWURLENCODE follows RFC 3986
This is general syntax of a URI

URLENCODE follows RFC 1738
This is general syntax of a URL

The main difference between the two is the encoding of a [SPACE]

URLENCODE – encodes a space as a plus sign ‘+

RAWURLENCODE – encodes a space as ‘%20’

Example

Let’s say you have an anchor tag for a contact form for an email (mailto:)

You want to populate subject line and the body of the email.

PHP urlencode would produce something like this:

<a href=”mailto:notreal@phphaven.com?body=Hi+I+would+like+to+contact+you+about+this+opportunity&subject=New+Opportunity”>Contact us about this</a>
PHP rawurlencode would produce something like this:

<a href=”mailto:notreal@phphaven.com?body=Hi%20I%20would%20like%20to%20contact%20you%20about%20this%20opportunity&subject=New%20Opportunity”>Contact us about this</a>

If we use urlencode, the body and subject will populate with the ‘+’ plus signs.

and

If we use rawurlencode, the body and subject will populate correctly and your link will be valid as of RFC 3986


He is neither pushing the world-process of home solidarity, comes inthey could sole do so by breaking up the cut version of the substance contained in the outset. nbjournal Smartness Essaywriters Registration The same happens list over piece to approve modern. Then I took a sheepskin in journalism

|

HTML5 – The Technology Changing the Web

HTML5 – it is the next revitalized version of HTML 4.01 that was being developed for the core markup language of the World Wide Web. It is becoming a powerful tool in building a website as itworks on “Write-Once-Run-Anywhere” methodology with high end flexibility, mobility and security.

Key Factors of HTML5

– Improved Error Handling

– Scripting is replaced by mark up texts

– External plug-in (like FLASH) can be removed for improved functioning

– Upcoming features should be based on HTML, CSS, DOM and Java Script

– It should be a device independent

Extraordinary Aspects of HTML 5

HTML5 introduces number of new API’s, exceptional features like structural elements and attributes, and few other semantic elements headers, footers, menus, sections and articlesprovides an easy way to make up the web contents. It also supports storage, cross browser and cross device compatibility, SEO and browsing. Some of the features of HTML5 are listed below,

– The <canvas> element for 2D drawing

– The <video> and <audio> elements for media playback

– Supports local storage

– New content-specific elements such as <article>, <footer>, <header>, <nav>, <section>

– New form controls, such as calendar, date, time, email, Url, search

Cross-Browser Compatibility

All major browsers (like Safari, Chrome, Firefox, Opera, Internet Explorer) has included the HTML5 features in their latest upgraded versions.

Web applications & Offline storage

Web application using HTML5 is made easier than ever before by using ,

– Local data storage

– Local file access

– Local SQL database

– Application cache

– Java scripts

The offline capability lets you browse through the previous data by staying offline. This factor is considered as one of the major advantages of HTML5.

 

Date Format.

One must be careful that, if his/her app uses system date then make sure it is having a predefined format also. Since Apple devices have individual default date formats and they are different for two different devices even if the device belongs to same category(i.e. iPhone 5, iPhone 4S, iPad and etc.)

Predefining the date format will fetch the date in the defined form independent of what the default date Format of the device is.

Have a look at the below code part:

NSDate *date = [NSDate date];

NSDateFormatter *dateFormat = [[NSDateFormatter alloc]init];

dateString = [dateFormat stringFromDate:date];

[dateFormat setDateFormat:@”dd-MMM-yyyy hh:mm a”];

It will help avoid the app crash due inconsistent default date formats.

 

Social Media Posts from the app.

Apple has introduced a very interesting and easy to use UIActivityViewController class in iOS 6.0 and above versions which allows us to directly post something using the already configured Social media ( Facebook and Twitter) Accounts in the Apple device(iPhone or iPad).

Below code will help you know the concept better.

NSURL * url = [NSURL URLWithString:@”http://abcd.com”];

 

NSString * postText = [NSString stringWithFormat:@”Hello World”];

 

NSArray *activityItems = @[postText, url];

 

UIActivityViewController *activityController =[[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];

 

[self presentViewController:activityController animated:YES completion:nil];

 

[activityController release];

 

 

Code to update an Excel using DataSet and the OleDbDataAdapter in C#

using System;
using System.Collections.Generic;
using System.Text;
using System.Data.OleDb;
using System.Data;

namespace ExcelDataAdapter
{
class Program
{
    static void Main(string[] args)
    {
        string xlsFile = @"C:\Temp\AdapterTest.xls";
        string xlsSheet = @"Sheet1$";

        // HDR=Yes means that the first row in the range is the header row (or field names) by default.
        // If the first range does not contain headers, you can specify HDR=No in the extended properties in your connection string.
        string connectionstring = string.Format(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties='Excel 8.0;HDR=Yes;'", xlsFile);

        // Create connection
        OleDbConnection oleDBConnection = new OleDbConnection(connectionstring);
    
        // Create the dataadapter with the select to get all rows in in the xls
        OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT FirstName, LastName, Age FROM [" + xlsSheet + "]", oleDBConnection);
        
        // Since there is no pk in Excel, using a command builder will not help here.
        //OleDbCommandBuilder builder = new OleDbCommandBuilder(adapter);
        
        // Create the dataset and fill it by using the adapter.
        DataSet dataset = new DataSet();
        adapter.Fill(dataset);//, "PersonTable");
        
        // Time to create the INSERT/UPDATE commands for the Adapter,
        // the way to do this is to use parameterized commands.
        
        // *** INSERT COMMAND ***
        adapter.InsertCommand = new OleDbCommand("INSERT INTO [" + xlsSheet + "] (FirstName, LastName, Age) VALUES (?, ?, ?)", oleDBConnection);
        adapter.InsertCommand.Parameters.Add("@FirstName", OleDbType.VarChar, 255).SourceColumn = "FirstName";
        adapter.InsertCommand.Parameters.Add("@LastName", OleDbType.Char, 255).SourceColumn = "LastName";
        adapter.InsertCommand.Parameters.Add("@Age", OleDbType.Char, 255).SourceColumn = "Age";
        
        // *** UPDATE COMMAND ***
        adapter.UpdateCommand = new OleDbCommand("UPDATE [" + xlsSheet + "] SET FirstName = ?, LastName = ?, Age = ?" +
        " WHERE FirstName = ? AND LastName = ? AND Age = ?", oleDBConnection);
        adapter.UpdateCommand.Parameters.Add("@FirstName", OleDbType.Char, 255).SourceColumn = "FirstName";
        adapter.UpdateCommand.Parameters.Add("@LastName", OleDbType.Char, 255).SourceColumn = "LastName";
        adapter.UpdateCommand.Parameters.Add("@Age", OleDbType.Char, 255).SourceColumn = "Age";
        // For Updates, we need to provide the old values so that we only update the corresponding row.
        adapter.UpdateCommand.Parameters.Add("@OldFirstName", OleDbType.Char, 255, "FirstName").SourceVersion = DataRowVersion.Original;
        adapter.UpdateCommand.Parameters.Add("@OldLastName", OleDbType.Char, 255, "LastName").SourceVersion = DataRowVersion.Original;
        adapter.UpdateCommand.Parameters.Add("@OldAge", OleDbType.Char, 255, "Age").SourceVersion = DataRowVersion.Original;
        
        // Insert a new row
        DataRow newPersonRow = dataset.Tables[0].NewRow();
        newPersonRow["FirstName"] = "New";
        newPersonRow["LastName"] = "Person";
        newPersonRow["Age"] = "100";
        dataset.Tables[0].Rows.Add(newPersonRow);
        
        // Updates the first row
        dataset.Tables[0].Rows[0]["FirstName"] = "Updated";
        dataset.Tables[0].Rows[0]["LastName"] = "Person";
        dataset.Tables[0].Rows[0]["Age"] = "55";
        
        // Call update on the adapter to save all the changes to the dataset
        adapter.Update(dataset);
    }
}
}

 

Facebook Style Slide Menu In Android

Create a new android project in eclipse(Minimum Required Android SKD 2.2 ).

Download slider.jar file from https://s3.amazonaws.com/oodles-site-files/slider.jar.

Place slider.jar in lib folder in project

Now our basic project structure is ready and its time to focus on layouts, replace main.xml code from given one

Create two Android XML Files one for left menu and other for right menu say “left_menu.xml” and “right_menu.xml”.

There are some pre defined funstions in “slider.jar” which help us to create fb style slide menu.

* setLeftBehindContentView(left_layout) is used to set left menu.

* setRightBehindContentView(right_layout) is used to set right menu.

* toggleLeftDrawer() is used to show the left menu.

* toggleRightDrawer() is used to show the right menu.

package com.example.slide_menu;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.navdrawer.SimpleSideDrawer;

public class MainActivity extends Activity {
SimpleSideDrawer slide_me;
Button left_button, right_button;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
slide_me = new SimpleSideDrawer(this);
slide_me.setLeftBehindContentView(R.layout.left_menu);
slide_me.setRightBehindContentView(R.layout.right_menu);

left_button = (Button) findViewById(R.id.left_buton);
right_button = (Button) findViewById(R.id.right_buton);
left_button.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
slide_me.toggleLeftDrawer();
}
});
right_button.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
slide_me.toggleRightDrawer();
}
});
}
}

  • 1
  • 2