instruction
stringlengths
0
30k
I'm getting into ASP.NET (C# - I know it doesn't matter for this particular question, but full disclosure and all that), and while I love that the `asp:`-style controls save me a lot of tedious HTML-crafting, I am often frustrated with certain behaviors. I encountered one last night when working with Master Pages: my `<asp:BulletedList ID="nav">`, when converted into HTML, became `<ul id="ct100_nav">`. There are other issues--I noticed that when you auto-populate a DataGrid, it adds attributes to the resulting table that I don't necessarily want there. I know that there is a certain amount of "convention over configuration" that you have to accept when you rely on a framework to take over some of your tedious duties, but the "conventions" in these cases aren't so much any established conventions, but rather unnecessary extras. I know *why* the ID adds the prefix, but I should be able to tweak and turn things like this off, especially since, as a bit of a web standards evangelist, I don't duplicated HTML id's in a single page anyway. So the question here is for those ASP.NET devs more seasoned than I: in your experiences in developing and deploying apps, how do you leverage these controls? Do you find yourself resorting back to hard-coded HTML? Do you use a blend? I don't want to design my HTML around idiosyncratic quirks in these controls, but, if possible, I'd like to leverage them when possible. What's a boy to do?
But, [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
I'm not sure of the SQL Server syntax for this but in MySQL I would do SELECT IDColumn, ( IF( Column1 >= 3, 1, 0 ) + IF( Column2 >= 3, 1, 0 ) + IF( Column3 >= 3, 1, 0 ) + ... [snip ] ) AS NumberOfColumnsGreaterThanThree FROM TableA; EDIT: A very (very) brief Google search tells me that the CASE statement does what I am doing with the IF statement in MySQL. You may or may not get use out of [the google result I found][1] FURTHER EDIT: I should also point out that this isn't an answer to your question but an alternative solution to your actual problem. [1]:http://www.craigsmullins.com/ssu_0899.htm
I'm guessing you're trying to prevent screen scraping? In my honest opinion it's a tough one to solve and trying to fix by checking the value of HTTP_REFERER is just a sticking plaster. Anyone going to the bother of automating submissions is going to be savvy enough to send the correct referer from their 'automaton'. You could try rate limiting but without actually modifying the app to force some kind of is-this-a-human validation (a CAPTCHA) at some point then you're going to find this hard to prevent.
Another version of this (in middle school) was "Please Excuse My Dear Aunt Sally". - Parentheses - Exponents - Multiplication - Division - Addition - Subtraction The mnemonic device was helpful in school, and still useful in programming today.
You can't tell apart users and malicious scripts by their http request. But you can analyze which users are requesting too many pages in too short a time, and block their ip-addresses.
If you are writing a site which takes credit card numbers for payment: 1. You should probably be as permissive as possible, so that if it does expire, you allow the credit card company to catch it. So, allow it until the last second of the last day of the month. 2. Don't write your own credit card processing code. If^H^HWhen you write a bug, someone will lose real money. We all make mistakes, just don't make decisions that turn your mistakes into catastrophes.
Efficiently selecting a set of random elements from a linked list
|language-agnostic|algorithm|list|
Say I have a linked list of numbers of length N. N is very large and I don’t know in advance the exact value of N. How can I most efficiently write a function that will return k completely random numbers from the list?
check if your compiler supports stackavail()
Programmatically access browser history
|firefox|
how can i create an application to read all my browser (firefox) history? i noticed that i have in C:\Users\user.name\AppData\Local\Mozilla\Firefox\Profiles\646vwtnu.default what looks like a sqlite database (urlclassifier3.sqlite) but i don't know if its really what is used to store de history information. i searched for examples on how to do this but didn't find anything. ps: although the title is similar i believe this question is not the same as ["How do you access browser history?"][1] [1]: http://stackoverflow.com/questions/48805/how-do-you-access-browser-history
|firefox|sqlite|
One thing you can try is opening up the old .csproj file in notepad and replacing the ProjectReference tags with Reference tags. If you can write a parser, feel free to share. :) Entry in .csproj file if it is a project reference <ItemGroup> <ProjectReference Include="..\WindowsApplication2\WindowsApplication2.csproj"> <Project>{7CE93073-D1E3-49B0-949E-89C73F3EC282}</Project> <Name>WindowsApplication2</Name> </ProjectReference> </ItemGroup> Entry in .csproj file if it is an assembly reference <ItemGroup> <Reference Include="WindowsApplication2, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <ExecutableExtension>.dll</ExecutableExtension> <HintPath>..\WindowsApplication2\bin\Release\WindowsApplication2.dll</HintPath> </Reference> </ItemGroup>
using System.Security.Principal; ... WindowsPrincipal wp = (WindowsPrincipal)HttpContext.Current.User; to get the current domain user. Of course you have to make sure that the IIS is set up to handle Windows Authentication.
I don't know any tool, but you can try to access user settings via [IVsPersistSolutionOpts][1] interface [1]: http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivspersistsolutionopts_members%28VS.80%29.aspx
If you need specific servers, use WMI. If you just want all available servers: <http://support.microsoft.com/kb/q287737/>
I use [Tweak UI][1] to configure explorer so that apps don't steal focus; you can also configure how many times they flash in the taskbar as well. EDIT: Once you are within Tweak UI, these options are found under General > Focus. [1]: http://www.microsoft.com/windowsxp/Downloads/powertoys/Xppowertoys.mspx
I use [Tweak UI][1] to configure explorer so that apps don't steal focus; you can also configure how many times they flash in the taskbar as well. EDIT: Once you are within Tweak UI, these options are found under General > Focus. EDIT: @Kev, apparently there is [a 64-bit version][2] (not MS approved, apparently, I would scan it for viruses of course) that works successfully with the 64-bit version of XP. From what I understand, you download that and then run it in XP compatibility mode as administrator and it will do the trick. Tweak UI is basically a nice wrapper around a collection of registry hacks, so I imagine you could find the hacks themselves if you didn't care for running Tweak UI in this manner. Hope that works for you! [1]: http://www.microsoft.com/windowsxp/Downloads/powertoys/Xppowertoys.mspx [2]: http://www.softpedia.com/get/Tweak/System-Tweak/TweakUI-64-Bit-Edition.shtml
Remember the order of the page lifecycle, and where you are databinding your form. * PreInit * Init * Load * Your Control Event Handler If you are reading the value in the Control Event handler, yet databinding in Init or Load, you'll have the old value. The trick is to always databind in the correct event, or check for postback and don't databind then.
I get all my unixish/GNU support using <A href="http://www.finkproject.org/">Fink</A> (which provides Debian-like package control) with the emacs22-carbon package which means I also get a clickable application. It does everything I expect it to do, and automagically starts using emacs extensions loaded with fink. Good times.
I would certainly go with Vincent's answer. Just make absolutely certain you are closing and disposing the tcp connections properly etc. WMI seems a bit of overkill to me if that is all you're after.
For myself, I have started insisting that every bug I find and fix be expressed as a test: 1. "Hmmm, that's not right..." 2. Find possible problem 3. Write a test, show that the code fails 4. Fix the problem 5. Show that the new code passes 6. Loop if the original problem persists I try to do this even while banging stuff out, and I get done in about the same time, only with a partial test suite already in place. (I don't live in a commercial programming environment, and am ofter the only coder working a particular project.)
For myself, I have started insisting that every bug I find and fix be expressed as a test: 1. "Hmmm, that's not right..." 2. Find possible problem 3. Write a test, show that the code fails 4. Fix the problem 5. Show that the new code passes 6. Loop if the original problem persists I try to do this even while banging stuff out, and I get done in about the same time, only with a partial test suite already in place. (I don't live in a commercial programming environment, and am often the only coder working a particular project.)
Using a referrer is very unreliable as a method of verification. As other people have mentioned, it is easily spoofed. Your best solution is to modify the application (if you can) You could use a CAPTCHA, or set some sort of cookie or session cookie that keeps track of what page the user last visited (a session would be harder to spoof) and keep track of page view history, and only allow users who have browsed the pages required to get to the page you want to block. This obviously requires you to have access to the application in question, however it is the most foolproof way (not completely, but "good enough" in my opinion.)
In addition to the benefits already mentioned, another nice feature of using FogBugz is BugzScout, which you can use to report errors from your app and log them into FogBugz automatically. If you're a one person team, chances are there are some bugs in your code you've never seen during your own testing, so it's nice to have those bugs found "in the wild" automatically reported and logged for you.
Javascript is another helpful tool to prevent (or at least delay) screen scraping. Most automated scraping tools don't have a Javascript interpreter, so you can do things like setting hidden fields, etc.
Javascript is another helpful tool to prevent (or at least delay) screen scraping. Most automated scraping tools don't have a Javascript interpreter, so you can do things like setting hidden fields, etc. Edit: Something along the lines of [this Phil Haack article](http://haacked.com/archive/2006/09/26/Lightweight_Invisible_CAPTCHA_Validator_Control.aspx).
When I learned this in grade school (in Canada) it was referred to as BEDMAS: **B**rackets **E**xponents **D**ivision **M**ultiplication **A**ddition **S**ubtraction Just for those from this part of the world...
You may consider a third party email service who handles delivery issues: - Exact Target - Vertical Response - Constant Contact - Campaign Monitor - Emma - Return Path - IntelliContact - SilverPop
I'm not really sure how applicable to programming the old BODMAS mnemonic is anyways. There is no guarantee on order of operations between languages, and while many keep the standard operations in that order, not all do. And then there are some languages where order of operations isn't really all that meaningful (Lisp dialects, for example). In a way, you're probably better off for programming if you forget the standard order and either use parentheses for everything(eg (a*b) + c) or specifically learn the order for each language you work in.
How do I rake tasks within a ruby script?
|ruby|cli|rake|
I've got a Rakefile with a rake task that I would normally call from the commandline (rake blog:post Title). I'd like to write a ruby script that calls that rake task multiple times, but the only solution I see is shelling out (`` or system). What's the right way to do this?
I had to do this for a project before. One of the major difficulties I had was explaining what I was trying to do to other people. I spent a ton of time trying to do this in SQL, but I found the pivot function woefully inadequate. I do not remember the exact reason why it was, but it is too simplistic for most applications, and it isn't full implemented in MS SQL 2000. I wound up writing a pivot function in .NET. I'll post it here in hopes it helps someone, someday. ''' <summary> ''' Pivots a data table from rows to columns ''' </summary> ''' <param name="dtOriginal">The data table to be transformed</param> ''' <param name="strKeyColumn">The name of the column that identifies each row</param> ''' <param name="strNameColumn">The name of the column with the values to be transformed from rows to columns</param> ''' <param name="strValueColumn">The name of the column with the values to pivot into the new columns</param> ''' <returns>The transformed data table</returns> ''' <remarks></remarks> Public Shared Function PivotTable(ByVal dtOriginal As DataTable, ByVal strKeyColumn As String, ByVal strNameColumn As String, ByVal strValueColumn As String) As DataTable Dim dtReturn As DataTable Dim drReturn As DataRow Dim strLastKey As String = String.Empty Dim blnFirstRow As Boolean = True ' copy the original data table and remove the name and value columns dtReturn = dtOriginal.Clone dtReturn.Columns.Remove(strNameColumn) dtReturn.Columns.Remove(strValueColumn) ' create a new row for the new data table drReturn = dtReturn.NewRow ' Fill the new data table with data from the original table For Each drOriginal As DataRow In dtOriginal.Rows ' Determine if a new row needs to be started If drOriginal(strKeyColumn).ToString <> strLastKey Then ' If this is not the first row, the previous row needs to be added to the new data table If Not blnFirstRow Then dtReturn.Rows.Add(drReturn) End If blnFirstRow = False drReturn = dtReturn.NewRow ' Add all non-pivot column values to the new row For Each dcOriginal As DataColumn In dtOriginal.Columns If dcOriginal.ColumnName <> strNameColumn AndAlso dcOriginal.ColumnName <> strValueColumn Then drReturn(dcOriginal.ColumnName.ToLower) = drOriginal(dcOriginal.ColumnName.ToLower) End If Next strLastKey = drOriginal(strKeyColumn).ToString End If ' Add new columns if needed and then assign the pivot values to the proper column If Not dtReturn.Columns.Contains(drOriginal(strNameColumn).ToString) Then dtReturn.Columns.Add(drOriginal(strNameColumn).ToString, drOriginal(strValueColumn).GetType) End If drReturn(drOriginal(strNameColumn).ToString) = drOriginal(strValueColumn) Next ' Add the final row to the new data table dtReturn.Rows.Add(drReturn) ' Return the transformed data table Return dtReturn End Function
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]). [1]: http://code.google.com/p/checkdigits/wiki/CheckDigitSystems
Recommendations for Web application performance benchmarks
|performance|testing|web-application|benchmarking|
I am about to start testing an intranet web application. Specifically, I have to determine the application's performance. Please could somone suggest formal/informal standards for how I can judge the application's performance.
|performance|testing|web-applications|benchmarking|
Testing a variable to determine if it's numeric in Perl
|perl|number|
Is there a simple way in Perl that will allow me to determine if a given variable is numeric? Something along the lines of: if (is_number($x)) { ... } would be ideal. A technique that won't throw warnings when the `-w` switch is being used is certainly preferred.
Is there a simple way in Perl that will allow me to determine if a given variable is numeric? Something along the lines of: if (is_number($x)) { ... } would be ideal. A technique that won't throw warnings when the `-w` switch is being used is certainly preferred. --- Update. Thank you all for your answers. I really appreciate all your help. Sorry I can't select multiple accepted answers. The rest of you will have to be satisfied with an upvote.
|perl|numbers|
Suggestions for Migrating from ASP.NET WebForms to ASP.NET MVC?
|.net|asp.net|asp.net-mvc|webform|
ASP.NET MVC has been [discussed](http://stackoverflow.com/questions/tagged/mvc) on this forum a few times. I'm about to do a large **migration** of several websites from classic ASP/ASP.NET WebForms to ASP.NET MVC and was wondering what kind of advice those of you with experience in both technologies have. What I have: a typical ASP.NET app with heavily coupled presentation/business logic, all sorts of messy ASP.NET-generated Javascript cruft, and so forth. What I want: clean ASP.NET MVC-generated agnostic markup. 'Nuff said. Any pointers, tips, tricks, or gotchas to be aware of? Thanks!
I process a lot of credit card transaction at work, and I can tell you that the expiry date is inclusive.
I process a lot of credit card transaction at work, and I can tell you that the expiry date is inclusive. Also, I agree with Gorgapor. Don't write your own processing code. They are some good tools out there for credit card processing. Here we have been using [Monetra][1] for 3 years and it does a pretty decent job at it. [1]: http://www.mainstreetsoftworks.com/
We actually built one in-house where I work. Unfortunately, it's not available for the public. This is actually a great project to work on and it's not that hard to do. If you plan on doing something by yourself, I suggest you read about [Quantity][1], [Dimension][2] and [Unit][3] ([fundamental units][4]). These helped us understand the domain of the problem clearly and helped a lot in designing the library. [1]: http://en.wikipedia.org/wiki/Physical_quantity [2]: http://en.wikipedia.org/wiki/Dimensional_analysis [3]: http://en.wikipedia.org/wiki/Units_of_measurement [4]: http://en.wikipedia.org/wiki/Fundamental_units
Any restrictions on development in Vista
|iis|windows-vista|
I'm looking at a new computer which will probably have vista on it. But there are so many editions of vista; are there any weird restrictions on what you can run on the various editions? For instance you couldn't run IIS on Windows ME. Can you still run IIS on the home editions of vista?
In your example a credit card is expired on 6/2008. Without knowing what you are doing I cannot say definitively you should not be validating ahead of time but be aware that sometimes business rules defy all logic. For example, where I used to work they often did not process a card at all or would continue on transaction failure simply so they could contact the customer and get a different card.
I would suggest: First find your k random numbers. Sort them. Then traverse both the linked list and your random numbers once. If you somehow don't know the length of your linked list (how?), then you could grab the first k into an array, then for node r, generate a random number in [0, r), and if that is less than k, replace the rth item of the array. (Not entirely convinced that doesn't bias...) Other than that: "If I were you, I wouldn't be starting from here." Are you sure linked list is right for your problem? Is there not a better data structure, such as a good old flat array list.
vBulletin uses a sort of Pseudo-Cron system, that basically checks a schedule on every page access, and fires any processes that are due then. It's been a while since I worked with Wordpress, but I think something like this should work if it runs on each page view.
Well, you do need to know what N is at runtime at least, even if this involves doing an extra pass over the list to count them. The simplest algorithm to do this is to just pick a random number in N and remove that item, repeated k times. Or, if it is permissible to return repeat numbers, don't remove the item. Unless you have a VERY large N, and very stringent performance requirements, this algorithm runs with `O(N*k)` complexity, which should be acceptable. Edit: Nevermind, Tom Hawtin's method is way better. Select the random numbers first, then traverse the list once. Same theoretical complexity, I think, but much better expected runtime.
<pre><code> --Example SQL CREATE TABLE D001_Students ( StudentID INTEGER CONSTRAINT nnD001_STID NOT NULL, ChristianName NVARCHAR(255) CONSTRAINT nnD001_CHNA NOT NULL, Surname NVARCHAR(255) CONSTRAINT nnD001_SURN NOT NULL, CONSTRAINT pkD001 PRIMARY KEY(StudentID) ); CREATE INDEX idxD001_STID on D001_Students; CREATE TABLE D002_Classes ( ClassID INTEGER CONSTRAINT nnD002_CLID NOT NULL, StudentID INTEGER CONSTRAINT nnD002_STID NOT NULL, ClassName NVARCHAR(255) CONSTRAINT nnD002_CLNA NOT NULL, CONSTRAINT pkD001 PRIMARY KEY(ClassID, StudentID), CONSTRAINT fkD001_STID FOREIGN KEY(StudentID) REFERENCES D001_Students(StudentID) ); CREATE INDEX idxD002_CLID on D002_Classes; CREATE VIEW V001_StudentClasses ( SELECT D001.ChristianName, D001.Surname, D002.ClassName FROM D001_Students D001 INNER JOIN D002_Classes D002 ON D001.StudentID = D002.StudentID ); </code></pre> These are the conventions I was taught, but you should adapt to whatever you developement hose uses. 1. Plural. It is a collection of entities. 2. Yes. The attribute is a representation of singular property of an entity. 3. Yes, prefix table name allows easily trackable naming of all constraints indexes and table aliases. 4. Pascal Case for table and column names, prefix + ALL caps for indexes and constraints.
Perhaps you could deserialise the byte array using a known encoding and ensure that (a) it doesn't throw any exceptions, and (b) deserialises to the original string. It seems that from your description of the scenario, you may not have the original string readily available. Might there be a way to create it?
How do i enable MSTDC on sqlserver?
|msdtc|
Is that even a valid question? I have a .Net windows app that is using MSTDC and it throwing an exception: > System.Transactions.TransactionManagerCommunicationException: > Network access for Distributed > Transaction Manager (MSDTC) has been > disabled. Please enable DTC for > network access in the security > configuration for MSDTC using the > Component Services Administrative tool ---> System.Runtime.InteropServices.COMException (0x8004D024): The transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D024) at System.Transactions.Oletx.IDtcProxyShimFactory.ReceiveTransaction(UInt32 propgationTokenSize, Byte[] propgationToken, IntPtr managedIdentifier, Guid& transactionIdentifier, OletxTransactionIsolationLevel& isolationLevel, ITransactionShim& transactionShim).... I follow the guide [here][1] to able MSTDC on the pc, on which the app is installed. But the error still occurs. I was wondering if this was a DB issue? And if so how can i resolve it? [1]: http://kbalertz.com/883960/enable-MSDTC-communications-Commerce-Server-Developer-Edition-Windows-Service.aspx
You can use Merge Replication. Theres a tutorial here [SQL Server Compact 3.5 How-to Tutorials][1] (Number 5). [1]: http://msdn.microsoft.com/en-us/sqlserver/bb219480.aspx
MSDTC must be enabled on both systems, both server and client. <br /> Also, make sure that there isn't a firewall between the systems that blocks RPC.<br/> <a href="http://www.sqldev.net/misc/DTCTest.htm">DTCTest</a> is a nice litt app that helps you to troubleshoot any other problems.<br />
|asp.net|controls|
Scheme (define (factorial x) (if (= x 0) 1 (* x (factorial (- x 1)))))
**Scheme** Here is a simple recursive definition: (define (factorial x) (if (= x 0) 1 (* x (factorial (- x 1))))) Scheme also provides the requirement that tail-recursive functions use constant stack space. Here is a version of factorial that is tail-recursive: (define factorial (letrec ((fact (lambda (x accum) (if (= x 0) accum (fact (- x 1) (* accum x)))))) (lambda (x) (fact x 1))))
**Scheme** Here is a simple recursive definition: (define (factorial x) (if (= x 0) 1 (* x (factorial (- x 1))))) In Scheme tail-recursive functions use constant stack space. Here is a version of factorial that is tail-recursive: (define factorial (letrec ((fact (lambda (x accum) (if (= x 0) accum (fact (- x 1) (* accum x)))))) (lambda (x) (fact x 1))))
**C/C++** unsigned long factorial(int n) { unsigned long factorial = 1; int i; for (i = 2; i <= n; i++) factorial *= i; return factorial; } **PHP** function factorial($n) { for ($factorial = 1, $i = 2; $i <= $n; $i++) $factorial *= $i; return $factorial; }
**C/C++** unsigned long factorial(int n) { unsigned long factorial = 1; int i; for (i = 2; i <= n; i++) factorial *= i; return factorial; } **PHP** function factorial($n) { for ($factorial = 1, $i = 2; $i <= $n; $i++) $factorial *= $i; return $factorial; } [@Niyaz][1]: You didn't specify return type for the function [1]: http://stackoverflow.com/questions/23930/factorial-algorithms-in-different-languages#23979
**C/C++**: Procedural unsigned long factorial(int n) { unsigned long factorial = 1; int i; for (i = 2; i <= n; i++) factorial *= i; return factorial; } **PHP**: Procedural function factorial($n) { for ($factorial = 1, $i = 2; $i <= $n; $i++) $factorial *= $i; return $factorial; } [@Niyaz][1]: You didn't specify return type for the function [1]: http://stackoverflow.com/questions/23930/factorial-algorithms-in-different-languages#23979
Suggestions on Ajax development environment for PHP
|php|ajax|ide|webdevelopment|
I am a C/C++ programmer professionally, but I've created a couple of personal web sites using PHP and MySQL. They're pretty basic, and I'd like to jazz them up using Ajax, but I've never done any Ajax. I've done all the development so far manually, i.e. no IDE or anything like that. Does anyone have suggestions on Ajax development environments that can help me? Shareware or freeware would be preferable as I'd find it hard to justify spending more than a minimal amount of money on this...
Sorry I can't help toooooo much, but go to http://twit.tv, and find the Security Now podcast - they did one a couple of weeks ago on DNS - get the first one. It has a good explanation of how it works etc (which may help). The second one on that site is about how it's been "hacked" - the first one is the how it works. To kinda answer it: The "root servers" (for .com for eg) hold a record for stackoverflow.com. But they can't hold all the details, so they have an NS record (name server record) saying "if you want more info, go look over there". So your machine asks that target machine (ns1.stackoverflow.com) for www.stackoverflow.com, and gets back the A record (IP address), or MX (mail etc) So, your domain register will store it in a database or whatever they chose, and when you do an update, they SOMEHOW (I dont know, but I guess it's published by NIC) push that change to the (cluster of) root name servers. They would then push the changes for your domain (eg where www goes, where your mail goes etc) to their local server, which actually serves the domain info. Hope that makes SOME sense :)
Sorry I can't help toooooo much, but go to http://twit.tv, and find the Security Now podcast - they did one a couple of weeks ago on DNS - get the first one. It has a good explanation of how it works etc (which may help). The second one on that site is about how it's been "hacked" - the first one is the how it works. To kinda answer it: The "root servers" (for .com for eg) hold a record for stackoverflow.com. But they can't hold all the details, so they have an NS record (name server record) saying "if you want more info, go look over there". So your machine asks that target machine (ns1.stackoverflow.com) for www.stackoverflow.com, and gets back the A record (IP address), or MX (mail etc) So, your domain register will store it in a database or whatever they chose, and when you do an update, they SOMEHOW (I dont know, but I guess it's published by NIC, but they DO have to pay to be a registrar, and be checked out etc) push that change to the (cluster of) root name servers. They would then push the changes for your domain (eg where www goes, where your mail goes etc) to their local server, which actually serves the domain info. Hope that makes SOME sense :) > Does this tell me that the > stackoverflow.com nameservers have > been stored in the .com name servers? Yes and no. Its like you going calling directory assistance for everything ending in .com. You ask for stackoverflow - they tell you "if you want SO, call this number, and they can tell you how to get Jeff (www), Joel (mail), etc.". The root server is the first directory assistance. Your register's name server is the one on the end of the second call (assuming you called it :) )
.NET Console Application Tab Completion
|.net|console|
Any ideas on how to implement tab completion for a .NET (C#) Console Application? And I mean within an application that is run and then loops for user input (like if you run ftp.exe without any arguments), like this: string line = string.Empty; while (line != "exit") { //do something here Console.ReadLine(); } I know I probably couldn't actually use readline, but I would like to be able to do tab completion at that same point where you retrieve input from the user.
Since there currently isn't a MS SQL client for Mac OSX, I would, as [Modesty][1] has suggested, use [Remote Desktop][2] for the Mac. [1]: http://stackoverflow.com/questions/3452/sql-server-client-for-osx#3455 [2]: http://www.microsoft.com/mac/products/remote-desktop/default.mspx
Ed: phpmyadmin is for MySQL, but the asker needs something for Microsoft SQL Server (MSSQL). Most solutions that I found involve using an ODBC Driver and then whatever client app you use. For example, [Gorilla SQL][1] claims to be able to do that, even though the project seems abandoned. Most **good** solutions are either using Remote Desktop or VMWare/Parallels. [1]: http://www.macupdate.com/info.php/id/17557
from [timocracy.com][1]: require 'rake' require 'rake/rdoctask' require 'rake/testtask' require 'tasks/rails' def capture_stdout s = StringIO.new oldstdout = $stdout $stdout = s yield s.string ensure $stdout = oldstdout end Rake.application.rake_require '../../lib/tasks/metric_fetcher' results = capture_stdout {Rake.application['metric_fetcher'].invoke} [1]: http://www.timocracy.com/articles/2008/02/21/calling-invoking-rails-rake-tasks-from-within-ruby-for-testing-try-2
@CodingTheWheel Heres your code through eclipse (ctrl+shift+f) and the inserted back here :) Including the four spaces in front each line. public static boolean simpleNLP(String inputline, String keywords[]) { int i; int maxToken = keywords.length; int to, from; if (inputline.length() < 1) return false; Vector lexed = new Vector(); // stores the words // first extract every substring in inputline that has a blank on either // side. from = 0; to = 0; while (inputline.charAt(from) == ' ' && from < inputline.length()) from++; // skip ' ' if (from >= inputline.length()) return false; // check for blank and empty lines while (to >= 0) { to = inputline.indexOf(' ', from); if (to > 0) { lexed.addElement(inputline.substring(from, to)); from = to; while (inputline.charAt(from) == ' ' && from < inputline.length() - 1) from++; } else { lexed.addElement(inputline.substring(from)); } } // // if we get here we have a vector of strings that correspond to the // words in the input. // // so now we look for matches in order boolean status = false; to = 0; for (i = 0; i < lexed.size(); i++) { String s = (String) lexed.elementAt(i); if (s.equalsIgnoreCase(keywords[to])) { to++; if (to >= keywords.length) { status = true; break; } } } return status; }
@CodingTheWheel Heres your code, a bit clean up and through eclipse (ctrl+shift+f) and the inserted back here :) Including the four spaces in front each line. public static boolean simpleNLP(String inputline, String keywords[]) { if (inputline.length() < 1) return false; List<String> lexed = new ArrayList<String>(); for (String ele : inputline.split(" ")) { lexed.add(ele); } boolean status = false; to = 0; for (i = 0; i < lexed.size(); i++) { String s = (String) lexed.get(i); if (s.equalsIgnoreCase(keywords[to])) { to++; if (to >= keywords.length) { status = true; break; } } } return status; }
That's good. You're right, I don't have the original string, since I'm testing a module that creates an XML document as a byte array. I didn't think about deserializing to a String with an expected encoding. That will do the trick. Thanks!
Do you even need MSDTC? The escalation you're experiencing is often caused by creating multiple connections within a single TransactionScope. If you do need it then you need to enable it as outlined in the error message. On XP: - Go to Administrative Tools -> Component Services - Expand Component Services -> Computers -> <computer name> - Right-click -> Properties -> MSDTC tab - Hit the Security Configuration button
Have a look at this: http://www.albahari.com/nutshell/linqbridge.html Linq is several different things, and I'm not 100% sure which bits you want, but the above might be useful in some way. If you don't already have a book on Linq (I guess you don't), then I found "Linq In Action" to be be good.
If you're looking for high performance, you are going to want to avoid paging completely, so the page file size becomes less significant. Invest in as much RAM as feasible for the DB server.
Copy some simple code line by line and get them to read and interpret it as they go along. They will soon work it out. I started programming on an Acorn Electron with snippets of code from Acorn magazines. I had no idea about programming when I was 6, I used to copy the text, but gradually I learnt what the different words meant.
I would recommend in first teaching the very basics that are used in almost every language, but doing so without a language. Outline all the basic concepts If-Else If-Else, Loops, Classes, Variable Types, Structures, etc. Everything that is the foundation of most languages. Then move onto really understanding Boolean, comparisons and complex AND OR statements, to get the feeling on what the outcomes are for more complex statements. By doing it this way he will understand the concepts of programming and have a much easier time stepping into languages, from there its just learning the intricate details of the languages, its functions, and syntax.
If I understand you correctly, the idea is to get a different "singleton" object for each caller object or "context". One thing you can do is to create a thread-local global variable where you write the ID of the current context. (This can be done with AOP.) Then in the singleton getter, the context ID is fetched from the thread-local to use as a key to the correct "singleton" instance for the calling context. Regarding AOP there should be no problem using it in applets since, depending on your point-cuts, the advices are woven at compile time and a JAR is added to the runtime dependencies. Hence, no special evidence of AOP should remain at run time.
Sometimes you might find yourself working on a team where #regions are encouraged or required. If you're like me and you can't stand messing around with folded code you can turn it off outlining for C#: 1. Options -> Text Editor -> C# -> Advanced Tab 2. Uncheck "Enter outlining mode when files open"
Sometimes you might find yourself working on a team where #regions are encouraged or required. If you're like me and you can't stand messing around with folded code you can turn off outlining for C#: 1. Options -> Text Editor -> C# -> Advanced Tab 2. Uncheck "Enter outlining mode when files open"
According to Visa's "Card Acceptance and Chargeback Management Guidelines for Visa Merchants"; "Good Thru" (or "Valid Thru") Date is the expiration date of the card. It is located below the embossed account number. **If the current transaction date is after the "Good Thru" date, the card has expired.**
So you're using a DOM method to create a `script` element and append that to an existing element and this then causes the content of the appended `script` element to execute? That sounds good. You say that the script tag is part of a larger HTML page and therefore cannot be singled out. Can you not give the script tag an ID and target it? I'm probably missing something obvious here.
This might be helpful: WindowsIdentity myIdentity = WindowsIdentity.GetCurrent(); WindowsPrincipal myPrincipal = new WindowsPrincipal(myIdentity); string name = myPrincipal.Identity.Name; string authType = myPrincipal.Identity.AuthenticationType; string isAuth = myPrincipal.Identity.IsAuthenticated.ToString(); string identName = myIdentity.Name; string identType = myIdentity.AuthenticationType; string identIsAuth = myIdentity.IsAuthenticated.ToString(); string iSAnon = myIdentity.IsAnonymous.ToString(); string isG = myIdentity.IsGuest.ToString(); string isSys = myIdentity.IsSystem.ToString(); string token = myIdentity.Token.ToString(); Disclaimer: I got this from a technet article, but I can't find the link.
Why can't you just do something like List GetKRandomFromList(List input, int k) List ret = new List(); for(i=0;i<k;i++) ret.Add(input[Math.Rand(0,input.Length)]); return ret; I'm sure that you don't mean something that simple so can you specify further?