web stats analysis

Archive for August 24th, 2013

How to windows phone: navigation to the page in c# ?

Navigating Between Pages.

windows phone navigate to page,

Below several ways to pass data to another page:


1.You can use query parameters as Shawn suggested.
2.You can use global data stored somewhere like in app.cs
3.You can use a static class to hold the data.
4.You can use a shared viewModel to hold the parameters. (or static properties in the viewmodel)


You can also take help query parameters and NavigationEventArgs.You can use the NavigationEventArgs to define if the user is going forword or background by checking the NavigationModel.If you want to download by using the query parameters so can tell page 2.

Write the below code in page 1.

private void MoveToPage2FromPage1()


NavigationService.Navigate(new Uri("/Page2.xaml?shouldDownload=true", UriKind.Relative));


Write the below code in page 2.

protected override void OnNavigatedTo(NavigationEventArgs e)


  if (e.NavigationMode == NavigationMode.Back) return;

  string shouldDownload = "";   //May not be needed if you'll only ever go to page 2 from page 1 to download...

  if (NavigationContext.QueryString.TryGetValue("shouldDownload", out shouldDownload))





How to download file using C#?

A question which asked for a solution to download a file from a web server programmatically.
The simple solution code is below.

Using below code in button click event:

private void btndwn_file(object sender, EventArgs e)
string url = @"http://www.code.top10idea.com/wp-content/uploads/download_image.png";

// Create an instance of WebClient

WebClient client = new WebClient();

// Hookup DownloadFileCompleted Event

client.DownloadFileCompleted +=    new AsyncCompletedEventHandler(client_DownloadFileCompleted);

// Start the download and copy the file to c:\temp

client.DownloadFileAsync(new Uri(url), @"c:\temp\download_image.png");

void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
MessageBox.Show("File successfully downloaded");

You can also download the file synchronously using WebClient.DownloadFile() method.

How to pass a Javascript Array via JQuery Post so that all its contents are accessible via the PHP $_POST array?

How to send an array via the url in javascript/jQuery?

If you want to pass a JavaScript object/hash (ie. an associative array in PHP) then you would do:

$.post(‘/url/to/page’, {‘key1′: ‘value’, ‘key2′: ‘value’});

If you wanna pass an actual array (ie. an indexed array in PHP) then you can do:

$.post(‘/url/to/page’, {‘someKeyName’: ['value','value']});

If you want to pass a JavaScript array then you can do:

$.post(‘/url/to/page’, {‘someKeyName’: variableName});

How to redirect to index.php after “login in using facebook connect”?

How to forward a website to another url?

Redirect to another web page using PHP.

Facebook redirect url to index.php

I try and get simple solution is bellow:


You could try into below config.php file.

$config['allow_get_array'] = TRUE;

$config['enable_query_strings'] = FALSE;

This is my controller and its work properly for me.

$myurl = "http://mysite.com/index.php";

redirect($this->facebook->getLoginUrl(array('scope' => 'email', 'redirect_uri' => $myurl)));
If users facebook connect first time then after if it redirects to member.php then follow below:

Change the default redirect URL.
Open modules\boonex\facebook_connect\classes\BxFaceBookConnectConfig.php
Look for this line.
$this -> sDefaultRedirectUrl = BX_DOL_URL_ROOT . ‘member.php’;
Change in to this.
$this -> sDefaultRedirectUrl = BX_DOL_URL_ROOT . ‘index.php’;

C# window application checkboxlist selection mode one not working.

CheckedListBox.SelectionMode Property.

Simple solution is bellow.

Add the below name space and assembly

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)


public override SelectionMode SelectionMode { get; set; }

The following example demonstrates initializing a CheckedListBox control by setting the SelectionMode to allow one item in the list to be selected.To run the example, paste the following code in a form containing a CheckedListBox named CheckedListBox1 and call the InitializeCheckListBox method from the form’s constructor or Load method.

// This method initializes CheckedListBox1 with a list of all
// the controls on the form. It sets the selection mode
// to single selection and allows selection with a single click.
// It adds itself to the list before adding itself to the form.

internal System.Windows.Forms.CheckedListBox CheckedListBox1;

private void InitializeCheckedListBox()
this.CheckedListBox1 = new CheckedListBox();
this.CheckedListBox1.Location = new System.Drawing.Point(40, 90);
this.CheckedListBox1.CheckOnClick = true;
this.CheckedListBox1.Name = "CheckedListBox1";
this.CheckedListBox1.Size = new System.Drawing.Size(120, 94);
this.CheckedListBox1.TabIndex = 1;
this.CheckedListBox1.SelectionMode = SelectionMode.One;
this.CheckedListBox1.ThreeDCheckBoxes = true;

foreach ( Control aControl in this.Controls )
this.CheckedListBox1.Items.Add(aControl, false);

this.CheckedListBox1.DisplayMember = "Name";

How to display image and data in Repeater Control in asp.net & c sharp?

Example of Repeater Control in asp.net.

I have simple solution is bellow.

Displaying image in repeater control try following:

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"
SelectCommand="SELECT * FROM [country]"></asp:SqlDataSource>
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1" OnItemDataBound="Repeater1_ItemDataBound">
<asp:HiddenField Value='<%# Eval("id") %>' ID="HiddenField1" runat="server" />
<asp:Image ID="Image1" runat="server" />

And add bellow code into aspx.cs page.

protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
HiddenField h_field =  e.Item.FindControl("HiddenField1") as HiddenField;
if (h_field != null)
string val_item = h_field.Value;
Image img = e.Item.FindControl("Image1") as Image;
img.ImageUrl = "~/image" + val_item + ".jpg";


How to programmatically search for a file inside some JAR into java?

Java: Copy jar files programmatically into another destination.

I have a simple solution is like below:

What is jar file?

Jar is a collection of a multiple files as single one file. Jar files are an better way to distribute java application.It is compressing a file into a zip file is an better way to distribute other program over the internet.

To start JAR file just type the below command.

java -jar example.jar

To explode or extract the JAR file type the below command.

jar -xf example.jar

Now how to search jar files programmatically into another destination?

=>You just use JarInputStream to open it.
=>Then over it using getNextJarEntry.
=>Finaly compare name using ZipEntry.getName().

Your jar file has been search programmatically.



How to solve java.lang.NoClassDefFoundError?

I try and get simple solution is like below:

Here I explain how to solve this type of error.
Step:1-Check the class path in evironment variables.
Step:2-I opened project in navigator of eclipse and check the class files.

Here my class file are in different folder not in bin folder.

Step:3-Simple I just copied different folder class files to bin folder.
Step:4-Then last copy .class files to bin directory of your eclipse.

My problem is resolved by above solution and hope also your problem will be resolve.