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
92,689
149,025
How to define listview templates in code
I am writing a Composite control, which contains a listview to display a table of items. Normally when using a ListView in Asp.NET I would define the templates in the code-forward. <%# Eval("Content") %> I assume it's something like: ListView view = new ListView(); view.LayoutTemplate =..... view.ItemTemplate =..... /...
The trick is to subscribe to the databinding event of the itemplaceholder in the ItemTemplate. The complete solution: public class FibonacciControl: CompositeControl { public FibonacciControl() { //.... } protected override void CreateChildControls() { base.CreateChildControls(); ListView view = new ListView(); view...
How to define listview templates in code I am writing a Composite control, which contains a listview to display a table of items. Normally when using a ListView in Asp.NET I would define the templates in the code-forward. <%# Eval("Content") %> I assume it's something like: ListView view = new ListView(); view.LayoutTe...
TITLE: How to define listview templates in code QUESTION: I am writing a Composite control, which contains a listview to display a table of items. Normally when using a ListView in Asp.NET I would define the templates in the code-forward. <%# Eval("Content") %> I assume it's something like: ListView view = new ListVie...
[ ".net", "asp.net", "controls", "webforms" ]
10
9
17,457
4
0
2008-09-18T13:49:35.737000
2008-09-29T14:50:12.467000
92,698
93,863
Combine rows / concatenate rows
I'm looking for an Access 2007 equivalent to SQL Server's COALESCE function. In SQL Server you could do something like: Person John Steve Richard SQL DECLARE @PersonList nvarchar(1024) SELECT @PersonList = COALESCE(@PersonList + ',','') + Person FROM PersonTable PRINT @PersonList Which produces: John, Steve, Richard I...
Here is a sample User Defined Function (UDF) and possible usage. Function: Function Coalsce(strSQL As String, strDelim, ParamArray NameList() As Variant) Dim db As Database Dim rs As DAO.Recordset Dim strList As String Set db = CurrentDb If strSQL <> "" Then Set rs = db.OpenRecordset(strSQL) Do While Not rs.EOF strL...
Combine rows / concatenate rows I'm looking for an Access 2007 equivalent to SQL Server's COALESCE function. In SQL Server you could do something like: Person John Steve Richard SQL DECLARE @PersonList nvarchar(1024) SELECT @PersonList = COALESCE(@PersonList + ',','') + Person FROM PersonTable PRINT @PersonList Which ...
TITLE: Combine rows / concatenate rows QUESTION: I'm looking for an Access 2007 equivalent to SQL Server's COALESCE function. In SQL Server you could do something like: Person John Steve Richard SQL DECLARE @PersonList nvarchar(1024) SELECT @PersonList = COALESCE(@PersonList + ',','') + Person FROM PersonTable PRINT ...
[ "vba", "ms-access", "coalesce" ]
8
14
16,547
5
0
2008-09-18T13:50:44.580000
2008-09-18T15:56:41.453000
92,699
92,822
Non-iterative / Non-looping Way To Calculate Effective Date?
I have a table called OffDays, where weekends and holiday dates are kept. I have a table called LeadTime where amount of time (in days) for a product to be manufactured is stored. Finally I have a table called Order where a product and the order date is kept. Is it possible to query when a product will be finished manu...
You can generate a table of working days in advance. WDId | WDDate -----+----------- 4200 | 2008-01-08 4201 | 2008-01-09 4202 | 2008-01-12 4203 | 2008-01-13 4204 | 2008-01-16 4205 | 2008-01-17 Then do a query such as SELECT DeliveryDay.WDDate FROM WorkingDay OrderDay, WorkingDay DeliveryDay, LeadTime, Order where Deliv...
Non-iterative / Non-looping Way To Calculate Effective Date? I have a table called OffDays, where weekends and holiday dates are kept. I have a table called LeadTime where amount of time (in days) for a product to be manufactured is stored. Finally I have a table called Order where a product and the order date is kept....
TITLE: Non-iterative / Non-looping Way To Calculate Effective Date? QUESTION: I have a table called OffDays, where weekends and holiday dates are kept. I have a table called LeadTime where amount of time (in days) for a product to be manufactured is stored. Finally I have a table called Order where a product and the o...
[ "sql", "date" ]
3
2
742
8
0
2008-09-18T13:50:48.260000
2008-09-18T14:04:37.773000
92,720
92,819
jQuery/JavaScript to replace broken images
I have a web page that includes a bunch of images. Sometimes the image isn't available, so a broken image is displayed in the client's browser. How do I use jQuery to get the set of images, filter it to broken images then replace the src? --I thought it would be easier to do this with jQuery, but it turned out much eas...
Handle the onError event for the image to reassign its source using JavaScript: function imgError(image) { image.onerror = ""; image.src = "/images/noimage.gif"; return true; } Or without a JavaScript function: The following compatibility table lists the browsers that support the error facility: http://www.quirksmode.o...
jQuery/JavaScript to replace broken images I have a web page that includes a bunch of images. Sometimes the image isn't available, so a broken image is displayed in the client's browser. How do I use jQuery to get the set of images, filter it to broken images then replace the src? --I thought it would be easier to do t...
TITLE: jQuery/JavaScript to replace broken images QUESTION: I have a web page that includes a bunch of images. Sometimes the image isn't available, so a broken image is displayed in the client's browser. How do I use jQuery to get the set of images, filter it to broken images then replace the src? --I thought it would...
[ "javascript", "jquery", "html", "broken-image" ]
588
820
328,077
32
0
2008-09-18T13:53:32.840000
2008-09-18T14:04:21.050000
92,754
92,818
Switching an OSS project license from GPL to L-GPL on Sourceforge
Is that possible to switch an Open Source Project license from GPL to LGPL v3? I am the project originator and the only contributor.
yes, of course. You can change the licence to whatever you want. Go to your admin page, then edit registration from the menu, view Public Info, then edit the Trove categorisation. You need to remove then add a new category. Easy (if a little link-happy). This applies if you're an admin of the project, no matter how man...
Switching an OSS project license from GPL to L-GPL on Sourceforge Is that possible to switch an Open Source Project license from GPL to LGPL v3? I am the project originator and the only contributor.
TITLE: Switching an OSS project license from GPL to L-GPL on Sourceforge QUESTION: Is that possible to switch an Open Source Project license from GPL to LGPL v3? I am the project originator and the only contributor. ANSWER: yes, of course. You can change the licence to whatever you want. Go to your admin page, then e...
[ "open-source", "licensing" ]
3
6
484
3
0
2008-09-18T13:56:39.790000
2008-09-18T14:04:19.663000
92,781
92,962
How do I present text vertically in a JLabel ? (Java 1.6)
I'm looking to have text display vertically, first letter at the bottom, last letter at the top, within a JLabel. Is this possible?
I found this page: http://www.java2s.com/Tutorial/Java/0240__Swing/VerticalLabelUI.htm when I needed to do that. I don't know if you want the letters 'standing' on each other or all rotated on their side. /* * The contents of this file are subject to the Sapient Public License * Version 1.0 (the "License"); you may not...
How do I present text vertically in a JLabel ? (Java 1.6) I'm looking to have text display vertically, first letter at the bottom, last letter at the top, within a JLabel. Is this possible?
TITLE: How do I present text vertically in a JLabel ? (Java 1.6) QUESTION: I'm looking to have text display vertically, first letter at the bottom, last letter at the top, within a JLabel. Is this possible? ANSWER: I found this page: http://www.java2s.com/Tutorial/Java/0240__Swing/VerticalLabelUI.htm when I needed to...
[ "java", "jlabel" ]
13
7
15,342
5
0
2008-09-18T13:59:22.263000
2008-09-18T14:19:20.907000
92,802
92,813
What is the Linux equivalent to DOS pause?
I have a Bash shell script in which I would like to pause execution until the user presses a key. In DOS, this is easily accomplished with the pause command. Is there a Linux equivalent I can use in my script?
read does this: user@host:~$ read -n1 -r -p "Press any key to continue..." key [...] user@host:~$ The -n1 specifies that it only waits for a single character. The -r puts it into raw mode, which is necessary because otherwise, if you press something like backslash, it doesn't register until you hit the next key. The -p...
What is the Linux equivalent to DOS pause? I have a Bash shell script in which I would like to pause execution until the user presses a key. In DOS, this is easily accomplished with the pause command. Is there a Linux equivalent I can use in my script?
TITLE: What is the Linux equivalent to DOS pause? QUESTION: I have a Bash shell script in which I would like to pause execution until the user presses a key. In DOS, this is easily accomplished with the pause command. Is there a Linux equivalent I can use in my script? ANSWER: read does this: user@host:~$ read -n1 -r...
[ "linux", "bash", "shell" ]
281
373
199,666
10
0
2008-09-18T14:02:27.763000
2008-09-18T14:03:44.610000
92,809
92,851
Effective Methods to Manage Digital Distraction
With the plethora of communication methods available to co-workers, how do you manage to keep distractions at bay for a large enough block of time to accomplish some focused programming? Do you quit or close all communications, have you informed people that an away message really means you are a way, or something else?
My e-mail is on a separate computer from my coding machine at work so that helps. Most other diversions are blocked. Besides that all I have to distract me is the phone and coworkers walking by. StackOverflow isn't blocked, though, and that's becoming an increasing distraction.;)
Effective Methods to Manage Digital Distraction With the plethora of communication methods available to co-workers, how do you manage to keep distractions at bay for a large enough block of time to accomplish some focused programming? Do you quit or close all communications, have you informed people that an away messag...
TITLE: Effective Methods to Manage Digital Distraction QUESTION: With the plethora of communication methods available to co-workers, how do you manage to keep distractions at bay for a large enough block of time to accomplish some focused programming? Do you quit or close all communications, have you informed people t...
[ "communication", "time-management" ]
3
1
318
5
0
2008-09-18T14:03:19.087000
2008-09-18T14:08:28.263000
92,811
93,547
Reverse Engineering for Database Diagramming in Visio with SQL Server 2008
I need to reverse engineer a Microsoft SQL Server 2008 in order to create a Microsoft Visio 2007 Database Model Diagram. So I choose "Reverse Engineer" from the Database menu to connect to the DB. I configured the Microsoft SQL Server Visio driver so that is uses SQL Server Native Client 10.0 as the ODBC driver. Afterw...
From Microsoft support via the Microsoft forums: Further investigation reveals that this is expected behavior for Visio 2007. When Visio opens a connection using the Visio SQL Server Driver it checks the server version and since SQL Server 2008 shipped after Visio 2007 it doesn't recognise SQL Server 2008 as a supporte...
Reverse Engineering for Database Diagramming in Visio with SQL Server 2008 I need to reverse engineer a Microsoft SQL Server 2008 in order to create a Microsoft Visio 2007 Database Model Diagram. So I choose "Reverse Engineer" from the Database menu to connect to the DB. I configured the Microsoft SQL Server Visio driv...
TITLE: Reverse Engineering for Database Diagramming in Visio with SQL Server 2008 QUESTION: I need to reverse engineer a Microsoft SQL Server 2008 in order to create a Microsoft Visio 2007 Database Model Diagram. So I choose "Reverse Engineer" from the Database menu to connect to the DB. I configured the Microsoft SQL...
[ "database", "sql-server-2008", "odbc", "visio" ]
42
31
68,121
6
0
2008-09-18T14:03:40.553000
2008-09-18T15:24:23.777000
92,820
92,876
Casting array of objects (which implement interface IFoo) to IFoo[] in C#
class A: IFoo { }... A[] arrayOfA = new A[10]; if(arrayOfA is IFoo[]) { // this is not called } Q1: Why is arrayOfA not an array of IFoos? Q2: Why can't I cast arrayOfA to IFoo[]?
arrayOfA is IFoo[]. There must be something else wrong with your program. You seem to have mocked up some code to show the problem, but in fact your code (see below) works as you expect. Try updating this question with the real code - or as close to real as you can - and we can take another look. using System; public c...
Casting array of objects (which implement interface IFoo) to IFoo[] in C# class A: IFoo { }... A[] arrayOfA = new A[10]; if(arrayOfA is IFoo[]) { // this is not called } Q1: Why is arrayOfA not an array of IFoos? Q2: Why can't I cast arrayOfA to IFoo[]?
TITLE: Casting array of objects (which implement interface IFoo) to IFoo[] in C# QUESTION: class A: IFoo { }... A[] arrayOfA = new A[10]; if(arrayOfA is IFoo[]) { // this is not called } Q1: Why is arrayOfA not an array of IFoos? Q2: Why can't I cast arrayOfA to IFoo[]? ANSWER: arrayOfA is IFoo[]. There must be som...
[ "c#" ]
1
6
2,501
2
0
2008-09-18T14:04:31.720000
2008-09-18T14:12:09.503000
92,826
92,838
How do I use TextMate as my command line subversion message editor?
Simply setting the SVN_EDITOR variable to "mate" does not get the job done. It opens TextMate when appropriate, but then when I save the message and exit, I'm prompted to continue, abort or try again. It seems like the buffer isn't returned to the svn command for use.
You need to include a command line option in your SVN_EDITOR (or EDITOR) variable export SVN_EDITOR='mate -w' This makes the svn command wait for the editor to close/release the file before continuing, which is where the process is getting mucked up now. See here.
How do I use TextMate as my command line subversion message editor? Simply setting the SVN_EDITOR variable to "mate" does not get the job done. It opens TextMate when appropriate, but then when I save the message and exit, I'm prompted to continue, abort or try again. It seems like the buffer isn't returned to the svn ...
TITLE: How do I use TextMate as my command line subversion message editor? QUESTION: Simply setting the SVN_EDITOR variable to "mate" does not get the job done. It opens TextMate when appropriate, but then when I save the message and exit, I'm prompted to continue, abort or try again. It seems like the buffer isn't re...
[ "svn", "command-line", "textmate" ]
4
19
2,484
2
0
2008-09-18T14:05:00.083000
2008-09-18T14:07:05.973000
92,837
93,057
How do I use a list from a different site in MOSS?
I have an announcements list on one site. I want to add it as a web part to the top of each subsite. How can I do this in MOSS?
Out of box that is not possible. Lists are limited to one site only. The only option you have is to use content query web part (available in SharePoint Standard or better). Here is how you can use CQWP. There is also enhanced - community edition here. You can embed these in your subsite templates.
How do I use a list from a different site in MOSS? I have an announcements list on one site. I want to add it as a web part to the top of each subsite. How can I do this in MOSS?
TITLE: How do I use a list from a different site in MOSS? QUESTION: I have an announcements list on one site. I want to add it as a web part to the top of each subsite. How can I do this in MOSS? ANSWER: Out of box that is not possible. Lists are limited to one site only. The only option you have is to use content qu...
[ "sharepoint", "moss" ]
6
1
2,908
6
0
2008-09-18T14:06:39.267000
2008-09-18T14:31:29.440000
92,841
92,982
Is there a .NET function to validate a class name?
I am using CodeDom to generate dynamic code based on user values. One of those values controls what the name of the class I'm generating is. I know I could sterilize the name based on language rules about valid class names using regular expressions, but I'd like to know if there is a specific method built into the fram...
An easy way to determine if a string is a valid identifier for a class or variable is to call the static method System.CodeDom.Compiler.CodeGenerator.IsValidLanguageIndependentIdentifier(string value)
Is there a .NET function to validate a class name? I am using CodeDom to generate dynamic code based on user values. One of those values controls what the name of the class I'm generating is. I know I could sterilize the name based on language rules about valid class names using regular expressions, but I'd like to kno...
TITLE: Is there a .NET function to validate a class name? QUESTION: I am using CodeDom to generate dynamic code based on user values. One of those values controls what the name of the class I'm generating is. I know I could sterilize the name based on language rules about valid class names using regular expressions, b...
[ "c#", ".net", "validation", "class", "naming" ]
21
25
5,861
4
0
2008-09-18T14:07:27.643000
2008-09-18T14:22:40.727000
92,842
92,956
Converting Table Layout To Div
I'm implementing a comment control that uses an ASP.Repeater to display each comment. The comment itself is currently displayed using a table to divide up some images to display the comment in a bubble. I know that tables are supposed to be the epitome of evil for design layout, and really expensive to display for the ...
The best resource I've seen for creating rounded corners using DIV elements was an article on "A List Apart" - see http://alistapart.com/articles/customcorners/. If you're looking to use DIV elements to layout your entire site, there are several other relevant articles on that site. See: http://alistapart.com/articles/...
Converting Table Layout To Div I'm implementing a comment control that uses an ASP.Repeater to display each comment. The comment itself is currently displayed using a table to divide up some images to display the comment in a bubble. I know that tables are supposed to be the epitome of evil for design layout, and reall...
TITLE: Converting Table Layout To Div QUESTION: I'm implementing a comment control that uses an ASP.Repeater to display each comment. The comment itself is currently displayed using a table to divide up some images to display the comment in a bubble. I know that tables are supposed to be the epitome of evil for design...
[ "html", "css", "layout" ]
1
4
2,180
4
0
2008-09-18T14:07:35.863000
2008-09-18T14:19:03.980000
92,847
92,968
How do I shrink an array in Perl?
How do I make an array shorter in Perl? I read some webpages indicating that I can assign: $#ARRAY = 42; I read that the use of $# is deprecated. I need a solution that will work for an array of arrays, too. This didn't work: $#$ARRAY[$i] = 42;
I'm not aware of assigning $#ARRAY being deprecated; perldoc perldata from 5.10.0 certainly says nothing about it. It is the fastest way to truncate an array. If you want something a little more readable, use splice: splice @ARRAY, 43; (Note 43 instead of 42 - $#ARRAY gets you the last index of the array, whereas splic...
How do I shrink an array in Perl? How do I make an array shorter in Perl? I read some webpages indicating that I can assign: $#ARRAY = 42; I read that the use of $# is deprecated. I need a solution that will work for an array of arrays, too. This didn't work: $#$ARRAY[$i] = 42;
TITLE: How do I shrink an array in Perl? QUESTION: How do I make an array shorter in Perl? I read some webpages indicating that I can assign: $#ARRAY = 42; I read that the use of $# is deprecated. I need a solution that will work for an array of arrays, too. This didn't work: $#$ARRAY[$i] = 42; ANSWER: I'm not aware ...
[ "perl", "arrays" ]
15
20
19,085
8
0
2008-09-18T14:08:07.390000
2008-09-18T14:20:03.353000
92,848
96,010
Safe to use TAdsSettings object in the main thread, and AdsQuery objects in other threads?
I have a Win-CGI application I am currently converting to ISAPI. The application uses the TDataset descendants for Extended Systems Advantage Database Server. As there can be only one instance of a TAdsSettings object, this must be in the main thread. TAdsQuery objects are needed in the request threads. Will this work ...
Yes, it will work. The TAdsSettings component modifies settings in the Advantage Client Engine (ACE), and with ISAPI there will be one instance of ACE loaded that all threads use. I wouldn't recommend it, however. Depending on the settings you are changing it would make more sense to just call the ACE APIs directly. Fo...
Safe to use TAdsSettings object in the main thread, and AdsQuery objects in other threads? I have a Win-CGI application I am currently converting to ISAPI. The application uses the TDataset descendants for Extended Systems Advantage Database Server. As there can be only one instance of a TAdsSettings object, this must ...
TITLE: Safe to use TAdsSettings object in the main thread, and AdsQuery objects in other threads? QUESTION: I have a Win-CGI application I am currently converting to ISAPI. The application uses the TDataset descendants for Extended Systems Advantage Database Server. As there can be only one instance of a TAdsSettings ...
[ "multithreading", "delphi", "advantage-database-server" ]
2
1
464
3
0
2008-09-18T14:08:16.347000
2008-09-18T19:25:52.463000
92,859
999,810
What are the differences between struct and class in C++?
This question was already asked in the context of C#/.Net. Now I'd like to learn the differences between a struct and a class in C++. Please discuss the technical differences as well as reasons for choosing one or the other in OO design. I'll start with an obvious difference: If you don't specify public: or private:, m...
You forget the tricky 2nd difference between classes and structs. Quoth the standard (§11.2.2 in C++98 through C++11): In absence of an access-specifier for a base class, public is assumed when the derived class is declared struct and private is assumed when the class is declared class. And just for completeness' sake,...
What are the differences between struct and class in C++? This question was already asked in the context of C#/.Net. Now I'd like to learn the differences between a struct and a class in C++. Please discuss the technical differences as well as reasons for choosing one or the other in OO design. I'll start with an obvio...
TITLE: What are the differences between struct and class in C++? QUESTION: This question was already asked in the context of C#/.Net. Now I'd like to learn the differences between a struct and a class in C++. Please discuss the technical differences as well as reasons for choosing one or the other in OO design. I'll s...
[ "c++", "oop", "class", "struct", "c++-faq" ]
496
497
382,628
29
0
2008-09-18T14:09:58.947000
2009-06-16T06:19:01.103000
92,860
92,959
Eventhandling in ascx usercontrols
What is best practises for communicating events from a usercontrol to parent control/page i want to do something similar to this: MyPage.aspx: MyUserControl.ascx.cs: public partial class MyUserControl: UserControl { public event EventHandler SomeEvent;.... private void OnSomething() { if (SomeEvent!= null) SomeEvent(th...
You would want to create an event on the control that is subscribed to in the parent. See OdeToCode for an example. Here is the article for longevity sake: Some user controls are entirely self contained, for example, a user control displaying current stock quotes does not need to interact with any other content on the ...
Eventhandling in ascx usercontrols What is best practises for communicating events from a usercontrol to parent control/page i want to do something similar to this: MyPage.aspx: MyUserControl.ascx.cs: public partial class MyUserControl: UserControl { public event EventHandler SomeEvent;.... private void OnSomething() {...
TITLE: Eventhandling in ascx usercontrols QUESTION: What is best practises for communicating events from a usercontrol to parent control/page i want to do something similar to this: MyPage.aspx: MyUserControl.ascx.cs: public partial class MyUserControl: UserControl { public event EventHandler SomeEvent;.... private vo...
[ "c#", "asp.net" ]
3
6
13,986
3
0
2008-09-18T14:10:01.880000
2008-09-18T14:19:13.853000
92,862
92,905
Why Does Ruby Only Permit Certain Operator Overloading
In Ruby, like in many other OO programming languages, operators are overloadable. However, only certain character operators can be overloaded. This list may be incomplete but, here are some of the operators that cannot be overloaded:!, not, &&, and, ||, or
Methods are overloadable, those are part of the language syntax.
Why Does Ruby Only Permit Certain Operator Overloading In Ruby, like in many other OO programming languages, operators are overloadable. However, only certain character operators can be overloaded. This list may be incomplete but, here are some of the operators that cannot be overloaded:!, not, &&, and, ||, or
TITLE: Why Does Ruby Only Permit Certain Operator Overloading QUESTION: In Ruby, like in many other OO programming languages, operators are overloadable. However, only certain character operators can be overloaded. This list may be incomplete but, here are some of the operators that cannot be overloaded:!, not, &&, an...
[ "ruby", "methods", "operators", "operator-overloading" ]
9
13
4,705
5
0
2008-09-18T14:10:09.087000
2008-09-18T14:14:12.353000
92,894
93,038
Separating user table from people table in a relational database
I've done many web apps where the first thing you do is make a user table with usernames, passwords, names, e-mails and all of the other usual flotsam. My current project presents a situation where non-users records need to function similarly to users, but do not need to the ability to be a first order user. Is it reas...
This is certainly a good idea, as you are normalizing the database. I have done a similar design in an app that I am writing, where I have an employee table and a user table. Users may a from an external company or an employee, so I have separate tables because an employee is always a user, but a user may not be an emp...
Separating user table from people table in a relational database I've done many web apps where the first thing you do is make a user table with usernames, passwords, names, e-mails and all of the other usual flotsam. My current project presents a situation where non-users records need to function similarly to users, bu...
TITLE: Separating user table from people table in a relational database QUESTION: I've done many web apps where the first thing you do is make a user table with usernames, passwords, names, e-mails and all of the other usual flotsam. My current project presents a situation where non-users records need to function simi...
[ "database", "database-design", "rdbms" ]
11
10
6,127
7
0
2008-09-18T14:13:13.260000
2008-09-18T14:29:00.960000
92,927
93,014
How can I avoid duplicate copies of an object in a cache?
I'm using memcache to design a cache for the model layer of a web application, one of my biggest problems is data consistency. It came to my mind caching data like this: (key=query, value=list of object ids result of the query) for each id of the list: (key=object.id, value=object) So, every time a query is done: If th...
Caching is one of those topics where there is no one right answer - it depends on your domain. The caching policy that you describe may be sufficient for your domain. However, you don't appear to be worried about stale data. Often I would expect to see a timestamp against some of the entities - if the cached value is o...
How can I avoid duplicate copies of an object in a cache? I'm using memcache to design a cache for the model layer of a web application, one of my biggest problems is data consistency. It came to my mind caching data like this: (key=query, value=list of object ids result of the query) for each id of the list: (key=obje...
TITLE: How can I avoid duplicate copies of an object in a cache? QUESTION: I'm using memcache to design a cache for the model layer of a web application, one of my biggest problems is data consistency. It came to my mind caching data like this: (key=query, value=list of object ids result of the query) for each id of t...
[ "php", "caching", "memcached" ]
1
1
1,070
2
0
2008-09-18T14:16:40.990000
2008-09-18T14:26:20.623000
92,928
93,179
time.sleep -- sleeps thread or process?
In Python for *nix, does time.sleep() block the thread or the process?
It blocks the thread. If you look in Modules/timemodule.c in the Python source, you'll see that in the call to floatsleep(), the substantive part of the sleep operation is wrapped in a Py_BEGIN_ALLOW_THREADS and Py_END_ALLOW_THREADS block, allowing other threads to continue to execute while the current one sleeps. You ...
time.sleep -- sleeps thread or process? In Python for *nix, does time.sleep() block the thread or the process?
TITLE: time.sleep -- sleeps thread or process? QUESTION: In Python for *nix, does time.sleep() block the thread or the process? ANSWER: It blocks the thread. If you look in Modules/timemodule.c in the Python source, you'll see that in the call to floatsleep(), the substantive part of the sleep operation is wrapped in...
[ "python", "multithreading", "time", "sleep", "python-internals" ]
424
424
335,706
7
0
2008-09-18T14:16:45.063000
2008-09-18T14:42:23.020000
92,971
94,277
How do I set the size of Emacs' window?
I'm trying to detect the size of the screen I'm starting emacs on, and adjust the size and position the window it is starting in (I guess that's the frame in emacs-speak) accordingly. I'm trying to set up my.emacs so that I always get a "reasonably-big" window with it's top-left corner near the top-left of my screen. I...
If you want to change the size according to resolution you can do something like this (adjusting the preferred width and resolutions according to your specific needs): (defun set-frame-size-according-to-resolution () (interactive) (if window-system (progn;; use 120 char wide window for largeish displays;; and smaller 8...
How do I set the size of Emacs' window? I'm trying to detect the size of the screen I'm starting emacs on, and adjust the size and position the window it is starting in (I guess that's the frame in emacs-speak) accordingly. I'm trying to set up my.emacs so that I always get a "reasonably-big" window with it's top-left ...
TITLE: How do I set the size of Emacs' window? QUESTION: I'm trying to detect the size of the screen I'm starting emacs on, and adjust the size and position the window it is starting in (I guess that's the frame in emacs-speak) accordingly. I'm trying to set up my.emacs so that I always get a "reasonably-big" window w...
[ "emacs", "elisp" ]
111
91
70,131
10
0
2008-09-18T14:20:29
2008-09-18T16:40:11.147000
92,984
93,243
Is "Partial Function Application" a misnomer in the context of Javascript?
A friend of mine and I were having a discussion regarding currying and partial function application in Javascript, and we came to very different conclusions as to whether either were achievable. I came up with this implementation of Function.prototype.curry, which was the basis of our discussion: Function.prototype.cur...
Technically you're creating a brand new function that calls the original function. So if my understanding of partially applied functions is correct, this is not a partially applied function. A partially applied function would be closer to this (note that this isn't a general solution): vindaloo.curry = function(a) { re...
Is "Partial Function Application" a misnomer in the context of Javascript? A friend of mine and I were having a discussion regarding currying and partial function application in Javascript, and we came to very different conclusions as to whether either were achievable. I came up with this implementation of Function.pro...
TITLE: Is "Partial Function Application" a misnomer in the context of Javascript? QUESTION: A friend of mine and I were having a discussion regarding currying and partial function application in Javascript, and we came to very different conclusions as to whether either were achievable. I came up with this implementati...
[ "javascript", "functional-programming" ]
12
4
715
5
0
2008-09-18T14:22:42.270000
2008-09-18T14:48:34.737000
92,985
96,996
Using Drools in a heavy batch process
We used Drools as part of a solution to act as a sort of filter in a very intense processing application, maybe running up to 100 rules on 500,000 + working memory objects. turns out that it is extremely slow. anybody else have any experience using Drools in a batch type processing application?
I haven't worked with the latest version of Drools (last time I used it was about a year ago), but back then our high-load benchmarks proved it to be utterly slow. A huge disappointment after having based much of our architecture on it. At least something good I remember about drools is that their dev team was availabl...
Using Drools in a heavy batch process We used Drools as part of a solution to act as a sort of filter in a very intense processing application, maybe running up to 100 rules on 500,000 + working memory objects. turns out that it is extremely slow. anybody else have any experience using Drools in a batch type processing...
TITLE: Using Drools in a heavy batch process QUESTION: We used Drools as part of a solution to act as a sort of filter in a very intense processing application, maybe running up to 100 rules on 500,000 + working memory objects. turns out that it is extremely slow. anybody else have any experience using Drools in a bat...
[ "drools" ]
17
4
8,980
9
0
2008-09-18T14:22:49.010000
2008-09-18T21:08:33.560000
93,018
93,341
Are properties accessed by fields still lazy-loaded?
I'm using the field.camelcase in my mapping files to setting things like collections, dependant entities, etc. and exposing the collections as readonly arrays. I know the access strategy does not affect the lazy loading, I just want confirm that this will still be cached: private ISet attributes; public virtual Attribu...
The access value just tells it how to access the field and field.camelcase just tells it the naming strategy. This doesn't affect lazy loading. The lazy value will determine lazy loading in the mapping. See: https://nhibernate.info/doc/nhibernate-reference/mapping.html
Are properties accessed by fields still lazy-loaded? I'm using the field.camelcase in my mapping files to setting things like collections, dependant entities, etc. and exposing the collections as readonly arrays. I know the access strategy does not affect the lazy loading, I just want confirm that this will still be ca...
TITLE: Are properties accessed by fields still lazy-loaded? QUESTION: I'm using the field.camelcase in my mapping files to setting things like collections, dependant entities, etc. and exposing the collections as readonly arrays. I know the access strategy does not affect the lazy loading, I just want confirm that thi...
[ "c#", ".net", "nhibernate", "lazy-loading" ]
1
1
324
1
0
2008-09-18T14:26:46.160000
2008-09-18T14:59:31.230000
93,022
93,047
Non Visual Studio F# IDE
Does anyone know of an IDE for F# development that does not involve me shelling out $300? I will gladly move to F# VS Express if they ever release one, but spending money to just get started with a new language is not in my budget.
http://msdn.microsoft.com/en-us/vsx2008/products/bb933751.aspx Visual Studio Shell - Free, and F# supports it out of the box. (edited) http://blogs.msdn.com/dsyme/archive/2008/04/04/tackling-the-f-productization.aspx Theres a link talking about using the Shell and such too
Non Visual Studio F# IDE Does anyone know of an IDE for F# development that does not involve me shelling out $300? I will gladly move to F# VS Express if they ever release one, but spending money to just get started with a new language is not in my budget.
TITLE: Non Visual Studio F# IDE QUESTION: Does anyone know of an IDE for F# development that does not involve me shelling out $300? I will gladly move to F# VS Express if they ever release one, but spending money to just get started with a new language is not in my budget. ANSWER: http://msdn.microsoft.com/en-us/vsx2...
[ "ide", "f#" ]
23
19
9,259
5
0
2008-09-18T14:27:09.827000
2008-09-18T14:29:36.293000
93,039
93,411
Where are static variables stored in C and C++?
In what segment (.BSS,.DATA, other) of an executable file are static variables stored so that they don't have name collision? For example: foo.c: bar.c: static int foo = 1; static int foo = 10; void fooTest() { void barTest() { static int bar = 2; static int bar = 20; foo++; foo++; bar++; bar++; printf("%d,%d", foo, ba...
Where your statics go depends on whether they are zero-initialized. zero-initialized static data goes in.BSS (Block Started by Symbol), non-zero-initialized data goes in.DATA
Where are static variables stored in C and C++? In what segment (.BSS,.DATA, other) of an executable file are static variables stored so that they don't have name collision? For example: foo.c: bar.c: static int foo = 1; static int foo = 10; void fooTest() { void barTest() { static int bar = 2; static int bar = 20; foo...
TITLE: Where are static variables stored in C and C++? QUESTION: In what segment (.BSS,.DATA, other) of an executable file are static variables stored so that they don't have name collision? For example: foo.c: bar.c: static int foo = 1; static int foo = 10; void fooTest() { void barTest() { static int bar = 2; static...
[ "c++", "c", "compiler-construction" ]
227
160
239,538
17
0
2008-09-18T14:29:05.937000
2008-09-18T15:07:35.283000
93,044
93,996
How do I determine the page number for the tab I just clicked on in gtk#?
I have a GTK notebook with multiple tabs. Each tab label is a composite container containing, among other things, a button I want to use to close the tab. The button has a handler for the "clicked" signal. When the signal is called, I get the button widget and "EventArgs" as a parameter. I need to determine the page nu...
One easy work around is to pass the page number to your button's Clicked event as you construct the buttons. for (int page = 0; page < n; page++){ int the_page = page; NotebookPage p = new NotebookPage ();... Button b = new Button ("Close page {0}", the_page); b.Clicked += delegate { Console.WriteLine ("Page={0}", the_...
How do I determine the page number for the tab I just clicked on in gtk#? I have a GTK notebook with multiple tabs. Each tab label is a composite container containing, among other things, a button I want to use to close the tab. The button has a handler for the "clicked" signal. When the signal is called, I get the but...
TITLE: How do I determine the page number for the tab I just clicked on in gtk#? QUESTION: I have a GTK notebook with multiple tabs. Each tab label is a composite container containing, among other things, a button I want to use to close the tab. The button has a handler for the "clicked" signal. When the signal is cal...
[ "mono", "gtk", "gtk#" ]
3
5
422
1
0
2008-09-18T14:29:22.893000
2008-09-18T16:09:57.380000
93,049
93,132
Are Java 6's performance improvements in the JDK, JVM, or both?
I've been wondering about the performance improvements touted in Java SE 6 - is it in the compiler or the runtime? Put another way, would a Java 5 application compiled by JDK 6 see an improvement run under JSE 5 (indicating improved compiler optimization)? Would a Java 5 application compiled by JDK 5 see an improvement...
I have not heard about improvements in the compiler, but extensive information has been published on the runtime performance improvements. Migration guide: http://java.sun.com/javase/6/webnotes/adoption/adoptionguide.html Performance whitepaper: https://www.oracle.com/java/technologies/javase/6performance.html
Are Java 6's performance improvements in the JDK, JVM, or both? I've been wondering about the performance improvements touted in Java SE 6 - is it in the compiler or the runtime? Put another way, would a Java 5 application compiled by JDK 6 see an improvement run under JSE 5 (indicating improved compiler optimization)?...
TITLE: Are Java 6's performance improvements in the JDK, JVM, or both? QUESTION: I've been wondering about the performance improvements touted in Java SE 6 - is it in the compiler or the runtime? Put another way, would a Java 5 application compiled by JDK 6 see an improvement run under JSE 5 (indicating improved compi...
[ "java", "performance", "comparison", "benchmarking", "versions" ]
2
4
6,564
4
0
2008-09-18T14:30:01.690000
2008-09-18T14:38:26.400000
93,073
93,115
How to implement thread safe reference counting in C++
How do you implement an efficient and thread safe reference counting system on X86 CPUs in the C++ programming language? I always run into the problem that the critical operations not atomic, and the available X86 Interlock operations are not sufficient for implementing the ref counting system. The following article co...
Nowadays, you can use the Boost/TR1 shared_ptr<> smart pointer to keep your reference counted references. Works great; no fuss, no muss. The shared_ptr<> class takes care of all the locking needed on the refcount.
How to implement thread safe reference counting in C++ How do you implement an efficient and thread safe reference counting system on X86 CPUs in the C++ programming language? I always run into the problem that the critical operations not atomic, and the available X86 Interlock operations are not sufficient for impleme...
TITLE: How to implement thread safe reference counting in C++ QUESTION: How do you implement an efficient and thread safe reference counting system on X86 CPUs in the C++ programming language? I always run into the problem that the critical operations not atomic, and the available X86 Interlock operations are not suff...
[ "c++", "multithreading", "atomic", "reference-counting" ]
21
13
18,240
7
0
2008-09-18T14:33:15.037000
2008-09-18T14:37:07.697000
93,085
93,172
Physics of a snooker game
Anyone can point me to any info regarding physics of a snooker game, if possible more about the ball collisions? I would like to make a game and I need some help about the physics.
There's a book online about this, " Amateur Physics for the Amateur Pool Player " by Ron Shepard (PDF Link) I haven't read it but I've heard it's good for game developers.
Physics of a snooker game Anyone can point me to any info regarding physics of a snooker game, if possible more about the ball collisions? I would like to make a game and I need some help about the physics.
TITLE: Physics of a snooker game QUESTION: Anyone can point me to any info regarding physics of a snooker game, if possible more about the ball collisions? I would like to make a game and I need some help about the physics. ANSWER: There's a book online about this, " Amateur Physics for the Amateur Pool Player " by R...
[ "physics" ]
7
10
4,916
2
0
2008-09-18T14:34:07.767000
2008-09-18T14:41:49.870000
93,091
93,216
Why can't strings be mutable in Java and .NET?
Why is it that they decided to make String immutable in Java and.NET (and some other languages)? Why didn't they make it mutable?
According to Effective Java, chapter 4, page 73, 2nd edition: "There are many good reasons for this: Immutable classes are easier to design, implement, and use than mutable classes. They are less prone to error and are more secure. [...] " Immutable objects are simple. An immutable object can be in exactly one state, t...
Why can't strings be mutable in Java and .NET? Why is it that they decided to make String immutable in Java and.NET (and some other languages)? Why didn't they make it mutable?
TITLE: Why can't strings be mutable in Java and .NET? QUESTION: Why is it that they decided to make String immutable in Java and.NET (and some other languages)? Why didn't they make it mutable? ANSWER: According to Effective Java, chapter 4, page 73, 2nd edition: "There are many good reasons for this: Immutable class...
[ "java", ".net", "string", "mutable" ]
205
217
45,698
17
0
2008-09-18T14:34:33.083000
2008-09-18T14:46:15.210000
93,094
93,310
Windsor Container: Registering things in Code vs Xml
From what I've read about Windsor/Microkernel it is in theory possible to do everything that you can do using xml files with code. As a matter of fact - and please correct me if I'm wrong - it seems like the major contribution of the Windsor layer is to add xml configuration for things Microkernel can already do. Howev...
I've always found looking at the unit test the best way to learn how to use an open source project. Castle has a fluent interface that will allow you to do everything in code. From the WindsorDotNet2Tests test case: [Test] public void ParentResolverIntercetorShouldNotAffectGenericComponentInterceptor() { WindsorContain...
Windsor Container: Registering things in Code vs Xml From what I've read about Windsor/Microkernel it is in theory possible to do everything that you can do using xml files with code. As a matter of fact - and please correct me if I'm wrong - it seems like the major contribution of the Windsor layer is to add xml confi...
TITLE: Windsor Container: Registering things in Code vs Xml QUESTION: From what I've read about Windsor/Microkernel it is in theory possible to do everything that you can do using xml files with code. As a matter of fact - and please correct me if I'm wrong - it seems like the major contribution of the Windsor layer i...
[ ".net", "inversion-of-control", "castle-windsor" ]
4
7
2,709
1
0
2008-09-18T14:34:47.170000
2008-09-18T14:56:13.593000
93,105
109,201
What's the best way to determine if a character is a letter in VB6?
Need a function that takes a character as a parameter and returns true if it is a letter.
Seanyboy's IsCharAlphaA answer is close. The best method is to use the W version like so: Private Declare Function IsCharAlphaW Lib "user32" (ByVal cChar As Integer) As Long Public Property Get IsLetter(character As String) As Boolean IsLetter = IsCharAlphaW(AscW(character)) End Property Of course, this all rarely matt...
What's the best way to determine if a character is a letter in VB6? Need a function that takes a character as a parameter and returns true if it is a letter.
TITLE: What's the best way to determine if a character is a letter in VB6? QUESTION: Need a function that takes a character as a parameter and returns true if it is a letter. ANSWER: Seanyboy's IsCharAlphaA answer is close. The best method is to use the W version like so: Private Declare Function IsCharAlphaW Lib "us...
[ "vb6" ]
5
4
11,669
9
0
2008-09-18T14:35:50.820000
2008-09-20T20:11:44.310000
93,128
104,176
MySQL Error 1153 - Got a packet bigger than 'max_allowed_packet' bytes
I'm importing a MySQL dump and getting the following error. $ mysql foo < foo.sql ERROR 1153 (08S01) at line 96: Got a packet bigger than 'max_allowed_packet' bytes Apparently there are attachments in the database, which makes for very large inserts. This is on my local machine, a Mac with MySQL 5 installed from the My...
You probably have to change it for both the client (you are running to do the import) AND the daemon mysqld that is running and accepting the import. For the client, you can specify it on the command line: mysql --max_allowed_packet=100M -u root -p database < dump.sql Also, change the my.cnf or my.ini file (usually fou...
MySQL Error 1153 - Got a packet bigger than 'max_allowed_packet' bytes I'm importing a MySQL dump and getting the following error. $ mysql foo < foo.sql ERROR 1153 (08S01) at line 96: Got a packet bigger than 'max_allowed_packet' bytes Apparently there are attachments in the database, which makes for very large inserts...
TITLE: MySQL Error 1153 - Got a packet bigger than 'max_allowed_packet' bytes QUESTION: I'm importing a MySQL dump and getting the following error. $ mysql foo < foo.sql ERROR 1153 (08S01) at line 96: Got a packet bigger than 'max_allowed_packet' bytes Apparently there are attachments in the database, which makes for ...
[ "mysql", "mariadb", "mysql-connector", "mariadb-10.5", "max-allowed-packet" ]
538
759
620,723
15
0
2008-09-18T14:38:14.993000
2008-09-19T18:10:12.970000
93,147
93,199
How to design a rule engine?
I'm supposed to create a simple rule engine in C#. Any leads on how I can proceed?. It's a minimalistic rule engine, and would use SQL server as the back end. Do we have any general blueprint or design patterns that generally apply to rule engines? What kind of.Net technologies can I use to design one? Any directions w...
If you're using.NET 3.0 or later, you can use the Rules Engine of Windows Workflow Foundation without having to acutally use Workflow. I've done this on a project, and you can use SQL or XML as the backend, and it works great. You can use the IDE that comes with the Workflow examples and put it in your own apps. It's e...
How to design a rule engine? I'm supposed to create a simple rule engine in C#. Any leads on how I can proceed?. It's a minimalistic rule engine, and would use SQL server as the back end. Do we have any general blueprint or design patterns that generally apply to rule engines? What kind of.Net technologies can I use to...
TITLE: How to design a rule engine? QUESTION: I'm supposed to create a simple rule engine in C#. Any leads on how I can proceed?. It's a minimalistic rule engine, and would use SQL server as the back end. Do we have any general blueprint or design patterns that generally apply to rule engines? What kind of.Net technol...
[ "c#", "sql-server", "rule-engine" ]
17
14
32,486
7
0
2008-09-18T14:39:34.663000
2008-09-18T14:44:48.660000
93,150
114,811
SQL Server post-join rowcount underestimate
The Query Optimizer is estimating that the results of a join will have only one row, when the actual number of rows is 2000. This is causing later joins on the dataset to have an estimated result of one row, when some of them go as high as 30,000. With a count of 1, the QO is choosing a loop join/index seek strategy fo...
Although the statistics were up to date, the scan percentage wasn't high enough to provide accurate information. I ran this on each of the base tables that was having a problem to update all the statistics on a table by scanning all the rows, not just a default percentage. UPDATE STATISTICS WITH FULLSCAN, ALL The query...
SQL Server post-join rowcount underestimate The Query Optimizer is estimating that the results of a join will have only one row, when the actual number of rows is 2000. This is causing later joins on the dataset to have an estimated result of one row, when some of them go as high as 30,000. With a count of 1, the QO is...
TITLE: SQL Server post-join rowcount underestimate QUESTION: The Query Optimizer is estimating that the results of a join will have only one row, when the actual number of rows is 2000. This is causing later joins on the dataset to have an estimated result of one row, when some of them go as high as 30,000. With a cou...
[ "sql-server", "performance" ]
4
3
1,169
2
0
2008-09-18T14:39:59.780000
2008-09-22T13:20:04.657000
93,153
93,413
Easy way to set CurrentCulture for the entire application?
In a.net 2 winforms application, what's a good way to set the culture for the entire application? Setting CurrentThread.CurrentCulture for every new thread is repetitive and error-prone. Ideally I'd like to set it when the app starts and forget about it.
The culture for a thread in.NET is the culture for the system (as viewed by a single application/process). There is no way to override that in.NET, you'll have to continue setting the CurrentCulture for each new thread.
Easy way to set CurrentCulture for the entire application? In a.net 2 winforms application, what's a good way to set the culture for the entire application? Setting CurrentThread.CurrentCulture for every new thread is repetitive and error-prone. Ideally I'd like to set it when the app starts and forget about it.
TITLE: Easy way to set CurrentCulture for the entire application? QUESTION: In a.net 2 winforms application, what's a good way to set the culture for the entire application? Setting CurrentThread.CurrentCulture for every new thread is repetitive and error-prone. Ideally I'd like to set it when the app starts and forge...
[ ".net", "winforms", "localization" ]
11
12
12,607
2
0
2008-09-18T14:40:15.210000
2008-09-18T15:08:02.270000
93,162
188,088
Obtaining client IP address in WCF 3.0
Apparently you can easily obtain a client IP address in WCF 3.5 but not in WCF 3.0. Anyone know how?
It turns out you can, so long as (a) your service is being hosted in a Web Service (obviously) and (b) you enable AspNetCompatibility mode, as follows:... And then you can get the IP address by: HttpContext.Current.Request.UserHostAddress
Obtaining client IP address in WCF 3.0 Apparently you can easily obtain a client IP address in WCF 3.5 but not in WCF 3.0. Anyone know how?
TITLE: Obtaining client IP address in WCF 3.0 QUESTION: Apparently you can easily obtain a client IP address in WCF 3.5 but not in WCF 3.0. Anyone know how? ANSWER: It turns out you can, so long as (a) your service is being hosted in a Web Service (obviously) and (b) you enable AspNetCompatibility mode, as follows:.....
[ "wcf" ]
82
36
64,810
3
0
2008-09-18T14:40:59.247000
2008-10-09T16:34:44.277000
93,171
93,254
Non-breaking non-space in HTML
I have a bowling web application that allows pretty detailed frame-by-frame information entry. One thing it allows is tracking which pins were knocked down on each ball. To display this information, I make it look like a rack of pins: o o o o o o o o o o Images are used to represent the pins. So, for the back row, I ha...
You could try the css "nowrap" option in the containing div. {white-space: nowrap;} Not sure how widely that is supported.
Non-breaking non-space in HTML I have a bowling web application that allows pretty detailed frame-by-frame information entry. One thing it allows is tracking which pins were knocked down on each ball. To display this information, I make it look like a rack of pins: o o o o o o o o o o Images are used to represent the p...
TITLE: Non-breaking non-space in HTML QUESTION: I have a bowling web application that allows pretty detailed frame-by-frame information entry. One thing it allows is tracking which pins were knocked down on each ball. To display this information, I make it look like a rack of pins: o o o o o o o o o o Images are used ...
[ "html", "css", "internet-explorer", "line-breaks", "pocketpc" ]
11
26
16,632
18
0
2008-09-18T14:41:46.110000
2008-09-18T14:49:30.427000
93,177
93,198
Modifying JVM parameters at runtime
Does someone know if it is possible to modify the JVM settings at runtime (e.g. -dname=value)? I need this little trick to run my Java stored procedure (oracle 10g).
Assuming you mean system properties (-D...; -d picks data model) System.setProperty(...) may do what you want.
Modifying JVM parameters at runtime Does someone know if it is possible to modify the JVM settings at runtime (e.g. -dname=value)? I need this little trick to run my Java stored procedure (oracle 10g).
TITLE: Modifying JVM parameters at runtime QUESTION: Does someone know if it is possible to modify the JVM settings at runtime (e.g. -dname=value)? I need this little trick to run my Java stored procedure (oracle 10g). ANSWER: Assuming you mean system properties (-D...; -d picks data model) System.setProperty(...) ma...
[ "java" ]
0
5
2,250
4
0
2008-09-18T14:42:21.210000
2008-09-18T14:44:48.317000
93,183
93,265
What's the difference between Subclipse Get Contents and Get Revision?
When using the Eclipse->Team->Show History view, what's the difference between using Subclipse "Get Contents" and "Get Revision" options on a revision of a file? Is there any way to see what svn commands Subclipse is issuing behind the scenes?
From the Subclipse manual (Help > Help Contents): Get Contents Use this option to update the contents of the selected file in your working copy with the contents of the revision in the repository. The revision number of your local file is not changed by this option. This option is only valid when the resource history w...
What's the difference between Subclipse Get Contents and Get Revision? When using the Eclipse->Team->Show History view, what's the difference between using Subclipse "Get Contents" and "Get Revision" options on a revision of a file? Is there any way to see what svn commands Subclipse is issuing behind the scenes?
TITLE: What's the difference between Subclipse Get Contents and Get Revision? QUESTION: When using the Eclipse->Team->Show History view, what's the difference between using Subclipse "Get Contents" and "Get Revision" options on a revision of a file? Is there any way to see what svn commands Subclipse is issuing behind...
[ "svn", "version-control", "eclipse-plugin", "subclipse", "revision" ]
5
10
4,187
2
0
2008-09-18T14:43:04.110000
2008-09-18T14:50:37.650000
93,208
93,282
Can I automatically 'Generate Scripts' in a SQL Server 2005 task?
I'd like to automatically generate database scripts on a regular basis. Is this possible.
To generate script for an object you have to pass up to six parameters: exec proc_genscript @ServerName = 'Server Name', @DBName = 'Database Name', @ObjectName = 'Object Name to generate script for', @ObjectType = 'Object Type', @TableName = 'Parent table name for index and trigger', @ScriptFile = 'File name to save th...
Can I automatically 'Generate Scripts' in a SQL Server 2005 task? I'd like to automatically generate database scripts on a regular basis. Is this possible.
TITLE: Can I automatically 'Generate Scripts' in a SQL Server 2005 task? QUESTION: I'd like to automatically generate database scripts on a regular basis. Is this possible. ANSWER: To generate script for an object you have to pass up to six parameters: exec proc_genscript @ServerName = 'Server Name', @DBName = 'Datab...
[ "sql-server", "scripting" ]
4
7
3,633
2
0
2008-09-18T14:45:25.553000
2008-09-18T14:53:26.830000
93,214
93,393
How do you mock params when testing a Rails model's setter?
Given the code from the Complex Form part III how would you go about testing the virtual attribute? def new_task_attributes=(task_attributes) task_attributes.each do |attributes| tasks.build(attributes) end end I am currently trying to test it like this: def test_adding_task_to_project p = Project.new params = {"new_ta...
It looks as if new_task_attributes= is expecting an array of hashes, but you're passing it a hash. Try this: def test_adding_task_to_project p = Project.new new_tasks_attributes = [{ "name" => "paint fence"}] p.new_tasks_attributes = (new_tasks_attributes) p.save assert p.tasks.length == 1 end
How do you mock params when testing a Rails model's setter? Given the code from the Complex Form part III how would you go about testing the virtual attribute? def new_task_attributes=(task_attributes) task_attributes.each do |attributes| tasks.build(attributes) end end I am currently trying to test it like this: def t...
TITLE: How do you mock params when testing a Rails model's setter? QUESTION: Given the code from the Complex Form part III how would you go about testing the virtual attribute? def new_task_attributes=(task_attributes) task_attributes.each do |attributes| tasks.build(attributes) end end I am currently trying to test i...
[ "ruby-on-rails", "unit-testing", "testing", "testing-strategies" ]
1
3
1,050
2
0
2008-09-18T14:45:57.037000
2008-09-18T15:04:59.487000
93,222
93,284
How can I find out what triggered the TRACKER_ID rule in spamassassin?
I recently received an email from my girlfriend that spamassassin marked as spam, mostly because spamassassin detected a tracker ID... except there wasn't one. I'd like to know what triggered it, so that I can report a sensible bug.
How about looking at the rule in question? Google says this: /^[a-z0-9]{6,24}[-_a-z0-9]{12,36}[a-z0-9]{6,24}\s*\z/is...which in its current form will hit (some, depending on hyphenation) words with 24 or more characters. So maybe someone who is familiar with tracker IDs can adjust the regexp so that large words (say 30...
How can I find out what triggered the TRACKER_ID rule in spamassassin? I recently received an email from my girlfriend that spamassassin marked as spam, mostly because spamassassin detected a tracker ID... except there wasn't one. I'd like to know what triggered it, so that I can report a sensible bug.
TITLE: How can I find out what triggered the TRACKER_ID rule in spamassassin? QUESTION: I recently received an email from my girlfriend that spamassassin marked as spam, mostly because spamassassin detected a tracker ID... except there wasn't one. I'd like to know what triggered it, so that I can report a sensible bug...
[ "email", "error-reporting", "spamassassin", "spam-prevention" ]
1
3
3,071
2
0
2008-09-18T14:46:39.920000
2008-09-18T14:53:32.587000
93,231
94,834
Debugging Eclipse Application Problem: Launches repeatedly
I'm having a problem debugging an Eclipse Application from Eclipse. When I launch the Debug Configuration, the Eclipse Application starts up and then stops repeatedly. It shows the splash screen and then disappears. This is the farthest it gets before restarting: MyDebugConfiguration [Eclipse Application] org.eclipse.e...
Have you tried launching Eclipse with the -clean option? This may resolve the issue if it's somehow related to a configuration problem or the registry cache.
Debugging Eclipse Application Problem: Launches repeatedly I'm having a problem debugging an Eclipse Application from Eclipse. When I launch the Debug Configuration, the Eclipse Application starts up and then stops repeatedly. It shows the splash screen and then disappears. This is the farthest it gets before restartin...
TITLE: Debugging Eclipse Application Problem: Launches repeatedly QUESTION: I'm having a problem debugging an Eclipse Application from Eclipse. When I launch the Debug Configuration, the Eclipse Application starts up and then stops repeatedly. It shows the splash screen and then disappears. This is the farthest it get...
[ "eclipse", "debugging" ]
0
0
1,005
3
0
2008-09-18T14:47:13.710000
2008-09-18T17:43:55.780000
93,260
93,291
A free tool to check C/C++ source code against a set of coding standards?
It looks quite easy to find such a tool for Java ( Checkstyle, JCSC ), but I can't seem to find one for C/C++. I am not looking for a lint-like static code analyzer, I only would like to check against coding standards like variable naming, capitalization, spacing, identation, bracket placement, and so on.
The only tool I know is Vera. Haven't used it, though, so can't comment how viable it is. Demo looks promising.
A free tool to check C/C++ source code against a set of coding standards? It looks quite easy to find such a tool for Java ( Checkstyle, JCSC ), but I can't seem to find one for C/C++. I am not looking for a lint-like static code analyzer, I only would like to check against coding standards like variable naming, capita...
TITLE: A free tool to check C/C++ source code against a set of coding standards? QUESTION: It looks quite easy to find such a tool for Java ( Checkstyle, JCSC ), but I can't seem to find one for C/C++. I am not looking for a lint-like static code analyzer, I only would like to check against coding standards like varia...
[ "c++", "c", "coding-style" ]
161
58
134,615
12
0
2008-09-18T14:50:24.997000
2008-09-18T14:54:15.347000
93,261
93,331
In the COFF file format, what is the significance of the relocation information section?
I am reading about COFF file formats, which is commonly used to create an executable file format (it has some variants also). While reading, I came across the relocation section of the format. How is this relocation section used to create an executable file. It would be very useful if you point me to some links which w...
Relocation is used to place executable code in its own memory space in a process. For example, if you try to load two dlls that both request the same base address (ie, the same place in memory), then one of the dlls will have to be relocated to another address. NTCore is a useful site for exploring Portable Executable ...
In the COFF file format, what is the significance of the relocation information section? I am reading about COFF file formats, which is commonly used to create an executable file format (it has some variants also). While reading, I came across the relocation section of the format. How is this relocation section used to...
TITLE: In the COFF file format, what is the significance of the relocation information section? QUESTION: I am reading about COFF file formats, which is commonly used to create an executable file format (it has some variants also). While reading, I came across the relocation section of the format. How is this relocati...
[ "coff" ]
5
4
1,993
3
0
2008-09-18T14:50:28.617000
2008-09-18T14:58:46.023000
93,264
93,292
How do I drop a foreign key in SQL Server?
I have created a foreign key (in SQL Server) by: alter table company add CountryID varchar(3); alter table company add constraint Company_CountryID_FK foreign key(CountryID) references Country; I then run this query: alter table company drop column CountryID; and I get this error: Msg 5074, Level 16, State 4, Line 2 Th...
Try alter table company drop constraint Company_CountryID_FK alter table company drop column CountryID
How do I drop a foreign key in SQL Server? I have created a foreign key (in SQL Server) by: alter table company add CountryID varchar(3); alter table company add constraint Company_CountryID_FK foreign key(CountryID) references Country; I then run this query: alter table company drop column CountryID; and I get this er...
TITLE: How do I drop a foreign key in SQL Server? QUESTION: I have created a foreign key (in SQL Server) by: alter table company add CountryID varchar(3); alter table company add constraint Company_CountryID_FK foreign key(CountryID) references Country; I then run this query: alter table company drop column CountryID;...
[ "sql-server", "t-sql" ]
240
362
388,284
8
0
2008-09-18T14:50:36.493000
2008-09-18T14:54:18.310000
93,274
93,296
Min-width in MSIE 6
What is the definitive way to mimic the CSS property min-width in Internet Explorer 6? Is it better not to try?
foo { min-width: 100px } // for everyone * html foo { width: 100px } // just for IE (or serve a separate stylesheet to IE using conditional comments )
Min-width in MSIE 6 What is the definitive way to mimic the CSS property min-width in Internet Explorer 6? Is it better not to try?
TITLE: Min-width in MSIE 6 QUESTION: What is the definitive way to mimic the CSS property min-width in Internet Explorer 6? Is it better not to try? ANSWER: foo { min-width: 100px } // for everyone * html foo { width: 100px } // just for IE (or serve a separate stylesheet to IE using conditional comments )
[ "css", "internet-explorer", "internet-explorer-6" ]
6
8
3,013
11
0
2008-09-18T14:52:26.443000
2008-09-18T14:54:47.497000
93,277
93,327
What Does ActiveRecord::MultiparameterAssignmentErrors Mean?
I have a rails form with a datetime_select field. When I try to submit the form, I get the following exception: ActiveRecord::MultiparameterAssignmentErrors in WidgetsController#update 1 error(s) on assignment of multiparameter attributes If it's a validation error, why don't I see an error on the page? This is in Rail...
It turns out that rails uses something called Multi-parameter assignment to transmit dates and times in small parts that are reassembled when you assign params to the model instance. My problem was that I was using a datetime_select form field for a date model field. It apparently chokes when the multi-parameter magic ...
What Does ActiveRecord::MultiparameterAssignmentErrors Mean? I have a rails form with a datetime_select field. When I try to submit the form, I get the following exception: ActiveRecord::MultiparameterAssignmentErrors in WidgetsController#update 1 error(s) on assignment of multiparameter attributes If it's a validation...
TITLE: What Does ActiveRecord::MultiparameterAssignmentErrors Mean? QUESTION: I have a rails form with a datetime_select field. When I try to submit the form, I get the following exception: ActiveRecord::MultiparameterAssignmentErrors in WidgetsController#update 1 error(s) on assignment of multiparameter attributes If...
[ "ruby-on-rails", "forms", "datetime-select", "multiparameter" ]
15
11
10,846
7
0
2008-09-18T14:53:00.810000
2008-09-18T14:57:42.030000
93,279
93,412
How to create a fast PHP library?
For our online game, we have written tons of PHP classes and functions grouped by theme in files and then folders. In the end, we have now all our backend code (logic & DB access layers) in a set of files that we call libs and we include our libs in our GUI (web pages, presentation layer) using include_once('pathtolib/...
Manage all includes manually, only where needed Set your include_path to only where it has to be, the default is something like.:/usr/lib/pear/:/usr/lib/php, point it only at where it has to be, php.net/set_include_path Don't use autoload, it's slow and makes APC and equivalent caches jobs a lot harder You can turn off...
How to create a fast PHP library? For our online game, we have written tons of PHP classes and functions grouped by theme in files and then folders. In the end, we have now all our backend code (logic & DB access layers) in a set of files that we call libs and we include our libs in our GUI (web pages, presentation lay...
TITLE: How to create a fast PHP library? QUESTION: For our online game, we have written tons of PHP classes and functions grouped by theme in files and then folders. In the end, we have now all our backend code (logic & DB access layers) in a set of files that we call libs and we include our libs in our GUI (web pages...
[ "php", "include" ]
1
5
9,909
8
0
2008-09-18T14:53:15.067000
2008-09-18T15:07:40.400000
93,290
96,627
Best Java Obfuscation Application For Size Reduction
An important part of mobile development, especially when you are talking about mobile games, is dealing with the application size restrictions. Some devices enforce their own size limits, while all the carriers have their own size requirements for applications to be released in their deck space. My question is, is ther...
When it comes to J2ME and obfuscation it pays to be a bit cautious. Proguard is the best choice because of the many years it has been in development, and the many bugfixes that it has received. I remember the version transition between 2.X and 3.X and how it broke many of my (then) employer builds. This happened becaus...
Best Java Obfuscation Application For Size Reduction An important part of mobile development, especially when you are talking about mobile games, is dealing with the application size restrictions. Some devices enforce their own size limits, while all the carriers have their own size requirements for applications to be ...
TITLE: Best Java Obfuscation Application For Size Reduction QUESTION: An important part of mobile development, especially when you are talking about mobile games, is dealing with the application size restrictions. Some devices enforce their own size limits, while all the carriers have their own size requirements for a...
[ "java-me", "mobile", "obfuscation" ]
4
3
5,772
3
0
2008-09-18T14:54:11.430000
2008-09-18T20:34:39.380000
93,294
175,031
Stack overflow from .NET code in IIS, but not in Winforms
So I have a nasty stack overflow I have been trying to track down / solve for the past 8 hours or so, and I'm at the point where i think i need advice. The details: Interestingly enough this code runs fine when called in the context of our regular winforms application -- but I am tasked with writing a web-based version...
I thought I'd post back here with the resolution to this in case someone else runs into it. The replies above were all helpful, and pointed out why i might be overflowing the stack -- but the thing that I still couldn't come to grips with was why the exact same code ran fine in our winforms app. What I eventually disco...
Stack overflow from .NET code in IIS, but not in Winforms So I have a nasty stack overflow I have been trying to track down / solve for the past 8 hours or so, and I'm at the point where i think i need advice. The details: Interestingly enough this code runs fine when called in the context of our regular winforms appli...
TITLE: Stack overflow from .NET code in IIS, but not in Winforms QUESTION: So I have a nasty stack overflow I have been trying to track down / solve for the past 8 hours or so, and I'm at the point where i think i need advice. The details: Interestingly enough this code runs fine when called in the context of our regu...
[ ".net", "debugging", "iis", "stack", "windbg" ]
4
5
4,249
4
0
2008-09-18T14:54:23.117000
2008-10-06T16:25:26.607000
93,297
107,678
Newbie wants to create a PDF reader for ipod touch - what's the best approach?
I want to make a small app that displays a PDF, presenting zoom-able single pages with a previous-next page function.
The Core Graphics API is pretty much the same in Cocoa and Cocoa touch. Read up on CGPDFDocument, it should provide you with everything you will need to render PDF pages. You won't need to read the PDF spec or use a library to parse PDF files directly. You will probably to learn more about Core Graphics / Quartz 2D / e...
Newbie wants to create a PDF reader for ipod touch - what's the best approach? I want to make a small app that displays a PDF, presenting zoom-able single pages with a previous-next page function.
TITLE: Newbie wants to create a PDF reader for ipod touch - what's the best approach? QUESTION: I want to make a small app that displays a PDF, presenting zoom-able single pages with a previous-next page function. ANSWER: The Core Graphics API is pretty much the same in Cocoa and Cocoa touch. Read up on CGPDFDocument...
[ "iphone", "pdf", "ipod" ]
6
15
7,744
5
0
2008-09-18T14:55:04.283000
2008-09-20T08:58:52.773000
93,335
97,199
WSDL Generator for C#
Does anyone know of a good tool to generate the WSDL for a service contract written in C# (i.e. set of methods that are tagged as "[OperationContract]" using WCF)? All the tools I've found work the other way around: create code stubs from a WSDL. I don't want to have to hand-jam a WSDL file. I've found tools for php an...
Easiest thing to do is host the service with a base address setup, and then just hit it from a browser with "?wsdl" appended to the end. Here's an example of a service configuration with a base address specified. Note this goes in the element in your config: Once you get it hosted, just go to http://localhost:9000/MySe...
WSDL Generator for C# Does anyone know of a good tool to generate the WSDL for a service contract written in C# (i.e. set of methods that are tagged as "[OperationContract]" using WCF)? All the tools I've found work the other way around: create code stubs from a WSDL. I don't want to have to hand-jam a WSDL file. I've ...
TITLE: WSDL Generator for C# QUESTION: Does anyone know of a good tool to generate the WSDL for a service contract written in C# (i.e. set of methods that are tagged as "[OperationContract]" using WCF)? All the tools I've found work the other way around: create code stubs from a WSDL. I don't want to have to hand-jam ...
[ "c#", "wcf", "wsdl" ]
2
5
7,100
3
0
2008-09-18T14:59:01.030000
2008-09-18T21:30:18.920000
93,353
95,138
Create many constrained, random permutation of a list
I need to make a random list of permutations. The elements can be anything but assume that they are the integers 0 through x-1. I want to make y lists, each containing z elements. The rules are that no list may contain the same element twice and that over all the lists, the number of times each elements is used is the ...
This could be improved, but it seems to do the job (Python): import math, random def get_pool(items, y, z): slots = y*z use_each_times = slots/len(items) exceptions = slots - use_each_times*len(items) if (use_each_times > y or exceptions > 0 and use_each_times+1 > y): raise Exception("Impossible.") pool = {} for n ...
Create many constrained, random permutation of a list I need to make a random list of permutations. The elements can be anything but assume that they are the integers 0 through x-1. I want to make y lists, each containing z elements. The rules are that no list may contain the same element twice and that over all the li...
TITLE: Create many constrained, random permutation of a list QUESTION: I need to make a random list of permutations. The elements can be anything but assume that they are the integers 0 through x-1. I want to make y lists, each containing z elements. The rules are that no list may contain the same element twice and th...
[ "random", "list", "permutation" ]
0
2
1,855
6
0
2008-09-18T15:00:27.220000
2008-09-18T18:12:21.393000
93,357
93,418
How can I set a timeout against a BufferedReader based upon a URLConnection in Java?
I want to read the contents of a URL but don't want to "hang" if the URL is unresponsive. I've created a BufferedReader using the URL... URL theURL = new URL(url); URLConnection urlConn = theURL.openConnection(); urlConn.setDoOutput(true); BufferedReader urlReader = new BufferedReader(newInputStreamReader(urlConn.getIn...
I think URLConnection.setReadTimeout is what you are looking for.
How can I set a timeout against a BufferedReader based upon a URLConnection in Java? I want to read the contents of a URL but don't want to "hang" if the URL is unresponsive. I've created a BufferedReader using the URL... URL theURL = new URL(url); URLConnection urlConn = theURL.openConnection(); urlConn.setDoOutput(tr...
TITLE: How can I set a timeout against a BufferedReader based upon a URLConnection in Java? QUESTION: I want to read the contents of a URL but don't want to "hang" if the URL is unresponsive. I've created a BufferedReader using the URL... URL theURL = new URL(url); URLConnection urlConn = theURL.openConnection(); urlC...
[ "java", "url", "sockets" ]
11
13
14,495
5
0
2008-09-18T15:00:41.510000
2008-09-18T15:08:51.147000
93,359
113,914
Can I generate a Flex web and Air desktop app from the same source code?
I'm new to Air. I've got an existing Flex 2 application which I'm considering bringing into Flexbuilder 3. My question is can I use the same base application (and source code) to make the Air version, or would I have to maintain to separate code trees: one for the Air version and one for the Flex/SWF version?
The best approach I've found to creating both Flex and AIR applications from the same source, is to use a core library project for almost all code, with separate small projects for the Flex and AIR applications. There are two key concepts that make this very powerful and maintainable, allowing for not just two applicat...
Can I generate a Flex web and Air desktop app from the same source code? I'm new to Air. I've got an existing Flex 2 application which I'm considering bringing into Flexbuilder 3. My question is can I use the same base application (and source code) to make the Air version, or would I have to maintain to separate code t...
TITLE: Can I generate a Flex web and Air desktop app from the same source code? QUESTION: I'm new to Air. I've got an existing Flex 2 application which I'm considering bringing into Flexbuilder 3. My question is can I use the same base application (and source code) to make the Air version, or would I have to maintain ...
[ "apache-flex", "air", "adobe", "desktop", "flexbuilder" ]
7
6
6,351
5
0
2008-09-18T15:00:58.683000
2008-09-22T09:05:32.490000
93,361
93,441
Can I serve a ClickOnce application with Apache?
We're testing our ClickOnce deployed application internally on IIS (Internet Information Services), but we're wondering if we can deploy it to the wider internet using Apache on Linux so we can make use of our existing external website host. If so, is there anything else I need to consider other than as specifying the ...
I found a number of people asking the same question starting around 2005, but here is the first google result - also discusses silverlight. http://software.clempaul.me.uk/articles/clickonce/ As far as I can tell, however, the only thing you would need to worry about would be setting up the mime types and providing acce...
Can I serve a ClickOnce application with Apache? We're testing our ClickOnce deployed application internally on IIS (Internet Information Services), but we're wondering if we can deploy it to the wider internet using Apache on Linux so we can make use of our existing external website host. If so, is there anything else...
TITLE: Can I serve a ClickOnce application with Apache? QUESTION: We're testing our ClickOnce deployed application internally on IIS (Internet Information Services), but we're wondering if we can deploy it to the wider internet using Apache on Linux so we can make use of our existing external website host. If so, is t...
[ "apache", "deployment", "clickonce" ]
16
10
8,529
2
0
2008-09-18T15:01:26.373000
2008-09-18T15:11:29.953000
93,408
93,717
test attribute in JSTL <c:if> tag
I saw some code like the following in a JSP user My confusion is over the "=" that appears in the value of the test attribute. My understanding was that anything included within <%= %> is printed to the output, but surely the value assigned to test must be a Boolean, so why does this work? For bonus points, is there an...
All that the test attribute looks for to determine if something is true is the string "true" (case in-sensitive). For example, the following code will print "Hello world!" Hello world! The code within the <%= %> returns a boolean, so it will either print the string "true" or "false", which is exactly what the tag looks...
test attribute in JSTL <c:if> tag I saw some code like the following in a JSP user My confusion is over the "=" that appears in the value of the test attribute. My understanding was that anything included within <%= %> is printed to the output, but surely the value assigned to test must be a Boolean, so why does this w...
TITLE: test attribute in JSTL <c:if> tag QUESTION: I saw some code like the following in a JSP user My confusion is over the "=" that appears in the value of the test attribute. My understanding was that anything included within <%= %> is printed to the output, but surely the value assigned to test must be a Boolean, ...
[ "java", "jsp", "jstl" ]
14
17
130,641
5
0
2008-09-18T15:07:21.260000
2008-09-18T15:42:46.727000
93,415
102,256
Maximizing an Emacs frame to just one monitor with elisp
I use maxframe.el to maximize my Emacs frames. It works great on all three major platforms, except on my dual-head Mac setup (Macbook Pro 15-inch laptop with 23-inch monitor). When maximizing an Emacs frame, the frame expands to fill the width of both monitors and the height of the larger monitor. Obviously, I would li...
I quickly scanned the reference that you provided to maxframe.el and I don't think that you're using the same technique that I use. Does the following code snippet help you? (defun toggle-fullscreen () "toggles whether the currently selected frame consumes the entire display or is decorated with a window border" (inter...
Maximizing an Emacs frame to just one monitor with elisp I use maxframe.el to maximize my Emacs frames. It works great on all three major platforms, except on my dual-head Mac setup (Macbook Pro 15-inch laptop with 23-inch monitor). When maximizing an Emacs frame, the frame expands to fill the width of both monitors an...
TITLE: Maximizing an Emacs frame to just one monitor with elisp QUESTION: I use maxframe.el to maximize my Emacs frames. It works great on all three major platforms, except on my dual-head Mac setup (Macbook Pro 15-inch laptop with 23-inch monitor). When maximizing an Emacs frame, the frame expands to fill the width o...
[ "emacs", "editor", "elisp" ]
12
8
2,037
3
0
2008-09-18T15:08:17.573000
2008-09-19T14:27:40.867000
93,417
93,592
How do you query object collections in Java (Criteria/SQL-like)?
Suppose you have a collection of a few hundred in-memory objects and you need to query this List to return objects matching some SQL or Criteria like query. For example, you might have a List of Car objects and you want to return all cars made during the 1960s, with a license plate that starts with AZ, ordered by the n...
I have used Apache Commons JXPath in a production application. It allows you to apply XPath expressions to graphs of objects in Java.
How do you query object collections in Java (Criteria/SQL-like)? Suppose you have a collection of a few hundred in-memory objects and you need to query this List to return objects matching some SQL or Criteria like query. For example, you might have a List of Car objects and you want to return all cars made during the ...
TITLE: How do you query object collections in Java (Criteria/SQL-like)? QUESTION: Suppose you have a collection of a few hundred in-memory objects and you need to query this List to return objects matching some SQL or Criteria like query. For example, you might have a List of Car objects and you want to return all car...
[ "java", "sql", "collections" ]
32
13
38,826
7
0
2008-09-18T15:08:49.337000
2008-09-18T15:29:50.050000
93,423
93,685
Reading an ASCII file with FileChannel and ByteArrays
I have the following code: String inputFile = "somefile.txt"; FileInputStream in = new FileInputStream(inputFile); FileChannel ch = in.getChannel(); ByteBuffer buf = ByteBuffer.allocateDirect(BUFSIZE); // BUFSIZE = 256 /* read the file into a buffer, 256 bytes at a time */ int rd; while ( (rd = ch.read( buf ))!= -1 ) ...
You have to know what the encoding of the file is, and then decode the ByteBuffer into a CharBuffer using that encoding. Assuming the file is ASCII: import java.util.*; import java.io.*; import java.nio.*; import java.nio.channels.*; import java.nio.charset.*; public class Buffer { public static void main(String args[...
Reading an ASCII file with FileChannel and ByteArrays I have the following code: String inputFile = "somefile.txt"; FileInputStream in = new FileInputStream(inputFile); FileChannel ch = in.getChannel(); ByteBuffer buf = ByteBuffer.allocateDirect(BUFSIZE); // BUFSIZE = 256 /* read the file into a buffer, 256 bytes at a...
TITLE: Reading an ASCII file with FileChannel and ByteArrays QUESTION: I have the following code: String inputFile = "somefile.txt"; FileInputStream in = new FileInputStream(inputFile); FileChannel ch = in.getChannel(); ByteBuffer buf = ByteBuffer.allocateDirect(BUFSIZE); // BUFSIZE = 256 /* read the file into a buff...
[ "java", "file-io", "io", "arrays", "filechannel" ]
5
7
14,369
6
0
2008-09-18T15:09:25.623000
2008-09-18T15:39:24.363000
93,439
93,477
Add RSS to any website?
Is there any website/service which will enable me to add RSS subscription to any website? This is for my company I work. We have a website which displays company related news. These news are supplied by an external agency and they gets updated to our database automatically. Our website picks up random/new news and disp...
If you have the data in your database, creating one yourself is fairly straight forward - there's a simple tutorial here. Once you've set up a feed, in the of your page, you put text like: This allows the feed to be "auto-discovered" by your user's browser (e.g. the RSS icon appears in the address bar in FF).
Add RSS to any website? Is there any website/service which will enable me to add RSS subscription to any website? This is for my company I work. We have a website which displays company related news. These news are supplied by an external agency and they gets updated to our database automatically. Our website picks up ...
TITLE: Add RSS to any website? QUESTION: Is there any website/service which will enable me to add RSS subscription to any website? This is for my company I work. We have a website which displays company related news. These news are supplied by an external agency and they gets updated to our database automatically. Our...
[ "rss", "screen-scraping" ]
2
6
1,083
9
0
2008-09-18T15:11:20.970000
2008-09-18T15:16:01.643000
93,451
93,463
Does AES (128 or 256) encryption expand the data? If so, by how much?
I would like to add AES encryption to a software product, but am concerned by increasing the size of the data. I am guessing that the data does increase in size, and then I'll have to add a compression algorithm to compensate.
AES does not expand data. Moreover, the output will not generally be compressible; if you intend to compress your data, do so before encrypting it. However, note that AES encryption is usually combined with padding, which will increase the size of the data (though only by a few bytes).
Does AES (128 or 256) encryption expand the data? If so, by how much? I would like to add AES encryption to a software product, but am concerned by increasing the size of the data. I am guessing that the data does increase in size, and then I'll have to add a compression algorithm to compensate.
TITLE: Does AES (128 or 256) encryption expand the data? If so, by how much? QUESTION: I would like to add AES encryption to a software product, but am concerned by increasing the size of the data. I am guessing that the data does increase in size, and then I'll have to add a compression algorithm to compensate. ANSW...
[ "encryption", "compression", "aes" ]
49
64
45,912
7
0
2008-09-18T15:12:19.267000
2008-09-18T15:14:24.563000
93,455
93,577
Assembly names and versions
What is considered as best practice when it comes to assemblies and releases? I would like to be able to reference multiple versions of the same library - solution contains multiple projects that depend on different versions of a commonutils.dll library we build ourselves. As all dependencies are copied to the bin/debu...
Here's what I've been living by -- It depends on what you are planning to use the DLL files for. I categorize them in two main groups: Dead-end Assemblies. These are EXE files and DLL files you really aren't planning on referencing from anywhere. Just weakly name these and make sure you have the version numbers you rel...
Assembly names and versions What is considered as best practice when it comes to assemblies and releases? I would like to be able to reference multiple versions of the same library - solution contains multiple projects that depend on different versions of a commonutils.dll library we build ourselves. As all dependencie...
TITLE: Assembly names and versions QUESTION: What is considered as best practice when it comes to assemblies and releases? I would like to be able to reference multiple versions of the same library - solution contains multiple projects that depend on different versions of a commonutils.dll library we build ourselves. ...
[ "c#", "assemblies", "naming-conventions" ]
3
2
2,469
3
0
2008-09-18T15:12:50.857000
2008-09-18T15:27:54.220000
93,468
93,503
Call .NET objects/dlls across virtual sites
Site 1 has dll's for x amount of object and data calls. Can Site 2 (a separate.net web app) call the objects/dll's of Site 1?
This may be more semantics: You can't call an object of another process. You can however potentially instantiate a class within a dll as long as there is a reference to that dll in the calling web application. If you GAC the dll, the classes (not objects) will be accessible to the entire machine.
Call .NET objects/dlls across virtual sites Site 1 has dll's for x amount of object and data calls. Can Site 2 (a separate.net web app) call the objects/dll's of Site 1?
TITLE: Call .NET objects/dlls across virtual sites QUESTION: Site 1 has dll's for x amount of object and data calls. Can Site 2 (a separate.net web app) call the objects/dll's of Site 1? ANSWER: This may be more semantics: You can't call an object of another process. You can however potentially instantiate a class wi...
[ ".net" ]
0
1
78
3
0
2008-09-18T15:15:05.593000
2008-09-18T15:18:14.073000
93,472
93,614
DateTimePicker: pick both date and time
Is it possible to use DateTimePicker (Winforms) to pick both date and time (in the dropdown)? How do you change the custom display of the picked value? Also, is it possible to enable the user to type the date/time manually?
Set the Format to Custom and then specify the format: dateTimePicker1.Format = DateTimePickerFormat.Custom; dateTimePicker1.CustomFormat = "MM/dd/yyyy hh:mm:ss"; or however you want to lay it out. You could then type in directly the date/time. If you use MMM, you'll need to use the numeric value for the month for entry...
DateTimePicker: pick both date and time Is it possible to use DateTimePicker (Winforms) to pick both date and time (in the dropdown)? How do you change the custom display of the picked value? Also, is it possible to enable the user to type the date/time manually?
TITLE: DateTimePicker: pick both date and time QUESTION: Is it possible to use DateTimePicker (Winforms) to pick both date and time (in the dropdown)? How do you change the custom display of the picked value? Also, is it possible to enable the user to type the date/time manually? ANSWER: Set the Format to Custom and ...
[ "c#", ".net", "winforms", "datetimepicker" ]
161
211
314,946
8
0
2008-09-18T15:15:37.573000
2008-09-18T15:32:37.500000
93,474
93,529
Classical ASP in IIS 6.0 not scaling
The IIS 6.0 is serving my Classical ASP pages in a serial fashion (one at a time) The #2 request will be handled by the web server only when the #1 request ends. If the #1 request takes a little longer, the #2 request will have to wait for the #1 ends to starts being handled by IIS. Is this a missconfiguration in IIS? ...
Yes, IIS or the site is most likely configured for server-side debugging, which causes all requests to the site to go through a single thread. To check if this is the case/turn it off: In the Properties pages for any Web site or Web virtual directory, click the Home Directory or Virtual Directory tab. Under Application...
Classical ASP in IIS 6.0 not scaling The IIS 6.0 is serving my Classical ASP pages in a serial fashion (one at a time) The #2 request will be handled by the web server only when the #1 request ends. If the #1 request takes a little longer, the #2 request will have to wait for the #1 ends to starts being handled by IIS....
TITLE: Classical ASP in IIS 6.0 not scaling QUESTION: The IIS 6.0 is serving my Classical ASP pages in a serial fashion (one at a time) The #2 request will be handled by the web server only when the #1 request ends. If the #1 request takes a little longer, the #2 request will have to wait for the #1 ends to starts bei...
[ "asp-classic", "iis-6", "scalability" ]
1
4
425
2
0
2008-09-18T15:15:45.590000
2008-09-18T15:21:46.543000
93,482
93,544
Persisting Checkbox State Across Postbacks
I have a web form that binds a DataGrid to a, normally, different data source on each postback. I have a static CheckBox column that is always present to the left of the autogenerated columns. I achieve a TabControl effect with a horizontal Menu control above the grid, with each menu item being a tab that contains a di...
I think the best bet for this is to have a different gridview for each of your "tabs". Use the MultiView control with a View control for each tab, and a gridview in each View. In the click event of your menu change to the correct view. Only bind each gridview once, and then your checkboxes will persist.
Persisting Checkbox State Across Postbacks I have a web form that binds a DataGrid to a, normally, different data source on each postback. I have a static CheckBox column that is always present to the left of the autogenerated columns. I achieve a TabControl effect with a horizontal Menu control above the grid, with ea...
TITLE: Persisting Checkbox State Across Postbacks QUESTION: I have a web form that binds a DataGrid to a, normally, different data source on each postback. I have a static CheckBox column that is always present to the left of the autogenerated columns. I achieve a TabControl effect with a horizontal Menu control above...
[ "asp.net" ]
3
3
1,324
1
0
2008-09-18T15:16:23.467000
2008-09-18T15:24:13.607000
93,506
95,025
How to verify existence of a table with a given ID in a word doc in C# VSTO 3
I want to check for the existence of a table with a given ID in a word document in C# (VS 2008) Visual Studio Tools for Office (version 3). Obviously I can iterate through the document's Tables collection and check every ID, but this seems inefficient; the document will end up having a few dozen tables after I'm done w...
I don't think there's a better way to do it. Any solution including IQueryable would presumably need to iterate the collection internally so wouldn't be any faster. Performance is unlikely to be a problem anyway, so I wouldn't worry about the inefficiency. If you are doing it a lot, you could provide a wrapper that ite...
How to verify existence of a table with a given ID in a word doc in C# VSTO 3 I want to check for the existence of a table with a given ID in a word document in C# (VS 2008) Visual Studio Tools for Office (version 3). Obviously I can iterate through the document's Tables collection and check every ID, but this seems in...
TITLE: How to verify existence of a table with a given ID in a word doc in C# VSTO 3 QUESTION: I want to check for the existence of a table with a given ID in a word document in C# (VS 2008) Visual Studio Tools for Office (version 3). Obviously I can iterate through the document's Tables collection and check every ID,...
[ "c#", "ms-word", "vsto", "iqueryable", "officedev" ]
2
1
365
1
0
2008-09-18T15:19:11.700000
2008-09-18T18:01:18.970000
93,526
93,538
What is a Y-combinator?
A Y-combinator is a computer science concept from the “functional” side of things. Most programmers don't know much at all about combinators, if they've even heard about them. What is a Y-combinator? How do combinators work? What are they good for? Are they useful in procedural languages?
If you're ready for a long read, Mike Vanier has a great explanation. Long story short, it allows you to implement recursion in a language that doesn't necessarily support it natively.
What is a Y-combinator? A Y-combinator is a computer science concept from the “functional” side of things. Most programmers don't know much at all about combinators, if they've even heard about them. What is a Y-combinator? How do combinators work? What are they good for? Are they useful in procedural languages?
TITLE: What is a Y-combinator? QUESTION: A Y-combinator is a computer science concept from the “functional” side of things. Most programmers don't know much at all about combinators, if they've even heard about them. What is a Y-combinator? How do combinators work? What are they good for? Are they useful in procedural...
[ "functional-programming", "computer-science", "theory", "definition", "combinators" ]
440
229
142,741
18
0
2008-09-18T15:21:02.520000
2008-09-18T15:23:03.500000
93,539
93,559
What is the difference between Views and Materialized Views in Oracle?
What is the difference between Views and Materialized Views in Oracle?
Materialized views are disk based and are updated periodically based upon the query definition. Views are virtual only and run the query definition each time they are accessed.
What is the difference between Views and Materialized Views in Oracle? What is the difference between Views and Materialized Views in Oracle?
TITLE: What is the difference between Views and Materialized Views in Oracle? QUESTION: What is the difference between Views and Materialized Views in Oracle? ANSWER: Materialized views are disk based and are updated periodically based upon the query definition. Views are virtual only and run the query definition eac...
[ "sql", "oracle", "view", "relational-database", "materialized-views" ]
433
446
777,439
8
0
2008-09-18T15:23:18.070000
2008-09-18T15:25:55.363000
93,541
402,419
Baseline snaplines in custom Winforms controls
I have a custom user control with a textbox on it and I'd like to expose the baseline (of the text in the textbox) snapline outside of the custom control. I know that you create a designer (inherited from ControlDesigner) and override SnapLines to get access to the snaplines, but I'm wondering how to get the text basel...
I just had a similar need, and I solved it like this: public override IList SnapLines { get { IList snapLines = base.SnapLines; MyControl control = Control as MyControl; if (control == null) { return snapLines; } IDesigner designer = TypeDescriptor.CreateDesigner( control.textBoxValue, typeof(IDesigner)); if (designe...
Baseline snaplines in custom Winforms controls I have a custom user control with a textbox on it and I'd like to expose the baseline (of the text in the textbox) snapline outside of the custom control. I know that you create a designer (inherited from ControlDesigner) and override SnapLines to get access to the snaplin...
TITLE: Baseline snaplines in custom Winforms controls QUESTION: I have a custom user control with a textbox on it and I'd like to expose the baseline (of the text in the textbox) snapline outside of the custom control. I know that you create a designer (inherited from ControlDesigner) and override SnapLines to get acc...
[ ".net", "winforms", "user-controls", "design-time", "windows-forms-designer" ]
35
26
6,950
5
0
2008-09-18T15:23:35.837000
2008-12-31T06:36:42.867000
93,545
2,089,097
How do you detect dialup, broadband or wireless Internet connections in C++ for Windows?
I have an installation program (just a regular C++ MFC program, not Windows Installer based) that needs to set some registry values based on the type of Internet connection: broadband, dialup, and/or wireless. Right now this information is being determined by asking a series of yes or no questions. The problem is that ...
Use InternetGetConnectedState API to retrieve internet connection state. I tested it and it works fine. I found this document which can help: http://www.pcausa.com/resources/InetActive.txt
How do you detect dialup, broadband or wireless Internet connections in C++ for Windows? I have an installation program (just a regular C++ MFC program, not Windows Installer based) that needs to set some registry values based on the type of Internet connection: broadband, dialup, and/or wireless. Right now this inform...
TITLE: How do you detect dialup, broadband or wireless Internet connections in C++ for Windows? QUESTION: I have an installation program (just a regular C++ MFC program, not Windows Installer based) that needs to set some registry values based on the type of Internet connection: broadband, dialup, and/or wireless. Rig...
[ "c++", "mfc", "windows-xp", "broadband" ]
1
2
2,678
6
0
2008-09-18T15:24:13.807000
2010-01-18T20:47:12.673000
93,551
93,688
How to encode the filename parameter of Content-Disposition header in HTTP?
Web applications that want to force a resource to be downloaded rather than directly rendered in a Web browser issue a Content-Disposition header in the HTTP response of the form: Content-Disposition: attachment; filename= FILENAME The filename parameter can be used to suggest a name for the file into which the resourc...
There is discussion of this, including links to browser testing and backwards compatibility, in the proposed RFC 5987, "Character Set and Language Encoding for Hypertext Transfer Protocol (HTTP) Header Field Parameters." RFC 2183 indicates that such headers should be encoded according to RFC 2184, which was obsoleted b...
How to encode the filename parameter of Content-Disposition header in HTTP? Web applications that want to force a resource to be downloaded rather than directly rendered in a Web browser issue a Content-Disposition header in the HTTP response of the form: Content-Disposition: attachment; filename= FILENAME The filename...
TITLE: How to encode the filename parameter of Content-Disposition header in HTTP? QUESTION: Web applications that want to force a resource to be downloaded rather than directly rendered in a Web browser issue a Content-Disposition header in the HTTP response of the form: Content-Disposition: attachment; filename= FIL...
[ "browser", "http-headers", "specifications" ]
630
103
506,544
22
0
2008-09-18T15:25:07.003000
2008-09-18T15:39:58.607000
93,569
93,797
Are POD types always aligned?
For example, if I declare a long variable, can I assume it will always be aligned on a "sizeof(long)" boundary? Microsoft Visual C++ online help says so, but is it standard behavior? some more info: a. It is possible to explicitely create a misaligned integer (*bar): char foo[5] int * bar = (int *)(&foo[1]); b. Apparen...
As others have mentioned, this isn't part of the standard and is left up to the compiler to implement as it sees fit for the processor in question. For example, VC could easily implement different alignment requirements for an ARM processor than it does for x86 processors. Microsoft VC implements what is basically call...
Are POD types always aligned? For example, if I declare a long variable, can I assume it will always be aligned on a "sizeof(long)" boundary? Microsoft Visual C++ online help says so, but is it standard behavior? some more info: a. It is possible to explicitely create a misaligned integer (*bar): char foo[5] int * bar ...
TITLE: Are POD types always aligned? QUESTION: For example, if I declare a long variable, can I assume it will always be aligned on a "sizeof(long)" boundary? Microsoft Visual C++ online help says so, but is it standard behavior? some more info: a. It is possible to explicitely create a misaligned integer (*bar): char...
[ "c++", "c", "visual-c++" ]
4
10
1,272
6
0
2008-09-18T15:27:16
2008-09-18T15:50:56.647000
93,578
94,169
Accessing a resource file from a filesystem plugin on SymbianOS
I cannot use the Resource File API from within a file system plugin due to a PlatSec issue: *PlatSec* ERROR - Capability check failed - Can't load filesystemplugin.PXT because it links to bafl.dll which has the following capabilities missing: TCB My understanding of the issue is that: File system plugins are dlls which...
The Symbian file server has the following capabilities: TCB ProtServ DiskAdmin AllFiles PowerMgmt CommDD So any DLL being loaded into the file server process must have at least these capabilities. There is no way around this, short of writing a new proxy process as you allude to. However, there is a more fundamental re...
Accessing a resource file from a filesystem plugin on SymbianOS I cannot use the Resource File API from within a file system plugin due to a PlatSec issue: *PlatSec* ERROR - Capability check failed - Can't load filesystemplugin.PXT because it links to bafl.dll which has the following capabilities missing: TCB My unders...
TITLE: Accessing a resource file from a filesystem plugin on SymbianOS QUESTION: I cannot use the Resource File API from within a file system plugin due to a PlatSec issue: *PlatSec* ERROR - Capability check failed - Can't load filesystemplugin.PXT because it links to bafl.dll which has the following capabilities miss...
[ "symbian" ]
1
3
663
4
0
2008-09-18T15:28:04.610000
2008-09-18T16:29:24.027000
93,590
93,694
Is FileStream lazy-loaded in .NET?
I have a question about using streams in.NET to load files from disk. I am trying to pinpoint a performance problem and want to be sure it's where I think it is. Dim provider1 As New MD5CryptoServiceProvider Dim stream1 As FileStream stream1 = New FileStream(FileName, FileMode.Open, FileAccess.Read, FileShare.Read) pr...
FileStream simply exposes an IO.Stream around a file object, and uses buffers. It doesn't read the entire file in the constructor (the file could be larger than RAM). The performance issue is most likely in the hashing, and you can perform some simple benchmarks to prove whether it's because of file IO or the algorithm...
Is FileStream lazy-loaded in .NET? I have a question about using streams in.NET to load files from disk. I am trying to pinpoint a performance problem and want to be sure it's where I think it is. Dim provider1 As New MD5CryptoServiceProvider Dim stream1 As FileStream stream1 = New FileStream(FileName, FileMode.Open, ...
TITLE: Is FileStream lazy-loaded in .NET? QUESTION: I have a question about using streams in.NET to load files from disk. I am trying to pinpoint a performance problem and want to be sure it's where I think it is. Dim provider1 As New MD5CryptoServiceProvider Dim stream1 As FileStream stream1 = New FileStream(FileNam...
[ ".net", "performance" ]
2
2
928
3
0
2008-09-18T15:29:37.977000
2008-09-18T15:40:19.823000
93,591
102,638
How do I use IntelliJ to auto-complete method parameters?
A feature in Eclipse that I really miss is how you can auto-complete method parameters with currently in-scope variables. This feature will, with a single key combo ( ctrl + space ) fill in all method parameters. As long as my variables were named similarly to the method parameters, I never had a problem with this auto...
IntelliJ IDEA 9 now supports what they call "super completion" which matches the behavior you are looking for and is available through their early access program. (source: jetbrains.com ) IntelliJ IDEA 8 does not allow you to autocomplete more than one parameter at a time. You are forced to use Control - Shift - Space ...
How do I use IntelliJ to auto-complete method parameters? A feature in Eclipse that I really miss is how you can auto-complete method parameters with currently in-scope variables. This feature will, with a single key combo ( ctrl + space ) fill in all method parameters. As long as my variables were named similarly to t...
TITLE: How do I use IntelliJ to auto-complete method parameters? QUESTION: A feature in Eclipse that I really miss is how you can auto-complete method parameters with currently in-scope variables. This feature will, with a single key combo ( ctrl + space ) fill in all method parameters. As long as my variables were na...
[ "autocomplete", "intellij-idea" ]
62
39
62,277
5
0
2008-09-18T15:29:38.007000
2008-09-19T15:10:04.683000
93,625
93,649
Floating div's in list items (ul, li)
I have a list with two s in every and I want to float them one next to the other and I want the to take the whole availabe space. How do I do it? content content
*{ margin: 0; padding: 0;} li{ width: 100%: display: block; } li:after{ clear: both; } div.a{ width: 49%; float: left; } div.b{ width: 49%; float: left; } Should do the trick.
Floating div's in list items (ul, li) I have a list with two s in every and I want to float them one next to the other and I want the to take the whole availabe space. How do I do it? content content
TITLE: Floating div's in list items (ul, li) QUESTION: I have a list with two s in every and I want to float them one next to the other and I want the to take the whole availabe space. How do I do it? content content ANSWER: *{ margin: 0; padding: 0;} li{ width: 100%: display: block; } li:after{ clear: both; } div.a{...
[ "html", "css", "css-float" ]
1
4
4,649
7
0
2008-09-18T15:33:59.090000
2008-09-18T15:36:19.707000
93,642
93,725
How do download accelerators work?
We require all requests for downloads to have a valid login (non-http) and we generate transaction tickets for each download. If you were to go to one of the download links and attempt to "replay" the transaction, we use HTTP codes to forward you to get a new transaction ticket. This works fine for a majority of users....
You'll get a more comprehensive overview of Download Accelerators at wikipedia. Acceleration is multi-faceted First A substantial benefit of managed/accelerated downloads is the tool in question remembers Start/Stop offsets transferred and uses "partial" and 'range' headers to request parts of the file instead of all o...
How do download accelerators work? We require all requests for downloads to have a valid login (non-http) and we generate transaction tickets for each download. If you were to go to one of the download links and attempt to "replay" the transaction, we use HTTP codes to forward you to get a new transaction ticket. This ...
TITLE: How do download accelerators work? QUESTION: We require all requests for downloads to have a valid login (non-http) and we generate transaction tickets for each download. If you were to go to one of the download links and attempt to "replay" the transaction, we use HTTP codes to forward you to get a new transac...
[ "html", "download", "accelerator" ]
23
21
12,895
8
0
2008-09-18T15:35:46.713000
2008-09-18T15:43:51.407000
93,654
93,670
Is there a .NET/C# wrapper for SQLite?
I'd sort of like to use SQLite from within C#.Net, but I can't seem to find an appropriate library. Is there one? An official one? Are there other ways to use SQLite than with a wrapper?
From https://system.data.sqlite.org: System.Data.SQLite is an ADO.NET adapter for SQLite. System.Data.SQLite was started by Robert Simpson. Robert still has commit privileges on this repository but is no longer an active contributor. Development and maintenance work is now mostly performed by the SQLite Development Tea...
Is there a .NET/C# wrapper for SQLite? I'd sort of like to use SQLite from within C#.Net, but I can't seem to find an appropriate library. Is there one? An official one? Are there other ways to use SQLite than with a wrapper?
TITLE: Is there a .NET/C# wrapper for SQLite? QUESTION: I'd sort of like to use SQLite from within C#.Net, but I can't seem to find an appropriate library. Is there one? An official one? Are there other ways to use SQLite than with a wrapper? ANSWER: From https://system.data.sqlite.org: System.Data.SQLite is an ADO.N...
[ "c#", ".net", "database", "sqlite" ]
271
330
120,498
12
0
2008-09-18T15:36:48.053000
2008-09-18T15:38:08.190000
93,655
93,899
Stripping Invalid XML characters in Java
I have an XML file that's the output from a database. I'm using the Java SAX parser to parse the XML and output it in a different format. The XML contains some invalid characters and the parser is throwing errors like 'Invalid Unicode character (0x5)' Is there a good way to strip all these characters out besides pre-pr...
I haven't used this personally but Atlassian made a command line XML cleaner that may suit your needs (it was made mainly for JIRA but XML is XML): Download atlassian-xml-cleaner-0.1.jar Open a DOS console or shell, and locate the XML or ZIP backup file on your computer, here assumed to be called data.xml Run: java -ja...
Stripping Invalid XML characters in Java I have an XML file that's the output from a database. I'm using the Java SAX parser to parse the XML and output it in a different format. The XML contains some invalid characters and the parser is throwing errors like 'Invalid Unicode character (0x5)' Is there a good way to stri...
TITLE: Stripping Invalid XML characters in Java QUESTION: I have an XML file that's the output from a database. I'm using the Java SAX parser to parse the XML and output it in a different format. The XML contains some invalid characters and the parser is throwing errors like 'Invalid Unicode character (0x5)' Is there ...
[ "java", "xml" ]
29
10
45,408
6
0
2008-09-18T15:36:56.290000
2008-09-18T16:00:43.503000
93,692
93,703
Which Javascript engine would you embed in your application?
I want to embed Javascript in a hobby game engine of mine. Now that we have the 5th generation of Javascript engines out (all blazing fast) I'm curious what engine would you choose to embed in a C++ framework (that includes actual ease of embeding it)? Note: Just to make it clear, I'm not interested in DOM scripting or...
Mozilla's SpiderMonkey is fairly easy and well-documented. It's a C API, but it's straightforward to wrap it in C++. It can be compiled to be thread-safe, which is useful for games since you'd likely want to have your main logic in one thread and user interface logic in a second thread. Google's V8 might be a good choi...
Which Javascript engine would you embed in your application? I want to embed Javascript in a hobby game engine of mine. Now that we have the 5th generation of Javascript engines out (all blazing fast) I'm curious what engine would you choose to embed in a C++ framework (that includes actual ease of embeding it)? Note: ...
TITLE: Which Javascript engine would you embed in your application? QUESTION: I want to embed Javascript in a hobby game engine of mine. Now that we have the 5th generation of Javascript engines out (all blazing fast) I'm curious what engine would you choose to embed in a C++ framework (that includes actual ease of em...
[ "javascript", "c++", "embed" ]
67
21
55,473
10
0
2008-09-18T15:40:08.077000
2008-09-18T15:41:22.037000
93,695
93,836
Best cross-browser method to capture CTRL+S with JQuery?
My users would like to be able to hit Ctrl + S to save a form. Is there a good cross-browser way of capturing the Ctrl + S key combination and submit my form? App is built on Drupal, so jQuery is available.
$(window).keypress(function(event) { if (!(event.which == 115 && event.ctrlKey) &&!(event.which == 19)) return true; alert("Ctrl-S pressed"); event.preventDefault(); return false; }); Key codes can differ between browsers, so you may need to check for more than just 115.
Best cross-browser method to capture CTRL+S with JQuery? My users would like to be able to hit Ctrl + S to save a form. Is there a good cross-browser way of capturing the Ctrl + S key combination and submit my form? App is built on Drupal, so jQuery is available.
TITLE: Best cross-browser method to capture CTRL+S with JQuery? QUESTION: My users would like to be able to hit Ctrl + S to save a form. Is there a good cross-browser way of capturing the Ctrl + S key combination and submit my form? App is built on Drupal, so jQuery is available. ANSWER: $(window).keypress(function(e...
[ "javascript", "jquery" ]
176
125
124,370
17
0
2008-09-18T15:40:23.253000
2008-09-18T15:54:32.940000
93,699
93,841
What is the .NET equivalent of PHP var_dump?
I remember seeing a while ago that there is some method in maybe the Reflection namespace that would recursively run ToString() on all of an object's properties and format it nicely for display. Yes, I know everything I could want will be accessible through the debugger, but I'm wondering if anyone knows that command?
I think what you're looking for is/was called ObjectDumper. It uses reflection to iterate through and output all of the different properties for an object. I first heard about it while learning LINQ, and most of the examples in the Linq in Action book use it. It appears that Microsoft didn't include it in the final ver...
What is the .NET equivalent of PHP var_dump? I remember seeing a while ago that there is some method in maybe the Reflection namespace that would recursively run ToString() on all of an object's properties and format it nicely for display. Yes, I know everything I could want will be accessible through the debugger, but...
TITLE: What is the .NET equivalent of PHP var_dump? QUESTION: I remember seeing a while ago that there is some method in maybe the Reflection namespace that would recursively run ToString() on all of an object's properties and format it nicely for display. Yes, I know everything I could want will be accessible through...
[ ".net", "reflection" ]
15
8
23,777
5
0
2008-09-18T15:40:47.327000
2008-09-18T15:54:49.290000
93,705
173,255
How do I visualise clusters of users?
I have an application in which users interact with each-other. I want to visualize these interactions so that I can determine whether clusters of users exist (within which interactions are more frequent). I've assigned a 2D point to each user (where each coordinate is between 0 and 1). My idea is that two users' points...
In the past, when I've tried this kind of thing, I've used a spring model to pull linked nodes together, something like: dx = -k*(x-l). dx is the change in the position, x is the current position, l is the desired separation, and k is the spring coefficient that you tweak until you get a nice balance between spring str...
How do I visualise clusters of users? I have an application in which users interact with each-other. I want to visualize these interactions so that I can determine whether clusters of users exist (within which interactions are more frequent). I've assigned a 2D point to each user (where each coordinate is between 0 and...
TITLE: How do I visualise clusters of users? QUESTION: I have an application in which users interact with each-other. I want to visualize these interactions so that I can determine whether clusters of users exist (within which interactions are more frequent). I've assigned a 2D point to each user (where each coordinat...
[ "cluster-analysis", "data-visualization" ]
3
2
521
3
0
2008-09-18T15:41:25.593000
2008-10-06T05:17:47
93,708
93,749
How to disable browser postback warning dialog
I have an asp.net application that runs exclusively on IE7 (internal web site). When a user needs to enter data, I pop up a child window with a form. When the form closes, it calls javascript:window.opener.location.reload(true) so that the new data will display on the main page. The problem is that the browser complain...
It's because the page in window.opener comes from a POST Request Maybe you can use javascript:window.opener.location = window.opener.location; to do just a GET request if the data can be fetched without a POST.
How to disable browser postback warning dialog I have an asp.net application that runs exclusively on IE7 (internal web site). When a user needs to enter data, I pop up a child window with a form. When the form closes, it calls javascript:window.opener.location.reload(true) so that the new data will display on the main...
TITLE: How to disable browser postback warning dialog QUESTION: I have an asp.net application that runs exclusively on IE7 (internal web site). When a user needs to enter data, I pop up a child window with a form. When the form closes, it calls javascript:window.opener.location.reload(true) so that the new data will d...
[ "asp.net", "javascript", "internet-explorer-7" ]
1
0
4,823
7
0
2008-09-18T15:42:10.537000
2008-09-18T15:47:03.970000
93,716
93,721
Windows Form with Resizing Frame and no Title Bar?
How can I hide the title bar from a Windows Form but still have a Resizing Frame?
Setting FormBorderStyle = None will remove the title bar (at both design and run time) - and also remove your ability to resize the form. If you need a border you can set: ControlBox = false Text = ""
Windows Form with Resizing Frame and no Title Bar? How can I hide the title bar from a Windows Form but still have a Resizing Frame?
TITLE: Windows Form with Resizing Frame and no Title Bar? QUESTION: How can I hide the title bar from a Windows Form but still have a Resizing Frame? ANSWER: Setting FormBorderStyle = None will remove the title bar (at both design and run time) - and also remove your ability to resize the form. If you need a border y...
[ "c#", "winforms", "visual-studio", "resize", "titlebar" ]
8
12
17,114
2
0
2008-09-18T15:42:45.917000
2008-09-18T15:43:22.110000
93,743
94,196
Get Accordian Selected Index in ASP.Net C#
Im working on an ASP.Net app with c#. I am stuck on a problem with an accoridian. My accordian correctly displays data from a datasource which in this case in some text and then a list of images. On each accordians content there are the images to be displayed and then a button to add another image. This button links to...
If you are redirecting to another page, you are going to have to pass the currently opened section to it via a querystring and then when the new page sends you back, it'll send you back the same value so you know which one to open. Another quick way would be to pop it into a session and then read from that session. But...
Get Accordian Selected Index in ASP.Net C# Im working on an ASP.Net app with c#. I am stuck on a problem with an accoridian. My accordian correctly displays data from a datasource which in this case in some text and then a list of images. On each accordians content there are the images to be displayed and then a button...
TITLE: Get Accordian Selected Index in ASP.Net C# QUESTION: Im working on an ASP.Net app with c#. I am stuck on a problem with an accoridian. My accordian correctly displays data from a datasource which in this case in some text and then a list of images. On each accordians content there are the images to be displayed...
[ "c#", ".net", "asp.net", "webforms" ]
0
0
901
1
0
2008-09-18T15:46:13.757000
2008-09-18T16:32:13.787000
93,770
96,651
EEFileLoadException when using C# classes in C++(win32 app)
For deployment reasons, I am trying to use IJW to wrap a C# assembly in C++ instead of using a COM Callable Wrapper. I've done it on other projects, but on this one, I am getting an EEFileLoadException. Any help would be appreciated! Managed C++ wrapper code (this is in a DLL): extern "C" __declspec(dllexport) IMyObjec...
The problem was where the DLLs were located. c:\dlls\managed.dll c:\dlls\wrapper.dll c:\exe\my.exe I confirmed this by copying managed.dll into c:\exe and it worked without issue. Apparently, the CLR won't look for managed DLLs in the path of the unmanaged DLL and will only look for it where the executable is. (or in t...
EEFileLoadException when using C# classes in C++(win32 app) For deployment reasons, I am trying to use IJW to wrap a C# assembly in C++ instead of using a COM Callable Wrapper. I've done it on other projects, but on this one, I am getting an EEFileLoadException. Any help would be appreciated! Managed C++ wrapper code (...
TITLE: EEFileLoadException when using C# classes in C++(win32 app) QUESTION: For deployment reasons, I am trying to use IJW to wrap a C# assembly in C++ instead of using a COM Callable Wrapper. I've done it on other projects, but on this one, I am getting an EEFileLoadException. Any help would be appreciated! Managed ...
[ "c#", "managed-c++" ]
30
38
31,614
6
0
2008-09-18T15:49:31.923000
2008-09-18T20:36:41.560000
93,771
93,825
Why is my programmatically created user missing from the Welcome screen?
I have a program that creates a Windows user account using the NetUserAdd() API which is suggested by Microsoft. The user is created successfully, and I can log in as that user. However, on Windows XP, the newly-created user is missing from the Welcome screen. If I disable the Welcome screen, I can log in as the new us...
One thing you could do is add the username as a value to the registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList Use the username (As a REG_DWORD) and a value of 1 to show the user and 0 to hide.
Why is my programmatically created user missing from the Welcome screen? I have a program that creates a Windows user account using the NetUserAdd() API which is suggested by Microsoft. The user is created successfully, and I can log in as that user. However, on Windows XP, the newly-created user is missing from the We...
TITLE: Why is my programmatically created user missing from the Welcome screen? QUESTION: I have a program that creates a Windows user account using the NetUserAdd() API which is suggested by Microsoft. The user is created successfully, and I can log in as that user. However, on Windows XP, the newly-created user is m...
[ "security", "winapi" ]
1
4
404
1
0
2008-09-18T15:49:32.873000
2008-09-18T15:53:49.807000
93,773
94,070
How does the ActiveRecord pattern differ from the Domain Object or Data Mapper pattern?
I was looking at DataMapper, which appeared at first glance to use the ActiveRecord ORM pattern. Other people said that it uses the DataMapper and/or the Domain Object pattern. What is the difference between those patterns?
The main difference between the two patterns is this: In the ActiveRecord you have one domain object that both knows all the business logic and how to save/update itself in the database, user.getLinkToProfile() and User::find(1), User::save(user) In the DataMapper pattern you have one domain object that holds all the b...
How does the ActiveRecord pattern differ from the Domain Object or Data Mapper pattern? I was looking at DataMapper, which appeared at first glance to use the ActiveRecord ORM pattern. Other people said that it uses the DataMapper and/or the Domain Object pattern. What is the difference between those patterns?
TITLE: How does the ActiveRecord pattern differ from the Domain Object or Data Mapper pattern? QUESTION: I was looking at DataMapper, which appeared at first glance to use the ActiveRecord ORM pattern. Other people said that it uses the DataMapper and/or the Domain Object pattern. What is the difference between those ...
[ "ruby-on-rails", "activerecord", "datamapper" ]
10
22
2,872
2
0
2008-09-18T15:49:42.593000
2008-09-18T16:17:07.567000
93,790
94,035
MySQL Trigger & Stored Procedure Replication
Ok,I'm running a setup with a single master and a number of slaves. All writes go through the master and are replicated down to the slaves which are used strictly for reads. Now I have a stored procedure (not function) which is called by a trigger on an insert. According to the MySQL docs, for replication triggers log ...
In MySQL 5.0 (and MySQL 5.1 with statement based binary logging), only the calling query is logged, so in your case, the INSERT would be logged. On the slave, the INSERT will be executed and then the trigger will be re-run on the slave. So the trigger needs to exist on the slave, and assuming it does, then it will be e...
MySQL Trigger & Stored Procedure Replication Ok,I'm running a setup with a single master and a number of slaves. All writes go through the master and are replicated down to the slaves which are used strictly for reads. Now I have a stored procedure (not function) which is called by a trigger on an insert. According to ...
TITLE: MySQL Trigger & Stored Procedure Replication QUESTION: Ok,I'm running a setup with a single master and a number of slaves. All writes go through the master and are replicated down to the slaves which are used strictly for reads. Now I have a stored procedure (not function) which is called by a trigger on an ins...
[ "mysql", "stored-procedures", "triggers" ]
2
6
7,387
2
0
2008-09-18T15:50:30.093000
2008-09-18T16:13:24.970000
93,791
3,523,465
Are there many users of PRADO out there?
After making some comments, I've been inspired to get some feedback on the PHP MVC framework PRADO. I've been using it for over a year now and I've very much enjoyed working with it, however I notice that throughout Stack Overflow, it doesn't seem to rate a mention when symfony or CakePHP are being talked about as pote...
The first time I looked into PRADO, I spent about 10 days using it and kept saying to myself: "This framework is amazing!". A couple of months later, I started working on a big project where the customer had chosen to use PRADO... And Hell began... As long as we kept using PRADO's base components, everything was perfec...
Are there many users of PRADO out there? After making some comments, I've been inspired to get some feedback on the PHP MVC framework PRADO. I've been using it for over a year now and I've very much enjoyed working with it, however I notice that throughout Stack Overflow, it doesn't seem to rate a mention when symfony ...
TITLE: Are there many users of PRADO out there? QUESTION: After making some comments, I've been inspired to get some feedback on the PHP MVC framework PRADO. I've been using it for over a year now and I've very much enjoyed working with it, however I notice that throughout Stack Overflow, it doesn't seem to rate a men...
[ "php", "model-view-controller", "frameworks", "prado" ]
3
3
1,008
7
0
2008-09-18T15:50:30.593000
2010-08-19T15:36:08.050000
93,804
93,827
How can I maintain consistent DB schema accross 18 databases (sql server)?
We have 18 databases that should have identical schemas, but don't. In certain scenarios, a table was added to one, but not the rest. Or, certain stored procedures were required in a handful of databases, but not the others. Or, our DBA forgot to run a script to add views on all of the databases. What is the best way t...
For legacy fixes/cleanup, there are tools, like SQLCompare, that can generate scripts to sync databases. For.NET shops running SQL Server, there is also the Visual Studio Database Edition, which can create change scripts for schema changes that can be checked into source control, and automatically built using your CI/b...
How can I maintain consistent DB schema accross 18 databases (sql server)? We have 18 databases that should have identical schemas, but don't. In certain scenarios, a table was added to one, but not the rest. Or, certain stored procedures were required in a handful of databases, but not the others. Or, our DBA forgot t...
TITLE: How can I maintain consistent DB schema accross 18 databases (sql server)? QUESTION: We have 18 databases that should have identical schemas, but don't. In certain scenarios, a table was added to one, but not the rest. Or, certain stored procedures were required in a handful of databases, but not the others. Or...
[ "sql", "sql-server", "database", "schema" ]
2
4
3,309
8
0
2008-09-18T15:51:17.470000
2008-09-18T15:53:59.760000
93,811
94,151
WinForm - draw resizing frame using a single-pixel border
In a Windows Form with a Resizing Frame, the frame border draws with a raised 3-D look. I'd like it to draw with a flat single pixel border in a color of my choosing. Is this possible without having to owner draw the whole form?
You could try something like this: Point lastPoint = Point.Empty; Panel leftResizer = new Panel(); leftResizer.Cursor = System.Windows.Forms.Cursors.SizeWE; leftResizer.Dock = System.Windows.Forms.DockStyle.Left; leftResizer.Size = new System.Drawing.Size(1, 100); leftResizer.MouseDown += delegate(object sender, MouseE...
WinForm - draw resizing frame using a single-pixel border In a Windows Form with a Resizing Frame, the frame border draws with a raised 3-D look. I'd like it to draw with a flat single pixel border in a color of my choosing. Is this possible without having to owner draw the whole form?
TITLE: WinForm - draw resizing frame using a single-pixel border QUESTION: In a Windows Form with a Resizing Frame, the frame border draws with a raised 3-D look. I'd like it to draw with a flat single pixel border in a color of my choosing. Is this possible without having to owner draw the whole form? ANSWER: You co...
[ "c#", "winforms", "resize", "border" ]
1
2
2,379
1
0
2008-09-18T15:52:01.090000
2008-09-18T16:27:19.397000