Umbraco Imagegen.ashx and keeping images in another folder - image

I have an umbraco installation that uses imagegen.ashx.
I would like to deploy it using octopus deploy, this is pretty simpel and is already working.
My problem is that octopus deploys to a new folder (with a version number) each time, which imposes a problem with the media folder, since it can be changed in every folder.
I have made a shared folder at the same level as the versions, and I have made a virtual directory in IIS.
If I access the files directly through a browser - they exist and everything is fine.
But if I use imagegen.ashx it does not work, I have tried setting the imagebasedir property like so:
<Class Name="default" OverridesQueryString="true">
<AllowUpsizing>false</AllowUpsizing>
<MaxHeight>800</MaxHeight>
<MaxWidth>800</MaxWidth>
<ImageBaseDir>D:\Octopus\Applications\customer Test\customer\Shared\ </ImageBaseDir>
</Class>
What am i doing wrong?

ImageBaseDir is unlikely to expect a server mapped path.
The imagegen documentation shows examples that are either relative to the site, or from a fully-qualified url from another site.
Mapping to a path outside of your webroot will likely cause permissions issues for a number of reasons i wont get into here...though i see that you have set up the Media folder as a virtual directory. Good start, however it appears that you're mapping to the d:\ drive instead of the virtual directory you set-up (Presumably this is /Media ?).
You may also look into how the imagegen "Cached" folders are respected by your Octopus set-up. If the imagegen generated images/files get munged, that's a no-good-situation that could leave you with the appearance of missing images:
/(media-virtual-directory)/99999/Cached/index.xml could state that the generated image is # "df1rt0lr.png" -but if that got removed in the deploy process you'll see the missing image behaviour.
Have you used the AltImage property to specify a fallback to a known, always available image? This will help tell if imagegen is throwing errors before outputting your expected result.
I don't believe it's an imagegen issue however, it's a pretty mature product and it's well put together as well being well documented. I would look at using a relative path for ImageBaseDir - or better yet, not using this attribute at all but rather just having your /Media folder being in a constant location as your virtual directory.

Related

Directory location for writing cache file

Hi I am trying to find out what is the best location to save a cache file.
I have an Windows form application that updates user's data from the server using a custom tool.
I want to write the timestamp of the latest updates done on user's machine in the cache file.
Where is the best location for keeping this file:
1. in application directory (c:\program files..)
2. in a temp location e.g. Users profile folder or c:\windows\temp
3. in any location (e.g. c:\dataupdates) where user has full access to read/write to.
Not in the application directory. That much is clear. :) The application directory shouldn't even be writable by the program (or actually by the user account that runs the program). Although some applications still use this location, it has actually been deprecated since Windows 95, I believe, and it has become a real pain since the more rigid UAC applied in Windows Vista and 7.
So the most obvious options are:
The temp folder, which is for temporary files. Note however, that you will need to clean those files up. Temp folder is not automatically cleared by default, so adding new files all the time will consume increasingly much space on the hard drive. On the other hand, some users do clear their temp folders, or may have scripts installed that do that for them, so you cannot trust such files to remain. Also, this is not always C:\Temp of whatever. You'll have to ask Windows what the location is.
You can pick 'any' location. Note that you cannot write anywhere. You cannot even expect the C drive to exist. If you choose this, then you have to make it a configurable setting.
The %app data% directory, my personal favorite, which is a special directory for applications to store their data in. The advantage is, that you can ask Windows for this location, and you can make up a relative path based on that directory, so you don't really have to make it an application setting. For more info on how to get it, see also this question: C# getting the path of %AppData%
I would definitely choose the App Data path for this purpose.

Mac OS X - How to store web projects in a location other than /Library

Google turns up nothing but very basic set up of web servers on the Mac. I've got that.
I build web projects locally on a Mac using PHP/MySQL. I store the sites in /Library/WebServer/Documents then access them via browsers with http://localhost.
This works fine.
What I would like to do is to be able to place symlinks or aliases of projects into the /WebServer/Documents folder and access sites on other (local) drives. I don't want to have to store everything in the Library folder. However, it seems that symlinks don't work. The only way a project functions is if all it's files are located in the /Library folder - no symlinks.
I realize I can change the root path for the web server in the http.conf file but I don't want to actually change the server path, I merely want to use symlinks if possible. I also realize I could use something like MAMP, but things run fine with my traditional set up (and I prefer to avoid MAMP since it's not always real-world). Main motivation here is that I don't want to store files on the boot volume, where there Library folder is located.
Can I use symlinks for directories with Mac OS10.6.8/Apache? if so how, please?
Thanks!
Solved via this article at Apple:
http://support.apple.com/kb/TA21182?viewlocale=en_US
One must specifically create a symbolic link. Which, it appears, is not the same as an Alias on the Mac OS.
But this isn't feature of MAMP application, this is about web server. Make it through MAMP and go see what is new in apache config files (httpd.conf, vhost.conf).
you have to use symlinks instead of an alias... sad there is no ui for that!
you have to go into the Terminal and type:
ln -s /ORIGINALPATH /LINKEDPATH
the first PATH is the base path of the original file and the second is for the base path for the symlink of the file/folder etc

External Methods for Plone/Zope

I have two instances of Plone running on a server - their locations are /usr/local/Plone/Inst1 and /usr/local/Plone/Inst2. I'm trying to setup external methods, but am having a difficult time figuring out where my "Extensions" folder should be placed. It seems that where ever I place it, the ZMI never sees it. I have tried:
/usr/local/Plone/Extensions
/usr/local/Plone/Inst1/Extensions
...and various other sub-folders within the "Inst1" directory. When I add an external method, I've tried adding it at both the root of the ZMI ("/") and in the Instance folder ("/Inst1/"). When I add it to the root, I get a message that says "The specified module, demo, could not be found." When I try to add it in the instance folder, I get an error page that says "This page does not seem to exist..."
It appears that the ZMI is failing to find that file ("demo.py"). Is there a particular place it should be stored?
After looking over documentation from Zope's site (and numerous tutorials), it should be in the "Zope" folder - but I don't have any such folder (nor does any folder named "Extensions" exist on the file system, other than the one I created in the "Plone" and "Plone/Inst1" directories).
Depending on what version of Plone you have installed will change this, but it is likely something like:
/path/to/plone/install/parts/instance/Extensions
Or
/path/to/plone/install/parts/client1/Extensions
You're probably better off putting the external method in a product though since placing an external method in it's "parts" instance folder will mean it will be wiped out every time you run buildout. Then if you're going to make a product out of it, you might as will do a traversable view utility like "##plone_context_state" and "##plone_portal_state" which is usually a better way to do it.

Is there a way in Visual Studio 2010 to have code/project/folder structure mapped from TFS to mutiple machines?

I am currently working on several applications and in n some of these apps the solutions contain projects from multiple work spaces in Visual Studio 2010.
This causes an issue when others attempt to work on the code for a certain application or simply download the code and run the app. I have my work spaces for my computer defined, but others do not.
What I want to do is have a way to set up a work space or sort of work space template where anyone can download the code from the server, while on any machine and with the required folder structure, and the application will run.
For instance, if I had the following server structure:
$/
$/SolutionFiles/
$/SubFolder1/
$/SubFolder1/ProjectA/
$/SubFolder1/ProjectB/
$/SubFolder2/
$/SubFolder2/Project1/
$/SubFolder2/Project2/
...and I had a solution $/SolutionFiles/MyAppSolution that contains code from $/SubFolder/ProjectA/ and $/SubFolder2/Project1/, I want to have a separate workspace or something, possibly named "MyAppSolution_Workspace" or something like that, that will map the solution folder and the related project folders to a generic path. This would need to work and be accessible from all other separate computers and would need to keep the same directory structure from the server and have the same folder names and everything as is expected by the solution/project files.
From what it looks like Shared work spaces in VS2010 would work, but it seems to only apply to one machine and is not entirely generic.
Are there any suggestions for how to accomplish this?
You probably won't like this answer but here is what we do:
Keep your workspace mapping as simple as possible. Never move folders or rename folders or files using the workspace mapping. Then all users need to do is map from the top and everything works. They may get more files than they want but it will work.
Advanced users can use the folder cloaking ability to block getting folders they aren't interested in or can map just the folders they want. The key being that when they map specific folders instead of the root they leave the paths the same as they would be if the root was mapped.
In our system we then have our version and release branching structure above the folders of your example. So everything you've listed would be duplicated inside a MAIN folder and inside a Release_1 folder.

GetOpenFilename api call in Windows 7 won't allow direct access to My Documents

In many of my Access (2002) programs I use the GetOpenFileNameA and GetSaveFileNameA functions from comdlg32.dll. I often set the initial directory to the user's My Documents folder (using calls to SHGetSpecialFolderLocation and SHGetPathFromIDListA from shell32). This all works fine under Windows XP.
However, I recently switched to Windows 7 as my development environment and have been getting the following error message:
You can’t open this location using
this program. Please try a different
location.
The function I use to get the My Documents location is returning the correct folder. However, even if I hard code that directory location into the GetOpenFileNameA call, I still get the error.
I came across this post: http://social.msdn.microsoft.com/Forums/en-US/windowsuidevelopment/thread/3391f1dd-25b0-4102-9d5c-58309cc72c9d but, even adapting it to work with Access instead of Excel, I had no luck.
EDIT: Suddenly this is no longer a problem for me. I suspect a windows update went out addressing this issue. Does anyone know if that's true or not?
EDIT: It turns out this is still a problem. Also, in case it helps in the troubleshooting I have found that I get this error message for any of the special folder locations (My Music, My Documents, etc). Also, if I change the location of the My Music folder to, say, C:\Test then I get this message when I try to open the folder C:\Test, while the folder C:\Users\Mike\Music (the original My Music location) opens without a hitch.
Windows 7 adds the concept of a "library", which is basically a virtual folder that includes the contents of at least two actual subdirectories. One place it uses the library is the "My Documents" folder, which (at least by default) is a library that includes both the user's documents directory ("c:\users\whoever\documents") and the public documents directory (C:\users\public\documents").
As such, the basic approach you're using simply can't work -- there is no path that denotes the Documents folder. The documents folder needs to be specified by a PIDL, not a path.
Edit: It's not clear what's going on if you can't open C:\users\user\Documents. A quick test in C++ works fine using code like:
OPENFILENAME data = {0};
wchar_t filename[256] = {0};
data.lpstrInitialDir = L"C:\\users\\jerry\\documents";
data.lStructSize = sizeof(data);
data.lpstrFile = filename;
data.nMaxFile = sizeof(filename);
GetOpenFileName(&data);
OTOH, there's no real need to specify the initial path -- the Documents folder is the default anyway.
The link I posted in my original question (http://social.msdn.microsoft.com/Forums/en-US/windowsuidevelopment/thread/3391f1dd-25b0-4102-9d5c-58309cc72c9d) held the answer after all. I'll summarize things here. To fix this behavior, you need to do away with the STRIPFOLDERBIT flag in the shell compatibility registry entry for all affected programs.
Keep in mind (and this is what tripped me up for so long) that 32-bit programs have entries in a special registry section if you have 64-bit windows. Here's the quick and dirty:
Rename STRIPFOLDERBIT to xSTRIPFOLDERBIT for the following keys (as applicable):
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ShellCompatibility\Applications\excel.exe
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ShellCompatibility\Applications\msaccess.exe
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\ShellCompatibility\Applications\excel.exe
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\ShellCompatibility\Applications\msaccess.exe

Resources