instruction stringlengths 0 30k ⌀ |
|---|
You may have to generate you own "glyph cache" in texture memory as you go, potentially with some sort of LRU policy to avoid destroying all of the texture memory. Not nearly as easy as your current method, but may be the only way given the number of unicode chars |
[Install4J][1]. Not free, but worth it. Give the trial a shot
[1]: http://www.ej-technologies.com/products/install4j/overview.html |
My favourite "start learning to code" project is the Game **Snakes** or **Tron** because it allows you to start slow (variables to store the current "worm position", arrays to store the worm positions if the worm is longer than one "piece", loops to make the worm move, if/switch to allow the user to change the worm's d... |
Eclipse does some of this in Java (or PHP with plugins) on its own. Allows you to fold functions and such. I tend to like it. If I know what a function does and I am not working on it, I dont need to look at it. |
I agree with @lomaxx, it's more important to be consistent throughout the team than to have the *right* convention.
Still, here are several good places to get ideas and guidance for coding conventions:
1. [Practical Guidelines and Best Practices for Microsoft Visual Basic and Visual C#][1] Developers by Frances... |
Yes your insight is correct.
This is called [dynamic programming][1]. It is a common memory runtime trade-off.
(By the way, there are a few other way to compute fibonacci faster.)
@John:
I don't think it has anything to do with do with hash.
[1]: http://en.wikipedia.org/wiki/Dynamic_programming |
Yes your insight is correct.
This is called [dynamic programming][1]. It is usually a common memory runtime trade-off.
In the case of fibo, you don't even need to cache everything :
int fibo(int n) {
if (n == 0 ) return 1;
if (n == 1 ) return 1;
int p = fibo(0);
int c = fi... |
Yes your insight is correct.
This is called [dynamic programming][1]. It is usually a common memory runtime trade-off.
In the case of fibo, you don't even need to cache everything :
int fibo(int n) {
if (n == 0 ) return 1;
if (n == 1 ) return 1;
int p = fibo(0);
int c = fi... |
Yes your insight is correct.
This is called [dynamic programming][1]. It is usually a common memory runtime trade-off.
In the case of fibo, you don't even need to cache everything :
**Here is a linear algorithm O(n)**
int fibo(int n) {
if (n == 0 ) return 1;
if (n == 1 ) return 1;
... |
Well, Vim's generic completion mechanism is surprisingly good, just using Ctrl-N in insert mode. Also, line completion is very handy, using C-x C-l.
Also check out this [vim script for perl][1].
[1]: http://www.vim.org/scripts/script.php?script_id=556 |
I love debugging with the [Multiple startup projects option][1]
[1]: http://blogs.msdn.com/saraford/archive/2008/07/28/did-you-know-you-can-start-debugging-multiple-projects-268.aspx |
<code>document.write</code> is about as deprecated as they come. Thanks to the wonders of JavaScript, though, you can just assign your own function to the <code>write</code> method of the <code>document</code> object which uses <code>innerHTML</code> on an element of your choosing to append the supplied content. |
Vim 7 supports omni completion.
For example, I have this in my vimrc
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
and then, when I press **Ctrl-x Ctrl-o** in Insert mode, I get a dropdown list of autocomplete possibilities.
Here's an omnicfunc [for perl](http://www.vim.org/scripts/script.ph... |
I believe `places.sqlite` is the one you should be looking into for history (Firefox 3). Here's [a Mozilla wiki entry][1] that has some info on the subject.
[1]: https://wiki.mozilla.org/Mozilla2:Unified_Storage |
I believe `places.sqlite` is the one you should be looking into for history (Firefox 3). Below are a couple of Mozilla wiki entries that have some info on the subject.
- [Mozilla 2: Unified Storage][1]
- [Browser History][2] *(see especially section "Database Design" here)*
[1]: https://wiki.mozilla.org/Mo... |
I believe `places.sqlite` is the one you should be looking into for history (Firefox 3). Below are a couple of Mozilla wiki entries that have some info on the subject.
- [Mozilla 2: Unified Storage][1]
- [Browser History][2] *(see especially section "Database Design" here)*
In earlier versions of Firefox they ... |
Cntl-N
This is explained in the Perl Hacks book, along with how to do Package completion. Highly recommended.
|
What is the Best Way to Populate a Menu Control on a Master Page |
|.net-3.5|menu|master-pages| |
Database? Page variables? Enum?????
looking for opionions here. |
Typically I have always done this using a 3rd party aggregator. The messages are compiled into SMIL, which is the description language for the MMS messages. These are then sent on to the aggregator who will then send them through the MMS gateway of the Network Operator. They are typically charged on a per message ba... |
How Do I Test Rails Logging In from the Console? |
|ruby|ruby-on-rails| |
I was having a heck of a time figuring out how to login and logout using response objects from Rails. The standard blogs were ok, but I finally diagnosed it, and I wanted to record it here.
app.get '/'
assert_response :success
app.get '/auth_only_url'
assert_response 302
user = User.find(:use... |
I was having a heck of a time figuring out how to login and logout using response objects from Rails. The standard blogs were ok, but I finally diagnosed it, and I wanted to record it here.
app.get '/'
assert_response :success
app.get '/auth_only_url'
assert_response 302
user = User.find(:use... |
How to export findbugs results from Eclipse findbugs plugin? |
|java|eclipse-plugin|findbugs| |
I have findbugs plugin for eclipse which when run on my project will show results in Bugs explorer clubbed by the type of bug.
I need to be able to do two things:
- Export all these to excel sheet
- Find out the bugs reported in a set of files (and be able to do it recursively w/o running for whole project... |
You should be able to go :
Class Animal<SpeciesType, OrderType>
where SpeciesType : Species
where OrderType : Order |
I do not think you can use the Management Studio GUI to update XML-columns without writing the UPDATE-command yourself.
One way you could let users update xml-data is to write a simple .net based program (winforms or asp.net) and then select/update the data from there. This way you can also sanitize the data and eas... |
How do I create tri-state checkboxes with a TreeView control in .NET? |
|vb.net| |
I have a treeview control with checkboxes turned on. Because the treeview control has nested nodes, I need the checkboxes to be able to have some sort of tri-mode selection. I can't find a way to do this (I can only have the checkboxes fully checked or unchecked). |
|.net| |
I have a treeview control in a Windows Forms project that has checkboxes turned on. Because the treeview control has nested nodes, I need the checkboxes to be able to have some sort of tri-mode selection. I can't find a way to do this (I can only have the checkboxes fully checked or unchecked). |
Apache rewrite based on subdomain |
|apache|mod-rewrite| |
Im trying to redirect requests for a wildcard domain to a sub-directory.
ie. `something.blah.domain.com` --> `blah.domain.com/something`
I dont know how to get the subdomain name to use in the rewrite rule. |
Im trying to redirect requests for a wildcard domain to a sub-directory.
ie. `something.blah.domain.com` --> `blah.domain.com/something`
I dont know how to get the subdomain name to use in the rewrite rule.
**Final Solution:**
RewriteCond %{HTTP_HOST} !^blah\.domain\.com
RewriteCond %{HTTP_HOST} ^(... |
Im trying to redirect requests for a wildcard domain to a sub-directory.
ie. `something.blah.domain.com` --> `blah.domain.com/something`
I dont know how to get the subdomain name to use in the rewrite rule.
**Final Solution:**
RewriteCond %{HTTP_HOST} !^blah\.domain\.com
RewriteCond %{HTTP_HOST} ^(... |
It's not so much that structs are "immutable."
The real underlying issue is that structs are a Value type, not a Reference type. So when you pull out a "reference" to the struct from the list, it is creating a new copy of the entire struct. So any changes you make on it are changing the copy, not the original versi... |
Pass the :domain on delete as well. Here's the source of that method:
# Removes the cookie on the client machine by setting the value to an empty string
# and setting its expiration date into the past. Like []=, you can pass in an options
# hash to delete cookies with extra data such as a +path+.
... |
Packaging Java apps for the Windows/Linux desktop. |
|java|windows|executable|swt| |
I am writing an application in Java for the desktop using the Eclipse SWT library for GUI rendering. I think SWT helps Java get over the biggest hurdle for acceptance on the desktop: namely providing a Java application with a consistent, responsive interface that looks like that belonging to any other app on your desk... |
|java|windows|swt|executable| |
I am writing an application in Java for the desktop using the Eclipse SWT library for GUI rendering. I think SWT helps Java get over the biggest hurdle for acceptance on the desktop: namely providing a Java application with a consistent, responsive interface that looks like that belonging to any other app on your desk... |
@[AnotherHowie][1], I thought the whole preprocessing could be done with sort and uniq. The problem is that the OP's data seems to be comma delimited and (Solaris 8's) uniq doesn't allow you any way specify the record separator, so there wasn't a super clean way to do the preprocessing using standard unix tools. I do... |
I went through the same and found that all of the free options weren't very good. Looks like you'll be writing your own. I'd be interested to see if someone has a free/cheap option that works |
Yes your insight is correct.
This is called [dynamic programming][1]. It is usually a common memory runtime trade-off.
In the case of fibo, you don't even need to cache everything :
**Here is a linear algorithm O(n)**
int fibo(int n) {
if (n == 0 ) return 1;
if (n == 1 ) return 1;
... |
Yes your insight is correct.
This is called [dynamic programming][1]. It is usually a common memory runtime trade-off.
In the case of fibo, you don't even need to cache everything :
**Here is a linear algorithm O(n)**
in OCaml:
let rec fibo n =
let rec aux = fun
| 0 ->... |
You could use DOS?
DIR /s/b > Files.txt |
Normally, you would create a new Rails app using
rails ProjectName
To use MySQL, use
rails -d mysql ProjectName |
If you are creating a new rails application you can set the database using the -d switch like this:
rails -d mysql myapp
Its always easy to switch your database later though, and using sqlite really is easier if you are developing on a Mac. |
Why not just use SQL Management Studio to create a complete script of your database and the objects? |
To make the things a little more clear:
1. Yes, I know that using HTTP_REFERER is completely unreliable and somewhat childish but I'm pretty sure that the people that learned (from me maybe?) to make automations with Excel VBA will not know how to subvert a HTTP_REFERER within the time span to have the final soluti... |
Searching directories for tons of files? |
|c#|filemanagement|directory| |
I'm using MSVE, and I have my own tiles I'm displaying in layers on top. Problem is, there's a ton of them, and they're on a network server. In certain directories, there are something on the order of 30,000+ files. Initially I called Directory.GetFiles, but once I started testing in a pseudo-real environment, it timed... |
|c#|directory|filemanagement| |
I'm using MSVE, and I have my own tiles I'm displaying in layers on top. Problem is, there's a ton of them, and they're on a network server. In certain directories, there are something on the order of 30,000+ files. Initially I called Directory.GetFiles, but once I started testing in a pseudo-real environment, it timed... |
Definitely split them up. That said, stay as far away from the Indexing Service as you can. |
If you already have a rails project, change the adapter in the `config/database.yml` file to `mysql` and make sure you specify a valid username and password, and optionally, a socket:
development:
adapter: mysql
database: db_name_dev
username: koploper
password:
host: localhost... |
I think that your example would work just as well if you used a <div> instead of a <table>. The only difference is that the text in the <table> is also centered. If you want that too, just add the <tt>text-align: center;</tt> rule.
Another thing to keep in mind is that the <div> will by defau... |
I would solve it using the technique below. The example expect an *article* table with an *id* on each row.
Delete article where id not in (select top 1000 id from article)
Edit: Too slow to answer my own question ... |
Automatic Timeout Web Client Use |
|c#|asp.net| |
One of the problems I have come accross having complext tasks on the browser is with automatic timeouts. Currently our site has a sliding expiration of 30 minutes. Normally this isn't a problem because we use asp.net and most of the time the users update one or two fields and then submit the form. This obviously kee... |
Take a look at this code from the Mono project
http://tirania.org/blog/archive/2008/Aug-26.html
I played with it some the other day.
It does a lot of command line editingy, but I don't think it does line completion. |
You can set an EVENT in your parameter file (plain text or spfile) to force Oracle to dump a detailed trace file in the user_dump_dest, the object name might be in there, if not the SQL should be.
EVENT="942 trace name errorstack level 12"
If you are using a plain text file you need to keep all your EVENT setting... |
One solution is to serialize the inner object to a string and then load the string into a XmlDocument where you can find the XmlNode representing your data and attach it to the outer object.
XmlSerializer xser1 = new XmlSerializer(typeof(Config));
XmlSerializer xser2 = new XmlSerializer(typeof(MyConfig));
... |
You could try using [find][1].
[1]: http://www.scala-lang.org/docu/files/api/scala/List.html#find((A)%3D%3EBoolean) |
IF the menu is dynamic _per-user_ then you'll have to hit the database for each user. From then on I would probably store it in session to avoid future round-trips to the database.
If it's dynamic, but the entire site sees the same items, then put it in the database and cache the results
|
In my experience not all browsers handle this properly. I'm not really sure why (or which browsers) but I've mistakenly sent links like this to clients on occasion and they've often come back confused. I suspect their browser prompts them to download the file instead of displaying it properly. |
[http://codex.wordpress.org/Function_Reference/wp_schedule_event][1]
[1]: http://codex.wordpress.org/Function_Reference/wp_schedule_event |
Binding to a Sitemap is certainly the easiest. |
That's an interesting question, there are lots of ways to approach it.
You could load the menu structure from XML, that's the way the built-in ASP.NET navigation controls/"sitemap" setup works. This is probably a good choice overall, and there is reasonably good tooling for it in Visual Studio.
If it's a dynamic... |
I suspect one of the reasons javascript is becoming more popular is that it's more easy to retrofit into an existing application. |
[This post][1] earlier discussed different approaches for SMS and might be helpful for you.
[1]: http://stackoverflow.com/questions/53019/what-kind-of-technologies-are-available-for-sending-text-messages#53067 |
http://www.isecpartners.com/files/web-session-management.pdf
A 19 page white paper on "Secure Session Management with Cookies for Web Applications"
They cover lots of security issues that I haven't seen all in one spot before. It's worth a read. |
Using jQuery to beautify someone else's html |
|html|jquery| |
I have a third-party app that creates HTML-based reports that I need to display. I have *some* control over how they look, but in general it's pretty primitive. I *can* inject some javascript, though. I'd like to try to inject some jQuery goodness into it to tidy it up some. One specific thing I would like to do is... |
Here's another one that has bit me from time to time. When you are working on FORTRAN code make sure you skip all six initial columns. Every once and a while, I'll only get the code indented five spaces and nothing works. At first glance everything seems okay and then I finally realize that all the lines are startin... |
Yes your insight is correct.
This is called [dynamic programming][1]. It is usually a common memory runtime trade-off.
In the case of fibo, you don't even need to cache everything :
**Here is a linear algorithm O(n)**
in OCaml:
let rec fibo n =
let rec aux = fun
| 0 ->... |
Yes your insight is correct.
This is called [dynamic programming][1]. It is usually a common memory runtime trade-off.
In the case of fibo, you don't even need to cache everything :
**Pure memorization**
Since the author is asking for a general sample of code I write here what would be a general application o... |
You can stream FLV videos using a simple player like [JW FLV Media Player][1]. It supports several streaming methods, playlists etc. It's actively developed, and I have found it to be the best solution for streaming flash video.
[1]: http://www.jeroenwijering.com/?item=JW_FLV_Player |
This is probably a bit deceptive example, since address is a bit non-normalized in this case. It is a reasonable trade-off, however since address fields are difficult to normalize.
If you make the line breaks carry important information, you're un-normalizing and making the post office interpret the meaning of the lin... |
Take a look at ISO 11179-5: Naming and identification principles
You can get it here: [http://metadata-standards.org/11179/#11179-5][1]
I blogged about it a while back here: [ISO-11179 Naming Conventions][2]
[1]: http://metadata-standards.org/11179/#11179-5
[2]: http://sqlservercode.blogspot.com/2006/11/... |
9 out of 10 times, code folding means that you have failed to use the <a href="http://en.wikipedia.org/wiki/Separation_of_concerns">SoC principle</a> for what its worth.<br />
I more or less feel the same thing about partial classes. If you have a piece of code you think is too big you need to chop it up in manageable... |
If you choose to throw a NPE and you are using the argument in your method, it might be redundant and expensive to explicitly check for a null. I think the VM already does that for you. |
I use [RSS Bandit][1] (for Windows) to stay up to date with my RSS feeds/Blogs.
There are [lots of other RSS aggregator applications][2], though.
If you don't want another "big" application, but have Windows Vista, you could also choose to make Internet Explorer monitor the RSS feed and use the Feed sidebar appli... |
change visibility of asp.net label with javascript |
|asp.net|javascript| |
Mod-Rewrite loading files behind the DocumentRoot |
|mod-rewrite|.htaccess| |
I'm using htaccess and mod_rewrite to point to files that reside behide the DocumentRoot. My folder structure looks like this:
<pre>
home/
webroot/
other_files/
</pre>
I have a <code>.htaccess</code> file in webroot with the following:
<pre>
RewriteEngine on
RewriteRule ^(.*)$ /home/other... |
Add a second (empty) table immediately after the first. Page break after that. |
Another option is to use a tool such as [ResourceHacker][1]. It handles way more than just icons as well. Cheers!
[1]: http://www.angusj.com/resourcehacker/ |
I don't grok the WPF command pattern |