IIS 7, Silverlight Pivot: Handler "CXML" has a bad module "ManagedPipelineHandler" in its module list

This is a problem that one keeps running into if one gets to install projects with Silverlight Pivot often enough that you remember the problems, yet not often enough to remember the solutions.

This is how I solved the problem

Set up Application pool settings correctly
* I had to go to Application Pools, find the site pool, and double click it.
* Change .NET version to v4.0
* Make sure that Managed pipeline mode is set to Integrated

Register .NET

* %windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i

http://forums.silverlight.net/t/189941.aspx/1

Bash, Cygwin: Remember the CRLF

This morning I wrote a bash script to find redundant accounts from a database. Writing the actual script was easy, but I ran into a problem with my environment. You see, I use windows. So the text files created in windows have that pesky CRLF line endings. So, whenever I attempted to execute a query to mysql, I would get an error saying that there was no such database.

Since I had ran into a new line problem two days ago, I decided to switch the script format to unix. I did this by doing


:e ++ff=unix
:w

The script worked after that. Bash and mysql wanted to interpret \r. It obviously didn't know what to do, so it would break afterwards.

Windows batch: automating start of day

I read someone on twitter stating that their resolution was to automate repetitive tasks. This is not my resolution, but I thought it was an excellent idea.

One task that I do every time I turn on the computer is opening 4 essential programs. This takes a few minutes. It is boring. I need to open IE, Fireforx, pidgin, and skype. I have task buttons for IE and Fireforx, and Pigdin can be found on the top of my start menu. Skype will rise and fall depending on how recent the last update was. The last two are the reason why the process can delay a bit.

So I wrote this simple batch file to open them all. The script switches to the directory of the program and starts it in the background. In bash we would use & to push the process to the background; in windows it is using the command "start". Then I created a shortcut that I dropped on the desktop. And I was finished.

Now the whole process takes around 30 seconds with a single double click.

set originalPath= %CD%
 
cd "C:\Program Files\Mozilla Firefox"
start firefox.exe
 
cd "C:\Program Files\Internet Explorer\"
start iexplore.exe
 
cd"C:\Program Files\Pidgin"
start pidgin.exe
 
cd "C:\Program Files\Skype\Phone"
start skype.exe
 
cd %originalPath%
echo End of Script

Ruby: Automating service start up in windows

In my windows 7 machine, I have a lot of services that I keep turned off. I turn them on only when I actually needed them. This keeps my computer working better than if I had all of the services running at the same time.

So every time that I need to turn them on, I have to manually go to the Services control and start each service. Pursuing the goal of attempting to automate as many repetitive tasks as possible, I wrote this small ruby script that, when one runs it as administrator (windowsese for sudo), it will start both of them up with one action and less time.

services = ['Apache2.2', 'MySQL']
 
services.each do |service|
 command = "net start #{service}"
 system command
end

CSS two column layout

The solution:

A container includes a left and right div with floats to the right and to the left. To clear the floats, add overflow:auto; to the container.

.container 
{
    width: 100%;
    position: relative;
    overflow: auto;
}
 
.nav-left 
{
    float: left;
    width: 18%;
    padding-left: 5px;
}
 
.content 
{
    float: right;
    width: 80%;
    position: relative;
    padding-right: 5px;
}

I first found a solution that used percentage widths instead of fixed widths
http://matthewjamestaylor.com/blog/perfect-2-column-left-menu.htm

Then I found a solution for clearing the floats
http://www.quirksmode.org/css/clearing.html

Rant:

There is a reason why so many people use tables for layout: CSS column layout is a failure. It is ridiculously complex. I have learned the CSS to get two columns over and over. Since I am not a designer, I keep forgetting these kinds of css tricks, so every so often I have to learn them again (the reason why I am writing this entry.)

Now, using tables for layout is easy. Semantically it is wrong, but for practical use it is so easy that it is hard to believe that there would be more than one or two tutorials teaching you how to do that. In fact, for many, just telling them "create a layout using a table!" would be enough of a tutorial to get a new web designer pushed in the right direction. CSS column layouts, on the other hand, are abundant. Too abundant, in fact, for a problem that already had an easy solution with tables.

C# Updating an object with a dictionary<string, string> value

This is more of an exploratory entry than a solution to a problem. Today I wrote this code to handle updating a C# object from a Dictionary. If the object had a key, then it should update its value. I ran into trouble because the object had nullable values, and this tripped the Converter object. I tried a few times, but the clock was ticking away, so I had to find another solution.

At his point I remembered about UpdateModel(). If you are using .NET MVC, you don't need to use this. There is already the handy UpdateModel() function that will do this work for you. So if you have this problem in MVC, use UpdateModel().

At the end of the day, I came back to this problem because I knew that there was a solution, since UpdateModel() does the same function, and I wanted to know how it was done. So I attempted a number of solutions to how to convert a string to a nullable value. At some point I found the solution below in Stack Overflow:

     using System.ComponentModel;
 
    public partial class Memo
    {
        public void Update(Dictionary<string,string> collection)
        {
            var properties = TypeDescriptor.GetProperties(this);
 
                foreach (PropertyDescriptor property in properties)
                {
                    if (collection.Contains(property.Name))
                    {
                        var value = collection[property.Name];
                        property.SetValue(this, property.Converter.ConvertFromInvariantString(value));
                    }
                }
            }
 
        }
    }

The solution was the PropertyDescriptor and its converter. This worked. I should learn more about this object in the future.

Source:

On using PropertyDescriptorCollection
http://stackoverflow.com/questions/446522/how-to-set-nullable-type-via-r...

Drupal, Gmap: no markers showing on the map

Photobucket

Short answer: make sure that gmap_markers.js has Drupal.gmap.iconpath pointing to the right folder where the marker icons are.

The long story:
Recently a client had a problem with drupal's gmap module. The markers wouldn't show. If you carefully moved the pointer around the map you would see it changing to a hand. One could even click on it. But the markers themselves were invisible.

I found the following page: http://drupal.org/node/1071244 which gives you a troubleshooting checklist for gmap. One of its steps is to make sure that you have access to gmap_markers.js. When I went to that page, I found that this is a configuration file. I saw that the images were supposed to be in a folder given by Drupal.gmap.iconpath, so I navigated through the directories in the file system to see if the images were there. They were not.

So the problem was that the file was moved to a public area, as it is required for it to work, but the value of Drupal.gmap.iconpath was never changed. So gmap was not able to find it. Changing the value to the appropriate drupal path fixed the problem.

CapitalCampDC: High Performance Drupal Step by Step

Performance tweaking

There is a need for high performance drupal. Faster sites are more money. Faster sites get ranked higher by google. Vistors love fast sites. Mentioned in the media? What if the server goes down exactly then?

How to fail at Optimizing
1. Optimizing one part to death and neglecting the rest
2. Optimizing things without knowing where the pain is
3. Optimizing things with new methods without really understanding them
4. Optimizing things without testing it will hold the load

*pressflow / drupal 7
* APC
* MemCache
* Varnish and boost

Testing a site for Performance

* Safari / chrome / Firefox Developer Toolbar
* ab (apache benchmark)
* Load Testing test suits
* Devel module

Devel can save how long it takes to get pages.
If modules are a problem, enabling core

Pressflow if you want to do high performance drupal

APC
alternative PHP Cache
makes it much faster

MemCache
* You can store the cache into memory
* locking is important for drupal implementation
* It especially helps in logged in user

Boost
* it will create static html files

Varnish
* High performance concurrent reverse proxy
* delivers much faster than Apache
* works mostly only with anonymous pages

To set up the configuration
Set varnish to port 80
set apache to port 8080

Other stuff
imagecache_info
php slowness, HipHop

It is important to get yourself information.

varnish debug module -- being released today

enable boost and adding that configuration

planet and trollon.com the blog post with the information

CapitalCampDC: Cooking with content strategy

Content inventory
Deliverable (ingredients)

quantitative inventory
pdfs
videos

metadata and content responsibilities
and this becomes the content migration plan

Content purpose and objects

User persona

Strategy
Anotated wireframe

Content-type is metadata
Bullets are content types
Each item is metadata. It translates into fields.

Node-reference field: a way to nest it
node-list - a list of nodes

Content templates

content team and development team working together.

CapitalCampDC: Automatic security testing

Security Review module

vulnerable module: the vulnerable example module
Coder module
secure code review module

Security Review module.
It identifies the problems.
It gives you a description of what is wrong.
And a link to the manuals

You can also use drush

Hacked! project module
It may take a while

Revision control.
Use revision control to check whether a site has been hacked.

Secure Code Review module
static analysis of the code.
It uses a php tokenizer. It uses patterns.

Vuln.module

Browse around your site to see different popups

Drupal Scout Automated XSS

Scout Automated CSRF
dynamic code analysis
new tool

http://www.drupalscout.com

Syndicate content