instruction stringlengths 0 30k ⌀ |
|---|
I would like to wipe out all data for a specific kind in Google App Engine. What is the
best way to do this?
I wrote a delete script (hack), but since there is so much data is
timeout's out after a few hundred records. |
convert the timestamp to HEX. That will generate a shorter alphanumeric number for you out of the timestamp.
|
What about
$rows = $db->fetchAll('select a, b FROM y WHERE a IN (2, 0) ORDER BY a DESC');
if(count($rows) > 0) {
$a = $rows[0]['a'];
$i = 0;
while($rows[$i]['a'] === $a) {
echo $rows[$i++]['b']."\n";
}
}
One query, but overhead if there are a lot of 'zero' values... |
Is this any use:
[http://downloads.techrepublic.com.com/5138-9592-6028761.html][1]
[1]: http://downloads.techrepublic.com.com/5138-9592-6028761.html
NB Registration is required |
The first option you describe is essentially a pessimistic locking model whilst the second is an optimistic model.
Which one to choose really comes down to a number of factors but essentially boils down to how the business wants to work. For example, would it unduly inconvenience the users if a document they needed to... |
> You could also decorate s_Initialized with the volatile keyword and forego the use of lock entirely.
That is not correct. You will still encounter the problem of a second thread passing the check before the first thread has had a chance to to set the flag which will result in multiple executions of the initialisat... |
It would be hard to argue either way given the needs you outlined, that either would shine over the other.
What I will say is this:
1. You say you are already familar with SSExpress, then that is a good reason to stick with it
2. IMHO the tools with SSExpress are superior and easier to use than the Oracle equiv... |
Sorry, no link, but one advice. Because we support Oracle and SQL Server, I know that getting fixes for the 'normal' Oracle database, is not something what I call fun. You have to pay for it, and if you have no tool which updates your Oracle system for you, it's a pain in the a.., if you ask me. Check out how the Oracl... |
Both of KiwiBastard's points are very good and I completely agree with him.
If you really want a free alternative that is similar to MS SQL and supports growth should you need it, you could have a look at MySQL or PostgreSQL. SQLite also seems a good choice.
Surely you can afford an old Linux server if you work in ... |
Since FlexBuilder essentially is an extended version of Eclipse, any tools/scripts for doing the same in Eclipse should work for FlexBuilder aswell. I couldn't find any tools like this googling it, have you considered doing away with FlexBuilder completely, there are plenty of guides for using the mxmlc (or fcsh) compi... |
Calculate DateTime Weeks into Rows |
There isn't really a good algorithm for this. You can use this basic construct to find an unused id:
int id;
do {
id = generateRandomId();
} while (doesIdAlreadyExist(id));
doSomethingWithNewId(id); |
Cant you use HTML to make it work? |
If this is something you'll need to do often you will probably want to maintain a live (non-db) data structure to help you quickly answer this question. A 10-way tree would be good. When the app starts it populates the tree by reading the keys from the db, and then keeps it in sync with the various inserts and deletes ... |
Is Java Script really the right language for your game?
Many of games out there are using the [LUA][1] programming language for scripting. It's easy to integrate, it's very small, it compiles on almost every platform and it's easy to learn.
This somewhat off topic, but thinking outside the box can be important to g... |
You may take a look at Apache Chainsaw. This nifty tool allows Log incomes from nearly everyqhere and has live filtering and colering. If you have an already written Log, I'm not sure if it can read it, it's been a while since I used it last time (was very usefull for the prototyping phase of our JBoss server) |
Statefulness runs counter to the basic architecture of HTTP (ask Roy Fielding), and reduces scalability. |
JQuery create select list options from JSON, not happening as advertised? |
|javascript|jquery|html-select|drop-down-menu| |
How come this doesn't work (operating on an empty select list `<select id="requestTypes"></select>`
$(function() {
$.getJSON("/RequestX/GetRequestTypes/", showRequestTypes);
}
);
function showRequestTypes(data, textStatus) {
... |
In Outlook 2007 there is functionality to [create polls (Voting)][1] which may satisfy your needs:
> This feature requires you to use a Microsoft Exchange Server 2000, Exchange Server 2003, or Exchange Server 2007 account.
A demonstration is provided [here][2].
[1]: http://office.microsoft.com/en-us/outloo... |
I really like the <a href="http://xstream.codehaus.org/">XStream</a>
library. It does a really good job of outputting fairly simple xml
as a result of a provided Java object. It works great for reproducing
the object back from the xml as well. And, one of our 3rd party libraries
already depended on it anyway.
... |
most decent firewall programs should allow you to access this information. I know that Agnitum OutpostPro Firewall does. |
I strongly suggest installing your own perl in your own home directory, if you have space. Then you can keep everything under your control and keep your own module set, as well as escaping if the admins are keeping you on an older version of perl. (Not to mention preserving yourself if they upgrade some day and leave... |
At a command line, netstat -a will give you lots o' info. |
Windows comes with the <code>netstat</code> utility, which should do exactly what you want. |
Indeed, you can use C# 3.0 compiler features when targeting .NET 2.0, except extension methods and default LINQ implementations, which are located in newer assemblies. But if you need to co-operate with VS2005 users, you can open Properties view for a given project (not Project Properties, but Edit \ Properties Window,... |
>>> list("Word to Split")
['W', 'o', 'r', 'd', ' ', 't', 'o', ' ', 'S', 'p', 'l', 'i', 't']
|
CF stands for "Compression Factor". CF-10 means factor ten, and I don't think it's different from any "standard" jpeg. |
I believe you are looking for the `fieldset` HTML tag, which you can then style with CSS. E.g.,
<fieldset style="border: 1px black solid">
<legend style="border: 1px black solid;
margin-left: 1em; padding: 0.2em 0.8em ">title</legend>
Text within the box <br />
Etc
</fieldset>
|
You might want to try this if it's to allow your site's visitors to scan stuff, I think it's embeddable in your own site, but I've never used it : http://en.barcodepedia.com/ |
If you feel like syncing to the cloud and don't mind the initial, beta, 2GB cap, I've fallen in love with [Dropbox][1].
It has versions for Windows, OSX, and Linux, works effortlessly, keeps files versioned, and works entirely in the background based on when the files changed (not a daily schedule or manual activati... |
from [http://www.pixy.cz/blogg/clanky/css-fieldsetandlabels.html][1]
<form>
<fieldset>
<legend>Subscription info</legend>
<label for="name">Username:</label>
<input type="text" name="name" id="name" />
<br />
<label for="mail">E-mail:</label>
<input type... |
Sometimes you want to hide the implementation details of a method or improve
the level of abstraction of a problem so that it’s more meaningful to the caller
of a method. To do this, you can intercept the original exception and substitute
a custom exception that’s better suited for explaining the problem.
Take fo... |
Scriptaculous not working with the latest Prototype. |
|javascript|prototype|js|scriptaculous| |
This is a really weird problem that I have been having. When I download Scriptaculous from the official web site, [script.aculo.us][1], bundled in the ZIP is prototype.js version 1.6.0.1. This works perfectly fine, I can follow along the wiki examples and begin learning. However, when I upgrade to prototype 1.6.0.2 (th... |
|javascript|prototype|scriptaculous| |
Don't just use a standards compliant browser, use other tools such as the [w3c validator][1].
[1]: http://validator.w3.org/ |
Sometimes you need to use 16 pixel boundaries rather than 8 because of subsampling; every 2nd pixel is thrown away during the encoding process, and those 8x8 DCT blocks started out as 16x16 and will decode back to 16x16. This won't be a problem at the highest quality settings.
|
Functions are always executed in the scope they are defined in, as are methods and class bodies. They are never executed in another scope. Because importing is just another assignment statement, and everything in Python is a reference, the functions, classes and modules don't even know where they are imported to.
Yo... |
If you do not care for actual discussions (which tend to go offtopic and do not offer authoritative response), you can choose some library that will make your tast easier. I'd recomment taking a look at [ll-xist](http://www.livinglogic.de/Python/Download.html), this library contains large amount of life-saving code, li... |
What [Tometzky](http://stackoverflow.com/questions/74892/is-there-a-quality-file-size-or-other-benefit-to-jpeg-sizes-being-multiples-of#84213) said. If you don't have the correct multiple, the lossless flip and rotate algorithms don't work. That's because the padding on the right/bottom that can be safely ignored now... |
What [Tometzky](http://stackoverflow.com/questions/74892/is-there-a-quality-file-size-or-other-benefit-to-jpeg-sizes-being-multiples-of#84213) said. If you don't have the correct multiple, the lossless flip and rotate algorithms don't work. That's because the padding on the right/bottom that can be safely ignored now... |
The substring returns the value with the first two characters skipped, the padleft pads the result with leading zeros:
string s = "2014";
MessageBox.Show(s.Substring(2).PadLeft(2, 'x')); //14
string s2 = "14";
MessageBox.Show(s2.Substring(2).PadLeft(2, 'x')); //xx
My guess is ... |
Under Linux, see the man page for tcp(7).
It appears that you can get the number of untransmitted bytes by ioctl(sock,SIOCINQ ...
Other stats might be available from members of the structure given back by the TCP_INFO getsockopt() call.
|
String.Format("{0:n}", 1234); |
string.format("{0:#,###,###.##}", MyNumber)
That will give you commas at the thousand, and millions point. |
One reason against 'chaining' is the [Law of Demeter][1] which would suggest that your code is fragile in the face of changes to LookupCodeDataTable.
You should add a function like this:
function getMeaning( lookupCode as LookupCodeDataTable)
getMeaning=lookupCode.Item(0).Meaning
end function
and ... |
If you just have to compare values you can use something like:
protected bool CharEnumEqualsCharObj(TransactionStatus enum_status, object obj_status) {
return (char)enum_status == (char)obj_status;
}
|
I should be as simple as running this:
mysql -u<user> -p < db_backup.dump
If the dump is of a single database you may have to add a line at the top of the file:
using <database-name-here>;
If it was a dump of many databases, the using statements are already in there.
To run these commands, open ... |
Best practictes for configuring Apache / Tomcat |
|apache|tomcat|mod-proxy|jboss|java| |
We are currently using Apache 2.2.3 and Tomcat 5 (Embedded in JBoss 4.2.2) using `mod_proxy_jk` as the connector.
Can someone shed some light on the the correct way to calculate / configure the values below (as well as anything else that may be relevant). Both Apache and Tomcat are running on separate machines and ... |
You can use the 'netstat' command for this. There's a description of doing this sort of thing [here][1].
[1]: http://www.petri.co.il/quickly_find_local_open_ports.htm |
Indices are created in an existing table to locate rows more quickly and efficiently. It is possible to create an index on one or more columns of a table, and each index is given a name. The users cannot see the indexes, they are just used to speed up queries.
Basically, your DBMS will create some sort of tree struc... |
find -L .
From the find manpage:
-L Follow symbolic links.
If you find you want to only follow a *few* symbolic links (like maybe just the toplevel ones you mentioned), you should look at the -H option, which only follows symlinks that you pass to it on the commandline. |
Using ls:
ls -LR
from 'man ls':
-L, --dereference
when showing file information for a symbolic link, show informa‐
tion for the file the link references rather than for the link
itself
Or, using find:
find -L .
From the find manpage:
... |
Another option is to switch between inline and non inline functions based on your build, using .inl files, like this:
in foo.inl file:
inline std::string Foo::ThisMethodDoesNotRun()
{
return "Not Running";
}
in foo.h:
#if !COVERAGE_BUILD
#include "foo.inl"
#endif
in f... |
Maven would be a good fit for your project IMO. Maven is an all around build and deployment management tool. It's biggest strength is that it makes build scripts significantly eaiser to maintain than functionally comparable Ant files or shell scripts.
There are a lot of advantages to using maven the biggest being ... |
Maven would be a good fit for your project IMO. Maven is an all around build and deployment management tool. It's biggest strength is that it makes build scripts significantly eaiser to maintain than functionally comparable Ant files or shell scripts.
There are a lot of advantages to using maven the biggest being ... |
I've seen this done so many times before via brute force, using random number generators, and it's always a bad idea. Generating a random number outside of the db and attempting to see if it exists will put a lot strain on your app and database. And it could lead to 2 processes picking the same id.
Your best option ... |
Gentoo doesn't exactly "prompt" for packages. The network CD will get you a small base system, then it's up to you to set everything else you need up yourself. This is one of the positive and negative things about Gentoo. |
Rather than think of it as one big number, try breaking it down and looking for associated ideas eg:
- 2 maximum snooker breaks (a maximum break is 147)
- 4 years (48 months)
- 3 years (36 months)
- 4 years (48 months)
The above applies to the biggest negative number; positive is that minus one.
Maybe the a... |
Don't have shared ownership. If you do, make sure it's only with code you don't control.
That solves 100% of the problems, since it forces you to understand how everything interacts.
MSN |
It is probably a bad idea to scan every value in that table every time looking for a unique value. I think the way to do this would be to have a value in another table, lock on that table, read the value, calculate the value of the next id, write the value of the next id, release the lock. You can then use the id you r... |
What are the extents of the meaning of "distributing" under the LGPL license? |
|licensing|software-distribution|lgpl| |
This question is a follow up on one of my other questions, [Can I legally Incorporating GPL & LGPL, open-sourced software in a proprietary, closed-source project?][1]
Many of the conditions of the [LGPL license][2] are based on the notion of distribution. My company does business as a consultant. We are contracted t... |
By default, jQuery selectors return the jQuery object. Add this to get the DOM element returned:
var dropdownList = $("#requestTypes")[0]; |
You can create a custom form within outlook that contains the controls you want. Use that form when creating a new email message. That will work. |
This will give you what you want
<head>
<title></title>
<style type="text/css">
legend {border:solid 1px;}
</style>
</head>
<body>
<fieldset>
<legend>Test</legend>
<br /><br />
</fieldset>
</body> |
Why not use swing and java? It is quite cross platform, and looks reasonable for form apps. If you squint a bit and ignore the java, its quite pleasant - or alternatively, use one of them dynamic languages on the JVM (Groovy http://groovy.codehaus.org/GUI+Programming+with+Groovy is my recommended one). |
All your different Make->find() and Model->find() calls are completely independent of each other. Even Make->Model->find() is the same as Model->find(), Cake does not in any way remember or take into account what you have already found in other models. What you're looking for is something like:
$this->Product->f... |
Why Re-throwing Exceptions? |
|exception| |
I've seen the following code many times:
try
{
... // some code
}
catch (Exception ex)
{
... // Do something
throw new CustomException(ex);
// or
// throw;
// or
// throw ex;
}
Can you please explain the purpose of re-... |
|exception|language-agnostic| |
Why Re-throw Exceptions? |
|language-agnostic|exception| |
Just an update:
I decided that Josh's point on data usage was a very good one.
People are unlikely to keep viewing page 50 of a forum.
Based on this model, I decided to cache the 90 latest threads in each forum. In the fetching function I check the limit and offset to see if the specified slice of threads is withi... |
Try:
s = "Word to Split"
wordlist = list(s)
wordlist
That should give you what you need (['W','o','r','d',' ','t','o',' ','S','p','l','i','t']).
|
The list function will do this
>>> list('foo')
['f', 'o', 'o']
|
Some good warning stated already here.
I'll just add that speaking of SIN (Canada's Social Insurance Number) codes, I believe it's possible to have collisions between a SIN and a SSN (in other words the same number, but two different people/countries). It shouldn't be a surprise since these are separate codification... |
How frequently do you write to the table vs. reading from it. If you have frequent writes and occasional reads, consider just always doing inserts and then handle collapsing the values when doing a select.
If you're trying to put everything in one table, consider breaking them out into separate tables to cut down o... |
The garbage collector will handle any managed resources. In your example, the brush will be cleaned up when the garbage collector decides to, which will happen some time after the last reference to the brush is no longer valid.
There are certain things that need to be manually cleaned up, but those are pointers retr... |
A good error message should:
- Be unobtrusive (no blue-screen or yellow-screen of death)
- Give the user direction to correct the problem (on their own if possible, or who to contact for help)
- Hide useless, esoteric programmer nonsense ( don't say, "a null reference exception occurred on line 45")
- Be ... |
It's taking 1 second to do an indexed lookup on a 350k-row table? That sounds really rather unnecessarily slow to me.. Are you sure there isn't something else wrong? |
Check out this book, (http://www.apress.com/book/view/9781590598542) it gives many different scenarios, including emailing reports, report generation service, etc. Its regarding client side reporting, but it applies equally well to server side (design side anyways). this may have its advantages doing it client side (or... |
How do I rotate an image at 12 midnight every day? |
|js|rotate| |
I need to rotate an image at 12 midnight every day from a group of 5-10 images. How can I go about doing this with javascript or jquery or even php? |
|javascript|php|jquery| |
It depends on your needs and programming style. But one of the benefits of `namespace` is to help partition name space (hence the name). With a single namespace, as your project is increases in size and complexity, so does the likelihood of name-collision.
If you're writing code that's meant to be shared or reused... |
Well, as long as you use the managed version of the resources and don't call the windows APIs by yourself, you should be OK. Only worry about having to delete/destroy a resource when what you get is an IntPtr, as "windows handles" (and a whole lot other things) are known in .NET, and not an object.
By the way, the r... |
Best practices for configuring Apache / Tomcat |
|java|apache|tomcat|jboss|mod-proxy| |
I assume I really should not answer this one, but it's just too much fun.
Look at [This][1] page about SQL injections. That should cover your needs.
[This][2] page shows how to add user accounts to mySQL
[1]: http://en.wikipedia.org/wiki/Sql_injection
[2]: http://dev.mysql.com/doc/refman/5.0/en/adding-us... |
I assume I really should not answer this one, but it's just too much fun.
Look at [This][1] page about SQL injections. That should cover your needs.
[This][2] page shows how to add user accounts to mySQL
I would try entering the following in random user input fields:
p'; INSERT INTO user VALUES('localhos... |
I assume I really should not answer this one, but it's just too much fun.
Look at [This][1] page about SQL injections. That should cover your needs.
[This][2] page shows how to add user accounts to mySQL
I would try entering the following in random user input fields:
p'; INSERT INTO user VALUES
('localh... |