instruction stringlengths 0 30k ⌀ |
|---|
The error you are referring to above is usually caused by *associations pointing in the wrong direction*. This happens very easily when manually adding associations to the designer since the association arrows in the L2S designer point backwards when compared to data modelling tools.
It would be nice if they threw a... |
The error you are referring to above is usually caused by ***associations pointing in the wrong direction***. This happens very easily when manually adding associations to the designer since the association arrows in the L2S designer point backwards when compared to data modelling tools.
It would be nice if they thr... |
IMO, the "more obvious/more idiomatic/better solution" is to use an existing ORM rather than invent DAO-like classes.
It appears to me that ORM's are more popular than "raw" SQL connections. Why? Because Python *is* OO, and the mapping from SQL row to to object *is* absolutely essential. There aren't many cases wh... |
i am working on a planner application which loosely follows the iCalendar standard (to record events), read up RFC 2445 and see whether you are interested and you may be interested in this schema published by apple inc. [icalendar schema][1]
[1]: http://developer.apple.com/documentation/AppleApplications/Referen... |
i am working on a planner application which loosely follows the iCalendar standard (to record events), read up RFC 2445 and see whether you are interested and you may be interested in this schema published by apple inc. [icalendar schema][1]
my database schema
event (**event_id**, dtstart, dtend, summary, categ... |
You can try turning it off in the web.config.
<httpRuntime enable = "False"/>
|
The reason you use mock objects in composition is if the real objects do something you dont want to set up (like use sockets, serial ports, get user input, retrieve bulky data etc). You should always use real objects where possible. Mock objects are only for when the estimated effort to implement and maintain a test us... |
What is the difference between the <%# and <%= opening tags? |
|vb.net|visualstudio|.aspx| |
While editing an aspx file I found both these opening tags used for seemingly the same thing. Is there a difference and if yes, what is it? |
|.net|asp.net| |
Well, that code follows entirely different paths for IE and everything-else. I assume the problem is limited to one of them. What browsers have you tried it on, and which exhibit this error?
The only other thing I can think of is that the popularTags element may not exist when you're trying to do stuff to it. How is... |
`<%=` is a equivalent to `<% Repsonse.Write()`
You can write any content out here: for example
<%=myProperty + " additional Text" %>
`<%#` is a binding expression. You can retrieve any public value in the current context (for example in GridViews). But you cannot mix content here.
Take a look at [MSDN]... |
|flash|silverlight| |
We are building a training website where we need to track viewers watching videos and store detailed info about the viewing (when they paused, if they watched the whole video etc)
What should we consider when deciding between the two technologies?
I forgot to add. This is for an in house app. We have complete con... |
The reason this occurs is because eclipse runs your app as a background process and not as a top-level process with a system console. |
Here are a couple of great resources to do with Flex/AS3 best practices and standards:
[Flex SDK coding conventions and best practices][1]
[Flex best practices – Part 1: Setting up your Flex project][2]
The first one I found especially useful and I try to make sure any team I work with have all read it
... |
Is all data access limited to stored procedures? If not, the task could be nearly impossible. If so, you just have to make sure your data migration scripts work well transitioning from the old to the new schema, and then make sure your stored procedures honor theur inputs and outputs.
Hopefully none of them have... |
Versions of Rubygems from 1.0 and up automatically detect the platform you are running and thus do not ask that question. Are you able to update your gems to the latest?
$ sudo gem update --system
Be warned if you are on Windows once you have updated; you might run into [this issue][1].
[1]: http://sta... |
The most obvious answer would be that Microsoft have themselves embraced this concept through their use of Xaml in [Windows Presentation Foundation][1] which replaces WinForms (to an extent).
If you want to stick to a WinForms, you may want to consider [MyXaml][2] which is kind of a homage to Xaml for WinForms!
... |
If you want to match give preg_match_all a shot with a regular expression like this:
preg_match_all('/((\<\%)(\s)(.*?)(\s)(\%\>))/i', '<% wtf %> <% sadfdsafds %>', $result);
This results in a match of just about everything under the sun. You can add/remove parens to match more/less:
Array
(
[0] => Array... |
|java|unit-testing|mocking|jmockit| |
Why don't you send it as a string then convert it back to a date type as needed? This way it will not be converted over different timezones. Keep it simple. |
Why don't you send it as a string then convert it back to a date type as needed? This way it will not be converted over different timezones. Keep it simple.
Edit: I like the Struct idea, allows for good functionality. |
[rsl's stringex][1] is pretty awesome, think of it as permalink_fu done right.
[1]: http://github.com/rsl/stringex "rsl's stringex" |
The Scrum is a standup meeting, and the concept of a talking stick is an excellent point.
The key here is not that you have one or a few uncooperative team members, but is IMO, a more fundamental problem: the scrum team is supposed to be self managed, and the scrum meeting is to keep the **team** informed. If the o... |
Place To get EULA and Other Legalese For Software? |
|legal| |
I was curious if anyone out there has experience getting the necessary legal documents (user agreements, privacy policies, disclaimers, etc.) for a small software business. For example if you just want to have a software 'company' that sells a few piece of software that you have written, are there cheap solutions for ... |
|legal|eula| |
It's best to, where possible, have your validation rules specified in your database and use or write a framework that makes those rules bubble up into your front end. ASP.NET Dynamic Data helps with this and there are some commercial libraries out there that make it even easier.
This can be done both for simple inp... |
What happens to your time slice if you get pre-empted in vxWorks? |
|vxworks| |
If you have round robin enabled in Vxworks and your task gets preempted by a higher priority task, what happens to the remaining time slice? |
There are other concerns than just SQL injection with input. You should take the most defensive stance possible whenever accepting user input. For example, a user might be able to enter a link to an image into a textbox, which is actually a PHP script that runs something nasty.
If you design your application well, ... |
Considering that XML doesn't use a line based format, you should probably check the number of characters. With a regular expression, you can create a pattern to match the comment prefix and match a minimum number of characters before it matches the first comment suffix.
http://www.regular-expressions.info/
Here i... |
What's the easiest way to use C source code in a Java application? |
|java|c|translation| |
I found this open-source library that I want to use in my Java application. The library is written in C and was developed under Unix/Linux, and my application will run on Windows. It's a library of mostly mathematical functions, so as far as I can tell it doesn't use anything that's platform-dependent, it's just very b... |
I found this open-source library that I want to use in my Java application. The library is written in C and was developed under Unix/Linux, and my application will run on Windows. It's a library of mostly mathematical functions, so as far as I can tell it doesn't use anything that's platform-dependent, it's just very b... |
VC++ supports [__forceinline][1] and [__declspec(noinline)][2] directives if you think you know better than the compiler. Hint: you probably don't!
[1]: http://msdn.microsoft.com/en-us/library/z8y1yy88(VS.71).aspx
[2]: http://msdn.microsoft.com/en-us/library/kxybs02x(VS.80).aspx |
If you have to create the file, I think that you can probably do something like this:
using (FileStream outFile = System.IO.File.Create(filename))
{
outFile.Seek(<length_to_write>, SeekOrigin.Begin);
}
Where <length_to_write> would be the size in bytes of the file to write. I'm not sure th... |
If you have to create the file, I think that you can probably do something like this:
using (FileStream outFile = System.IO.File.Create(filename))
{
outFile.Seek(<length_to_write>-1, SeekOrigin.Begin);
OutFile.WriteByte(0);
}
Where length_to_write would be the size in bytes of the ... |
What is the point of the Lowered* columns in asp.net membership tables? |
|asp.net| |
What is the architectural reason for the column names prefixed with "Lowered" in the SQL schema for ASP.Net membership and friends? Some examples of the columns in question are below:
- aspnet_Applications.LoweredApplicationName
- aspnet_users.LoweredUserName
- aspnet_membership.LowerEmail
I see that th... |
In C++ you could have an abstract class with no implementation, and you could inherit multiple classes. Java and C# got rid of multiple inheritance, so in order to have the ability to inherit multiple contracts (not behaviors), they created interfaces. You can only inherit one class in C#, but you can inherit as many... |
Information hiding means not to expose to consumers of your class what they don't need to know. Hiding properties and replacing them with methods is pointless **because properties are actually special type of methods** |
programmatically find number of hosts in a Netmask |
|networking|math| |
How do you programmatically find the number of hosts that a netmask supports.
Eg, If you have a /30 , how do you find how many IP's are in it without using a lookup table?
Preferably would be able to work with the "/" notation, rather than 255.xxx.xxx.xxx notation.
|
As mentioned above, some of the fundamental Object Oriented Design principles are OCP, LSP, DIP and ISP.
An excellent overview of these by Robert C. Martin (of Object Mentor) is available here: [OOD Principles and Patterns][1]
[1]: http://www.objectmentor.com/resources/articles/Principles_and_Patterns.pdf |
I think the basic idea is "multiple inheritance" .But C# does not support it. So along came Interfaces.
|
The first thing is to create the table schema. I already did that for a Legacy database using Enterprise Architect. You can select the DB and it will create you every tables/fields. Then, you will need to split everything in categories. Exemple all your receives and ships products together, client stuff in an other cat... |
This is off the top of my head and can be clearly cleaned up but use it as a starting point:
select case when DATENAME(day, [date]) = 'Monday' then DATEADD(day, 1, [Date])
when DATENAME(day, [date]) = 'Tuesday' then DATEADD(day, 1, [Date])
when DATENAME(day, [d... |
This is off the top of my head and can be clearly cleaned up but use it as a starting point:
select case when DATENAME(dw, [date]) = 'Monday' then DATEADD(dw, 1, [Date])
when DATENAME(dw, [date]) = 'Tuesday' then DATEADD(dw, 1, [Date])
when DATENAME(dw, [date])... |
System calls in the C standard library typically return -1 on error and 0 on success. Also the Fotran computed if statement would (and probably still does) jump to one of three line numbers depending on the condition evaluating to less than, equal to or greater than zero.
eg: IF (I-15) 10,20,10
would test for th... |
This solution implements a generator, to avoid holding all the permutations on memory:
def permutations (orig_list):
if not isinstance(orig_list, list):
orig_list = list(orig_list)
yield orig_list
if len(orig_list) == 1:
return
... |
I appreciate that this is hard to do *right* - but if you provide the user a way to edit the results (say, a pop-up window to edit the name if it didn't guess right) and still guess "right" for most cases... of course it's the guessing that's tough.
It's easy to say "don't do it" when looking at the problem theoreti... |
Does anyone know the CVS command line options to get the details of the last check in? |
|cvs|build-automation| |
I'm using CVS on Windows (with the WinCVS front end), and would like to add details of the last check in to the email from our automated build process, whenever a build fails, in order to make it easier to fix.
I need to know the files that have changed, the user that changed them, and the comment.
I've been tryi... |
|cvs|history|build-automation| |
|continuous-integration|cvs|history|build-automation| |
We did this via a perl script that dumps the changelog and you can get a free version of perl for Windows at the second link.
[Cvs2Cl script][2]
[Active Perl][1]
[1]: http://www.activestate.com/Products/activeperl/index.mhtml "Active Perl"
[2]: http://www.red-bean.com/cvs2cl/ |
Right, the FileSystemWatcher doesn't know anything about your file's contents. It'll tell you if it changed, etc. but not what changed.
Are you only adding to the file? It was a little unclear from the post as to whether lines were added or could also be removed. Assuming they are appended, the solution is pretty... |
You're right about the FileSystemWatcher. You can listen for created, modified, deleted, etc. events but you don't get deeper than the file that raised them.
Do you have control over the file itself? You could change the model slightly to use the file like a buffer. Instead of one file, have two. One is the stag... |
Try `Server.UrlEncode()`, or `System.Web.HttpUtility.UrlEncode()` for instances when you don't have access to the `Server` object |
Try `Server.UrlEncode()`, or `System.Web.HttpUtility.UrlEncode()` for instances when you don't have access to the `Server` object. You can also use `System.Uri.EscapeUriString()` to avoid adding a reference to the `System.Web` assembly. |
MFC is the most important missing thing in my opinion.
|
Inline is a compiler hint and does not force the compiler to inline the code (at least in C++). So the short answer is it's compiler and probably context dependent what will happen in your example. Most good compilers would probably inline both especially due to the obvious optimization of a constant return from both ... |
In terms of the type of shift you get, the important thing is the type of the value that you're shifting. A classic source of bugs is when you shift a literal to, say, mask off bits. For example, if you wanted to drop the left-most bit of an unsigned integer, then you might try this as your mask:
~0 >> 1
Unfo... |
Although this [similar discussion][1] was started:
We are trying this solution on one of our frequently data mined applications:
[A Better CAPTCHA Control (Look Ma - NO IMAGE!)
][2]
You can see it in action on our [Building Inspections Search][3].
You can view Source and see that the CAPTCHA is just HTML.
... |
I think it's great that Joel et al. let people use FogBugs hosted for free on their own. It's a great business strategy, because the users become fans (it is great software after all), and then they recommend it to their businesses or customers. |
I use <a href="http://sourceforge.net/projects/console/">Console</a> with <a href="http://unxutils.sourceforge.net/">unxutils</a>
Console for the tabs and easier to manage select/copy/paste
unxutils for ls, rm, grep, uniq, sort ... and other goodness. |
Some more options:
[MSYS][1]: a Minimal SYStem providing a POSIX compatible Bourne shell environment, with a small collection of UNIX command line tools. Primarily developed as a means to execute the configure scripts and Makefiles used to build Open Source software, but also useful as a general purpose command line... |
PowerShell is amazing, however for anything other than the most basic commands there is a learning curve when switching from bash etc.
I went back to using cygwin. |
I've never found anything I like more than Cygwin.
I also went ahead and installed Cygwin/X w/ Openbox so I can get something like this:
![alt text][1]
It's got multiple workspaces inside the main Openbox window so I can easily have up to 20 non-overlapping xterms that I can easily cycle through.
[1]: h... |
In my experience, positively employing defensive programming does not necessarily mean that you end up improving the quality of your code. Don't get me wrong, you need to defensively program to catch the kinds of problems that users will come across - users don't like it when your program crashes on them - but this is ... |
create table #dates (dt datetime)
insert into #dates (dt) values ('1/1/2001')
insert into #dates (dt) values ('1/2/2001')
insert into #dates (dt) values ('1/3/2001')
insert into #dates (dt) values ('1/4/2001')
insert into #dates (dt) values ('1/5/2001')
select
dt, d... |
Here's a whole catalogue of database refactorings:
[http://databaserefactoring.com/][1]
[1]: http://databaserefactoring.com/ |
If you just want to have fun, then try the Parallax Propeller chip. The HYDRA game platform looks like a blast. There's a $100 C compiler for it now.
I started on BASIC stamps, moved up through SX chips and PICs into 8051s, then 68332s, various DSPs, FPGA soft processors, etc.
8051s are more useful in the real ... |
See http://code.activestate.com/recipes/252178/:
def all_perms(str):
if len(str) <=1:
yield str
else:
for perm in all_perms(str[1:]):
for i in range(len(perm)+1):
#nb str[0:1] works in both string and list contexts
... |
One possible solution is to use the extra parens, like so, but to ditch those in the results, so you actually only _use_ 1/2 of the total restults.
for input
Hi my name is <h1>Issac</h1><% some stuff %>here<% more stuff %>
output would be
Array(
[0]=>Hi my name is <h1>Issac</h1>
[... |
One possible solution is to use the extra parens, like so, but to ditch those in the results, so you actually only _use_ 1/2 of the total restults.
this regex
$matches = preg_split("/(<|<)%[\s]*(.*?)[\s]*%(>|>)/i",$markup,-1,(PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE));
for input
... |
That's a very difficult thing to work around; A couple quick options after refactoring the database are:
<ol>
<li>Create views that match the original schema but pull from the new schema; You may need triggers here so any updates to the views can be handled.</li>
<li>Create the new schema and put in triggers on each... |
I think the basic idea is "multiple inheritance". So the idea came from C++.
|
http://www.unixwiz.net/techtips/netmask-ref.html
That will provide you with all of the logic you need to determine what you need to do. |
As far as I know, this is controlled by the user and cannot be done programmatically. |
There are tons of good ones in the AutoHotKey Forum:
[http://www.autohotkey.com/forum/forum-2.html&sid=8149586e9d533532ea76e71e8c9e5b7b][1]
[1]: http://www.autohotkey.com/forum/forum-2.html&sid=8149586e9d533532ea76e71e8c9e5b7b
How good? really depends on what you want/need. |
Managing the patch level of multiple windows systems |
|windows|system-administration|patch| |
In an environment with multiple windows servers what is the best way to ensure patch compliance accross all systems?
Is there a simple tool (some sort of client/server app?) that allows reports to be generated showing the status of all the systems so any that aren't automatically patching themselves can be fixed w... |
The nice thing about Tramp is that you only pay for that round-trip to SSH when you open the first file. Sudo then caches your credentials, and Emacs saves a handle, so that subsequence sudo-opened files take much less time.
I haven't found the extra time it takes to save burdening, either. It's fast enough, IMO. |
Where n is the number after the '/'
>>> def number_of_hosts(n):
... return 2 ** (32 - n)
...
>>> number_of_hosts(32)
1
>>> number_of_hosts(30)
4 |
Interfaces were also a central part of COM, which was a very successful technology for separating interfaces from implementation.
|
Information Hiding is hiding **both** logic and data. You should be able to change both radically and not affect users of your class.
It seems that many people understand Information Hiding in principle, but then also think that getters and setters for everything / properties for everything is an example of it.
T... |
2^(32-n) - 2, where n is your number, in this case, 30. The number n, gives you the number of bits that are covered in the address range, which gives you 32-n bits left for your network. Therefore, there are 2^(32-n) possible total addresses. You subtract 2 for the network and broadcast addresses to get your answer. |
#!/bin/sh
echo "hello world" | read var1 var2
echo $var1
echo $var2
produces no output because pipelines run each of their components inside a subshell. Subshells *inherit copies* of the parent shell's variables, rather than sharing them. Try this:
#!/bin/sh
foo="contents of shell vari... |
I've recently deployed hanfs using DRBD as the backend, in my situation, I'm running active/standby mode, but I've tested it successfully using OCFS2 in primary/primary mode too. There unfortunately isn't much documentation out there on how best to achieve this, most that exists is barely useful at best. If you do go... |