instruction stringlengths 0 30k ⌀ |
|---|
JQuery & Objects, trying to make a ligthwight widget. |
|javascript|jquery| |
Trying to make a make generic select "control" that I can dynamically add elements to but I am having trouble getting functions to work right.
This is what I started with.
$select = $("<select></select>");
$select.addOption = function(value,text){
$(this).append($("<option></option>").val(value).tex... |
A real Sun geek would chime in here about the virtues of using Solaris as a Java development platform, but I am much more ambivalent. Developing with Java is about the same on any linux distro; you are going to wind up having to install the JDK and tools of your choosing (Eclipse, Sun Studio, Tomcat, etc) so you may as... |
nginx is great but if you don't fancy a whole new web server, apache 2.2 with mod proxy balancer will do the same job |
A magic number can also be a number with special, hardcoded semantics. For example, I once saw a system where record IDs > 0 were treated normally, 0 itself was "new record", -1 was "this is the root" and -99 was "this was created in the root". 0 and -99 would cause the WebService to supply a new ID.
What's bad abou... |
It may be just me, but the way I'd get into this is by creating a code generator - using reflection at runtime is a bit costly and untyped. Creating classes that would get generated according to your latest code and copy everything in a strongly typed manner would mean that you will catch these errors at build-time.
... |
You and `String.Format()` will be new best friends!
<http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html#syntax>
Looking at this, I didn't realize Sun's documentation was almost as bad as Microsoft's.. ouch.
|
Use [DecimalFormat][1].
[1]: http://java.sun.com/javase/6/docs/api/java/text/DecimalFormat.html |
I like [Terminus][1] for some command line stuff, at least scrolling log files and irssi/irc ([TTF versions available][2]).
[1]: http://fractal.csie.org/~eric/wiki/Terminus_font
[2]: http://misc.nybergh.net/pub/fonts/terminus/ttf/ |
I like [Terminus][1] for some command line stuff, at least scrolling log files and irssi/irc ([TTF versions available][2]). Screenshot of the terminus.ttf in action below (PuTTY on Windows XP with ClearType enabled).
![Screenshot of the terminus.ttf in action below (PuTTY on Windows XP with ClearType enabled).][3]
... |
I like [Terminus][1] for some command line stuff, at least scrolling log files and irssi/irc ([TTF versions available][2]). Screenshot of the terminus.ttf in action below (PuTTY on Windows XP with ClearType enabled).
![Screenshot of the terminus.ttf in action below (PuTTY on Windows XP with ClearType enabled).][3]
... |
I like [Terminus][1] for some command line stuff, at least scrolling log files and irssi/irc ([TTF versions available][2]). Screenshot of the terminus.ttf in action below (PuTTY on Windows XP with ClearType enabled).
![Screenshot of the terminus.ttf in action below (PuTTY on Windows XP with ClearType enabled).][3]
... |
My application also had a similar problem and this is how I solved it:
1) <code>WEB-INF/classes/application.properties</code> contains the entry:
<pre>
ds.jndi=java:comp/env/jdbc/tcds
</pre>
2) On the WLS machine, I have an entry in the <code>/etc/sysenv</code> file:
<pre>
ds.jndi=wlsds
</pre>
3) I confi... |
How to develop categories of controllers in MVC Routing? |
Categories of controllers in MVC Routing? (Duplicate Controller names in seperate Namespaces) |
>> The switch statement does a constant time branch regardless of how many cases you have.
Since the language allows the *string* type to be used in a switch statement I presume the compiler is unable to generate code for a jump table style implementation for this type and needs to generate an if-then style.
I do... |
>Lomaxx wrote:
>> "The switch statement does a constant time branch regardless of how many cases you have."
Since the language allows the *string* type to be used in a switch statement I presume the compiler is unable to generate code for a constant time branch implementation for this type and needs to generate an ... |
> wrote:
>> "The switch statement does a constant time branch regardless of how many cases you have."
Since the language allows the *string* type to be used in a switch statement I presume the compiler is unable to generate code for a constant time branch implementation for this type and needs to generate an if-the... |
WebDAV query trouble - unable to read body of e-mail |
|webdav| |
Our group(corporate environment) needs to monitor a couple of faceless accounts' Outlook inbox for specific types of bounced e-mails.
WebDAV(using C# 2.0) is one of the paths we've traveled and we're almost there ... except for one minor problem -- we're getting the response below for the e-mail body element
... |
Have never worked out how to do it without a round trip, so it depends on what your goal is.
If they have to have javascript to proceed, then I have (in .net) done things like disabling the login button at the server side, then enabled it client side it with javascript, and used a noscript tag to show an error mes... |
I'd also have to add another vote for Android's "Droid Sans Mono". It's a very crisp, clear coding font. |
Dereks solution is probably the best, but here's an alternative anyway:
Recent Linux kernel version allow you to pipe core dumps to a script or program. You could write a script to catch the core dump, collect any extra information you need and mail everything back.
This is a global setting though, so it'd apply t... |
>The problem with this code is that it will generate stack overflow error for any number greater than 15 (in most computers).
Really? What computer are you using? It's taking a long time at 44, but the stack is not overflowing. In fact, your going to get a value bigger than an integer can hold (~4 billion unsigned) ... |
>The problem with this code is that it will generate stack overflow error for any number greater than 15 (in most computers).
Really? What computer are you using? It's taking a long time at 44, but the stack is not overflowing. In fact, your going to get a value bigger than an integer can hold (~4 billion unsigned, ... |
Markdown is a play on words because it is markup. "Markdown" is a proper noun.
Markup is just a way of providing functionality above plain text. For example: formatting, links, images, etc. |
- [Markup][1] is a generic term for a language that describes a document's formatting
- [Markdown][2] is a specific markup library: [http://daringfireball.net/projects/markdown/][3]
[1]: http://en.wikipedia.org/wiki/Markup_language
[2]: http://en.wikipedia.org/wiki/Markdown
[3]: http://daringfireball.n... |
The Safari Back Button Problem |
|javascript|safari| |
I do some minor programming and web work for a local community college. Work that includes maintaining a very large and soul destroying website that consists of a hodge podge of VBScript, javascript, Dreamweaver generated cruft and a collection of add-ons that various conmen have convinced them to buy over the years.
... |
Not that I know of, but pretty much all you need is:
* a split container
* a user control containing your actual form
* a grid view
Now you just hook up the grid view's item selection events with a controller that loads data into the user control's child controls.
From what I can tell, there Access Split For... |
There are **many** flash mp3 players that you can use that do this. Usually, you just have to edit a text file to point at the mp3s you want to have available.
Here is the first one that showed up on a google search for `flash mp3 player`: [http://www.flashmp3player.org/demo.html][1]
[1]: http://www.flashmp3p... |
Can you please clarify? Is the WebClient class you speak of the one in HTTPUnit/Java?
If so, your session should be saved automatically. |
It's simple, it's short and if you want to create a real implementation inside the property's body somewhere down the line, it won't break your type's external interface.
As simple as that. |
To expand on [Rytmis's comment][1], you can't use the *as* keyword for structs (Value Types), as they have no null value.
[1]: http://stackoverflow.com/questions/2483/casting-newtype-vs-object-as-newtype#2487 |
Getting the ID of the element that fired an event using JQuery |
|javascript|jquery| |
Is there any way to get the ID of the element that fires an event?
I'm thinking something like:
<html>
<head>
<script type="text/javascript" src="starterkit/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("a").click(
... |
How can I upsert a bunch of ActiveRecord objects and relationships in Rails? |
|ruby-on-rails|activerecord| |
I am working with an API that provides bus arrival data. For every request, I get back (among other things) a list of which routes serve the stop in question. For example, if the list includes result for bus route #1, 2, and 5, then I know that those serve this stop.
I have a many-to-many relationship set up between... |
The exact definitions of "vsize," "rss," "rprvt," "rshrd," and other obscure-looking abbreviations vary from OS to OS. The manual pages for the "top" and "ps" commands will have some sort of description, but all such descriptions are simplified greatly (or are based on long-extinct kernel implementations). "Process s... |
The **Publish to Provider** functionality has worked great for me. See [Scott Gu's Blog Entry](http://weblogs.asp.net/scottgu/archive/2006/12/22/recipe-deploying-a-sql-database-to-a-remote-hosting-environment-part-1.aspx).
If you need something really robust look at redgate software's tools [here](http://www.red-g... |
Wild guess here: If you don't want to modify the third party's tables, Can you create a view and then put a trigger on that view? |
If you are looking for user facing interaction, stick with xml. It has more support, understanding, and general acceptance currently. If it's internal, I would say that protocol buffers are a great idea.
Maybe in a few years as more tools come out to support protocol buffers, then start looking towards that for a pu... |
This is a useless ternary expression. This would be equivalent:
$canMerge = ($condition1 && $condition2); |
This is broken because 'false' as a string will evaluate to true as a boolean.
However, this is an unneeded ternary expression, because the resulting values are simple true and false. This would be equivalent:
$canMerge = ($condition1 && $condition2); |
I thought I'd give this a shot using classes and polymorphism. I had a previous iteration which used sub-classing which ended up having way too much overhead. I've switched to a more flexible delegate / public property object model which is significantly better. My code is slightly more accurate for most situations, I ... |
I thought I'd give this a shot using classes and polymorphism. I had a previous iteration which used sub-classing which ended up having way too much overhead. I've switched to a more flexible delegate / public property object model which is significantly better. My code is slightly more accurate for most situations, I ... |
I thought I'd give this a shot using classes and polymorphism. I had a previous iteration which used sub-classing which ended up having way too much overhead. I've switched to a more flexible delegate / public property object model which is significantly better. My code is very slightly more accurate, I wish I could co... |
I thought I'd give this a shot using classes and polymorphism. I had a previous iteration which used sub-classing which ended up having way too much overhead. I've switched to a more flexible delegate / public property object model which is significantly better. My code is very slightly more accurate, I wish I could co... |
I thought I'd give this a shot using classes and polymorphism. I had a previous iteration which used sub-classing which ended up having way too much overhead. I've switched to a more flexible delegate / public property object model which is significantly better. My code is very slightly more accurate, I wish I could co... |
@Peter Coulton -- you don't read Knuth, you study it.
For me, and my work... _Purely Functional Data Structures_ is great for thinking and developing with functional languages in mind. |
In .NET, enumeration values are (by default) serialized into xml with the name. For instances where you can have multiple values ([flags](http://msdn.microsoft.com/en-us/library/system.flagsattribute.aspx)), then it puts a space between the values. This works because the enumeration doesn't contain spaces, so you can g... |
this is a total hack but you could use an iframe inside the noscript tag to trigger an HTTP GET on a url to tell the server that a user doesn't have javascript enabled.
<body>
...
...
<noscript>
<iframe src ="/nojs.aspx?SOMEIDENTIFIER=XXXX&NOJS=TRUE" style="display: none;">
</ifr... |
Take a look at Apache's [Axis][1] project. It's well supported on C++ (and Java) and if you have the good fortune to start with a good WSDL for the target service you'll be home-free.
[1]: http://ws.apache.org/axis/index.html |
I primarily use [Microsoft Enterprise Library Data Access Block][1] to access stored procedures in MS SQL Server databases.
[1]: http://msdn.microsoft.com/en-us/library/cc309504.aspx |
inline lists with graphical links in css |
|html|css|xhtml|list| |
given this html:
<ul id="topnav">
<li id="topnav_galleries"><a href="#">Galleries</a></li>
<li id="topnav_information"><a href="#">Information</a></li>
</ul>
and this css:
#topnav_galleries a, #topnav_information a {
background-repeat: no-repeat;
text-indent: -9000px;
paddi... |
See Apache Commons' [DateUtils][1]. There's a `parseDate` method that takes your `String` and multiple patterns to try and spits out a `Date` instance.
[1]: http://commons.apache.org/lang/api-release/org/apache/commons/lang/time/DateUtils.html |
How do I return an array of strings from an ActiveX object to JScript |
|com|activex|javascript| |
I need to call into a Win32 API to get a series of strings, and I would like to return an array of those strings to JScript. This is for script that runs on local machine for administration scripts, not for the web browser.
My IDL file for the COM object has the interface that I am calling into as:
<pre>
HRESULT G... |
Depends what you mean by a generic Windows CE installation. Windows CE itself is a modularised operating system, so different devices can have different modules included. Therefore each Windows CE device can have a radically different OS installed (headless even).
Coredll is the standard "common" library that gets i... |
I think I misunderstood your question. What you're asking for is not in scope of how the application handles its key storage, but rather how your company will store it.
In that case, you have two obvious choices:
- Physical: Write to USB drive, burn to CD, etc. Store in physically secure location. But you ru... |
How to implement file upload progress bar on web? |
|javascript|ajax| |
I would like display something more meaningful that animated gif while users upload file to my web application. What possibilities do I have? |
|javascript|ajax| |
I would like display something more meaningful that animated gif while users upload file to my web application. What possibilities do I have?
*Edit: I am using .Net but I don't mind if somebody shows me platform agnostic version.* |
|.net|javascript|ajax| |
Round numbers, yes. This is the [main example source][1].
/*
* Copyright (c) 1995 - 2008 Sun Microsystems, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* ar... |
One way would be through automating a browser -- you mentioned WebClient, so I'm guessing you might be referring to WebClient in .NET.<p>Two main points:<ul><li>There's nothing special about https related to WebClient - it just works</li><li>Cookies are typically used to carry authentication -- you'll need to capture a... |
One way would be through automating a browser -- you mentioned WebClient, so I'm guessing you might be referring to WebClient in .NET.<p>Two main points:<ul><li>There's nothing special about https related to WebClient - it just works</li><li>Cookies are typically used to carry authentication -- you'll need to capture a... |
You can use `(this)` to reference the object the fired the function.
`'this'` is a DOM element when you are inside of a callback function (in the context of jQuery), for example, being called by the click, each, bind, etc. methods.
|
It isn't clear from your question which WebClient class (or language) you are referring to.
If have a Java Runtime you can use the Apache HttpClient class; here's an example I wrote using Groovy that accesses the delicious API over SSL:
def client = new HttpClient()
def credentials = new Usernam... |
Team Explorer on codeplex anonymously |
|version-control|tfs|codeplex| |
I was on codeplex and trying to connect to their source control using team explorer. No joy though.
I tried connecting with https or http, using the server name and the project name. As I do not have a user on codeplex I could not login.
I am just trying to check out some code without changing it. My question is... |
Sorry for the late response, I was out of office.
If that's the expected functionality I think it's not so usefull, at least there should be a reset.
I fixed it now just using the FLASHW_ALL | FLASHW_TIMERNOFG combination.
Btw, can't rate your answers, not enough rep yet. |
Memcache control panel? |
|memcached|cache|controlpanel|eaccelerator| |
We've been running [eAccelerator][1] on each of 3 webservers and are looking to move to a [memcache][2] pool across all 3, hopefully reducing by about 2/3 our db lookups.
One of the handy things about eAccelerator is the web-based control interface ([control.php][3]), which has proved very useful when we've had to f... |
|caching|memcached|controlpanel|eaccelerator| |
I recommend [nose](http://www.somethingaboutorange.com/mrl/projects/nose/).
It is the most Pythonic of the unit test frameworks. The test runner runs both doctests and unittests, so you are free to use whatever style of test you like. |
Before you start searching for duplicate addresses in your database, you should first make sure you store the addresses in a standard format.
Most countries have a standard way of formatting addresses, in the US it's the USPS CASS system: <http://www.usps.com/ncsc/addressservices/certprograms/cass.htm>
But most o... |
>.NET Strings are Immutable
>Therefore having an instance method makes absolutely no sense.
By that logic the string class should have no instance methods which return modified copies of the object, yet it has _plenty_ (Trim, ToUpper, and so on). Furthermore, lots of other objects in the framework do this too.
... |
I have no idea what's causing the problem but I know who might be able to help you. Safari is built on [Webkit][1] and short of Apple (who are not so community minded) the [Webkit team][2] might know what the issue is.
It's not a stupid question at all.
[1]: http://webkit.org/
[2]: http://webkit.org/contact.... |
Today's web browsers only handle GETS + POSTS. In Rails, for example, PUTS + DELETES are "faked" through hidden form fields.
Unless your framework has some workaround to "support" PUTS + DELETES, don't worry about them for now. |
I've noticed something very similar. I think it is because Firefox and IE, when going back, are retrieving the page from the server again and Safari is not. Have you tried adding a page expiry/no cache header? I was going to look into it when I discovered the behaviour but haven't had time yet. |
An iframe solves the problem:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><title>Safari Back Button Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body onload="alert('Hello');">
<a href="http://www.codi... |
To be honest, I understand closures perfectly well except I've never been clear about what exactly is the thing which is the "closure" and what's so "closure" about it. I recommend you give up looking for any logic behind the choice of term.
Anyway, here's my explanation:
def foo():
x = 3
def ... |
Stream data (such as music) using PHP (or another language) |
|stream|mp3|php|sockets| |
For years, I've been investigating how to create music streams from my computer. I've seen programs, but anything useful I've seen is windows only (I use a Mac).
Eventually, I got interested in *how* streams work. Is there any way I could create my *own* stream, possibly using socket functions in PHP? Is there a ... |
|php|sockets|mp3|stream| |
There's also red5 ([http://osflash.org/red5][1]) that is pretty much dedicated to streaming and shared objects on the server - it is java though. However, weborb ([http://www.themidnightcoders.com/weborb/][2]) has some awesome benefits on the data access side if you're looking to do some AMF as well as streaming video... |