instruction
stringlengths
0
30k
I have control over the HttpServer but not over the ApplicationServer or the Java Applications sitting there but I need to block direct access to certain pages on those applications. Precisely, I don't want users automating access to forms issuing direct GET/POST HTTP requests to the appropriate servlet. So, I decided to block users based on the value of HTTP_REFERER. After all, if the user is navigating inside the site, it will have an appropriate HTTP_REFERER. Well, that was what I thought. I implemented a rewrite rule in the .htaccess file that says: RewriteEngine on # Options +FollowSymlinks RewriteCond %{HTTP_REFERER} !^http://mywebaddress(.cl)?/.* [NC] RewriteRule (servlet1|servlet2)/.+\?.+ - [F] I expected to forbid access to users that didn't navigate the site but issue direct GET requests to the "servlet1" or "servlet2" servlets using querystrings. But my expectations ended abruptly because the regular expression "(servlet1|servlet2)/.+\?.+" didn't worked at all. I get really disappointed when I changed that expr to "(servlet1|servlet2)/.+" and worked so well that my users were blocked no matter if they navigated the site or not. So, my question is: How do I can accomplish this thing of not allowing "robots" with direct access to certain pages if I have no access/privileges/time to modify the application?
I don't have a solution, but I'm betting that relying on the referrer will never work because user-agents are free to not send it at all or spoof it to something that will let them in.
[You could have invented Monads!][1] > sigfpe says: >>But all of these introduce monads as something esoteric in need of explanation. But what I want to argue is that they aren't esoteric at all. In fact, faced with various problems in functional programming you would have been led, inexorably, to certain solutions, all of which are examples of monads. In fact, I hope to get you to invent them now if you haven't already. It's then a small step to notice that all of these solutions are in fact the same solution in disguise. And after reading this, you might be in a better position to understand other documents on monads because you'll recognise everything you see as something you've already invented. >>Many of the problems that monads try to solve are related to the issue of side effects. So we'll start with them. (Note that monads let you do more than handle side-effects, in particular many types of container object can be viewed as monads. Some of the introductions to monads find it hard to reconcile these two different uses of monads and concentrate on just one or the other.) In an imperative programming language such as C++, functions behave nothing like the functions of mathematics. For example, suppose we have a C++ function that takes a single floating point argument and returns a floating point result. Superficially it might seem a little like a mathematical function mapping reals to reals, but a C++ function can do more than just return a number that depends on its arguments. It can read and write the values of global variables as well as writing output to the screen and receiving input from the user. In a pure functional language, however, a function can only read what is supplied to it in its arguments and the only way it can have an effect on the world is through the values it returns. [1]: http://sigfpe.blogspot.com/2006/08/you-could-have-invented-monads-and.html
These solutions come to my mind: - You can try to use [Dependency Walker][1] or similar program to analyze dependecies. - Parse MSBuild files (*.csproject) to get list of dependencies **EDIT:** Just found 2 cool tools [Dependency Visualizer][2] & [Dependency Finder][3] on codeplex I think they can help you greatly. [1]: http://www.dependencywalker.com [2]: http://www.codeplex.com/dependencyvisualizer [3]: http://www.codeplex.com/DependencyFinder
These solutions come to my mind: - You can try to use [Dependency Walker][1] or similar program to analyze dependecies. - Parse MSBuild files (*.csproject) to get list of dependencies **EDIT:** Just found 2 cool tools [Dependency Visualizer][2] & [Dependency Finder][3] on codeplex I think they can help you greatly. **EDIT:** @edg, I totally misread your question, since you loose references from csproj files you have to use static analysis tool like NDepend or try to analyze dependencies in run time. [1]: http://www.dependencywalker.com [2]: http://www.codeplex.com/dependencyvisualizer [3]: http://www.codeplex.com/DependencyFinder
Dynamically inserting javascript into HTML that uses document.write
|javascript|html|ajax|
I am currently loading a lightbox style popup that loads it's HTML from an XHR call. This content is then displayed in a 'modial' popup using `element.innerHTML = content` This works like a charm. In another section of this website I use a Flickr 'badge' (<http://www.elliotswan.com/2006/08/06/custom-flickr-badge-api-documentation/>) to load flickr images dynamically. This is done including a script tag that loads a flickr javascript, which in turn does some `document.write` statments. Both of them work perfectly when included in the HTML. Only when loading the flickr badge code _inside_ the lightbox, no content is rendered at all. It seems that using `innerHTML` to write `document.write` statements is taking it a step too far, but I cannot find any clue in the javascript implementations (FF2&3, IE6&7) of this behavior. Can anyone clarify if this should or shouldn't work? Thanks.
I am currently loading a lightbox style popup that loads it's HTML from an XHR call. This content is then displayed in a 'modal' popup using `element.innerHTML = content` This works like a charm. In another section of this website I use a Flickr 'badge' (<http://www.elliotswan.com/2006/08/06/custom-flickr-badge-api-documentation/>) to load flickr images dynamically. This is done including a script tag that loads a flickr javascript, which in turn does some `document.write` statments. Both of them work perfectly when included in the HTML. Only when loading the flickr badge code _inside_ the lightbox, no content is rendered at all. It seems that using `innerHTML` to write `document.write` statements is taking it a step too far, but I cannot find any clue in the javascript implementations (FF2&3, IE6&7) of this behavior. Can anyone clarify if this should or shouldn't work? Thanks.
As Google Web Toolkit is a [subset of Java][1] it works best when you Java at the backend too. Since Google App Engine is currently [Python only][2] I think you'd have to do a lot of messing about to get your server and client to talk nicely to each other. [1]: http://code.google.com/support/bin/answer.py?answer=54830&topic=10208 [2]: http://code.google.com/appengine/kb/general.html#language
Yes. I don't have any experience using Access to hit PostgreSQL from a remote location but I have successfully used Access as a front-end to SQL Server & DB2 from a remote location with success. Ironically, what you don't want to do is use Access to front-end an Access database (mdb) from a remote location over a high-latency link. Since hitting the MDB uses file-based operations it's pretty easy to end up with a corrupt database if you have anything more than a trivial db.
I found a few examples of other implementations: Luke Baker has one he is calling [Active Record in PHP][1]. Flinn has a [post][2] about why it is not possible in PHP because in Ruby everything is an object. With a followup [here][3] I know a few people who have looked at [ZF][4] have you tried that? [CakePHP][5]? [1]:http://lukebaker.org/projects/activerecord-in-php/ [2]:http://www.actsasflinn.com/articles/2007/08/08/php-and-activerecord [3]:http://www.actsasflinn.com/articles/2007/08/10/php-and-activerecord-continued [4]:http://framework.zend.com/ [5]:http://cakephp.org/
Best way to handle LOBs in Oracle dblink'ed tables
|oracle-database|sql|dblink|
If you create an Oracle dblink you cannot directly access LOB columns in the target tables. For instance, you create a dblink with: create database link TEST_LINK connect to TARGETUSER IDENTIFIED BY password using 'DATABASESID'; After this you can do stuff like: select column_a, column_b from data_user.sample_table@TEST_LINK Except if the column is a LOB, then you get the error: ORA-22992: cannot use LOB locators selected from remote tables This is documented here: http://download-uk.oracle.com/docs/cd/B10501_01/appdev.920/a96591/adl04mng.htm#98328 The same page suggests you fetch the values into a local table, but that is... kind of messy: CREATE TABLE tmp_hello AS SELECT column_a from data_user.sample_table@TEST_LINK Any ideas? Thanks
|sql|oracle-database|dblink|
If you create an Oracle dblink you cannot directly access LOB columns in the target tables. For instance, you create a dblink with: create database link TEST_LINK connect to TARGETUSER IDENTIFIED BY password using 'DATABASESID'; After this you can do stuff like: select column_a, column_b from data_user.sample_table@TEST_LINK Except if the column is a LOB, then you get the error: ORA-22992: cannot use LOB locators selected from remote tables This is documented here: <http://download-uk.oracle.com/docs/cd/B10501_01/appdev.920/a96591/adl04mng.htm#98328> The same page suggests you fetch the values into a local table, but that is... kind of messy: CREATE TABLE tmp_hello AS SELECT column_a from data_user.sample_table@TEST_LINK Any ideas? Thanks
You need the control to handle three events: Mouse Down, Mouse Move and Mouse Up. On the Mouse Down event, you will need to capture the mouse. This means the mouse messages are sent to the control that has the capture. In the mouse move event, if the input is captured then update the displayed image depending on the amount the mouse moved. In the mouse up event, release the capture if the input is captured. The boolean jjnguy suggests is unnecessary as the Capture property of a Control is readable so it's possible to determine if the capture has been set. Skizz
You have to reference the System.configuration assembly (note the lowercase)
You have to reference the System.configuration assembly (note the lowercase) I don't know why this assembly is not added by default to new projects on Visual Studio, but I find myself having the same problem every time I start a new project. I always forget to add the reference.
you can get around this problem by getting hold of the System.RunTime.Serialization dll (it's a .net 3.x assembly) and referencing it from your .net 2.0 application. This works because the .net 3.0 binaries are compiled to run on the .net 2.0 CLR. By doing this, you get access to the DataContractSerliazer which I've used to get around a similar problem where I wanted to pass in a ICollection<t> as a parameter to a webservice and the xmlserializer didn't know how to deal with it properly. If you're cool with using the .net 3.x dll in your 2.x application you should be able to use the DataContractSerializer to solve this problem
Performance issues regarding Access 2003 and the OLE Object data type
|ms-access|serialization|oledb|
In MS Access 2003 (I know, I know), I'm using the OLE Object data type to persist the sate of some objects that are marked as serializable (just using a IO.BinaryFormatter to serialize to a MemoryStream, and then saving that to the db as a Byte array). Does this work pretty much like a varbinary, or a blob? Are there any gotchas looming in the shadows that anyone knows about? Any performance advise or war stories? I'd profit from any advice.
I'm not sure whether you're asking for a shell as in bash/csh, or a shell as in ipython. If it's the later, then I'd recommend looking at [Reinteract][1]. While it's still very alpha, it's already a great tool for rapid prototyping in python, and allows embedding of plots, widgets, etc. [1]: http://fishsoup.net/software/reinteract/
I don't agree with the people that say that if you don't have problems you'd better not switch. I think that SCM is some of the disciplines a good developer should know well, and frankly, even if you master VSS you are just experimenting a small fraction of the advantages a good SCM tool and SCM strategy can do for you and for your team. Obviously evaluate and test the alternatives first in a non-production environment.
How to find out which Service Pack is installed on SQL Server?
|sql-server|
the title says it all...
If you use these attributes: [XmlArray("ProviderPatientLists")] [XmlArrayItem("File")] public ProviderPatientList Files { get { return _ProviderPatientLists; } set { _ProviderPatientLists = value; } } Where ProviderPatientList inherit's `List<PatientList>` You can then have more control over the xml outputed will create <ProviderPatientLists> <File> </File> <File> </File> <File> </File> </ProviderPatientLists>
ASP.Net: why is my button's click/command events not binding/firing in a repeater?
|asp.net|vb.net|.net-2.0|button|repeater|
|asp.net|vb.net|.net-2.0|repeater|button|
Remove the bar at the top of Loginview for formatting
|asp.net|webform|
I'm making a webform using a loginview, the problem is that because the control includes a grey bar telling you what type of control it is it throws of correctly formatting the page (It has LoginView1 at the top), is there a way to hide this on the LoginView as the contentPlaceholder does an excellent job for this. I've found that you can Remove the ID, but that seems like a hack as it stops programatic access
|asp.net|webforms|
How to generate a verification code/number ?
|language-agnostic|number|generation|
I'm working on an application where users have to make a call and type a verification number with the keypad of their phone. I would like to be able to detect if the number they type is correct or not. The phone system does not have access to a list of valid numbers, but instead it will validate the number against an algorithm (like a credit card number). Here are some of the requirements : - It must be difficult to type a valid random code - It must be difficult to have a valid code if I make a typo (tranposition of digits, wrong digit) - I must have a reasonnable number of possible combinations (let's say 1M) - The code must be as short as possible, to avoid errors from the user Given these requirements, how would you generate such a number ? Thanks !
I'm working on an application where users have to make a call and type a verification number with the keypad of their phone. I would like to be able to detect if the number they type is correct or not. The phone system does not have access to a list of valid numbers, but instead it will validate the number against an algorithm (like a credit card number). Here are some of the requirements : - It must be difficult to type a valid random code - It must be difficult to have a valid code if I make a typo (tranposition of digits, wrong digit) - I must have a reasonnable number of possible combinations (let's say 1M) - The code must be as short as possible, to avoid errors from the user Given these requirements, how would you generate such a number ? Thanks ! EDIT : @Haaked : The code has to be numerical, because the user type it with it's phone. @matt b : On the first step, the code is displayed on a Web page, the second step is to call and type in the code. I don't know the user's phone number.
|language-agnostic|numbers|generation|
I'm working on an application where users have to make a call and type a verification number with the keypad of their phone. I would like to be able to detect if the number they type is correct or not. The phone system does not have access to a list of valid numbers, but instead it will validate the number against an algorithm (like a credit card number). Here are some of the requirements : - It must be difficult to type a valid random code - It must be difficult to have a valid code if I make a typo (tranposition of digits, wrong digit) - I must have a reasonnable number of possible combinations (let's say 1M) - The code must be as short as possible, to avoid errors from the user Given these requirements, how would you generate such a number ? Thanks ! EDIT : @Haaked : The code has to be numerical, because the user type it with it's phone. @matt b : On the first step, the code is displayed on a Web page, the second step is to call and type in the code. I don't know the user's phone number. Folowup : I've found several algorithms to *check* the validity of numbers (See this intersting Google Code project : [checkDigits][1]). But I didn't found information on how to *generate* such numbers. [1]: http://code.google.com/p/checkdigits/wiki/CheckDigitSystems
Each looping construct serves a different purpose. for - This is used to loop for a specific number of iterations. foreach - This is used to loop through all of the values in a collection. while - This is used to loop until you meet a condition. Of the three, "while" will most likely provide the best performance in most situations. Of course, if you do something like the following, you are basically rewriting the "for" loop (which in c# is slightly more performant). $count = 0; do { ... $count++; } while ($count < 10); They all have different basic purposes, but they can also be used in somewhat the same way. It completely depends on the specific problem that you are trying to solve.
Stored procedures represent a software contract that encapsulates the actions taken against the database. The code in the procedures, and even the schema of the database itself can be changed without affecting compiled, deployed code, just so the inputs and outputs of the procedure remain the same. By embedding queries in your application, you are tightly coupling yourself to your data model. For the same reason, it is also not good practice to simply create stored procedures that are just CRUD queries against every table in your database, since this is still tight coupling. The procedures should instead be bulky, coarse grained operations. From a security perspective, it is good practice to disallow db_datareader and db_datawriter from your application and only allow access to stored procedures.
Form post doesn't contain textbox data [ASP.NET C#]
|c#|asp.net|
I have several "ASP:TextBox" controls on a form (about 20). When the form loads, the text boxes are populated from a database. The user can change the populated values, and when they submit the form, I take the values posted to the server and conditionally save them (determined by some business logic). All but 1 of the text boxes work as intended. The odd box out, upon postback, does not contain the updated value that the user typed into the box. When debugging the application, it is clear that **myTextBox.Text** reflects the old, pre-populated value, not the new, user-supplied value. Every other box properly shows their respective user-supplied values. I did find a workaround. My solution was to basically extract the text box's value out of the Request.Form object: **Request.Form[myTextBox.UniqueID]**, which does contain the user-supplied value. What could be going on, here? As I mentioned, the other text boxes receive the user-supplied values just fine, and this particular problematic text box doesn't have any logic associated to it -- it just takes the value and saves it. The maindifference between this text box and the others is that this is a multi-line box (for inputting notes), which I believe is rendered as an HTML "textarea" tag instead of an "input" tag in ASP.NET.
I've been also using SmartAssembly. I found that Ezrinz .Net Reactor much better for me on .net applications. It obfuscates, support Mono, merges assemblies and it also also has a very nice licensing module to create trial version or link the licence to a particular machine (very easy to implement). Price is also very competitive and when I needed support they where fast. [Eziriz][1] Just to be clear I'm just a custumer who likes the product and not in any way related with the company. [1]: http://www.eziriz.com/
As Google Web Toolkit is a [subset of Java][1] it works best when you Java at the backend too. Since Google App Engine is currently [Python only][2] I think you'd have to do a lot of messing about to get your server and client to talk nicely to each other. jQuery seems the most popular JavaScript library option in the [AJAX Tag at DjangoSnippets.com][3]. [1]: http://code.google.com/support/bin/answer.py?answer=54830&topic=10208 [2]: http://code.google.com/appengine/kb/general.html#language [3]: http://www.djangosnippets.org/tags/ajax/?page=1
As Google Web Toolkit is a [subset of Java][1] it works best when you Java at the backend too. Since Google App Engine is currently [Python only][2] I think you'd have to do a lot of messing about to get your server and client to talk nicely to each other. jQuery seems to be the most popular JavaScript library option in the [AJAX Tag at DjangoSnippets.com][3]. [1]: http://code.google.com/support/bin/answer.py?answer=54830&topic=10208 [2]: http://code.google.com/appengine/kb/general.html#language [3]: http://www.djangosnippets.org/tags/ajax/?page=1
Use strtok. In my opinion, there isn't a need to build a class around tokenizing unless strtok doesn't provide you with what you need. It might not, but in 15+ years of writing various parsing code in C and C++, I've always used strtok. Here is an example char myString[] = "The quick brown fox"; char *p = strtok(myString, " "); while (p) { printf ("Token: %s\n", p); p = strtok(NULL, " "); } A few caveats (which might not suit your needs). The string is "destroyed" in the process, meaning that EOS characters are placed inline in the delimter spots. Correct usage might require you to make a non-const version of the string. You can also change the list of delimiters mid parse. In my own opinion, the above code is far simpler and easier to use than writing a separate class for it. To me, this is one of those functions that the language provides and it does it well and cleanly. It's simply a "C based" solution. It's appropriate, it's easy, and you don't have to write a lot of extra code :-)
Check [this][1] out [1]: http://www.codeproject.com/KB/library/Measurement_Conversion.aspx
There are a few things you can try with this, seems to happen alot and the solution varies for everyone it seems. If you are still using the IIS virtual directory make sure its pointed to the correct directory and also check the asp.net version it is set to, make sure it is set to asp.net 2 Clear out your bin/debug/obj all of them. Do a clean solution and the a Build Solution. Check your project file in a text editor and make sure where its looking for the global file is correct, sometimes it doesnt change the directory. remove the global from the solution and add it back after saving and closing. make sure all the script tags in the aspx file point to the correct one after. You can try running the convert to web application tool, that redoes all of the code and project files. Make sure you close VS after you try them. Those are some things i know to try. Hope one of them works for you.
There are a few things you can try with this, seems to happen alot and the solution varies for everyone it seems. If you are still using the IIS virtual directory make sure its pointed to the correct directory and also check the asp.net version it is set to, make sure it is set to asp.net 2 Clear out your bin/debug/obj all of them. Do a clean solution and then a Build Solution. Check your project file in a text editor and make sure where its looking for the global file is correct, sometimes it doesnt change the directory. remove the global from the solution and add it back after saving and closing. make sure all the script tags in the aspx file point to the correct one after. You can try running the convert to web application tool, that redoes all of the code and project files. Make sure you close VS after you try them. Those are some things i know to try. Hope one of them works for you.
My opinions on these are: 1) No, table names should be singular. While it appears to make sense for the simple selection (`select * from Orders`) it makes less sense for the OO equivalent (`Orders x = new Orders`). A table in a DB is really the set of that entity, it makes more sense once you're using set-logic: select Orders.* from Orders inner join Products on Orders.Key = Products.Key That last line, the actual logic of the join, looks confusing with plural table names. I'm not sure about always using an alias (as Matt suggests) clears that up. 2) They should be singular as they only hold 1 property 3) Never, if the column name is ambiguous (as above where they both have a column called [Key]) the name of the table (or its alias) can distinguish them well enough. You want queries to be quick to type and simple - prefixes add unnecessary complexity. 4) Whatever you want, I'd suggest CapitalCase I don't think there's one set of absolute guidelines on any of these. As long as whatever you pick is consistent across the application or DB I don't think it really matters.
can i use javascript to create a client side e-mail
|javascript|email|
i want to create a client side mail creator web page. i know the problems of using the mailto action in an html form (not standard, no default mail appication setted in the client...). but the web page isn't very important, and they don't care me very much. The mail created by the mailto action has the sintax: subject:undifined subject body: param1=value1 param2=value2 . . . paramn=valuen ¿Can i use javascript to format the mail like this? Subject:XXXXX Body: Value1;Value2;Value3...ValueN Thanks PD: sry for my bad english
Can I use JavaScript to create a client side email?
I want to create a client side mail creator web page. I know the problems of using the mailto action in an html form (not standard, no default mail appication set on the client...). but the web page isn't very important, and they don't care very much. The mail created by the mailto action has the syntax: subject: undefined subject body: >param1=value1 param2=value2 . . . paramn=valuen ¿Can i use javascript to format the mail like this? >Subject:XXXXX > >Body: >Value1;Value2;Value3...ValueN Thanks PD: sry for my bad english
I want to create a client side mail creator web page. I know the problems of using the mailto action in an html form (not standard, no default mail appication set on the client...). but the web page isn't very important, and they don't care very much. The mail created by the mailto action has the syntax: >subject: undefined subject >body: > >param1=value1 >param2=value2 >. >. >. >paramn=valuen ¿Can i use javascript to format the mail like this? >Subject:XXXXX > >Body: >Value1;Value2;Value3...ValueN Thanks PD: sry for my bad english
You have to remember that what MSVCRT calls "OS handles" are not Win32 handles, but another layer of handles added just to confuse you. MSVCRT tries to emulate the Unix handle numbers where stdin=0, stdout=1, stderr=2 and so on. Win32 handles are numbered differently and their values always happen to be a multiple of 4. Opening the pipe and getting all the handles configured properly will require getting your hands messy. Using the MSVCRT source code and a debugger is probably a requirement.
Espo is pretty much bang on target. Just wanted to add my two cents: The "non temporal" phrase means lacking temporal locality. Caches exploit two kinds of locality - spatial and temporal, and by using a non-temporal instruction you're signaling to the processor that you don't expect the data item be used in the near future. I am a little skeptical about the hand-coded assembly that uses the cache control instructions. In my experience these things lead to more evil bugs than any effective performance increases.
How to prevent Write Ahead Logging on just one table in PostgreSQL?
|postgresql|
I am considering log-shipping of [Write Ahead Logs (WAL)][1] in PostgreSQL to create a warm-standby database. However I have one table in the database that receives a huge amount of INSERT/DELETEs each day, but which I don't care about protecting the data in it. To reduce the amount of WALs produced I was wondering, **is there a way to prevent any activity on one table from being recorded in the WALs?** [1]: http://www.postgresql.org/docs/8.2/static/runtime-config-wal.html
If your "FooProcessor" really does process foos, then don't be reluctant to give it that name just because you already have a BarProcessor, BazProcessor, etc. When in doubt, obvious is best. The other developers who have to read your code may not be using the same thesaurus you are. That said, more specificity wouldn't hurt for this particular example. "Process" is a pretty broad word. Is it really a "FooUpdateProcessor" (which might become "FooUpdater"), for example? You don't have to get too "creative" about the naming, but if you wrote the code you probably have a fairly good idea of what it does and doesn't do. Finally, remember that the bare class name isn't all that you and the readers of your code have to go on - there are usually namespaces in play as well. Those can often give readers enough context to see clearly what your class if really for, even if its bare name is fairly generic.
I think you need to annotate your *Problem* super-class with *[@MappedSuperclass][1]* instead of *@Entity*. [1]: http://java.sun.com/javaee/5/docs/api/javax/persistence/MappedSuperclass.html
This is more of a how-to-implement tip, but I started dabbling with creating an ActiveRecord/DataMapper implementation in PHP and quickly ran into many hurdles with array-like access. Eventually I found the SPL extensions to PHP, and particularly ArrayObject and ArrayIterator. These began to make my life a lot easier. Unfortunately I haven't had much time to devote to it, but anyone who tries something like this should check those out.
No. Though, groovy, a JVM language, is dynamically typed and would let you write: def map = new HashMap<complicated generic expression>();
> What is the normal way people writing > network code in Delphi use > Windows-style overlapped asynchronous > socket I/O? Well, Indy has been the 'standard' library for socket I/O for a long while now - and it's based on blocking sockets. This means if you want asynchronous behaviour, you use additional thread(s) to connect/read/write data. To my mind this is actually a major advantage, as there's no need to manage any kind of state machine navigation, or worry about callback procs or similar stuff. I find the logic of my 'reading' thread is less cluttered and much more portable than non-blocking sockets would allow. Indy **9** has been mostly bombproof, fast and reliable for us. However the move to Indy 10 for Tiburon is causing me a little concern. > @Mike: "...the need to kill sockets to free threads...". This made go "huh?" until I remembered our threading library uses an exception-based technique to kill 'waiting' threads safely. We call [QueueUserAPC][1] to queue a function which raises a C++ exception (NOT derived from class Exception) which should only be caught by our thread wrapper procedure. All destructors get called so the threads all terminate cleanly and tidy up on the way out. [1]: http://msdn.microsoft.com/en-us/library/ms684954(VS.85).aspx
Well, the brute force solution is to attempt to initiate a connection with the database on each server. That will tell you whether it's running, though you could have timeout issues. The more elegant (but more difficult... isn't that always the way?) solution would be to use WMI to connect to the remote machine and find out if the SQL server process is running.
This isn't a way to page the data, but have you looked into the [ListView](http://msdn.microsoft.com/en-us/library/bb398790.aspx) control? It gives the flexibility of repeater / data list but with built in paging like the grid view. And for paging in sql, you would want to do something like [this](http://www.davidhayden.com/blog/dave/archive/2005/12/30/2652.aspx)
hmm, I don't know if I would say that online materials are useless, but I do agree that there is something about books. Maybe they are better written, or maybe it is the act of forking over $50 that makes you more inclined to study the material. Either way, I agree that books should be part of this question. If anyone has any suggestions for books for languages I will edit the post with the best suggestions.
Shouldn't be much different: namespace.foo = function foo() {...} namespace.foo.prototype.getLength = function() { ... } or you could use (function() { function foo() { ... } foo.prototype... namespace.foo = foo; })(); to save some typing.
You have to use the PagedDataSource, it allows you to turn a standard data source into one that can be paged. Here's an [example article][1] [1]: http://www.codeproject.com/Kb/aspnet/pagingBySreejith%20Thathanattu.aspx
This was answered [here][1]. [1]: http://stackoverflow.com/questions/2840/paging-sql-server-2005-results
Are you initially loading the data only when !Page.IsPostBack? Also, is view state enabled for the text box?
Stored procedures are definitely the way to go...they are compiled, have execution plan before hand and you could do rights management on them. I do not understand this whole source control issue on stored procedure. You definitely can source control them, if only you are a little disciplined. Always start with a .sql file that is the source of your stored procedure. Put it in version control once you have written your code. The next time you want to edit your stored procedure get it from your source control than your database. If you follow this, you will have as good source control as your code. I would like to quote Tom Kyte from Oracle here...Here's his rule on where to write code...though a bit unrelated but good to know I guess. 1. Start with stored procedures in PL/SQL... 2. If you think something can't be done using stored procedure in PL/SQL, use Java stored procedure. 3. If you think something can't be done using Java Stored procedure, consider Pro*c. 4. If you think you can't achieve something using Pro*C, you might want to rethink what you need to get done.
That stuff is all built in, it is called a maintenance plan
Use the [TCPClient Class][1] to create a generic function that connects in TCP to a given IP address. Then iterate over the list of servers you want to test and try to open a connection to port 1433. [1]: http://msdn.microsoft.com/en-us/library/system.net.sockets.tcpclient.aspx
In the end I used a table with one row and four cells for this. In each one I selected the source elements with position() mod 4 equal to 0, 1, 2 or 3 as appropriate, and then made sure that the photo and caption was always the same height so the rows lined up correctly.
I created a simple test page that illustrates the problem: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title>Document Write Testcase</title> </head> <body> <div id="container"> </div> <div id="container2"> </div> <script> // This doesn't work! var container = document.getElementById('container'); container.innerHTML = "<script type='text/javascript'>alert('foo');document.write('bar');<\/script>"; // This does! var container2 = document.getElementById('container2'); var script = document.createElement("script"); script.type = 'text/javascript'; script.innerHTML = "alert('bar');document.write('foo');"; container.appendChild(script); </script> </body> </html> This page alerts 'bar' and prints 'foo', while I expected it to also alert 'foo' and print 'bar'.
I created a simple test page that illustrates the problem: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title>Document Write Testcase</title> </head> <body> <div id="container"> </div> <div id="container2"> </div> <script> // This doesn't work! var container = document.getElementById('container'); container.innerHTML = "<script type='text/javascript'>alert('foo');document.write('bar');<\/script>"; // This does! var container2 = document.getElementById('container2'); var script = document.createElement("script"); script.type = 'text/javascript'; script.innerHTML = "alert('bar');document.write('foo');"; container.appendChild(script); </script> </body> </html> This page alerts 'bar' and prints 'foo', while I expected it to also alert 'foo' and print 'bar'. But, unfortunately, since the `script` tag is part of a larger HTML page, I cannot single out that tag and append it like the example above. Well, I can, but that would require scanning `innerHTML` content for `script` tags, and replacing them in the string by placeholders, and then inserting them using the DOM. Sounds no _that_ trivial.
I created a simple test page that illustrates the problem: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title>Document Write Testcase</title> </head> <body> <div id="container"> </div> <div id="container2"> </div> <script> // This doesn't work! var container = document.getElementById('container'); container.innerHTML = "<script type='text/javascript'>alert('foo');document.write('bar');<\/script>"; // This does! var container2 = document.getElementById('container2'); var script = document.createElement("script"); script.type = 'text/javascript'; script.innerHTML = "alert('bar');document.write('foo');"; container.appendChild(script); </script> </body> </html> This page alerts 'bar' and prints 'foo', while I expected it to also alert 'foo' and print 'bar'. But, unfortunately, since the `script` tag is part of a larger HTML page, I cannot single out that tag and append it like the example above. Well, I can, but that would require scanning `innerHTML` content for `script` tags, and replacing them in the string by placeholders, and then inserting them using the DOM. Sounds not _that_ trivial.
|bestpractices|webdevelopment|database-design|
|database-design|
Javascript and PHP - Login Script with hidden buttons
|php|javascript|design|webdevelopment|
I have been using PHP and Javascript for building my dads website. He wants to incorporate a login system into his website. I have the design for the login system using PHP, my problem is how do I show buttons if the person is logged in. For Example - You have Home, Products, About Us, and Contact. Well I want to have buttons for Dealer, Distributor, and maybe other information if the user is logged in. So I will have Home, Products, About Us, Contacts, Dealer (if dealer login), Distributor (if distributor login), and so forth. Would Javascript be a good way to do this or would php, maybe even both. Using Javascript to show and hide buttons, and php to check to see which buttons to show.
|javascript|php|design|
Checklist for testing a new site
|testing|webdevelopment|
What are the most common things to test in a new site? For instance to prevent exploits by bots, malicious users, massive load, etc.? And just as importantly, what tools and approaches should you use?
What are the most common things to test in a new site? For instance to prevent exploits by bots, malicious users, massive load, etc.? And just as importantly, what tools and approaches should you use? (some stress test tools are really expensive/had to use, do you write your own? etc) What common exploits should be checked for? Edit: the reason for this question is partially from being in SO beta, however please refrain from SO beta discussion, SO beta got me thinking about my own site and good thing too. This is meant to be a checklist for things that I, you, or someone else hasn't thought of before.
What are the most common things to test in a new site? For instance to prevent exploits by bots, malicious users, massive load, etc.? And just as importantly, what tools and approaches should you use? (some stress test tools are really expensive/had to use, do you write your own? etc) [Common exploits that should be checked for][1]. Edit: the reason for this question is partially from being in SO beta, however please refrain from SO beta discussion, SO beta got me thinking about my own site and good thing too. This is meant to be a checklist for things that I, you, or someone else hasn't thought of before. [1]: http://stackoverflow.com/questions/23102/what-are-comon-exploits-web-i-should-know-about
|testing|
ASP.NET - asp:xxx Controls versus standard HTML
|asp.net|controls|webdevelopment|