Writing to text file with specific date and time in the file name

I am trying to write all my data to a text file and it is working unless I put DateTime in the file name.
The current code looks like this:

string time = DateTime.Now.ToString("d");
string name = "MyName";
File.WriteAllText(time+name+"test.txt","HelloWorld");

I am getting this exception:

An unhandled exception of type ‘System.IO.DirectoryNotFoundException’ occurred in mscorlib.dll

But as far as I know, the File.WriteAllText() method should create a new file or overwrite already existed file.

read more

Unable to run Plone site

I am using Plone for my site When i am trying to run following command it gets an error :
Plone/zinstance $ bin/instance fg

Traceback (most recent call last):

File "/Plone/zinstance/parts/instance/bin/interpreter", line 297, in <module>
    exec(compile(__file__f.read(), __file__, "exec"))
  File "/Plone/buildout-cache/eggs/Zope2-2.13.22-py2.7.egg/Zope2/Startup/run.py", line 76, in <module>
    run(/Plone/buildout-cache/eggs/Zope2-2.13.22-py2.7.egg/Zope2/Startup/run.py", line 22, in run
    starter.prepare()
  File "/home/turningcloud/Plone/buildout-cache/eggs/Zope2-2.13.22-py2.7.egg/Zope2/Startup/__init__.py", line 79, in prepare
    self.setupServers()
  File "/Plone/buildout-cache/eggs/Zope2-2.13.22-py2.7.egg/Zope2/Startup/__init__.py", line 214, in setupServers
    % (server.servertype(),e[1]))
ZConfig.ConfigurationError: There was a problem starting a server of type "HTTPServer". This may mean that your user does not have permission to bind to the port which the server is trying to use or the port may already be in use by another application. (Address already in use)

read more

Responsive site; maintaining image height while decreasing width?

This is the site I am working on: http://www.cmattayers.com/moushegianlaw/

I am trying to get the main image slider (the photo of the gavel) to be responsive, but to maintain the same height. Right now I have it so the dimensions of the image are being squished, by using:

#headerslider img{
    height:227px;
    width:100%;
}

But, I want to maintain the integrity of the image and have it slide to the left (out of view, as if it were in a “frame”) as the browser window size gets narrower. I don’t know how to accomplish this or if this is even possible. Is a pure CSS solution workable?

read more

How to upgrade Julia to a new release?

Question 1 – upgrade

I’m using v"0.3.8" on Windows. I found from

http://julialang.org/downloads/

Current Release (v0.3.9)

I know I could download the prebuild version and install again. Is there a way to upgrade (from current installed version) to the new version?

There’s Pkg.update(), it runs for a long time without any output – it doesn’t work in this way.

From the documentation:

update() Update package the metadata repo – kept in
Pkg.dir(“METADATA”) – then update any fixed packages that can safely
be pulled from their origin; then call Pkg.resolve() to determine a
new optimal set of packages versions.

read more

How can I move a file pointer to the next line in a file?

I am attempting to write a function that reads through a line, saves each character to an array, manipulates that character array, prints the results to another file, then moves on to the next line in the file.

Some sample input/output would be as follows (the purpose of the program is to find the derivative – but that part of the code is working fine.):

INPUT:
x
4x^4
91
sinx

OUTPUT:
1
16x^3
0
cosx

The function that I have written so far:

int main(){

    FILE *inptr = fopen("functions.txt", "r");
    FILE *outptr = fopen( "derive.txt", "w");

    if(inptr)
        derive(inptr,outptr);

    return 0;
}

void derive(FILE *inptr, FILE *outptr){
    int i;
    char in = '0';
    char array[MAX];

    while((in = fgetc(inptr)) != EOF){
        for(i = 0; in != '\n'; i++){
            fscanf(inptr, "%c", &in);
            array[i] = in;
        }
        manipulate(array, outptr); // Function that finds the derivative and prints to output file
    }
}

read more