instruction
stringlengths
0
30k
|java|javascript|servlets|activemq-classic|jms|
I am building a site that uses a simple AJAX Servelt to talk JMS (ActiveMQ) and when a message arrives from the topic to update the site. I have Javascript that creates an XMLHttpRequest for data. The Servelt processes the Get Request and sends back JSON. However I have no idea how to connect my Servlet into my Acti...
Write a Servelt that Talks to JMS (ActiveMQ) and OnMessage Update the Site
fstream are great but I will go a little deeper and tell you about [RAII](http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization). The problem with a classic example is that you are forced to close the file by yourself, meaning that you will have to bend your architecture to this need. RAII makes use of...
How to set proxy with credentials to generated WCF client?
|wcf|
I have a problem to connect to my WCF service if customer is using proxy with credentials. I'm unable to find the way to set credential to generated client proxy. If I use the web service, then it is possible to set proxy.
Indexes is a method which database systems use to quickly find data. The real world analogy are indexes in books. If an author/publisher does a good job at indexing their book, it becomes pretty easy for the reader to directly go to the page they want to read simply by looking at the index. Same goes for a database....
Here is an example of someone successfully direct loading timestamp data: [`Loading Data (Part 4): sqlldr (direct, skip_index_maintainance)`][1] [1]: http://oracle-unix.blogspot.com/2007/07/loading-data-part-4-sqlldr-direct.html
<h3>HtmlHelper</h3> The html helper methods check the ViewDataDictionary for a value. The value can either be in the dictionary or in the Model, as a property. To extract the value, an internal sealed class named the ViewDataEvaluator uses PropertyDescriptor to get the value. Then, Convert.ToString() is called to conv...
<h3>HtmlHelper</h3> The html helper methods check the ViewDataDictionary for a value. The value can either be in the dictionary or in the Model, as a property. To extract the value, an internal sealed class named the ViewDataEvaluator uses PropertyDescriptor to get the value. Then, Convert.ToString() is called to conv...
A language lawyer question. Hmkay. My personal top3: 1. violating the strict aliasing rule 2. violating the strict aliasing rule 3. violating the strict aliasing rule :-) **Edit** Here is a little example that does it wrong twice: (assume 32 bit ints and little endian) float funky_float_abs...
The answer is "it depends". I use the first example if I consider 0, "", [] and False (list not exhaustive) to be equivalent to None in this context.
Thanks to @Pax Diablo, @bvmou and @Arachnid for the suggestion of using full datetimes throughout. If I have to accept datetime.time objects from an external source, then this seems to be an alternative `add_secs_to_time()` function: def add_secs_to_time(timeval, secs_to_add): dummy_date = datetime.dat...
This won't scale very well. Having a large number of threads means the VM has to spend more time context-switching, and memory useage will be higher due to each thread requiring its own stack space. You would be better off with a smaller number of threads processing in a pipeline fashion, or use the thread pool with as...
You can't. from [log4net SDK Reference RollingFileAppender Class ][1] **CAUTION** A maximum number of backup files when rolling on date/time boundaries is not supported. [1]: http://logging.apache.org/log4net/release/sdk/log4net.Appender.RollingFileAppender.html
It's not the same as "not adding these properties", but the last time I saw this, the engineer addressed it by implementing concrete NHibernate classes and deriving them from a common abstract base class (e.g. MyAuditable) that implemented the properties you dislike. This way you only have to solve the problem once.
If it's going into an HTML attribute, you'll need to both HTML-encode (as a minimum: `>` to `&gt;` `<` to `&lt` and `"` to `&quot;`) it, *and* escape single-quotes (with a backslash) so they don't interfere with your javascript quoting. Best way to do it is with your templating system (extending it, if necessary), ...
If it's going into an HTML attribute, you'll need to both HTML-encode (as a minimum: `>` to `&gt;` `<` to `&lt` and `"` to `&quot;`) it, *and* escape single-quotes (with a backslash) so they don't interfere with your javascript quoting. Best way to do it is with your templating system (extending it, if necessary), ...
Technical issues when switching to an unmanaged Virtual Private Server (VPS) hosting provider?
|ssl|virtualization|hosting|reverse-dns|
I'm considering moving a number of small client sites to an unmanaged VPS hosting provider. I haven't decided which one yet, but my understanding is that they'll give me a base OS install (I'd prefer Debian or Ubuntu), an IP address, a root account, SSH, and that's about it. Ideally, I would like to create a complet...
|ssl|hosting|virtualization|reverse-dns|
|hosting|virtualization|vps|reverse-dns|
Playing around with Computer Management (assuming you're running Windows here) and it seems like you can make it monitor a process over time. Go to computer management -> performance logs and alerts and look at the counter/trace logs. Right click on counter logs and add a new log. Now click add object and select mem...
[This solution][1] is about forms authentication, but it details the 401 issue. > The solution was simply to attach a > handler to the Application's > EndRequest event by putting the > following in Global.asax: protected void Application_EndRequest(object sender, EventArgs e) { if (Context.Item...
setInterval is feeding cycleCharts actual timing data. you want var cycleId = setInterval(function(){ cycleCharts( someId ); }, 10000);
setInterval is feeding cycleCharts actual timing data ( so one can work out the actual time it ran and use to produce a less stilted response, mostly practical in animation ) you want var cycleId = setInterval(function(){ cycleCharts(); }, 10000);
setInterval is feeding cycleCharts actual timing data ( so one can work out the actual time it ran and use to produce a less stilted response, mostly practical in animation ) you want var cycleId = setInterval(function(){ cycleCharts(); }, 10000); ( this behavior may not be standardized, so don't rely o...
Here is one way that works. Sub Main() Dim fs As New FileSystemObject ' Add Reference to Microsoft Scripting Runtime MsgBox fs.FileExists("\\server\folder\file.ext") End Sub
You can use string.Format to easily pad a value with spaces e.g. string a = String.Format("|{0,5}|{1,5}|{2,5}", 1, 20, 300); string b = String.Format("|{0,-5}|{1,-5}|{2,-5}", 1, 20, 300); // 'a' will be equal to "| 1| 20| 300|" // 'b' will be equal to "|1 |20 |300 |"
What is the best documentation for snapshots and flow repositories in Spring Web Flow?
|java|documentation|spring|webflow|
I'm looking for more and better documentation about snapshots, flow repositories, and flow state serialization in Spring Web Flow. Available docs I've found seem pretty sparse. "Spring in Action" doesn't talk about this. The Spring Web Flow Reference Manual does mention a couple flags here: http://static.springfr...
Here are some tools that can make it easier and safer to work (Googling the names will bring up the relevant pages): Subversion - Source control NUnit - Testing framework CruiseControl.Net - Automated builds
The html helper methods check the ViewDataDictionary for a value. The value can either be in the dictionary or in the Model, as a property. To extract the value, an internal sealed class named the ViewDataEvaluator uses PropertyDescriptor to get the value. Then, Convert.ToString() is called to convert the object return...
Unfortunately, I don't know of a way to restart the application and still maintain your session. A workaround is to set the PC back to the entry point of your program. You can do this by either calling: <code>jump _function_</code> or <code>set $pc=_address_</code>. If you munged the arguments to <code>m...
Unfortunately, I don't know of a way to restart the application and still maintain your session. A workaround is to set the PC back to the entry point of your program. You can do this by either calling: <code>jump _function_</code> or <code>set $pc=_address_</code>. If you munged the arguments to <code>m...
You can use one of the many tools designed specifically for this. One of them is [Google Datacenter Search at iWebTool](http://www.iwebtool.com/google_datacenter_search). (It's really all about getting a list of data center IPs and sending the same GET variable to them as to google.com.)
You can use one of the many tools designed specifically for this. One of them is [Google Datacenter Search at iWebTool](http://www.iwebtool.com/google_datacenter_search). (It's really all about getting a list of data center IPs and sending the same GET variable to them as to google.com.) *edit* Here is a complete...
You can use one of the many tools designed specifically for this. One of them is [Google Datacenter Search at iWebTool](http://www.iwebtool.com/google_datacenter_search). (It's really all about getting a list of data center IPs and sending the same GET variable to them as to google.com.)
If you take out the empty list from the call to set() in Terhost's answer, you get a little speed boost. Change: found = set([]) to: found = set() However, you don't need the set at all. def unique(items): keep = [] for item in items: if item not in keep: ...
You'll get it as part of a Visual Studio install (if you included the SDK), or in a standalone SDK install. It'll live somewhere like `C:\program files\Microsoft Visual Studio 8\SDK\v2.0\Bin` If you don't already have it, you can download the .NET SDKs from <a href="http://msdn.microsoft.com/en-us/netframework/aa...
I am not sure how much you already know on the topic, but I believe Wikipedia's article on [L-system](http://en.wikipedia.org/wiki/L-system "L-system") should be a good start. "using code" is a bit fuzzy, so I can hardly answer. You might find some freeware to experiment with L-systems, you can play with some graphi...
SQL Server locks explained
|sql-server|locking|
Below is a list of locks that SQL Server 2000 is meant to support. I am a bit confused as to what the "intent" locks actually mean. I've looked around on the Web and the answers seem to be a bit cryptic. Further to getting an answer to my specific question, I am hoping to use this question as a Wiki for what each l...
for mssql (and maybe others) the syntax looks like: create index <indexname> on <tablename>(<column1>[,<column2>...])
public struct MemoryStatus { public uint Length; public uint MemoryLoad; public uint TotalPhysical; public uint AvailablePhysical; public uint TotalPageFile; public uint AvailablePageFile; public uint TotalVirtual; public uin...
The p/invoke way public struct MemoryStatus { public uint Length; public uint MemoryLoad; public uint TotalPhysical; public uint AvailablePhysical; public uint TotalPageFile; public uint AvailablePageFile; ...
The p/invoke way **EDIT** : Changed to GlobalMemoryStatusEx to give accurate results (heh) [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] private class MEMORYSTATUSEX { public uint dwLength; public uint dwMemoryLoad; public ulong ullTotalPhys; ...
You've allocated arr in foo, but that pointers value is stored in the call stack. If you want to do this, do it like this: void foo( int ** arr) { *arr = (int *)malloc( sizeof(int) * 25 ); (*arr)[3] = 69; } And in main, simply pass a pointer to foo (like foo(&arr))
Thanks for the replies so far I should point out i'm not the one that does the maintenance nor do I have access all the time to IIS. Also I prefer options where I do nothing as like all programmers I am a bit lazy. I know one way is to check a flag on every page but i'm hoping to avoid it. Could I not do something w...
First, some general comments about you requirements: - reading OBJ or OFF files is very easy. You could implement it yourself, on top of a library providing the more geometric features, in a few minutes. On the other hand, the geometric part of such libraries is so much more tricky that you should certainly focus ...
In my experience, validation rules are seldom universal across all screens/forms/processes in an application. Scenarios like this are common: on the add page, it may be ok for a Person object not to have a last name, but on the edit page it must have a last name. That being the case I've come to believe that validation...
This may be a silly question, but did you double check to make sure you have the toolkit reference at the top of your aspx file?
This may be a silly question, but did you double check to make sure you have the toolkit reference at the top of your aspx file? (Adding from comment for ease of reading) Try adding this to your web.config <system.web.extensions> <scripting> <scriptResourceHandler enableCompression=...
How do I escape a string inside javascript inside an onClick handler?
|javascript|html|string|escaping|
Maybe I'm just thinking about this too hard, but I'm having a problem figuring out what escaping to use on a string in some javascript inside a link's onClick handler. Example: <a href="#" onclick="SelectSurveyItem('<%itemid%>', '<%itemname%>'); return false;">Select</a> The `<%itemid%>` and `<%itemname%>` a...
Maybe I'm just thinking about this too hard, but I'm having a problem figuring out what escaping to use on a string in some javascript inside a link's onClick handler. Example: <a href="#" onclick="SelectSurveyItem('<%itemid%>', '<%itemname%>'); return false;">Select</a> The `<%itemid%>` and `<%itemname%>` a...
Fastest way to find objects from a collection matched by string member
|c#|string|collections|arrays|performance|
ADI's [Blackfin][1] is another option since it's quite a straight forward architecture to program, yet can also do some fairly hefty DSP stuff should you choose to go down that route. It helps that the assembly language is quite sane too. The Blackfin [STAMP][2] boards are an inexpensive (~$100 last I checked) way i...
Here's my printf primer: http://www.pixelbeat.org/programming/gcc/format_specs.html I always compile with -Wall with gcc which will warn about any mismatches between the supplied printf formats and variables.
Unfortunately not :( There are some very useful sites however. I find one of the best is [cocoadev.com][1] as it contains lots of useful information about many of the more obscure classes usually including snippets of code to do some really cool things :) Maybe we (the cocoa community) should look into building some...
Unfortunately not :( There are some very useful sites however. I find one of the best is [cocoadev.com][1] as it contains lots of useful information about many of the more obscure classes usually including snippets of code to do some really cool things :) Maybe we (the cocoa community) should look into building some...
I really don't think that what you want reflects the structure better. To define a schema (think XSD) for this you would have to know all of the potential keys in advance since you indicate that you want each one to be a separate custom type. Conceptually Bars would be an array of objects holding objects of type Key0...
It's not an easy issue, and I know of no library to do it. I might sit down and try to write something like this sometime. I'd do it in either Prolog, Java or Haskell, though. As far as I can see, there are several issues: - Tokenization: sometimes, numbers are written eleven hundred fifty two, but I've seen elevenh...
Hmm... I wouldn't use garbage collection as an argument for/against the use of structs vs classes. The managed heap works much like a stack - creating an object just puts it at the top of the heap, which is almost as fast as allocating on the stack. Additionally, if an object is short-lived and does not survive a GC...
Eclipse [Metrics Feature][1] ([update site][2]) The blurb: > This Eclipse plugin calculates various metrics for your code during build cycles and warns you, via the Problems view, of ‘range violations’ for each metric. This allows you to stay continuously aware of the health of your code base. You may also export ...
Eclipse [Metrics Feature][1] ([update site][2]). The blurb: > This Eclipse plugin calculates various metrics for your code during build cycles and warns you, via the Problems view, of ‘range violations’ for each metric. This allows you to stay continuously aware of the health of your code base. You may also export...
RegisterClientScriptBlock
|asp.net|javascript|
ASP.NET 2.0 provides the `ClientScript.RegisterClientSCriptBlock()` method for registering Javascript in an ASP.NET Page. The issue I'm having is passing the script when it's located in another directory. Specifically, the following syntax does not work: ClientScript.RegisterClientScriptBlock(this.GetType(),...
Custom row source for combo box in continuous form in Access
|ms-access|
Generally it is, for the version control and commenting reasons discussed by others, and I'd apply that in 95% of all cases. however there are circumstances where it does make sense, for example if I'm coding graphics and I want a couple of variables to represent texture coordinates (always referenced by convention as...
MySQL describe tablename
If you systematically encode all user input before displaying then yes, you are safe. However problems arise when you need to let **some** tags go unencoded so that you allow users to post images or bold text or any feature that requires user's input be processed as (or converted to) un-encoded markup. You will h...
If you systematically encode all user input before displaying then yes, you are safe. However problems arise when you need to let **some** tags go unencoded so that you allow users to post images or bold text or any feature that requires user's input be processed as (or converted to) un-encoded markup. You will h...
If you systematically encode all user input before displaying <s>then yes, you are safe</s> you are still not 100 % safe.</s> (See @[Avid](#70222)'s post for more details) In addition problems arise when you need to let **some** tags go unencoded so that you allow users to post images or bold text or any featur...
"Error Creating Window Handle"
|.net|winforms|handles|
We're working on a very large .NET WinForms composite application - not CAB, but a similar home grown framework. We're running in a Citrix and RDP environment running on Windows Server 2003. We're starting to run into random and difficult to reproduct "Error creating window handle" error that seems to be an old f...
Here several examples why : 1. Template code is impossible to write with exception specifications, template<class T> void f( T k ) { T x( k ); x.x(); } The copies might throw, the parameter passing might throw, and ``x()`` might throw some unknown e...
As previously stated, use AppDomain.CreateDomain to create a new app domain. You can then load an assembly into it using the Load method, or even execute an assembly using the ExecuteAssembly method. You can use GetAssemblies to see if an assembly has already been loaded. Be aware too that you cannot unload an assem...
I am building a site that uses a simple AJAX Servelt to talk JMS (ActiveMQ) and when a message arrives from the topic to update the site. I have Javascript that creates an XMLHttpRequest for data. The Servelt processes the Get Request and sends back JSON. However I have no idea how to connect my Servlet into my Acti...
Write a Servlet that Talks to JMS (ActiveMQ) and OnMessage Update the Site
I am building a site that uses a simple AJAX Servlet to talk JMS (ActiveMQ) and when a message arrives from the topic to update the site. I have Javascript that creates an XMLHttpRequest for data. The Servlet processes the Get Request and sends back JSON. However I have no idea how to connect my Servlet into my Acti...
The first thing I would check is whether you need to connect via an HTTP proxy (in which case direct connections bypassing the proxy will likely time out). Run Wireshark and see what happens.
When you say "search against a DB", what do you mean? Relational databases and information retrieval systems use very different approaches for good reason. What kind of data are you searching? What kind of queries do you perform? If I were going to implement an inverted index on top of a database, as Compass does...
Looking at the jQuery source code, there are four returned statuses, in additon to **success**: - **timeout** - when your specified timeout is exceeded - **error** - http error, like 404 - **notmodified** - when requested resource was not modified since last request - **parsererror** - when...
Looking at the jQuery source code, there are four returned statuses, in additon to **success**: - **timeout** - when your specified timeout is exceeded - **error** - http error, like 404 - **notmodified** - when requested resource was not modified since last request - **parsererror** - when...
Putting it in `WEB-INF` will hide the XML file from users who try to access it directly through a URL, so yes, I'd say put it in `WEB-INF`.
If you want to enforce the use of a constructor, you could set your object's default parameterless constructor to private, and leave public only some enforced constructors: public class SomeObject { private SomeObject() {} public SomeObject(string someString) //enforced construc...
I like [Profont][1], I first came across it when [Jeff blogged about programming fonts][2] [1]: http://www.tobias-jung.de/seekingprofont/ [2]: http://www.codinghorror.com/blog/archives/000157.html
In addition to the above mentioned: - http://weblogs.asp.net/stephenwalther - [Asp.net MVC in Action][1] looks to be a good book. [1]: http://www.manning.com/palermo/
I'm not *totally* understanding the setup that's leading to the problem, but you might want to explore the useIFrame property of the YUI Autocomplete object -- it layers an iframe object beneath the autocomplete field, which allows the field to then float above the objects that are obscuring it in IE's buggy layout. ...
Exceptions should not be thrown as a **normal** part of validation. Validation invoked from within business objects is a last line of defense, and should only happen if the UI fails to check something. As such they can be treated like any other runtime exception. Note that here's a difference between defining valida...