instruction stringlengths 0 30k ⌀ |
|---|
[Processing](http://ejohn.org/blog/processingjs/)
var p = Processing(CanvasElement);
p.size(100, 100);
p.background(0);
p.fill(255);
p.ellipse(50, 50, 50, 50); |
Take a look at this library that is a jquery plugin:
[http://www.openstudio.fr/Library-for-simple-drawing-with.html][1]
[1]: http://www.openstudio.fr/Library-for-simple-drawing-with.html |
A simple technique is to use a prioritization matrix.
Examples:
- http://erc.msh.org/quality/pstools/psprior2.cfm
- http://it.toolbox.com/blogs/enterprise-solutions/sample-project-prioritization-matrix-23381
Also useful is the prioritization quadrants (two dimensions: Importance, Urgency) that Co... |
Use vars()
class Foo(object):
def __init__(self):
self.a = 1
self.b = 2
vars(A()) #==> {'a': 1, 'b': 2}
vars(A()).keys() #==> ['a', 'b'] |
Refer to [this question][1].
[1]: http://stackoverflow.com/questions/96486/javascript-drawing-library#96509 |
You can create "images" using javascript's flot library.
It's on [google code: flot](http://code.google.com/p/flot/)<br />
And requires [jQuery](http://www.jquery.com/)
Here's an example, how a [graph might look like](http://people.iola.dk/olau/flot/examples/graph-types.html)
|
If you want to show/hide the div with client side code (javascript) running in the browser, you do something like the following:
<script>
var fooElement = document.getElementById("foo");
foo.style.display = "inline"; //to show the div
foo.style.display = "none"; // to hide the div
</script... |
Deciding whether a web application is a good approach depends on what you are trying to achieve. However here are some more general cons of web applications:
- Real integration with desktop apps (e.g. Outlook) is impossible
- Drag and drop between your app and the desktop / other running apps |
Internet Explorer is the only browser which really suffers from this in today's world. (Versions 5 & 6 were dog slow. Haven't checked 7 & 8 for this.) What's more, IE gets slower and slower the longer your string is.
If you have long strings to concatenate then definitely use an array.join technique. (Or some St... |
The simple, and best solution, is just to charge them up front. Set a price that works for you and them.
Asking paying customers to prove that they are paying customers after they've already paid just pisses them off. Implementing the code to make your software not run wastes your time and money, and introduces bugs... |
Just a few ideas...
Is displaying your pages as slow when doing it from the Server or from a Client? If slower from client, do check your network.
Are your pages very "heavy"? (means, many elements, web parts and so on?) Than maybe it's normal.
Have you noticed they load slowlier since you've add one specific ... |
Whatever language and environment you choose, if the student wants to learn for professional reasons or to do "real" programming (whatever that is), have them start by writing their starter programs<sup>1</sup> on paper and taking them away to run. Come back with the output and/or error results and have them fix things... |
I'm surprised no one suggested gzipping your code. A straight ~50% saving there! |
First, try to find out what's slowing you down.
- How much faster is the parser when you parse from memory?
- Does using a `BufferedInputStream` with a large size help?
Is it easy to split up the XML file? In general, shuffling through 30 GiB of any kind of data will take some time, since you have to loa... |
You might want to look at existing styles. You can find quite a few of them on kde-look.org, in the [Styles / 4.0 section][1].
[1]: http://kde-look.org/index.php?xcontentmode=9 |
Bussiness application 'layers' are:
1. User Interface
-----------------
This implements the business-user's view of h(is/er) job. It uses terms that the user is familiar with.
2. Processing
-------------
This is where calculations and data manipulation happen. Any business logic that involves changing data ar... |
Bill de hÓra wrote a very good essay entitled [Web resource mapping criteria for frameworks][1] that is well worth a read.
[1]: http://www.dehora.net/journal/2007/08/web_resource_mapping_criteria_for_frameworks.html |
From an SMTP perspective, you can start a line with a period but you have to send two periods instead. If the SMTP client you're using doesn't do this, you may encounter the problem you describe.
It might be worth trying an IP sniffer to see where the problem really is. There are likely at least two separate SMTP tr... |
You can calculate the number of bytes without doing any conversion.
foreach character in the Java string
if 0 <= character <= 0x7f
count += 1
else if 0x80 <= character <= 0x7ff
count += 2
else if 0x800 <= character <= 0xffff
count += 3
This works because Java is not surrogate aware (yet... |
You can calculate the number of bytes without doing any conversion.
foreach character in the Java string
if 0 <= character <= 0x7f
count += 1
else if 0x80 <= character <= 0x7ff
count += 2
else if 0x800 <= character <= 0xd7ff // excluding the surrogate area
count... |
I know you said not to tell you to use Emacs.
Use Emacs.
Serious, the <a href="http://common-lisp.net/project/slime/">SLIME</a> setup for Emacs is pretty much <em>the</em> standard development platform for Lisp, and for very good reason. |
Playing with ps options doesn't give you what you need? |
The question is of course: why do you want a random ID?
One case where I encountered a similar requirement, was for client IDs of a webapp: the client identifies himself with his client ID (stored in a cookie), so it has to be hard to brute force guess another client's ID (because that would allow hijacking his data... |
Firstly, Drupal is by no means a slow system, actually it works quite well.
Secondly, this has been already asked and answered [here][1].
By the way Drupal has a medium learning curve but, once you learn how to use you'll find it simple and you'll find it will satisfy almost everything you want to do with it. Its... |
Regex to replace Boolean with bool |
|regex|perl| |
I am working on a C++ code base that was recently moved from X/Motif to Qt. I am trying to write a PERL script that will replace all occurrences of Boolean (from X) with bool. The script just does a simple replacement.
s/\bBoolean\b/bool/g
There are few conditions that I can not get to work right.
1... |
I am working on a C++ code base that was recently moved from X/Motif to Qt. I am trying to write a PERL script that will replace all occurrences of Boolean (from X) with bool. The script just does a simple replacement.
s/\bBoolean\b/bool/g
There are few conditions.
1) We have CORBA in our code and \... |
If you want to alter the color of the div with client side code (javascript) running in the browser, you do something like the following:
<script>
var fooElement = document.getElementById("foo");
fooElement.style.color = "red"; //to change the font color
</script> |
Strict vs NonStrict NHibernate cache concurrency strategies |
|nhibernate|caching| |
This question is about the difference between ReadWrite and NonStrictReadWrite cache concurrency strategies for NHibernate's second level cache.
As I understand it, the difference between these two strategies is relevant when you have a distributed *replicated* cache - nonstrict won't guarantee that one cache has th... |
Python - Get Class Variables |
|python|class-variables|methods| |
Is there a built-in method in Python to get an array of all a class' class variables? For example, if I have this code:
class hi:
def __init__(self):
self.ii = "foo"
self.kk = "bar"
Is there a way for me to do this:
>>> mystery_method(hi)
["ii", "kk"]
Thanks guys! |
Python - Get Instance Variables |
Is there a built-in method in Python to get an array of all a class' instance variables? For example, if I have this code:
class hi:
def __init__(self):
self.ii = "foo"
self.kk = "bar"
Is there a way for me to do this:
>>> mystery_method(hi)
["ii", "kk"]
Thanks guys!
E... |
|python|methods|instance-variables| |
One way would be to search through the jar file for all the .class files (or search through the classes directory), use the Class.forName() method to load the class file and check MyInterface.class.isAssignableFrom(myClass).
This wouldn't deal easily public inner static classes (you could parse the class file name),... |
Beyond any tool and process, there should be... some people ;)
In our shop, he is called a **Release Manager** and he determines the next functional perimeter to ship into production.
Then there is a **Freeze Manager** who actually knows about code and files and bugs (he is usually one of the programmers), and wi... |
Whatever they write, have them step through it in a debugger line-by-line on the first run. Let them <i>see for themselves</i> what the computer is doing. This takes a lot of mystery out of things, reduces intimidation ("oh, each line really is that simple!"), and helps them learn debugging skills and recognize why com... |
I noticed that Sharepoint loves to add a ton of JavaScript. If you run a Browser with slow JavaScript (say, Internet Explorer), i notice that it sometimes does not "feel" fast.
Also, if you are running custom code on it: Make sure to dispose your SPWebs after use, that can up a lot! |
I have heard of and used older compilers where true > 0, and false <= 0.
That's one reason you don't want to use if(pointer) or if(number) to check for zero, they might evaluate to false unexpectedly.
Similarly, I've worked on systems where NULL wasn't zero. |
Almost all copy-protection is both ineffective, and a usability nightmare. Some of it, such as putting root-kits on your customers' machines becomes downright unethical |
With a web application, there are more privacy concerns, when you are storing user data on your servers. You have to make sure that you don't loose/disclose it and your users have to be comfortable with the idea of storing that data on your servers.
Apart from that, there are many security problems, like Man-in-the... |
ISwissArmyKnife!
Consult this:
[http://thedailywtf.com/Articles/Classic-WTF-Implements-ISwissArmyKnife.aspx][1]
[1]: http://thedailywtf.com/Articles/Classic-WTF-Implements-ISwissArmyKnife.aspx |
There is a known issue with initial requests once an IIS application pool has unloaded the SharePoint resources or recycled itself where the spin-up on a new request is very slow.
Details about why that happens and how to fix it can be found here; [SharePoint 2007 Quirks - Solving painfully slow spin-up times][1]
... |
It can be a real pain to work out the eventual call stack before you step with the debugger if you have interfaces everywhere. I tend to prefer interfaces only when:
1. you need team members to agree on who should do what before they start coding - an interface then documents the border exactly
2. when you actually... |
I find that interfaces complicates the design, especially for other people to cowork on your stuff. Don't get me wrong, interfaces are great for a lot of stuff, but mostly if you want two or more classes to share a common interface.
If you find yourself in the situation where you suddenly need an interface, refactor... |
I just wanted to come back and answer my own question. I started with Axis2, Apache's implementation of SOAP. After generating the client using WSDL2Java, I was able to successfully invoke Microsoft Reporting Services WebService and generate reports, output in Excel, PDF, CSV and other formats. In my case, I also us... |
Schema reference for IIS programmatic administration |
|windows|iis|schema| |
Where can I find the IIS object schema? All I found from MSDN was a picture of the class hierarchy.
To be clear, I want to configure IIS through either WMI or ADSI and I'm looking for something like [the Active Directory schema][1], only for IIS. I want a list of all the objects I can configure, which objects they c... |
Is it possible to determine the current user from within a global keyboard hook in .NET |
|.net|windows| |
I want to create a keyboard and mouse hook which will be started as a windows service. I want to monitor the activity of the various users who use the system throughout the day. i.e. which users are *active* at what times.
Is is possible to determine which user will be receiving the events? |
I want to create a keyboard and mouse hook which will be started as a windows service. I want to monitor the activity of the various users who use the system throughout the day. i.e. which users are *active* at what times.
Is is possible to determine which user will be receiving the events? (The service will be runn... |
See the other answers for log4j. But also consider [JAMon][1] for *application monitoring*. It's very easy to add to a spring application, e.g.:
<bean id="performanceMonitor" class="org.springframework.aop.interceptor.JamonPerformanceMonitorInterceptor">
<property name="useDynamicLogger" value="fal... |
There are a few possible ways to do this.
One would be
SELECT
...
ORDER BY
CASE
WHEN ISNUMERIC(value) = 1 THEN CONVERT(INT, value)
ELSE 9999999 -- or something huge
END,
value
the first part of the ORDER BY converts everything to an int (with a huge value... |
If you need database independence, you'll probably want to put all your business logic in the application layer since the standards available in the application tier are far more prevalent than those available to the database tier.
However, if database independence isn't the #1 factor and the skill-set of your tea... |
I am working on a C++ code base that was recently moved from X/Motif to Qt. I am trying to write a PERL script that will replace all occurrences of Boolean (from X) with bool. The script just does a simple replacement.
s/\bBoolean\b/bool/g
There are a few conditions.
1) We have CORBA in our code and... |
I am working on a C++ code base that was recently moved from X/Motif to Qt. I am trying to write a Perl script that will replace all occurrences of Boolean (from X) with bool. The script just does a simple replacement.
s/\bBoolean\b/bool/g
There are a few conditions.
1) We have CORBA in our code and... |
Because the try block and the catch block are 2 different blocks.
In the following code, would you expect s defined in block A be visible in block B?
{ // block A
string s = "dude";
}
{ // block B
Console.Out.WriteLine(s); // or printf or whatever
} |
API for interacting with Windows Vista Complete PC Backup? |
|windows|windows-vista|api|backup| |
Is there a program or API I can code against to extract individual files from a Windows Vista Complete PC Backup image?
I like the idea of having a complete image to restore from, but hate the idea that I have to make two backups, one for restoring individual files, and one for restoring my computer in the event of ... |
How to extract files from Windows Vista Complete PC Backup? |
Testing the UI in an Asp.net Page? |
|asp.net|unit-testing| |
What's the best way to test the UI in an Asp.net Page? |
What's the best way to automate testing the UI in an Asp.net Page? |
Out of the four professional jobs I've had over the past 8 years or so, I've only worked at one place that did not allow any type of instant messaging. All the other companies had at least some type of setup for intranet instant messaging.
I think that IM is almost necessary in today's business environment. I don't... |
|java|sqlite| |
I'm attracted to the neatness that a single file database provides. What driver/connector library is out there to connect and use SQLite with Java.
I've discovered a wrapper library, [http://www.ch-werner.de/javasqlite][1], but are the other more prominent projects available?
[1]: http://www.ch-werner.de/java... |
I'm attracted to the neatness that a single file database provides. What driver/connector library is out there to connect and use SQLite with Java.
I've discovered a wrapper library, [http://www.ch-werner.de/javasqlite][1], but are there other more prominent projects available?
[1]: http://www.ch-werner.de/ja... |
Aspectj doesn't catch all events in spring framework? |
|java|aspectj|spring| |
My project is based on spring framework 2.5.4. And I try to add aspects for some controllers (I use aspectj 1.5.3).
I've enabled auto-proxy in application-servlet.xml, just pasted that lines to the end of xml file:
<aop:aspectj-autoproxy />
<bean id="auditLogProcessor" class="com.example.bg.web.utils.Aud... |
My project is based on spring framework 2.5.4. And I try to add aspects for some controllers (I use aspectj 1.5.3).
I've enabled auto-proxy in application-servlet.xml, just pasted these lines to the end of the xml file:
<aop:aspectj-autoproxy />
<bean id="auditLogProcessor" class="com.example.bg.web.util... |
Bypass invalid SSL certificate errors when calling web services in .Net |
|.net|web-services|sharepoint| |
We are setting up a new SharePoint for which we don't have a valid SSL certificate yet. I would like to call the Lists web service on it to retrieve some meta data about the setup. However, when I try to do this, I get the exception:
> The underlying connection was closed: Could not establish trust relationship for ... |
How do you manage a large product backlog? |
|requirements|backlog|project-management|product-management| |
We have a large backlog of things we should do in our software, in a lot of different categories, for example:
- New problem areas for our products to solve
- New functionality supporting existing problem areas
- New functionality requested by our existing users
- Usability and "look" enhancements
- A... |
|project-management|requirements|product-management|backlog| |
We have a large backlog of things we should do in our software, in a lot of different categories, for example:
- New problem areas for our products to solve
- New functionality supporting existing problem areas
- New functionality requested by our existing users
- Usability and "look" enhancements
- A... |
As with anything else - use with moderation and where necessary. Ask yourself "**Are you gonna need it?**". |
There won't be a large list of books, as the list of people with a lot of experience is limited. Template metaprogramming started for real around the first C++ Template Programming Workshop in 2000, and many of the authors named so far attended. (IIRC, Andrei didn't.) These pioneers greatly influenced the field, and ba... |
Hofstadter's Law:
'It always takes longer than you expect, even when you take Hofstadter's Law into account.'
I believe this is because:
* Work expands to fill the time available to do it. No matter how ruthless you are cutting unnecessary features, you would have been more brutal if the deadlines were even ti... |
GUI clients: http://www.selenic.com/mercurial/wiki/index.cgi/GUIClients
Other tools: http://www.selenic.com/mercurial/wiki/index.cgi/OtherTools
|
Short answer:
$ ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile]
However, you might want to consider using ssh-agent, which can cache the passphrase for a time.
The latest versions of gpg-agent also support the protocol that is used by ssh-agent.
|
How does replication in team foundation server work. |
|version-control|tfsbuild| |
We have two offices in different states and issues with performance when using integrated source control over the WAN. We were contemplating using replication in TFS to allow both office to have fast and robust connectivity. We need to understand network load, speed of access, how conflicts are managed. |
How long does it really take to do something? |
|project-management|time-management| |
I mean name off a programming project you did and how long it took, please. The boss has never complained but I sometimes feel like things take too long. But this could be because I am impatient as well. Let me know your experiences for comparison.
I've also noticed that things always seem to take longer, sometimes ... |
It is only worth the effort if it gives you a practical benefit. Sticking to standards might make it easier to build a website that works across most browsers. Then again, if you're happy with how a website displays on the browsers you care about (maybe one, maybe all), then going through hoops to make it pass validati... |
You might want to look into using the "custom tool" code generation techniques in Visual Studio; there's an article about it on [CodeProject][1]
[1]: http://www.codeproject.com/KB/cs/VsMultipleFileGenerator.aspx?display=Print |