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
200,439
200,453
How to use a .js file?
I'm sorry for this very newbish question, I'm not much given into web development. I've got this cool JavaScript in a.js file that we want to use on a small web site. (It's a script to run Cooliris on it). How do use the.js file or attach it to my HTML code?
Just include this line anywhere in your HTML page: Don't forget the closing tag as IE won't recongize it without a separate closing tag.
How to use a .js file? I'm sorry for this very newbish question, I'm not much given into web development. I've got this cool JavaScript in a.js file that we want to use on a small web site. (It's a script to run Cooliris on it). How do use the.js file or attach it to my HTML code?
TITLE: How to use a .js file? QUESTION: I'm sorry for this very newbish question, I'm not much given into web development. I've got this cool JavaScript in a.js file that we want to use on a small web site. (It's a script to run Cooliris on it). How do use the.js file or attach it to my HTML code? ANSWER: Just includ...
[ "javascript" ]
10
24
34,288
4
0
2008-10-14T08:59:00.483000
2008-10-14T09:03:51.130000
200,441
330,815
Startup point for Symbian/embedded programming learning
I have good knowledge on C++ (not C) and recently bought a Symbian-based phone. This gave me reasons to start learning on how to program this beast. I have searched for Symbian programming tutorials but there is so much knowledge that it is hard to choose best for startup. So I'm asking for hints, tips on where to star...
I will merely point out a few resources that I used when I embarked on the journey to become a Symbian Developer. The Learning Centre at Symbian Developer portal. There are all manners of documents, whitepapers, and tutorials there to get you up to speed with Symbian internals and application development. Also, you wil...
Startup point for Symbian/embedded programming learning I have good knowledge on C++ (not C) and recently bought a Symbian-based phone. This gave me reasons to start learning on how to program this beast. I have searched for Symbian programming tutorials but there is so much knowledge that it is hard to choose best for...
TITLE: Startup point for Symbian/embedded programming learning QUESTION: I have good knowledge on C++ (not C) and recently bought a Symbian-based phone. This gave me reasons to start learning on how to program this beast. I have searched for Symbian programming tutorials but there is so much knowledge that it is hard ...
[ "embedded", "symbian" ]
6
3
1,142
4
0
2008-10-14T08:59:34.150000
2008-12-01T13:24:45.997000
200,447
200,702
Tracd Realm
I am trying to setup tracd for the project I am currently working on. After creating a password file with the python script given in the site I am trying to start the server with authentication on. But it throws up warning saying No users found in the realm. What actually is a realm - I tried using trac as the value an...
Replacing the above said command line with the one bellow helps. tracd --port 8000 --auth=Trac,D:\My_Test_Project\Documents\Trac\digest.txt,Trac D:\My_Test_Project\Documents\Trac The string after --auth= should be the environment name and not the project name.
Tracd Realm I am trying to setup tracd for the project I am currently working on. After creating a password file with the python script given in the site I am trying to start the server with authentication on. But it throws up warning saying No users found in the realm. What actually is a realm - I tried using trac as ...
TITLE: Tracd Realm QUESTION: I am trying to setup tracd for the project I am currently working on. After creating a password file with the python script given in the site I am trying to start the server with authentication on. But it throws up warning saying No users found in the realm. What actually is a realm - I tr...
[ "python", "project-management", "wiki", "trac" ]
6
6
3,017
3
0
2008-10-14T09:01:54.627000
2008-10-14T10:47:31.170000
200,457
200,500
Refactoring features in Visual Studio 2005 for VB
Does anybody know a good and free add-in for Visual Studio 2005 to get refactoring features in VB?
The default answer to this one is probably Refactor! since this tool is also endorsed by Microsoft as the “official” VB refactoring addin. However, being a free tool, it comes nowhere near the power of other commercial tools such as ReSharper or Refactor! Pro. By the way: While I would definitely advise trying out all ...
Refactoring features in Visual Studio 2005 for VB Does anybody know a good and free add-in for Visual Studio 2005 to get refactoring features in VB?
TITLE: Refactoring features in Visual Studio 2005 for VB QUESTION: Does anybody know a good and free add-in for Visual Studio 2005 to get refactoring features in VB? ANSWER: The default answer to this one is probably Refactor! since this tool is also endorsed by Microsoft as the “official” VB refactoring addin. Howev...
[ "vb.net", "visual-studio", "refactoring", "add-in" ]
5
6
809
4
0
2008-10-14T09:06:23.543000
2008-10-14T09:24:51.587000
200,467
200,502
Online game: Macromedia Flash or Microsoft Silverlight and why?
Which technology stack is best for the creation of a two dimensional MMORPG and why? This question is loaded, so which are the major factors would you consider for development in such a domain?
I develop Flash for a living, so my answer should be taken with a grain of salt. I reccomend Flash for the following reasons: Size of install base. I don't have numbers for Silverlight but Flash 9 (the latest non-alpha revision) is over 90%. Air alows you to deploy to a desktop on multiple platforms with minor changes ...
Online game: Macromedia Flash or Microsoft Silverlight and why? Which technology stack is best for the creation of a two dimensional MMORPG and why? This question is loaded, so which are the major factors would you consider for development in such a domain?
TITLE: Online game: Macromedia Flash or Microsoft Silverlight and why? QUESTION: Which technology stack is best for the creation of a two dimensional MMORPG and why? This question is loaded, so which are the major factors would you consider for development in such a domain? ANSWER: I develop Flash for a living, so my...
[ "flash", "silverlight" ]
7
14
2,681
10
0
2008-10-14T09:12:42.250000
2008-10-14T09:25:44.563000
200,469
200,473
What is the difference between a process and a thread?
What is the technical difference between a process and a thread? I get the feeling a word like 'process' is overused and there are also hardware and software threads. How about light-weight processes in languages like Erlang? Is there a definitive reason to use one term over the other?
Both processes and threads are independent sequences of execution. The typical difference is that threads (of the same process) run in a shared memory space, while processes run in separate memory spaces. I'm not sure what "hardware" vs "software" threads you might be referring to. Threads are an operating environment ...
What is the difference between a process and a thread? What is the technical difference between a process and a thread? I get the feeling a word like 'process' is overused and there are also hardware and software threads. How about light-weight processes in languages like Erlang? Is there a definitive reason to use one...
TITLE: What is the difference between a process and a thread? QUESTION: What is the technical difference between a process and a thread? I get the feeling a word like 'process' is overused and there are also hardware and software threads. How about light-weight processes in languages like Erlang? Is there a definitive...
[ "multithreading", "process", "operating-system" ]
2,016
1,764
1,396,002
35
0
2008-10-14T09:13:24.247000
2008-10-14T09:15:58.967000
200,470
200,936
Style sheet images aren't reloaded by Firefox or Safari
We have found out that Firefox (at least v3) and Safari don't properly cache images referenced from a css file. The images are cached, but they are never refreshed, even if you change them on the server. Once Firefox has the image in the cache, it will never check if it has changed. Our css file looks like this: div#ne...
I would just add a querystring value to the image url. I usually just create a "version number" and increment it every time the image changes: div#news { background: url(images/newsitem_background.jpg?v=00001) no-repeat;... }
Style sheet images aren't reloaded by Firefox or Safari We have found out that Firefox (at least v3) and Safari don't properly cache images referenced from a css file. The images are cached, but they are never refreshed, even if you change them on the server. Once Firefox has the image in the cache, it will never check...
TITLE: Style sheet images aren't reloaded by Firefox or Safari QUESTION: We have found out that Firefox (at least v3) and Safari don't properly cache images referenced from a css file. The images are cached, but they are never refreshed, even if you change them on the server. Once Firefox has the image in the cache, i...
[ "css", "firefox", "safari", "firefox-3" ]
6
8
3,340
7
0
2008-10-14T09:14:40.123000
2008-10-14T12:25:50.020000
200,476
201,341
HTML.ActionLink method
Let's say I have a class public class ItemController:Controller { public ActionResult Login(int id) { return View("Hi", id); } } On a page that is not located at the Item folder, where ItemController resides, I want to create a link to the Login method. So which Html.ActionLink method I should use and what parameters s...
I think what you want is this: ASP.NET MVC1 Html.ActionLink(article.Title, "Login", // <-- Controller Name. "Item", // <-- ActionMethod new { id = article.ArticleID }, // <-- Route arguments. null // <-- htmlArguments.. which are none. You need this value // otherwise you call the WRONG method... // (refer to comments,...
HTML.ActionLink method Let's say I have a class public class ItemController:Controller { public ActionResult Login(int id) { return View("Hi", id); } } On a page that is not located at the Item folder, where ItemController resides, I want to create a link to the Login method. So which Html.ActionLink method I should us...
TITLE: HTML.ActionLink method QUESTION: Let's say I have a class public class ItemController:Controller { public ActionResult Login(int id) { return View("Hi", id); } } On a page that is not located at the Item folder, where ItemController resides, I want to create a link to the Login method. So which Html.ActionLink ...
[ "c#", ".net", "asp.net-mvc", "html-helper", "actionlink" ]
264
513
811,742
10
0
2008-10-14T09:16:58.513000
2008-10-14T14:19:33.567000
200,479
200,654
How to get the status of a JBoss Application Server
I am working on writing a Highly Available agent for JBoss Application Server to run on Solaris Open HA Cluster. As I don't know much of the JBoss AS, can someone please tell me how can I probe the status of the application server? I want to know the health of the application server, for example whether it is currently...
Out of the box, JBoss has a JMX console that provides information about the modules loaded into the micro-kernel and the services that are running. This application is usually available at http://hostname:8080/jmx-console, and you could conceivably use its presence or absence as an indicator of whether your JBoss serve...
How to get the status of a JBoss Application Server I am working on writing a Highly Available agent for JBoss Application Server to run on Solaris Open HA Cluster. As I don't know much of the JBoss AS, can someone please tell me how can I probe the status of the application server? I want to know the health of the app...
TITLE: How to get the status of a JBoss Application Server QUESTION: I am working on writing a Highly Available agent for JBoss Application Server to run on Solaris Open HA Cluster. As I don't know much of the JBoss AS, can someone please tell me how can I probe the status of the application server? I want to know the...
[ "jboss", "solaris", "application-server", "failovercluster" ]
2
4
18,047
3
0
2008-10-14T09:19:27.150000
2008-10-14T10:25:34.723000
200,483
201,138
How do I get a list of Java class dependencies for a main class?
Is there a way to find all the class dependencies of a java main class? I have been manually sifting through the imports of the main class and it's imports but then realized that, because one does not have to import classes that are in the same package, I was putting together an incomplete list. I need something that w...
It can be eaily done with just javac. Delete your class files and then compile the main class. javac will recursively compile any classes it needs (providing you don't hide package private classes/interfaces in strangely named files). Of course, this doesn't cover any recursive hacks.
How do I get a list of Java class dependencies for a main class? Is there a way to find all the class dependencies of a java main class? I have been manually sifting through the imports of the main class and it's imports but then realized that, because one does not have to import classes that are in the same package, I...
TITLE: How do I get a list of Java class dependencies for a main class? QUESTION: Is there a way to find all the class dependencies of a java main class? I have been manually sifting through the imports of the main class and it's imports but then realized that, because one does not have to import classes that are in t...
[ "java", "dependencies", "dependency-management" ]
12
3
23,907
5
0
2008-10-14T09:19:37.167000
2008-10-14T13:26:26.873000
200,488
201,027
ASP.NET Theme Images
How would I set an image to come from a theme directory (my theme changes so I don't want to directly reference) I am sure this is possible but every example I find doesn't seem to work. They are usually along the lines of: asp:image ID="Image1" runat="server" ImageUrl="~/Web/Mode1.jpg" / where Web would be a sub direc...
If you are wanting to reference an Image in your Theme folder, then I suggesting using a SkinId. Inside the skin file of each Theme Folder you would define something like this When you go to use the image in your code you do something like this... Depending on the theme your application has picked it will pick up the c...
ASP.NET Theme Images How would I set an image to come from a theme directory (my theme changes so I don't want to directly reference) I am sure this is possible but every example I find doesn't seem to work. They are usually along the lines of: asp:image ID="Image1" runat="server" ImageUrl="~/Web/Mode1.jpg" / where Web...
TITLE: ASP.NET Theme Images QUESTION: How would I set an image to come from a theme directory (my theme changes so I don't want to directly reference) I am sure this is possible but every example I find doesn't seem to work. They are usually along the lines of: asp:image ID="Image1" runat="server" ImageUrl="~/Web/Mode...
[ "asp.net", "themes" ]
14
19
14,915
4
0
2008-10-14T09:22:21.450000
2008-10-14T12:52:08.377000
200,512
200,534
How do I tell Java to map a logical font (e.g. SansSerif) to a specific font on my system?
Is there a way to map a logical font (e.g. SansSerif) to a different font when running a Java program? If so, does the method differ between Java VM versions?
Look in $JAVA_HOME/jre/lib/fontconfig.properties for everything (well, almost) you'd ever want to know about font mapping in Java.:-)
How do I tell Java to map a logical font (e.g. SansSerif) to a specific font on my system? Is there a way to map a logical font (e.g. SansSerif) to a different font when running a Java program? If so, does the method differ between Java VM versions?
TITLE: How do I tell Java to map a logical font (e.g. SansSerif) to a specific font on my system? QUESTION: Is there a way to map a logical font (e.g. SansSerif) to a different font when running a Java program? If so, does the method differ between Java VM versions? ANSWER: Look in $JAVA_HOME/jre/lib/fontconfig.prope...
[ "java", "fonts" ]
5
7
2,703
1
0
2008-10-14T09:31:43.243000
2008-10-14T09:41:24.797000
200,525
200,553
Regex for specifig tags and their content, groupped by the tag name
Here is the input (html, not xml):... html content... content for tag 1 content for tag 2 content for tag 3... html content... I would like to get 3 matches, each with two groups. First group would contain the name of the tag and the second group would contain the inner text of the tag. There are just those three tags,...
I don't see why you would want to use match group names for that. Here is a regular expression that would match tag name and tag content into numbered sub matches. <(tag1|tag2|tag3)>(.*?) Here is a variant with.NET style group names <(?'name'tag1|tag2|tag3)>(?'value'.*?). EDIT RegEx adapted as per question author's cla...
Regex for specifig tags and their content, groupped by the tag name Here is the input (html, not xml):... html content... content for tag 1 content for tag 2 content for tag 3... html content... I would like to get 3 matches, each with two groups. First group would contain the name of the tag and the second group would...
TITLE: Regex for specifig tags and their content, groupped by the tag name QUESTION: Here is the input (html, not xml):... html content... content for tag 1 content for tag 2 content for tag 3... html content... I would like to get 3 matches, each with two groups. First group would contain the name of the tag and the ...
[ "c#", "regex", "tags" ]
2
2
6,423
6
0
2008-10-14T09:37:02.153000
2008-10-14T09:46:41.870000
200,527
200,596
UserHostAddress gives wrong IPs
I collect statistics on IP addresses from where users visit my site and I have noticed what there are only two IP addresses presented, 172.16.16.1 and 172.16.16.248. The property I use to determine IP address is Request.UserHostAddress What could be a reason of IP address information losing? All the users are from arou...
This looks like the work of a reverse proxy. When you use a reverse proxy, the client connects to the proxy, which itself opens a new connection to your server. Since ASP.NET uses the infos of the incoming connection to fill the user address, you get the address of the reverse proxy. If you are indeed in this configura...
UserHostAddress gives wrong IPs I collect statistics on IP addresses from where users visit my site and I have noticed what there are only two IP addresses presented, 172.16.16.1 and 172.16.16.248. The property I use to determine IP address is Request.UserHostAddress What could be a reason of IP address information los...
TITLE: UserHostAddress gives wrong IPs QUESTION: I collect statistics on IP addresses from where users visit my site and I have noticed what there are only two IP addresses presented, 172.16.16.1 and 172.16.16.248. The property I use to determine IP address is Request.UserHostAddress What could be a reason of IP addre...
[ "asp.net", "networking", "ip-address" ]
11
10
19,830
7
0
2008-10-14T09:38:36.177000
2008-10-14T10:04:03.800000
200,530
200,722
To which kind of problem is functional programming well suited?
Functional programming seems to be a paradigm in computer science which has more and more echo. I wonder which kind of problems are better solved with a functional programming approach rather than with a more traditional object oriented approach. Thank you.
Functional programming is best suited for most kinds of problems, including anything you would normally use object-oriented programming for, except for maybe problems that require the storing of a lot of state or other side effects. Aside from that, FP handles complex problems much more gracefully than OOP, as a lot of...
To which kind of problem is functional programming well suited? Functional programming seems to be a paradigm in computer science which has more and more echo. I wonder which kind of problems are better solved with a functional programming approach rather than with a more traditional object oriented approach. Thank you...
TITLE: To which kind of problem is functional programming well suited? QUESTION: Functional programming seems to be a paradigm in computer science which has more and more echo. I wonder which kind of problems are better solved with a functional programming approach rather than with a more traditional object oriented a...
[ "functional-programming" ]
11
7
2,857
12
0
2008-10-14T09:40:03.413000
2008-10-14T10:59:06.780000
200,535
200,577
Java Webservice testing
I provide a web service to my organisation. i was wondering would anyone recommeding the use of apache cactus for setting up a testing framework or has anyone worked with any other web service frameworks that may be useful? Thanks Damien
As you are dealing with a web service you would not need to use Jakarta Cactus and could get away with writing plain old JUnit tests. The tests would take two forms: 1. Does the underlying functionality work as expected? This has nothing to do with the web service itself but the underlying functionality it provides. e....
Java Webservice testing I provide a web service to my organisation. i was wondering would anyone recommeding the use of apache cactus for setting up a testing framework or has anyone worked with any other web service frameworks that may be useful? Thanks Damien
TITLE: Java Webservice testing QUESTION: I provide a web service to my organisation. i was wondering would anyone recommeding the use of apache cactus for setting up a testing framework or has anyone worked with any other web service frameworks that may be useful? Thanks Damien ANSWER: As you are dealing with a web s...
[ "java", "web-services", "testing" ]
3
4
5,977
3
0
2008-10-14T09:41:47.700000
2008-10-14T09:57:37.370000
200,545
200,548
Attempted SQL injection attack - what are they trying to do?
I have a public facing website that has been receiving a number of SQL injection attacks over the last few weeks. I exclusively use parameterised stored procedures so I believe that there has been no successful attacks, but a recent log showed an interesting technique: Line breaks added for clarity http://www.mydummysi...
Below is the decoded SQL that they were trying to push: DECLARE @T varchar(255), @C varchar(4000) DECLARE Table_Cursor CURSOR FOR SELECT a.name,b.name FROM sysobjects a,syscolumns b WHERE a.id=b.id AND a.xtype='u' AND (b.xtype=99 OR b.xtype=35 OR b.xtype=231 OR b.xtype=167) OPEN Table_Cursor FETCH NEXT FROM Table_Cur...
Attempted SQL injection attack - what are they trying to do? I have a public facing website that has been receiving a number of SQL injection attacks over the last few weeks. I exclusively use parameterised stored procedures so I believe that there has been no successful attacks, but a recent log showed an interesting ...
TITLE: Attempted SQL injection attack - what are they trying to do? QUESTION: I have a public facing website that has been receiving a number of SQL injection attacks over the last few weeks. I exclusively use parameterised stored procedures so I believe that there has been no successful attacks, but a recent log show...
[ "sql-server", "sql-injection" ]
22
30
2,817
6
0
2008-10-14T09:44:09.347000
2008-10-14T09:45:46.380000
200,550
200,645
Trapping messages in MFC - Whats the difference?
I was just wondering what (if any) the difference was between the following two message traps in MFC for the function, OnSize(..). 1 - Via Message map: BEGIN_MESSAGE_MAP(CClassWnd, CBaseClassWnd)... ON_WM_SIZE().. END_MESSAGE_MAP() 2 - Via afx_message: afx_msg type OnSize(...); They seem to be used interchangeably, whi...
Both parts are necessary to add a message handler to a class. The message map should be declared inside your class, together with declarations for any message handler functions (e.g, OnSize ). class CClassWnd: public CBaseClassWnd {... afx_msg void OnSize(UINT nType, int cx, int cy); DECLARE_MESSAGE_MAP }; afx_msg is j...
Trapping messages in MFC - Whats the difference? I was just wondering what (if any) the difference was between the following two message traps in MFC for the function, OnSize(..). 1 - Via Message map: BEGIN_MESSAGE_MAP(CClassWnd, CBaseClassWnd)... ON_WM_SIZE().. END_MESSAGE_MAP() 2 - Via afx_message: afx_msg type OnSiz...
TITLE: Trapping messages in MFC - Whats the difference? QUESTION: I was just wondering what (if any) the difference was between the following two message traps in MFC for the function, OnSize(..). 1 - Via Message map: BEGIN_MESSAGE_MAP(CClassWnd, CBaseClassWnd)... ON_WM_SIZE().. END_MESSAGE_MAP() 2 - Via afx_message: ...
[ "c++", "windows", "mfc", "message" ]
6
13
2,522
3
0
2008-10-14T09:46:01.857000
2008-10-14T10:22:48.630000
200,574
200,584
LINQ equivalent of foreach for IEnumerable<T>
I'd like to do the equivalent of the following in LINQ, but I can't figure out how: IEnumerable items = GetItems(); items.ForEach(i => i.DoStuff()); What is the real syntax?
There is no ForEach extension for IEnumerable; only for List. So you could do items.ToList().ForEach(i => i.DoStuff()); Alternatively, write your own ForEach extension method: public static void ForEach (this IEnumerable enumeration, Action action) { foreach(T item in enumeration) { action(item); } }
LINQ equivalent of foreach for IEnumerable<T> I'd like to do the equivalent of the following in LINQ, but I can't figure out how: IEnumerable items = GetItems(); items.ForEach(i => i.DoStuff()); What is the real syntax?
TITLE: LINQ equivalent of foreach for IEnumerable<T> QUESTION: I'd like to do the equivalent of the following in LINQ, but I can't figure out how: IEnumerable items = GetItems(); items.ForEach(i => i.DoStuff()); What is the real syntax? ANSWER: There is no ForEach extension for IEnumerable; only for List. So you coul...
[ "linq", "foreach", "ienumerable" ]
878
1,059
707,674
22
0
2008-10-14T09:56:09.790000
2008-10-14T10:00:08.020000
200,576
4,098,392
Printing web page programmatically in JSP
I have a J2EE based web application. In one of the pages there is a button labeled "Print". My problem is something like this: User enters tool names for e.g: ToolName1 ToolName2 ToolName3 Then clicks on "Print". The intended action is that tool details of the 3 tools are retrieved from db and then printed one tool per...
The print button should submit the form to the server where you prepare the output you want to print (the tool details etc.). This is rendered as per usual using your JSP page or whatever. To complete the job, put a call to window.print() on the results page and have it fired on the page load (or document ready event)....
Printing web page programmatically in JSP I have a J2EE based web application. In one of the pages there is a button labeled "Print". My problem is something like this: User enters tool names for e.g: ToolName1 ToolName2 ToolName3 Then clicks on "Print". The intended action is that tool details of the 3 tools are retri...
TITLE: Printing web page programmatically in JSP QUESTION: I have a J2EE based web application. In one of the pages there is a button labeled "Print". My problem is something like this: User enters tool names for e.g: ToolName1 ToolName2 ToolName3 Then clicks on "Print". The intended action is that tool details of the...
[ "jsp", "printing-web-page" ]
2
2
9,796
5
0
2008-10-14T09:56:44.050000
2010-11-04T15:41:57.603000
200,578
201,243
How can I localize Perl variables in a different stack frame?
I have some auto-generated code which effectively writes out the following in a bunch of different places in some code: no warnings 'uninitialized'; local %ENV = %ENV; local $/ = $/; local @INC = @INC; local %INC = %INC; local $_ = $_; local $| = $|; local %SIG = %SIG; use warnings 'uninitialized'; When auto-generating...
Perhaps you can arrange for the code that uses those locals to be generated as a closure? Then you could sub run_with_env { my ($sub, @args) = @_; no warnings 'uninitialized'; local %ENV = %ENV; local $/ = $/; local @INC = @INC; local %INC = %INC; local $_ = $_; local $| = $|; local %SIG = %SIG; use warnings 'uninitial...
How can I localize Perl variables in a different stack frame? I have some auto-generated code which effectively writes out the following in a bunch of different places in some code: no warnings 'uninitialized'; local %ENV = %ENV; local $/ = $/; local @INC = @INC; local %INC = %INC; local $_ = $_; local $| = $|; local %...
TITLE: How can I localize Perl variables in a different stack frame? QUESTION: I have some auto-generated code which effectively writes out the following in a bunch of different places in some code: no warnings 'uninitialized'; local %ENV = %ENV; local $/ = $/; local @INC = @INC; local %INC = %INC; local $_ = $_; loca...
[ "perl", "scope", "local" ]
24
30
1,165
6
0
2008-10-14T09:57:58.400000
2008-10-14T13:53:25.023000
200,587
201,981
How can I mimic Visual Studio's "Ctrl-K, C" two-step macro behaviour using Autoit / Autohotkey?
I'm trying to set up AutoHotkey macros for some common tasks, and I want the hotkeys to mimic Visual Studio's "two-step shortcut" behaviour - i.e. pressing Ctrl - K will enable "macro mode"; within macro mode, pressing certain keys will run a macro and then disable 'macro mode', and any other key will just disable macr...
This Autohotkey script, when you press ctrl + k, will wait for you to press a key and if you press d, it will input the current date. ^k:: Input Key, L1 FormatTime, Time,, yyyy-MM-dd if Key = d Send %Time% return
How can I mimic Visual Studio's "Ctrl-K, C" two-step macro behaviour using Autoit / Autohotkey? I'm trying to set up AutoHotkey macros for some common tasks, and I want the hotkeys to mimic Visual Studio's "two-step shortcut" behaviour - i.e. pressing Ctrl - K will enable "macro mode"; within macro mode, pressing certa...
TITLE: How can I mimic Visual Studio's "Ctrl-K, C" two-step macro behaviour using Autoit / Autohotkey? QUESTION: I'm trying to set up AutoHotkey macros for some common tasks, and I want the hotkeys to mimic Visual Studio's "two-step shortcut" behaviour - i.e. pressing Ctrl - K will enable "macro mode"; within macro mo...
[ "autohotkey" ]
15
9
2,993
2
0
2008-10-14T10:00:22.857000
2008-10-14T16:57:37.693000
200,599
200,611
Store simple user settings in Python
I am programming a website in which users will have a number of settings, such as their choice of colour scheme, etc. I'm happy to store these as plain text files, and security is not an issue. The way I currently see it is: there is a dictionary, where all the keys are users and the values are dictionaries with the us...
Using cPickle on the dictionary would be my choice. Dictionaries are a natural fit for these kind of data, so given your requirements I see no reason not to use them. That, unless you are thinking about reading them from non-python applications, in which case you'd have to use a language neutral text format. And even h...
Store simple user settings in Python I am programming a website in which users will have a number of settings, such as their choice of colour scheme, etc. I'm happy to store these as plain text files, and security is not an issue. The way I currently see it is: there is a dictionary, where all the keys are users and th...
TITLE: Store simple user settings in Python QUESTION: I am programming a website in which users will have a number of settings, such as their choice of colour scheme, etc. I'm happy to store these as plain text files, and security is not an issue. The way I currently see it is: there is a dictionary, where all the key...
[ "python", "database", "web", "settings" ]
9
7
11,009
12
0
2008-10-14T10:04:46.327000
2008-10-14T10:10:11.900000
200,609
200,622
Can you recommend a Java library for reading (and possibly writing) CSV files?
Can you recommend a Java library for reading, parsing, validating and mapping rows in a comma separated value (CSV) file to Java value objects (JavaBeans)?
We have used http://opencsv.sourceforge.net/ with good success I also came across another question with good links: Java lib or app to convert CSV to XML file?
Can you recommend a Java library for reading (and possibly writing) CSV files? Can you recommend a Java library for reading, parsing, validating and mapping rows in a comma separated value (CSV) file to Java value objects (JavaBeans)?
TITLE: Can you recommend a Java library for reading (and possibly writing) CSV files? QUESTION: Can you recommend a Java library for reading, parsing, validating and mapping rows in a comma separated value (CSV) file to Java value objects (JavaBeans)? ANSWER: We have used http://opencsv.sourceforge.net/ with good suc...
[ "java", "parsing", "csv" ]
54
41
68,674
8
0
2008-10-14T10:08:20.187000
2008-10-14T10:14:04.687000
200,617
201,063
How do I use SQL's GETDATE() and DATEADD() in a Linq to SQL expression?
If I have a Linq to SQL expression like this: from subscription in dbContext.Subscriptions where subscription.Expires > DateTime.Now select subscription I want this to to use the SQL Servers GETDATE() function instead of the time of the machine running the C# program. The next question would be how to translate this: D...
Try this: [Function(Name="GetDate", IsComposable=true)] public DateTime GetSystemDate() { MethodInfo mi = MethodBase.GetCurrentMethod() as MethodInfo; return (DateTime)this.ExecuteMethodCall(this, mi, new object[]{}).ReturnValue; } EDIT: this needs to be a part of your DataContext class. Now you can use GetSystemDate()...
How do I use SQL's GETDATE() and DATEADD() in a Linq to SQL expression? If I have a Linq to SQL expression like this: from subscription in dbContext.Subscriptions where subscription.Expires > DateTime.Now select subscription I want this to to use the SQL Servers GETDATE() function instead of the time of the machine run...
TITLE: How do I use SQL's GETDATE() and DATEADD() in a Linq to SQL expression? QUESTION: If I have a Linq to SQL expression like this: from subscription in dbContext.Subscriptions where subscription.Expires > DateTime.Now select subscription I want this to to use the SQL Servers GETDATE() function instead of the time ...
[ "sql", "linq-to-sql" ]
27
43
29,977
3
0
2008-10-14T10:11:45.750000
2008-10-14T13:01:29.450000
200,626
200,652
Best case to move to an agile development methodology?
If you had to make a case to a business about adopting or moving to an agile development methodology (like SCRUM or XP etc) what case would you make (how do you sell the concept)? e.g. How would you describe the concepts and benefits to a non-technical person? If you have successfully done so, what was the winning argu...
Non-technical people are interested in projects done on time and within budget with good quality and which would satisfy their requirements at the time of the delivery. You should focus on how Agile helps to deliver those qualities. It's sometimes quite difficult to sell Agile to a non-technical person for two reasons:...
Best case to move to an agile development methodology? If you had to make a case to a business about adopting or moving to an agile development methodology (like SCRUM or XP etc) what case would you make (how do you sell the concept)? e.g. How would you describe the concepts and benefits to a non-technical person? If y...
TITLE: Best case to move to an agile development methodology? QUESTION: If you had to make a case to a business about adopting or moving to an agile development methodology (like SCRUM or XP etc) what case would you make (how do you sell the concept)? e.g. How would you describe the concepts and benefits to a non-tech...
[ "agile", "methodology" ]
3
2
754
8
0
2008-10-14T10:15:27.007000
2008-10-14T10:25:21.573000
200,635
200,791
How to change registration company name for Visual Studio 2008?
Is there a way to change name of company to which the Visual Studio 2008 is registered without reinstalling it?
This should have the answer you are looking for: http://bytes.com/forum/thread635503.html For the CompanyName in AssemblyInfo, it's $registeredorganization$ which uses value from registry key value from HKLM\Software\Microsoft\Windows NT\CurrentVersion\RegisteredOrganization.
How to change registration company name for Visual Studio 2008? Is there a way to change name of company to which the Visual Studio 2008 is registered without reinstalling it?
TITLE: How to change registration company name for Visual Studio 2008? QUESTION: Is there a way to change name of company to which the Visual Studio 2008 is registered without reinstalling it? ANSWER: This should have the answer you are looking for: http://bytes.com/forum/thread635503.html For the CompanyName in Asse...
[ "visual-studio-2008" ]
30
34
17,763
5
0
2008-10-14T10:19:06.813000
2008-10-14T11:33:00.690000
200,640
200,666
Are PHP short tags acceptable to use?
Here's the information according to the official documentation: There are four different pairs of opening and closing tags which can be used in PHP. Two of those, and, are always available. The other two are short tags and ASP style tags, and can be turned on and off from the php.ini configuration file. As such, while ...
There must be a clear distinction between the PHP short tag ( ) and shorthand echo tag ( ) The former is prohibited by the PHP Coding standard, mostly out of common sense because it's a PITA if you ever have to move your code to a server where it's not supported (and you can't enable it). As you say, lots of shared hos...
Are PHP short tags acceptable to use? Here's the information according to the official documentation: There are four different pairs of opening and closing tags which can be used in PHP. Two of those, and, are always available. The other two are short tags and ASP style tags, and can be turned on and off from the php.i...
TITLE: Are PHP short tags acceptable to use? QUESTION: Here's the information according to the official documentation: There are four different pairs of opening and closing tags which can be used in PHP. Two of those, and, are always available. The other two are short tags and ASP style tags, and can be turned on and ...
[ "php", "php-shorttags" ]
543
390
121,243
28
0
2008-10-14T10:21:04.563000
2008-10-14T10:31:56.567000
200,662
200,672
How can I make sure a background image displays before the page loads?
Is there a way to make sure a (large, 300K) background picture is always displayed first BEFORE any other content is shown on the page? On the server we have access to PHP.
All the html content is served and parsed before it even starts to fetch the image, so you have a problem before you start. You could circumvent this by programmatically hiding the content, and then triggering a "show" of it when the image is loaded. ie:
How can I make sure a background image displays before the page loads? Is there a way to make sure a (large, 300K) background picture is always displayed first BEFORE any other content is shown on the page? On the server we have access to PHP.
TITLE: How can I make sure a background image displays before the page loads? QUESTION: Is there a way to make sure a (large, 300K) background picture is always displayed first BEFORE any other content is shown on the page? On the server we have access to PHP. ANSWER: All the html content is served and parsed before ...
[ "php", "javascript", "html" ]
0
3
4,564
6
0
2008-10-14T10:30:25.917000
2008-10-14T10:34:16.127000
200,667
201,044
Excel Timesheet
I have some data in the following format: Salary Code InTime 1690 09:03:00 1690 09:13:00 1690 09:07:00 1691 08:48:00 1691 08:52:00 1691 08:50:00 1691 08:54:00 1691 08:46:00 1691 09:28:00 1691 08:59:00 1691 08:53:00 1691 09:02:00 1693 08:57:00 1693 09:01:00 1693 08:54:00 1693 09:22:00 1693 09:16:00 1693 08:58:00 1693 09...
It can be done without programming, but there is one bit of information you need to add in order for this to make sense - the date or sequence number for each entry. Then you will be able to plot: salary code: the series date or sequence number: the x-axis In Time: the value / y-axis The easiest way is with the PivotCh...
Excel Timesheet I have some data in the following format: Salary Code InTime 1690 09:03:00 1690 09:13:00 1690 09:07:00 1691 08:48:00 1691 08:52:00 1691 08:50:00 1691 08:54:00 1691 08:46:00 1691 09:28:00 1691 08:59:00 1691 08:53:00 1691 09:02:00 1693 08:57:00 1693 09:01:00 1693 08:54:00 1693 09:22:00 1693 09:16:00 1693 ...
TITLE: Excel Timesheet QUESTION: I have some data in the following format: Salary Code InTime 1690 09:03:00 1690 09:13:00 1690 09:07:00 1691 08:48:00 1691 08:52:00 1691 08:50:00 1691 08:54:00 1691 08:46:00 1691 09:28:00 1691 08:59:00 1691 08:53:00 1691 09:02:00 1693 08:57:00 1693 09:01:00 1693 08:54:00 1693 09:22:00 1...
[ "excel", "charts" ]
1
3
1,839
3
0
2008-10-14T10:31:57.100000
2008-10-14T12:57:39.003000
200,676
200,763
VisualC++ 6.0 with unsigned long long and sprintf
I want to sprintf() an unsigned long long value in visual C++ 6.0 (plain C). char buf[1000]; //bad coding unsigned __int64 l = 12345678; char t1[6] = "test1"; char t2[6] = "test2"; sprintf(buf, "%lli, %s, %s", l, t1, t2); gives the result 12345678, (null), test1 (watch that test2 is not printed) and l = 123456789012345...
To print an unsigned __int64 value in Visual C++ 6.0 you should use %I64u, not %lli (refer to this page on MSDN). %lli is only supported in Visual Studio 2005 and later versions. So, your code should be: sprintf(buf, "%I64u, %s, %s", l, t1, t2);
VisualC++ 6.0 with unsigned long long and sprintf I want to sprintf() an unsigned long long value in visual C++ 6.0 (plain C). char buf[1000]; //bad coding unsigned __int64 l = 12345678; char t1[6] = "test1"; char t2[6] = "test2"; sprintf(buf, "%lli, %s, %s", l, t1, t2); gives the result 12345678, (null), test1 (watch ...
TITLE: VisualC++ 6.0 with unsigned long long and sprintf QUESTION: I want to sprintf() an unsigned long long value in visual C++ 6.0 (plain C). char buf[1000]; //bad coding unsigned __int64 l = 12345678; char t1[6] = "test1"; char t2[6] = "test2"; sprintf(buf, "%lli, %s, %s", l, t1, t2); gives the result 12345678, (nu...
[ "c", "visual-c++-6" ]
4
9
8,351
3
0
2008-10-14T10:36:26.263000
2008-10-14T11:19:29.373000
200,686
201,145
Multi page forms in Rails
I'm having a quite complex model with many fields, has_many associations, images added by image_column etc... The New object will be added by a multi page form (8 steps) - How should I accomplish validation and propagation between those steps? I think validation_group could be useful for defining validations for each s...
For overall design, you might want to look into the concept of a Presenter layer (Jay Fields defines it in his blog entry Rails: Presenter Pattern ) as a way to keep your controllers thin and views stupid when dealing with complex/multiple models.
Multi page forms in Rails I'm having a quite complex model with many fields, has_many associations, images added by image_column etc... The New object will be added by a multi page form (8 steps) - How should I accomplish validation and propagation between those steps? I think validation_group could be useful for defin...
TITLE: Multi page forms in Rails QUESTION: I'm having a quite complex model with many fields, has_many associations, images added by image_column etc... The New object will be added by a multi page form (8 steps) - How should I accomplish validation and propagation between those steps? I think validation_group could b...
[ "ruby-on-rails", "model-view-controller", "validation", "forms" ]
5
6
5,565
3
0
2008-10-14T10:39:36.520000
2008-10-14T13:28:06.417000
200,689
200,727
How do I set the byte order marker for Unicode files?
I know this is not a "real" programming question. But, it relates to programming so I am going to set it anyway. I have a program that I need to test that reads the Byte Order Marker of the file to see if it is utf-8 or utf-16. My problem is I cannot find a program/text editor that will allow me to set the byte order m...
There is a pretty good program called BabelPad. It will not only set the BOM, I believe it will also tel you if it is set or not. You can also do it programmitically in.Net. There is a good FAQ about this on MSN.
How do I set the byte order marker for Unicode files? I know this is not a "real" programming question. But, it relates to programming so I am going to set it anyway. I have a program that I need to test that reads the Byte Order Marker of the file to see if it is utf-8 or utf-16. My problem is I cannot find a program/...
TITLE: How do I set the byte order marker for Unicode files? QUESTION: I know this is not a "real" programming question. But, it relates to programming so I am going to set it anyway. I have a program that I need to test that reads the Byte Order Marker of the file to see if it is utf-8 or utf-16. My problem is I cann...
[ "file", "unicode", "utf-8", "byte-order-mark" ]
3
3
1,363
4
0
2008-10-14T10:41:50.917000
2008-10-14T11:03:25.787000
200,691
200,708
How to use Special Chars in Java/Eclipse
How can I use/display characters like ♥, ♦, ♣, or ♠ in Java/Eclipse? When I try to use them directly, e.g. in the source code, Eclipse cannot save the file. What can I do? Edit: How can I find the unicode escape sequence?
The problem is that the characters you are using cannot be represented in the encoding you have the file set to (Cp1252). The way I see it, you essentially have two options: Option 1. Change the encoding. According to IBM, you should set the encoding to UTF-8. I believe this would solve your problem. Set the global tex...
How to use Special Chars in Java/Eclipse How can I use/display characters like ♥, ♦, ♣, or ♠ in Java/Eclipse? When I try to use them directly, e.g. in the source code, Eclipse cannot save the file. What can I do? Edit: How can I find the unicode escape sequence?
TITLE: How to use Special Chars in Java/Eclipse QUESTION: How can I use/display characters like ♥, ♦, ♣, or ♠ in Java/Eclipse? When I try to use them directly, e.g. in the source code, Eclipse cannot save the file. What can I do? Edit: How can I find the unicode escape sequence? ANSWER: The problem is that the charac...
[ "java", "eclipse", "unicode", "encoding", "cp1252" ]
26
37
83,643
8
0
2008-10-14T10:42:00.573000
2008-10-14T10:49:01.307000
200,721
200,744
Most interesting non-mainstream language?
I'm interested in compilers, interpreters and languages. What is the most interesting, but forgotten or unknown, language you know about? And more importantly, why? I'm interested both in compiled, interpreted and VM languages, but not esoteric languages like Whitespace or BF. Open source would be a plus, of course, si...
I love compilers and VMs, and I love Lua. Lua is not as well supported as many other scripting languages, but from a mindset like yours I'm sure you will fall in love with Lua too. I mean it's like lisp, (can do anything lisp can as far as I know), has lots of the main features from ADA, plus it's got meta programming ...
Most interesting non-mainstream language? I'm interested in compilers, interpreters and languages. What is the most interesting, but forgotten or unknown, language you know about? And more importantly, why? I'm interested both in compiled, interpreted and VM languages, but not esoteric languages like Whitespace or BF. ...
TITLE: Most interesting non-mainstream language? QUESTION: I'm interested in compilers, interpreters and languages. What is the most interesting, but forgotten or unknown, language you know about? And more importantly, why? I'm interested both in compiled, interpreted and VM languages, but not esoteric languages like ...
[ "programming-languages", "language-design" ]
43
30
7,486
43
0
2008-10-14T10:59:06.107000
2008-10-14T11:11:36.380000
200,724
200,909
Resizing XAML properties
Is there a way to have XAML properties scale along with the size of the uielements they belong to? In essence, I have a control template that I have created too large for it's use/ mainly because I want to use the same control with different sizes. The problem is that I can set the control size to Auto (in the ControlT...
You could try to bind the width and height of the control inside the template to the width and height respectively of the templated control at runtime. Something like: Note that the binding sources are the FrameworkElement.ActualWidth and FrameworkElement.ActualHeight properties of the templated control. These properti...
Resizing XAML properties Is there a way to have XAML properties scale along with the size of the uielements they belong to? In essence, I have a control template that I have created too large for it's use/ mainly because I want to use the same control with different sizes. The problem is that I can set the control size...
TITLE: Resizing XAML properties QUESTION: Is there a way to have XAML properties scale along with the size of the uielements they belong to? In essence, I have a control template that I have created too large for it's use/ mainly because I want to use the same control with different sizes. The problem is that I can se...
[ "wpf", "xaml", "scaling" ]
3
1
1,495
3
0
2008-10-14T10:59:39.447000
2008-10-14T12:15:52.740000
200,729
245,832
Essential techniques for pinpointing missing requirements?
An initial draft of requirements specification has been completed and now it is time to take stock of requirements, review the specification. Part of this process is to make sure that there are no sizeable gaps in the specification. Needless to say that the gaps lead to highly inaccurate estimates, inevitable scope cre...
evaluate the lifecycle of the elements of the model with respect to a generic/overall model such as acquisition --> stewardship --> disposal do you know where every entity comes from and how you're going to get it into your system? do you know where every entity, once acquired, will reside, and for how long? do you kno...
Essential techniques for pinpointing missing requirements? An initial draft of requirements specification has been completed and now it is time to take stock of requirements, review the specification. Part of this process is to make sure that there are no sizeable gaps in the specification. Needless to say that the gap...
TITLE: Essential techniques for pinpointing missing requirements? QUESTION: An initial draft of requirements specification has been completed and now it is time to take stock of requirements, review the specification. Part of this process is to make sure that there are no sizeable gaps in the specification. Needless t...
[ "specifications" ]
7
2
1,534
8
0
2008-10-14T11:03:59.313000
2008-10-29T04:52:34.913000
200,738
201,325
How can I unpack binary hex formatted data in Python?
Using the PHP pack() function, I have converted a string into a binary hex representation: $string = md5(time); // 32 character length $packed = pack('H*', $string); The H* formatting means "Hex string, high nibble first". To unpack this in PHP, I would simply use the unpack() function with the H* format flag. How woul...
There's an easy way to do this with the binascii module: >>> import binascii >>> print binascii.hexlify("ABCZ") '4142435a' >>> print binascii.unhexlify("4142435a") 'ABCZ' Unless I'm misunderstanding something about the nibble ordering (high-nibble first is the default… anything different is insane), that should be perf...
How can I unpack binary hex formatted data in Python? Using the PHP pack() function, I have converted a string into a binary hex representation: $string = md5(time); // 32 character length $packed = pack('H*', $string); The H* formatting means "Hex string, high nibble first". To unpack this in PHP, I would simply use t...
TITLE: How can I unpack binary hex formatted data in Python? QUESTION: Using the PHP pack() function, I have converted a string into a binary hex representation: $string = md5(time); // 32 character length $packed = pack('H*', $string); The H* formatting means "Hex string, high nibble first". To unpack this in PHP, I ...
[ "python", "binary", "hex" ]
7
13
29,514
3
0
2008-10-14T11:08:07.277000
2008-10-14T14:15:26.693000
200,742
200,973
How do I write a .Net Regular Expression to match from the end of line back
I have the following line of text Reference=*\G{7B35DDAC-FFE2-4435-8A15-CF5C70F23459}#1.0#0#..\..\..\bin\App Components\AcmeFormEngine.dll#ACME Form Engine and wish to grab the following as two separate capture groups: AcmeFormEngine.dll ACME Form Engine Can anyone help?
I voted for tomalask's non-regex approach. However if you HAD to do it with regex, I think you need something like this \\([^\\/?"<>|]+?)\#([^\\/?"<>|]+?)[\r\n]*$ This will allow things like - and _ which are valid in filenames, Its 2 identical groups (each excluding invalid chars for win32 filenames) beginning with a ...
How do I write a .Net Regular Expression to match from the end of line back I have the following line of text Reference=*\G{7B35DDAC-FFE2-4435-8A15-CF5C70F23459}#1.0#0#..\..\..\bin\App Components\AcmeFormEngine.dll#ACME Form Engine and wish to grab the following as two separate capture groups: AcmeFormEngine.dll ACME F...
TITLE: How do I write a .Net Regular Expression to match from the end of line back QUESTION: I have the following line of text Reference=*\G{7B35DDAC-FFE2-4435-8A15-CF5C70F23459}#1.0#0#..\..\..\bin\App Components\AcmeFormEngine.dll#ACME Form Engine and wish to grab the following as two separate capture groups: AcmeFor...
[ ".net", "regex" ]
0
1
583
4
0
2008-10-14T11:11:03.430000
2008-10-14T12:38:08.093000
200,743
259,685
WiX script with only Welcome and Completed screens
I need a WiX 3 script to display to display only 2 dialogs: Welcome & Completed. Thats it no need for EULA, folder selection etc. All help appreciated.
All you need to do is add this in your WIX script, it will give you the WelcomeDlg before the installation and show the Installation progress, then the Exit Dialog. Don't forget to add the WixUIExtension.dll to your references. 1
WiX script with only Welcome and Completed screens I need a WiX 3 script to display to display only 2 dialogs: Welcome & Completed. Thats it no need for EULA, folder selection etc. All help appreciated.
TITLE: WiX script with only Welcome and Completed screens QUESTION: I need a WiX 3 script to display to display only 2 dialogs: Welcome & Completed. Thats it no need for EULA, folder selection etc. All help appreciated. ANSWER: All you need to do is add this in your WIX script, it will give you the WelcomeDlg before ...
[ "wix", "installation", "windows-installer" ]
27
55
13,450
2
0
2008-10-14T11:11:24.477000
2008-11-03T19:39:55.613000
200,746
200,854
How do I split strings in J2ME?
How do I split strings in J2ME in an effective way? There is a StringTokenizer or String.split(String regex) in the standard edition (J2SE), but they are absent in the micro edition (J2ME, MIDP).
There are a few implementations of a StringTokenizer class for J2ME. This one by Ostermiller will most likely include the functionality you need See also this page on Mobile Programming Pit Stop for some modifications and the following example: String firstToken; StringTokenizer tok; tok = new StringTokenizer("some|ra...
How do I split strings in J2ME? How do I split strings in J2ME in an effective way? There is a StringTokenizer or String.split(String regex) in the standard edition (J2SE), but they are absent in the micro edition (J2ME, MIDP).
TITLE: How do I split strings in J2ME? QUESTION: How do I split strings in J2ME in an effective way? There is a StringTokenizer or String.split(String regex) in the standard edition (J2SE), but they are absent in the micro edition (J2ME, MIDP). ANSWER: There are a few implementations of a StringTokenizer class for J2...
[ "java", "algorithm", "string", "java-me" ]
14
11
11,491
8
0
2008-10-14T11:12:04.570000
2008-10-14T11:57:42.933000
200,752
201,351
What is the buffer size to create a .zip archive using Java?
I use this code to create a.zip with a list of files: ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile)); for (int i=0;i 0;){ zos.write(buffer,0,read); } fis.close(); zos.closeEntry(); } zos.close(); I don't know how the zip algorithm and the ZipOutputStream works, if it writes something before I...
Short answer: I would pick something like 16k. Long answer: ZIP is using the DEFLATE algorithm for compression ( http://en.wikipedia.org/wiki/DEFLATE ). Deflate is a flavor of Ziv Lempel Welch(search wikipedia for LZW). DEFLATE uses LZ77 and Huffman coding. This is a dictionary compression, and as far as I know from th...
What is the buffer size to create a .zip archive using Java? I use this code to create a.zip with a list of files: ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile)); for (int i=0;i 0;){ zos.write(buffer,0,read); } fis.close(); zos.closeEntry(); } zos.close(); I don't know how the zip algorithm a...
TITLE: What is the buffer size to create a .zip archive using Java? QUESTION: I use this code to create a.zip with a list of files: ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile)); for (int i=0;i 0;){ zos.write(buffer,0,read); } fis.close(); zos.closeEntry(); } zos.close(); I don't know how t...
[ "java", "zip", "buffer" ]
7
11
7,526
2
0
2008-10-14T11:14:45.997000
2008-10-14T14:22:23.060000
200,755
200,784
EntitySet vs Table query performance in LINQ2SQL
In a LINQ to SQL class, why are the properties that are created from the foreign keys EntitySet objects, which implement IEnumerable, where as the objects on the DataContext are Table objects which implement IQueryable? EDIT: To clarify, here is an example that illustrates what I'm trying to understand. This example: c...
Tables are effectively a conceptual matter - they really exist on the server, so you need to query to get entries. The foreign key entries are the ones actually fetched by another query, so at that point they're locally available. That's a fairly woolly description, but hopefully it gets over the general concept.
EntitySet vs Table query performance in LINQ2SQL In a LINQ to SQL class, why are the properties that are created from the foreign keys EntitySet objects, which implement IEnumerable, where as the objects on the DataContext are Table objects which implement IQueryable? EDIT: To clarify, here is an example that illustrat...
TITLE: EntitySet vs Table query performance in LINQ2SQL QUESTION: In a LINQ to SQL class, why are the properties that are created from the foreign keys EntitySet objects, which implement IEnumerable, where as the objects on the DataContext are Table objects which implement IQueryable? EDIT: To clarify, here is an exam...
[ "linq", "linq-to-sql", "ienumerable", "iqueryable" ]
9
1
4,569
3
0
2008-10-14T11:16:03.250000
2008-10-14T11:29:21.243000
200,757
200,778
How do you handle the tension between refactoring and the need for merging?
Our policy when delivering a new version is to create a branch in our VCS and handle it to our QA team. When the latter gives the green light, we tag and release our product. The branch is kept to receive (only) bug fixes so that we can create technical releases. Those bug fixes are subsequently merged on the trunk. Du...
This is a real practical problem. It gets worse if you have several versions you need to support and have branched for each. Even worse still if you have a genuine R&D branch too. My preference was to allow the main trunk to proceed at its normal rate and not to hold on because in an environment where release timings w...
How do you handle the tension between refactoring and the need for merging? Our policy when delivering a new version is to create a branch in our VCS and handle it to our QA team. When the latter gives the green light, we tag and release our product. The branch is kept to receive (only) bug fixes so that we can create ...
TITLE: How do you handle the tension between refactoring and the need for merging? QUESTION: Our policy when delivering a new version is to create a branch in our VCS and handle it to our QA team. When the latter gives the green light, we tag and release our product. The branch is kept to receive (only) bug fixes so t...
[ "version-control", "refactoring", "release", "branch", "merge" ]
27
18
1,863
6
0
2008-10-14T11:16:20.923000
2008-10-14T11:25:42.077000
200,765
200,807
Single Table Inheritance
An answer to a question of mine on DB design suggested something called single table inheritance. I've done a bit of searching on that, but I can't seem to find that much clear information on it. Basically what I seem to understand from it is that you have a big table with all the fields in it and also a type field - a...
Is it a good idea? It depends. It breaks Normalization in that a table does not have a single purpose. What happens when you extend the base class for the nth time? You will have to add columns to the table. Most modern DBs don't have a problem with that as you can modify the table but what about refactoring and removi...
Single Table Inheritance An answer to a question of mine on DB design suggested something called single table inheritance. I've done a bit of searching on that, but I can't seem to find that much clear information on it. Basically what I seem to understand from it is that you have a big table with all the fields in it ...
TITLE: Single Table Inheritance QUESTION: An answer to a question of mine on DB design suggested something called single table inheritance. I've done a bit of searching on that, but I can't seem to find that much clear information on it. Basically what I seem to understand from it is that you have a big table with all...
[ "ruby-on-rails", "database-design", "single-table-inheritance" ]
4
5
2,806
7
0
2008-10-14T11:20:04.037000
2008-10-14T11:39:23.890000
200,786
203,947
Memory leak in .NETCF - creating dynamic controls?
I have a problem with a memory leak in a.NET CF application. Using RPM I identified that dynamically creating controls are not garbage collected as expected. Running the same piece of code in.NET Window Forms behave differently and disposes the control as I expected. See the output from RPM via PerfMon for the Process ...
Some additional information here that explains this behaviour. According to Ilya Tumanov: Everything UI related on NETCF is intentionally removed from GC scope so it is never collected. This behavior is different from desktop and has been changed in NETCF V3.5 (unless running in compatibility mode). It is so different ...
Memory leak in .NETCF - creating dynamic controls? I have a problem with a memory leak in a.NET CF application. Using RPM I identified that dynamically creating controls are not garbage collected as expected. Running the same piece of code in.NET Window Forms behave differently and disposes the control as I expected. S...
TITLE: Memory leak in .NETCF - creating dynamic controls? QUESTION: I have a problem with a memory leak in a.NET CF application. Using RPM I identified that dynamically creating controls are not garbage collected as expected. Running the same piece of code in.NET Window Forms behave differently and disposes the contro...
[ ".net", "compact-framework", "memory-leaks", "garbage-collection", "profiling" ]
1
3
2,713
4
0
2008-10-14T11:30:28.540000
2008-10-15T07:29:00.663000
200,794
201,367
Is there a DBGrid component that can handle large datasets fast?
Large datasets, millions of records, need special programming to maintain speed in DBGrids. I want to know if there are any ready-made components for Delphi (DBGrids) that do this automatically? EDIT For Example: Some databases have features such as fetch 1st X records (eg 100 records). When I reach the bottom with scr...
I would have a look at Developer Express QuantumGrid Suite. (@birger: you just were a tick faster;-) ) So I'm not just duplicating the answer, some elaboration: The DevExpress Grid uses a data controller that has several modes to controll the data bound to the grid. One of these is exactly what you are looking for: Gri...
Is there a DBGrid component that can handle large datasets fast? Large datasets, millions of records, need special programming to maintain speed in DBGrids. I want to know if there are any ready-made components for Delphi (DBGrids) that do this automatically? EDIT For Example: Some databases have features such as fetch...
TITLE: Is there a DBGrid component that can handle large datasets fast? QUESTION: Large datasets, millions of records, need special programming to maintain speed in DBGrids. I want to know if there are any ready-made components for Delphi (DBGrids) that do this automatically? EDIT For Example: Some databases have feat...
[ "performance", "delphi", "dataset", "dbgrid" ]
3
3
5,382
5
0
2008-10-14T11:33:45.867000
2008-10-14T14:24:34.943000
200,810
200,851
How can I do access control via an SQL table?
I'm trying to create an access control system. Here's a stripped down example of what the table I'm trying to control access to looks like: things table: id group_id name 1 1 thing 1 2 1 thing 2 3 1 thing 3 4 1 thing 4 5 2 thing 5 And the access control table looks like this: access table: user_id type object_id access...
I don't know the Postgres SQL dialect, but maybe something like: select thing.*, coalesce ( ( select access from access where userid = 1 and type = 'thing' and object_id = thing.id ), ( select access from access where userid = 1 and type = 'group' and object_id = thing.group_id ) ) from things Incidentally, I don't lik...
How can I do access control via an SQL table? I'm trying to create an access control system. Here's a stripped down example of what the table I'm trying to control access to looks like: things table: id group_id name 1 1 thing 1 2 1 thing 2 3 1 thing 3 4 1 thing 4 5 2 thing 5 And the access control table looks like thi...
TITLE: How can I do access control via an SQL table? QUESTION: I'm trying to create an access control system. Here's a stripped down example of what the table I'm trying to control access to looks like: things table: id group_id name 1 1 thing 1 2 1 thing 2 3 1 thing 3 4 1 thing 4 5 2 thing 5 And the access control ta...
[ "sql", "postgresql", "access-control" ]
4
1
903
4
0
2008-10-14T11:39:51.783000
2008-10-14T11:56:43.823000
200,822
200,943
How do I track and debug JavaScript memory leaks in Firefox?
I've been trying to track this one for literally a month now without any success. I have this piece of code on an car advertising website which basically allows thumbnails to rotate in search results given that a car has multiple pictures. You can see it in action at the following: http://www.abcavendre.com/4506691919/...
A way to track memory leaks in Firefox is with the Leak Monitor Addon. It shows memory leaks of javascript (including extension-scripts). Please remind that the plugin will sometimes show leaked objects that will get cleaned up later by the garbage collection. If that is the case the plugin will launch a new window sho...
How do I track and debug JavaScript memory leaks in Firefox? I've been trying to track this one for literally a month now without any success. I have this piece of code on an car advertising website which basically allows thumbnails to rotate in search results given that a car has multiple pictures. You can see it in a...
TITLE: How do I track and debug JavaScript memory leaks in Firefox? QUESTION: I've been trying to track this one for literally a month now without any success. I have this piece of code on an car advertising website which basically allows thumbnails to rotate in search results given that a car has multiple pictures. Y...
[ "javascript", "memory-leaks", "mootools" ]
17
8
19,262
3
0
2008-10-14T11:46:24.717000
2008-10-14T12:28:05.053000
200,830
200,843
How to dynamically set which properties get bound to a DataGridView?
My DataGridView needs to support a number of types and these types may have any number of public properties, not all of which I want to display. Can anyone suggest a way to dynamically customise a DataGridView's columns when binding a class a datasource? Is there an attribute that will tell a control whether to use a p...
By default (with auto column generation enabled), it will simply obtain (via ComponentModel) the [Browsable(true)] properties, (or those that omit this attribute). If this is the only use of binding for this data, you could add [Browsable(false)] to the properties you don't want to show. Note that this will also preven...
How to dynamically set which properties get bound to a DataGridView? My DataGridView needs to support a number of types and these types may have any number of public properties, not all of which I want to display. Can anyone suggest a way to dynamically customise a DataGridView's columns when binding a class a datasour...
TITLE: How to dynamically set which properties get bound to a DataGridView? QUESTION: My DataGridView needs to support a number of types and these types may have any number of public properties, not all of which I want to display. Can anyone suggest a way to dynamically customise a DataGridView's columns when binding ...
[ "c#", ".net", "winforms", "data-binding", "datagridview" ]
4
4
817
1
0
2008-10-14T11:51:05.083000
2008-10-14T11:55:20.893000
200,836
201,126
How do I parse a base query (à la Google Data) in Java?
I have a system where I query a REST / Atom server for documents. The queries are inspired by GData and look like: http://server/base/feeds/documents?bq=[type in {'news'}] I have to parse the "bq" parameter to know which type of documents will be returned without actually doing the query. So for example, bq=[type = 'ne...
The right way would be to use parser generator like Antlr, JFlex or JavaCC. A quick and dirty way would be: String[] disjunctedPredicateGroups = query.split("\|"); List normalizedPredicates = ArrayList; for (String conjunction: disjunctedPredicateGroups ) { normalizedPredicates.add(conjunction.split("\[|\]")); } // pro...
How do I parse a base query (à la Google Data) in Java? I have a system where I query a REST / Atom server for documents. The queries are inspired by GData and look like: http://server/base/feeds/documents?bq=[type in {'news'}] I have to parse the "bq" parameter to know which type of documents will be returned without ...
TITLE: How do I parse a base query (à la Google Data) in Java? QUESTION: I have a system where I query a REST / Atom server for documents. The queries are inspired by GData and look like: http://server/base/feeds/documents?bq=[type in {'news'}] I have to parse the "bq" parameter to know which type of documents will be...
[ "java", "parsing", "gdata-api" ]
0
3
468
1
0
2008-10-14T11:54:04.750000
2008-10-14T13:20:08.833000
200,837
201,763
Using SQL for cleaning up JIRA database
Has anyone had luck with removing large amount of issues from a jira database instead of using the frontend? Deleting 60000 issues with the bulktools is not really feasible. Last time I tried it, the jira went nuts because of its own way of doing indexes.
We got gutsy and did a truncate on the jiraissues table and then use the rebuild index feature on the frontend. It looks like it's working!
Using SQL for cleaning up JIRA database Has anyone had luck with removing large amount of issues from a jira database instead of using the frontend? Deleting 60000 issues with the bulktools is not really feasible. Last time I tried it, the jira went nuts because of its own way of doing indexes.
TITLE: Using SQL for cleaning up JIRA database QUESTION: Has anyone had luck with removing large amount of issues from a jira database instead of using the frontend? Deleting 60000 issues with the bulktools is not really feasible. Last time I tried it, the jira went nuts because of its own way of doing indexes. ANSWE...
[ "sql", "jira" ]
1
3
2,820
3
0
2008-10-14T11:54:07.230000
2008-10-14T15:59:13.053000
200,839
200,875
What's the difference between StaticResource and DynamicResource in WPF?
When using resources such as brushes, templates and styles in WPF, they can be specified either as StaticResources or as a DynamicResource Most of the times (always?), only one works and the other will throw exception during runtime. But I'd like to know why: What is the main difference. Like memory or performance impl...
A StaticResource will be resolved and assigned to the property during the loading of the XAML which occurs before the application is actually run. It will only be assigned once and any changes to resource dictionary ignored. A DynamicResource assigns an Expression object to the property during loading but does not actu...
What's the difference between StaticResource and DynamicResource in WPF? When using resources such as brushes, templates and styles in WPF, they can be specified either as StaticResources or as a DynamicResource Most of the times (always?), only one works and the other will throw exception during runtime. But I'd like ...
TITLE: What's the difference between StaticResource and DynamicResource in WPF? QUESTION: When using resources such as brushes, templates and styles in WPF, they can be specified either as StaticResources or as a DynamicResource Most of the times (always?), only one works and the other will throw exception during runt...
[ ".net", "wpf", "xaml", "resources" ]
531
527
217,372
8
0
2008-10-14T11:54:57.853000
2008-10-14T12:04:29.097000
200,842
200,947
Cooliris fetching from google docs:
We're creating a Interaction design pattern website for a class. We've been using google docs to create the patterns list during the classes, sharing it with the teacher for evaluation. So the environment is this: We've been able to fetch a single image from each presentation we want to display, such as: http://docs.go...
The server needed a crossdomain.xml to allow cooliris. So we can't do it directly from google but we'll just download it a put on another server.
Cooliris fetching from google docs: We're creating a Interaction design pattern website for a class. We've been using google docs to create the patterns list during the classes, sharing it with the teacher for evaluation. So the environment is this: We've been able to fetch a single image from each presentation we want...
TITLE: Cooliris fetching from google docs: QUESTION: We're creating a Interaction design pattern website for a class. We've been using google docs to create the patterns list during the classes, sharing it with the teacher for evaluation. So the environment is this: We've been able to fetch a single image from each pr...
[ "rss", "google-docs", "cooliris" ]
0
1
609
2
0
2008-10-14T11:55:08.287000
2008-10-14T12:31:14.953000
200,847
201,398
Persistence framework?
I'm trying to decide on the best strategy for accessing the database. I understand that this is a generic question and there's no a single good answer, but I will provide some guidelines on what I'm looking for. The last few years we have been using our own persistence framework, that although limited has served as wel...
Improve our current framework - Problem is that it needs a good deal of effort In your question, you have not given a reason why you should rewrite functionality which is available from so many other places. I would suggest that reinventing an ORM is not a good use of your time, unless you have unique needs for the ORM...
Persistence framework? I'm trying to decide on the best strategy for accessing the database. I understand that this is a generic question and there's no a single good answer, but I will provide some guidelines on what I'm looking for. The last few years we have been using our own persistence framework, that although li...
TITLE: Persistence framework? QUESTION: I'm trying to decide on the best strategy for accessing the database. I understand that this is a generic question and there's no a single good answer, but I will provide some guidelines on what I'm looking for. The last few years we have been using our own persistence framework...
[ "linq", "nhibernate", "ado.net", "linq-to-entities", "persistence" ]
1
2
1,351
5
0
2008-10-14T11:55:47.007000
2008-10-14T14:31:24.290000
200,858
200,881
C# : How does this work : Unit myUnit = 5;
I just noticed that you can do this in C#: Unit myUnit = 5; instead of having to do this: Unit myUnit = new Unit(5); Does anyone know how I can achieve this with my own structs? I had a look at the Unit struct with reflector and noticed the TypeConverter attribute was being used, but after I created a custom TypeConver...
You need to provide an implicit conversion operator from int to Unit, like so: public struct Unit { // the conversion operator... public static implicit operator Unit(int value) { return new Unit(value); } // the boring stuff... private readonly int value; public int Value { get { return value; } } public Unit(int valu...
C# : How does this work : Unit myUnit = 5; I just noticed that you can do this in C#: Unit myUnit = 5; instead of having to do this: Unit myUnit = new Unit(5); Does anyone know how I can achieve this with my own structs? I had a look at the Unit struct with reflector and noticed the TypeConverter attribute was being us...
TITLE: C# : How does this work : Unit myUnit = 5; QUESTION: I just noticed that you can do this in C#: Unit myUnit = 5; instead of having to do this: Unit myUnit = new Unit(5); Does anyone know how I can achieve this with my own structs? I had a look at the Unit struct with reflector and noticed the TypeConverter attr...
[ "c#", "struct", "typeconverter" ]
14
31
1,516
2
0
2008-10-14T11:58:49.340000
2008-10-14T12:06:10.090000
200,863
200,934
JQuery: Visual studio, error CS1056: Unexpected character '$'
Trying to include ThickBox (from http://jquery.com/demo/thickbox/ ) in an ASP.NET application. Visual Studio is failing when I try to run the application with the error: js\ThickBox\jquery-1.2.6.min.js(11): error CS1056: Unexpected character '$' Using Visual Studio 2008 and jquery 1.2.6
Maybe is because of the conflict between jQuery $ and the one defined by the asp.net script library. You can call jQuery.noConflict() then use jQuery instead of $. For example instead of $("#test") you will call jQuery("#test"). See http://docs.jquery.com/Core/jQuery.noConflict for more info.
JQuery: Visual studio, error CS1056: Unexpected character '$' Trying to include ThickBox (from http://jquery.com/demo/thickbox/ ) in an ASP.NET application. Visual Studio is failing when I try to run the application with the error: js\ThickBox\jquery-1.2.6.min.js(11): error CS1056: Unexpected character '$' Using Visual...
TITLE: JQuery: Visual studio, error CS1056: Unexpected character '$' QUESTION: Trying to include ThickBox (from http://jquery.com/demo/thickbox/ ) in an ASP.NET application. Visual Studio is failing when I try to run the application with the error: js\ThickBox\jquery-1.2.6.min.js(11): error CS1056: Unexpected characte...
[ "asp.net", "jquery", "visual-studio-2008" ]
7
4
15,417
4
0
2008-10-14T12:00:21.053000
2008-10-14T12:25:13.080000
200,869
203,226
How to invoke .net page methods from javascript without jquery?
I've been trying to call Page Methods from my own JavaScript code but it doesn't work. If I use jQuery AJAX I can sucessfully call the Page Methods, but I need to do this from my own JavaScript code because we can't use third-party libraries (we are building our own library). Whenever I use jQuery AJAX methods I get th...
You're requesting the URL with a GET, while the jQuery code uses a POST. I expect that a Page Method can only be called through a POST, to allow you to include any parameters in the body of your request. You may also need to set the Content-Type of your request to application/json, as the jQuery code does - I don't kno...
How to invoke .net page methods from javascript without jquery? I've been trying to call Page Methods from my own JavaScript code but it doesn't work. If I use jQuery AJAX I can sucessfully call the Page Methods, but I need to do this from my own JavaScript code because we can't use third-party libraries (we are buildi...
TITLE: How to invoke .net page methods from javascript without jquery? QUESTION: I've been trying to call Page Methods from my own JavaScript code but it doesn't work. If I use jQuery AJAX I can sucessfully call the Page Methods, but I need to do this from my own JavaScript code because we can't use third-party librar...
[ "jquery", ".net", "ajax" ]
2
2
9,376
3
0
2008-10-14T12:02:56.573000
2008-10-14T23:35:32.587000
200,878
200,946
Problem parsing an XLS file with C#
Ok, let's see if I can make this make sense. I have a program written that parses an Excel file and it works just fine. I use the following to get into the file: string FileToConvert = Server.MapPath(".") + "\\App_Data\\CP-ARFJN-FLAG.XLS"; string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + File...
It sounds like the XLS file generated by your third-party app may not really be in Excel format - it might actually be a tab-delimited text file with an.xls extension. Try opening it with a text editor and see. If it is tab delimited, you can ditch the OleDB adapter and open/parse it as a standard text file.
Problem parsing an XLS file with C# Ok, let's see if I can make this make sense. I have a program written that parses an Excel file and it works just fine. I use the following to get into the file: string FileToConvert = Server.MapPath(".") + "\\App_Data\\CP-ARFJN-FLAG.XLS"; string connectionString = "Provider=Microsof...
TITLE: Problem parsing an XLS file with C# QUESTION: Ok, let's see if I can make this make sense. I have a program written that parses an Excel file and it works just fine. I use the following to get into the file: string FileToConvert = Server.MapPath(".") + "\\App_Data\\CP-ARFJN-FLAG.XLS"; string connectionString = ...
[ "c#", "excel" ]
3
9
5,766
4
0
2008-10-14T12:04:59.330000
2008-10-14T12:31:14.753000
200,887
200,898
object editing and isDirty() flag
I'm working on a system were a user can edit existing objects ("Filter" domain objects to be exact) through a GUI. As a UI hint, we only want to enable the save button if the user really modified something to the object. I was wondering if anyone had any experience with this problem and what the best way would be to ap...
Correct! Additionally,you can expose two methods: BeginEdit - In this method, your mark your IsDirty Flag to True. Meaning you are doing modification. Call this method when you are about to make modifications CancelEdit - In this method, reset the IsDirty Flag to False. Meaning you have arborted the edit process and re...
object editing and isDirty() flag I'm working on a system were a user can edit existing objects ("Filter" domain objects to be exact) through a GUI. As a UI hint, we only want to enable the save button if the user really modified something to the object. I was wondering if anyone had any experience with this problem an...
TITLE: object editing and isDirty() flag QUESTION: I'm working on a system were a user can edit existing objects ("Filter" domain objects to be exact) through a GUI. As a UI hint, we only want to enable the save button if the user really modified something to the object. I was wondering if anyone had any experience wi...
[ "user-interface", "dns", "flags" ]
7
3
5,188
7
0
2008-10-14T12:07:11.040000
2008-10-14T12:12:32.573000
200,890
200,958
ASP.NET: Popup browser windows and session cookies
SUMMARY: When browsing an ASP.NET website using Windows Explorer, popup windows do not "borrow" the session cookie from the parent window. DETAILS: I'm working on an ASP.NET website (.NET 2.0). I use FormsAuthentication. It is a requirement to use cookies to handle the session. On a page I have a button. When the user ...
My suspicion here is that when opened from Windows Explorer (not that I fully understand what you mean by this), the session cookie that is being sent back is not stored anywhere and thus not available for the pop up window to include with its request. I don't see how you can get around this. Is it not possible to tell...
ASP.NET: Popup browser windows and session cookies SUMMARY: When browsing an ASP.NET website using Windows Explorer, popup windows do not "borrow" the session cookie from the parent window. DETAILS: I'm working on an ASP.NET website (.NET 2.0). I use FormsAuthentication. It is a requirement to use cookies to handle the...
TITLE: ASP.NET: Popup browser windows and session cookies QUESTION: SUMMARY: When browsing an ASP.NET website using Windows Explorer, popup windows do not "borrow" the session cookie from the parent window. DETAILS: I'm working on an ASP.NET website (.NET 2.0). I use FormsAuthentication. It is a requirement to use coo...
[ "asp.net", ".net", "session", "cookies", "popup" ]
1
0
4,416
2
0
2008-10-14T12:09:46.200000
2008-10-14T12:33:30.753000
200,900
200,991
Retrieving values in reflected types from reflected properties
I need to access some members marked internal that are declared in a third party assembly. I would like to return a value from a particular internal property in a class. Then I'd like to retrieve a value from a property on that returned value. However, these properties return types that are also internal and declared i...
You just keep digging on the returned value (or the PropertyType of the PropertyInfo): u sing System; using System.Reflection; public class Foo { public Foo() {Bar = new Bar { Name = "abc"};} internal Bar Bar {get;set;} } public class Bar { internal string Name {get;set;} } static class Program { static void Main() { o...
Retrieving values in reflected types from reflected properties I need to access some members marked internal that are declared in a third party assembly. I would like to return a value from a particular internal property in a class. Then I'd like to retrieve a value from a property on that returned value. However, thes...
TITLE: Retrieving values in reflected types from reflected properties QUESTION: I need to access some members marked internal that are declared in a third party assembly. I would like to return a value from a particular internal property in a class. Then I'd like to retrieve a value from a property on that returned va...
[ ".net", "reflection", "access-modifiers" ]
2
3
220
2
0
2008-10-14T12:12:58.767000
2008-10-14T12:41:53.607000
200,901
1,727,646
When can I delete a file after using it in Response.WriteFile()?
Is the WriteFile call properly synchronous, and can I delete the file written immediately after the call?
It is fully synchronous, as you can see by looking at the implementation of HttpResponse.WriteFile with Lutz Reflector. You can delete the file immediately after the call to Response.WriteFile. You don't have the guarantee that the response stream has been completely transmitted to the client, but calling Response.Flus...
When can I delete a file after using it in Response.WriteFile()? Is the WriteFile call properly synchronous, and can I delete the file written immediately after the call?
TITLE: When can I delete a file after using it in Response.WriteFile()? QUESTION: Is the WriteFile call properly synchronous, and can I delete the file written immediately after the call? ANSWER: It is fully synchronous, as you can see by looking at the implementation of HttpResponse.WriteFile with Lutz Reflector. Yo...
[ "asp.net" ]
9
4
6,964
5
0
2008-10-14T12:13:04.057000
2009-11-13T07:13:10.267000
200,912
646,167
What is the difference between: image/x-citrix-pjpeg and image/pjpeg
Some files are uploaded with a reported MIME type: image/x-citrix-pjpeg They are valid jpeg files and I accept them as such. I was wondering however: why is the MIME type different? Is there any difference in the format? or was this mimetype invented by some light bulb at citrix for no apparent reason?
Update: Ok, I did some more searching and testing on this question, and it turns out they're all lying about MIME-type (never trust any info send by the client, I know). I've checked a bunch of files with different encodings (created with libjpeg) Official MIME type for jpeg files: image/jpeg But some applications (mos...
What is the difference between: image/x-citrix-pjpeg and image/pjpeg Some files are uploaded with a reported MIME type: image/x-citrix-pjpeg They are valid jpeg files and I accept them as such. I was wondering however: why is the MIME type different? Is there any difference in the format? or was this mimetype invented ...
TITLE: What is the difference between: image/x-citrix-pjpeg and image/pjpeg QUESTION: Some files are uploaded with a reported MIME type: image/x-citrix-pjpeg They are valid jpeg files and I accept them as such. I was wondering however: why is the MIME type different? Is there any difference in the format? or was this ...
[ "jpeg", "mime-types", "citrix" ]
12
13
7,533
6
0
2008-10-14T12:16:49.477000
2009-03-14T16:15:45.547000
200,918
200,952
How do you control architecture in an agile project?
How do you ensure that the project will be build with "good" design decisions enabling a flexible software architecture? How do you balance between completely leaving the architecture to the teams on one side, and let all architecture control to a few individuals on the other side? Do you have an "architecture group", ...
A prerequisite for Agile approaches is an architecture you already know how to use. If the architecture is not well-defined and completely understood, you can't really take an Agile approach. You need to have some technical spikes that show how the architecture works, and how the various pieces will fit together. You c...
How do you control architecture in an agile project? How do you ensure that the project will be build with "good" design decisions enabling a flexible software architecture? How do you balance between completely leaving the architecture to the teams on one side, and let all architecture control to a few individuals on ...
TITLE: How do you control architecture in an agile project? QUESTION: How do you ensure that the project will be build with "good" design decisions enabling a flexible software architecture? How do you balance between completely leaving the architecture to the teams on one side, and let all architecture control to a f...
[ "architecture", "agile" ]
7
5
391
6
0
2008-10-14T12:18:34.013000
2008-10-14T12:32:15.810000
200,920
201,612
Embedding Intellisense Xml Documentation in Assembly?
I have an assembly containing very thorough XML-based documentation, which is used through Sandcastle to generate the help-files for the product. We also use the output XML files for providing proper Intellisense in Visual Studio when programmers use the assembly obviously. In order to do this, it seems we have do both...
Unfortunately you will need to supply both as Visual Studio only knows to look at XML documents for Intellisense.
Embedding Intellisense Xml Documentation in Assembly? I have an assembly containing very thorough XML-based documentation, which is used through Sandcastle to generate the help-files for the product. We also use the output XML files for providing proper Intellisense in Visual Studio when programmers use the assembly ob...
TITLE: Embedding Intellisense Xml Documentation in Assembly? QUESTION: I have an assembly containing very thorough XML-based documentation, which is used through Sandcastle to generate the help-files for the product. We also use the output XML files for providing proper Intellisense in Visual Studio when programmers u...
[ "xml", "visual-studio", "documentation", "assemblies", "intellisense" ]
25
13
7,032
3
0
2008-10-14T12:20:50.280000
2008-10-14T15:17:27.693000
200,924
200,978
In C#, I have a IntPtr to a WIN32 WndProc. What is the syntax for calling it?
I'm subclassing a native window (the edit control of a combobox...) oldWndProc = SetWindowLong(HandleOfCbEditControl, GWL_WNDPROC, newWndProc); In my subclassing wndproc, I'll have code like this, right, but I can't figure out the syntax for calling the oldWndProc. int MyWndProc(int Msg, int wParam, int lParam) { if (M...
You'll call CallWindowProc by P/Invoke. Just define the parameters as int variables (as it looks like that's how you defined them in the SetWindowLong call), so something like this: [DllImport("CallWindowProc"...] public static extern int CallWindowProc(int previousProc, int nativeControlHandle, int msg, int lParam, in...
In C#, I have a IntPtr to a WIN32 WndProc. What is the syntax for calling it? I'm subclassing a native window (the edit control of a combobox...) oldWndProc = SetWindowLong(HandleOfCbEditControl, GWL_WNDPROC, newWndProc); In my subclassing wndproc, I'll have code like this, right, but I can't figure out the syntax for ...
TITLE: In C#, I have a IntPtr to a WIN32 WndProc. What is the syntax for calling it? QUESTION: I'm subclassing a native window (the edit control of a combobox...) oldWndProc = SetWindowLong(HandleOfCbEditControl, GWL_WNDPROC, newWndProc); In my subclassing wndproc, I'll have code like this, right, but I can't figure o...
[ "c#", ".net", "winapi" ]
2
2
4,495
3
0
2008-10-14T12:22:38.093000
2008-10-14T12:39:02.973000
200,932
211,820
How do I make vim indent java annotations correctly?
When indenting java code with annotations, vim insists on indenting like this: @Test public void... I want the annotation to be in the same column as the method definition but I can't seem to find a way to tell vim to do that, except maybe using an indent expression but I'm not sure if I can use that together with regu...
Edit: I cannot delete my own answer because it has already been accepted, but @pydave's answer seems to be the better (more robust) solution. You should probably be using the indentation file for the java FileType (instead of using cindent) by setting filetype plugin indent on. That said, the indentation file coming wi...
How do I make vim indent java annotations correctly? When indenting java code with annotations, vim insists on indenting like this: @Test public void... I want the annotation to be in the same column as the method definition but I can't seem to find a way to tell vim to do that, except maybe using an indent expression ...
TITLE: How do I make vim indent java annotations correctly? QUESTION: When indenting java code with annotations, vim insists on indenting like this: @Test public void... I want the annotation to be in the same column as the method definition but I can't seem to find a way to tell vim to do that, except maybe using an ...
[ "java", "vim", "annotations" ]
23
10
4,906
3
0
2008-10-14T12:24:41.630000
2008-10-17T11:38:52.640000
200,945
201,079
Why is ASP.NET failing due to permissions on GAC?
I'm trying to run an ASP.NET 2.0 application on an XP machine. As far as I know, everything is configured correctly. However, I receive the following message: Server Application Unavailable And two events appear in the Application event log each time: aspnet_wp.exe (PID: 3352) stopped unexpectedly. Failed to execute th...
You might also find Process Monitor useful for troubleshooting these types of problems. If you set-up a filter to show all activity containing aspnet_wp.exe, it should show you which files it's attempting to access, allowing you to update the permissions accordingly.
Why is ASP.NET failing due to permissions on GAC? I'm trying to run an ASP.NET 2.0 application on an XP machine. As far as I know, everything is configured correctly. However, I receive the following message: Server Application Unavailable And two events appear in the Application event log each time: aspnet_wp.exe (PID...
TITLE: Why is ASP.NET failing due to permissions on GAC? QUESTION: I'm trying to run an ASP.NET 2.0 application on an XP machine. As far as I know, everything is configured correctly. However, I receive the following message: Server Application Unavailable And two events appear in the Application event log each time: ...
[ "asp.net", "gac" ]
7
2
7,202
5
0
2008-10-14T12:30:22.727000
2008-10-14T13:07:32.183000
200,954
201,064
Solution: Per application, or per application suite
Often multiple applications share a large codebase of libraries that change often in development. In these cases, I prefer to create a solution named after the suite, and include separate projects for each application and the shared libraries. Is this a good approach? How do others structure their code bases for things...
It really depends on your organization's particular needs. MSDN has a good page that goes through the various recommended solution layouts, including: The Single Solution model (preferred) The Partitioned Single Solution model The Multi-solution model (Only if strictly necessary) The MSDN page also discusses the pros a...
Solution: Per application, or per application suite Often multiple applications share a large codebase of libraries that change often in development. In these cases, I prefer to create a solution named after the suite, and include separate projects for each application and the shared libraries. Is this a good approach?...
TITLE: Solution: Per application, or per application suite QUESTION: Often multiple applications share a large codebase of libraries that change often in development. In these cases, I prefer to create a solution named after the suite, and include separate projects for each application and the shared libraries. Is thi...
[ "visual-studio", "architecture" ]
21
27
31,534
2
0
2008-10-14T12:32:54.983000
2008-10-14T13:01:43.490000
200,960
201,091
Find all storage devices attached to a Linux machine
I have a need to find all of the writable storage devices attached to a given machine, whether or not they are mounted. The dopey way to do this would be to try every entry in /dev that corresponds to a writable devices ( hd* and sd* )...... Is there a better solution, or should I stick with this one?
/proc/partitions will list all the block devices and partitions that the system recognizes. You can then try using file -s to determine what kind of filesystem is present on the partition, if any.
Find all storage devices attached to a Linux machine I have a need to find all of the writable storage devices attached to a given machine, whether or not they are mounted. The dopey way to do this would be to try every entry in /dev that corresponds to a writable devices ( hd* and sd* )...... Is there a better solutio...
TITLE: Find all storage devices attached to a Linux machine QUESTION: I have a need to find all of the writable storage devices attached to a given machine, whether or not they are mounted. The dopey way to do this would be to try every entry in /dev that corresponds to a writable devices ( hd* and sd* )...... Is ther...
[ "linux", "bash", "shell" ]
113
81
470,703
7
0
2008-10-14T12:33:40.440000
2008-10-14T13:11:17.010000
200,966
200,974
What is more readable?
I have these two pieces of code, wich one is more readable? foreach decimal technicalPremium = 0; foreach (Risk risk in risks) { technicalPremium = technicalPremium + risk.TechnicalPremium; } return technicalPremium; linq return risks.Sum(risk => risk.TechnicalPremium);
If the team that works on the code knows what the Linq version does and knows its inner workings, then it is more readable.
What is more readable? I have these two pieces of code, wich one is more readable? foreach decimal technicalPremium = 0; foreach (Risk risk in risks) { technicalPremium = technicalPremium + risk.TechnicalPremium; } return technicalPremium; linq return risks.Sum(risk => risk.TechnicalPremium);
TITLE: What is more readable? QUESTION: I have these two pieces of code, wich one is more readable? foreach decimal technicalPremium = 0; foreach (Risk risk in risks) { technicalPremium = technicalPremium + risk.TechnicalPremium; } return technicalPremium; linq return risks.Sum(risk => risk.TechnicalPremium); ANSWER:...
[ "c#", "linq", "lambda", "readability" ]
6
16
1,114
21
0
2008-10-14T12:35:40.717000
2008-10-14T12:38:16.640000
200,976
203,762
What does InstallShield 2008 use for working with databases?
I am using Installshield 2008 Developer Edition and need to run SQL scripts against an existing SQL Server 2005 Express. When I do this without InstallShield, I would have to have some ODBC drivers installed for example. How does InstallShield do this? Does it include some sort of driver? Or does it depend on preexisti...
If you are having the database installed by Installshield as part of your installation, Installshield has all the information to simply use a connection string like this: "Driver={SQL Native Client};Server=localhost;Database=newdatabase;Uid=proguser;Pwd=progpass;" There is no need to create an ODBC connection to use a ...
What does InstallShield 2008 use for working with databases? I am using Installshield 2008 Developer Edition and need to run SQL scripts against an existing SQL Server 2005 Express. When I do this without InstallShield, I would have to have some ODBC drivers installed for example. How does InstallShield do this? Does i...
TITLE: What does InstallShield 2008 use for working with databases? QUESTION: I am using Installshield 2008 Developer Edition and need to run SQL scripts against an existing SQL Server 2005 Express. When I do this without InstallShield, I would have to have some ODBC drivers installed for example. How does InstallShie...
[ "sql", "installshield" ]
1
2
1,283
2
0
2008-10-14T12:38:36.127000
2008-10-15T04:57:40.143000
201,004
201,061
Why can't I connect to a WCF service with net.tcp but i can with http?
I have a WCF service running on the IIS with a ServiceHostFactory. It's running fine with the WSHttpBinding but because of the speed and everything being on the same network (no firewalls) i want to speed up things a bit using the NetTcpBinding instead. When i try to do that i get this error: Could not connect to net.t...
Check out this post on enabling non-HTTP bindings in IIS 7.0. By default, you have to explicitly enable net.tcp in IIS 7.0. Hope this helps. UPDATE: Saw your comment - unfortunately, net.tcp is not supported in IIS 6.0. Check out this link which details the supported WCF bindings for various hosts (including self-hosti...
Why can't I connect to a WCF service with net.tcp but i can with http? I have a WCF service running on the IIS with a ServiceHostFactory. It's running fine with the WSHttpBinding but because of the speed and everything being on the same network (no firewalls) i want to speed up things a bit using the NetTcpBinding inst...
TITLE: Why can't I connect to a WCF service with net.tcp but i can with http? QUESTION: I have a WCF service running on the IIS with a ServiceHostFactory. It's running fine with the WSHttpBinding but because of the speed and everything being on the same network (no firewalls) i want to speed up things a bit using the ...
[ "wcf", "tcp", "iis-6" ]
21
14
73,298
7
0
2008-10-14T12:47:06.607000
2008-10-14T13:01:07.203000
201,022
201,035
which scope should a DAO typically have
its out of question that a dao will not hold any state. however, for easiest access to the class, is it better to use prototype( = new every time) or singleton? simple object creation is cheap for dao's.. it typically only holds a sessionfactory, accessing the object from a list of singletons may be equally expensive. ...
If your question is about architecture, I'd go with scoping DAOs to the Unit of Work or Transaction you are doing. This reduces the potential for cross-transaction pollution and threading-issues. If your question is about performance, then the answer lies within a profiler, which gives you accurate numbers for your par...
which scope should a DAO typically have its out of question that a dao will not hold any state. however, for easiest access to the class, is it better to use prototype( = new every time) or singleton? simple object creation is cheap for dao's.. it typically only holds a sessionfactory, accessing the object from a list ...
TITLE: which scope should a DAO typically have QUESTION: its out of question that a dao will not hold any state. however, for easiest access to the class, is it better to use prototype( = new every time) or singleton? simple object creation is cheap for dao's.. it typically only holds a sessionfactory, accessing the o...
[ "prototype", "dependency-injection", "singleton", "dao" ]
1
3
2,692
3
0
2008-10-14T12:50:59.080000
2008-10-14T12:54:23.973000
201,023
203,343
Hibernate Union alternatives
What alternatives do I have to implement a union query using hibernate? I know hibernate does not support union queries at the moment, right now the only way I see to make a union is to use a view table. The other option is to use plain jdbc, but this way I would loose all my example/criteria queries goodies, as well a...
Use VIEW. The same classes can be mapped to different tables/views using entity name, so you won't even have much of a duplication. Being there, done that, works OK. Plain JDBC has another hidden problem: it's unaware of Hibernate session cache, so if something got cached till the end of the transaction and not flushed...
Hibernate Union alternatives What alternatives do I have to implement a union query using hibernate? I know hibernate does not support union queries at the moment, right now the only way I see to make a union is to use a view table. The other option is to use plain jdbc, but this way I would loose all my example/criter...
TITLE: Hibernate Union alternatives QUESTION: What alternatives do I have to implement a union query using hibernate? I know hibernate does not support union queries at the moment, right now the only way I see to make a union is to use a view table. The other option is to use plain jdbc, but this way I would loose all...
[ "java", "sql", "hibernate", "union" ]
66
35
153,384
10
0
2008-10-14T12:51:21.810000
2008-10-15T00:37:08.063000
201,033
201,081
Entity Perspectives
Context: So, I am attempting to build a ridiculously complex domain model. Talking with the users, there are multiple ways the system will be used (For example: one way is from the perspective of the employee; another way is from the perspective of the employer). In actuality, they are multiple applications reusing the...
No, this is absolutely appropriate. Evan's calls these 'perspectives' Bounded Contexts in his book. Instead of having a really complex domain model, try building a simple one that addresses the domain in a specific way really well. Bounded Contexts can be linked together to form a web of smaller, simpler, direct domain...
Entity Perspectives Context: So, I am attempting to build a ridiculously complex domain model. Talking with the users, there are multiple ways the system will be used (For example: one way is from the perspective of the employee; another way is from the perspective of the employer). In actuality, they are multiple appl...
TITLE: Entity Perspectives QUESTION: Context: So, I am attempting to build a ridiculously complex domain model. Talking with the users, there are multiple ways the system will be used (For example: one way is from the perspective of the employee; another way is from the perspective of the employer). In actuality, they...
[ "dns", "domain-driven-design", "entity" ]
4
4
172
2
0
2008-10-14T12:53:30.370000
2008-10-14T13:08:22.807000
201,038
201,047
When to use a build tool?
A beginner question, bear with me: I'm just wondering under what circumstances one should use a build tool like nant or msbuild? I'm working on a medium sized application (.net 3.0), every developer is doing his work and builds on his machine checking his code changes into the repository as he goes. Once we're all done...
The short answer is always. Each developer should be building using the build script before checking code in. The people building the release should be using the build script to build the release. Your buildbots should be using the build script to build and test the code that's been checked in. Doing this allows all th...
When to use a build tool? A beginner question, bear with me: I'm just wondering under what circumstances one should use a build tool like nant or msbuild? I'm working on a medium sized application (.net 3.0), every developer is doing his work and builds on his machine checking his code changes into the repository as he...
TITLE: When to use a build tool? QUESTION: A beginner question, bear with me: I'm just wondering under what circumstances one should use a build tool like nant or msbuild? I'm working on a medium sized application (.net 3.0), every developer is doing his work and builds on his machine checking his code changes into th...
[ "build-process", "development-process" ]
8
15
2,307
8
0
2008-10-14T12:55:24.970000
2008-10-14T12:58:16.883000
201,066
201,113
How to sync access to file between ASP.NET web site and ASP.NET web service on one web server
I have deployed ASP.NET web site and ASP.NET web service on the same web server. Both of them require access to shared file. How to implement/share lock that supports single writers and multiple readers? If somebody reads, nobody can write, but all still can read. If somebody writes, nobody can read/write.
to open file for writing with allowing other threads to read it use System.IO.File.Open method with System.IO.FileShare.Read. Ie.: System.IO.File.Open("path.txt",System.IO.FileMode.OpenOrCreate,System.IO.FileAccess.ReadWrite,System.IO.FileShare.Read) Other (reading) threads should use System.IO.FileAccess.Read Signatur...
How to sync access to file between ASP.NET web site and ASP.NET web service on one web server I have deployed ASP.NET web site and ASP.NET web service on the same web server. Both of them require access to shared file. How to implement/share lock that supports single writers and multiple readers? If somebody reads, nob...
TITLE: How to sync access to file between ASP.NET web site and ASP.NET web service on one web server QUESTION: I have deployed ASP.NET web site and ASP.NET web service on the same web server. Both of them require access to shared file. How to implement/share lock that supports single writers and multiple readers? If s...
[ "asp.net", "web-services", "multithreading" ]
1
2
1,515
3
0
2008-10-14T13:02:22.613000
2008-10-14T13:17:14.723000
201,078
202,444
Unit testing for safe publication
How would you unittest a safe-publication guarantee in Java? To be concrete: I have a Cache interface that has a method getOrLoad(K key, ObjectLoader loader). Thing is, if a Cache cannot find an object for the given key, then it must load it from the ObjectLoader instance. However, the Cache is required to guarantee th...
I discovered a JavaOne presentation by Bill Pugh, Brian Goetz and Cliff Click on the subject of testing concurrent code. They suggested this approach, witch I think is the best I've heard: A number of producers create stateful and thread-unsafe objects with a state-dependant hashCode implementation. As the objects are ...
Unit testing for safe publication How would you unittest a safe-publication guarantee in Java? To be concrete: I have a Cache interface that has a method getOrLoad(K key, ObjectLoader loader). Thing is, if a Cache cannot find an object for the given key, then it must load it from the ObjectLoader instance. However, the...
TITLE: Unit testing for safe publication QUESTION: How would you unittest a safe-publication guarantee in Java? To be concrete: I have a Cache interface that has a method getOrLoad(K key, ObjectLoader loader). Thing is, if a Cache cannot find an object for the given key, then it must load it from the ObjectLoader inst...
[ "java", "unit-testing", "concurrency", "junit" ]
4
1
330
3
0
2008-10-14T13:07:17.597000
2008-10-14T19:13:26.313000
201,101
201,116
How to initialize all members of an array to the same value?
I have a large array in C (not C++ if that makes a difference). I want to initialize all members of the same value. I could swear I once knew a simple way to do this. I could use memset() in my case, but isn't there a way to do this that is built right into the C syntax?
Unless that value is 0 (in which case you can omit some part of the initializer and the corresponding elements will be initialized to 0), there's no easy way. Don't overlook the obvious solution, though: int myArray[10] = { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }; Elements with missing values will be initialized to 0: int myArr...
How to initialize all members of an array to the same value? I have a large array in C (not C++ if that makes a difference). I want to initialize all members of the same value. I could swear I once knew a simple way to do this. I could use memset() in my case, but isn't there a way to do this that is built right into t...
TITLE: How to initialize all members of an array to the same value? QUESTION: I have a large array in C (not C++ if that makes a difference). I want to initialize all members of the same value. I could swear I once knew a simple way to do this. I could use memset() in my case, but isn't there a way to do this that is ...
[ "c", "arrays", "initialization", "array-initialize" ]
1,171
1,493
2,256,474
27
0
2008-10-14T13:13:40.783000
2008-10-14T13:17:23.130000
201,132
201,196
What factors should effect the Data Access Layer I use on a new project?
I will be teaching a class sson, and I need to explain what factors should affect your decision of data access technology. I am familiar with many data access methods like Typed Data Sets, Linq to SQL, Linq to Entities,.netTiers, LLBLGen, and custom calls with SQL connection objects and command objects. Some of my clie...
Like with all choice's in a software project: It depends... But in my opinion the most important factor is the environment of the project. This consists of (I don't claim that this list is complete in anyway): Available skills within development team AND maintenance team (if different) Required features Constraints set...
What factors should effect the Data Access Layer I use on a new project? I will be teaching a class sson, and I need to explain what factors should affect your decision of data access technology. I am familiar with many data access methods like Typed Data Sets, Linq to SQL, Linq to Entities,.netTiers, LLBLGen, and cust...
TITLE: What factors should effect the Data Access Layer I use on a new project? QUESTION: I will be teaching a class sson, and I need to explain what factors should affect your decision of data access technology. I am familiar with many data access methods like Typed Data Sets, Linq to SQL, Linq to Entities,.netTiers,...
[ ".net", "asp.net", "data-access-layer" ]
3
2
242
4
0
2008-10-14T13:22:05.757000
2008-10-14T13:44:14.120000
201,141
203,250
How to create a JNIEnv mock in C/C++
I am writing some JNI code in C that I wish to test using cunit. In order to call the JNI functions, I need to create a valid JNIEnv struct. Does anyone know if there is a mocking framework for such a purpose, or who can give me some pointers on how to create a mock JNIEnv struct myself?
jni.h contains the complete structure for JNIEnv_, including the "jump table" JNINativeInterface_. You could create your own JNINativeInterface_ (pointing to mock implementations) and instantiate a JNIEnv_ from it. Edit in response to comments: (I didn't look at the other SO question you referenced) #include "jni.h" #i...
How to create a JNIEnv mock in C/C++ I am writing some JNI code in C that I wish to test using cunit. In order to call the JNI functions, I need to create a valid JNIEnv struct. Does anyone know if there is a mocking framework for such a purpose, or who can give me some pointers on how to create a mock JNIEnv struct my...
TITLE: How to create a JNIEnv mock in C/C++ QUESTION: I am writing some JNI code in C that I wish to test using cunit. In order to call the JNI functions, I need to create a valid JNIEnv struct. Does anyone know if there is a mocking framework for such a purpose, or who can give me some pointers on how to create a moc...
[ "c++", "c", "mocking", "java-native-interface", "cunit" ]
4
3
3,424
3
0
2008-10-14T13:27:02.300000
2008-10-14T23:49:14.540000
201,146
201,173
Efficient traversal of a changelist
I have a list of changes to a list - Adds and Deletes. The list could be huge - say 10'000 items. I want to know the state of the list after change 9'000. I could walk the list from the start all the way to change 9'000. That seems a bit long-winded to me. I could keep a list of items and record when they're added and ...
If you cache the state of the list every Xth change, then you can do a binary chop to get down to two cached states bounding the change you're looking for, then you walk at most X items to get to the item itself. That's O(log N), more-or-less. But more generally, reducing big O complexity is the means, not the end. If ...
Efficient traversal of a changelist I have a list of changes to a list - Adds and Deletes. The list could be huge - say 10'000 items. I want to know the state of the list after change 9'000. I could walk the list from the start all the way to change 9'000. That seems a bit long-winded to me. I could keep a list of item...
TITLE: Efficient traversal of a changelist QUESTION: I have a list of changes to a list - Adds and Deletes. The list could be huge - say 10'000 items. I want to know the state of the list after change 9'000. I could walk the list from the start all the way to change 9'000. That seems a bit long-winded to me. I could k...
[ "algorithm", "complexity-theory", "big-o" ]
1
1
144
3
0
2008-10-14T13:28:32.373000
2008-10-14T13:38:05.240000
201,178
201,192
Interface doesn't accept inherited member (OO question)
I feel like a fool, but here goes: public interface IHasErrorController{ ErrorController ErrorController { get; set; } } public class DSErrorController: ErrorController{yadi yadi ya} public class DSWebsiteController: Controller, IHasErrorController{ public DSErrorController ErrorController { get; set; } } This gives ...
C# (at the moment) has very little [co|contra]variance support; as such, the interface implementation must be an exact match, including the return type. To keep your concreate type on the class API, I would implement the interface explicitly - i.e. add: ErrorController IHasErrorControlloer.ErrorController { get {return...
Interface doesn't accept inherited member (OO question) I feel like a fool, but here goes: public interface IHasErrorController{ ErrorController ErrorController { get; set; } } public class DSErrorController: ErrorController{yadi yadi ya} public class DSWebsiteController: Controller, IHasErrorController{ public DSErr...
TITLE: Interface doesn't accept inherited member (OO question) QUESTION: I feel like a fool, but here goes: public interface IHasErrorController{ ErrorController ErrorController { get; set; } } public class DSErrorController: ErrorController{yadi yadi ya} public class DSWebsiteController: Controller, IHasErrorContro...
[ "c#", "oop" ]
2
5
381
2
0
2008-10-14T13:39:00.030000
2008-10-14T13:43:48.490000
201,182
201,197
Debugging with exceptions: How to work around 'Break when thrown'
I'm getting tired of clearing the Debugging->Exceptions option Break when thrown to get past an exception I handle properly, then setting the Break when thrown option to find the source of a subsequent exception not handled properly. I would like a way to exclude certain try blocks from Break when thrown, with somethin...
Push Alt-Ctrl-e to bring up the exceptions window. Specify which exceptions you wish to ignore.
Debugging with exceptions: How to work around 'Break when thrown' I'm getting tired of clearing the Debugging->Exceptions option Break when thrown to get past an exception I handle properly, then setting the Break when thrown option to find the source of a subsequent exception not handled properly. I would like a way t...
TITLE: Debugging with exceptions: How to work around 'Break when thrown' QUESTION: I'm getting tired of clearing the Debugging->Exceptions option Break when thrown to get past an exception I handle properly, then setting the Break when thrown option to find the source of a subsequent exception not handled properly. I ...
[ "visual-studio", "debugging", "exception" ]
5
5
421
1
0
2008-10-14T13:40:40.570000
2008-10-14T13:44:29.580000
201,183
201,471
How can I determine equality for two JavaScript objects?
A strict equality operator will tell you if two object types are equal. However, is there a way to tell if two objects are equal, much like the hash code value in Java? Stack Overflow question Is there any kind of hashCode function in JavaScript? is similar to this question, but requires a more academic answer. The sce...
The short answer The simple answer is: No, there is no generic means to determine that an object is equal to another in the sense you mean. The exception is when you are strictly thinking of an object being typeless. The long answer The concept is that of an Equals method that compares two different instances of an obj...
How can I determine equality for two JavaScript objects? A strict equality operator will tell you if two object types are equal. However, is there a way to tell if two objects are equal, much like the hash code value in Java? Stack Overflow question Is there any kind of hashCode function in JavaScript? is similar to th...
TITLE: How can I determine equality for two JavaScript objects? QUESTION: A strict equality operator will tell you if two object types are equal. However, is there a way to tell if two objects are equal, much like the hash code value in Java? Stack Overflow question Is there any kind of hashCode function in JavaScript...
[ "javascript", "object", "equals", "hashcode" ]
990
226
906,161
77
0
2008-10-14T13:41:07.357000
2008-10-14T14:48:47.440000
201,185
201,239
Automatically enforcing a max database table size by dropping old rows
I have an Oracle table which contains event log messages for an application. We don't want this table to grow out of control and eat up too much space, so we'd like to set a cap on the number of rows that it can contain to some big number like one million. So we'd like to tell Oracle that when the table grows too large...
Depending on your definition of simpler... My bias would be to schedule a job that runs periodically (say, nightly) in order to delete the oldest rows. If you expect that you could generate a million event logs in a single day, you may want the job to run more frequently, but nightly is generally sufficient for most pe...
Automatically enforcing a max database table size by dropping old rows I have an Oracle table which contains event log messages for an application. We don't want this table to grow out of control and eat up too much space, so we'd like to set a cap on the number of rows that it can contain to some big number like one m...
TITLE: Automatically enforcing a max database table size by dropping old rows QUESTION: I have an Oracle table which contains event log messages for an application. We don't want this table to grow out of control and eat up too much space, so we'd like to set a cap on the number of rows that it can contain to some big...
[ "oracle" ]
2
4
1,134
4
0
2008-10-14T13:41:41.037000
2008-10-14T13:52:24.230000
201,191
201,242
How to get a calculated column back in Linq To SQL
We are using Linq To SQL with our own data context logic that executes the one linq query across multiple databases. When we get the results back, we need the database for each of the rows. So... I want to have a property on my class that will return the database name (SQL Server, so DB_NAME()). How can I do this in Li...
LINQ to SQL allows you to map views and UDFs to objects. Make a UDF view which executes DB_NAME() and returns it as a column, map it using the designer, and you should be good to go.
How to get a calculated column back in Linq To SQL We are using Linq To SQL with our own data context logic that executes the one linq query across multiple databases. When we get the results back, we need the database for each of the rows. So... I want to have a property on my class that will return the database name ...
TITLE: How to get a calculated column back in Linq To SQL QUESTION: We are using Linq To SQL with our own data context logic that executes the one linq query across multiple databases. When we get the results back, we need the database for each of the rows. So... I want to have a property on my class that will return ...
[ "linq-to-sql" ]
2
1
1,478
2
0
2008-10-14T13:43:26.090000
2008-10-14T13:52:59.843000
201,198
206,934
Guide to New Vista Features
I'm an MFC programmer. I just had my first taste of Vista (on a VPC... Yup, I'm late). I should be evaluating things in depth in the coming days. On taking a casual look, I noticed two major changes: The shell is new User Access Control Event Viewer has changed (would like more info on this) What other new features sho...
Perhaps wikipedia's Features new to Windows Vista and possibly Features removed from Windows Vista will be of use to you.
Guide to New Vista Features I'm an MFC programmer. I just had my first taste of Vista (on a VPC... Yup, I'm late). I should be evaluating things in depth in the coming days. On taking a casual look, I noticed two major changes: The shell is new User Access Control Event Viewer has changed (would like more info on this)...
TITLE: Guide to New Vista Features QUESTION: I'm an MFC programmer. I just had my first taste of Vista (on a VPC... Yup, I'm late). I should be evaluating things in depth in the coming days. On taking a casual look, I noticed two major changes: The shell is new User Access Control Event Viewer has changed (would like ...
[ "mfc", "documentation", "windows-vista" ]
4
2
416
9
0
2008-10-14T13:44:54.400000
2008-10-15T23:48:58.627000
201,199
201,234
How can I share a folder of content between multiple ASP.Net projects in studio?
I would like to share 2 folders of content ('stylesheets' and 'graphics') between multiple asp.net projects in a solution. Is there a way to do this and have studio display the graphics and such appropriately at design time?
I looked into this deeply a while back and found no great solution right there in Visual Studio.NET. What I ended up doing was using my source control system to share the folders. I used Subversion Externals to share to multiple working copies, from a single source in Subversion. http://svnbook.red-bean.com/en/1.1/ch07...
How can I share a folder of content between multiple ASP.Net projects in studio? I would like to share 2 folders of content ('stylesheets' and 'graphics') between multiple asp.net projects in a solution. Is there a way to do this and have studio display the graphics and such appropriately at design time?
TITLE: How can I share a folder of content between multiple ASP.Net projects in studio? QUESTION: I would like to share 2 folders of content ('stylesheets' and 'graphics') between multiple asp.net projects in a solution. Is there a way to do this and have studio display the graphics and such appropriately at design ti...
[ "asp.net", "resources", "sharing" ]
4
2
543
2
0
2008-10-14T13:45:02.997000
2008-10-14T13:51:14.530000
201,233
211,722
Winforms - Dynamic Load / Save Settings
I have a "settings file" in my Winforms application called Settings.settings with a partial class for custom methods, etc. Is there a way to load / save dynamic settings based on arbitrary keys? For example, I have some ListViews in my application in which I want to save / load the column widths; Instead of creating a ...
Store your column width settings in an Xml Serializable object. Ie, something that implements IXmlSerializable then create a single setting entry of that type in Settings.settings. A good option would probably be an Xml Serializable Dictionary. A quick google search found quite a few different blog posts that describe ...
Winforms - Dynamic Load / Save Settings I have a "settings file" in my Winforms application called Settings.settings with a partial class for custom methods, etc. Is there a way to load / save dynamic settings based on arbitrary keys? For example, I have some ListViews in my application in which I want to save / load t...
TITLE: Winforms - Dynamic Load / Save Settings QUESTION: I have a "settings file" in my Winforms application called Settings.settings with a partial class for custom methods, etc. Is there a way to load / save dynamic settings based on arbitrary keys? For example, I have some ListViews in my application in which I wan...
[ "c#", "winforms", "dynamic", "settings" ]
1
1
3,305
3
0
2008-10-14T13:50:51.613000
2008-10-17T10:56:54.630000
201,235
207,923
Importing Active Directory Users and Groups into SQL Server (possibly via c#)
I need to import all ad groups in a few OUs into a table in SQL Server 2008. Once I have those I need to import all the members of those groups to a different table. I can use c# to do the work and pass the data to SQL server or do it directly in SQL server. Suggestions on the best way to approach this?
Arry, I don't know exactly, but found some links that may help you. I think the hottest track is this expression: "(&(objectCategory=Person)(memberOf=DN=GroupName, OU=Org, DC=domain, DC=com))" I found it in LDAP Query for group members on a ColdFusion community's site. I'm more or less sure the filter can easily be app...
Importing Active Directory Users and Groups into SQL Server (possibly via c#) I need to import all ad groups in a few OUs into a table in SQL Server 2008. Once I have those I need to import all the members of those groups to a different table. I can use c# to do the work and pass the data to SQL server or do it directl...
TITLE: Importing Active Directory Users and Groups into SQL Server (possibly via c#) QUESTION: I need to import all ad groups in a few OUs into a table in SQL Server 2008. Once I have those I need to import all the members of those groups to a different table. I can use c# to do the work and pass the data to SQL serve...
[ "c#", "sql-server", "active-directory" ]
5
3
29,086
3
0
2008-10-14T13:51:33.263000
2008-10-16T09:27:09.693000
201,245
201,260
Can't find dynamic controls in datagrid on postback
Using.NET 1.1, I have a DataGrid that contains three columns for each row. Row one has a label with some text. Row three will always have two radio buttons and two checkboxes and those are in the HTML side of the page. Row two will have dynamically generated controls (just textboxes for now) and there can be 1 or more ...
Remember: every time a postback occurs you are working with a new instance of your page class. Dynamic controls added to the page during a previous postback went to the garbage collector as soon as the page for that postback rendered to the browser, along with the rest of that page instance. You need to re-create your ...
Can't find dynamic controls in datagrid on postback Using.NET 1.1, I have a DataGrid that contains three columns for each row. Row one has a label with some text. Row three will always have two radio buttons and two checkboxes and those are in the HTML side of the page. Row two will have dynamically generated controls ...
TITLE: Can't find dynamic controls in datagrid on postback QUESTION: Using.NET 1.1, I have a DataGrid that contains three columns for each row. Row one has a label with some text. Row three will always have two radio buttons and two checkboxes and those are in the HTML side of the page. Row two will have dynamically g...
[ "asp.net", "datagrid", "postback" ]
0
3
1,724
2
0
2008-10-14T13:53:32.013000
2008-10-14T13:57:45.357000
201,255
201,266
MarshalAsAttribute Sizeconst .NET
Using C#, does anyone know how to get the MarshalAsAttribute's Sizeconst value in runtime? Eg. I would like to retrieve the value of 10. [StructLayout[LayoutKind.Sequential, Pack=1] Class StructureToMarshalFrom { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public byte[] _value1; }
Yup, with reflection: FieldInfo field = typeof(StructureToMarshalFrom).GetField("_value1"); object[] attributes = field.GetCustomAttributes(typeof(MarshalAsAttribute), false); MarshalAsAttribute marshal = (MarshalAsAttribute) attributes[0]; int sizeConst = marshal.SizeConst; (Untested, and obviously lacking rather a lo...
MarshalAsAttribute Sizeconst .NET Using C#, does anyone know how to get the MarshalAsAttribute's Sizeconst value in runtime? Eg. I would like to retrieve the value of 10. [StructLayout[LayoutKind.Sequential, Pack=1] Class StructureToMarshalFrom { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public byte[] _valu...
TITLE: MarshalAsAttribute Sizeconst .NET QUESTION: Using C#, does anyone know how to get the MarshalAsAttribute's Sizeconst value in runtime? Eg. I would like to retrieve the value of 10. [StructLayout[LayoutKind.Sequential, Pack=1] Class StructureToMarshalFrom { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] p...
[ "c#", ".net", "marshalling" ]
2
5
3,502
2
0
2008-10-14T13:56:41.430000
2008-10-14T13:59:59.083000
201,261
201,925
Making Excel functions affect 'other' cells
Let's say that I create a Sub (not a function) whose mission in life is to take the active cell (i.e. Selection) and set an adjacent cell to some value. This works fine. When you try to convert that Sub to a Function and try to evaluate it from from spreadsheet (i.e. setting it's formula to "=MyFunction()") Excel will ...
It can't be done, which makes sense because: When a worksheet function is called, the cell containing the function is not necessarily the active cell. So you can't find the adjacent cell reliably. When Excel is recalculating a worksheet, it needs to maintain dependencies between cells. So it can't allow worksheet funct...
Making Excel functions affect 'other' cells Let's say that I create a Sub (not a function) whose mission in life is to take the active cell (i.e. Selection) and set an adjacent cell to some value. This works fine. When you try to convert that Sub to a Function and try to evaluate it from from spreadsheet (i.e. setting ...
TITLE: Making Excel functions affect 'other' cells QUESTION: Let's say that I create a Sub (not a function) whose mission in life is to take the active cell (i.e. Selection) and set an adjacent cell to some value. This works fine. When you try to convert that Sub to a Function and try to evaluate it from from spreadsh...
[ "excel", "formula", "vba" ]
4
9
23,791
6
0
2008-10-14T13:58:30.147000
2008-10-14T16:42:33.933000
201,282
202,534
How can I get table names from an MS Access Database?
Microsoft SQL Server and MySQL have an INFORMATION_SCHEMA table that I can query. However it does not exist in an MS Access database. Is there an equivalent I can use?
To build on Ilya's answer try the following query: SELECT MSysObjects.Name AS table_name FROM MSysObjects WHERE (((Left([Name],1))<>"~") AND ((Left([Name],4))<>"MSys") AND ((MSysObjects.Type) In (1,4,6))) order by MSysObjects.Name (this one works without modification with an MDB) ACCDB users may need to do something li...
How can I get table names from an MS Access Database? Microsoft SQL Server and MySQL have an INFORMATION_SCHEMA table that I can query. However it does not exist in an MS Access database. Is there an equivalent I can use?
TITLE: How can I get table names from an MS Access Database? QUESTION: Microsoft SQL Server and MySQL have an INFORMATION_SCHEMA table that I can query. However it does not exist in an MS Access database. Is there an equivalent I can use? ANSWER: To build on Ilya's answer try the following query: SELECT MSysObjects.N...
[ "ms-access" ]
39
61
151,690
8
0
2008-10-14T14:04:08.573000
2008-10-14T19:40:37.583000
201,287
201,313
How do I get which JRadioButton is selected from a ButtonGroup
I have a swing application that includes radio buttons on a form. I have the ButtonGroup, however, looking at the available methods, I can't seem to get the name of the selected JRadioButton. Here's what I can tell so far: From ButtonGroup, I can perform a getSelection() to return the ButtonModel. From there, I can per...
I would just loop through your JRadioButtons and call isSelected(). If you really want to go from the ButtonGroup you can only get to the models. You could match the models to the buttons, but then if you have access to the buttons, why not use them directly?
How do I get which JRadioButton is selected from a ButtonGroup I have a swing application that includes radio buttons on a form. I have the ButtonGroup, however, looking at the available methods, I can't seem to get the name of the selected JRadioButton. Here's what I can tell so far: From ButtonGroup, I can perform a ...
TITLE: How do I get which JRadioButton is selected from a ButtonGroup QUESTION: I have a swing application that includes radio buttons on a form. I have the ButtonGroup, however, looking at the available methods, I can't seem to get the name of the selected JRadioButton. Here's what I can tell so far: From ButtonGroup...
[ "java", "swing" ]
91
47
267,990
14
0
2008-10-14T14:05:47.370000
2008-10-14T14:12:36.560000
201,292
201,318
Limit Database List to Ones With Permission SQL Server
By default if you connect to a remote SQL Server via an account that has access to say 1 of the 10 databases. You will still see in the Object Explorer all other databases, obviously due to permissions you cannot actually query them, but you can see their names. I have heard that there is a method that disable this beh...
This blog talks about methods for hiding DBs for both SQL 2000 and SQL 2005.
Limit Database List to Ones With Permission SQL Server By default if you connect to a remote SQL Server via an account that has access to say 1 of the 10 databases. You will still see in the Object Explorer all other databases, obviously due to permissions you cannot actually query them, but you can see their names. I ...
TITLE: Limit Database List to Ones With Permission SQL Server QUESTION: By default if you connect to a remote SQL Server via an account that has access to say 1 of the 10 databases. You will still see in the Object Explorer all other databases, obviously due to permissions you cannot actually query them, but you can s...
[ "sql-server", "ssms", "database-permissions", "database-security" ]
4
1
6,438
3
0
2008-10-14T14:08:24.540000
2008-10-14T14:13:18.930000
201,314
201,330
nearest ancestor node in jQuery
In my javascript experience, I found that is a very common task "searching the nearest ancestor of an element with some condition (tag name, class,...)". Can the parents() method of jquery do the job? The order of returned elements of parents() is predictable? Is top-to-bottom or bottom-to-top? For the moment I use thi...
Edit: Since jQuery 1.3, this has been built in as the closest() function. eg: $('#foo').closest('.bar'); yep - parents() traverses up the tree. $('#d').parents("div:first"); will select div b.
nearest ancestor node in jQuery In my javascript experience, I found that is a very common task "searching the nearest ancestor of an element with some condition (tag name, class,...)". Can the parents() method of jquery do the job? The order of returned elements of parents() is predictable? Is top-to-bottom or bottom-...
TITLE: nearest ancestor node in jQuery QUESTION: In my javascript experience, I found that is a very common task "searching the nearest ancestor of an element with some condition (tag name, class,...)". Can the parents() method of jquery do the job? The order of returned elements of parents() is predictable? Is top-to...
[ "javascript", "jquery", "dom" ]
15
21
10,676
4
0
2008-10-14T14:12:40.210000
2008-10-14T14:16:45.133000