Repeater DataBinder.Eval “Conditional” Expression

In VB.NET there is a useful IIF statement that let’s you do inline evaluations of expressions via conditional coding… but in C#, let’s just say it is “done differently”… a really useful difference to bare in mind is that those expressions CAN be evaluating using Ternary operators, such as:

< %# Convert.ToDateTime(DataBinder.Eval(Container.DataItem, “DateAdded”)) >= DateTime.Now.AddDays(-30) ? “Add something here” : “Else Add somethign here.”% >

Hope that helps someone other then myself… :)

SPQuery not executing the query and returning all results

Let me guess… you’re usig the U2U CAML Query builder… if thats the case don’t forget to remove your “Query” tags… the SPQuery object doesn’t like that!  :)

Sharepoint Designer Web Cache

Sometimes in Sharepoint Designer I noticed that some files were showing “checked out” even though they were not!

Oh how that drove me crazy!

It’s actually a local web cache issue that caused this, and this fella wrote a small script that you can run every now and then that can clear it out… throw this in a bat file and run it at your pleasure:

cd "%APPDATA%\Microsoft\Web Server Extensions\Cache"
del *.web /S /Q "%APPDATA%\Microsoft\Web Server Extensions\Cache"
cd "%USERPROFILE%\AppData\Local\Microsoft\WebsiteCache\"
rmdir /S /Q "%USERPROFILE%\AppData\Local\Microsoft\WebsiteCache\."
mkdir "%USERPROFILE%\AppData\Local\Microsoft\WebsiteCache"
dir "%APPDATA%\Microsoft\Web Server Extensions\Cache"
dir "%USERPROFILE%\AppData\Local\Microsoft\WebsiteCache"
pause

Run-As!

Found this really useful list of “Run-As” commands … If you’re like me, you appreciate a nice “Short Cut” here and there to get things done faster!

To Access… Run Command
Accessibility Controls access.cpl
Accessibility Wizard accwiz
Add Hardware Wizard hdwwiz.cpl
Add/Remove Programs appwiz.cpl
Administrative Tools control admintools
Adobe Acrobat (if installed) acrobat
Adobe Designer (if installed) formdesigner
Adobe Distiller (if installed) acrodist
Adobe ImageReady (if installed) imageready
Adobe Photoshop (if installed) photoshop
Automatic Updates wuaucpl.cpl
Bluetooth Transfer Wizard fsquirt
Calculator calc
Certificate Manager certmgr.msc
Character Map charmap
Check Disk Utility chkdsk
Clipboard Viewer clipbrd
Command Prompt cmd
Component Services dcomcnfg
Computer Management compmgmt.msc
Control Panel control
Date and Time Properties timedate.cpl
DDE Shares ddeshare
Device Manager devmgmt.msc
Direct X Control Panel (if installed)* directx.cpl
Direct X Troubleshooter dxdiag
Disk Cleanup Utility cleanmgr
Disk Defragment dfrg.msc
Disk Management diskmgmt.msc
Disk Partition Manager diskpart
Display Properties control desktop
Display Properties desk.cpl
Display Properties (w/Appearance Tab Preselected) control color
Dr. Watson System Troubleshooting Utility drwtsn32
Driver Verifier Utility verifier
Event Viewer eventvwr.msc
Files and Settings Transfer Tool migwiz
File Signature Verification Tool sigverif
Findfast findfast.cpl
Firefox (if installed) firefox
Folders Properties folders
Fonts control fonts
Fonts Folder fonts
Free Cell Card Game freecell
Game Controllers joy.cpl
Group Policy Editor (XP Prof) gpedit.msc
Hearts Card Game mshearts
Help and Support helpctr
HyperTerminal hypertrm
Iexpress Wizard iexpress
Indexing Service ciadv.msc
Internet Connection Wizard icwconn1
Internet Explorer iexplore
Internet Properties inetcpl.cpl
Internet Setup Wizard inetwiz
IP Configuration (Display Connection Configuration) ipconfig /all
IP Configuration (Display DNS Cache Contents) ipconfig /displaydns
IP Configuration (Delete DNS Cache Contents) ipconfig /flushdns
IP Configuration (Release All Connections) ipconfig /release
IP Configuration (Renew All Connections) ipconfig /renew
IP Configuration (Refreshes DHCP & Re-Registers DNS) ipconfig /registerdns
IP Configuration (Display DHCP Class ID) ipconfig /showclassid
IP Configuration (Modifies DHCP Class ID) ipconfig /setclassid
Java Control Panel (if installed) jpicpl32.cpl
Java Control Panel (if installed) javaws
Keyboard Properties control keyboard
Local Security Settings secpol.msc
Local Users and Groups lusrmgr.msc
Logs You Out Of Windows logoff
Malicious Software Removal Tool mrt
Microsoft Access (if installed) msaccess
Microsoft Chat winchat
Microsoft Excel (if installed) excel
Microsoft Frontpage (if installed) frontpg
Microsoft Movie Maker moviemk
Microsoft Paint mspaint
Microsoft Powerpoint (if installed) powerpnt
Microsoft Word (if installed) winword
Microsoft Syncronization Tool mobsync
Minesweeper Game winmine
Mouse Properties control mouse
Mouse Properties main.cpl
Nero (if installed) nero
Netmeeting conf
Network Connections control netconnections
Network Connections ncpa.cpl
Network Setup Wizard netsetup.cpl
Notepad notepad
Nview Desktop Manager (if installed) nvtuicpl.cpl
Object Packager packager
ODBC Data Source Administrator odbccp32.cpl
On Screen Keyboard osk
Opens AC3 Filter (if installed) ac3filter.cpl
Outlook Express msimn
Paint pbrush
Password Properties password.cpl
Performance Monitor perfmon.msc
Performance Monitor perfmon
Phone and Modem Options telephon.cpl
Phone Dialer dialer
Pinball Game pinball
Power Configuration powercfg.cpl
Printers and Faxes control printers
Printers Folder printers
Private Character Editor eudcedit
Quicktime (If Installed) QuickTime.cpl
Quicktime Player (if installed) quicktimeplayer
Real Player (if installed) realplay
Regional Settings intl.cpl
Registry Editor regedit
Registry Editor regedit32
Remote Access Phonebook rasphone
Remote Desktop mstsc
Removable Storage ntmsmgr.msc
Removable Storage Operator Requests ntmsoprq.msc
Resultant Set of Policy (XP Prof) rsop.msc
Scanners and Cameras sticpl.cpl
Scheduled Tasks control schedtasks
Security Center wscui.cpl
Services services.msc
Shared Folders fsmgmt.msc
Shuts Down Windows shutdown
Sounds and Audio mmsys.cpl
Spider Solitare Card Game spider
SQL Client Configuration cliconfg
System Configuration Editor sysedit
System Configuration Utility msconfig
System File Checker Utility (Scan Immediately) sfc /scannow
System File Checker Utility (Scan Once At The Next Boot) sfc /scanonce
System File Checker Utility (Scan On Every Boot) sfc /scanboot
System File Checker Utility (Return Scan Setting To Default) sfc /revert
System File Checker Utility (Purge File Cache) sfc /purgecache
System File Checker Utility (Sets Cache Size to size x) sfc /cachesize=x
System Information msinfo32
System Properties sysdm.cpl
Task Manager taskmgr
TCP Tester tcptest
Telnet Client telnet
Tweak UI (if installed) tweakui
User Account Management nusrmgr.cpl
Utility Manager utilman
Windows Address Book wab
Windows Address Book Import Utility wabmig
Windows Backup Utility (if installed) ntbackup
Windows Explorer explorer
Windows Firewall firewall.cpl
Windows Magnifier magnify
Windows Management Infrastructure wmimgmt.msc
Windows Media Player wmplayer
Windows Messenger msmsgs
Windows Picture Import Wizard (need camera connected) wiaacmgr
Windows System Security Tool syskey
Windows Update Launches wupdmgr
Windows Version (to show which version of windows) winver
Windows XP Tour Wizard tourstart
Wordpad write

Sharepoint Memory Considerations

A recent lesson learned in regards to Sharepoint infrastructure.  There is only so far a 32 bit OS, with 4 GB’s of ram can go.  Let’s take a deeper look as to why.

Sharepoint utilizes virtual memory to run.   On a 32 bit OS, remember that any given application can only run in a single 4 GB memory space.  Steve Sheppard (works on Sharepoint at Microsoft) had a nice white paper (and blog post) talking about how this limit can affect your Sharepoint environment.  The bottom line, if you start experiencing traffic on the rise, be watchful… you could run out of virtual memory and start locking worker processes (the process that utilized by IIS’s Application Pools), and can even crash them.  Obviously that means downtime for your end user (yuck).

In that same blog post he mentions that you can also setup a series of SIMPLE (and highly effective) performance counters (basic Windows 2000/2003) on the server and gauge how close you are to this sort of a scenario.  What I ended up doing was I setup two counter logs (because the scales are so different) with the following counters:

Performance Counter One:

  • % Usage (Paging File)
    Obviously how badly your paging file (virutal memory) is being taxed… a great indication in this regards.
  • Requests Current (ASP.NET)
    The current number of requests, including those that are queued, currently executing, or waiting to be written to the client.  Under the ASP.NET process model, when this counter exceeds the requestQueueLimit defined in the processModel configuration section, ASP.NET will begin rejecting requests.
  • Requests Queued (ASP.NET)
    The number of requests waiting to be processed.   
  • Request Execution Time (ASP.NET)
    The number of milliseconds that it took to execute the most recent request

Performance Counter Two:

  • Working Set (Process)
    It shows how much RAM is required so that the actively used virtual memory for all processes is in RAM.
  • Pages Output/Sec (Memory)
    This shows how many virtual memory pages were written to the pagefile to free RAM page frames for other purposes each second.  This is the best counter to monitor if you suspect that paging is your performance bottleneck
  • Pool Nonpaged Bytes (Memory)
    This measures the size, in bytes, of the non-paged pool. This is an area of system memory for objects that cannot be written to disk but instead must remain in physical memory as long as they are allocated. There is a possible memory leak if the value is greater than 175MB (or 100MB with the /3GB switch). A typical Event ID 2019 is recorded in the system event log.
  • Pool Paged Bytes (Memory)
    This measures the size, in bytes, of the paged pool. This is an area of system memory used for objects that can be written to disk when they are not being used. There may be a memory leak if this value is greater than 250MB (or 170MB with the /3GB switch). A typical Event ID 2020 is recorded in the system event log.
  • System Code Total Bytes  (Memory)
  • Virtual Bytes (Process)
    Indicates the current size (in bytes) of the allocated (reserved and committed) virtual memory.
  • Thread Count (Process)
    Shows the number of threads currently active in the current process.

The one that you want to keep an eye on the most to springboard into the information that the other counters shows, is the REQUESTS CURRENT.  That will be your first indication of usage traffic.  Consider the following diagram:

Notice how immediately you notice a steep increase in activity… for a typical 32 bit OS with 4 GBs of RAM, this is pretty much bringing the server to a crawl and is nearly about to crash.   In this scenario, if you look at mainly the Working Set, and Private Bytes you should notice a spike in those as well that coorelate with the Requests Current.  All the other stats can help you narrow down things in a general sense and then go from there.

Make the switch to 64 bit Sharepoint as soon as possible.

The true bottom line, you can really solve alot of your major problems of this nature by simply getting off your 32 bit system, and onto 64 bit.  You might as well since it’s only a matter of time before everything is anyway.  But just a simple illustration of it’s benefits (credit goes to my co-worker Jason on this one, it’s about the simplest way I have heard so far to explain it), if you punch in your (scientific) calculator 2^32 you will notice that a 32 bit system is only capable of 4.2 billion unique locations (or 4 GB’s of memory hehe) that it can utilize for memory management.  But if you type 2^64 you will notice the phenominal increase of 1 Terabyte (at least as of Windows Server 2003)!  Man, now that is something crazy.

Anyway… this is just a super simple suggestion on how to begin your own troubleshooting, but perhaps this gives you a nice entry point into similiar issues you might be encountering in regards to memory managment with Sharepoint.  I highly suggest Steve Sheppard’s very helpful article on this subject which goes into both the Virtual and Physical implications of your current server configuration.

References: