Silverlight 4 Assembly Caching for Project References - silverlight

I have several Silverlight utility and control projects that I re-use in several different applications with-in my web application. These are all worked on in the same solution. Each Silverlight application has it's own page.
Example Setup
Utilities
CommonResources
I've strong name keyed and created extmap for these projects, but the dll's are still in the xaps. The version is defnied as 1.0.0.0 in the assembly.cs.
CommonResources
1.0.0.0
{public key here}
Silverlight.Common.CommonResources.dll
These all reference Utilities and CommonResources
- ManageFoo
- ManageBar
- etc
Can I assembly cache the utilities and CommonResources dll?

You may try adding an XML file (e.g. named Common.CommonResources.extmap.xml) to the CommonResources project, and set “Copy to Output Directory” to “Copy if newer”, with the following content:
<?xml version="1.0"?>
<manifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<assembly>
<name>Common.CommonResources</name>
<version>*.*.*.*</version>
<publickeytoken>*</publickeytoken>
<relpath>Common.CommonResources.dll</relpath>
<extension downloadUri="Common.CommonResources.zip" />
</assembly>
</manifest>

I don't see why you couldn't in this scenario. In fact it seems to be the ideal candidate.
You'll need to make sure you generate extmap files for your Utilities and CommonResources dlls. The file looks like this:
<?xml version="1.0"?>
<manifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<assembly>
<name>System.Windows.Controls.Data.DataForm.Toolkit</name>
<version>2.0.5.0</version>
<publickeytoken>31bf3856ad364e35</publickeytoken>
<relpath>System.Windows.Controls.Data.DataForm.Toolkit.dll</relpath>
<extension downloadUri="System.Windows.Controls.Data.DataForm.Toolkit.zip" />
</assembly>
</manifest>
and has the name of the form:
<dllname>.extmap.dll
and must be in the same location as the dll itself.

Related

Trying to Programmatically Expire the HTTP Response Headers

Our Team is building a C# project with a Silverlight module. We deploy to a Windows 2008 with IIS 7. I’m trying to Programmatically Expire the HTTP Response Headers Associated with a Folder called ClientBin immediately. I know how to do it manually through IIS Manager. ( Basically, I go to the HTTP Response Headers Section of the folder or file that is of interest, and then I use "Set Common Headers...." to expire immediately.) However, we will be Redeploying to IIS a number of times, and I want to ensure that it is programmatically done because it’s a headache to keep Reconfiguring all the time.
Should I do it from the C# code of my project or is it better practice to do it using WMI scripting?
#kev and #jeff-cuscutis have provided the ways to configure expiration of the HTTP Response Headers using XML configuration in the web.config file of a ASP.NET application
How to configure static content cache per folder and extension in IIS7?
ou can set specific cache-headers for a whole folder in either your root web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- Note the use of the 'location' tag to specify which
folder this applies to-->
<location path="images">
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="00:00:15" />
</staticContent>
</system.webServer>
</location>
</configuration>
Or you can specify these in a web.config file in the content folder:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="00:00:15" />
</staticContent>
</system.webServer>
</configuration>
I'm not aware of a built in mechanism to target specific file types.
You can do it on a per file basis. Use the path attribute to include the filename
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<location path="YourFileNameHere.xml">
<system.webServer>
<staticContent>
<clientCache cacheControlMode="DisableCache" />
</staticContent>
</system.webServer>
</location>
</configuration>

Micsoroft Enterprise Validation framework -> How to have one config file per validated Type

I am using microsoft enterprise validation framework. And I'm linking the file 'validation.config' in my app.config file.
<section name="validation" type="Microsoft.Practices.EnterpriseLibrary.Validation.Configuration.ValidationSettings, Microsoft.Practices.EnterpriseLibrary.Validation, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
allowLocation="true" allowDefinition="MachineToApplication" restartOnExternalChanges="false" />
<validation configSource="LocalConfiguration\validation.config" />
In 'validation.config' file i have
<?xml version="1.0" encoding="utf-8" ?>
<validation>
<type name="Car">
<ruleset>
<properties>
<validators>...</validators>
</properties>
</ruleset>
</type>
<type name="Human">
<ruleset>
<properties>
<validators>...</validators>
</properties>
</ruleset>
</type>
</validation>
The question is: Can i put the 'Car' and 'Human' types in different files and link those files in validation.config or is there any other way of separation because my validators are too many and I want it to be clean and easy to read.
#.NETJunkie has a blog post on Splitting up Validation Application Block configuration into multiple files which should address your needs.

Wicket encoding issue on Google App Engine

I am a google app engine newbie.
I have an encoding issue with a wicket application in GAE.
(see http://ristorante-lastoria.appspot.com/wicket/home )
My IDE is configured to save the HTML template files in UTF-8.
I ve printed out the default file.encoding used by GAE JVM and it's ASCII.
I 've tried to set the following parameters in the appengine-web.xml.
<system-properties>
<property name="file.encoding" value="UTF-8" />
</system-properties>
<env-variables>
<env-var name="DEFAULT_ENCODING" value="UTF-8" />
<env-var name="APP_ENCODING" value="UTF-8" />
</env-variables>
I ve tried to set the flag --compile-encoding=UTF-8 when uploading the war content to the server.
At the build level(using maven), I tried to escape the unicode characters in the build using the native2ascii tool.
No luck so far :-(
Wicket version: 1.4.17
TIA
Add a xml declaration wirh encoding to all your templates:
<?xml version="1.0" encoding="UTF-8" ?>

How can I place multiple project dlls in the same Assembly Cache zip for Silverlight?

I'm using the very helpful MvvmLight toolkit and want to package both dlls into a single zip with Assembly Caching turned on. I tried to set the for both the main and the Extras.dll, but the app can no find the Extras dll in the zip. Is this possible to do with Silverlight?
EDIT: I'm using Assembly Caching so that the toolkit (and other dlls) are not in the XAP. Then the user will only need to download these one time, instead of once for every Silverlight app. We have a ASP.NET app with several different pages exposing different Silverlight apps.
I've found that I can use the same zip file in each extmap file now. I'm not sure if I did it wrong before or what...
<?xml version="1.0"?>
<manifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<assembly>
<name>GalaSoft.MvvmLight.Extras.SL4</name>
<version>3.0.0.30106</version>
<publickeytoken>918f02b0f4b4b116</publickeytoken>
<relpath>GalaSoft.MvvmLight.SL4.Extras.dll</relpath>
<extension downloadUri="GalaSoft.MvvmLight.SL4.zip" />
</assembly>
</manifest>
<?xml version="1.0"?>
<manifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<assembly>
<name>GalaSoft.MvvmLight.SL4</name>
<version>3.0.0.30106</version>
<publickeytoken>918f02b0f4b4b116</publickeytoken>
<relpath>GalaSoft.MvvmLight.SL4.dll</relpath>
<extension downloadUri="GalaSoft.MvvmLight.SL4.zip" />
</assembly>
</manifest>

From Netbeans Dev to Tomcat Production: DB Connection Not Found

I developed a Java web application in Netbeans 6.5 using a MySQL database and Hibernate. Both the development database server and development application server (Tomcat 6) reside on my development machine. Everything works; the application pulls data from the database correctly.
Now, I'm ready to move it to the production server. Again, the DB server and app server are on the same machine. I deploy the WAR file and try to access the application; I can access the static pages but the Servlets that use the database error out with the exception:
org.hibernate.exception.JDBCConnectionException: Cannot open connection
I'm pretty sure the problem relates to Tomcat not knowing about the data source. It seems as if Netbeans handles this for me. I've read that I might need to add a RESOURCE entry so I took some advice from this site which gave me a context.xml of:
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/EmployeeDirectory">
<Resource
name="jdbc/employeedirectory" auth="Container"
type="javax.sql.DataSource" username="EmployeeDir"
password="EmployeeDirectory" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://127.0.0.1:3306/EmployeeDirectory?autoReconnect=true"
maxActive="15" maxIdle="7"
validationQuery="Select 1" />
</Context>
a web.xml of:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!-- Omit Servlet Info -->
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/employeedirectory</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
and a hibernate.cfg.xml of:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.datasource">java:comp/env/jdbc/employeedirectory</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- Omit other Mappings -->
<mapping class="EmployeeDirectory.data.PhoneNumber" resource="EmployeeDirectory/data/PhoneNumber.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Now, I get a org.hibernate.HibernateException: Could not find datasource error.
Am I on the right path for moving from development to production? What am I missing?
I think you are on the right track. I would first set up the datasource and verify it out side of hibernate. Here is a good article on that: http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.htm and some examples here: http://www.mbaworld.com/docs/jndi-datasource-examples-howto.html
Then, I would configure hibernate to use the datsource. From looking at your hibernate.cfg.xml file I think you should try changing hibernate.connection.datasource to jdbc/employeedirectory
the jndi datasource should be defined in /tomcat/server.xml see Tomcat JNDI Datasource how-to and not in webapp/context.xml
Tomcat 6 requires that you add the resource tag to the context.xml, not the server.xml. You could in Tomcat 5.x. I have it working fine in a separate install of Tomcat, but I'm still trying to use connection pooling inside NB 6.5.
That same Apache site has a link to the Tomcat 6 version of JNDI and it tells you to add the resource tag to the context.xml.

Resources