Saturday, 26 October 2013

Abnormally Win XP; high CPU usage from svchost.exe [SOLVED in real!]

Description of the problem

In summer of 2013, Microsoft published an update for windows XP where after the apply of the update, the computer became too slow because, the svchost.exe seemed to consume amount of cpu resources.

Well... officially there wasn't any patch for this bug and lot of computers arround the world become... slow.

The svchost.exe is not something simple, belongs to the core of the system and is used from other services to complete several operations of the system and of other installed applications. So, it is not solution to drop the scvhost.exe. The svchost.exe also is used for viruses also to perform their request actions, so the same svchost.exe is not responsible if the computer is infected or hacked.

So this solution can work on healthy machines.

Solution

Disable the Windows Updates! Microsoft doesn't support the windows xp version so you will not lose any security.
You have to disable the Windows Update from two points
1. Right click on My Computer -> Properties -> Automatic updates -> Disable them!
2. Right click on My Computer -> Manage -> Services and applications -> Services ->
Find in the list the service names "Automatic Updates". Right click on it -> properties -> start up type: disabled.

Thursday, 11 July 2013

excel shortcuts - 98 shortcuts


problem

excel shortcuts - 98 shortcuts
Hidden and usefull
---
See the link also
difficulty level

0/10 :))
compatibility

MSOffice 2010 - Excel (and previous also some of them)
solution

Selection - Select the whole column => CTRL + SPACE
Selection - Select the whole row => SHIFT + SPACE
Selection - Select table => SHIFT + CTRL + SPACE bar
Selection - Save => CTRL + s
Selection - Select visible cells only => ALT + ;
Selection - Select entire region => CTRL + A
Selection - Select range from start cell to far left => SHIFT + Home
Selection - Select range from start cell to end in direction of arrow => SHIFT + End + arrow
Selection - Select a continuous range of data (e.g. pivot), no matter where your cursor is. => CTRL + *
Selection - Select blank cells => F5 + ALT + S + K + ENTER
Selection - Select all cells with comments => CTRL + SHIFT + O
Selection - Select all cells that are directly or indirectly referred to by formulas in the selection => CTRL + SHIFT + {
Selection - Select all cells with formulas that refer directly or indirectly to the active cell => CTRL + SHIFT + }
Selection - Selects all the way to a1 from cursor position => CTRL + SHIFT + HOME
Selection - Select cells in the direction of arrow => CTRL + SHIFT + Arrow
Navigation - Previous sheet => CTRL + Page Up
Navigation - Next sheet => CTRL + Page Down
Navigation - Launch GO TO Dialog (from here you can select special or jump to a cell or range) => F5
Navigation - Go to top left (will go to top left of freezed pane if set) => CTRL + Home
Navigation - Go to last non-blank cell => CTRL + end
Navigation - Go to previous sheet => CTRL + PgUp
Navigation - Go to next sheet => CTRL + PgDn
Navigation - Print => CTRL + p
Navigation - Toggle between workbooks in a given session of excel. => CTRL + TAB
Formulas - Change the type of cell reference from relative to absolute or semi-absolute => F4
Formulas - Repeat whatever you did last => F4
Formulas - Debug portions of a formula (select and press) => F9
Formulas - Sum range => ALT + =
Formulas - Enter array formula => CTRL + SHIFT + Enter
Formulas - Select array formula range => CTRL + /
Formulas - Display range names (can be used when typing formulas) => F3
Formulas - Evaluate formulas. (its easy to remember when working with some “tuf” formulas!) => ALT + TUF
Formulas - Copy a formula from above cell and edit => CTRL + '
Formulas - Display the formula palette after you type a valid function name in a formula => CTRL + A (while writing a formula)
Formulas - Alternate between displaying cell values and displaying cell formulas => CTRL + ` (Single Left Quotation Mark)
Formulas - Calculate formulas => F9
Formulas - Select all precedent cells => CTRL + [
Formulas - Select all dependent cells => CTRL + ]
Formatting - Format Selection (cells, objects, charts) => CTRL + 1
Formatting - Bold a cell’s content => CTRL + B
Formatting - Format Painter – Paste formats from selection => ALT + EST
Formatting - Format as number with 2 dp => CTRL + SHIFT + 1
Formatting - Format as local currency => CTRL + SHIFT + 4
Formatting - Format as percentage with 0 dp => CTRL + SHIFT + 5
Formatting - Hide row => CTRL + 9
Formatting - Hide column => CTRL + 0
Formatting - Unhide row => CTRL + SHIFT + 9
Formatting - Unhide column => CTRL + SHIFT + 0
Formatting - Display the style command format menu => ALT + '
Formatting - Sets/removes strikeout in current cell => CTRL + 5
Formatting - Show/hide the top bar when you have a group => Crtl + 8
Formatting - Single border around selected cells => CTRL + SHIFT + 7
Formatting - Sort => ALT + DS
Formatting - Insert hyperlink => CTRL + K
Formatting - Freeze panes => ALT + WFF
Formatting - Remove grid lines or (alt+t)ov(alt+g)[enter] => ALT + WVG (2007+)
Formatting - To wrap lines => ALT + HW (2007+)
Excel Options - Save as => F12
Excel Options - Collapse the ribbon (press again to expand) => CTRL + F1
Excel Options - Opens print preview => CTRL + F2
Excel Options - Maximize the current window => ALT + SPACE X
Excel Options - Activate next window => ALT + TAB
Excel Options - Activate previous window => ALT + SHIFT + TAB
Excel Options - Close an excel workbook => crtl + F4
Excel Options - Split screens => ALT + W + S
Everything Else - Create a pivot table in new sheet (of course after selecting the range) => ALT + DPF
Everything Else - Create a pivot table in the same sheet. => ALT + DPN
Everything Else - Show visual basic editor => ALT + F11
Everything Else - Macro dialog => ALT + F8
Everything Else - Apply/remove filter => ALT + DFF
Everything Else - Keep filter on columns, but show all rows => ALT + DFS
Everything Else - Insert pivot table => ALT + NVT
Everything Else - Turn filter on or off => CTRL + SHIFT + L
Editing - Paste values only => ALT + ESV
Editing - Edit a cell, place cursor at the end => F2
Editing - Show in-cell drop down with previously entered values => ALT + Down arrow
Editing - Fills down value from cell above => CTRL + D
Editing - Add a comment or Edit comment => SHIFT + F2
Editing - Insert new sheet => SHIFT + F11
Editing - Insert row => CTRL + +
Editing - Delete row => CTRL +
Editing - -Copy => CTRL + C
Editing - Paste => CTRL + V
Editing - Cut => CTRL + X
Editing - Undo => CTRL + Z
Editing - Get a line break inside the cell => ALT + Enter (while editing the cell)
Editing - Clear all contents => ALT + EAA
Editing - Copy => CTRL + insert
Editing - Paste => SHIFT + Insert
Editing - Make chart/pivot chart => F11
Editing - Edit a cell in Apple Macs => CTRL + U
Editing - Copy the value from the cell above the active cell into the cell or the formula bar => CTRL + SHIFT + "
Editing - Copies whatever is in the cell to the left of it. => CTRL + R
Editing - Delete box (cell, row, column) => ALT + ED
Editing - Insert box (cell, row, column) => ALT + IE
Auto Complete - Enter current date => CTRL + ;
Auto Complete - Enter current time => CTRL + :


Wednesday, 12 June 2013

Javascript, Load file (html script) into div, getting back UI reference

Load UI dynamically with jquery's .load() function
Hi, bellow is a javascript  script where loads another html into your page, into another div or whatever. As you see, creates another div with a new provided id. This script is useful because applies the "hooks" when the load is completed, so there is no case to loose the load. Also, the function that it offered to be called after the load is completed, returns a lot of args, like the "xhr" where is the real load where the jquery uses under the hood.

function LoadUIFromFile(
    HostID,            // The id of the element where the new element will be added.
    EmbeddedID,        // The id of the new embedded div element.
    FileToLoad,        // The html script where will be loaded in the new id.
    HideIt,            // (optional) Boolean, hide it or not on new div's creation.
    OnLoad,            // (optional) Function will be called on load completion. Available args: Caller, responseText, textStatus, xhr.
    CallerObject    // (optional) Which object called this function, this will be used for OnLoad
){

    //handle the undefined variables
    if (typeof HideIt == 'undefined') HideIt=true;
    if (typeof OnLoad == 'undefined') OnLoad=null;
    if (typeof CallerObject == 'undefined') CallerObject=null;
   
    //create the div, load the data of the file to it and hide it
    $("#"+HostID).append('<div id="'+EmbeddedID+'"></div>');
    $("#"+EmbeddedID).data("AnelUtils_OnLoadFunction",OnLoad);
    $("#"+EmbeddedID).data("AnelUtils_CallerObject",CallerObject);
    $("#"+EmbeddedID).load(FileToLoad, null, function(responseText, textStatus, xhr) {
        if ($(this).data("AnelUtils_OnLoadFunction")!=null)
            $(this).data("AnelUtils_OnLoadFunction")($(this).data("AnelUtils_CallerObject"), responseText, textStatus, xhr);
    });
    if (HideIt) $("#"+EmbeddedID).hide();
   
    return $("#"+EmbeddedID);

}

Tuesday, 11 June 2013

real Rich Editor on .net ASP MVC applications


situation

real Rich Editor on .net ASP MVC applications
problem

ASP.net MVC - Viewer
How to embeed, the Rich Editor, JCE TinyMCE, HTML editor to your ASP AMV project
The somehow problem with this solution is that if you have more that one textarea in your page, all text areas will use the editor.
difficulty level

1/10 :))
compatibility

ASP.net MVC
solution

1. Download the editor from this page: http://www.tinymce.com/download/download.php This example is running with version TinyMCE 3.5.8 (the vesrion TinyMCE 4.0b1 found to have broken links itself!). Place this JS to Script folder of your MVC project. For instance, I placed it to ~/Scripts/JSScripts/TinyMCEEditor/. To add it in pretty nice fashion, create the tinymce directory somewhere out of the VS, and drag and drop it into Solution Explorer. The VS automatically will create folders files in both solution explorer and physical files in Solution’s directory.
2. Add this script to your viewer. This script initialize the editor. The red text should be replaced with the exact file name of the js file of the editor.
<script type="text/javascript" src="~/Scripts/JSScripts/TinyMCEEditor/tiny_mce_src.js"></script>
<script type="text/javascript">
 tinyMCE.init({
  // General options
  mode: "textareas",
  theme: "advanced",
  plugins: "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",
  setup: function (ed) {
   ed.onKeyPress.add(
   function (ed, evt) {
   }
   );
  }, // Theme options
  theme_advanced_buttons1: "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
  theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
  theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
  theme_advanced_buttons4: "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
  theme_advanced_toolbar_location: "top",
  theme_advanced_toolbar_align: "left",
  theme_advanced_statusbar_location: "bottom",
  theme_advanced_resizing: true,
  // Example content CSS (should be your site CSS)
  content_css: "css/content.css",
  // Drop lists for link/image/media/template dialogs
  template_external_list_url: "lists/template_list.js",
  external_link_list_url: "lists/link_list.js",
  external_image_list_url: "lists/image_list.js",
  media_external_list_url: "lists/media_list.js",
  // Style formats
  style_formats: [
  { title: 'Bold text', inline: 'b' },
  { title: 'Red text', inline: 'span', styles: { color: '#ff0000' } },
  { title: 'Red header', block: 'h1', styles: { color: '#ff0000' } },
  { title: 'Example 1', inline: 'span', classes: 'example1' },
  { title: 'Example 2', inline: 'span', classes: 'example2' },
  { title: 'Table styles' },
  { title: 'Table row 1', selector: 'tr', classes: 'tablerow1' }
  ],
  // Replace values for the template plugin
  template_replace_values: {
   username: "Some User",
   staffid: "991234"
  }
 });
</script>

3. Call the editor via textarea element. Instead of the helper, write the html code by your self ("Description" is the name of the field)
  remove this: @Html.EditorFor(model => model.Description)
  with this: @Html.TextAreaFor(model => model.Description)
  or with this: <textarea id="Description" name="Description" rows="15" cols="50" style="width: 80%" runat="server">@Html.Raw(Model.Description)</textarea>

4. Update your MVC model to allow html scripts from the Viewer. Add the attribute [AllowHtml] to your Model's attribute, to avoid validation html form error request. Use using System.Web.Mvc;
5 . To Show the value as Html rich format, use the HTML.Raw helper as above
@Html.Raw(item.Description)


Thursday, 16 May 2013

Always Display the Current Year in your © Copyright Notice


situation

Keep my Copyright label updated.
problem

Always Display the Current Year in your © Copyright Notice in HTML, PHP, ASP and Joomla
difficulty level

1/10 :))
compatibility

For HTML, PHP, ASP and Joomla
solution

HTML
<p>&copy; Copyright 2000-
<script language="JavaScript" type="text/javascript">
    now = new Date
    theYear=now.getYear()
    if (theYear < 1900)
    theYear=theYear+1900
    document.write(theYear)
</script>

My Company, Inc. All rights reserved. Version 4.01g</p>

PHP
date("Y")

Joomla
    <div id="footer">
        <span class="copy"><?php echo JText::_('My company &copy; 2009
-'.date("Y").' |');?> <a href="index.php?option=com_content&amp;view=article&amp;catid=84&amp;id=130&amp;Itemid=464">Privacy Policy</a></span>
    </div>

ASP
<h6>&copy;
@DateTime.Now.Year - My Company</h6>