Sunday, 15 June 2014

asp.net - Using IIS 7 Redirect Module or coding your own -


What is the difference between using the IIS redirection module to redirect. Just play with your own coding and response kintext? It does not matter to me, they both do the same thing and it is very easy to use the redirect module in IIS because it is relatively redirected anyway! As this code is doing, it is a global. AS says:

App. response. Status = "301 move permanently"; App response. Adhider ("location", new location);

Am I not right? You can do the same thing in 2 different ways! IIS or code! Use IIS only to web.config in your app:

  & lt; HttpRedirect enabled = "wrong" destination = "http://www.domainToRedirectTo.com/" exact destination = "false" httpResponseStatus = "permanent" />  

Good and simple! Accurate determination is false, so it will be redirected to a destination based on a relative basis.

I have to listen to arguments against using one side versus one side because I do not see any argument that would benefit in any way. Both satisfy the same goal.

The way you put it, there is no difference. A coded version allows you to respond to input on the runtime and to redirect people to different pages - use this code for a login.aspx page Can be unsuccessful -page.aspx or login- succesfull-page.aspx . If it's just hard-coded no difference

Remember that the redirects do not mean the sign of permanent rehabilitation of the URL only. . You may want to redirect people to a temporary message (redirect code 307) - for example, if you are working for Apple and Steve Jobs is giving a key word - that is, "Steve Jobs has a redirection to the store. Is giving the main word and we are updating the store "page in this example to give a switch a blow and update your entire web-form to the configuration files of all the IIS servers Instead of choosing the change through runtime logic. Each redirection has its own purpose.


python - Is RLock a sensible default over Lock? -


Threading module in Python provides two types of locks: a common lock and a recantent lock I think if I lock it Should I always like RLock on lock; Mainly to prevent deadlock situations.

In addition, I get two points, when lock on an RLock is preferred:

  • There is a more complex internal structure in RLock and therefore poor performance Could.
  • Due to some reason, I want to restart a thread through lock.

Is my argument correct? Can you tell other aspects?

two points:

  • Officially Python version (2.4, 2.5 to 3.1) is much slower than a lock lock, because locks in C and RLox in Python apply (this will change to 3.2)
  • A < / Li>

Bottom line, I can release it from any thread (not necessarily the thread that receives it), while an RLock should be released from the same thread, D only a Suggests using Arelk if it coincides with the words that you are looking for, otherwise default glued locks.


asp.net - Running a query in Page Load a bad idea? -


I am running an asp.net application in which I added a [insert] global / page_load query / update query. Therefore, every time the user hits any page on the site, he updates the database with his activity (session ID, time, hit on the page). I have not implemented it yet, but this is the only suggestion that I take care of how many people are currently on my site.

Is it going to kill my database and / or IIS for a long time? We believe that the site is average between 30,000 and 50,000 users at a time. I can not lock on top of a database hit continuously with every single page hit for my site every single user. I am worried what will happen, though this is the first time that I have tried a solution in this way, so I can become very crazy.

Disable it.

Create a DLL that handles the update, and the page load is a fire and forgets with the parameter.


javascript - jQuery - remove list items based off of time -


I currently have a page in which there is an anonymous list that is initially populated by my DB inquiry into the list, Each list item has a time stamp and text, if Javascript and AJAX are to be used, then this page updates dynamically without any inventory every 10 seconds, if the new data has arrived.

What is the easiest and most effective way to remove items from the list from the list, more than 24 hours old?

My tendency is to do the following:

  1. In the js file, load all list items in an array in an unreserved list
  2. To get data during the data, if the data comes back, then add those objects to the array also
  3. Each time the matching () function is called, it also removes a distant data () function Which removes all items that are older than 24 hours

In addition, I have a javascript Attempted to remove the correct way of adding list items to the script array is a code here that I am trying to add to all the list items in an array:

  var list = new array ( ); $ (".listname") Each (function (i) {list.push ($ (this));});  

To delete list items from the array, I expect to use it:

  list.pop (); Why do not array first (oldest first), then use   

? This will remove the first item in the array, as described.


parsing - Lexer written in Javascript? -


I have a project where the user needs to define a set of instructions for the UI that is completely javascript Has been written in I have the ability to parse a string of instructions and then have to translate them into instructions. Is there a library to parse 100% javascript? Or a generator that will be generated in javascript? Thanks!

Something like that, maybe?

The first available parser development system for JS / CC is - Dividives It has been developed, both for the purpose of producing productive compiler development system and how to normally do the bottom-up parsing Pars table generation is done, with the intention of creating an easy-to-use academic environment for those interested in it.

Both platform-independent software associations: a regular expression-based generator from the input character stream to a personal token and a parser generator , parse tables Calculating the formation of a stand-alone, working parser for a given specification and free grammar referenced to JS / CC is defined in an individual meta language, and the individual semantic code is defined as To Milit can be evaluated on the cut rule.

JS / CC is fully written in ECMAScript , it can be executed in many different ways: platform-independent, browser-based JavaScript Embedded on the website, as a Windows Script host application, as a compiled JScript.NET executable, interpreted by Mozilla / Rhino or Mozilla / Spiderman, or V8 shell script on Windows, * n Bus, Linux and Mac OSX. However, for productive execution, it is recommended to use command-line versions. This version is capable of collecting a full compiler from the JS / CC parser specification, which is later stored in the .js Javascript source file.


flex - How to make a property bindable? -


I have a class like this. The property is based on "ipboard" filed "ecboardid", I have found that when Accced changes, UI controls do not see that "ipag" has also changed. So, how to make this property binding? PUBLIC class encoder EventDispatcher {public worker ecboardid: String; / * -......................................... Methods ..... ..................................... * / public function copyFrom (newEncoder: encoder): zero { Ecboardid = newEncoder.ecboardid; This.dispatchEvent (new event ('isPagChanged')); } [Bindabal (event = "ipt switch")] Public function found ipag (): boolean {if (this.aconbird! = Null) {if (this .onlyboardid.search ('xxx')! = -1) {return False; } Back true; } Other {return false; }}}

Edit:

If I change the property to a static job,

 < Code> [bindable] public class encoder event dispatcher (public worker excibid): string; / * -......................................... Methods ..... ..................................... * / public function copyFrom (newEncoder: encoder): zero { Ecboardid = newEncoder.ecboardid; This.dispatchEvent (new event ('isPagChanged')); } Public static function isPag (string excreb): boolean {if (ecboardid! = Null) {if (ecboardid.search ('xxx') = -1) {return false; } Back true; } Other {return false; }}}  

Tie this way:

  visible = {encoder.ispag (encoder.acbddid)}  

works? Will the encoder see a change in a boobed?

I do not think you can only read properties Bindable, because the Flex changes continue the incidents To call the setter method for a property uses. For the properties of the object, see the section on binding.


c++ - Is there an occassion where using catch all clause : catch (...) is justified? -


Every time I have caught all the statements:

  try {// some code } Hold (...) {}  

In this always has been misused

Arguments against using cache All sections Are clear This will include anything that contains OS exceptions such as Access violation, since the exception handler can not know who it is working with, in most cases the exception is ambiguous log message or some incompatible message box Will appear in the form.

then hold (...) seems natural evil

but it has still been implemented in C ++ and other languages ​​(Java, C #) applies the same technique. So in some cases it is fair use?

The argument against using cache is clear all sections, these OS exceptions such as access The violation will catch anything because the exception handler can not know what the behavior is with it, in most cases the exception will appear as a fuzzy log message or some unorganized message box.

And if those same exceptions aren

hold (...) presenting at least my self message box (And starts customizing) logging, saving crash dumps, etc. ).

I think the Destructors have proper use of hold (...). I can not throw devastators - well, I mean, they can throw, but if a district without any progress Because of the exception of the thrown during the pile, the program ends, so they should not allow the exceptions to be avoided. It is generally better that instead of ending the program, the exceptions continue to be uninterrupted first.

Another situation is in a worker thread that can work arbitrarily; Normally you do not want an unexpected accident if the worker throws an exception. The worker provides the opportunity to clamp (...) semi-cleanliness and closure in the thread.