Advertisements

Wednesday, April 23, 2014

// // Leave a Comment

Twitter Updated its Layout

Hi,

If you are using Twitter, here is a good news for you all. Now twitter has updated its layout and made similar as Older Facebook layout. It has 3 columns and based in your screen resolution, it reduce to 2 column.
Some of the new features are as below.
Big Profile Photo
Bigger Header Image

Feature to Filter Tweets
When you Joined Twitter
Bigger notification for Followers profile
Ability to Pin Ability

Custom size for Tweets according to their popularity
There are a lot of new features also available. You are requested to visit and check yourself.
Reference: Aakarpost
Thanks for reading. Please provide feedback and comments and do not forget to share.
+John Bhatt 
Read More
// // Leave a Comment

Running DOS or C/C++ in Full Screen in Windows 7 or 8

Hi,

If you are a developer, of learning programming languages, you must have to deal with Turbo C/C++ compiler. On the early days of Learning, we have used Windows XP which have ability to run Command Prompt (MS DOS) in full screen mode. But Microsoft has ended support to Windows XP and released 4 new operating system after Windows XP. The major change in newer versions is that, they do not support MS DOS in full screen mode.

Now the requirement is, if you have to work on C/C++ application, you have to work in minimized screen. To make it full screen, we have an application named DOSBox, which is open-source and cross platform.
Below is step by step guide to install and configure DOSBox.

  • Download and Install DOSBox from http://www.dosbox.com/download.php?main=1.
  • After installing open DOSBox from menu.
  • You will see following screen.
  • Type following command to load Turbo C compiler in DOSBox.
    MOUNT C C:\TC ⏎
    C: ⏎
    CD BIN ⏎
    TC ⏎
    

Description of Code:

Line 1: MOUNT C C:\TC : Mounts C:\TC (where Turbo C is located) as C Drive. You can choose any drive that exists in your system. This will not effect your existing files.
Line 2: C: : Navigated to C Drive.
Line 3: CD BIN Navigated to Folder BIN normally as we do in MS - DOS.
Line 4: TC Run the Turbo C/C++ Compiler IDE located inside BIN folder.


Lets make it full screen.
Do not forget to change the Directory options from Options menu so that Include directories work fine.
If you find this article helpful, do share with your friends. If you have any suggestions or comments, let us know. We will read and improve ourselves.
John Bhatt
Read More

Wednesday, March 26, 2014

// // Leave a Comment

Microsoft Excel : Text Functions Part -3

Hi,

In previous post we have talked about some of the Text functions in detail. We will continue this post from where we left.

If you have not read previous posts, this post might be some confusing to you. I will request you to read these posts before proceeding.

Text Functions in Microsoft Excel Part -1

Text Functions in Microsoft Excel Part –2

Directly moving ahead to function details and their use.

9. FIXED()

Introduction: FIXED function Rounds a number to the specified number of decimals, formats the number in decimal format using a period and commas, and returns the result as text.
Using Method: This function takes minimum of one and maximum of 3 parameters. First one is Number, this can be any number value or reference to a cell. Second is the decimals , for rounding. Last one is a Boolean option for keeping period separator or not.

=FIXED(139493.4532,2) or =FIXED(A1,-1,TRUE)

Example:

FIXED

NOTE: Difference between ROUND function and FIXED function is, FIXED converts number to text after rounding but ROUND keep number to number after rounding.

10. LEFT()

Introduction: LEFT function returns specified number of characters from start based in start number (length) in a string.

Using Method: This function takes two parameters. First one is text to be searched, this can be simple string value or reference to a cell. Second is the number of characters to start.
=LEFT("Hello World",6) or =LEFT(A1,6)

Example:

LEFT

11. LEN()

Introduction: LEN function returns number of characters in a string. In simple words, it returns the length of a string.

Using Method: This function takes single parameter and that is of type string or reference to a cell.

=LEN(“Hello World”) or =LEN(A1)

Example:

 LEN

12. LOWER()

Introduction: LOWER function converts all characters in a string to lower case.
Using Method: This function takes a single parameter and that is of type string or reference to a cell.

=LOWER(“Hello World”) or =LOWER(A1)

Example:

LOWER 

13. MID()

Introduction: MID function returns the middle characters from a string specified by start number and length.
Using Method: This function takes three parameters. One is text which is required, another is Start number to search from and another is number of character to show or length to be picked.
=MID(“John is from Nepal”,9,10) or =MID(A1,9,10)

Example:

 MID

14. PROPER()

Introduction: PROPER function converts all characters and words to Title case as per English Grammar. Means all the beginning character of all words are in capital letter and other are in small letter regardless of their typography.
Using Method: This function takes a single parameter and that is text string or reference to cell .

=PROPER(“this is going to BE CHANGED in title”) or =PROPER(A1)

Example:

PROPER 

15. REPLACE()

Introduction: REPLACE function replaces a part of string with specified string.
Using Method: This function takes four parameters, First one is text to be replaced, then starting number of character where replace to be started, then number of character to replace (length), and final one is new text.
=REPLACE(A1,6,3,”was ”) or =REPLACE(A1,6,3,C1)

Example:

 REPLACE

16. RIGHT()

Introduction: RIGHT function does the exactly same work as LEFT do but from opposite index. This returns the text from end of an string based on the length passed by user.
Using Method: This function takes two parameters and both are required. First one is string or reference to cell containing text and another is number of character to be shown.
=RIGHT(“The last five words”,5) or =RIGHT(A1,5)

Example:

 RIGHT 

I will be back with remaining text function in another post. Thanks for reading.

You can provide feedback using comments or contact page.

John Bhatt

Read More

Wednesday, March 12, 2014

// // Leave a Comment

Print GridView only in ASP.NET

Hi,

Lets come back to ASP.NET tips and trick series. We are once again going to learn new trick related to GridView. Previously I have posted following articles related to GridView.

Requirement

Suppose, you have a page where you are displaying any kind of data to user. You want to add a functionality to print these records. But problem with Browsers Default Print options (Ctrl+P) is that, it will print whole page. All header images, footer, sidebar and colors will printed, which is not required. You have two options, either create a new page for print view and redirect user to that page or just print the required area, in our case it is GridView. 
Most of developer working in a web applications have MasterPage for their web-application. MasterPage are similar to templates in normal HTML having some advanced functionality and customized code for maintaining easier and common look of website or application.
Lets have a look at below screen to make our requirement more clear.

Code for Default.aspx

This is the code for GridView.
   <asp:GridView runat="server" ID="gvProducts" AutoGenerateColumns="false" AllowPaging="false" AlternatingRowStyle-BackColor="Linen" HeaderStyle-BackColor="SkyBlue" Width="100%" OnPageIndexChanging="gvProducts_PageIndexChanging" EmptyDataText="Sorry! No Products to List. First Add from Add Product Link.">
                    <Columns>
                        <asp:TemplateField HeaderText="Product ID">
                            <ItemTemplate>
                                <asp:Label ID="lblProductID" runat="server" Text='<%#Eval("ProductID")%>' ToolTip="ID of Product as stored in Database."></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <Columns>
                        <asp:TemplateField HeaderText="Product Name">
                            <ItemTemplate>
                                <asp:Label ID="lblProductName" runat="server" ToolTip="Name of Product" Text='<%#Eval("ProductName")%>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <Columns>
                        <asp:TemplateField HeaderText="Brand">
                            <ItemTemplate>
                                <asp:Label ID="lblBrandName" runat="server" ToolTip="Brand of Product" Text='<%#Eval("BrandName")%>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <Columns>
                        <asp:TemplateField HeaderText="Category">
                            <ItemTemplate>
                                <asp:Label ID="lblProductCat" runat="server" ToolTip="Category of Product" Text='<%#Eval("CategoryName")%>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <Columns>
                        <asp:TemplateField HeaderText="In Stock">
                            <ItemTemplate>
                                <asp:Label ID="lblProductinStock" runat="server" ToolTip="Quantity available in Stock"
                                    Text='<%#Eval("UnitsInStock")%>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>

Code for Default.aspx.cs

We do not have much more at backend, we are just going to bind data to GridView.
 protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConToStore"].ConnectionString);
            SqlDataAdapter adp = new SqlDataAdapter("Select * from Products,Brands,Category where Products.BrandID=Brands.BrandID and Products.CategoryID=Category.CategoryID", con);
            DataSet ds = new DataSet();
            adp.Fill(ds);
            gvProducts.DataSource = ds.Tables[0];
            gvProducts.DataBind();
        }
    }

Printing Page.

Lets press Ctrl+P key combination to print page, before printing see the Preview.

Printing GridView Only

We need to make following change to print GridView only. Lets start with HTML.
Wrap the GridView inside a Table or Panel. I am using Table. You can also go with Panel.
  <table width="70%" id="pnlGridView" runat="server" align="center" class="ContentTable">
        <tr>
            <td colspan="2" align="center">
                <h1>All Products in Store</h1>
            </td>
        </tr>
        <tr>
            <td> </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:GridView runat="server" ID="gvProducts" AutoGenerateColumns="false" AllowPaging="false" 
    AlternatingRowStyle-BackColor="Linen" HeaderStyle-BackColor="SkyBlue" Width="100%" 
    OnPageIndexChanging="gvProducts_PageIndexChanging" 
    EmptyDataText="Sorry! No Products to List. First Add from Add Product Link.">
                    ...............
     .............
                </asp:GridView>
            </td>
        </tr>
        <tr>
            <td align="right">
                <asp:LinkButton ID="lnkPrint" runat="server" ToolTip="Click to Print All Records" Text="Print Data" OnClick="lnkPrint_Click"></asp:LinkButton>     
                <asp:LinkButton ID="lnkExportAll" runat="server" ToolTip="Export this List" Text="Export to Excel" OnClick="lnkExportAll_Click"></asp:LinkButton>
                     
                <asp:LinkButton ID="lnkAddNew" runat="server" ToolTip="Add New Product"
                    Text="Add New" OnClick="lnkAddNew_Click"></asp:LinkButton>
            </td>
        </tr>
    </table>
Now just add following JavaScript function in head section and assign that function to Print linkbutton.
    <script language="javascript" type="text/javascript">
        function PrintPage() {
            var printContent = document.getElementById('<%= pnlGridView.ClientID %>');
            var printWindow = window.open("All Records", "Print Panel", 'left=50000,top=50000,width=0,height=0');
            printWindow.document.write(printContent.innerHTML);
            printWindow.document.close();
            printWindow.focus();
            printWindow.print();
        }
    </script>
Now lets click on Print Link button which we have created. Following will be output for above code.

Bingo! It was the requirement.
Hope you enjoyed reading. If you have any feedback or suggestions, please send us as comment or using contact options. Keep sharing.
John Bhatt
Read More