www.allfree-stuff.com


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.


C#:

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


VB.Net



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

KEY
DESCRIPTION
F1
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.
F2
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.
F3
Displays the Paste Name dialog box.
SHIFT+F3 displays the Insert Function dialog box.
F4
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.
F5
Displays the Go To dialog box.
CTRL+F5 restores the window size of the selected workbook window.
F6
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.
F7
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.
F8
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.
F9
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.
F10
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.
F11
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).
F12
Displays the Save As dialog box.


MS Excel 2007 - Shortcut  Keys with CTRL combination 

CTRL combination shortcut keys
KEY
DESCRIPTION
CTRL+PgUp
Switches between worksheet tabs, from left-to-right.
CTRL+PgDn
Switches between worksheet tabs, from right-to-left.
CTRL+SHIFT+(
Unhides any hidden rows within the selection.
CTRL+SHIFT+)
Unhides any hidden columns within the selection.
CTRL+SHIFT+&
Applies the outline border to the selected cells.
CTRL+SHIFT_
Removes the outline border from the selected cells.
CTRL+SHIFT+~
Applies the General number format.
CTRL+SHIFT+$
Applies the Currency format with two decimal places (negative numbers in parentheses).
CTRL+SHIFT+%
Applies the Percentage format with no decimal places.
CTRL+SHIFT+^
Applies the Exponential number format with two decimal places.
CTRL+SHIFT+#
Applies the Date format with the day, month, and year.
CTRL+SHIFT+@
Applies the Time format with the hour and minute, and AM or PM.
CTRL+SHIFT+!
Applies the Number format with two decimal places, thousands separator, and minus sign (-) for negative values.
CTRL+SHIFT+*
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.
CTRL+SHIFT+:
Enters the current time.
CTRL+SHIFT+"
Copies the value from the cell above the active cell into the cell or the Formula Bar.
CTRL+SHIFT+Plus (+)
Displays the Insert dialog box to insert blank cells.
CTRL+Minus (-)
Displays the Delete dialog box to delete the selected cells.
CTRL+;
Enters the current date.
CTRL+`
Alternates between displaying cell values and displaying formulas in the worksheet.
CTRL+'
Copies a formula from the cell above the active cell into the cell or the Formula Bar.
CTRL+1
Displays the Format Cells dialog box.
CTRL+2
Applies or removes bold formatting.
CTRL+3
Applies or removes italic formatting.
CTRL+4
Applies or removes underlining.
CTRL+5
Applies or removes strikethrough.
CTRL+6
Alternates between hiding objects, displaying objects, and displaying placeholders for objects.
CTRL+8
Displays or hides the outline symbols.
CTRL+9
Hides the selected rows.
CTRL+0
Hides the selected columns.
CTRL+A
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.
CTRL+B
Applies or removes bold formatting.
CTRL+C
Copies the selected cells.
CTRL+C followed by another CTRL+C displays the Clipboard.
CTRL+D
Uses the Fill Down command to copy the contents and format of the topmost cell of a selected range into the cells below.
CTRL+F
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.
CTRL+G
Displays the Go To dialog box.
F5 also displays this dialog box.
CTRL+H
Displays the Find and Replace dialog box, with the Replace tab selected.
CTRL+I
Applies or removes italic formatting.
CTRL+K
Displays the Insert Hyperlink dialog box for new hyperlinks or theEdit Hyperlink dialog box for selected existing hyperlinks.
CTRL+N
Creates a new, blank workbook.
CTRL+O
Displays the Open dialog box to open or find a file.
CTRL+SHIFT+O selects all cells that contain comments.
CTRL+P
Displays the Print dialog box.
CTRL+SHIFT+P opens the Format Cells dialog box with the Fonttab selected.
CTRL+R
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.
CTRL+S
Saves the active file with its current file name, location, and file format.
CTRL+T
Displays the Create Table dialog box.
CTRL+U
Applies or removes underlining.
CTRL+SHIFT+U switches between expanding and collapsing of the formula bar.
CTRL+V
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.
CTRL+W
Closes the selected workbook window.
CTRL+X
Cuts the selected cells.
CTRL+Y
Repeats the last command or action, if possible.
CTRL+Z
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
stack.Push(initial)


' Continue processing for each stacked directory
Do While (stack.Count > 0)
   ' Get top directory string
   Dim dir As String = stack.Pop
   Try
' 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)
   stack.Push(directoryName)
Next


   Catch ex As Exception
   End Try
Loop


' 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
   Console.WriteLine(path)
Next



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
    FROM INFORMATION_SCHEMA.TABLES
    WHERE TABLE_SCHEMA = 'your_database_Name' ; 


How to get record counts for all tables in MySQL Database

SELECT SUM(TABLE_ROWS) 
    FROM INFORMATION_SCHEMA.TABLES 
    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
        Try
            Return URL.Substring(URL.LastIndexOf("/") + 1)
        Catch ex As Exception
            Return URL
        End Try
End Function