Monday, June 14, 2010

JavaScript syntax error with telerik.grid.min.js

When implementing custom binding with the Telerik ASP.NET MVC, I based my code on this example described here under the Controller tab.

The CustomBinding action is called when the whole page is loaded or refreshed, then showing on the grid the default data, e.g. the first page. This action should return a view with the model object (IEnumerable<Order> in this example).

The _CustomBinding action is called from an AJAX call when the user clicks on the grid controls, like page number, sort, or filter. This action should return a view with a GridModel object and not with the view model (IEnumerable<Order>). If you do not use a GridModel object, then you will get the JavaScript syntax error char 4048 in telerik.grid.min.js.




Although the Telerik example is right, when I wrote my code based on it, I mistakenly used the wrong model object, and couldn't figure out what was wrong. Thanks for this forum post that enlighted me of what was going on.

Saturday, June 12, 2010

Using SyntaxHighlighter (version 2.1.364) with Blogger

After spending sometime to make SyntaxHighlighter work with Blogger, I finally found an article that has the solution that perfectly worked for me. The other posts I found were not using the latest version (version 2.1.364 when this post was published), so no support for latest languages such as PowerShell, or they were using the latest version but the instructions didn't work 100%.The following article worked for me:

Wednesday, June 09, 2010

Checking the type and size of RAM with Windows PowerShell

I subscribe to the PowerTip of the day email of PowerShell.com and I got this tip today. If you want to know the type and size of RAM your PC uses, and available banks, you can use the following script:

$memorytype = "Unknown", "Other", "DRAM", "Synchronous DRAM", "Cache DRAM",
"EDO", "EDRAM", "VRAM", "SRAM", "RAM", "ROM", "Flash", "EEPROM", "FEPROM",
"EPROM", "CDRAM", "3DRAM", "SDRAM", "SGRAM", "RDRAM", "DDR", "DDR-2"
$formfactor = "Unknown", "Other", "SIP", "DIP", "ZIP", "SOJ", "Proprietary",
"SIMM", "DIMM", "TSOP", "PGA", "RIMM", "SODIMM", "SRIMM", "SMD", "SSMP",
"QFP", "TQFP", "SOIC", "LCC", "PLCC", "BGA", "FPBGA", "LGA"
$col1 = @{Name='Size (GB)'; Expression={ $_.Capacity/1GB } }
$col2 = @{Name='Form Factor'; Expression={$formfactor[$_.FormFactor]} }
$col3 = @{Name='Memory Type'; Expression={ $memorytype[$_.MemoryType] } }

Get-WmiObject Win32_PhysicalMemory | Select-Object BankLabel, $col1, $col2, $col3


The output would be something like:

BankLabel                     Size (GB) Form Factor         Memory Type
---------                     --------- -----------         -----------
                                      2 DIMM                DDR-2
                                      2 DIMM                DDR-2
                                      2 DIMM                DDR-2
                                      2 DIMM                DDR-2

It works pretty nice, doesn't it?

Spring Boot Configuration Properties Localization

Spring Boot allows to externalize application configuration by using properties files or YAML files. Spring Profiles  provide a way to segr...