serving using zinc and pharo - server

After working on zincs tutorial I want to serve an entire repo filled with .js, .html and .css files I created a firstpathsegment so that I upload all files to the sam place but then how to create a place to serve and store the files ? and how to upload them ?

If you read on in the tutorial, you'll find how to do that in the part 'Static file server'
(ZnServer startDefaultOn: 1701)
delegate: (ZnStaticFileServerDelegate new
directory: (FileDirectory on: '/var/www');
prefixFromString: 'static-files';
yourself).
If you compare that to the ZnMonticelloServerDelegate implementation, you'll see how to write files. If you want to be able to create subdirectories, take a look at FileSystem-Core-Public. In a public-facing site, you'll need to do something about authentication and access control. We mostly put an apache or nginx in front (and let that take care of the static files).

Related

Hugo deploy and delete not necessary files

I'm developing a new Hugo site and in this case I thought to create also a template so.I can use for future site.
Well in the template there are tons of vendor files and library because depending of the pages that the site will implement these library will be used. The problem is on the deploy. For example I use Line icons library that has a lot of .png files. (For example 200 files).
Well in the template I put all the files but could happen that in the site that implement this template I use only five icons. Is there a way that look around the final HTML and the usage of the icons and delete in the public folder the not necessary files?
Not directly.
You would need to add an utility script to your template, in order for any user implementing said template to be able to call this script on demand.
That script should then be able to:
analyze the HTML files generated in public_html
cleanup the icons accordingly

Meteor 1.4 - General approach to file system + /public activity

I've done some digging around and a lot of the threads regarding file system and how it works with Meteor seem to be pretty outdated, not to mention packages related to file storage/serving (i.e. CollectionFS). I was wondering if anyone here has deep experience with handling files in lieu of 1.4 or even 1.3 (I am currently on 1.4.1.1).
My questions are as follows:
Did Meteor 1.3/1.4 come with any changes regarding fs?
What is the general best approach to storing and serving static assets in light of Meteor 1.4?
I've seen many threads that say dynamically storing files to /public triggers a server upload, but I've tested this on local by manually copy/pasting a .png file into /public, and it only triggers a client refresh with the console message Client modified -- refreshing. Would this hold true for files added during runtime, and would it hold true in production?
Currently I am trying to stay clear from S3 or any other third party CDN's to keep a low budget, and also trying to stay clear from storing files into Mongo.
Thanks for any and all opinions!
What about setting up a shared folder or NFS folder, have your Meteor app handle the file upload, write the file to that location, and configure Nginx or whatever you are using as the load balancer to serve those files. If you worry about browser refreshed when the file is put into the public folder, you do not need to write files to the public folder right?

DNN - Redirecting specific file types

I've taken on the webmaster role for a website that uses DNN version 07.02.02. Most of the links to my pdf files are broken. They pdfs were in a folder called "/pdfs" now they're in a new folder "/docs/pdfs "
A few quick things:
I only have ftp access to the web site files. No access to web.config so rewrite rules are out.
I don't want to copy the old files back to "/pdfs" because it would mean managing two different pdf copies (there are over 500 pdfs).
Using file directories with a .pdf extension then add an index.asp file with a redirect i.e. "/pdfs/file_1001.pdf/index.asp" led to an error page because there's an override which doesn't allow site directory pages exposed.
Using a DNN module where I'd have to enter 500 files to redirect seems redundant when I only want to move a directory.
Any solutions to try?
In DNN if you have HOST level access you can modify Config files through the Host/Configuration manager page.
There you could modify the web.config file.
You might also look at the siteurls.config file (also accessible there) in which you could define some URL rules, might be as easy as
<RewriterRule>
<LookFor>/pdf/(.*)</LookFor>
<SendTo>/docs/pdf/$1</SendTo>
</RewriterRule>
The above rule is completely untested, not positive if it will do what you need or not.
I did a little more testing, and it looks like this won't work out of the box as a default setting that tells it to NOT rewrite PDF files, but I can't find the source code for that currently.

Where do I put picture in my ASP.Net MVC2 application?

Where do I place images within my solution?
I usually create Images folder inside Content folder. Most 3rd party components that use .css files search images subdirectory for their images by default.
You could put them in the Content folder, along with your .css files. Or you could create a brand new folder and organize it any way you like.
In the content folder.
We have a separate resources domain that serves up all static content (recommended). In the solution, I just have a 'resources' folder that mimics the structure of the production folder. Easier to deploy using a script. You can create a separate site or vdir on your local web server and map it to this static folder. The location could then be refernced in your project via an app setting (configuration.resourcedomain + "/resources/images/xyz.jpg")

Non class files with Java Web Start

How do you distribute other files needed by your application that aren't in a jar file? For example, the application at http://www.javabeginner.com/java-swing/java-swing-shuffle-game . The download contains Shuffle.jar, Shuffle.bat, Score.dat, and an images folder with 3 images in it. I can see possibly putting the images directly in Shuffle.jar, but you wouldn't want to put Score.dat in the jar file because it changes. Is there somewhere you could identify this type of file in the jnlp?
The non-java files should be stored as resources. For files that change, you store the original or template file also as a resource in your jar. When the program starts, you have it check the local system to see if that file exists. If not, it creates the local file by copying the template file from the JAR resource. If the file already exists, then it is used as is.
To save files to the local system, even when running in the sandbox (unsigned), you can use the PersistenceService (javadoc / example). If your java application is signed, then you can use the regular File apis to write the file to the local machine, such as in a ".yourgame" subfolder under the user's home folder.
You can put all those files (except the scores file) in your jar file and load the contents using resource loading.
I've just deleted and restarted my reply twice now, changing my answer each time; this is confusing and needs a bit more clarification.
Are you SURE that application is supposed to be a Web Start app? On the site you linked to, it doesn't appear to be. Are you trying to take an application that was not designed as a Web Start application and change it into one that can be Web Start?
If it's not a Web Start app as your tag implies, then this question is open ended. You can distribute it 100 different ways.
If you are indeed trying to convert it into a Web Start app, you can start by packaging the images into the jar and that will alleviate your first headache if you just read them from there instead of from a File(). If it's going to be Web Start, then you need to decide how you want to keep scores. You have to decide what the scoring system is like before you can decide on how to go about it; will all the scores be kept on the web site hosting the Web Start app? Will that part still be local? If you want to get access to the local file system, you need to sign the jar, then you can extract the score.dat to the file system and do whatever you want with it if the end user accepts.
You need to figure out what you want to do before you can do it, or at least clear it up for us if you already know more than we know you know.