instruction
stringlengths 0
30k
⌀ |
---|
In my Apache conf.d directory I have subversion.conf that contains:
<Location /svn>
DAV svn
SVNParentPath /var/www/svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /var/www/svn/password
Require valid-user
</Location>
Then whenever I start a new project I just run:
svnadmin create /var/www/svn/myproject |
Recommended to use separate repository per project. In my Apache conf.d directory I have subversion.conf that contains:
<Location /svn>
DAV svn
SVNParentPath /var/www/svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /var/www/svn/password
Require valid-user
</Location>
Then whenever I start a new project I just run:
svnadmin create /var/www/svn/myproject |
You need to pick a type in your assembly and then do the following:
typeof(Some.Object.In.My.Assembly).Assembly.GetName().Version; |
via reflection you can get the Assembly object which contains the assembly version. |
I used the Microsoft ASP.Net Ajax and AjaxControlToolkit to do something like this. They have a ResizeableControl and a DragPanel. I used these, then hosted an IFrame inside the panel to display the content.
Worked pretty well.
***
This site:
http://www.asp.net/learn/videos/default.aspx?tabid=63#ajax
Has lots of tutorial videos that show you how to get started using the controls. |
Example of c# based rule language? |
|rule-language| |
Can you provide a good example of rule definition language written in C#.
Java guys have [JESS][1], is there anything good for C#?
[1]: http://herzberg.ca.sandia.gov/ |
|rule-language|c#| |
|c#|rule-engine| |
I agree with Geoff, the only time we use Literals is if we want to do something **different** with the data ... for example, we might want a DueDate field to say "Today" or "Yesterday" instead of the actual date. |
Open source rules engine with decent interface for writing rules |
|ruleengine| |
I'm trying to locate an open source business rules engine that has a decent interface for building the rules.
OR at least one that works well on the .Net platform and has been updated sometime in the past 12 months.
Thanks, |
|.net|ruleengine| |
|.net|rule-engine| |
jQuery slicing and click events |
|jquery| |
This is probably a really simple jQuery question, but I couldn't answer it after 10 minutes in the documentation so...
I have a list of checkboxes, and I can get them with the selector `'input[type=checkbox]'`. I want the user to be able to shift-click and select a range of checkboxes. To accomplish this, I need to get the index of a checkbox in the list, so I can pass that index to `.slice(start, end)`. How do I get the index when the user clicks a box? |
|javascript|jquery| |
How well will WCF scale to a large number of client users? |
|wcf|scalability|soa| |
Does anyone have any experience with how well services build with Microsoft's WCF will scale to a large number of users?
The level I'm thinking of is in the region of 1000+ client users connecting to a collection of services providing the business logic for our application, and these talking to a database, in something akin to a traditional 3-tier architecture.
Are there any particular gotchas that have slowed down performance, or any design lessons learnt that have enabled this level of scalability? |
The DateFormat class has a parse method, you could try it.
[http://java.sun.com/j2se/1.4.2/docs/api/java/text/DateFormat.html][1]
[1]: http://java.sun.com/j2se/1.4.2/docs/api/java/text/DateFormat.html |
The DateFormat class has a parse method.
[http://java.sun.com/j2se/1.4.2/docs/api/java/text/DateFormat.html][1]
[1]: http://java.sun.com/j2se/1.4.2/docs/api/java/text/DateFormat.html |
I've had the same issue. There is no easy way to tell the updateProgress to render inline. You would be better off to roll your own updateProgress element. You can add a beginRequest listener and endRequest listener to show and hide the element you want to display inline. Here is simple page which shows how to do it:
**aspx**
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="sm" runat="server"></asp:ScriptManager>
<asp:UpdatePanel runat="server" ID="up1" UpdateMode="Always">
<ContentTemplate>
<asp:Label ID="lblTest" runat="server"></asp:Label>
<asp:Button ID="btnTest" runat="server" Text="Test" OnClick="btnTest_OnClick" />
</ContentTemplate>
</asp:UpdatePanel>
<img id="loadingImg" src="../../../images/loading.gif" style="display:none;"/><span>Some Inline text</span>
<script>
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(function(sender, args) {
if (args.get_postBackElement().id == "btnTest") {
document.getElementById("loadingImg").style.display = "inline";
}
});
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function(sender, args) {
if (document.getElementById("loadingImg").style.display != "none") {
document.getElementById("loadingImg").style.display = "none";
}
});
</script>
</div>
</form>
**cs**
public partial class updateProgressTest : System.Web.UI.Page
{
protected void btnTest_OnClick(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(1000);
this.lblTest.Text = "I was changed on the server! Yay!";
}
}
|
To add to TimK's answer, if you have a router, test pulling the upstream link on the router, this will test a bad connection without your system knowing that you lost the physical link. |
If I understand correctly, you want to sum all values in the cross section defined at each "bin" along 1 dimension. I suggest making a 1D array for your destination, then looping through each element in your array adding the value to the destination with the index of the dimension of interest.
If you are using arbitrary number of dimensions, you must have a way of addressing elements (I would be curious how you are implementing this). Your implementation of this will affect how you set the destination index. But an obvious way would be with if statements checked in the iteration loops.
|
Create an EXE from a SWF using Flex 3 without requiring AIR? |
|apache-flex|actionscript-3|flash| |
I have a simple little test app written in Flex 3 (MXML and some AS3). I can compile it to a SWF just fine, but I'd like to make it into an EXE so I can give it to a couple of my coworkers who might find it useful.
With Flash 8, I could just target an EXE instead of a SWF and it would wrap the SWF in a projector, and everything worked fine. Is there an equivalent to that using the Flex 3 SDK that doesn't end up requiring AIR?
Note: I don't have Flex Builder, I'm just using the free Flex 3 SDK. |
I think Stack Overflow itself is using an ApplicationCache expiration to run background code at intervals. |
If you're on a Linux host, you'll almost certainly be using [cron][1].
[1]: http://en.wikipedia.org/wiki/Cron |
In sql 2008 you have native compression, if you have to do this a lot and don't have SQL server 2008 then take a look at something like [Quest LiteSpeed][1] which compreeses the backup automatically
[1]: http://www.quest.com/litespeed-for-sql-server/ |
Under linux you can use cron jobs (http://www.unixgeeks.org/security/newbie/unix/cron-1.html) to schedule tasks.
Use URL fetchers like wget or curl to make HTTP GET requests.
Secure your URLs with authentication so that no one can execute the tasks without knowing the user/password. |
I'd also recommend Subversion. It does not take too long to set up, it is free, and there is a really good book available online that goes over the basics as well as some advanced topics: <a href="http://svnbook.red-bean.com/">http://svnbook.red-bean.com/</a> |
<a href="http://projecteuler.net/">Project Euler</a> has a number of interesting mathematics problems that could provide great material for a beginning programmer to cut her teeth on. The problems begin easy and increase in difficulty and the web is <a href="http://www.google.com/search?hl=en&lr=&safe=active&q=project+euler+solutions&btnG=Search">full of sample solutions in various programming languages</a>. |
> To add to TimK's answer, if you have a router, test pulling the upstream link on the router, this will test a bad connection without your system knowing that you lost the physical link.
Also if you plug it back in after a few seconds it's possible that the connection won't be lost*. This can simulate a very high latency.
*this depends on your ISP and your router. |
Mark said:
> git - very hot since Linus switched to it
I just want to point out that Linus didn't switch to it, Linus *wrote* it. |
I am a big fan of Embarcadero's [ER/Studio][1]. It is very powerful and produces excellent on-screen as well as printed results. They have a free trial as well, so you should be able to get in and give it a shot without too much strife.
Good luck!
[1]: http://www.embarcadero.com/products/erstudio/index.html |
SVN merge merged extra stuff |
|svn|merge| |
I just did a merge using something like:
svn merge -r 67212:67213 https://my.svn.repository/trunk .
I only had 2 files, one of which is a simple ChangeLog. Rather than just merging my ChangeLog changes, it actually pulled mine plus some previous ones that were not in the destination ChangeLog. I noticed there was a conflict when I executed --dry-run, so I updated ChangeLog, and there was STILL a conflict (and I saw the conflict when I did the actual merge).
I then later diffed on the file I was merging from:
svn diff -r 67212:67213 ChangeLog
And I see just the changes I had made, so I know that extra changes didn't get in there somehow.
This makes me worried that merge is not actually just taking what I changed, which is what I would have expected. Can anybody explain what happened? |
I just did a merge using something like:
svn merge -r 67212:67213 https://my.svn.repository/trunk .
I only had 2 files, one of which is a simple ChangeLog. Rather than just merging my ChangeLog changes, it actually pulled mine plus some previous ones that were not in the destination ChangeLog. I noticed there was a conflict when I executed --dry-run, so I updated ChangeLog, and there was STILL a conflict (and I saw the conflict when I did the actual merge).
I then later diffed on the file I was merging from:
svn diff -r 67212:67213 ChangeLog
And I see just the changes I had made, so I know that extra changes didn't get in there somehow.
This makes me worried that merge is not actually just taking what I changed, which is what I would have expected. Can anybody explain what happened? |
I just did a merge using something like:
svn merge -r 67212:67213 https://my.svn.repository/trunk .
I only had 2 files, one of which is a simple ChangeLog. Rather than just merging my ChangeLog changes, it actually pulled mine plus some previous ones that were not in the destination ChangeLog. I noticed there was a conflict when I executed --dry-run, so I updated ChangeLog, and there was STILL a conflict (and I saw the conflict when I did the actual merge).
I then later diffed on the file I was merging from:
svn diff -r 67212:67213 ChangeLog
And I see just the changes I had made, so I know that extra changes didn't get in there somehow.
This makes me worried that merge is not actually just taking what I changed, which is what I would have expected. Can anybody explain what happened?
UPDATE: In response to NilObject:
So, I have 2 files changed, only ChangeLog is relevant, the other merged fine. When I go to my regular trunk checkout, I do the diff command above and see:
Index: ChangeLog
===================================================================
--- ChangeLog (revision 67212)
+++ ChangeLog (revision 67213)
@@ -1,3 +1,7 @@
+2008-08-06 Mike Stone <myemail>
+
+ * changed_file: Details.
+
2008-08-06 Someone Else <their_email>
* theirChanges: Details.
After my merge of the previous changes, the diff of ChangeLog looks like this:
Index: ChangeLog
===================================================================
--- ChangeLog (revision 67215)
+++ ChangeLog (working copy)
@@ -1,3 +1,14 @@
+<<<<<<< .working
+=======
+2008-08-06 Mike Stone <myemail>
+
+ * changed_file: Details.
+
+2008-08-06 Someone Else <their_email>
+
+ * theirChanges: Details.
+
+>>>>>>> .merge-right.r67213
2008-08-05 Someone Else2 <their2_email>
* olderChange: Details.
Note that the entry that was incorrectly pulled in was not in the file I am merging it to, but yet it was not one of my changes and shouldn't have been merged anyways. It was easy to fix (remove the extra lines that weren't part of my changes), but it still makes me worry about merging automatically in SVN. |
Validating posted form data in the ASP.NET MVC framework |
|asp.net|mvc|validation| |
I've been playing around with the ASP.NET MVC Framework and the one thing that's really confusing me is how I'm meant to do server side validation of posted form data. I presume I don't post back to the same URL, but if I don't how do I redisplay the form with the entered data and error messages? Also, where should the validation logic go? In the model or the controller? This seems to be one of the few areas where web forms are much stronger (I miss the validation controls). |
I've been playing around with the ASP.NET MVC Framework and the one thing that's really confusing me is how I'm meant to do server side validation of posted form data. I presume I don't post back to the same URL, but if I don't, how do I redisplay the form with the entered data and error messages? Also, where should the validation logic go? In the model or the controller? This seems to be one of the few areas where web forms are much stronger (I miss the validation controls). |
|asp.net|asp.net-mvc|mvc|validation| |
How do I get rid of Home in ASP.Net MVC? |
|asp.net-mvc| |
I know this site is written using ASP.Net MVC and I do not see "/Home" in the url. This proves to me that it can be done. What special route and do I need? |
|asp.net|mvc| |
|asp.net|asp.net-mvc|mvc| |
RSS Feeds in ASP.NET MVC |
|asp.net|mvc|rss| |
How would you reccommend handling RSS Feeds in ASP.NET MVC? Using a third party library? Using the RSS stuff in the BCL? Just making an RSS view that render the XML? Or something completely different? |
|asp.net|asp.net-mvc|mvc|rss| |
Visio 2005 allows you to open visio multiple times - does this not work in 2007? Try opening a visio document, and then starting another instance of visio from the Start-->Programs menu.
If not, read on...
Visio is an MDI interface - you'll need to stretch the whole visio window across the two monitors in question, then choose the "Window" menu and select "Tile" after you've opened your two documents.
Alternately, in the upper right hand corner just below the application minimize, restore and close buttons you'll find the document minimize, restore and close. Choose restore, and you can manipulate the windows inside the main visio app.
Hope this helps!
-Adam Davis |
Hurray for pointers!
@Joel: I learned C.
unsigned char length = 10;
unsigned char data[10] = {0x00, 0x00, 0x0A, 0xBC, 0x00, 0x00, 0x00, 0x00, 0x0A, 0xBC};
unsigned char *shift = data;
while (shift < data+(length-2)) {
*shift = (*(shift+1)&0x0F)<<4 | (*(shift+2)&0xF0)>>4;
shift++;
}
*(data+length-2) = (*(data+length-1)&0x0F)<<4;
*(data+length-1) = 0x00; |
Making an iframe take vertical space |
|html|iframe| |
I would like to have an iframe take as much vertical space as it needs to display its content and not display a scrollbar. Is it at all possible ?
Are there any workarounds? |
|javascript|html|css|iframe| |
DesignMode with Controls |
|.net|user-controls| |
Has anyone found a useful solution to the DesignMode problem when developing controls?
The issue is that if you nest controls then DesignMode only works for the first level. The second and lower levels DesignMode will always return FALSE.
The standard hack has been to look at the name of the process that is running and if it is "DevEnv.EXE" then it must be studio thus DesignMode is really TRUE.
The problem with that is looking for the ProcessName works its way around through the registry and other strange parts with the end result that the user might not have the required rights to see the process name. In addition this strange route is very slow. So we have had to pile additional hacks to use a singleton and if an error is thrown when asking for the process name then assume that DesignMode is FALSE.
A nice clean way to determine DesignMode is in order. Acually getting Microsoft to fix it internally to the framework would be even better! |
|.net|user-controls|designmode| |
|.net|user-controls| |
I just started looking into http://www.soapui.org/ and it seems like it will work nicely for testing web services.
Also, maybe look at adding an abstraction layer in your web service, each service call would directly call a testable method (outside of the web scope)? I just did this with a bigger project I'm working on, and it's testability is working nicely. |
I've never been caught by this myself, but couldn't you just walk back up the Parent chain from the control to see if DesignMode is set anywhere above you?
|
inline-block on span |
|html|inline-block| |
I expected the two span tags in the following sample to display next to each other, instead they display one below the other. If I set the width of the class span.right to 49% they display next to each other. I am not able to figure out why the right span is pushed down like the right span has some invisible padding/margin which makes it take more than 50%. I am trying to get this done without using html tables. Any ideas?
TIA
<pre><code>
<html>
<head>
<title>Test Page</title>
<style type='text/css'>
* {
margin: 0;
}
html,body{
margin:0;
padding:0;
height:100%;
width:100%;
border:none;
}
div.header{
width:100%;
height:80px;
vertical-align:top;
}
span.left {
height:80px;
width:50%;
display:inline-block;
background-color:pink;
}
span.right {
vertical-align:top;
display:inline-block;
text-align:right;
height:80px;
width:50%;
background-color:red;
}
</style>
</head>
<body>
<div class='header'>
<span class='left'>Left Span 50% width</span>
<span class='right'>Right Span 50% width</span>
</div>
</body>
</html>
</code></pre> |
The [FlashWindowEx][1] function which controls the flashing takes a [FLASHWINFO][2] struct which has a uCount field to control how many times it flashes. Also, a possible value for the dwFlags field is FLASHW_STOP to cause the flashing to stop.
EDIT: Forgot was a C# tagged question ... so [P/Invoke goodness found here][3].
[1]: http://msdn.microsoft.com/en-us/library/ms679347%28VS.85%29.aspx
[2]: http://msdn.microsoft.com/en-us/library/ms679348%28VS.85%29.aspx
[3]: http://www.pinvoke.net/default.aspx/user32.FlashWindowEx |
Model, model, model, model, model. Skinny controllers, simple views.
The RedHandedHomePage model does the parsing on initialization, then call 'def render' in the controller, set output to an instance variable, and print that in a view.
|
Experiences of the Smart Client Software Factory |
|scsf|.net|softwarefactory|visualstudio|softwaredevelopment| |
Has anyone had any experience in building a 'real world' application with the [Smart Client Software Factory][1], from Microsofts Patterns and Practices group? I'm looking for advice on how difficult it was to master, whether it decreased your time to market and any other general pitfalls.
[1]: http://www.codeplex.com/smartclient |
|.net|softwaredevelopment|scsf|softwarefactory| |
|.net|scsf|software-factory| |
I think @Craig is on the right track depending on the details of the problem you are solving. Add it to the repeater and remove it or set Visible="false" to hide it where needed. Viewstate gets tricky with dynamically created controls/user controls, so google that or check [here][1] if you must add dynamically. The article referenced also shows an alternative way to load dynamically:
> Control ctrl=this.LoadControl(Request.ApplicationPath +"/Controls/" +ControlName);
[1]: http://www.aspnet4you.com/articles.aspx?articleid=5032 |
Deserialize in a different language. |
|java|serialization|log4j| |
The log4j network adapter sends events as a serialised java object. I would like to be able to capture this object and deserialise it in a different language (python). Is this possible?
*NOTE* The network capturing is easy; its just a TCP socket and reading in a stream. The difficulty is the deserialising part |
Regex will do the trick... create a perl/python/php script to do the job for you..
I'm pretty sure windows batch file can't do regex.
|
I use a ternary in a printf like this:
printf("%s\n", b?"true":"false");
If you macro it :
B2S(b) ((b)?"true":"false")
then you need to make sure whatever you pass in as 'b' doesn't have any side effects. And don't forget the brackets around the 'b' as you could get compile errors. |
Are Http-Only cookies a viable option for an AJAX website? |
|ajax|cookies| |
A perfect fit for [X() macros][1]. These types of macros can use the C preprocessor to construct enums and arrays from the same source. You only need to add new data to the #define containing the X() macro.
Your example can be written as follows:
// All dog data goes in this list
#define XDOGTYPE \
X(kVizsla,0,"vizsla") \
X(kTerrier,3,"terrier") \
X(kYellowLab,10,"yellowlab")
// Dog info
typedef struct {
int val; // Defined value
char * desc; // Text description
} DogType;
// Build an array index using the Names
typedef enum {
#define X(Name,Val,Text) Name,
XDOGTYPE
#undef X
MAXDOGS
} DogIndex;
// Build a lookup table of values
DogType Dog[] = {
#define X(Name,Val,Text) {Val,Text},
XDOGTYPE
#undef X
};
// Access the values
for (i=0; i < MAXDOGS; i++)
printf("%d: %s\n",Dog[i].val,Dog[i].desc);
[1]: http://www.ddj.com/cpp/184401387 "X() macros" |
In Python
#!/usr/bin/python
class Node:
def process(self):
raise('you should not be processing a node')
class BinaryNode(Node):
def __init__(self, _left, _right):
self.left = _left
self.right = _right
def process(self):
raise('you should not be processing a binarynode')
class Plus(BinaryNode):
def process(self):
return self.left.process() + self.right.process()
class Minus(BinaryNode):
def process(self):
return self.left.process() - self.right.process()
class Mul(BinaryNode):
def process(self):
return self.left.process() * self.right.process()
class Div(BinaryNode):
def process(self):
return self.left.process() / self.right.process()
class Num(Node):
def __init__(self, _value):
self.value = _value
def process(self):
return self.value
def demo(n):
print n.process()
demo(Num(2)) # 2
demo(Plus(Num(2),Num(5))) # 2 + 3
demo(Plus(Mul(Num(2),Num(3)),Div(Num(10),Num(5)))) # (2 * 3) + (10 / 2)
The tests are just building up the binary trees by using constructors.
|
Polymorphic solution, in Python
#!/usr/bin/python
class Node:
"""base class, you should not process one of these"""
def process(self):
raise('you should not be processing a node')
class BinaryNode(Node):
"""base class for binary nodes"""
def __init__(self, _left, _right):
self.left = _left
self.right = _right
def process(self):
raise('you should not be processing a binarynode')
class Plus(BinaryNode):
def process(self):
return self.left.process() + self.right.process()
class Minus(BinaryNode):
def process(self):
return self.left.process() - self.right.process()
class Mul(BinaryNode):
def process(self):
return self.left.process() * self.right.process()
class Div(BinaryNode):
def process(self):
return self.left.process() / self.right.process()
class Num(Node):
def __init__(self, _value):
self.value = _value
def process(self):
return self.value
def demo(n):
print n.process()
demo(Num(2)) # 2
demo(Plus(Num(2),Num(5))) # 2 + 3
demo(Plus(Mul(Num(2),Num(3)),Div(Num(10),Num(5)))) # (2 * 3) + (10 / 2)
The tests are just building up the binary trees by using constructors.
|
have you tried watching the traffic between the GUI and the serial port to see if there is some kind of special command being sent across? Also just curious, Phython is sending ASCII and not UTF-8 or something else right? The reason I ask is because I noticed you quote changes for the strings and in some languages that actually is the difference between ASCII and UTF-8. |
Toad Data Modeller from Quest does a nice job on this and is reasonably priced. Embarcadero E/R studio is good too, as Bruce mentioned. |
sp_fulltext_database 'enable'
CREATE FULLTEXT CATALOG [myFullText]
WITH ACCENT_SENSITIVITY = ON
CREATE FULLTEXT INDEX ON [dbo].[tblName] KEY INDEX [PK_something] ON [myFullText] WITH CHANGE_TRACKING AUTO
ALTER FULLTEXT INDEX ON [dbo].[otherTable] ADD ([Text])
ALTER FULLTEXT INDEX ON [dbo].[teyOtherTable] ENABLE |
this is what I use for C# w/resharper, should work just the same with vb.net:
build deploy */bin */bin/* obj *.dll *.pdb *.user *.suo _ReSharper* *.resharper* bin |
You could also look at either indexing the files yourself, or getting a third part app like google desktop or [copernic][1] to do it and then interface with their index. I know copernic has an API that you can use to search for any file in their index and it also supports mapping network drives.
[1]: http://www.copernic.com/en/products/desktop-search/whats-new-15.html |
How do I use Java to read from a file that is actively being written? |
|java|file|file-io| |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.