EzDevInfo.com

website

First brazilian conference about CSS

Get IP address of visitors using Python + Flask

I'm making a website where users can log on and download files, using the Flask micro-framework (based on Werkzeug) which uses Python (2.6 in my case).

I need to get the IP address of users when they log on (for logging purposes). Does anyone know how to do this? Surely there is a way to do it with Python?


Source: (StackOverflow)

How To Convert ASP.NET Website to ASP.NET Web Application

I have an ASP.NET 3.5 Website (visual studio lingo), but the site continues to grow and is looking rather cowboyish among other things. I'd like to see this get converted into a Web Application (namespaces and all).

Is this something that can be easily done in Visual Studio? If not, are there any other tools out there that could create all of the namespaces, etc. automagically?


Source: (StackOverflow)

Advertisements

How many JavaScript programs are executed for a single web-page in the browser?

JavaScript programs consist of statements and function declarations. When a JavaScript program is executed, these two steps occur:

  1. the code is scanned for function declarations, and every func. declaration is "executed" (by creating a function object) and a named reference to that function is created (so that this function can be called from within a statement)

  2. the statements are executed (evaluated) sequentially (as they appear in the code)

Because of that, this works just fine:

<script>
    foo();
    function foo() {
        return;
    }
</script>

Although the "foo" function is called before it is declared, it works because the function declaration is evaluated before the statement.

However, this does not work:

<script>
    foo();
</script>
<script>
    function foo() {
        return;
    }
</script>

A ReferenceError will be thrown ("foo is not defined"). This leads to the conclusion that every SCRIPT element inside the HTML code of the web-page represents a separate JavaScript program and every time the HTML parser encounters a SCRIPT element, it executes the program inside that element (and then once the program is executed, the parser moves on to the HTML code that follows the SCRIPT element).

Then again, this does work:

<script>
    function foo() {
        return;
    }
</script>
<script>
    foo();
</script>

My understanding here is that the Global object (which serves as the Variable object in the global execution context) exists (and remains) at all times, so the first JavaScript program will create the function object and make a reference for it, and then the second JavaScript program will use that reference to call the function. Therefore, all JavaScript programs (within a single web-page) "use" the same Global object, and all changes done to the Global object by one JavaScript program can be observed by all JavaScript programs that run subsequently.

Now, note this...

<script>
    // assuming that foo is not defined
    foo();
    alert(1);
</script>

In the above case, the alert call will not execute, because the "foo()" statement throws a ReferenceError (which breaks the whole JavaScript program) and therefore, all subsequent statements do not execute.

However, in this case...

<script>
    // assuming that foo is not defined
    foo();
</script>
<script>
    alert(1);
</script>

Now, the alert call does get executed. The first JavaScript program throws a ReferenceError (and as a consequence breaks), but the second JavaScript program runs normally. Of course, the browser will report the error (although it did execute subsequent JavaScript programs, after the error occurred).

Now, my conclusions are:

  • every SCRIPT element within the HTML code of the web-page represents a separate JavaScript program. These programs execute immediately as the HTML parser encounters them.
  • all JavaScript programs within the same web-page "use" the same Global object. That Global object exists at all times (from the moment the web-page is fetched up until the web-page is destroyed). JavaScript programs may manipulate the Global object, and all changes done to the Global object by one JavaScript program can be observed in all subsequent JavaScript programs.
  • if one JavaScript program breaks (by having an error thrown), that does not prevent subsequent JavaScript programs to execute.

Please fact-check this post and tell me if I got something wrong.

Also, I have not found resources that explain the behaviors mentioned in this post, and I assume that the browser makers must have published such resources somewhere, so if you know about them, please provide the links to them.

UPDATE!

OK, I am going to (try to) answer my own question here :) I got a response (via e-mail) from Dmitry A. Soshnikov (he runs a blog about JavaScript at http://www.dmitrysoshnikov.com/ ).

His take on this issue is this: Each SCRIPT block contains global code. Executing each SCRIPT block creates a new execution context. Therefore, each SCRIPT block has its own execution context, but all those execution contexts share the same Global object.

SCRIPT blocks could be viewed as different "sub-programs" with the same shared state.

Furthermore, the ECMAScript spec (3rd edition) states (chapter 10): "Global code is source text that is treated as an ECMAScript Program."


Source: (StackOverflow)

How can I set a website image that will show as preview on facebook?

When you share a link on facebook it will automatically find images on the website and randomly picks one as a preview. How can you influence the preview image? When a person shares the website link on his facebook?


Source: (StackOverflow)

web site vs web application [duplicate]

This question already has an answer here:

What is the difference between a website and a web application?


Source: (StackOverflow)

Website screenshots using PHP

Is there any way of taking a screenshot of a website in PHP, then saving it to a file?


Source: (StackOverflow)

How to dynamically change a web page's title?

I have a webpage that implements a set of tabs each showing different content. The tab clicks do not refresh the page but hide/unhide contents at the client side.

Now there is a requirement to change the page title according to the tab selected on the page ( for SEO reasons ). Is this possible? Can someone suggest a solution to dynamically alter the page title via javascript without reloading the page?


Source: (StackOverflow)

How to detect Adblock on my website?

I would like to be able to detect if the user is using adblocking software when they visit my website. If they are using it, I want to display a message asking them to turn it off in order to support the project, like this website does.

If you enter to that site and your browser has some kind of adblock software enabled, then the site instead of showing the actual ads shows a little banner telling the users that the ad revenue is used for hosting the project and they should consider turning Adblock off.

I want to do that on my website, I'm using adsense ads on it, How can I do that?


Source: (StackOverflow)

HTML5 Camera Access Through Browser in iOS

We are creating an html5 website for mobile and need to get camera access through the web browser without being a native app. We are having trouble making this work in iOS. Is anyone aware of a solution for this?


Source: (StackOverflow)

How do you go about charging for building a website?

Someone has approached me to build a website for their small business. What is the protocol for laying out an offer for building a website in terms of pricing?

Do I charge for number of pages? If they want advanced features (Flash, Ajax, etc.) is it just price per hour of development? What if I have no idea how long it will take? Are there any good ways of looking at a similar website to help determine if something is going to be a 20 hour job or a 100 hour job.

Are there any standard templates that are used when determining scope and pricing for a website development job?


Source: (StackOverflow)

What's the difference between a web site and a web application?

I'm stumped trying to come up to a difference between a web site and a web application for myself. As I see it, a web site points to a specific page and a web application is more of some sort of 'portal' to content and information.

But where I'm stuck is that a web application is still viewed through a browser (is it not?) and a web site can still view content dynamically, making the line between web site and application prety gray.

For instance, does a web site using ASP.NET or AJAX (I assume ASP.NET is AJAX's proprietary sibling, if not, ignore ASP.NET AND concentrate on the AJAX), becomes a web application because it can retrieve data dynamically and asynchronously or would a website using PHP and a CMS be more of a web application because it forms the pages on request, based on the request of the client and its content in its databse?

Or maybe I'm totally wrong here - what differenciates between a web application and a website?


Source: (StackOverflow)

What is the difference between web application and website in asp.net? [duplicate]

This question already has an answer here:

What is the difference between web application and website in asp.net?
and if it have a difference which best from all sides?


Source: (StackOverflow)

How to get the previous url using PHP

Suppose my site's url is given as hyperlink on some page on the internet; that page could be anything on internet - blog, orkut, yahoo, even stackoverflow etc, and someone clicks on it,and visited my site. So can we know, using php, the previous url from which the visitor came to my page?


Source: (StackOverflow)

How do you migrate an IIS 7 site to another server?

I'm new to the IIS world but am wondering the best practice for moving a website to another server (along with all settings, etc.)

  • Manually recreate the site on the new server (not maintainable for obvious reasons)
  • Copy the applicationHost.config settings file
  • Use appcmd to make a backup and restore
  • Use MSDeploy to publish the site on the new machine
  • Use a 3rd party tool

Just wondering what others' experiences have been. Thanks!


Source: (StackOverflow)

Using Sphinx to write personal websites and blogs

Sphinx is a Python library to generate nice documentation from a set of ReST formatted text files.

I wonder if any one has written Sphinx plugins to make it generate personal websites and blogs.

Especially for blogs, there needs to be a way to automatically list posts chronologically and generate a RSS feed. One needs to write a Sphinx plugin to do such special page/xml generation.

Has anyone tried this before?


Source: (StackOverflow)