instruction stringlengths 0 30k ⌀ |
|---|
Any downsides to using ASP.Net AJAX and JQuery together |
|asp.net|ajax|jquery| |
We are planning to use the JQuery library to augment our client side JavaScript needs.
Are there any major issues in trying to use both ASP.Net AJAX and JQuery? Both libraries seem to use $ for special purposes. Are there any conflicts that we need to be aware of?
We also use Telerik controls that use ASP.Net A... |
|jquery|asp.net-ajax| |
var str = 'foo bar "lorem ipsum" baz';
var results = str.match(/("[^"]+"|[^"\s]+)/g);
... returns the array you're looking for.
Note, however:
- Bounding quotes are included, so can be removed with `replace(/^"([^"]+)"$/,"$1")` on the results.
- Spaces between the quotes will stay intact. So, i... |
[0-9][0-9][0-9] will match a *minimum* of 3 numbers, so as Joe mentioned, you have to (at a minimum) include \b. |
[0-9][0-9][0-9] will match a *minimum* of 3 numbers, so as Joe mentioned, you have to (at a minimum) include \b or anything else that will delimit the numbers. Probably the most sure-fire method is:
[^0-9][0-9][0-9][0-9][^0-9] |
Best way to serialize and Image |
|.net|web-services| |
I am serializing a JPEG Image in c#.net. I am simply converting it into a byte steam and sending it through web service. I observed that serialized byte stream is 30 times more than that of the size of actual image. Can any one suggest me a better approach to serialize and stay relative to the size of the actual image?... |
How can I get a more compact serialization of an image? |
|.net|web-services|serialization| |
What is a good regression testing framwork for software applications? |
|testing| |
Am looking for a regression test framework where I can add tests to.. Tests could be any sort of binaries that poke an application.. |
And if the size of the images you send by webservices can be large, maybe you can take a look to MTOM. It's a WS-* standard to optimize the size of message with binary attachments. It's now very integrated in stacks like Axis2 or Metro for Java or in .NET :
http://msdn.microsoft.com/en-us/library/aa528822.aspx (wse... |
Consider using [WCF streaming][1]. I didn't notice an overhead transmitting files via this service.
MSDN:
[Large Data and Streaming][2]
[1]: http://kjellsj.blogspot.com/2007/02/wcf-streaming-upload-files-over-http.html
[2]: http://msdn.microsoft.com/en-us/library/ms733742.aspx |
I assume you connect the two serial ports using a "null modem" cable.
Use a program like minicom to talk to remote system -- you probably need to set up the communication parameters and possibly turn off hardware flow control (if your cable doesn't have the flow-control lines connected).
|
Why not convert it to a Base64String?
byte[] arr = File.ReadAllBytes(filename);
string str = Convert.ToBase64String(arr);
On the other end you can change it back to a byte[] by going:
byte[] arr = Convert.FromBase64String(string); |
You did not indicate what language you are working in, but the xUnit family is available for a lot of different languages.
/Allan |
How to infer coercions? |
|programming-languages|compiler-construction|types|type-inference|type-theory| |
I would like to know how to infer coercions (a.k.a. implicit conversions) during type inference. I am using the type inference scheme described in [Top Quality Type Error Messages](http://people.cs.uu.nl/bastiaan/phdthesis/index.html) by Bastiaan Heeren, but I'd assume that the general idea is probably the same in all ... |
You're missing your C library development headers. You should install a package that has them. These are necessary to install this module because it has to compile some non-perl C code and needs to know more about your system.
I can't tell what kind of operating system you're on, but it looks like linux. If it's deb... |
I keep my personal projects on assembla. Wiki, Issue Tracking, Source Control... very useful. |
So let's say you want to compile C# into Javascript. You are asking whether you can take advantage of the existing C# compilers, so instead of compiling C# into Javascript directly you actually convert the MSIL generated by the C# compiler into Javascript?
Sure, you can do that. Once you have the MSIL binary you can... |
It's that, InStr()/SubString(), changing Operator(1) to Operator(001), storing the n in Operator(n) separately, or creating a computed column that hides the ugly string manipulation. What you have seems fine. |
Awfully hard to read without line breaks, but it looks like you are missing `sys/types.h` on your system. Do you have a full build environment installed (gcc, make, etc.)? What OS and distribution are you using?
In the future, you should bockquote output like this (select the text and click the quote button). |
NHibernate to not cache a property |
|.net|nhibernate|caching| |
How can I configure NHibernate to not cache a file. I know I can create a method that does an HSQL, but can I through a configuration setting in the <class>.xml file or the hibernate xml file itself to not cache a property?
Thanks in advance. |
They're just properties of table1's table2 property.
select t1.table2.property1, t1.table2.property2, ... from table1 as t1
Here's the relevant part of the [hibernate doc][1].
[1]: http://www.hibernate.org/hib_docs/reference/en/html/queryhql.html#queryhql-select |
They're just properties of table1's table2 property.
select t1.table2.property1, t1.table2.property2, ... from table1 as t1
You might have to join, like so
select t2.property1, t2.property2, ...
from table1 as t1
inner join t1.table2 as t2
Here's the relevant part of the [hibernat... |
execute an insert and then log in one sqlcommand |
|sql| |
I've been asked to implement some code that will update a row in a database and then use a stored proc to insert the update in a history table. We can't add a stored proc to do this since we don't control the database. I know in sprocs you can do the update and then call execute on another stored proc. Can I set it ... |
|javascript|encryption|passwords|twitter| |
> The problem with turning off this "hosting process" is that all the "run and rewrite" functionality is no longer available.
The Visual Studio Hosting Process is not needed to allow Edit and Continue. It is used for "Design time expression Evalutation" in the case where the project is a dll rather than an EXE. It ... |
How do I make my Linux desktop sexy? |
|linux|compiz|compizfusion|3d|desktop| |
Anyone got any tips on how to improve the look and feel of the Linux desktop?
My contribution is: if you have half decent 3D acceleration on board, get CompizFusion for desktop effects to make the Mac boys cry!
[http://en.wikipedia.org/wiki/Compiz][1]
[1]: http://en.wikipedia.org/wiki/Compiz |
|linux|compiz|compizfusion|desktop| |
How can I add 3D effects to my Linux Desktop? |
How can I add 3D effects to my Linux desktop?
@Rob Cooper - thanks for the heads-up, hope this reword addresses the issues
|
How can I improve the Look and Feel of my Linux Desktop? |
How can I improve the look and feel of my Linux desktop?
I found Compiz and it's awesomely cool - so what else don't I know about? Looking for ideas in general for cool things to try.
@Rob Cooper - thanks for the heads-up, hope this reword addresses the issues
|
How can I improve my programming experience on my Linux Desktop? |
How can I improve the look and feel of my Linux desktop to suit my programming needs?
I found Compiz and it makes switching between my workspaces (which is something I do all the time to make the most of my 13.3" screen laptop) easy and look great - so what else don't I know about that make my programming environmen... |
|linux|desktop|compiz| |
[DT Search][1] is hands down the best search tool I have used. They have a number of solutions available. Their Engine will run on Native Win32, Linux or .NET. It will index pretty much every kind of document you might have (Excel, PDF, Word, etc.) I did some benchmarks comparisons a while ago and it was the easies... |
prepend to a file one liner shell? |
|shell| |
This is probably [a complex solution][1].
I am looking for a simple operator like ">>", but for prepending.
I am afraid it does not exist. I'll have to do something like
<pre>
mv $F tmp
cat header tmp > $F
</pre>
Anything smarter? (I am not fond of tmp files)
[1]: http://www.linuxtopia.org/online_b... |
|linux|shell| |
|unix|shell| |
I was initially thinking alt-left and alt-right might do what you want, but that's more for going forward and backwards in history of tabs you've viewed. Which might sort of get you what you want, but is probably just as confusing as alt-F6.
I think it sounds more like a bug in Eclipse, might be worth going over to ... |
If you derive from ListBox there is the RefreshItem protected method you can call. Just re-expose this method in your own type.
public class ListBox2 : ListBox {
public void RefreshItem2(int index) {
RefreshItem(index);
}
}
Then change your designer file to use your own type (in this case, ListBox... |
With ctrl-e you can jump directly to any editor by typing the beginning of it's name. Quite handy when you've got a lot of editors open.
|
When you start trying to do things that become difficult in shell-script, I would strongly suggest looking into rewriting the script in a "proper" scripting language (Python/Perl/Ruby/etc)
As for prepending a line to a file, it's not possible to do this via piping, as when you do anything like `cat blah.txt | grep s... |
How to capturing crash logs in Java |
|java|error-handling|crash| |
I'm working on a cross platform application in Java which currently works nicely on Windows, Linux and MacOS X. I'm trying to work out a nice way to do detection (and handling) of 'crashes'. Is there an easy, cross-platform way to detect 'crashes' in Java and to do something in response?
I guess by 'crashes' I mean ... |
Let me add to the other answers [jwz's howto][1] on setting view options on .dmg files. This is the simplest one that I got to work with no problems.
To change the icon from the default .dmg icon:
* In the Finder, open an inspector window (^I) for the file whose icon you want to use, click on the icon at the top... |
You can build 1.1 projects in Visual Studio 2005:
<http://www.hanselman.com/blog/BuildingNET11ProjectsUsingVisualStudio2005.aspx>
The MSBuild Everett Environment (MSBEE) has been announced, and soon this will be a (reasonably) supported scenario and we'll all be able to build both 1.1 and 2.0 versions of .NET cod... |
Most examples I've read do it by using either the command or memento pattern. But you can do it without design patterns too with a simple [deque-structure][1].
[1]: http://en.wikipedia.org/wiki/Deque |
Supported: Yes
Available: Not through normal channels. You might still find a boxed copy on Amazon or somewhere. |
I found [an article][1] referencing the MSDN article on [DLL search order][2] that says
> For managed code dependencies, the
> Global Assembly Cache always prevails;
> the local assembly in application
> directory will not be picked up if
> there is an existing (or newer with
> policy) copy in the GAC.
Consi... |
.NET 1.1 code can be imported in VS 2005, as .NET 2.0 is backward compatible with .NET 1.1.
You'll probably have to convert the project, but it should still run in VS 2005. |
I believe that vs2003 looses support in october |
As described in a paper titled [Real-Time Task Scheduling for Energy-Aware Embedded Systems][1], Swaminathan and Chakrabarty describe the challenges of real-time task scheduling in low-power (embedded) devices with multiple processor speeds and power consumption profiles available. The scheduling algorithm they outline... |
That was the intention of things like <A HREF="http://en.wikipedia.org/wiki/BogoMips">BogoMIPS</A>, but CPUs are a lot more complicated nowadays. Superscalar CPUs can issue multiple instructions per clock, making any measurement based on counting clock cycles to execute a block of instructions highly inaccurate.
CPU... |
How can I use a traditional HTML id attribute with an ASP.net runat='server' tag? |
|asp.net|css| |
I am refactoring some CSS on a website I have been working on, and noticed the absence of traditional HTML IDs in the code. There is heavy use of CssClass='…', or sometimes just class='…', but I can't seem to find a way to say id='…' and not have it swapped out by the server.
Here is an example:... |
I am refactoring some CSS on a website I have been working on, and noticed the absence of traditional HTML IDs in the code. There is heavy use of CssClass='…', or sometimes just class='…', but I can't seem to find a way to say id='…' and not have it swapped out by the server.
Here is an example:... |
|asp.net|css| |
There are some common performance tweeks. SVN is very IO heavy, so faster hard disks are an option (on both ends). Add more memory to your server. Make sure your clients have a defragmented hard disk (for Windows).
What access method you use also matters. Repositories stored on remote filesystems (using file:/// a... |
Also: errors do propagate upwards: if method X calls methods Y and Z, a single error handler in method X will cover all three methods. |
Make sure your connection to the server is a fast as can be (gigabit ethernet).
Make sure the server has fast disks in an array.
And, of course, only check out what you need. |
Monitoring web and DB access logs should alert you to things like this, but if you want a more fully featured alert system I would suggest some kind of IDS/IPS. You'll need a spare machine though, and a switch that can do port mirroring.
If you have those then an IDS is a cheap way of monitoring your traffic for many... |
Depending on how complicated you want to get, you can use a generic linking table. For one of my applications there are several reports where the user might pick, for instance a list of customers to run the report on rather than just a single customer from a combo box. I have a separate table with 2 fields:
- Un... |
I would have thought that the important thing to ask here is "what database platform are you using?"
For example, in Sybase, installing [MDA tables][1] might solve your problem, they provide a whole bunch of statistics from procedure call usage to average logical I/O, CPU time and index coverage. It can be as clever... |
Thanks onnodb
Unfortunately the client insists on MDI and the smaller title bar.
I have worked out one way of doing it which is to hide the title bar by overriding the windows CreateParams and then create my own title bar (simple panel with some Mouse handling for moving). Works well enough so I think I might run... |
Since you are already familiar with C and C++ I would recommend learning how to write a simple Windows GUI app using Charles Petzold's book. It will give you the fundamental understanding of how Windows works. It's good to understand that most everything that you see is a window (a button is a window for example) and... |
I've been asked to implement some code that will update a row in a ms sql database and then use a stored proc to insert the update in a history table. We can't add a stored proc to do this since we don't control the database. I know in sprocs you can do the update and then call execute on another stored proc. Can I ... |
You can query on them, but you can't make it part of the where clause. E.g.,
select t1.table2.x from table1 as t1
would work, but
select t1 from table1 as t1 where t1.table2.x = foo
would not. |
It is not only bad practice, but also less performant: The integer has to be boxed because String.Concat expectes an object while int.ToString() does not require boxing. |
Lot's of dynamic programming languages implement ideas from functional programming. The newer .Net languages (C# and VB) have what they call lambda's but these aren't side effect free.
It's not difficult combining concepts from functional programming and object oriented programming for example but it doesn't always ... |
Open-source full-text article recommendation engines |
|search|keywords|recommendation-engine|summary| |
I'm wondering if there are any good .NET recommendation algorithms available in open source projects, whether attached to a search engine or not. By recommendation I mean something that accepts a full-text article and recommends other articles from its index based on keyword similarity.
At the high end there are do... |
I'm wondering if there are any good .NET recommendation algorithms available in open source projects, whether attached to a search engine or not. By recommendation I mean something that accepts a full-text article and recommends other articles from its index based on keyword similarity.
At the high end there are do... |
Visual Studio 2003 is still available to download for MSDN subscribers.
The EULA for Visual Studio includes a 'downgrade' clause, which appears, IMNAL, to allow you to buy Visual Studio 2008 and then install 2003 under the same license.
> DOWNGRADE. You may install and use
> this version and an earlier version o... |
Mainstream support for VS2003 ends in October of this year:
[http://support.microsoft.com/lifecycle/search/?sort=PN&alpha=Visual+Studio][1]
Extended support (whatever that means) is still available for quite some time.
[1]: http://support.microsoft.com/lifecycle/search/?sort=PN&alpha=Visual+Studio |
In addition to Espo's link, look into [MSBee][1], an enhancements kit for MSBuild to better support .NET Framework 1.1.
It seems you can even [use .NET 1.1 with Visual Studio 2008][2], though, so you should have no problem.
That said, I'd be interested in hearing what made you choose against upgrading.
[1]... |
I've used the template before, i.e. web.dev.config, web.prod.config, etc, but now prefer the 'override file' technique. The web.config file contains the majority of the settings, but an external file contains environment-specific values such as db connections. Good explanation on [Paul Wilson's blog][1].
I think thi... |
I use this function adapted from codesta. [Edit: the very same one, I see, that scares you! Oops. Can't help you then.]
<http://blog.codesta.com/codesta_weblog/2007/12/net-gotchas---p.html>.
You use it by surrounding your code with a div like so. You could subclass the Form to include this automatically. I d... |
Just to verify that I didn't miss any loose ends:
$startDay = 1;
if (date("m") == 1) {
$startMonth = 12;
$startYear = date("Y") - 1;
$endMonth = 12;
$endYear = date("Y") - 1;
}
else {
$startMonth = date("m") - 1;
$startYear = date("Y");
$... |
Let me add to the other answers [jwz's howto][1] on setting view options on .dmg files. This is the simplest one that I got to work with no problems.
Also, to change the icon from the default .dmg icon:
* In the Finder, open an inspector window (^I) for the file whose icon you want to use, click on the icon at t... |
Let me add to the other answers [jwz's howto][1] on setting view options on .dmg files. This is the simplest one that I got to work with no problems.
Also, to change the icon from the default .dmg icon:
* In the Finder, open an inspector window (^I) for the file whose icon you want to use, click on the icon at t... |