Monday, December 17, 2012

How to Conditionally show any control in ASP.NET (Design View)

Most of the times we want to display an item from a database that may or may not have an associated download file link or image etc.

For example: you have different notices to be displayed on website, few of those notice records in database are having downloadble file (in db) and others may not have. and you want to display DOWNLOAD Link only where downloadble file exists in the database record.

If you bind the hyperlink to an control you can toggle the Visibility property from true to false, depending on the existence of an hyperlink, or image file path in the returned records. Following code can be used for the same.


Visible='<%# Eval("filePath")==DBNull.Value ? false: true %>'  


Visible=<%# IIf(Eval("filePath") Is DbNull.Value, "False","True") %>'

Sunday, December 2, 2012

How to Import Large Database Backup in WAMP by Increasing Import size in WAMP or Phpmyadmin

By default PHP Engine in WAMP supports/provides import size of database file is of 2mb. In case we want to import a large database i.e. database size greater than 10mb or 40mb etc.

The following steps can be followed to import large database size in wamp. We need to edit the PHP.INI file and after saving the changes, must restart all the services of WAMP.

Open PHP.INI files (C:\wamp\bin\php\php5.3.5 and C:\wamp\bin\apache\Apache2.2.17\bin) and perform following in both files:

1. Locate upload_max_filesize (use ctrl + F) and set it to as large as you need.

        For example upload_max_filesize = 100M (M denotes Mb).

2. Locate post_max_size and give it a larger value than upload_max_filesize.
        For example post_max_size = 120M (greater than upload size).

3. Locate memory_limit and give it a larger value than both of above.

        For example memory_limit = 140M

Monday, November 5, 2012

How to Enable/Disable the Dots for spaces in Visual Studio

In case your Visual Studio editor is showing white spaces dots in code window, the solution is given below:

Press Ctrl-R followed by Ctrl-W will Enable/Eisable this feature of Visual studio which will show dots for spaces

Sunday, May 20, 2012

MS Excel 2007 - Function Keys Shortcuts

MS Excel 2007 - Function  Keys Shortcuts

Displays the Microsoft Office Excel Help task pane.
CTRL+F1 displays or hides the Ribbon, a component of the Microsoft Office Fluent user interface.
ALT+F1 creates a chart of the data in the current range.
ALT+SHIFT+F1 inserts a new worksheet.
Edits the active cell and positions the insertion point at the end of the cell contents. It also moves the insertion point into the Formula Bar when editing in a cell is turned off.
SHIFT+F2 adds or edits a cell comment.
CTRL+F2 displays the Print Preview window.
Displays the Paste Name dialog box.
SHIFT+F3 displays the Insert Function dialog box.
Repeats the last command or action, if possible.
When a cell reference or range is selected in a formula, F4 cycles through the various combinations of absolute and relative references.
CTRL+F4 closes the selected workbook window.
Displays the Go To dialog box.
CTRL+F5 restores the window size of the selected workbook window.
Switches between the worksheet, Ribbon, task pane, and Zoom controls. In a worksheet that has been split (View menu, Manage This WindowFreeze PanesSplit Window command), F6 includes the split panes when switching between panes and the Ribbon area.
SHIFT+F6 switches between the worksheet, Zoom controls, task pane, and Ribbon.
CTRL+F6 switches to the next workbook window when more than one workbook window is open.
Displays the Spelling dialog box to check spelling in the active worksheet or selected range.
CTRL+F7 performs the Move command on the workbook window when it is not maximized. Use the arrow keys to move the window, and when finished press ENTER, or ESC to cancel.
Turns extend mode on or off. In extend mode, Extended Selection appears in the status line, and the arrow keys extend the selection.
SHIFT+F8 enables you to add a nonadjacent cell or range to a selection of cells by using the arrow keys.
CTRL+F8 performs the Size command (on the Control menu for the workbook window) when a workbook is not maximized.
ALT+F8 displays the Macro dialog box to create, run, edit, or delete a macro.
Calculates all worksheets in all open workbooks.
SHIFT+F9 calculates the active worksheet.
CTRL+ALT+F9 calculates all worksheets in all open workbooks, regardless of whether they have changed since the last calculation.
CTRL+ALT+SHIFT+F9 rechecks dependent formulas, and then calculates all cells in all open workbooks, including cells not marked as needing to be calculated.
CTRL+F9 minimizes a workbook window to an icon.
Turns key tips on or off.
SHIFT+F10 displays the shortcut menu for a selected item.
ALT+SHIFT+F10 displays the menu or message for a smart tag. If more than one smart tag is present, it switches to the next smart tag and displays its menu or message.
CTRL+F10 maximizes or restores the selected workbook window.
Creates a chart of the data in the current range.
SHIFT+F11 inserts a new worksheet.
ALT+F11 opens the Microsoft Visual Basic Editor, in which you can create a macro by using Visual Basic for Applications (VBA).
Displays the Save As dialog box.

MS Excel 2007 - Shortcut  Keys with CTRL combination 

CTRL combination shortcut keys
Switches between worksheet tabs, from left-to-right.
Switches between worksheet tabs, from right-to-left.
Unhides any hidden rows within the selection.
Unhides any hidden columns within the selection.
Applies the outline border to the selected cells.
Removes the outline border from the selected cells.
Applies the General number format.
Applies the Currency format with two decimal places (negative numbers in parentheses).
Applies the Percentage format with no decimal places.
Applies the Exponential number format with two decimal places.
Applies the Date format with the day, month, and year.
Applies the Time format with the hour and minute, and AM or PM.
Applies the Number format with two decimal places, thousands separator, and minus sign (-) for negative values.
Selects the current region around the active cell (the data area enclosed by blank rows and blank columns).
In a PivotTable, it selects the entire PivotTable report.
Enters the current time.
Copies the value from the cell above the active cell into the cell or the Formula Bar.
Displays the Insert dialog box to insert blank cells.
CTRL+Minus (-)
Displays the Delete dialog box to delete the selected cells.
Enters the current date.
Alternates between displaying cell values and displaying formulas in the worksheet.
Copies a formula from the cell above the active cell into the cell or the Formula Bar.
Displays the Format Cells dialog box.
Applies or removes bold formatting.
Applies or removes italic formatting.
Applies or removes underlining.
Applies or removes strikethrough.
Alternates between hiding objects, displaying objects, and displaying placeholders for objects.
Displays or hides the outline symbols.
Hides the selected rows.
Hides the selected columns.
Selects the entire worksheet.
If the worksheet contains data, CTRL+A selects the current region. Pressing CTRL+A a second time selects the current region and its summary rows. Pressing CTRL+A a third time selects the entire worksheet.
When the insertion point is to the right of a function name in a formula, displays the Function Arguments dialog box.
CTRL+SHIFT+A inserts the argument names and parentheses when the insertion point is to the right of a function name in a formula.
Applies or removes bold formatting.
Copies the selected cells.
CTRL+C followed by another CTRL+C displays the Clipboard.
Uses the Fill Down command to copy the contents and format of the topmost cell of a selected range into the cells below.
Displays the Find and Replace dialog box, with the Find tab selected.
SHIFT+F5 also displays this tab, while SHIFT+F4 repeats the lastFind action.
CTRL+SHIFT+F opens the Format Cells dialog box with the Fonttab selected.
Displays the Go To dialog box.
F5 also displays this dialog box.
Displays the Find and Replace dialog box, with the Replace tab selected.
Applies or removes italic formatting.
Displays the Insert Hyperlink dialog box for new hyperlinks or theEdit Hyperlink dialog box for selected existing hyperlinks.
Creates a new, blank workbook.
Displays the Open dialog box to open or find a file.
CTRL+SHIFT+O selects all cells that contain comments.
Displays the Print dialog box.
CTRL+SHIFT+P opens the Format Cells dialog box with the Fonttab selected.
Uses the Fill Right command to copy the contents and format of the leftmost cell of a selected range into the cells to the right.
Saves the active file with its current file name, location, and file format.
Displays the Create Table dialog box.
Applies or removes underlining.
CTRL+SHIFT+U switches between expanding and collapsing of the formula bar.
Inserts the contents of the Clipboard at the insertion point and replaces any selection. Available only after you have cut or copied an object, text, or cell contents.
CTRL+ALT+V displays the Paste Special dialog box. Available only after you have cut or copied an object, text, or cell contents on a worksheet or in another program.
Closes the selected workbook window.
Cuts the selected cells.
Repeats the last command or action, if possible.
Uses the Undo command to reverse the last command or to delete the last entry that you typed.
CTRL+SHIFT+Z uses the Undo or Redo command to reverse or restore the last automatic correction when AutoCorrect Smart Tags are displayed.

Monday, April 30, 2012

How to Get Recursive Listing of Files and Directories in VB.NET

How to Get Recursive Listing of Files and Directories in VB.NET

 Public Shared Function getRecursiveListing(ByVal initial As String) As List(Of String)
' This list stores the results.
Dim result As New List(Of String)

' This stack stores the directories to process.
Dim stack As New Stack(Of String)

' Add the initial directory

' Continue processing for each stacked directory
Do While (stack.Count > 0)
   ' Get top directory string
   Dim dir As String = stack.Pop
' Add all immediate file paths
result.AddRange(Directory.GetFiles(dir, "*.*"))

' Loop through all subdirectories and add them to the stack.
Dim directoryName As String
For Each directoryName In Directory.GetDirectories(dir)

   Catch ex As Exception
   End Try

' Return the list
Return result
    End Function

Dim list As List(Of String) = getRecursiveListing("C:\YourDirectoryPath")

' Loop through and display each path.
For Each path In list

How to get Tablewise Rows or Records count in MySQL Database

How to get Tablewise Rows or Records count in MySQL Database following SQL / Query is used

SELECT table_name, table_rows
    WHERE TABLE_SCHEMA = 'your_database_Name' ; 

How to get record counts for all tables in MySQL Database

    WHERE TABLE_SCHEMA = 'your_database_Name' ; 

Friday, April 27, 2012

How to Get Filename from URL in VB.Net (Asp .Net)

Get Filename from URL

Public Function GetFileNameFromURL(ByVal URL As String) As String
            Return URL.Substring(URL.LastIndexOf("/") + 1)
        Catch ex As Exception
            Return URL
        End Try
End Function