instruction stringlengths 0 30k ⌀ |
|---|
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 perf... |
You may also be interested in using joins on updates, which is possible as well.
Update someTable Set someValue = 4 From someTable s Inner Join anotherTable a on s.id = a.id Where a.id = 4
-- Only updates someValue in someTable who has a foreign key on anotherTable with a value of 4.
Edit: If the values ... |
Acceptable for invalid XHTML? |
|xhtml|markup| |
I've noticed a lot of sites, SO included, use XHTML as their mark-up language and then fail to adhere to the spec. Just browsing the source for SO there are missing closing tags for paragraphs, invalid elements, etc.
So should tools (and developers) use the XHTML doctype if they are going to produce invalid mark up?... |
UPDATE tableName SET col1='000' WHERE id='3' OR id='5'
This should achieve what you'r looking for. Just add more id's. I have tested it. |
It depends. I had that [issue with my blog][1] where a YouTube video caused invalid XHTML, but it rendered fine. On the other hand, I have a "Valid XHTML" link, and a combination of a "Valid XHTML" claim and invalid XHTML is not professional.
As SO does not claim to be valid, I think it's acceptable, but personally ... |
This doesn't specifically answer your question, because I'm not sure in any clients exist in OSX, but I generally just Remote Desktop into the server and work through that. Another option is VMWare Fusion (which is much better than Parallels in my opinion) + XP + SQL Server Management Studio. |
So long as it works in IE, FF, Safari, (insert other browser here) you should be okay. Validation isn't as important as having it render correctly in multiple browsers. Just because it is valid, doesn't mean it'll work in IE properly, for instance.
Run Google Analytics or similar on your site and see what kind of ... |
I wouldn't use XHTML at all just to save myself the philosophical stress. It's not like any browsers are treating it like XHTML anyway.
Browsers will reject poor mark-up if the page is sent as application/xhtml+xml, but they rarely are. This is fine.
I would be more concerned about things like inline use of CSS a... |
I say, if it renders OK, then it doesn't matter if it's pixel perfect.
It takes a while to get a site up and running the way you want it, going back and making changes is going to change the way the page renders slightly, then you have to fix *those* problems.
Now, I'm not saying you should built sloppy web page... |
Does anyone know of a web based IDE? |
|web-ide| |
Does anyone know of a web based IDE (Like VS, Eclipse, IDEA)?
Besides [ECCO][1]?
[1]: http://ecco.sourceforge.net/ |
The XmlSerializer or the DataContractSerializer in .net 3.x will do the job for you. |
I'd use [Reflection](http://java.sun.com/docs/books/tutorial/reflect/index.html), since I don't like the idea of changing the access to package on the declared method just for the sake of testing. However, I usually just test the public methods which should also ensure the the private methods are working correctly. |
I'd use [Reflection](http://java.sun.com/docs/books/tutorial/reflect/index.html), since I don't like the idea of changing the access to package on the declared method just for the sake of testing. However, I usually just test the public methods which should also ensure the the private methods are working correctly.
... |
Try **SOAP4R**
- [SOAP4R][1]
- [Getting Started with SOAP4R][2]
[1]: http://dev.ctor.org/soap4r
[2]: http://markthomas.org/2007/09/12/getting-started-with-soap4r/ |
Try **SOAP4R**
- [SOAP4R][1]
- [Getting Started with SOAP4R][2]
And I just heard about this on the Rails Envy Podcast (ep 31):
- [WS-Deathstar SOAP walkthrough ][3]
[1]: http://dev.ctor.org/soap4r
[2]: http://markthomas.org/2007/09/12/getting-started-with-soap4r/
[3]: http://hideoustriump... |
How do I loop through result objects in Flex? |
|apache-flex|actionscript-3|actionscript| |
I am having problems manually looping through xml data that is received via an HTTPService call, the xml looks something like this:
<pre>
<code>
<DataTable>
<Row>
<text>foo</text>
</Row>
<Row>
<text>bar</text>
</Row>
</D... |
The web application in question uses an Oracle database. The main functionality the application delivers is in reporting, where a user can get PDFs of reports at a high level and drill down to lower levels of supporting details.
As the number of supporting detail records has grown into the millions, the performance... |
How have you tackled web application performance improvement? |
My development team works on a web application (JSP reports, HTML, JavaScript) that uses an Oracle database (PL/SQL). The main functionality the application delivers is in reporting, where a user can get PDFs of reports at a high level and drill down to lower levels of supporting details.
As the number of supportin... |
What Strategies Have You Employed To Improve Web Application Performance? |
What strategies have you employed to improve web application performance? |
|performance|oracle-database|web-applications| |
My development team works on a web application (JSP reports, HTML, JavaScript) that uses an Oracle database (PL/SQL). The main functionality the application delivers is in reporting, where a user can get PDFs of reports at a high level and drill down to lower levels of supporting details.
As the number of supportin... |
Use the INSTR() function to find the position of the word in the string, and then use SUBSTRING() function to select a portion of characters before and after the position.
You'd have to look out that your SUBSTRING instruction don't use negative values or you'll get weird results.
Try that, and report back. |
An extension method? They're the answer to everything you know! ;)
public static class DateTimeExtensions
{
public static DateTime StartOfWeek(this DateTime dt, DayOfWeek startOfWeek)
{
int diff = dt.DayOfWeek - startOfWeek;
if (diff < 0)
{
diff += 7;
}
... |
A little more verbose and culture-aware:
System.Globalization.CultureInfo ci = System.Threading.Thread.CurrentThread.CurrentCulture;
DayOfWeek fdow = ci.DateTimeFormat.FirstDayOfWeek;
DayOfWeek today = DateTime.Now.DayOfWeek;
DateTime sow = DateTime.Now.AddDays(-(today - fdow)).Date; |
One might want to consider the use of an LDAP server in the place of a traditional SQL database if the application data is heavily key/value oriented and hierarchical in nature. |
on linux, you can look in the directory /proc/$PID to get information about that process. In fact, if the directory exists, the process is running. |
What are the endlines of you batch? If the code hangs on ReadLine, then the problem might be that it's unable to read the batch file… |
DateTime t = DateTime.Now;
t -= new TimeSpan ((int) t.DayOfWeek, t.Hour, t.Minute, t.Second);
Would give you midnight on the 1st Sunday of the week,
DateTime t = DateTime.Now;
t -= new TimeSpan ((int) t.DayOfWeek - 1, t.Hour, t.Minute, t.Second);
gives you the 1st Monday at midnight
|
Depends! ;)
For example there is [ADODB's Active Record implementation][1], then there is Zend_Db_DataTable and [Doctrine][2]. Those are the ones I know of, I am sure there are more implementations.
Out of those three I'd recommend Doctrine. Last time I checked Adodb carried a lot of extra weight for PHP4 and Zen... |
You can use [Zend Cache][1] to cache results of your queries among other things.
[1]: http://framework.zend.com/manual/en/zend.cache.html |
Whilst not strictly ActiveRecord, [Zend_Db_Table][1]
is pretty good.
[1]: http://framework.zend.com/manual/en/zend.db.table.html |
How to implement mouse dragging in Visual Basic? |
I would say that it depends: if you find that using Glade you can build the apps you want or need to make than that's absolutely fine. If however you actually want to learn how GTK works or you have some non-standard UI requirements you will **have** to dig into GTK internals (which are not that complicated).
Person... |
One of the issues with the resolving at run time is that you make it really hard for the opcode caches (like APC). Still, for now, doing something like you describe in your question is a valid way if you need a certain amount of indirection when instanciating stuff.
As long as you don't do something like
$cla... |
I've never heard of it, but [from their blog][1]:
> Aqua Connect Terminal Server uses the VNC (Virtual Network Computing) protocol to send data between Mac OS X and the client application.
Now, if someone *does* know of a non-VNC solution, I'd be happy to hear it.
[1]: http://www.aquaconnect.net/?p=170 |
If you want to maintain the order you can do something like this:
var unique = new List<T>();
var hs = new HashSet<T>();
foreach (T t in list)
if (hs.Add(t))
unique.Add(t);
Or the Linq way:
var hs = new HashSet<T>();
list.All( x => hs.Add(x) );
Otherwise just put ... |
If you don't care about the order you can just shove the items into a `HashSet`, if you *do* want to maintain the order you can do something like this:
var unique = new List<T>();
var hs = new HashSet<T>();
foreach (T t in list)
if (hs.Add(t))
unique.Add(t);
Or the Linq way:
... |
If you don't care about the order you can just shove the items into a `HashSet`, if you *do* want to maintain the order you can do something like this:
var unique = new List<T>();
var hs = new HashSet<T>();
foreach (T t in list)
if (hs.Add(t))
unique.Add(t);
Or the Linq way:
... |
|security|testing| |
How to Test Web Code |
|webdevelopment| |
Does anyone have some good hints for writing test code for database-backend development where there is a heavy dependency on state.
Specifically, I want to write tests for code that retrieve records from the database, but the answers will depend on the data in the database (which may change over time).
Do people ... |
|webdevelopment|testing|database| |
|database|testing|webdevelopment| |
Does anyone have some good hints for writing test code for database-backend development where there is a heavy dependency on state?
Specifically, I want to write tests for code that retrieve records from the database, but the answers will depend on the data in the database (which may change over time).
Do people ... |
How to Test Web Code? |
|database|testing| |
How can I detect if a browser is blocking an popup? |
|webdevelopment| |
Occasionally, I've come across a webpage that tries to pop open a new window (for user input, or something important), but the popup blocker prevents this from happening.
What methods can the calling window use to make sure the new window launched properly? |
|untagged| |
When is a file just a file? |
|bestpractices|webdevelopment| |
So, you're writing a web application and you have several areas of the site where the user can upload files. My basic working method for this is to store the actual file on the server, and have a database table that connects the stored filename to the record it relates to.
My question is this: Should there be a diff... |
I don't understand why everyone get caught up trying to make their websites fit the standard when some browsers sill have problems properly rendering standard code. I've been in web design for something like 10 years and I stopped double codding (read: hacking css), and changing stupid stuff just so I could put a butt... |
One more thing that i don't see in previos answers:
In Java the primitive wrappers classes like Integer, Double, Float, Boolean... and String are suposed to be invariant, so that when you pass an instance of those classes the invoked method couldn't alter your data in any way, in oposición with most of other classes, ... |
There are so many standards and they are so badly "enforced" or supported that I don't think it matters. Don't get me wrong, I think there should be standards but because they are not enforced, nobody follows them and it's a massive downward spiral. |
Yes, that's possible - you can use INSERT ... ON DUPLICATE KEY UPDATE.
Using your example:
INSERT INTO table (id,Col1,Col2) VALUES (1,1,1),(2,2,3),(3,9,3),(4,10,12)
ON DUPLICATE KEY UPDATE Col1=VALUES(Col1),Col2=VALUES(Col2); |
Though I believe in striving for valid XHTML and CSS, it's often hard to do for a number of reasons.
- First, some of the content could be loaded via AJAX. Sometimes, fragments are not properly inserted into the existing DOM.
- The HTML that you are viewing may not have all been produced in the same document. F... |
For 99.999% of the sites out there, it really won't matter. The only time I've had it matter, I ran the HTML input through HTMLTidy to XHTML-ize it, and then ran my processing on it.
Pretty much, it's the old programmer's axiom: trust no input. |
[UNION][1] should be your friend:
SELECT Column1 FROM table WHERE idColumn = 1
UNION ALL
SELECT Column2 FROM table WHERE idColumn = 1
UNION ALL
SELECT Column3 FROM table WHERE idColumn = 1
but it can [also be your foe][2] on large result sets.
[1]: http://msdn.microsoft.com/en-us/li... |
We have a very similar setup to the OP.
Developers develop in VM's with private DB's.
[Developers will soon be committing into private branches]
Testing is run on different machines ( actually in in VM's hosted on a server)
[Will soon be run by Hudson CI server]
Test by loading the reference dump into the... |
Just an idea, but couldn't you use Regex to quickly strip out the characters and then compare against that like @Matt Hamilton suggested?
Maybe even set up a view (not sure of mysql on views) that would hold all phone numbers stripped by regex to a plain phone number? |
Before you head down this road towards your own eventual insanity, you should take a look at this (or one day repeat it):
http://thedailywtf.com/Articles/The-Mythical-Business-Layer.aspx
Persisting objects in a database is not a good idea. It kills all the good things that a database is designed to do. |
Also, have a look at [Attached Events][1] and see if you can attach your event to every Page in your app. Might be easier than a custom intermediary class.
[1]: http://msdn.microsoft.com/en-us/library/bb613550.aspx |
[Heroku][1] - Ruby on Rails (RoR)
[AppJet][2] - Javascript
[CodeIDE][3] - Multi-Language
[1]: http://heroku.com/
[2]: http://appjet.com/
[3]: http://www.codeide.com/ |
Saving Perl Windows Environment Keys UPCASES them |
|perl|hash|key|env| |
I have a framework written in Perl that sets a bunch of environment variables to support interprocess (typically it is sub process) communication. We keep a sets of key/value pairs in XML-ish files. We tried to make the key names camel-case somethingLikeThis. This all works well.
Recently we have had occasion to... |
- Any personal experience in overcoming web application performance hurdles?
- Any recommended strategies for improving the performance of a data-driven web application?
My development team works on a web application (JSP reports, HTML, JavaScript) that uses an Oracle database (PL/SQL). The key functionality th... |
[ASP.NET ERROR] The request was aborted: Could not create SSL/TLS secure channel. |
|asp.net|https|web-application| |
I'm posting this on behalf of a co-worker.
He gets a "The request was aborted: Could not create SSL/TLS secure channel" error while using a WebRequest object to make an HTTPS request. Th funny thing is that this only happens after a while, and is temporarily fixed when the application is restarted, which suggests th... |
|asp.net|web-applications|https| |
ASP.Net: why is my button's click/command events not binding in a repeater? |
|asp.net|vb.net|.net-2.0|repeater|button| |
Here's the code from the ascx that has the repeater:
<asp:Repeater ID="ListOfEmails" runat="server" >
<HeaderTemplate><h3>A sub-header:</h3></HeaderTemplate>
<ItemTemplate>
[Some other stuff is here]
<asp:Button ID="removeEmail" runat="server" Text="X" ToolTip="remove" />
</ItemTe... |
|user-controls|drag-and-drop|vb| |
I need to create a quick-n-dirty knob control in Visual Basic 2005 Express, the value of which is incremented/decremented by "grabbing" it with the mouse and moving the cursor up/down. Because the knob itself doesn't move, I need to keep tracking the mouse movement outside of the rectangle of the control.
I use a La... |
listing items and displaying the data on one of the items. |
|asp.net|3.5| |
I use asp.net 3.5 and have also begun looking at 3.5 sp1
I like the clean urls that mvc tends to have but use asp.net webforms for my primary development. I normally use a url rewriter in order to accomplish this type stuff. When I say clean urls I mean like /products to get a list of products and /products/Product_... |
Listing Items and Displaying Data Inline |
|asp.net|.net-3.5| |
I use asp.net 3.5 and have also begun looking at 3.5 sp1
I like the clean urls that mvc tends to have but use asp.net webforms for my primary development. I normally use a url rewriter in order to accomplish this type stuff. When I say clean urls I mean like /products to get a list of products and /products/Product_... |
I would go with your first solution. This allows the user to focus on entering their credit card details.
You can then transfer them to another webpage which asks or provides them further information relating to the Google Map. |
If you have a fixed set of columns and you know what they are, you can basically do a series of subselects
`(SELECT Column1 AS ResultA FROM TableA) as R1`
and join the subselects. All this in a single query. |
while I agree with the sentiment of "if it renders fine then don't worry about it" statement, however it's good for follow a standard, even though it may not be fully supported right now. you can still use Table for layout, but it's not good for a reason. |
NetBeans is definitely recommended if you like IDEs. It has a lot of [Ruby features](http://www.netbeans.org/features/ruby/index.html) and there's a [Ruby only](http://download.netbeans.org/netbeans/6.1/final/) download. |
i can be wrong because i'm autodidact, but i NEVER user public properties in my Java clases, they are allways private or protected, so that outside code must access by getters/setters. it's better for mainteance / modification purposes. And for inside class code... if getter method is trivial i use the property directl... |
Block user access to internals of a site using HTTP_REFERER |
|security|apache|mod-rewrite|http-referer| |