question_id
int64
4
6.31M
answer_id
int64
7
6.31M
title
stringlengths
9
150
question_body
stringlengths
0
28.8k
answer_body
stringlengths
60
27.2k
question_text
stringlengths
40
28.9k
combined_text
stringlengths
124
39.6k
tags
listlengths
1
6
question_score
int64
0
26.3k
answer_score
int64
0
28.8k
view_count
int64
15
14M
answer_count
int64
0
182
favorite_count
int64
0
32
question_creation_date
stringdate
2008-07-31 21:42:52
2011-06-10 18:12:18
answer_creation_date
stringdate
2008-07-31 22:17:57
2011-06-10 18:14:17
156,810
156,881
Download files to local drive when sshed
What is the best way to download files to local hard drive when logged in to another computer using ssh in bash. I'm aware of sftp, but it is not convienent, e.g. it lacks tab completion of directory names. I'm using Ubuntu 8.04.1. I don't have a public IP and would not like to setup dynamic Dynamic DNS solution.
I'm also running Ubuntu 8.04.1, and if I type $ scp me@myserver.mydomain.com:.bashr I do indeed get tab completion (i.e. bash is sshing to my server and getting completion results from the filesystem there). Then $ scp me@myserver.mydomain.com:.bashrc. copies my.bashrc from my server to the current directory on my loca...
Download files to local drive when sshed What is the best way to download files to local hard drive when logged in to another computer using ssh in bash. I'm aware of sftp, but it is not convienent, e.g. it lacks tab completion of directory names. I'm using Ubuntu 8.04.1. I don't have a public IP and would not like to ...
TITLE: Download files to local drive when sshed QUESTION: What is the best way to download files to local hard drive when logged in to another computer using ssh in bash. I'm aware of sftp, but it is not convienent, e.g. it lacks tab completion of directory names. I'm using Ubuntu 8.04.1. I don't have a public IP and ...
[ "networking", "ssh", "sftp" ]
4
6
5,112
6
0
2008-10-01T09:09:38.090000
2008-10-01T09:40:57.420000
156,815
156,838
Explain x => x.ToString() //simplify so many calls
In a question answer I find the following coding tip:- 2) simple lambdas with one parameter: x => x.ToString() //simplify so many calls As someone who has not yet used 3.0 I don't really understand this tip but it looks interesting so I would appreciate an expantion on how this simplifies calls with a few examples. I'v...
When you need to create an instance of a delegate which has a single parameter, lambda expressions allow you to create that delegate "inline" in a very concise manner. For instance, here's code to find a particular person in a list, by their name: List list = new List (); // [..] Populate list here Person jon = list.Fi...
Explain x => x.ToString() //simplify so many calls In a question answer I find the following coding tip:- 2) simple lambdas with one parameter: x => x.ToString() //simplify so many calls As someone who has not yet used 3.0 I don't really understand this tip but it looks interesting so I would appreciate an expantion on...
TITLE: Explain x => x.ToString() //simplify so many calls QUESTION: In a question answer I find the following coding tip:- 2) simple lambdas with one parameter: x => x.ToString() //simplify so many calls As someone who has not yet used 3.0 I don't really understand this tip but it looks interesting so I would apprecia...
[ "c#", ".net-3.5", "lambda" ]
7
21
1,786
4
0
2008-10-01T09:11:00.037000
2008-10-01T09:16:35.310000
156,852
187,272
Dynamicaly populating a combobox with values from a Map based on what's selected in another combobox
Ok, here's one for the JavaScript gurus: In my app, one of the controllers passes a TreeMap to it's JSP. This map has car manufacturer's names as keys and Lists of Car objects as values. These Car objects are simple beans containing the car's name, id, year of production etc. So, the map looks something like this (this...
Well anyway, as i said, i finally managed to do it by myself, so here's my answer... I receive the map from my controller like this (I'm using Spring, don't know how this works with other frameworks): These are my combos: select id="modelsList" name="modelsList" I imported the following classes (some names have, of cou...
Dynamicaly populating a combobox with values from a Map based on what's selected in another combobox Ok, here's one for the JavaScript gurus: In my app, one of the controllers passes a TreeMap to it's JSP. This map has car manufacturer's names as keys and Lists of Car objects as values. These Car objects are simple bea...
TITLE: Dynamicaly populating a combobox with values from a Map based on what's selected in another combobox QUESTION: Ok, here's one for the JavaScript gurus: In my app, one of the controllers passes a TreeMap to it's JSP. This map has car manufacturer's names as keys and Lists of Car objects as values. These Car obje...
[ "javascript", "combobox", "maps" ]
1
2
18,849
7
0
2008-10-01T09:23:09.693000
2008-10-09T13:38:21.700000
156,871
162,189
Good simulation software for mobile devices
Can anyone recommend good simulation software for mobile devices? I am most interested in Nokia smart phones.
You are right! The Nokia phones runs on Symbian Platform. There are quite some variants out there, But S60 is better. UIQ is not doing that well lately. Have a read at Developing with S60 You can download the SDK from forum.nokia.com. So the Emulator comes with the Developer Kit. You can try to build and run the sample...
Good simulation software for mobile devices Can anyone recommend good simulation software for mobile devices? I am most interested in Nokia smart phones.
TITLE: Good simulation software for mobile devices QUESTION: Can anyone recommend good simulation software for mobile devices? I am most interested in Nokia smart phones. ANSWER: You are right! The Nokia phones runs on Symbian Platform. There are quite some variants out there, But S60 is better. UIQ is not doing that...
[ "development-environment", "mobile-phones" ]
1
0
900
6
0
2008-10-01T09:34:07.953000
2008-10-02T13:13:14.937000
156,873
156,949
Customized command line parsing in Python
I'm writing a shell for a project of mine, which by design parses commands that looks like this: COMMAND_NAME ARG1="Long Value" ARG2=123 ARG3=me@me.com My problem is that Python's command line parsing libraries (getopt and optparse) forces me to use '-' or '--' in front of the arguments. This behavior doesn't match my ...
You could split them up with shlex.split(), which can handle the quoted values you have, and pretty easily parse this with a very simple regular expression. Or, you can just use regular expressions for both splitting and parsing. Or simply use split(). args = {} for arg in shlex.split(cmdln_args): key, value = arg.spli...
Customized command line parsing in Python I'm writing a shell for a project of mine, which by design parses commands that looks like this: COMMAND_NAME ARG1="Long Value" ARG2=123 ARG3=me@me.com My problem is that Python's command line parsing libraries (getopt and optparse) forces me to use '-' or '--' in front of the ...
TITLE: Customized command line parsing in Python QUESTION: I'm writing a shell for a project of mine, which by design parses commands that looks like this: COMMAND_NAME ARG1="Long Value" ARG2=123 ARG3=me@me.com My problem is that Python's command line parsing libraries (getopt and optparse) forces me to use '-' or '--...
[ "python", "parsing", "shell", "command-line", "arguments" ]
7
10
4,886
7
0
2008-10-01T09:35:36.013000
2008-10-01T10:09:19.990000
156,880
1,068,620
Controlling the WCF XmlSerializer
I have some REST web services implemented in WCF. I wish to make these services return "Bad Request" when the xml contains invalid elements. The xml serialization is being handled by XmlSerializer. By default XmlSerializer ignores unknown elements. I know it is possible to hook XmlSerializer.UnknownElement and throw an...
"I know it is possible to hook XmlSerializer.UnknownElement and throw an exception from this handler, but because this is in WCF I have no control over serialization" Its actually possible to do this... In a WCF project that I worked on, we did something similar using the IDispatchMessageFormatter interface. More infor...
Controlling the WCF XmlSerializer I have some REST web services implemented in WCF. I wish to make these services return "Bad Request" when the xml contains invalid elements. The xml serialization is being handled by XmlSerializer. By default XmlSerializer ignores unknown elements. I know it is possible to hook XmlSeri...
TITLE: Controlling the WCF XmlSerializer QUESTION: I have some REST web services implemented in WCF. I wish to make these services return "Bad Request" when the xml contains invalid elements. The xml serialization is being handled by XmlSerializer. By default XmlSerializer ignores unknown elements. I know it is possib...
[ "wcf", "xml-serialization" ]
2
2
1,751
3
0
2008-10-01T09:40:39.713000
2009-07-01T11:30:34.640000
156,885
156,900
can I configure hibernate properties to connect without using an instance name to sql server 2005?
Can I configure hibernate properties to connect without using an instance name to sql server 2005? I need to force it to use localhost as the hostname and not specify the instance (same as you can do with the sql server enterprise manager). Ta! T
Yes, you can. You set it up as you normally would in the connection string: Server=(local);initial catalog=MyDataBase;Integrated Security=SSPI
can I configure hibernate properties to connect without using an instance name to sql server 2005? Can I configure hibernate properties to connect without using an instance name to sql server 2005? I need to force it to use localhost as the hostname and not specify the instance (same as you can do with the sql server e...
TITLE: can I configure hibernate properties to connect without using an instance name to sql server 2005? QUESTION: Can I configure hibernate properties to connect without using an instance name to sql server 2005? I need to force it to use localhost as the hostname and not specify the instance (same as you can do wit...
[ "sql", "sql-server", "sql-server-2005", "hibernate" ]
1
1
918
1
0
2008-10-01T09:42:44.123000
2008-10-01T09:49:45.217000
156,911
1,620,293
How would you transform a pre-existing web app into a multilingual one?
I am going to work on a project where a fairly large web app needs to tweaked to handle several languages. The thing runs with a hand crafted PHP code but it's pretty clean. I was wondering what would be the best way to do that? Making something on my own, trying to fit the actual architecture. Rewriting a good part of...
There are a number of ways of tackling this. None of them "the best way" and all of them with problems in the short term or the long term. The very first thing to say is that multi lingual sites are not easy, translators and lovely people but hard to work with and most programmers see the problem as a technical one onl...
How would you transform a pre-existing web app into a multilingual one? I am going to work on a project where a fairly large web app needs to tweaked to handle several languages. The thing runs with a hand crafted PHP code but it's pretty clean. I was wondering what would be the best way to do that? Making something on...
TITLE: How would you transform a pre-existing web app into a multilingual one? QUESTION: I am going to work on a project where a fairly large web app needs to tweaked to handle several languages. The thing runs with a hand crafted PHP code but it's pretty clean. I was wondering what would be the best way to do that? M...
[ "php", "symfony", "internationalization" ]
24
11
9,361
6
0
2008-10-01T09:54:16.407000
2009-10-25T07:50:34.413000
156,912
218,811
Sending a keyboard event from java to any application (on-screen-keyboard)
I am working on developing an on-screen keyboard with java. This keyboard has a JComponent for every possible key. When a mouse down is detected on the button, I want to send a specific keyboard code to the application currently on focus. The keyboard itself is within a JFrame with no decorations and set to always-on-t...
Apparently the only way to do this is to have a JNI layer that will make the conversion from java to native. Java has no easy way to provide such funcionality. This could be an interesting concept for a small, third party library for someone who wants to learn JNI...
Sending a keyboard event from java to any application (on-screen-keyboard) I am working on developing an on-screen keyboard with java. This keyboard has a JComponent for every possible key. When a mouse down is detected on the button, I want to send a specific keyboard code to the application currently on focus. The ke...
TITLE: Sending a keyboard event from java to any application (on-screen-keyboard) QUESTION: I am working on developing an on-screen keyboard with java. This keyboard has a JComponent for every possible key. When a mouse down is detected on the button, I want to send a specific keyboard code to the application currentl...
[ "java", "events", "swing", "keyboard", "java-native-interface" ]
4
2
11,950
5
0
2008-10-01T09:55:55.717000
2008-10-20T15:25:17.160000
156,916
157,425
Case-insensitive Glob on zsh/bash
I need to list all files whose names start with 'SomeLongString'. But the case of 'SomeLongString' can vary. How? I am using zsh, but a bash solution is also welcome.
ZSH: $ unsetopt CASE_GLOB Or, if you don't want to enable case-insensitive globbing in general, you can activate it for only the varying part: $ print -l (#i)(somelongstring)* This will match any file that starts with "somelongstring" (in any combination of lower/upper case). The case-insensitive flag applies for every...
Case-insensitive Glob on zsh/bash I need to list all files whose names start with 'SomeLongString'. But the case of 'SomeLongString' can vary. How? I am using zsh, but a bash solution is also welcome.
TITLE: Case-insensitive Glob on zsh/bash QUESTION: I need to list all files whose names start with 'SomeLongString'. But the case of 'SomeLongString' can vary. How? I am using zsh, but a bash solution is also welcome. ANSWER: ZSH: $ unsetopt CASE_GLOB Or, if you don't want to enable case-insensitive globbing in gener...
[ "linux", "bash", "zsh", "glob" ]
49
41
18,357
6
0
2008-10-01T09:56:39.973000
2008-10-01T12:50:20.507000
156,936
157,098
How can I expose iterators without exposing the container used?
I have been using C# for a while now, and going back to C++ is a headache. I am trying to get some of my practices from C# with me to C++, but I am finding some resistance and I would be glad to accept your help. I would like to expose an iterator for a class like this: template class MyContainer { public: // Here is t...
You may find the following article interesting as it addresses exactly the problem you have posted: On the Tension Between Object-Oriented and Generic Programming in C++ and What Type Erasure Can Do About It
How can I expose iterators without exposing the container used? I have been using C# for a while now, and going back to C++ is a headache. I am trying to get some of my practices from C# with me to C++, but I am finding some resistance and I would be glad to accept your help. I would like to expose an iterator for a cl...
TITLE: How can I expose iterators without exposing the container used? QUESTION: I have been using C# for a while now, and going back to C++ is a headache. I am trying to get some of my practices from C# with me to C++, but I am finding some resistance and I would be glad to accept your help. I would like to expose an...
[ "c++", "stl", "iterator", "encapsulation" ]
24
20
8,514
4
0
2008-10-01T10:02:35.870000
2008-10-01T10:56:45.710000
156,940
156,947
Is the web hosting location important these days?
I was recently looking at some web hosting solutions and some of the providers offered various hosting locations e.g. US or UK based servers. My question is: does it really make a difference from the performance point of view? Lets say that I am expecting most of the traffic coming from continental Europe? Would the fa...
Yes, obviously it does matter to some degree. This degree depends on the level of your site optimization (size of the pages, usage of AJAX, Flash etc) Example from my experience. Round-trip from russia to USA is 200ms. It does not make any difference for the small web site optimized for the performance, but it makes a ...
Is the web hosting location important these days? I was recently looking at some web hosting solutions and some of the providers offered various hosting locations e.g. US or UK based servers. My question is: does it really make a difference from the performance point of view? Lets say that I am expecting most of the tr...
TITLE: Is the web hosting location important these days? QUESTION: I was recently looking at some web hosting solutions and some of the providers offered various hosting locations e.g. US or UK based servers. My question is: does it really make a difference from the performance point of view? Lets say that I am expect...
[ "hosting" ]
8
5
1,775
14
0
2008-10-01T10:05:32.137000
2008-10-01T10:09:17.447000
156,951
157,023
.order_by() isn't working how it should / how I expect it to
In my Django project I am using Product.objects.all().order_by('order') in a view, but it doesn't seem to be working properly. This is it's output: Product Name Sort Evolution 2 Polarity 1 Jumbulaya 3 Kalidascope 4 It should look like this: Product Name Sort Polarity 1 Evolution 2 Jumbulaya 3 Kalidascope 4 But ...
Your saving loop is wrong. You save Product outside of the loop. It should be: if request.method == 'POST': PostEntries = len(request.POST) x = 1 while x < PostEntries: p = Product.objects.get(pk=x) p.order = int(request.POST.get(str(x),'')) print "Itr: " + str(x) x = x + 1 p.save() # NOTE HERE <- saving in loop instea...
.order_by() isn't working how it should / how I expect it to In my Django project I am using Product.objects.all().order_by('order') in a view, but it doesn't seem to be working properly. This is it's output: Product Name Sort Evolution 2 Polarity 1 Jumbulaya 3 Kalidascope 4 It should look like this: Product Name S...
TITLE: .order_by() isn't working how it should / how I expect it to QUESTION: In my Django project I am using Product.objects.all().order_by('order') in a view, but it doesn't seem to be working properly. This is it's output: Product Name Sort Evolution 2 Polarity 1 Jumbulaya 3 Kalidascope 4 It should look like th...
[ "python", "django" ]
1
5
670
1
0
2008-10-01T10:09:42.140000
2008-10-01T10:30:44.820000
156,954
160,602
Search for words in SQL Server index
I need something in between a full text search and an index search: I want to search for text in one column of my table (probably there will be an index on the column, too, if that matters). Problem is, I want to search for words in the column, but I don't want to match parts. For example, my column might contain busin...
SQL Server 2000 or above. SELECT * FROM dbo.TblBusinessNames WHERE BusinessName like '%[^A-z^0-9]Break%' -- In the middle of a sentence OR BusinessName like 'Break%' -- At the beginning of a sentence Keyword Reference for LIKE: http://msdn.microsoft.com/en-us/library/aa933232(SQL.80).aspx
Search for words in SQL Server index I need something in between a full text search and an index search: I want to search for text in one column of my table (probably there will be an index on the column, too, if that matters). Problem is, I want to search for words in the column, but I don't want to match parts. For e...
TITLE: Search for words in SQL Server index QUESTION: I need something in between a full text search and an index search: I want to search for text in one column of my table (probably there will be an index on the column, too, if that matters). Problem is, I want to search for words in the column, but I don't want to ...
[ "sql", "sql-server", "linq", "full-text-search" ]
6
3
8,533
6
0
2008-10-01T10:10:38.723000
2008-10-02T02:19:08.707000
156,975
157,046
How to add a horizontal gap with a JLabel
I have a JLabel (actually, it is a JXLabel). I have put an icon and text on it. Now I wand to add some spacing on the left side of the component, like this: I DON'T accept suggestion to move the JLabel or add spacing by modifying the image. I just want to know how to do it with plain java code.
I have found the solution! setBorder(new EmptyBorder(0,10,0,0)); Thanks everyone!
How to add a horizontal gap with a JLabel I have a JLabel (actually, it is a JXLabel). I have put an icon and text on it. Now I wand to add some spacing on the left side of the component, like this: I DON'T accept suggestion to move the JLabel or add spacing by modifying the image. I just want to know how to do it with...
TITLE: How to add a horizontal gap with a JLabel QUESTION: I have a JLabel (actually, it is a JXLabel). I have put an icon and text on it. Now I wand to add some spacing on the left side of the component, like this: I DON'T accept suggestion to move the JLabel or add spacing by modifying the image. I just want to know...
[ "java", "swing", "jlabel", "swingx" ]
6
13
14,247
4
0
2008-10-01T10:17:20.033000
2008-10-01T10:39:32.803000
156,994
157,013
What's the easiest way to import a new table into MySQL v5 from CSV?
I'm running MySQL 5 on a linux server on my local network. Running windows XP for my desktop. Had a look at the MySQL GUI Tools but I dont think they help. I cannot install apache on the remote server & use something like PHPmyAdmin.
I use SQLyog on my Windows system which has a free Community Edition and has an option to import from CSV. I've never used this option myself so I can't tell you how good it is. However, SQLyog has been great for all the other things I've used it for.
What's the easiest way to import a new table into MySQL v5 from CSV? I'm running MySQL 5 on a linux server on my local network. Running windows XP for my desktop. Had a look at the MySQL GUI Tools but I dont think they help. I cannot install apache on the remote server & use something like PHPmyAdmin.
TITLE: What's the easiest way to import a new table into MySQL v5 from CSV? QUESTION: I'm running MySQL 5 on a linux server on my local network. Running windows XP for my desktop. Had a look at the MySQL GUI Tools but I dont think they help. I cannot install apache on the remote server & use something like PHPmyAdmin....
[ "mysql", "csv" ]
1
2
10,987
9
0
2008-10-01T10:22:47.943000
2008-10-01T10:27:13.427000
157,005
207,882
Conditionally set an attribute on an element with JSP Documents (JSPX)
In HTML forms, buttons can be disabled by defining the "disabled" attribute on them, with any value: Hello If a button is to be enabled, the attribute should not exist as there is no defined value that the disabled attribute can be set to that would leave the button enabled. This is causing me problems when I want to e...
I use a custom JSP tag with dynamic attributes. You use it like this: Basically, what this tag does is generate an XML element with elementName and puts all attributes present in the tag, but skips the empty ones. The tag itself is pretty easy to implement, my implementation is just 44 lines long.
Conditionally set an attribute on an element with JSP Documents (JSPX) In HTML forms, buttons can be disabled by defining the "disabled" attribute on them, with any value: Hello If a button is to be enabled, the attribute should not exist as there is no defined value that the disabled attribute can be set to that would...
TITLE: Conditionally set an attribute on an element with JSP Documents (JSPX) QUESTION: In HTML forms, buttons can be disabled by defining the "disabled" attribute on them, with any value: Hello If a button is to be enabled, the attribute should not exist as there is no defined value that the disabled attribute can be...
[ "jsp", "xhtml", "webforms", "jspx" ]
20
13
38,399
11
0
2008-10-01T10:25:00.247000
2008-10-16T09:11:39.537000
157,018
157,074
Emacs and Python
I recently started learning Emacs. I went through the tutorial, read some introductory articles, so far so good. Now I want to use it for Python development. From what I understand, there are two separate Python modes for Emacs: python-mode.el, which is part of the Python project; and python.el, which is part of Emacs ...
If you are using GNU Emacs 21 or before, or XEmacs, use python-mode.el. The GNU Emacs 22 python.el won't work on them. On GNU Emacs 22, python.el does work, and ties in better with GNU Emacs's own symbol parsing and completion, ElDoc, etc. I use XEmacs myself, so I don't use it, and I have heard people complain that it...
Emacs and Python I recently started learning Emacs. I went through the tutorial, read some introductory articles, so far so good. Now I want to use it for Python development. From what I understand, there are two separate Python modes for Emacs: python-mode.el, which is part of the Python project; and python.el, which ...
TITLE: Emacs and Python QUESTION: I recently started learning Emacs. I went through the tutorial, read some introductory articles, so far so good. Now I want to use it for Python development. From what I understand, there are two separate Python modes for Emacs: python-mode.el, which is part of the Python project; and...
[ "python", "emacs" ]
34
21
10,910
3
0
2008-10-01T10:29:22.717000
2008-10-01T10:47:59.617000
157,026
157,035
Where can I find .NET Framework class diagram?
I just need a file (picture, pdf or other type file for printing) of the framework structure. It is very usefull while learning.Net framework.
.NET Framework 3.5 Common Namespaces and Types Poster November 2007 Edition The.NET Framework 3.5 Common Namespaces and Types Poster Overview The.NET Framework 3.5 Common Namespaces and Types Poster is downloadable as XPS or PDF format. There is also an XPS format file which prints over 16 letter or A4 pages for easy p...
Where can I find .NET Framework class diagram? I just need a file (picture, pdf or other type file for printing) of the framework structure. It is very usefull while learning.Net framework.
TITLE: Where can I find .NET Framework class diagram? QUESTION: I just need a file (picture, pdf or other type file for printing) of the framework structure. It is very usefull while learning.Net framework. ANSWER: .NET Framework 3.5 Common Namespaces and Types Poster November 2007 Edition The.NET Framework 3.5 Commo...
[ ".net", "class-diagram", "hierarchy" ]
9
11
12,784
6
0
2008-10-01T10:32:24.397000
2008-10-01T10:35:58.303000
157,034
157,135
Parsing Text in MS Access
I have column that contains strings. The strings in that column look like this: FirstString/SecondString/ThirdString I need to parse this so I have two values: Value 1: FirstString/SecondString Value 2: ThirdString I could have actually longer strings but I always nee it seperated like [string1/string2/string3/...][str...
In a query, use the following two expressions as columns: Left(col, InStrRev(col, "/") - 1), Mid(col, InStrRev(col, "/") + 1) col is your column. If in VBA, use the following: last_index= InStrRev(your_string, "/") first_part= Left$(your_string, last_index - 1) last_part= Mid$(your_string, last_index + 1)
Parsing Text in MS Access I have column that contains strings. The strings in that column look like this: FirstString/SecondString/ThirdString I need to parse this so I have two values: Value 1: FirstString/SecondString Value 2: ThirdString I could have actually longer strings but I always nee it seperated like [string...
TITLE: Parsing Text in MS Access QUESTION: I have column that contains strings. The strings in that column look like this: FirstString/SecondString/ThirdString I need to parse this so I have two values: Value 1: FirstString/SecondString Value 2: ThirdString I could have actually longer strings but I always nee it sepe...
[ "ms-access", "parsing" ]
1
1
9,391
4
0
2008-10-01T10:35:51.347000
2008-10-01T11:07:44.560000
157,039
157,141
Most pythonic way of counting matching elements in something iterable
I have an iterable of entries on which I would like to gather some simple statistics, say the count of all numbers divisible by two and the count of all numbers divisible by three. My first alternative, While only iterating through the list once and avoiding the list expansion (and keeping the split loop refactoring in...
Having to iterate over the list multiple times isn't elegant IMHO. I'd probably create a function that allows doing: twos, threes = countmatching(xrange(1,10), lambda a: a % 2 == 0, lambda a: a % 3 == 0) A starting point would be something like this: def countmatching(iterable, *predicates): v = [0] * len(predicates) f...
Most pythonic way of counting matching elements in something iterable I have an iterable of entries on which I would like to gather some simple statistics, say the count of all numbers divisible by two and the count of all numbers divisible by three. My first alternative, While only iterating through the list once and ...
TITLE: Most pythonic way of counting matching elements in something iterable QUESTION: I have an iterable of entries on which I would like to gather some simple statistics, say the count of all numbers divisible by two and the count of all numbers divisible by three. My first alternative, While only iterating through ...
[ "python", "list-comprehension" ]
23
21
17,557
12
0
2008-10-01T10:37:20.267000
2008-10-01T11:09:14.667000
157,044
157,177
How do I resolve the error "Expression must evaluate to a node-set" when checking for the existence of a node?
I'm attempting to check for the existence of a node using the following.NET code: xmlDocument.SelectSingleNode( String.Format("//ErrorTable/ProjectName/text()='{0}'", projectName)); This always raises: XPathException: Expression must evaluate to a node-set. Why am I getting this error and how can I resolve it? Thank yo...
The expression given evaluates to a boolean, not a node-set. I assume you want to check whether the ProjectName equals the parametrized text. In this case you need to write //ErrorTable/ProjectName[text()='{0}'] This gives you a list of all nodes (a nodeset) matching the given condition. This list may be empty, in whic...
How do I resolve the error "Expression must evaluate to a node-set" when checking for the existence of a node? I'm attempting to check for the existence of a node using the following.NET code: xmlDocument.SelectSingleNode( String.Format("//ErrorTable/ProjectName/text()='{0}'", projectName)); This always raises: XPathEx...
TITLE: How do I resolve the error "Expression must evaluate to a node-set" when checking for the existence of a node? QUESTION: I'm attempting to check for the existence of a node using the following.NET code: xmlDocument.SelectSingleNode( String.Format("//ErrorTable/ProjectName/text()='{0}'", projectName)); This alwa...
[ ".net", "xml", "xpath" ]
15
19
54,187
3
0
2008-10-01T10:39:07.280000
2008-10-01T11:24:40.417000
157,055
157,097
.NET 3.5 published in 11/07 .NET 3.0 in 11/06. Why are most people still using .NET 2.0?
People have been developing own solutions to the following problems: Consistent messaging frameworks for remote information exchange (webservices,rpc,...) SDK's for state managements for things such as Finite State Machines and Workflows Authentication Frameworks And much more. For over two years now, Microsoft offers....
Requires learning new stuff, many 'just a job' LOB developers can't be bothered. Legacy code investments, the custom systems may not be needed, but they work, recoding stuff to use Framework based systems is a waste of time if the existing system isn't broken. Dev software cost. Coding effectively in.net 3.x really req...
.NET 3.5 published in 11/07 .NET 3.0 in 11/06. Why are most people still using .NET 2.0? People have been developing own solutions to the following problems: Consistent messaging frameworks for remote information exchange (webservices,rpc,...) SDK's for state managements for things such as Finite State Machines and Wor...
TITLE: .NET 3.5 published in 11/07 .NET 3.0 in 11/06. Why are most people still using .NET 2.0? QUESTION: People have been developing own solutions to the following problems: Consistent messaging frameworks for remote information exchange (webservices,rpc,...) SDK's for state managements for things such as Finite Stat...
[ ".net", ".net-3.5", ".net-2.0", ".net-3.0" ]
12
5
990
15
0
2008-10-01T10:42:07.320000
2008-10-01T10:56:40.420000
157,058
157,112
Replace keys in a tuple in Erlang
I have a list of tuples eg. [{1,40},{2,45},{3,54}....{7,23}] where 1...7 are days of the week (calculated by finding calendar:day_of_the_week()). So now I want to change the list to [{Mon,40},{Tue,45},{Wed,54}...{Sun,23}]. Is there an easier way to do it than lists:keyreplace?
Simple. Use map and a handy tool from the httpd module. lists:map(fun({A,B}) -> {httpd_util:day(A),B} end, [{1,40},{2,45},{3,54},{7,23}]).
Replace keys in a tuple in Erlang I have a list of tuples eg. [{1,40},{2,45},{3,54}....{7,23}] where 1...7 are days of the week (calculated by finding calendar:day_of_the_week()). So now I want to change the list to [{Mon,40},{Tue,45},{Wed,54}...{Sun,23}]. Is there an easier way to do it than lists:keyreplace?
TITLE: Replace keys in a tuple in Erlang QUESTION: I have a list of tuples eg. [{1,40},{2,45},{3,54}....{7,23}] where 1...7 are days of the week (calculated by finding calendar:day_of_the_week()). So now I want to change the list to [{Mon,40},{Tue,45},{Wed,54}...{Sun,23}]. Is there an easier way to do it than lists:ke...
[ "erlang", "tuples" ]
7
3
3,618
2
0
2008-10-01T10:42:29.363000
2008-10-01T11:02:03.310000
157,070
157,109
In javaDoc, what's the best way of representing attributes in XML?
When you're adding javaDoc comments to your code and you're outlining the structure of an XML document that you're passing back, what's the best way to represent attributes? Is there a best practice for this? My general structure for my javaDoc comments is like this: /** *... * * @return XML document in the form: * * *...
Not sure I clearly understand your question. My preferred solution would be to embed the schema XSD or DTC in the description of the return parameter. Your solution seems to lead to personal idioms on how to represent things like multiple elements or others. Using a standard like XSD or DTD allows you to have a well kn...
In javaDoc, what's the best way of representing attributes in XML? When you're adding javaDoc comments to your code and you're outlining the structure of an XML document that you're passing back, what's the best way to represent attributes? Is there a best practice for this? My general structure for my javaDoc comments...
TITLE: In javaDoc, what's the best way of representing attributes in XML? QUESTION: When you're adding javaDoc comments to your code and you're outlining the structure of an XML document that you're passing back, what's the best way to represent attributes? Is there a best practice for this? My general structure for m...
[ "xml", "javadoc" ]
0
1
1,744
2
0
2008-10-01T10:47:10.973000
2008-10-01T11:00:23.267000
157,114
157,136
How to output a boolean in T-SQL based on the content of a column?
I made a view to abstract columns of different tables and pre-filter and pre-sort them. There is one column whose content I don't care about but I need to know whether the content is null or not. So my view should pass an alias as " true " in case the value of this specified column isn't null and " false " in case the ...
You have to use a CASE statement for this: SELECT CASE WHEN columnName IS NULL THEN 'false' ELSE 'true' END FROM tableName;
How to output a boolean in T-SQL based on the content of a column? I made a view to abstract columns of different tables and pre-filter and pre-sort them. There is one column whose content I don't care about but I need to know whether the content is null or not. So my view should pass an alias as " true " in case the v...
TITLE: How to output a boolean in T-SQL based on the content of a column? QUESTION: I made a view to abstract columns of different tables and pre-filter and pre-sort them. There is one column whose content I don't care about but I need to know whether the content is null or not. So my view should pass an alias as " tr...
[ "sql", "sql-server-2000" ]
61
87
87,681
8
0
2008-10-01T11:02:13.653000
2008-10-01T11:07:45.077000
157,116
160,031
Date change notification in a Tkinter app (win32)
Does anyone know if it is possible (and if yes, how) to bind an event (Python + Tkinter on MS Windows) to a system date change? I know I can have.after events checking once in a while; I'm asking if I can somehow have an event fired whenever the system date/time changes, either automatically (e.g. for daylight saving t...
I know, because if I have an.after timer waiting and I set the date/time after the timer's expiration, the timer event fires instantly. That could just mean that Tkinter (or Tk) is polling the system clock as part of the event loop to figure out when to run timers. If you're using Windows, Mark Hammond's book notes tha...
Date change notification in a Tkinter app (win32) Does anyone know if it is possible (and if yes, how) to bind an event (Python + Tkinter on MS Windows) to a system date change? I know I can have.after events checking once in a while; I'm asking if I can somehow have an event fired whenever the system date/time changes...
TITLE: Date change notification in a Tkinter app (win32) QUESTION: Does anyone know if it is possible (and if yes, how) to bind an event (Python + Tkinter on MS Windows) to a system date change? I know I can have.after events checking once in a while; I'm asking if I can somehow have an event fired whenever the system...
[ "python", "windows", "events", "tkinter" ]
1
1
888
1
0
2008-10-01T11:02:43.620000
2008-10-01T22:21:02.930000
157,119
157,263
Can I Override with derived types?
As far as i know it is not possible to do the following in C# 2.0 public class Father { public virtual Father SomePropertyName { get { return this; } } } public class Child: Father { public override Child SomePropertyName { get { return this; } } } I workaround the problem by creating the property in the derived class...
This is not possible in any.NET language because of type-safety concerns. In type-safe languages, you must provide covariance for return values, and contravariance for parameters. Take this code: class B { S Get(); Set(S); } class D: B { T Get(); Set(T); } For the Get methods, covariance means that T must either be S o...
Can I Override with derived types? As far as i know it is not possible to do the following in C# 2.0 public class Father { public virtual Father SomePropertyName { get { return this; } } } public class Child: Father { public override Child SomePropertyName { get { return this; } } } I workaround the problem by creatin...
TITLE: Can I Override with derived types? QUESTION: As far as i know it is not possible to do the following in C# 2.0 public class Father { public virtual Father SomePropertyName { get { return this; } } } public class Child: Father { public override Child SomePropertyName { get { return this; } } } I workaround the ...
[ "c#", ".net", "inheritance", "covariance" ]
46
31
36,705
9
0
2008-10-01T11:03:24.400000
2008-10-01T11:59:46.323000
157,132
157,322
Aborting upload from a servlet to limit file size
I'd like to limit the size of the file that can be uploaded to an application. To achieve this, I'd like to abort the upload process from the server side when the size of the file being uploaded exceeds a limit. Is there a way to abort an upload process from the server side without waiting the HTTP request to finish?
You can do something like this (using the Commons library): public class UploadFileServiceImpl extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { response.setContentType("text/plain"); try { FileItem uploadItem = getFileItem(request); if (uploadIt...
Aborting upload from a servlet to limit file size I'd like to limit the size of the file that can be uploaded to an application. To achieve this, I'd like to abort the upload process from the server side when the size of the file being uploaded exceeds a limit. Is there a way to abort an upload process from the server ...
TITLE: Aborting upload from a servlet to limit file size QUESTION: I'd like to limit the size of the file that can be uploaded to an application. To achieve this, I'd like to abort the upload process from the server side when the size of the file being uploaded exceeds a limit. Is there a way to abort an upload proces...
[ "java", "http", "servlets", "upload" ]
5
2
10,583
4
0
2008-10-01T11:07:21.863000
2008-10-01T12:23:46.030000
157,144
157,169
Customized DataGridView column does not accept the entered decimal seperator under Windows Vista
For a project I built a custom DataGridView column which contains NumericUpDown controls. It is implemented similar to the suggestion from Microsoft The column works fine under Windows XP. It accepts the entered digits and decimal separator. Under Windows Vista I have the odd problem that the control only accepts the d...
Can you please paste your OnKeyDown and/or OnKeyPress code? At least the relevant key-filtering code. It will make be easier to spot out any problems. BTW, I normally use both a British English and Brazilian Portuguese keyboards, so I've had my share of these issues. That kind of forces you to become a localization exp...
Customized DataGridView column does not accept the entered decimal seperator under Windows Vista For a project I built a custom DataGridView column which contains NumericUpDown controls. It is implemented similar to the suggestion from Microsoft The column works fine under Windows XP. It accepts the entered digits and ...
TITLE: Customized DataGridView column does not accept the entered decimal seperator under Windows Vista QUESTION: For a project I built a custom DataGridView column which contains NumericUpDown controls. It is implemented similar to the suggestion from Microsoft The column works fine under Windows XP. It accepts the e...
[ ".net", "datagridview", "windows-vista", "controls", "numericupdown" ]
0
0
1,703
1
0
2008-10-01T11:10:11.107000
2008-10-01T11:18:53.193000
157,149
157,175
Partial .csproj Files
Is it possible to split the information in a.csproj across more than one file? A bit like a project version of the partial class feature.
You can not have more than one master csproj. But because the underneath wiring of the csproj is done using msbuild you can simply have multiple partial csproj that import each other. The solution file would see the most derived csproj. project1.csproj.... project2.csproj... project.csproj - this is the main project th...
Partial .csproj Files Is it possible to split the information in a.csproj across more than one file? A bit like a project version of the partial class feature.
TITLE: Partial .csproj Files QUESTION: Is it possible to split the information in a.csproj across more than one file? A bit like a project version of the partial class feature. ANSWER: You can not have more than one master csproj. But because the underneath wiring of the csproj is done using msbuild you can simply ha...
[ "c#", "csproj" ]
17
24
6,291
3
0
2008-10-01T11:12:33.130000
2008-10-01T11:23:34.693000
157,157
157,224
What does the term "input-synchronized calls" mean?
I found this in an article on Multithreaded Apartments, but can’t find a definition for “input-synchronized calls”. (Article is at http://msdn.microsoft.com/en-us/library/ms693421(VS.85).aspx ) As used in the article - Multithreaded apartments cannot make input-synchronized calls What are “input-synchronized" calls? Th...
Have a look at this article here. Input-synchronized calls - When making input-synchronized calls, the object called must complete the call before yielding control. This helps ensure that focus management works correctly and that data entered by the user is processed appropriately. These calls are made by COM through t...
What does the term "input-synchronized calls" mean? I found this in an article on Multithreaded Apartments, but can’t find a definition for “input-synchronized calls”. (Article is at http://msdn.microsoft.com/en-us/library/ms693421(VS.85).aspx ) As used in the article - Multithreaded apartments cannot make input-synchr...
TITLE: What does the term "input-synchronized calls" mean? QUESTION: I found this in an article on Multithreaded Apartments, but can’t find a definition for “input-synchronized calls”. (Article is at http://msdn.microsoft.com/en-us/library/ms693421(VS.85).aspx ) As used in the article - Multithreaded apartments cannot...
[ "multithreading", "apartments" ]
0
1
350
1
0
2008-10-01T11:15:56.630000
2008-10-01T11:46:45.560000
157,163
157,171
How to do something with Bash when a text line appears in a file
I want to run a command as soon as a certain text appears in a log file. How do I do that in Bash?
Use command tail -f file.log | grep --line-buffered "my pattern" | while read line do echo $line done The --line-buffered is the key here, otherwise the read will fail.
How to do something with Bash when a text line appears in a file I want to run a command as soon as a certain text appears in a log file. How do I do that in Bash?
TITLE: How to do something with Bash when a text line appears in a file QUESTION: I want to run a command as soon as a certain text appears in a log file. How do I do that in Bash? ANSWER: Use command tail -f file.log | grep --line-buffered "my pattern" | while read line do echo $line done The --line-buffered is the ...
[ "linux", "bash", "grep" ]
4
14
2,033
5
0
2008-10-01T11:17:54.113000
2008-10-01T11:19:40.727000
157,178
157,199
How do you setup a shared Working Copy in Subversion
I still very new using Subversion. Is it possible to have a working copy on a network available share (c:\svn\projects\website) that everyone (in this case 3 of use) can checkout and commit files to? We don't need a build server because it is an asp site and the designers are used to having immediate results when they ...
In my experience it will work just fine out of the box. At my company we have had this setup for a number of years and not experienced any problems (outside the obvious ones of having a shared working copy). You should however look into having separate working copies and a trigger (hook) that updates the shared locatio...
How do you setup a shared Working Copy in Subversion I still very new using Subversion. Is it possible to have a working copy on a network available share (c:\svn\projects\website) that everyone (in this case 3 of use) can checkout and commit files to? We don't need a build server because it is an asp site and the desi...
TITLE: How do you setup a shared Working Copy in Subversion QUESTION: I still very new using Subversion. Is it possible to have a working copy on a network available share (c:\svn\projects\website) that everyone (in this case 3 of use) can checkout and commit files to? We don't need a build server because it is an asp...
[ "svn" ]
11
6
6,163
9
0
2008-10-01T11:25:06.127000
2008-10-01T11:34:37.727000
157,192
157,412
PHP Development - lot of (newbie) questions
I'm a Engineering student and I'm attending a Database and Information Systems class this semester. It's required that I produce a website/application that uses a database, using PHP/PGSQL. My questions are: which IDE would you recommend? does anyone have good tips and advices for a new developer? it would help me (a l...
which IDE would you recommend? Anything that supports remote debugging. You will save yourselves hours and hours and learn so much quicker if you can actually step through your code. It always amazes me that more people don't use good debugging tools for PHP. The tools are there, not using them is crazy. FWIW I've alwa...
PHP Development - lot of (newbie) questions I'm a Engineering student and I'm attending a Database and Information Systems class this semester. It's required that I produce a website/application that uses a database, using PHP/PGSQL. My questions are: which IDE would you recommend? does anyone have good tips and advice...
TITLE: PHP Development - lot of (newbie) questions QUESTION: I'm a Engineering student and I'm attending a Database and Information Systems class this semester. It's required that I produce a website/application that uses a database, using PHP/PGSQL. My questions are: which IDE would you recommend? does anyone have go...
[ "php", "ide" ]
4
10
935
11
0
2008-10-01T11:31:48.963000
2008-10-01T12:45:40.957000
157,195
157,485
Create a .eml (email) file in Java
Anybody knows how to do this? I got all the information of the email (body, subject, from, to, cc, bcc) and need to generate an.eml file out of it.
You can construct javax.mail.Message object (or have it already constructed from the mail server) and then you can use writeTo() method to save it to file. See JavaMail API for more information.
Create a .eml (email) file in Java Anybody knows how to do this? I got all the information of the email (body, subject, from, to, cc, bcc) and need to generate an.eml file out of it.
TITLE: Create a .eml (email) file in Java QUESTION: Anybody knows how to do this? I got all the information of the email (body, subject, from, to, cc, bcc) and need to generate an.eml file out of it. ANSWER: You can construct javax.mail.Message object (or have it already constructed from the mail server) and then you...
[ "java", "email", "outlook", "eml" ]
24
24
45,062
5
0
2008-10-01T11:33:11.660000
2008-10-01T13:07:02.637000
157,198
157,213
Double checked locking Article
I was reading this article about "Double-Checked locking" and out of the main topic of the article I was wondering why at some point of the article the author uses the next Idiom: Listing 7. Attempting to solve the out-of-order write problem public static Singleton getInstance() { if (instance == null) { synchronized(S...
The point of locking twice was to attempt to prevent out-of-order writes. The memory model specifies where reorderings can occur, partly in terms of locks. The lock ensures that no writes (including any within the singleton constructor) appear to happen after the "instance = inst;" line. However, to go deeper into the ...
Double checked locking Article I was reading this article about "Double-Checked locking" and out of the main topic of the article I was wondering why at some point of the article the author uses the next Idiom: Listing 7. Attempting to solve the out-of-order write problem public static Singleton getInstance() { if (ins...
TITLE: Double checked locking Article QUESTION: I was reading this article about "Double-Checked locking" and out of the main topic of the article I was wondering why at some point of the article the author uses the next Idiom: Listing 7. Attempting to solve the out-of-order write problem public static Singleton getIn...
[ "java", "synchronization", "locking", "double-checked-locking" ]
11
15
2,114
10
0
2008-10-01T11:34:04.810000
2008-10-01T11:41:26.570000
157,219
157,222
How can I support the support department better?
With the best will in the world, whatever software you (and me) write will have some kind of defect in it. What can I do, as a developer, to make things easier for the support department (first line, through to third line, and development) to diagnose, workaround and fix problems that the user encounters. Notes I'm exp...
Technical features: In the error dialogue for a desktop app, include a clickable button that opens up and email, and attaches the stacktrace, and log, including system properties. On an error screen in a webapp, report a timestamp including nano-seconds and error code, pid, etc so server logs can be searched. Allow log...
How can I support the support department better? With the best will in the world, whatever software you (and me) write will have some kind of defect in it. What can I do, as a developer, to make things easier for the support department (first line, through to third line, and development) to diagnose, workaround and fix...
TITLE: How can I support the support department better? QUESTION: With the best will in the world, whatever software you (and me) write will have some kind of defect in it. What can I do, as a developer, to make things easier for the support department (first line, through to third line, and development) to diagnose, ...
[ "language-agnostic" ]
6
4
310
9
0
2008-10-01T11:45:42.783000
2008-10-01T11:46:02.143000
157,232
157,891
How to log MethodName when wrapping Log4net?
I have wrapped Log4net in a static wrapper and want to log loggingEvent.LocationInformation.MethodName loggingEvent.LocationInformation.ClassName However all I get is the name of my wrapper. How can I log that info using a forwardingappender and a static wrapper class like Logger.Debug("Logging to Debug"); Logger.Info(...
Well the error was somewhere in my appender but for completeness ill include the answer to the best of my knowledge: the Facade you need should wrap ILogger and NOT ILog public static class Logger { private readonly static Type ThisDeclaringType = typeof(Logger); private static readonly ILogger defaultLogger; static L...
How to log MethodName when wrapping Log4net? I have wrapped Log4net in a static wrapper and want to log loggingEvent.LocationInformation.MethodName loggingEvent.LocationInformation.ClassName However all I get is the name of my wrapper. How can I log that info using a forwardingappender and a static wrapper class like L...
TITLE: How to log MethodName when wrapping Log4net? QUESTION: I have wrapped Log4net in a static wrapper and want to log loggingEvent.LocationInformation.MethodName loggingEvent.LocationInformation.ClassName However all I get is the name of my wrapper. How can I log that info using a forwardingappender and a static wr...
[ ".net", "logging", "log4net" ]
34
30
49,950
11
0
2008-10-01T11:50:01.480000
2008-10-01T14:28:50.223000
157,254
157,265
Is it a good design to put event handling code into an own method?
Image a Button on your windows form that does something when being clicked. The click events thats raised is typically bound to a method such as protected void Button1_Click(object sender, EventArgs e) { } What I see sometimes in other peoples' code is that the implementation of the buttons' behaviour is not put into t...
I put the event handling code into a separate method if: The code is to be called by multiple events or from anywhere else or The code does not actually have to do with the GUI and is more like back-end work. Everything small and only GUI-related goes always into the handler, sometimes even if it is being called from t...
Is it a good design to put event handling code into an own method? Image a Button on your windows form that does something when being clicked. The click events thats raised is typically bound to a method such as protected void Button1_Click(object sender, EventArgs e) { } What I see sometimes in other peoples' code is ...
TITLE: Is it a good design to put event handling code into an own method? QUESTION: Image a Button on your windows form that does something when being clicked. The click events thats raised is typically bound to a method such as protected void Button1_Click(object sender, EventArgs e) { } What I see sometimes in other...
[ "events" ]
2
4
412
4
0
2008-10-01T11:55:37.533000
2008-10-01T11:59:57.993000
157,271
157,378
What's the difference between rapidSSL and geotrust certificates?
I want to buy a 128bit SSL certificate for a website selling services. I checked http://www.rapidssl.com/ssl-certificate-products/ssl-certificate.htm and http://www.geotrust.com/ssl/compare-ssl-certificates.html. Why are the prices for QuickSSL (Geotrust, $249) and RapidSSL (rapidSSL, $69) so different? Is there any pa...
The job of the SSL certificate authority(CA)/provider is to validate your organizational identity so that when customers access your web site, they not only get the padlock for security, but they know that your identity as the fully qualified hostname are authentic and not some phishing scam. True, most all users look ...
What's the difference between rapidSSL and geotrust certificates? I want to buy a 128bit SSL certificate for a website selling services. I checked http://www.rapidssl.com/ssl-certificate-products/ssl-certificate.htm and http://www.geotrust.com/ssl/compare-ssl-certificates.html. Why are the prices for QuickSSL (Geotrust...
TITLE: What's the difference between rapidSSL and geotrust certificates? QUESTION: I want to buy a 128bit SSL certificate for a website selling services. I checked http://www.rapidssl.com/ssl-certificate-products/ssl-certificate.htm and http://www.geotrust.com/ssl/compare-ssl-certificates.html. Why are the prices for ...
[ "ssl", "digital-certificate", "certificate-authority" ]
47
54
46,590
7
0
2008-10-01T12:02:17.877000
2008-10-01T12:40:09.673000
157,274
160,857
How to 3270 screen-scrape from a Linux-based web app
I have a LAMP (PHP) web app which need to interface with programs on an IBM 3270 mainframe (via Microsoft SNA Server). One solution I'm looking at is screen-scraping via 3270. (I'm integrating the present with the past!) Many years ago, I wrote C code which used HLLAPI as the basis for such a task. Is HLLAPI still the ...
I haven't used it but maybe look at http://x3270.bgp.nu/ which says has a version: s3270 is a displayless version for writing screen-scraping scripts
How to 3270 screen-scrape from a Linux-based web app I have a LAMP (PHP) web app which need to interface with programs on an IBM 3270 mainframe (via Microsoft SNA Server). One solution I'm looking at is screen-scraping via 3270. (I'm integrating the present with the past!) Many years ago, I wrote C code which used HLLA...
TITLE: How to 3270 screen-scrape from a Linux-based web app QUESTION: I have a LAMP (PHP) web app which need to interface with programs on an IBM 3270 mainframe (via Microsoft SNA Server). One solution I'm looking at is screen-scraping via 3270. (I'm integrating the present with the past!) Many years ago, I wrote C co...
[ "php", "c", "mainframe", "3270", "hllapi" ]
8
7
7,041
5
0
2008-10-01T12:03:20.403000
2008-10-02T04:11:29.390000
157,287
157,327
Reports in a .NET Winforms App
I'm writing a Winforms application and I've been writing these awful HTML reports where I have templates set up and use String.Replace to get my variables into the templates, then output the results to a WebBrowser control. I really don't like this set up. I'd love to be able to use ASP.NET for my reports, but my clien...
Like was said earlier, use the report viewer with client side reporting. You can create reports the same way as you do for sql reporting services, except you dont need sql server(nor asp.net). Plus you have complete control over them(how you present, how you collect data, what layer they are generated in, etc). You can...
Reports in a .NET Winforms App I'm writing a Winforms application and I've been writing these awful HTML reports where I have templates set up and use String.Replace to get my variables into the templates, then output the results to a WebBrowser control. I really don't like this set up. I'd love to be able to use ASP.N...
TITLE: Reports in a .NET Winforms App QUESTION: I'm writing a Winforms application and I've been writing these awful HTML reports where I have templates set up and use String.Replace to get my variables into the templates, then output the results to a WebBrowser control. I really don't like this set up. I'd love to be...
[ "c#", ".net", "winforms", "report" ]
5
3
6,049
7
0
2008-10-01T12:08:48.970000
2008-10-01T12:25:26.417000
157,313
304,203
Template Lib (Engine) in Python running with Jython
Im searching a Template Lib or Template Engine for generating HTML (XML) that runs under Jython (Jython 2.5 Alpha is ok).
Use StringTemplate, see http://www.cs.usfca.edu/~parrt/papers/mvc.templates.pdf for details of why. There is nothing better, and it supports both Java and Python (and.NET, etc.).
Template Lib (Engine) in Python running with Jython Im searching a Template Lib or Template Engine for generating HTML (XML) that runs under Jython (Jython 2.5 Alpha is ok).
TITLE: Template Lib (Engine) in Python running with Jython QUESTION: Im searching a Template Lib or Template Engine for generating HTML (XML) that runs under Jython (Jython 2.5 Alpha is ok). ANSWER: Use StringTemplate, see http://www.cs.usfca.edu/~parrt/papers/mvc.templates.pdf for details of why. There is nothing be...
[ "python", "jython", "template-engine" ]
1
1
921
3
0
2008-10-01T12:20:23.060000
2008-11-20T02:50:53.313000
157,314
173,097
What is the Best binary/ordinary XML implementation for Java ME?
Following Izb's question about Best binary XML format for JavaME, I'm looking for an implementation for either binary XML-like formats or just plain XML. My metrics for such implementation, by most important first, are: Supported phones. A basic JTWI phone should be able to run it. It should be either verified or open ...
You could use NanoXML for J2ME. It works well and I've never had any problems with it in a production environment. Please note that it is non validating. IanG
What is the Best binary/ordinary XML implementation for Java ME? Following Izb's question about Best binary XML format for JavaME, I'm looking for an implementation for either binary XML-like formats or just plain XML. My metrics for such implementation, by most important first, are: Supported phones. A basic JTWI phon...
TITLE: What is the Best binary/ordinary XML implementation for Java ME? QUESTION: Following Izb's question about Best binary XML format for JavaME, I'm looking for an implementation for either binary XML-like formats or just plain XML. My metrics for such implementation, by most important first, are: Supported phones....
[ "xml", "java-me", "mobile" ]
0
1
538
5
0
2008-10-01T12:20:48.817000
2008-10-06T02:55:19.393000
157,342
157,369
bash script runs from shell but not from cron job
Cron installation is vixie-cron /etc/cron.daily/rmspam.cron #!/bin/bash /usr/bin/rm /home/user/Maildir/.SPAM/cur/*; I Have this simple bash script that I want to add to a cron job (also includes spam learning commands before) but this part always fails with "File or directory not found" From what I figure is the metach...
If there are no files in the directory, then the wildcard will not be expanded and will be passed to the command directly. There is no file called "*", and then the command fails with "File or directory not found." Try this instead: if [ -f /home/user/Maildir/.SPAM/cur/* ]; then rm /home/user/Maildir/.SPAM/cur/* fi Or ...
bash script runs from shell but not from cron job Cron installation is vixie-cron /etc/cron.daily/rmspam.cron #!/bin/bash /usr/bin/rm /home/user/Maildir/.SPAM/cur/*; I Have this simple bash script that I want to add to a cron job (also includes spam learning commands before) but this part always fails with "File or dir...
TITLE: bash script runs from shell but not from cron job QUESTION: Cron installation is vixie-cron /etc/cron.daily/rmspam.cron #!/bin/bash /usr/bin/rm /home/user/Maildir/.SPAM/cur/*; I Have this simple bash script that I want to add to a cron job (also includes spam learning commands before) but this part always fails...
[ "linux", "bash", "cron" ]
8
14
10,267
5
0
2008-10-01T12:32:13.250000
2008-10-01T12:38:11.927000
157,354
171,543
Is mathematics necessary for programming?
I happened to debate with a friend during college days whether advanced mathematics is necessary for any veteran programmer. He used to argue fiercely against that. He said that programmers need only basic mathematical knowledge from high school or fresh year college math, no more no less, and that almost all of progra...
To answer your question as it was posed I would have to say, "No, mathematics is not necessary for programming". However, as other people have suggested in this thread, I believe there is a correlation between understanding mathematics and being able to "think algorithmically". That is, to be able to think abstractly a...
Is mathematics necessary for programming? I happened to debate with a friend during college days whether advanced mathematics is necessary for any veteran programmer. He used to argue fiercely against that. He said that programmers need only basic mathematical knowledge from high school or fresh year college math, no m...
TITLE: Is mathematics necessary for programming? QUESTION: I happened to debate with a friend during college days whether advanced mathematics is necessary for any veteran programmer. He used to argue fiercely against that. He said that programmers need only basic mathematical knowledge from high school or fresh year ...
[ "math" ]
117
111
171,433
71
0
2008-10-01T12:35:37.517000
2008-10-05T05:28:16.293000
157,357
169,231
non-database field on ClearQuest form
Is there a way to use form fields that does not correspond to database field for temporary processings? I.e. I want to add: temp fields item1, item2 database field sum button with record hook that sets sum = item1 + item2
As far as I know it's simply not possible with ClearQuest. I've tried to do something similar and was told by our IBM consultant that the only way is to create a DB field for all variables.
non-database field on ClearQuest form Is there a way to use form fields that does not correspond to database field for temporary processings? I.e. I want to add: temp fields item1, item2 database field sum button with record hook that sets sum = item1 + item2
TITLE: non-database field on ClearQuest form QUESTION: Is there a way to use form fields that does not correspond to database field for temporary processings? I.e. I want to add: temp fields item1, item2 database field sum button with record hook that sets sum = item1 + item2 ANSWER: As far as I know it's simply not ...
[ "bug-tracking", "clearquest" ]
0
2
477
3
0
2008-10-01T12:36:13.630000
2008-10-03T23:04:25.227000
157,359
157,711
Accurate timestamping in Python logging
I've been building an error logging app recently and was after a way of accurately timestamping the incoming data. When I say accurately I mean each timestamp should be accurate relative to each other (no need to sync to an atomic clock or anything like that). I've been using datetime.now() as a first stab, but this is...
You're unlikely to get sufficiently fine-grained control that you can completely eliminate the possibility of duplicate timestamps - you'd need resolution smaller than the time it takes to generate a datetime object. There are a couple of other approaches you might take to deal with it: Deal with it. Leave your timesta...
Accurate timestamping in Python logging I've been building an error logging app recently and was after a way of accurately timestamping the incoming data. When I say accurately I mean each timestamp should be accurate relative to each other (no need to sync to an atomic clock or anything like that). I've been using dat...
TITLE: Accurate timestamping in Python logging QUESTION: I've been building an error logging app recently and was after a way of accurately timestamping the incoming data. When I say accurately I mean each timestamp should be accurate relative to each other (no need to sync to an atomic clock or anything like that). I...
[ "python", "logging", "timer", "timestamp" ]
12
7
10,460
8
0
2008-10-01T12:36:17.017000
2008-10-01T13:55:57.153000
157,375
157,866
Borderless Taskbar items: Using a right click menu (VB6)
Even when BorderStyle is set to 0, it is possible to force a window to show up on the taskbar either by turning on the ShowInTaskbar property or by using the windows api directly: SetWindowLong Me.hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, Win.GWL_EXSTYLE) Or Win.WS_EX_APPWINDOW. However, such taskbar entries lack a rig...
Without a hack, I think you're going to be stuck here, I'm sorry to say. When you set the VB6 borderless properties, you inherently disable the control menu. The control menu (typically activated by right-clicking the title bar of a window or left-clicking the icon in the upper left) is what's displayed when you right-...
Borderless Taskbar items: Using a right click menu (VB6) Even when BorderStyle is set to 0, it is possible to force a window to show up on the taskbar either by turning on the ShowInTaskbar property or by using the windows api directly: SetWindowLong Me.hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, Win.GWL_EXSTYLE) Or Win....
TITLE: Borderless Taskbar items: Using a right click menu (VB6) QUESTION: Even when BorderStyle is set to 0, it is possible to force a window to show up on the taskbar either by turning on the ShowInTaskbar property or by using the windows api directly: SetWindowLong Me.hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, Win.GW...
[ "winapi", "vb6" ]
2
1
2,343
1
0
2008-10-01T12:39:49.940000
2008-10-01T14:24:32.357000
157,392
1,453,761
How do I find out if a SQLite index is unique? (With SQL)
I want to find out, with an SQL query, whether an index is UNIQUE or not. I'm using SQLite 3. I have tried two approaches: SELECT * FROM sqlite_master WHERE name = 'sqlite_autoindex_user_1' This returns information about the index ("type", "name", "tbl_name", "rootpage" and "sql"). Note that the sql column is empty whe...
PRAGMA INDEX_LIST('table_name'); Returns a table with 3 columns: seq Unique numeric ID of index name Name of the index unique Uniqueness flag (nonzero if UNIQUE index.) Edit Since SQLite 3.16.0 you can also use table-valued pragma functions which have the advantage that you can JOIN them to search for a specific table ...
How do I find out if a SQLite index is unique? (With SQL) I want to find out, with an SQL query, whether an index is UNIQUE or not. I'm using SQLite 3. I have tried two approaches: SELECT * FROM sqlite_master WHERE name = 'sqlite_autoindex_user_1' This returns information about the index ("type", "name", "tbl_name", "r...
TITLE: How do I find out if a SQLite index is unique? (With SQL) QUESTION: I want to find out, with an SQL query, whether an index is UNIQUE or not. I'm using SQLite 3. I have tried two approaches: SELECT * FROM sqlite_master WHERE name = 'sqlite_autoindex_user_1' This returns information about the index ("type", "nam...
[ "sqlite" ]
20
38
16,949
5
0
2008-10-01T12:42:09.903000
2009-09-21T10:07:43.217000
157,424
157,445
Python 2.5 dictionary 2 key sort
I have a dictionary of 200,000 items (the keys are strings and the values are integers). What is the best/most pythonic way to print the items sorted by descending value then ascending key (i.e. a 2 key sort)? a={ 'keyC':1, 'keyB':2, 'keyA':1 } b = a.items() b.sort( key=lambda a:a[0]) b.sort( key=lambda a:a[1], reverse...
You can't sort dictionaries. You have to sort the list of items. Previous versions were wrong. When you have a numeric value, it's easy to sort in reverse order. These will do that. But this isn't general. This only works because the value is numeric. a = { 'key':1, 'another':2, 'key2':1 } b= a.items() b.sort( key=lam...
Python 2.5 dictionary 2 key sort I have a dictionary of 200,000 items (the keys are strings and the values are integers). What is the best/most pythonic way to print the items sorted by descending value then ascending key (i.e. a 2 key sort)? a={ 'keyC':1, 'keyB':2, 'keyA':1 } b = a.items() b.sort( key=lambda a:a[0]) b...
TITLE: Python 2.5 dictionary 2 key sort QUESTION: I have a dictionary of 200,000 items (the keys are strings and the values are integers). What is the best/most pythonic way to print the items sorted by descending value then ascending key (i.e. a 2 key sort)? a={ 'keyC':1, 'keyB':2, 'keyA':1 } b = a.items() b.sort( ke...
[ "python" ]
16
18
34,635
6
0
2008-10-01T12:50:19.447000
2008-10-01T12:56:01.383000
157,429
157,482
What are the benefits of using Perforce instead of Subversion?
My team has been using SVN for a few years. We now have the option of switching to Perforce. What would be the benefits (and pitfalls) of making such a switch?
P4 keeps track of your working copy on the server. This means that Large working copies are processed much faster. I used to have a large SVN project and a simple update took 15 minutes because it had to create a tree of the local working copy (thousands of folders). File access is slow. P4 stores the information about...
What are the benefits of using Perforce instead of Subversion? My team has been using SVN for a few years. We now have the option of switching to Perforce. What would be the benefits (and pitfalls) of making such a switch?
TITLE: What are the benefits of using Perforce instead of Subversion? QUESTION: My team has been using SVN for a few years. We now have the option of switching to Perforce. What would be the benefits (and pitfalls) of making such a switch? ANSWER: P4 keeps track of your working copy on the server. This means that Lar...
[ "svn", "perforce" ]
66
52
44,594
17
0
2008-10-01T12:52:46.460000
2008-10-01T13:05:34.480000
157,431
157,440
Server Error in '/' Application
I have created a Web Application in asp.net 2.0. which is working fine on my Local machine. However when trying to deploy it on sever that has windows 2003 sever, I get the error: Server Error in '/' Application. Parser Error Description: An error occurred during the parsing of a resource required to service this reque...
Is the folder on the web server (IIS presumably) marked as an ASP.NET application? If not, ~/ will point to the next application up, or the site root. It should have a cog icon in the IIS/MMC snap-in. Also ensure that it is running the right version of ASP.NET (v2.blah usually). In the IIS/MMC view, find the folder tha...
Server Error in '/' Application I have created a Web Application in asp.net 2.0. which is working fine on my Local machine. However when trying to deploy it on sever that has windows 2003 sever, I get the error: Server Error in '/' Application. Parser Error Description: An error occurred during the parsing of a resourc...
TITLE: Server Error in '/' Application QUESTION: I have created a Web Application in asp.net 2.0. which is working fine on my Local machine. However when trying to deploy it on sever that has windows 2003 sever, I get the error: Server Error in '/' Application. Parser Error Description: An error occurred during the pa...
[ "c#", "asp.net", ".net-2.0" ]
1
11
1,495
2
0
2008-10-01T12:53:10.780000
2008-10-01T12:54:28.750000
157,459
159,621
Problem joining on the highest value in mysql table
I have a products table... alt text http://img357.imageshack.us/img357/6393/productscx5.gif and a revisions table, which is supposed to track changes to product info alt text http://img124.imageshack.us/img124/1139/revisionslz5.gif I try to query the database for all products, with their most recent revision... select ...
Here's how I'd do it: SELECT p.*, r.* FROM products AS p JOIN revisions AS r USING (product_id) LEFT OUTER JOIN revisions AS r2 ON (r.product_id = r2.product_id AND r.modified < r2.modified) WHERE r2.revision_id IS NULL; In other words: find the revision for which no other revision exists with the same product_id and a...
Problem joining on the highest value in mysql table I have a products table... alt text http://img357.imageshack.us/img357/6393/productscx5.gif and a revisions table, which is supposed to track changes to product info alt text http://img124.imageshack.us/img124/1139/revisionslz5.gif I try to query the database for all ...
TITLE: Problem joining on the highest value in mysql table QUESTION: I have a products table... alt text http://img357.imageshack.us/img357/6393/productscx5.gif and a revisions table, which is supposed to track changes to product info alt text http://img124.imageshack.us/img124/1139/revisionslz5.gif I try to query the...
[ "mysql", "sql" ]
3
4
1,010
3
0
2008-10-01T12:59:45.803000
2008-10-01T20:45:34.810000
157,463
157,594
Should I use an FTP server as a maven host?
I would like to host a Maven repository for a framework we're working on and its dependencies. Can I just deploy my artifacts to my FTP host using mvn deploy, or should I manually deploy and/or setup some things before being able to deploy artifacts? I only have FTP access to server I want to host the Maven repo on. Th...
I've successfully used Archiva as my repository for several years... see http://archiva.apache.org/. It's easy to administer and allows you to configure as many repositories as you need (SNAPSHOT, internal, external, etc). According to the book " Better Builds with Maven ", the most common type of repository is HTTP, t...
Should I use an FTP server as a maven host? I would like to host a Maven repository for a framework we're working on and its dependencies. Can I just deploy my artifacts to my FTP host using mvn deploy, or should I manually deploy and/or setup some things before being able to deploy artifacts? I only have FTP access to...
TITLE: Should I use an FTP server as a maven host? QUESTION: I would like to host a Maven repository for a framework we're working on and its dependencies. Can I just deploy my artifacts to my FTP host using mvn deploy, or should I manually deploy and/or setup some things before being able to deploy artifacts? I only ...
[ "maven-2" ]
10
10
12,889
4
0
2008-10-01T13:00:33.463000
2008-10-01T13:27:45.237000
157,468
157,561
What types of sockets are available in VxWorks?
Vxworks supports standard IP v4 and IP v6 sockets, but sockets are also used for other purposes. What other types of sockets are available?
The socket types you can use depend on the communication domain you create your socket in. The listed socket types are: SOCK_DGRAM unreliable not sequenced possibly duplicated message SOCK_STREAM reliable sequenced non-duplicated stream SOCK_SEQPACKET reliable sequenced non-duplicated message SOCK_RDM reliable not sequ...
What types of sockets are available in VxWorks? Vxworks supports standard IP v4 and IP v6 sockets, but sockets are also used for other purposes. What other types of sockets are available?
TITLE: What types of sockets are available in VxWorks? QUESTION: Vxworks supports standard IP v4 and IP v6 sockets, but sockets are also used for other purposes. What other types of sockets are available? ANSWER: The socket types you can use depend on the communication domain you create your socket in. The listed soc...
[ "sockets", "vxworks" ]
2
1
2,399
1
0
2008-10-01T13:01:39.683000
2008-10-01T13:22:32.490000
157,491
157,506
Is there a way to establish a HTTPS Connection with Java 1.3?
I have to work on an old 1.3 JVM and I'm asked to create a secure connection to another server. Unfortunately the HttpsURLConnection only appears sinc JVM 1.4. Is there another way to create a secure connection? Is there a library that I could you to add this fonctionnality?
You need to install the Java Secure Socket Extension (JSSE), which used to be required because Sun wouldn't ship it with the JDK because of comedy export restrictions. I had a look on Sun's web site, but the JDK 1.3 instructions are preving elusive. Bear in mind that JDK 1.3 is now end-of-lifed by Sun, so they may not ...
Is there a way to establish a HTTPS Connection with Java 1.3? I have to work on an old 1.3 JVM and I'm asked to create a secure connection to another server. Unfortunately the HttpsURLConnection only appears sinc JVM 1.4. Is there another way to create a secure connection? Is there a library that I could you to add thi...
TITLE: Is there a way to establish a HTTPS Connection with Java 1.3? QUESTION: I have to work on an old 1.3 JVM and I'm asked to create a secure connection to another server. Unfortunately the HttpsURLConnection only appears sinc JVM 1.4. Is there another way to create a secure connection? Is there a library that I co...
[ "java", "https" ]
4
8
1,526
5
0
2008-10-01T13:08:01.790000
2008-10-01T13:11:10.067000
157,492
157,783
Open multiple documents from a single file
How would I go about creating multiple documents when a single file is opening in a MFC application? We have an aggregate file format which can contain information for multiple documents. When this file is opened, I would like multiple CDocuments created for each record in the file. We already have a extended CDocManag...
If you have several CDocument derived types that store different information, you need a seperate CMultiDocTemplate for each type, typically stored in your CApp derived class. When you call App.Initinstance you initialise each template using something like m_MyTempate1 = new CAtlasMDITemplate(IDR_RES_TYPE1, RUNTIME_CLA...
Open multiple documents from a single file How would I go about creating multiple documents when a single file is opening in a MFC application? We have an aggregate file format which can contain information for multiple documents. When this file is opened, I would like multiple CDocuments created for each record in the...
TITLE: Open multiple documents from a single file QUESTION: How would I go about creating multiple documents when a single file is opening in a MFC application? We have an aggregate file format which can contain information for multiple documents. When this file is opened, I would like multiple CDocuments created for ...
[ "mfc" ]
0
1
598
1
0
2008-10-01T13:08:32.007000
2008-10-01T14:10:52.483000
157,504
165,148
Passing Objects via QueryString
I have object A which in turn has a property of type Object B Class A property x as Object B End Class On my ASP.NET page when I select a gridview item which maps to an object of type A I serialize the object onto the QueryString and pass it to the next page. However I run into problems if property x actually has som...
If displaying the url of the next page in the browser does not matter, you could use the context.items collection. context.items.add("keyA", objectA) server.transfer("nextPage.aspx") Then on the next page: public sub page_load(...) dim objectA as A = ctype(context.items("keyA"), objectA) dim objectB as B = objectA.B en...
Passing Objects via QueryString I have object A which in turn has a property of type Object B Class A property x as Object B End Class On my ASP.NET page when I select a gridview item which maps to an object of type A I serialize the object onto the QueryString and pass it to the next page. However I run into problem...
TITLE: Passing Objects via QueryString QUESTION: I have object A which in turn has a property of type Object B Class A property x as Object B End Class On my ASP.NET page when I select a gridview item which maps to an object of type A I serialize the object onto the QueryString and pass it to the next page. However ...
[ "asp.net", "vb.net" ]
4
4
9,477
9
0
2008-10-01T13:11:00.333000
2008-10-03T00:04:36.430000
157,511
157,570
Using lock on the key of a Dictionary<string, object>
I have a Dictionary. EDIT: It was pointed out to me, that my example was bad. My whole intention was not to update the references in a loop but to update different values based on differnt threads need to update/get the data. I changed the loop to a method. I need to update items in my dictionary - one key at a time an...
Locking on an object that is accessible outside of the code locking it is a big risk. If any other code (anywhere) ever locks that object you could be in for some deadlocks that are hard to debug. Also note that you lock the object, not the reference, so if I gave you a dictionary, I may still hold references to the ke...
Using lock on the key of a Dictionary<string, object> I have a Dictionary. EDIT: It was pointed out to me, that my example was bad. My whole intention was not to update the references in a loop but to update different values based on differnt threads need to update/get the data. I changed the loop to a method. I need t...
TITLE: Using lock on the key of a Dictionary<string, object> QUESTION: I have a Dictionary. EDIT: It was pointed out to me, that my example was bad. My whole intention was not to update the references in a loop but to update different values based on differnt threads need to update/get the data. I changed the loop to ...
[ "c#", "dictionary", "locking" ]
9
11
20,336
7
0
2008-10-01T13:12:16.087000
2008-10-01T13:23:17.357000
157,528
157,574
How to freeze GridView header?
As in a title, does anyone know how to freeze GridView header in ASP.NET?
Option (a) buy into a UI package that includes a souped-up GridView with this functionality built-in. Option (b) roll your own - it's not simple. Dino Esposito has one approach. EDIT: Just noticed that the Dino article links to a subscriber-only area on the ASPnetPro magazine site. Here's another approach using extende...
How to freeze GridView header? As in a title, does anyone know how to freeze GridView header in ASP.NET?
TITLE: How to freeze GridView header? QUESTION: As in a title, does anyone know how to freeze GridView header in ASP.NET? ANSWER: Option (a) buy into a UI package that includes a souped-up GridView with this functionality built-in. Option (b) roll your own - it's not simple. Dino Esposito has one approach. EDIT: Just...
[ "asp.net", "gridview", "controls" ]
11
2
51,792
8
0
2008-10-01T13:15:13.210000
2008-10-01T13:23:39.197000
157,530
157,735
Singular/plural searches and stemming
I'm discovering a simple solution for singular-plural keywords searches. I heard about stemming but I don't want to use all its features, only plural/singular transformation. The language is Dutch. Have looked at http://www.snowball.tartarus.org before. Does anyone know the simple solution for singular|plural relevant ...
Use a dictionary, a list of stopwords (those you don't want to singularize) plus the rules for the language. If you don't know Dutch then I cannot help you, but show you how it'd be done in Spanish, for instance: Plurals end with s, if it doesn't then it's done If it ends with s, check if it's a verb or conjugation end...
Singular/plural searches and stemming I'm discovering a simple solution for singular-plural keywords searches. I heard about stemming but I don't want to use all its features, only plural/singular transformation. The language is Dutch. Have looked at http://www.snowball.tartarus.org before. Does anyone know the simple ...
TITLE: Singular/plural searches and stemming QUESTION: I'm discovering a simple solution for singular-plural keywords searches. I heard about stemming but I don't want to use all its features, only plural/singular transformation. The language is Dutch. Have looked at http://www.snowball.tartarus.org before. Does anyon...
[ "search", "stemming" ]
1
2
2,513
3
0
2008-10-01T13:16:00.710000
2008-10-01T14:01:59.650000
157,554
157,624
How do I convert an XmlNodeList into a NodeSet to use within XSLT?
I've got a XmlNodeList which I need to have it in a format that I can then re-use within a XSLT stylesheet by calling it from a C# extension method. Can anyone help? I have read that it might have something to do with using a XPathNavigator but I'm still a bit stuck.
I had to solve this issue myself a couple of years ago. The only way I managed it was to create an XML fragment containing the nodes in the node list and then passing in the children of the fragment. XsltArgumentList arguments = new XsltArgumentList(); XmlNodeList nodelist; XmlDocument nodesFrament = new XmlDocument();...
How do I convert an XmlNodeList into a NodeSet to use within XSLT? I've got a XmlNodeList which I need to have it in a format that I can then re-use within a XSLT stylesheet by calling it from a C# extension method. Can anyone help? I have read that it might have something to do with using a XPathNavigator but I'm stil...
TITLE: How do I convert an XmlNodeList into a NodeSet to use within XSLT? QUESTION: I've got a XmlNodeList which I need to have it in a format that I can then re-use within a XSLT stylesheet by calling it from a C# extension method. Can anyone help? I have read that it might have something to do with using a XPathNavi...
[ "c#", "xml", "xslt" ]
2
5
2,670
3
0
2008-10-01T13:21:28.157000
2008-10-01T13:33:43.353000
157,557
157,575
C# functions with static data
In VB.Net, I can declare a variable in a function as Static, like this: Function EncodeForXml(ByVal data As String) As String Static badAmpersand As Regex = new Regex("&(?![a-zA-Z]{2,6};|#[0-9]{2,4};)") data = badAmpersand.Replace(data, "&") ''// more processing return data End Function Note that I need to use the k...
Ha! In posting the question, I found the answer! Rather than googling for C# I should have been looking for details on how VB.Net implements it, and typing up the question made that apparent to me. After applying that insight, I found this: http://weblogs.asp.net/psteele/articles/7717.aspx That article explains that it...
C# functions with static data In VB.Net, I can declare a variable in a function as Static, like this: Function EncodeForXml(ByVal data As String) As String Static badAmpersand As Regex = new Regex("&(?![a-zA-Z]{2,6};|#[0-9]{2,4};)") data = badAmpersand.Replace(data, "&") ''// more processing return data End Function...
TITLE: C# functions with static data QUESTION: In VB.Net, I can declare a variable in a function as Static, like this: Function EncodeForXml(ByVal data As String) As String Static badAmpersand As Regex = new Regex("&(?![a-zA-Z]{2,6};|#[0-9]{2,4};)") data = badAmpersand.Replace(data, "&") ''// more processing return...
[ "c#", ".net", "vb.net" ]
7
14
1,413
4
0
2008-10-01T13:21:44.317000
2008-10-01T13:23:39.913000
157,587
157,962
SQL 2005 DB Partitioning for SharePoint
Background I have a massive db for a SharePoint site collection. It is 130GB and growing at 10gb per month. 100GB of the 130GB is in one site collection. 30GB is the version table. There is only one site collection - this is by design. Question Am I able to partition a database (SharePoint) using SQL 2005s data partiti...
You would have to create a partition set and rebuild the table on that partition set. SQL2005 can only partition on a single column, so you would have to have a column in the DB that Behaves fairly predictably so you don't get a large skew in the amount of data in each partition IIRC the column has to be a numeric or d...
SQL 2005 DB Partitioning for SharePoint Background I have a massive db for a SharePoint site collection. It is 130GB and growing at 10gb per month. 100GB of the 130GB is in one site collection. 30GB is the version table. There is only one site collection - this is by design. Question Am I able to partition a database (...
TITLE: SQL 2005 DB Partitioning for SharePoint QUESTION: Background I have a massive db for a SharePoint site collection. It is 130GB and growing at 10gb per month. 100GB of the 130GB is in one site collection. 30GB is the version table. There is only one site collection - this is by design. Question Am I able to part...
[ "sql-server-2005", "sharepoint", "partitioning" ]
3
1
596
2
0
2008-10-01T13:26:28.017000
2008-10-01T14:42:12.640000
157,592
157,641
Handling Long Running Reports
I am working on a ASP.net application written in C# with Sql Server 2000 database. We have several PDF reports which clients use for their business needs. The problem is these reports take a while to generate (> 3 minutes). What usually ends up happening is when the user requests the report the request timeout kills th...
Using the filesystem here is probably a good bet. Have a request that immediately returns a url to the report pdf location. Your server can then either kick off an external process or send a request to itself to perform the reporting. The client can poll the server (using http HEAD) for the PDF at the supplied url. If ...
Handling Long Running Reports I am working on a ASP.net application written in C# with Sql Server 2000 database. We have several PDF reports which clients use for their business needs. The problem is these reports take a while to generate (> 3 minutes). What usually ends up happening is when the user requests the repor...
TITLE: Handling Long Running Reports QUESTION: I am working on a ASP.net application written in C# with Sql Server 2000 database. We have several PDF reports which clients use for their business needs. The problem is these reports take a while to generate (> 3 minutes). What usually ends up happening is when the user ...
[ "c#", "asp.net", "ajax", "reporting" ]
9
5
3,122
6
0
2008-10-01T13:27:41.760000
2008-10-01T13:38:41.250000
157,599
162,121
When using cvs2svn how can you rename symbols such that a branch and tag resolve to the same name?
I am working on converting a CVS repository that has the following symbols (among others): tcm-6.1.0-branch -- a branch tcm-6.1.0 -- a tag Using the standard transformations cvs2svn identifies them properly. However, I'd like to do some clean up during the conversion. Specifically I'd like to drop the redundant '-branc...
RegexpSymbolTransform operates at too low a level, during the parsing of the repository files. Therefore, if you use a SymbolTransform to give two symbols the same name, they will be treated as one and the same symbol. It is possible to rename branches and tags after the conversion, but this would require an explicit S...
When using cvs2svn how can you rename symbols such that a branch and tag resolve to the same name? I am working on converting a CVS repository that has the following symbols (among others): tcm-6.1.0-branch -- a branch tcm-6.1.0 -- a tag Using the standard transformations cvs2svn identifies them properly. However, I'd ...
TITLE: When using cvs2svn how can you rename symbols such that a branch and tag resolve to the same name? QUESTION: I am working on converting a CVS repository that has the following symbols (among others): tcm-6.1.0-branch -- a branch tcm-6.1.0 -- a tag Using the standard transformations cvs2svn identifies them prope...
[ "svn", "cvs", "cvs2svn" ]
2
1
1,233
2
0
2008-10-01T13:28:04.270000
2008-10-02T12:59:34.160000
157,600
235,447
Data generators for SQL server?
I would like to receive suggestions on the data generators that are available, for SQL server. If posting a response, please provide any features that you think are important. I have never used a application like this, so I am looking to be educated on the topic. Thank you. (My goal is to fill a database with 10,000+ r...
I've rolled my own data generator that generates random data conforming to regular expressions. It turned into a learning project (under development) and is available at github.
Data generators for SQL server? I would like to receive suggestions on the data generators that are available, for SQL server. If posting a response, please provide any features that you think are important. I have never used a application like this, so I am looking to be educated on the topic. Thank you. (My goal is t...
TITLE: Data generators for SQL server? QUESTION: I would like to receive suggestions on the data generators that are available, for SQL server. If posting a response, please provide any features that you think are important. I have never used a application like this, so I am looking to be educated on the topic. Thank ...
[ "sql-server", "generator", "data-generation" ]
44
11
64,299
9
0
2008-10-01T13:28:10.620000
2008-10-24T22:16:34.333000
157,603
3,084,830
Getting specific revision via http with VisualSVN Server
I'm using VisualSVN Server to host an SVN repo, and for some automation work, I'd like to be able to get specific versions via the http[s] layer. I can get the HEAD version simply via an http[s] request to the server (httpd?) - but is there any ability to specify the revision, perhaps as a query-string? I can't seem to...
Better late than never; https://entire/Path/To/Folder/file/?p=REV?p=Rev specifies the revision
Getting specific revision via http with VisualSVN Server I'm using VisualSVN Server to host an SVN repo, and for some automation work, I'd like to be able to get specific versions via the http[s] layer. I can get the HEAD version simply via an http[s] request to the server (httpd?) - but is there any ability to specify...
TITLE: Getting specific revision via http with VisualSVN Server QUESTION: I'm using VisualSVN Server to host an SVN repo, and for some automation work, I'd like to be able to get specific versions via the http[s] layer. I can get the HEAD version simply via an http[s] request to the server (httpd?) - but is there any ...
[ "svn", "http", "version-control", "visualsvn", "visualsvn-server" ]
33
87
15,105
5
0
2008-10-01T13:29:00.290000
2010-06-21T12:59:10.603000
157,629
157,745
MVC User Controls + ViewData
Hi im new to MVC and I've fished around with no luck on how to build MVC User Controls that have ViewData returned to them. I was hoping someone would post a step by step solution on how to approach this problem. If you could make your solution very detailed that would help out greatly. Sorry for being so discrete with...
If I understand your question, you are trying to pass ViewData into the user control. A user control is essentially a partial view, so you would do this: <% Html.RenderPartial("someUserControl.ascx", viewData); %> Now in your usercontrol, ViewData will be whatever you passed in...
MVC User Controls + ViewData Hi im new to MVC and I've fished around with no luck on how to build MVC User Controls that have ViewData returned to them. I was hoping someone would post a step by step solution on how to approach this problem. If you could make your solution very detailed that would help out greatly. Sor...
TITLE: MVC User Controls + ViewData QUESTION: Hi im new to MVC and I've fished around with no luck on how to build MVC User Controls that have ViewData returned to them. I was hoping someone would post a step by step solution on how to approach this problem. If you could make your solution very detailed that would hel...
[ "asp.net-mvc", "model-view-controller", "user-controls", "viewdata" ]
9
8
7,529
4
0
2008-10-01T13:35:34.360000
2008-10-01T14:04:14.510000
157,646
157,669
Best way to encode text data for XML
I was looking for a generic method in.Net to encode a string for use in an Xml element or attribute, and was surprised when I didn't immediately find one. So, before I go too much further, could I just be missing the built-in function? Assuming for a moment that it really doesn't exist, I'm putting together my own gene...
System.XML handles the encoding for you, so you don't need a method like this.
Best way to encode text data for XML I was looking for a generic method in.Net to encode a string for use in an Xml element or attribute, and was surprised when I didn't immediately find one. So, before I go too much further, could I just be missing the built-in function? Assuming for a moment that it really doesn't ex...
TITLE: Best way to encode text data for XML QUESTION: I was looking for a generic method in.Net to encode a string for use in an Xml element or attribute, and was surprised when I didn't immediately find one. So, before I go too much further, could I just be missing the built-in function? Assuming for a moment that it...
[ ".net", "xml", "encoding", ".net-2.0" ]
73
4
134,314
13
0
2008-10-01T13:39:56.503000
2008-10-01T13:46:40.777000
157,661
157,684
Sharepoint WebParts
Say you have several webparts, one as a controller and several which take information from the controller and act on it. This is fairly easy to model using the Consumer/Producer interface introduced in ASP 2.0. How would you be able to add interactions the other way around whilst still maintaining the above? A simple e...
A quick and dirty solution to enable arbitrary control communication is to use recursive find control and events. Have the controls search the control tree by control type for what they need and then subscribe to publicly exposed events on the publishing control. I have previous used the trick to enable standard server...
Sharepoint WebParts Say you have several webparts, one as a controller and several which take information from the controller and act on it. This is fairly easy to model using the Consumer/Producer interface introduced in ASP 2.0. How would you be able to add interactions the other way around whilst still maintaining t...
TITLE: Sharepoint WebParts QUESTION: Say you have several webparts, one as a controller and several which take information from the controller and act on it. This is fairly easy to model using the Consumer/Producer interface introduced in ASP 2.0. How would you be able to add interactions the other way around whilst s...
[ "sharepoint", "web-parts", "webpart-connection" ]
5
2
729
2
0
2008-10-01T13:45:07.490000
2008-10-01T13:51:02.157000
157,662
165,590
What is the best way to sample/profile a PyObjC application?
Sampling with Activity Monitor/Instruments/Shark will show stack traces full of C functions for the Python interpreter. I would be helpful to see the corresponding Python symbol names. Is there some DTrace magic that can do that? Python's cProfile module can be useful for profiling individual subtrees of Python calls, ...
The answer is "dtrace", but it won't work on sufficiently old macs. http://tech.marshallfamily.com.au/archives/python-dtrace-on-os-x-leopard-part-1/ http://tech.marshallfamily.com.au/archives/python-dtrace-on-os-x-leopard-part-2/
What is the best way to sample/profile a PyObjC application? Sampling with Activity Monitor/Instruments/Shark will show stack traces full of C functions for the Python interpreter. I would be helpful to see the corresponding Python symbol names. Is there some DTrace magic that can do that? Python's cProfile module can ...
TITLE: What is the best way to sample/profile a PyObjC application? QUESTION: Sampling with Activity Monitor/Instruments/Shark will show stack traces full of C functions for the Python interpreter. I would be helpful to see the corresponding Python symbol names. Is there some DTrace magic that can do that? Python's cP...
[ "python", "cocoa", "macos", "pyobjc" ]
6
2
375
1
0
2008-10-01T13:45:12.123000
2008-10-03T03:33:35.510000
157,685
157,725
In MATLAB, how do I change the background color of a subplot?
I'm trying to change the background color of a single subplot in a MATLAB figure. It's clearly feasible since the UI allows it, but I cannot find the function to automate it. I've looked into whitebg, but it changes the color scheme of the whole figure, not just the current subplot. (I'm using MATLAB Version 6.1 by the...
You can use the set command. set(subplot(2,2,1),'Color','Red') That will give you a red background in the subplot location 2,2,1.
In MATLAB, how do I change the background color of a subplot? I'm trying to change the background color of a single subplot in a MATLAB figure. It's clearly feasible since the UI allows it, but I cannot find the function to automate it. I've looked into whitebg, but it changes the color scheme of the whole figure, not ...
TITLE: In MATLAB, how do I change the background color of a subplot? QUESTION: I'm trying to change the background color of a single subplot in a MATLAB figure. It's clearly feasible since the UI allows it, but I cannot find the function to automate it. I've looked into whitebg, but it changes the color scheme of the ...
[ "matlab", "plot", "background-color" ]
8
20
30,526
3
0
2008-10-01T13:51:11.407000
2008-10-01T13:58:53.620000
157,693
295,172
Modifying Request/Response Streams in WebBrowser Control Using MSHTML
I need to find a way to get at the request/response streams inside of the webbrowser winforms control and see that it's not real intuitive. For example, I need to be able to modify post data when a user clicks a submit button. It looks like you have to register for some MSHTML COM events to do so, but am unsure which I...
Take a look at Asynchronous Pluggable Protocols (IInternetProtocol): http://msdn.microsoft.com/en-us/library/aa767743(VS.85).aspx And a solution in C# that uses some of it for its own protocols in IE: http://www.codeproject.com/KB/aspnet/AspxProtocol.aspx
Modifying Request/Response Streams in WebBrowser Control Using MSHTML I need to find a way to get at the request/response streams inside of the webbrowser winforms control and see that it's not real intuitive. For example, I need to be able to modify post data when a user clicks a submit button. It looks like you have ...
TITLE: Modifying Request/Response Streams in WebBrowser Control Using MSHTML QUESTION: I need to find a way to get at the request/response streams inside of the webbrowser winforms control and see that it's not real intuitive. For example, I need to be able to modify post data when a user clicks a submit button. It lo...
[ "mshtml" ]
2
2
2,268
1
0
2008-10-01T13:52:02.980000
2008-11-17T09:27:30.753000
157,705
158,125
Checking for a duplicate element in the OUTPUT
I've got some XML, for example purposes it looks like this: test t2 t3 I want to transform it with XSLT, but I want to suppress the second f2 element in the output - how do I check inside my template to see if the f2 element already exists in the output when the second f2 element in the source is processed? My XSLT loo...
It depends how system wide you want to be. i.e. Are you only concerned with elements that are children of the same parent, or all elements at the same level ('cousins' if you like) or elements anywhere in the document... In the first situation you could check the preceding-sibling axis to see if any other elements exis...
Checking for a duplicate element in the OUTPUT I've got some XML, for example purposes it looks like this: test t2 t3 I want to transform it with XSLT, but I want to suppress the second f2 element in the output - how do I check inside my template to see if the f2 element already exists in the output when the second f2 ...
TITLE: Checking for a duplicate element in the OUTPUT QUESTION: I've got some XML, for example purposes it looks like this: test t2 t3 I want to transform it with XSLT, but I want to suppress the second f2 element in the output - how do I check inside my template to see if the f2 element already exists in the output w...
[ "xml", "xslt", "xslt-1.0" ]
4
7
6,946
3
0
2008-10-01T13:55:11.973000
2008-10-01T15:12:33.987000
157,717
157,766
What are some reasons why a sole developer should use TDD?
I'm a contract programmer with lots of experience. I'm used to being hired by a client to go in and do a software project of one form or another on my own, usually from nothing. That means a clean slate, almost every time. I can bring in libraries I've developed to get a quick start, but they're always optional. (and d...
I'm not about to blindly follow anything. That's the right attitude. I use TDD all the time, but I don't adhere to it as strictly as some. The best argument (in my mind) in favor of TDD is that you get a set of tests you can run when you finally get to the refactoring and maintenance phases of your project. If this is ...
What are some reasons why a sole developer should use TDD? I'm a contract programmer with lots of experience. I'm used to being hired by a client to go in and do a software project of one form or another on my own, usually from nothing. That means a clean slate, almost every time. I can bring in libraries I've develope...
TITLE: What are some reasons why a sole developer should use TDD? QUESTION: I'm a contract programmer with lots of experience. I'm used to being hired by a client to go in and do a software project of one form or another on my own, usually from nothing. That means a clean slate, almost every time. I can bring in libra...
[ "tdd", "methodology" ]
36
21
5,582
21
0
2008-10-01T13:57:11.237000
2008-10-01T14:07:05.207000
157,728
209,815
Diagnosing Bad OutputPaths: "The OutputPath property is not set for this project" (in the wonderful world of web deployment projects)
Starting with the error: Error 81 The OutputPath property is not set for this project. Please check to make sure that you have specified a valid Configuration/Platform combination. Configuration='Staging' Platform='AnyCPU' C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets 490 9 crm_deploy We have a...
Apparently a separate library without a Staging build can break it, even if the solution's Staging configuration is set to use the library's Debug build? Oh well...
Diagnosing Bad OutputPaths: "The OutputPath property is not set for this project" (in the wonderful world of web deployment projects) Starting with the error: Error 81 The OutputPath property is not set for this project. Please check to make sure that you have specified a valid Configuration/Platform combination. Confi...
TITLE: Diagnosing Bad OutputPaths: "The OutputPath property is not set for this project" (in the wonderful world of web deployment projects) QUESTION: Starting with the error: Error 81 The OutputPath property is not set for this project. Please check to make sure that you have specified a valid Configuration/Platform ...
[ ".net", "web-deployment-project", "deployment-project" ]
2
3
1,648
1
0
2008-10-01T14:00:18.017000
2008-10-16T18:59:06.607000
157,747
157,785
VBScript -- Using error handling
I want to use VBScript to catch errors and log them (ie on error "log something") then resume the next line of the script. For example, On Error Resume Next 'Do Step 1 'Do Step 2 'Do Step 3 When an error occurs on step 1, I want it to log that error (or perform other custom functions with it) then resume at step 2. Is ...
VBScript has no notion of throwing or catching exceptions, but the runtime provides a global Err object that contains the results of the last operation performed. You have to explicitly check whether the Err.Number property is non-zero after each operation. On Error Resume Next DoStep1 If Err.Number <> 0 Then WScript...
VBScript -- Using error handling I want to use VBScript to catch errors and log them (ie on error "log something") then resume the next line of the script. For example, On Error Resume Next 'Do Step 1 'Do Step 2 'Do Step 3 When an error occurs on step 1, I want it to log that error (or perform other custom functions wi...
TITLE: VBScript -- Using error handling QUESTION: I want to use VBScript to catch errors and log them (ie on error "log something") then resume the next line of the script. For example, On Error Resume Next 'Do Step 1 'Do Step 2 'Do Step 3 When an error occurs on step 1, I want it to log that error (or perform other c...
[ "vbscript", "error-handling" ]
95
171
357,925
5
0
2008-10-01T14:04:32.217000
2008-10-01T14:11:01.407000
157,755
169,771
Browser Helper Objects (BHO) in Windows Vista only with admin rights?
For a university project I programmed a Internet Explorer Browser Helper Object to process web document information while browsing. It were running successful on Windows XP with IE6 and IE7. Now I have the issue that under Windows Vista the same BHO needs administrator rights to run. Browser and BHO running if you star...
Not sure if your problem is related to custom actions in your installer but the following two links should help you. Building a BHO with the UAC in mind - http://simonguest.com/blogs/smguest/archive/2006/11/19/Building-Browser-Helper-Objects-using-Managed-Code.aspx (a little over half way down) Using the NoImpersonate ...
Browser Helper Objects (BHO) in Windows Vista only with admin rights? For a university project I programmed a Internet Explorer Browser Helper Object to process web document information while browsing. It were running successful on Windows XP with IE6 and IE7. Now I have the issue that under Windows Vista the same BHO ...
TITLE: Browser Helper Objects (BHO) in Windows Vista only with admin rights? QUESTION: For a university project I programmed a Internet Explorer Browser Helper Object to process web document information while browsing. It were running successful on Windows XP with IE6 and IE7. Now I have the issue that under Windows V...
[ "c#", ".net", "windows-vista", "bho" ]
4
4
1,759
2
0
2008-10-01T14:05:39.967000
2008-10-04T05:01:39.437000
157,759
157,801
How can I determine the running Mac OS X version programmatically?
I have a program which needs to behave slightly differently on Tiger than on Leopard. Does anybody know of a system call which will allow me to accurately determine which version of Mac OS X I am running. I have found a number of macro definitions to determine the OS of the build machine, but nothing really good to det...
See this article here But in short, if you're using carbon, use the Gestalt() call, and if you're using cocoa, there is a constant called NSAppKitVersionNumber which you can simply check against. Edit: For Mac OSX 10.8 and above, don't use Gestalt() anymore. See this answer for more details: How do I determine the OS v...
How can I determine the running Mac OS X version programmatically? I have a program which needs to behave slightly differently on Tiger than on Leopard. Does anybody know of a system call which will allow me to accurately determine which version of Mac OS X I am running. I have found a number of macro definitions to de...
TITLE: How can I determine the running Mac OS X version programmatically? QUESTION: I have a program which needs to behave slightly differently on Tiger than on Leopard. Does anybody know of a system call which will allow me to accurately determine which version of Mac OS X I am running. I have found a number of macro...
[ "cocoa", "macos", "macos-carbon" ]
14
15
22,658
8
0
2008-10-01T14:06:07.550000
2008-10-01T14:13:32.430000
157,770
159,848
Table Column Formatting
I'm trying to format a column in a using a element. I can set background-color, width, etc., but can't set the font-weight. Why doesn't it work? 1 2 3 4
As far as I know, you can only format the following using CSS on the element: background-color border width visibility This page has more info. Herb is right - it's better to style the 's directly. What I do is the following: text 1 text 2 text 3 text 4 text 5 text 6 This won't work in IE however.
Table Column Formatting I'm trying to format a column in a using a element. I can set background-color, width, etc., but can't set the font-weight. Why doesn't it work? 1 2 3 4
TITLE: Table Column Formatting QUESTION: I'm trying to format a column in a using a element. I can set background-color, width, etc., but can't set the font-weight. Why doesn't it work? 1 2 3 4 ANSWER: As far as I know, you can only format the following using CSS on the element: background-color border width visibili...
[ "css", "css-tables", "col" ]
18
36
40,799
6
0
2008-10-01T14:08:49.243000
2008-10-01T21:29:22.210000
157,773
157,802
How can I easily turn a .Net Windows Form app into an Asp.net app using Visual Studio 2005?
I have a pretty basic windows form app in.Net. All the code is C#. I'd like to turn it into an Asp.net web app. How can I easily do this? I think there's an easy way since the controls I drag/drop onto the windows form designer are pretty much the same that I drag/drop onto the aspx design page. Note: the windows form ...
There are two big problems here; first - they might look the same, but they are implemented completely differently - all of the UI work will need to be redone, largely from scratch. You will probably be able to re-use your actual "doing" code, though (i.e. the logic that manipulates the files). Second - define "local m...
How can I easily turn a .Net Windows Form app into an Asp.net app using Visual Studio 2005? I have a pretty basic windows form app in.Net. All the code is C#. I'd like to turn it into an Asp.net web app. How can I easily do this? I think there's an easy way since the controls I drag/drop onto the windows form designer ...
TITLE: How can I easily turn a .Net Windows Form app into an Asp.net app using Visual Studio 2005? QUESTION: I have a pretty basic windows form app in.Net. All the code is C#. I'd like to turn it into an Asp.net web app. How can I easily do this? I think there's an easy way since the controls I drag/drop onto the wind...
[ "c#", "asp.net", "winforms" ]
1
4
2,281
6
0
2008-10-01T14:09:19.927000
2008-10-01T14:13:51.040000
157,786
157,919
How do I get the MAX row with a GROUP BY in LINQ query?
I am looking for a way in LINQ to match the follow SQL Query. Select max(uid) as uid, Serial_Number from Table Group BY Serial_Number Really looking for some help on this one. The above query gets the max uid of each Serial Number because of the Group By Syntax.
using (DataContext dc = new DataContext()) { var q = from t in dc.TableTests group t by t.SerialNumber into g select new { SerialNumber = g.Key, uid = (from t2 in g select t2.uid).Max() }; }
How do I get the MAX row with a GROUP BY in LINQ query? I am looking for a way in LINQ to match the follow SQL Query. Select max(uid) as uid, Serial_Number from Table Group BY Serial_Number Really looking for some help on this one. The above query gets the max uid of each Serial Number because of the Group By Syntax.
TITLE: How do I get the MAX row with a GROUP BY in LINQ query? QUESTION: I am looking for a way in LINQ to match the follow SQL Query. Select max(uid) as uid, Serial_Number from Table Group BY Serial_Number Really looking for some help on this one. The above query gets the max uid of each Serial Number because of the ...
[ ".net", "linq", "linq-to-sql" ]
107
102
126,391
7
0
2008-10-01T14:11:10.313000
2008-10-01T14:34:12.957000
157,795
158,576
What's the WPF equivalent of WinForms components?
Windows Forms allows you to develop Components, non-visual elements that can have a designer. Built-in components include the BackgroundWorker, Timer, and a lot of ADO.NET objects. It's a nice way to provide easy configuration of a complicated object, and it it enables designer-assisted data binding. I've been looking ...
Just from my own observations, it seems like Microsoft is trying to move away from having components and similar things in the GUI. I think WPF tries to limit most of what's in the XAML to strictly GUI things. Data binding I guess would be the only exception. I know I try to keep most everything else in the code-behind...
What's the WPF equivalent of WinForms components? Windows Forms allows you to develop Components, non-visual elements that can have a designer. Built-in components include the BackgroundWorker, Timer, and a lot of ADO.NET objects. It's a nice way to provide easy configuration of a complicated object, and it it enables ...
TITLE: What's the WPF equivalent of WinForms components? QUESTION: Windows Forms allows you to develop Components, non-visual elements that can have a designer. Built-in components include the BackgroundWorker, Timer, and a lot of ADO.NET objects. It's a nice way to provide easy configuration of a complicated object, ...
[ "wpf", "winforms", "components" ]
10
6
1,645
4
0
2008-10-01T14:12:18.080000
2008-10-01T16:44:33.020000
157,807
157,810
GB English, or US English?
If you have an API, and you are a UK-based developer with a highly international audience, should your API be setColour() or setColor() (To take one word as a simple example.) UK-based engineers are often quite defensive about their 'correct' spellings but it could be argued that US spelling is more 'standard' in the i...
I would tend to use US-English as that has become the norm in other APIs. Speaking as an English programmer, I don't have any problem using "color", for example.
GB English, or US English? If you have an API, and you are a UK-based developer with a highly international audience, should your API be setColour() or setColor() (To take one word as a simple example.) UK-based engineers are often quite defensive about their 'correct' spellings but it could be argued that US spelling ...
TITLE: GB English, or US English? QUESTION: If you have an API, and you are a UK-based developer with a highly international audience, should your API be setColour() or setColor() (To take one word as a simple example.) UK-based engineers are often quite defensive about their 'correct' spellings but it could be argued...
[ "api", "naming-conventions", "api-design" ]
117
93
18,175
28
0
2008-10-01T14:14:44.097000
2008-10-01T14:15:51.613000
157,812
168,522
Field default value from query in MS Access
I have a field on a table in MS Access, tblMyTable.SomeID, and I want to set the default value as a user preference in tblUserPref.DefaultSomeID. It doesn't appear that I can set the default value to use a query in the table definition of tblMyTable. I have a form where records are entered into tblMyTable. I've tried t...
I'm not certain I've understood the problem, but I think you're asking to insert a value in the field that is drawn from a different table, based on some runtime information (such as the user name). In that case, you could use the domain lookup function, DLookup(), and you'd pass it the name of the field you want retur...
Field default value from query in MS Access I have a field on a table in MS Access, tblMyTable.SomeID, and I want to set the default value as a user preference in tblUserPref.DefaultSomeID. It doesn't appear that I can set the default value to use a query in the table definition of tblMyTable. I have a form where recor...
TITLE: Field default value from query in MS Access QUESTION: I have a field on a table in MS Access, tblMyTable.SomeID, and I want to set the default value as a user preference in tblUserPref.DefaultSomeID. It doesn't appear that I can set the default value to use a query in the table definition of tblMyTable. I have ...
[ "ms-access", "events" ]
2
5
24,877
5
0
2008-10-01T14:16:18.210000
2008-10-03T19:33:08.333000
157,832
157,842
Unfamiliar character in SQL statement
This is sort of SQL newbie question, I think, but here goes. I have a SQL Query (SQL Server 2005) that I've put together based on an example user-defined function: SELECT CASEID, GetNoteText(CASEID) FROM ( SELECT CASEID FROM ATTACHMENTS GROUP BY CASEID ) i GO the UDF works great (it concatenates data from multiple rows...
When you use a subquery in the FROM clause, you need to give the query a name. Since the name doesn't really matter to you, something simple like 'i' or 'a' is often chosen. But you could put any name there you wanted- there's no significance to 'i' all by itself, and it's certainly not a keyword. If you have a really ...
Unfamiliar character in SQL statement This is sort of SQL newbie question, I think, but here goes. I have a SQL Query (SQL Server 2005) that I've put together based on an example user-defined function: SELECT CASEID, GetNoteText(CASEID) FROM ( SELECT CASEID FROM ATTACHMENTS GROUP BY CASEID ) i GO the UDF works great (i...
TITLE: Unfamiliar character in SQL statement QUESTION: This is sort of SQL newbie question, I think, but here goes. I have a SQL Query (SQL Server 2005) that I've put together based on an example user-defined function: SELECT CASEID, GetNoteText(CASEID) FROM ( SELECT CASEID FROM ATTACHMENTS GROUP BY CASEID ) i GO the ...
[ "sql", "sql-server", "t-sql", "derived-table" ]
3
16
675
7
0
2008-10-01T14:19:45.690000
2008-10-01T14:21:14.157000
157,845
157,885
How much of a resource hog is Oracle Enterprise Manager?
I'm using a medical records system built on an Oracle database. Our vendor just told us that we need to shut down Oracle's Enterprise Manager service when we're not using it, because it uses too much of the system's resources. I know I can get actual numbers by checking Sysinternals Process Explorer, but I was hoping t...
We do the same thing on our testing and production servers too. I don't have any metrics to hand, but it did make a noticeable improvement in overall database response
How much of a resource hog is Oracle Enterprise Manager? I'm using a medical records system built on an Oracle database. Our vendor just told us that we need to shut down Oracle's Enterprise Manager service when we're not using it, because it uses too much of the system's resources. I know I can get actual numbers by c...
TITLE: How much of a resource hog is Oracle Enterprise Manager? QUESTION: I'm using a medical records system built on an Oracle database. Our vendor just told us that we need to shut down Oracle's Enterprise Manager service when we're not using it, because it uses too much of the system's resources. I know I can get a...
[ "oracle", "performance", "oracle-enterprise-manager" ]
4
4
2,103
6
0
2008-10-01T14:21:47.730000
2008-10-01T14:27:52.007000
157,846
158,255
obtaining a requestDispatcher
What is the benefit of using the servletContext as opposed the request in order to obtain a requestDispatcher? servletContext.getRequestDispatcher(dispatchPath) and using argRequest.getRequestDispatcher(dispatchPath)
It's there in the javadocs in black and white http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletRequest.html#getRequestDispatcher(java.lang.String) The difference between this method and ServletContext.getRequestDispatcher(java.lang.String) is that this method can take a relative path.
obtaining a requestDispatcher What is the benefit of using the servletContext as opposed the request in order to obtain a requestDispatcher? servletContext.getRequestDispatcher(dispatchPath) and using argRequest.getRequestDispatcher(dispatchPath)
TITLE: obtaining a requestDispatcher QUESTION: What is the benefit of using the servletContext as opposed the request in order to obtain a requestDispatcher? servletContext.getRequestDispatcher(dispatchPath) and using argRequest.getRequestDispatcher(dispatchPath) ANSWER: It's there in the javadocs in black and white ...
[ "java", "servlets" ]
0
3
496
2
0
2008-10-01T14:21:50.460000
2008-10-01T15:35:48.143000
157,856
303,596
Do Java listeners need to be removed? (In general)
Imagine this sample java class: class A { void addListener(Listener obj); void removeListener(Listener obj); } class B { private A a; B() { a = new A(); a.addListener(new Listener() { void listen() {} } } Do I need to add a finalize method to B to call a.removeListener? Assume that the A instance will be shared with s...
I just found a huge memory leak, so I am going to call the code that created the leak to be wrong and my fix that does not leak as right. Here is the old code: (This is a common pattern I have seen all over) class Singleton { static Singleton getInstance() {...} void addListener(Listener listener) {...} void removeList...
Do Java listeners need to be removed? (In general) Imagine this sample java class: class A { void addListener(Listener obj); void removeListener(Listener obj); } class B { private A a; B() { a = new A(); a.addListener(new Listener() { void listen() {} } } Do I need to add a finalize method to B to call a.removeListene...
TITLE: Do Java listeners need to be removed? (In general) QUESTION: Imagine this sample java class: class A { void addListener(Listener obj); void removeListener(Listener obj); } class B { private A a; B() { a = new A(); a.addListener(new Listener() { void listen() {} } } Do I need to add a finalize method to B to ca...
[ "java" ]
32
1
15,319
12
0
2008-10-01T14:22:59.490000
2008-11-19T22:19:46.170000
157,862
2,662,048
Life Cycle Tools Suite
I am looking to replace the life cycle tools currently used by my development teams. Tools that I'm looking for: Version Control Defect/Issue Tracking Requirements Tracking Test Case Management (potentially) Project Management: Project Status, hours entry I have a new beefy server (Windows 2008 Server) to run all tools...
Most common choice for version control system is Subversion. It has good tool support, most tools work with Subversion out of the box. You have a distributed team so you might consider a distributed version control system. For example Mercurial or Git. Mercurial has better support on Windows. Tool support is bit lackin...
Life Cycle Tools Suite I am looking to replace the life cycle tools currently used by my development teams. Tools that I'm looking for: Version Control Defect/Issue Tracking Requirements Tracking Test Case Management (potentially) Project Management: Project Status, hours entry I have a new beefy server (Windows 2008 S...
TITLE: Life Cycle Tools Suite QUESTION: I am looking to replace the life cycle tools currently used by my development teams. Tools that I'm looking for: Version Control Defect/Issue Tracking Requirements Tracking Test Case Management (potentially) Project Management: Project Status, hours entry I have a new beefy serv...
[ "version-control", "project-management", "lifecycle", "issue-tracking" ]
5
1
436
3
0
2008-10-01T14:23:59.470000
2010-04-18T11:23:36.260000
157,873
2,673,472
Rails test hanging - how can I print the test name before execution?
I'm having a test hang in our rails app can't figure out which one (since it hangs and doesn't get to the failure report). I found this blog post http://bmorearty.wordpress.com/2008/06/18/find-tests-more-easily-in-your-testlog/ which adds a setup hook to print the test name but when I try to do the same thing it gives ...
If you run test using rake it will work: rake test:units TESTOPTS="-v"
Rails test hanging - how can I print the test name before execution? I'm having a test hang in our rails app can't figure out which one (since it hangs and doesn't get to the failure report). I found this blog post http://bmorearty.wordpress.com/2008/06/18/find-tests-more-easily-in-your-testlog/ which adds a setup hook...
TITLE: Rails test hanging - how can I print the test name before execution? QUESTION: I'm having a test hang in our rails app can't figure out which one (since it hangs and doesn't get to the failure report). I found this blog post http://bmorearty.wordpress.com/2008/06/18/find-tests-more-easily-in-your-testlog/ which...
[ "ruby-on-rails", "ruby", "testing" ]
34
48
8,175
6
0
2008-10-01T14:26:06.533000
2010-04-20T07:56:09.907000
157,898
157,971
Class for URL Querystring Manipulation?
I am looking for a well tested class for manipulating URLs in.NET. Specifically I want to be able to add/update querystring values given a url. I have found various classes on the web that do this but none seem really robust and well tested. I also cannot find anything in the.NET framework; the Uri class doesn't let me...
shouldn't a simple string Dictionary suffice for this? an ordinary ASP.NET query string is just composed of key-value pairs separated by ampersands.
Class for URL Querystring Manipulation? I am looking for a well tested class for manipulating URLs in.NET. Specifically I want to be able to add/update querystring values given a url. I have found various classes on the web that do this but none seem really robust and well tested. I also cannot find anything in the.NET...
TITLE: Class for URL Querystring Manipulation? QUESTION: I am looking for a well tested class for manipulating URLs in.NET. Specifically I want to be able to add/update querystring values given a url. I have found various classes on the web that do this but none seem really robust and well tested. I also cannot find a...
[ "asp.net" ]
1
1
800
2
0
2008-10-01T14:30:33.527000
2008-10-01T14:43:08.583000
157,905
157,909
How do I prepend <%= request.getContextPath() %> to all relative URLs inside a jsp page?
The subject says it all, almost. How do I automatically fix jsp pages so that relative URLs are mapped to the context path instead of the server root? That is, given for example how do I set-up things in a way that maps the css to my-server/my-context/css/style.css instead of my-server/css/style.css? Is there an automa...
Look into the tag. This is an HTML tag which will mean all links on the page should start with your base URL. For example, if you specified and then had then the link should actually take you to /prefix/link/1.html. This should also work on (stylesheet) tags.
How do I prepend <%= request.getContextPath() %> to all relative URLs inside a jsp page? The subject says it all, almost. How do I automatically fix jsp pages so that relative URLs are mapped to the context path instead of the server root? That is, given for example how do I set-up things in a way that maps the css to ...
TITLE: How do I prepend <%= request.getContextPath() %> to all relative URLs inside a jsp page? QUESTION: The subject says it all, almost. How do I automatically fix jsp pages so that relative URLs are mapped to the context path instead of the server root? That is, given for example how do I set-up things in a way tha...
[ "jsp", "url", "tomcat" ]
2
8
13,935
2
0
2008-10-01T14:31:36.817000
2008-10-01T14:32:50.980000
157,917
157,941
Creating File Just for the Sake on Unit Test
This might be an interesting question. I need to test that if I can successfully upload and fetch the PDF file. This works for the text based files but I just wanted to check for PDF. For this unit test to run I need a PDF file. There are couple of options. I can create a dummy PDF file and store it some folder and rea...
Save a PDF file with your tests in a resources directory. Your tests should be as simple as possible, and creating a file is just one more point that could fail.
Creating File Just for the Sake on Unit Test This might be an interesting question. I need to test that if I can successfully upload and fetch the PDF file. This works for the text based files but I just wanted to check for PDF. For this unit test to run I need a PDF file. There are couple of options. I can create a du...
TITLE: Creating File Just for the Sake on Unit Test QUESTION: This might be an interesting question. I need to test that if I can successfully upload and fetch the PDF file. This works for the text based files but I just wanted to check for PDF. For this unit test to run I need a PDF file. There are couple of options....
[ "unit-testing" ]
4
8
1,463
5
0
2008-10-01T14:34:09.650000
2008-10-01T14:37:32.013000
157,923
158,054
Customizing PowerShell Prompt - Equivalent to CMD's $M$P$_$+$G?
I've started to "play around" with PowerShell and am trying to get it to "behave". One of the things I'd like to do is to customize the PROMPT to be "similar" to what "$M$P$_$+$G" do on MS-Dos: A quick rundown of what these do: Character | Description $m The remote name associated with the current drive letter or the e...
See if this does what you want: function prompt { ## Get the history. Since the history may be either empty, ## a single item or an array, the @() syntax ensures ## that PowerShell treats it as an array $history = @(get-history) ## If there are any items in the history, find out the ## Id of the final one. ## PowerShe...
Customizing PowerShell Prompt - Equivalent to CMD's $M$P$_$+$G? I've started to "play around" with PowerShell and am trying to get it to "behave". One of the things I'd like to do is to customize the PROMPT to be "similar" to what "$M$P$_$+$G" do on MS-Dos: A quick rundown of what these do: Character | Description $m T...
TITLE: Customizing PowerShell Prompt - Equivalent to CMD's $M$P$_$+$G? QUESTION: I've started to "play around" with PowerShell and am trying to get it to "behave". One of the things I'd like to do is to customize the PROMPT to be "similar" to what "$M$P$_$+$G" do on MS-Dos: A quick rundown of what these do: Character ...
[ "c#", "powershell", "command", "prompt", "customization" ]
3
1
2,654
5
0
2008-10-01T14:34:42.830000
2008-10-01T14:57:48.937000
157,924
157,946
Does LINQ's ExecuteCommand provide protection from SQL injection attacks?
I've got a situation where I need to use LINQ's ExecuteCommand method to run an insert. Something like (simplified for purposes of this question): object[] oParams = { Guid.NewGuid(), rec.WebMethodID }; TransLogDataContext.ExecuteCommand ( "INSERT INTO dbo.Transaction_Log (ID, WebMethodID) VALUES ({0}, {1})", oParams)...
Did some research, and I found this: In my simple testing, it looks like the parameters passed in the ExecuteQuery and ExecuteCommand methods are automatically SQL encoded based on the value being supplied. So if you pass in a string with a ' character, it will automatically SQL escape it to ''. I believe a similar pol...
Does LINQ's ExecuteCommand provide protection from SQL injection attacks? I've got a situation where I need to use LINQ's ExecuteCommand method to run an insert. Something like (simplified for purposes of this question): object[] oParams = { Guid.NewGuid(), rec.WebMethodID }; TransLogDataContext.ExecuteCommand ( "INSE...
TITLE: Does LINQ's ExecuteCommand provide protection from SQL injection attacks? QUESTION: I've got a situation where I need to use LINQ's ExecuteCommand method to run an insert. Something like (simplified for purposes of this question): object[] oParams = { Guid.NewGuid(), rec.WebMethodID }; TransLogDataContext.Exec...
[ "linq", "linq-to-sql", "sql-injection" ]
16
14
4,818
2
0
2008-10-01T14:34:48.633000
2008-10-01T14:38:59.327000
157,933
158,005
What's the best way of implementing a thread-safe Dictionary?
I was able to implement a thread-safe Dictionary in C# by deriving from IDictionary and defining a private SyncRoot object: public class SafeDictionary: IDictionary { private readonly object syncRoot = new object(); private Dictionary d = new Dictionary (); public object SyncRoot { get { return syncRoot; } } public v...
As Peter said, you can encapsulate all of the thread safety inside the class. You will need to be careful with any events you expose or add, making sure that they get invoked outside of any locks. public class SafeDictionary: IDictionary { private readonly object syncRoot = new object(); private Dictionary d = new Dict...
What's the best way of implementing a thread-safe Dictionary? I was able to implement a thread-safe Dictionary in C# by deriving from IDictionary and defining a private SyncRoot object: public class SafeDictionary: IDictionary { private readonly object syncRoot = new object(); private Dictionary d = new Dictionary (); ...
TITLE: What's the best way of implementing a thread-safe Dictionary? QUESTION: I was able to implement a thread-safe Dictionary in C# by deriving from IDictionary and defining a private SyncRoot object: public class SafeDictionary: IDictionary { private readonly object syncRoot = new object(); private Dictionary d = n...
[ "c#", ".net", "thread-safety", "collections" ]
110
43
69,815
8
0
2008-10-01T14:36:52.420000
2008-10-01T14:49:48.007000