instruction stringlengths 0 30k ⌀ |
|---|
We already had this [discussion](http://stackoverflow.com/questions/24451/goto-usage) and I stand by [my point](http://stackoverflow.com/questions/24451/goto-usage#24475).
Furthermore, I'm fed up with people describing higher-level language structures as “`goto` in disguise” because they clearly haven't got the poin... |
- F4 in windows explorer to access the location bar trivially.
- RMenuKey (usually next to the right-hand windows key) + W + F - create a new folder in explorer. |
Repeat CTRL + ALT + DEL Twice! |
Building Apps for Motorola Cell Phone |
|java|mobile-phones| |
I have an L6 phone from motorola, a usb cable to connect it to my computer, and the Tools for Phones software so I can do things like upload my own custom ringtones or download pictures from the phone's camera.
I have some ideas for programs I'd like to run on the phone, and it supports java, but I don't see anythin... |
SharePoint stream file for preview |
|asp.net|sharepoint|ssl|binary|streaming| |
I am looking to stream a file housed in a SharePoint 2003 document library down to the browser. Basically the idea is to open the file as a stream and then to "write" the file stream to the reponse, specifying the content type and content disposition headers. Content disposition is used to preserve the file name, con... |
To add: the foremost reason for unarchiving failure is forgetting "return self;" from the -init of a custom class. It hurts a lot :( |
As I understood you need to know how to set a value to the registry during runtime. I hope the codes bellow can help you.
using Microsoft.Win32;
/// <summary>
/// store a key value in registry. if it don't exist it will be created.
/// </summary>
/// <param name="mainKe... |
I need to create an Aggregate Field in a TClientDataSet, but as said in the docs:
> Choose OK. The newly defined aggregate
> field is automatically added to the
> client dataset and its Aggregates
> property is automatically updated to
> include the appropriate aggregate
> specification.
When I add a new agg... |
I need to create an Aggregate Field in a TClientDataSet, but as said in the docs:
> Choose OK. The newly defined aggregate
> field is automatically added to the
> client dataset and its Aggregates
> property is automatically updated to
> include the appropriate aggregate
> specification.
When I add a new agg... |
Best Solution For Authentication in Ruby on Rails |
|ruby|rubyonrails| |
I'm looking for a pre-built solution I can use in my RoR application. I'm ideally looking for something similar to the ASP.NET Forms authentication that provides email validation, sign-up controls, and allows users to reset their passwords. Oh yeah, and easily allows me to pull the user that is currently logged into ... |
|ruby|ruby-on-rails|authentication| |
The 'D' language was designed as a successor to C++. A purely functional subset of D is being developed by Andrei Alexandrescu for D 2.0. I am guessing D interoperates well with C++. |
I haven't tried it yet but you could make an extension method for what you want. I wouldn't do it, but I think it would work.
Also I find String.Format() false more in line with other patterned static methods like Int32.Parse(), long.TryParse(), etc. |
I haven't tried it yet but you could make an extension method for what you want. I wouldn't do it, but I think it would work.
Also I find String.Format() false more in line with other patterned static methods like Int32.Parse(), long.TryParse(), etc.
You cloud also just use a StringBuilder if you want a non stat... |
I've listened to Mark Miller on a couple of podcasts and really liked him so I tried to like Coderush too. I also tried [Visual Assist X][1] from Whole Tomato Software.
In my opinion none of the above could measure up to [Resharper][2] from Jetbrains. The others have many great features but Resharper is in a cla... |
In addition to Resharper I've tried both Coderush and [Visual Assist X][1] from Whole Tomato Software.
In my opinion none of the above could measure up to [Resharper][2] from Jetbrains which I decided to go for. The others have many great features but Resharper is in a class of it's own. IMHO Coderush looks coole... |
Create a variable in .CSS file for use within that .CSS file |
|css| |
We have some "theme colors" that are reused in our CSS sheet.
Is there a way to set a variable and then reuse it?
E.g.,
.css
OurColor: Blue
{ H1
color:OurColor;
} |
CSS doesn't offer any such thing. The only solution is to write a preprocessing script that is either run manually to produce static CSS output based on some dynamic pseudo-CSS, or that is hooked up to the web server and preprocesses the CSS prior to sending it to the client. |
[Database Normalization][1], and a giving a good thought to indexes, are two things that you just can't miss. Especially if you consider a game, where SELECTS happen much more frequently than UPDATEs.
For the long run, you should also take a look at [memcached][2], as database querys can be the bottleneck whenever y... |
In reference to Xian's answer, there's also the :first-child pseudo-element. Rather than having first-in-row class, you'd have this.
span:first-child {
width: auto;
}
Obviously, this is only applicable to a single line menu.
|
Since CSS does not have that (yet, I believe the next version will), follow Konrad Rudolphs advice for preprocesing. You probably want to use one that allready exists: m4
http://www.gnu.org/software/m4/m4.html |
I don't think you can execute JavaScript code embedded inside XML documents. Like, helios mentioned, you can preform the transformation using JavaScript.
JavaScript is embedded as CDATA in most cases, which is usually used **after** the XSL transformation has taken place. If I understand correctly, you want to have ... |
What I usually do (in pseudo):
abstract class:
private const string nameConstant = "ABSTRACT";
public string Name
{
get {return this.GetName();}
}
protected virtual string GetName()
{
return MyAbstractClass.nameConstant;
}
----
... |
This might be near to what you're looking for:
http://python.net/crew/theller/ctypes/ |
[Helping the YUI Compressor](http://yuiblog.com/blog/2008/02/11/helping-the-yui-compressor) gives some good advice on how you can tweak your scripts to achieve even better savings. |
Not very short, but effective! (JavaScript)
setTimeout(1, function() {while(1) a=1;}); |
How do I stub data for designers when using Expression Blend and Visual Studio? |
|wpf|expression-blend|xaml| |
We are trying out Visual Studio 2008 and Expression Blend on a new project. The goal is to clearly define the role of the developer and designer as separate, but reap the benefit of the developer being able to directly consume the XAML produced by the designer.
For the most part this has worked great, and I really l... |
php is_dir returns true for non-existent folder |
|php| |
Has anyone encountered this oddity?
I'm checking for the existence of a number of directories in one of my unit tests. <code>is_dir</code> is reporting true (1) in spite of the folder not existing at the time it is called. Code looks like this (with a few extraneous intermediate vars to ease debugging):
forea... |
How do you discard unstaged changes in git? |
|git| |
If some changes are added to the index and there are some changes that are not added to the index, how do I discard the changes in my working copy that are not added to the index yet? |
The pdb contains information the debugger needs in order to correctly read the stack. Your stack traces will contain line numbers and symbol names of the stack frames inside of the modules for which you have the pdb.
I'll give two usages examples. The first is the obvious answer. The second explains source-indexe... |
I've also run into differences between FF3 on WinXP and FF3 on OS X (mostly with CSS positioning). The CSS and HTML both validated properly, but I was never able to figure out why there was this difference. I would think that the rendering engine would be the same, but apparently there are at least a few subtle diffe... |
I really don't have a problem with using #region to organize code. Personally, I'll usually setup different regions for things like properties, event handlers, and public/private methods. |
In my work place we've set up a post-commit hook that generates RSS feeds that are displayed in various dash boards and are used for code reviewers to know when it is time to review and for us to see that new employees are committing enough. |
Why is Array.Length an int, and not an uint |
|c#|.net| |
Why is Array.Length an int, and not an uint. This bothers me (just a bit), because a length value can never by negative.
This also forced me to use an int for a length-property on my own class, because when you
specify an int-value, this needs to be cast explicity...
So the ultimate question is: is there any u... |
Looks like you've got some good answers here.
For those of you looking to handle your own CSV file parsing, heed the advice from the experts and [Don't roll your own CSV parser][1].
Your first thought is, _"I need to handle commas inside of quotes."_
Your next thought will be, _"Oh, crap, I need to handle quot... |
Here's a (perhaps suboptimal) python implementation:
input = 'a,"string, with",various,"values, and some",quoted'
# in case the input starts with a quote...
quoted_mod = int(not input.startswith('"'))
# first pass
input = input.split('"')
for i in range(len(input)):
if i %... |
Here's a simple algorithm:
1. Determine if the string begins with a '"' character
2. Split the string into an array delimited by the '"' character.
3. Mark the quoted commas with a placeholder #COMMA#
* If the input starts with a '"', mark those items in the array where the index % 2 == 0
* Otherwise mark th... |
I've been very happy with [E][1]. It's pretty lightweight and supports TextMate snippets and commands, which means you get access to a huge set of Rails-specific helpers.
However, it is decidedly an editor and not an IDE, so you won't get debugging, built in console, etc. But I've found that for Rails projects I pre... |
You're not the first to wonder and the answer is no. Elliotte has a nice rant on it: [http://cafe.elharo.com/web/css-repeats-itself/][1]. You could use JSP, or its equivalent, to generate the CSS at runtime.
[1]: http://cafe.elharo.com/web/css-repeats-itself/ |
@shs
yes, that select last(value) SHOULD work, but it doesn't... My understanding although I can't produce an authorative source is that the last(value) gives the last physical record in the access file, which means it could be the first one timewise but the last one physically. So I don't think you should use las... |
I can only recall using a goto once. I had a series of five nested counted loops and I needed to be able to break out of the entire structure from the inside early based on certain conditions:
for{
for{
for{
for{
for{
if(stuff){
GOTO ENDOFL... |
I can only recall using a goto once. I had a series of five nested counted loops and I needed to be able to break out of the entire structure from the inside early based on certain conditions:
for{
for{
for{
for{
for{
if(stuff){
GOTO ENDOFL... |
No, but [Sass][1] does this if you're coding in Ruby on Rails.
[1]: http://haml.hamptoncatlin.com/docs/rdoc/classes/Sass.html |
Yes, the names of the code under test (methods, properties, whatever) can change, but I contend your existing tests should fail if the expectations change. That is the true value of having well-constructed tests, not perusing a list of test names. That being said, well named test methods are great tools for getting new... |
|wpf|visual-studio-2008|xaml|expression-blend| |
The only way I know is to create a FocusListener and attach it to your component. If you want it this FocusListener to be global to all components in your application you might consider using Aspect Oriented Programming (AOP). With AOP is possible to code it once and apply your focus listener to all components instanti... |
The only way I know is to create a FocusListener and attach it to your component. If you want it this FocusListener to be global to all components in your application you might consider using Aspect Oriented Programming (AOP). With AOP is possible to code it once and apply your focus listener to all components instanti... |
[Suggested solution #2 of 3]
- Make a private member variable name.
- Define an abstract property Name in the interface.
- Implement the property in the base class like this:
public string Name
{
get {return Name;}
}
- Force all implementations to pass name as a constructor argu... |
to get advanced in prolog i like these two books:
[The Art of Prolog](http://www.amazon.com/Art-Prolog-Second-Programming-Techniques/dp/0262193388/)
[The Craft of Prolog](http://www.amazon.com/Craft-Prolog-Logic-Programming/dp/0262512270/)
really opens the mind for logic programming and recursion schemes.
|
Perhaps Motorola's own site
[link][1]
[1]: http://developer.motorola.com/?WT.mc_id=ca_hp_mdc |
For what its worth, <code>is_readable</code> can be used as a work around. |
git checkout path/to/file/to/revert |
I don't think this would cause your problem, but $path does have the trailing slash, correct? |
Per @Alasdair, remap Ctrl to "Caps Locks" or elsewhere: [instructions for various platforms][1].
P.S. I'm a bit surprised this can't be done via an elisp function.
[1]: http://www.emacswiki.org/cgi-bin/wiki/MovingTheCtrlKey |
Another quicker way is:
git stash save --keep-index
After that, you can drop that stash with a `git stash drop` command if you like. |
I personally will never leave my stuff on the web under someone else's control. All of my photos and e-mails I keep on local hard drives that I control.
I prefer to make my own stuff available to me through the web on my own hardware. The only way to have reasonable performance and be productive when offline is ... |
SQL Pagination |
|php|sql|sqlite|pdo| |
I am trying to paginate the results of an SQL query for use on a web page. The language and the database backend are PHP and SQLite.
The code I'm using works something like this (page numbering starts at 0)
http://example.com/table?page=0
page = request(page)
per = 10 // results per page
offse... |
Here's what I've got so far, I wanted to give this a little more time before accepting an answer.
DECLARE @IDs TABLE
(
ID int ,
DateBetween int
)
DECLARE @OID int
SET @OID = 6150
-- Grab the revisions, calc the datediff, and insert into temp table var.
INSERT @IDs SELECT ID, DATEDIFF(dd, (SELECT ... |
In Sybase if you create a temp table and then use it in one proc the plan for the select is built using an estimate of 100 rows in the table. (The plan is built when the procedure starts before the tables are populated.) This can result in the temp table being table scanned since it is only "100 rows". Calling a anothe... |
I doubt you'll find what you're looking for if "official" means "standards-based." What you describe is a user-agent scripting language to be parsed and executed during a style-sheet parsing. If your aim is to simplify XSLT by doing the dirty work in Javascript, you may be better off trying to generate the XSLT in ja... |
Threadsafe foreach enumeration of lists |
|c#|multithreading| |
I need to enumerate though generic IList<> of objects. The contents of the list may change, as in being added or removed by other threads, and this will kill my enumeration with a "Collection was modified; enumeration operation may not execute."
What is a good way of doing threadsafe foreach on a IList<>? prefferabl... |
Create the site as normal, then use spidering software to generate a HTML copy.
[HTTrack](http://www.httrack.com/) is software I have used before.
|
[Suggested solution #1 of 3]
1. Define an abstract property Name in the interface to force all implementing classes to implement the name property.
2. (in c#) Add this property as abstract in the base class.
3. In the implementations implement like this:
public string Name
{
get {return COMMAND_NAME;}
... |
[Suggested solution #1 of 3]
1. Define an abstract property Name in the interface to force all implementing classes to implement the name property.
2. (in c#) Add this property as abstract in the base class.
3. In the implementations implement like this:
public string Name
{
get {return COMM... |
|sql-server|database|free|oracle-xe| |
Speeding up an ASP.Net Web Site or Application |
|asp.net|ajax.net|ajax|performance|optimization| |
I have an Ajax.Net enabled ASP.Net 2.0 web site. Hosting for both the site and the database are out of my control as is the database's schema. In testing on hardware I do control the site performs well however on the client's hardware, there are noticeable delays when reloading or changing pages.
What I would like ... |
|asp.net|ajax|optimization|performance|ajax.net| |
I have an Ajax.Net enabled ASP.Net 2.0 web site. Hosting for both the site and the database are out of my control as is the database's schema. In testing on hardware I do control the site performs well however on the client's hardware, there are noticeable delays when reloading or changing pages.
What I would like ... |
|asp.net|ajax|optimization|performance| |
Don't be afraid of MXML. It's great for laying out views. If you write your own _reusable_ components then writing them in ActionScript may sometimes give you a little more control, but for non-reusable views MXML is much better. It's more terse, bindings are extemely easy to set up, etc.
However, bindings in pure A... |
If speed matters to your users, and they are technically inclined, http allows multiple connections for one file (if the client supports it. I use [DownThemAll][1]). Most browsers should handle ftp links just fine, though.
[1]: http://www.downthemall.net/ |
1. Download and install [Visual C++ Express Edition][1] (VCEE), if you don't have it yet.
2. The default install of Visual C++ Express Edition builds for the .Net platform. We'll need to build for the Windows platform since OpenGL and GLUT are not yet fully supported under .Net. For this we need the Microsoft Platform... |
There's no requirement that all styles for a selector reside in a single rule, and a single rule can apply to multiple selectors... so *flip it around*:
/* Theme color: text */
H1, P, TABLE, UL
{ color: blue; }
/* Theme color: emphasis */
B, I, STRONG, EM
{ color: #00006F; }
... |
@Tom
It might be easier for me in general to do the "In" query that you've suggested. Generally I do something like
select T1.account, T1.value
from table T as T1
where T1 = (select max(T2.time) from table T as T2 where T1.account = T2.Account) |
Until C and C++ (amongst other culprits) have labelled breaks and continues, goto will continue to have a role.
|
@Luke
I think your perhaps misunderstanding inheritance. Dog.GetLeg() will return a DogLeg object.
public class Dog{
public Leg GetLeg(){
DogLeg dl = super.GetLeg();
//set doglet specific properties
}
}
Animal a = getDog();
Leg... |
@Luke
I think your perhaps misunderstanding inheritance. Dog.GetLeg() will return a DogLeg object.
public class Dog{
public Leg GetLeg(){
DogLeg dl = super.GetLeg();
//set dogleg specific properties
}
}
Animal a = getDog();
... |
@Luke
I think your perhaps misunderstanding inheritance. Dog.GetLeg() will return a DogLeg object.
public class Dog{
public Leg GetLeg(){
DogLeg dl = new DogLeg(super.GetLeg());
//set dogleg specific properties
}
}
Animal a = getDog... |