Archive for December 2013

Tips to create youtube videos for good traffic, visits, and visitors

Tips to follow to create good youtube videos that can attract visitors

1. Length of the video should be short and not more than 1 hour.
2. Ask users to subscribe, share, like and comment after watching the video.
3. Upload videos at regular intervals of time atleast one video every week.
4. Maintain continuity and explain the continuity in the videos.
5. Create playlists and all videos into different playlist so that users can find all related videos under a playlist.
6. Choose a custom thumbnail that is related to the playlist in which you are going to add that video.
7. Make sure that you added appropriate meta data for the video such as title, tags and description.


Wednesday, 25 December 2013
Posted by Sudhir Chekuri

WPF Browse Image with OpenFileDialog and saving it in SQL Server database using C# ADO.NET Code

SQL Query to create table in SQL Server database to save image selected from WPF application


CREATE TABLE [dbo].[saveimage](
[sno] [int] IDENTITY(1,1) NOT NULL,
[img] [varchar](max) NULL
)

XAML Code in WPF application containing browse button, image and Upload button


<Window x:Class="SaveImageInDb.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <StackPanel VerticalAlignment="Center" >
            <Button Name="BtnUBrowse" Height="50" Width="150" Click="BtnBrowse_Click" >Browse Image</Button>
            <Border BorderBrush="Black" BorderThickness="1" Height="200" Width="150">
            <Image Name="Img1" Height="200" Width="150" ></Image>
            </Border><Button Name="BtnUploadImage" Height="50" Width="150" Click="BtnUploadImage_Click" >Upload Image</Button>
        </StackPanel>

    </Grid>
</Window>


C#.NET and ADO.NET Code to browse image using OpenFileDialog and uploading it after showing it in image control


using Microsoft.Win32;
using System;
using System.Data.SqlClient;
using System.IO;
using System.Windows;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace SaveImageInDb
{
  
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
        private void BtnBrowse_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog op = new OpenFileDialog();
            op.Title = "Select a picture";
            op.Filter = "All supported graphics|*.jpg;*.jpeg;*.png|" +
                "JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|" +
                "Portable Network Graphic (*.png)|*.png";
            if (op.ShowDialog() == true)
            {
                Img1.Source = new BitmapImage(new Uri(op.FileName));
            }
        }
        private void BtnUploadImage_Click(object sender, RoutedEventArgs e)
        {
            var imageBuffer = BitmapSourceToByteArray((BitmapSource)Img1.Source);
            SqlConnection con = new SqlConnection("Data Source=SUDHIR;Initial Catalog=db_wpfimage;Integrated Security=True");
            SqlCommand cmd = new SqlCommand("insert into saveimage values('" + imageBuffer + "')", con);
            con.Open();
            int i = cmd.ExecuteNonQuery();
            con.Close();
            if (i > 0)
            { MessageBox.Show("Image Uploaded to database"); }
        
        }
        private byte[] BitmapSourceToByteArray(BitmapSource image)
        {
            using (var stream = new MemoryStream())
            {
                var encoder = new PngBitmapEncoder(); // or some other encoder
                encoder.Frames.Add(BitmapFrame.Create(image));
                encoder.Save(stream);
                return stream.ToArray();
            }
        }
    }
}

Monday, 23 December 2013
Posted by Sudhir Chekuri
Tag :

Windows store app code to consume web service data to display in gridview

C# code in Web service

  [WebMethod]
    public donardetails  Required(string m)
    {

        SqlCommand cmd = new SqlCommand("select* from tbl_DonateBlood where BloodGroup='" + m + "'", con);
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        DataSet ds = new DataSet();
        da.Fill(ds);
        List<string> l = new List<string>();
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            string s = ds.Tables[0].Rows[i][0].ToString() + "," + ds.Tables[0].Rows[i][1].ToString() + "," + ds.Tables[0].Rows[i][2].ToString() + "," + ds.Tables[0].Rows[i][3].ToString() + "," + ds.Tables[0].Rows[i][4].ToString();
            l.Add(s);
        }
        donardetails d = new donardetails();
        d.details  = l;
        return  d;

    }

   public class donardetails
    {
       public List<string> details;
    
    }



XAML Code

 <GridView x:Name="Grid_Details"  Height="640"   >
                <GridView.ItemTemplate>
                    <DataTemplate>
                            <Border BorderBrush="Red" BorderThickness="1" Padding="11">
                                <Grid>
                           <Grid.RowDefinitions>
                                    <RowDefinition Height="40"/>
                                    <RowDefinition Height="40"/>
                                    <RowDefinition Height="40"/>
                                    <RowDefinition Height="40"/>
                                    <RowDefinition Height="40"/>
                                    <RowDefinition Height="40"/>
                                    <RowDefinition Height="40"/>
                                </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="auto"/>
                                    <ColumnDefinition Width="auto"/>
                                    <ColumnDefinition Width="auto"/>
                                    <ColumnDefinition Width="auto"/>
                                    <ColumnDefinition Width="auto"/>
                                    <ColumnDefinition Width="auto"/>
                                    <ColumnDefinition Width="auto"/>
                            </Grid.ColumnDefinitions>
                             
                                <TextBlock  Grid.Row="0" Grid.Column="0"  Text="SNo:"  Width="150" Height="25" Foreground="Red" FontSize="15" HorizontalAlignment="Left"/>
                                <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding SNo}"  Width="150" Height="25" Foreground="Red" FontSize="15" HorizontalAlignment="Left"/>
                                <TextBlock Grid.Row="1" Grid.Column="0" Text="Name:" Width="150" Height="25" Foreground="Red" FontSize="15" HorizontalAlignment="Left"/>
                                <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Name}" Width="150" Height="25" Foreground="Red" FontSize="15" HorizontalAlignment="Left"/>
                                <TextBlock Grid.Row="2" Grid.Column="0" Text="Mobile Number:" Width="150" Height="25" Foreground="Red" FontSize="15" HorizontalAlignment="Left"/>
                                <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding MobileNo}" Width="150" Height="25" Foreground="Red" FontSize="15" HorizontalAlignment="Left"/>
                                <TextBlock Grid.Row="3" Grid.Column="0" Text="Blood Group:" Width="150" Height="25" Foreground="Red" FontSize="15" HorizontalAlignment="Left"/>
                                <TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding BloodGroup}" Width="150" Height="25" Foreground="Red" FontSize="15" HorizontalAlignment="Left"/>
                                <TextBlock Grid.Row="4" Grid.Column="0" Text="Location:" Width="150" Height="25" Foreground="Red" FontSize="15" HorizontalAlignment="Left"/>
                                <TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding Location}" Width="150" Height="25" Foreground="Red" FontSize="15" HorizontalAlignment="Left"/>
                                </Grid>
                            </Border>
                        </DataTemplate>
                </GridView.ItemTemplate>
                </GridView>

C# Code

  public async void GetData()
         {
            
                 Give_Blood.GiveBloodServiceReference.BloodDonarWebServiceSoapClient o = new BloodDonarWebServiceSoapClient();
                 RequiredResponse a = await o.RequiredAsync(t.Text);
                 int count = a.Body.RequiredResult.details.Count;
                 if (t.Text != "bloodgroup")
                 {
                     if (count == 0)
                     {
                         MessageDialog msg = new MessageDialog("Blood Donars Not Available For '" + t.Text + "' Blood Group");
                         await msg.ShowAsync();
                     }
                 }

                 string[] rowarr = new string[count];
                 int k = 1;
                 for (int i = 0; i < count; i++)
                 {
                     string s = a.Body.RequiredResult.details[i];
                     //string s = a.Body.RequiredResult[i].ToString();
                     rowarr = s.Split(',');
                     //rowarr contains a row data 

                     for (int j = 0; j < (rowarr.Length - 1); )
                     {
                         tbl_GiveBlood h = new tbl_GiveBlood();

                         h.SNo = k.ToString();
                         j++;
                         h.Name = rowarr[j];
                         j++;
                         h.MobileNo = rowarr[j];
                         j++;
                         h.BloodGroup = rowarr[j];
                         j++;
                         h.Location = rowarr[j];
                         j++;
                         k++;
                         Grid_Details.Items.Add(h);

                     }
                 }
        }

Saturday, 14 December 2013
Posted by Sudhir Chekuri

Windows phone c# code to Call and Message from windows phone

 C# code for sending message:


            SmsComposeTask smsComposeTask = new SmsComposeTask();
            smsComposeTask.To = "6786543672"; //  phone number to whom the sms is to be sent
            smsComposeTask.Show(); // this will invoke the native sms edtior

C# code to make a call:


              phoneCallTask.PhoneNumber = "6786543672";
              phoneCallTask.DisplayName = "Name";
              phoneCallTask.Show();


Posted by Sudhir Chekuri

Windows phone C# code to get selected data by selecting checkbox in listbox

Here is the example to get selected data by selecting checkbox in listbox:

xaml code


<ListBox Height="600" Name="listBox1"  Margin="0,0,0,0" >
                     <ListBox.ItemTemplate>
                          <DataTemplate>
                        
                            <Grid x:Name="grid">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="auto"/>
                                  <ColumnDefinition Width="150"/>
                                   <ColumnDefinition Width="150"/>
                                <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                            <CheckBox x:Name="cb" Tag="{Binding PhoneNo}" IsChecked="{Binding IsSelected}" IsEnabled="True" Checked="cb_Checked_1" Unchecked="cb_Unchecked_1" Grid.Column="0" />
                            <TextBlock x:Name="Txt_Name" Grid.Column="1" Text="{Binding Name}" VerticalAlignment="Center"/>
                            <TextBlock x:Name="Txt_PhNo" Grid.Column="2"  Text="{Binding PhoneNo}" VerticalAlignment="Center" />
                            <TextBlock Grid.Column="3"  Text="{Binding Location}" VerticalAlignment="Center"/>
                             </Grid>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
               </ListBox>


C# code:


 string option_selected = "";
        int check_count = 0;
       
        private void cb_Checked_1(object sender, RoutedEventArgs e)
        {
              check_count = 0;
              option_selected = "";
            SearchElement(listBox1);
           string s = " Total Selected Checkboxes : " + check_count.ToString()
                 + Environment.NewLine + " Value Associated : " + option_selected;
        }
        
        private void cb_Unchecked_1(object sender, RoutedEventArgs e)
        {
            check_count = 0;
            option_selected = "";
            SearchElement(listBox1);
           string s = " Total Selected Checkboxes : " + check_count.ToString()
                + Environment.NewLine + " Value Associated : " + option_selected;
        }

        private void SearchElement(DependencyObject targeted_control)
        {
            var count = VisualTreeHelper.GetChildrenCount(targeted_control);   // targeted_control is the listbox
            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    var child = VisualTreeHelper.GetChild(targeted_control, i);
                    if (child is CheckBox) // specific/child control 
                    {
                        CheckBox targeted_element = (CheckBox)child;
                        if (targeted_element.IsChecked == true)
                        {
                            if (option_selected != "")
                            {
                                option_selected = option_selected + " , " + targeted_element.Tag;
                            }
                            else
                            {
                                // get the value associated with the "checked" checkbox  
                                option_selected = targeted_element.Tag.ToString();
                            }
                            // count the number of "Checked" checkboxes
                            check_count = check_count + 1;
                            return;
                        }
                    }
                    else
                    {
                        SearchElement(child);
                    }
                }
            }
            else
            {
                return;
            }

        }



Posted by Sudhir Chekuri

WIndows phone and store game ratings

use the below link to add app name
and other details of app.
Rating certificate will be send to the mail id which you have during registeration of app.

http://msdn.microsoft.com/en-us/library/windowsphone/help/jj206734(v=vs.105).aspx


Tuesday, 10 December 2013
Posted by Sudhir Chekuri

Privacy Policy of Truth or Dare Windows phone app

Truth or Dare is a windows phone app that does not collect or publish any personal information.
Your privacy is our at-most concern.

If you would like to report any violations of this policy, please contact us at devsupport@primaccess.com


Posted by Sudhir Chekuri

Privacy policy of Christmas Fever windows phone app

Christmas Fever is a windows phone app that does not collect or publish any personal information.
Your privacy is our at-most concern.

If you would like to report any violations of this policy, please contact us at devsupport@primaccess.com


Thursday, 5 December 2013
Posted by Sudhir Chekuri

Privacy policy of Hash Codes windows phone app

Hash Codes is a windows phone app that does not collect or publish any personal information.
Your privacy is our at-most concern.

If you would like to report any violations of this policy, please contact us at support@primaccess.com


Tuesday, 3 December 2013
Posted by Sudhir Chekuri

Followers

Total Pageviews

Powered by Blogger.

- Copyright © 2013 DevStudent - Metrominimalist - Powered by Blogger - Designed by Johanes Djogan -