instruction
stringlengths
0
30k
Martin Fowler is a good source of information on all things design patterns including MVC. Fowler discusses Passive View and separation of responsibilities is demonstrated also http://martinfowler.com/eaaDev/ModelViewPresenter.html
It sounds to me like you are distributing the forms/reports/labels etc to the clients. If you build an EXE, then you shouldn't get the "path" problem as VFP will embed the resource (in this case icon) into the exe and will know how to extract it at runtime. Peterson
I think it's just as important for generated code to be readable and follow normal coding styles. At some point, someone is either going to need to debug the code or otherwise see what is happening "behind the scenes".
There is a massive thread available here: http://tech.groups.yahoo.com/group/flexcoders/message/58926 But essentially, google already indexes .SWF files (you can test this out yourself by restricting search results to just .SWF files). It can search any text content within the SWF file. However, if the text in...
So basically something like this: public static String appendWithDelimiter(String original, String addition, String delimiter) { if (original.equals("")) { return addition; } else { StringBuilder sb = new StringBuilder(original.length() + addition.length() + delimiter.length()); ...
See divert sockets: [Divert Sockets mini HOWTO][1]. They work by passing traffic matching a certain ipfw rule to a special raw socket that can then reinject altered traffic into the network layers. [1]: http://www.faqs.org/docs/Linux-mini/Divert-Sockets-mini-HOWTO.html
This is one of those cases where a surrogate kay pretty much *always* makes sense. There are cases where you either chose what's best for the database or what's best for your object model, but in both cases, using a meaningless key or Guid is a better idea. It makes indexing easier and faster, and it is an idenity fo...
batch program called call.cmd; call call.cmd ****** B A T C H R E C U R S I O N exceeds STACK limits ****** Recursion Count=1240, Stack Usage=90 percent ****** B A T C H PROCESSING IS A B O R T E D ******
@macbirdie: you should NOT use GetDialogBaseUnits(), it is based on the default system font (Ugly bitmap font). You should use MapDialogRect()
If performance is important and most queries are read-only, I would suggest to replicate data over to another database. While this seems like unneeded duplication of data, it might help if indexes are required. This can be done with simple on insert triggers which in turn call dblink to update another copy. There ar...
You can setup the [user dump tool][1] from Microsoft with hot keys to dump a process. However, this is a user process dump, not a kernel dump... [1]: http://support.microsoft.com/kb/241215
Wildcard Subdomain Exceptions
|php|apache|wildcard-subdomain|.htaccess|
I have a wildcard subdomain enabled and dynamically parse the URL by passing it as-is to my index.php (ex. somecity.domain.com). Now, I wish to create a few subdomains that are static where I can install different application and not co-mingle with my current one (ex. blog.domain.com). My <code>.htaccess</code>...
|php|apache|.htaccess|wildcard-subdomain|
I have a wildcard subdomain enabled and dynamically parse the URL by passing it as-is to my index.php (ex. somecity.domain.com). Now, I wish to create a few subdomains that are static where I can install different application and not co-mingle with my current one (ex. blog.domain.com). My <code>.htaccess</code>...
Per the specs, your specialized function template should never be called outside `fileA.C`, unless you `export` the template definition, which no compiler (except Comeau) currently supports (or has it planned for the forseeable future). On the other hand, once the function template is instantiated, there is a functi...
GUID's in a SLN file
Well, first off, why not: > if (var1 && var2 && var2 && var3 && var4 && var5 && var6) { > ... Also, it's very hard to refactor abstract code examples. If you showed a specific example it would be easier to identify a better pattern to fit the problem. It's no better, but what I've done in the past: ...
Well, first off, why not: > if (var1 && var2 && var2 && var3 && var4 && var5 && var6) { > ... Also, it's very hard to refactor abstract code examples. If you showed a specific example it would be easier to identify a better pattern to fit the problem. It's no better, but what I've done in the past: ...
I like to break them down by level, so I'd format you example like this: if (var1 = true && var2 = true && var2 = true && var3 = true && var4 = true && var5 = true && var6 = true){ It's handy when you have more nesting, like this (obviously the real conditions would be more...
Found an answer that works for me: ps -eo uid,pid,etime | egrep '^ *user-id' | egrep ' ([0-9]+-)?([0-9]{2}:?){3}' | awk '{print $2}' | xargs -I{} kill {} (Where _user-id_ is a specific user's ID with long-running processes.) The second regular expression matches the a time that has an optional days figure,...
How do I edit work items in the Visual Studio 2008 xml editor?
|windows|visual-studio|tfs|
I'm trying to customize some TFS work items via the VS2008 xml editor, but every time I open a work item xml file it jumps to the graphical designer. All that gives me is a "View XML" button that doesn't let you edit the xml directly.
Check out [Implementation Patterns][1] by Kent Beck. There is a particular pattern I am thinking of that may help in this situation... it is called "Guards". Rather than having tons of conditions, you can break them out into a guard, which makes it clear which are the adverse conditions in a method. So for example...
|visual-studio|windows-mobile|emulation|device|
This is one good place where Ajax techniques might be helpful. When the user clicks the submit button, show the login dialog on client side and validate with the server before you actually submit the page. Another way I can think of is showing or hiding the login controls in a DIV tag dynamically in the main page it...
1. You should be able to find the element that was clicked from the [event object](http://www.w3schools.com/htmldom/dom_obj_event.asp). Depending on your browser you might want e.target or e.srcElement. The code below is from this [w3schools example](http://www.w3schools.com/js/tryit.asp?filename=try_dom_event_srcelem...
1. You should be able to find the element that was clicked from the [event object](http://www.w3schools.com/htmldom/dom_obj_event.asp). Depending on your browser you might want `e.target` or `e.srcElement`. The code below is from this [w3schools example](http://www.w3schools.com/js/tryit.asp?filename=try_dom_event_src...
Collect the data on the page they submitted it, and store it in your backend (database?) while they go off through the login sequence, hide a transaction id or similar on the page with the login form. When they're done, return them to the page they asked for by looking it up using the transaction id on the backend, and...
Leave your plain vanilla JavaScript behind. Get JQuery--it will save you a ton of time. <http://docs.jquery.com/Selectors>
I've been using [pmset][1] to control sleep mode on my Mac for awhile now, and it's pretty easy to integrate. Here's a rough example of how you could call that program from Java to disable/enable sleep mode. Note that you need root privileges to run pmset, and therefore you'll need them to run this program. impo...
Yeah, so whatever you pass into the View is accessible in the View as ViewData.Model. But that will be just a good old object if you don't do the strongly typed Views...
This answer is heavily influenced by a convseration here: http://www.tek-tips.com/viewthread.cfm?qid=1395151&page=3 begin for x in ( select Sid, Serial#, machine, program from v$session where machine <> 'MyDatabaseServerName' )...
This answer is heavily influenced by a convseration here: http://www.tek-tips.com/viewthread.cfm?qid=1395151&page=3 begin ALTER SYSTEM ENABLE RESTRICTED SESSION; for x in ( select Sid, Serial#, machine, program from v$session wher...
It's quite possible that somebody in the future will want to go through and see what your code does. So making it somewhat understandable is a good thing. You also might want to include at the top of each generated file a comment saying how and why this file was generated and what it's purpose is.
I think that depends on how the generated code will be used. If the code is not meant to be read by humans, i.e. it's regenerated whenever something changes, I don't think it has to be readable. However, if you are using code generation as an intermediate step in "normal" programming, the generated could should have th...
Generally, if you're generating code that needs to be human-modified later, it needs to be as human-readable as possible. However, even if it's code that will be generated and never touched again, it still needs to be readable enough that you (as the developer writing the code generator) can debug the generator - if yo...
C# :How do I know when the last OutputDataReceived has arrived
|c#|asynchronous|system.diagnostics|
I have a System.Diagnostics.Process object in a program targetted at the .Net framework 3.5 I have redirected both StandardOutput and StandardError pipes and I'm recieving data from them asynchronously. I've also set an event handler for the Exited event. Once I call Process.Start() I want to go off and do other...
I adopted the Project Naming guidelines from Blitz: [Blitz Project Naming Conventions & Organizational Guidelines][1] My DEV_Source is divided in database/flash/flex directories. The Flex directory is standard to the Adobe conventions, but the flash has a custom setup. bin -- Output of SWF, contains JS and ...
go to site actions -> Site Settings -> view all site settings -> site templates and page layouts and remove the site template from the list of allowed items. Gary Lapointe may also have made an stsadm extenstion for it; check [stsadm.blogspot.com][1] Mauro Masucci [http://www.brantas.co.uk][2] [1]: http:/...
Try using two separate steps: // create a Dictionary / Set / Collection fids first, then: from f in Foo where fids.Contains(f.FooId) select f
Try using two separate steps: // create a Dictionary / Set / Collection fids first var fids = (from fb in FooBar where fb.BarID = 1000 select new { fooID = fb.FooID, barID = fb.BarID }) .ToDictionary(x => x.fooID, x => x.barID); from f in Foo wh...
Can you have virtual users using an SFTP server?
|ftp|ssh|sftp|macosx|
I've had a FTP server (Mac OS X, but not the server version) set up for a while where the users are virtual, i.e. they are not actual user accounts in the server's OS, but accounts handled by the FTP server software -- to the OS they all look like the `ftp` user account. I'd like to retire the FTP server software and g...
|macos|ftp|ssh|sftp|
How to print css applied background images with the winforms webbrowser control
|c#|winforms|printing|webbrowser|
I am using the webbrowser control in winforms and discovered now that background images which I apply with css are not included in the printouts. Is there a way to make the webbrowser print the background of the displayed document too?
I am using the webbrowser control in winforms and discovered now that background images which I apply with css are not included in the printouts. Is there a way to make the webbrowser print the background of the displayed document too? Edit: Since I wanted to do this programatically, I opted for this solution: ...
|.net|visual-studio|sln|
Visual Studio Solution files contain two GUID's per project entry. I figure one of them is from the AssemblyInfo.cs Does anyone know for sure where these come from, and what they are used for?
GUIDs in a SLN file
http://psacake.com/web/jr.asp contains full instructions, and here's an excerpt: <pre> While it may seem odd to think about purposefully causing a Blue Screen Of Death (BSOD), Microsoft includes such a provision in Windows XP. This might come in handy for testing and troubleshooting your Startup And Recovery settin...
http://psacake.com/web/jr.asp contains full instructions, and here's an excerpt: <pre> While it may seem odd to think about purposefully causing a Blue Screen Of Death (BSOD), Microsoft includes such a provision in Windows XP. This might come in handy for testing and troubleshooting your Startup And Recovery settin...
I am a php user, but the point must be that the result no matter what is HTML and HTML is styled with CSS and there is an option for your style sheets for just using the style for printing. This should be the way to do it, imho. About big tables, there isnt really a magic "fix" for that. Page will break where it brea...
I like [Dr. Dobb's Journal][1] also but the magazine refers the reader to their web site for most of the interesting articles. I have found the [Java Developer's Journal][2] very interesting because it contains articles about Java in the context of both web and enterprise applications. [1]: http://www.ddj.com/ ...
I tend to treat common libraries like this as 3rd-party resources. This allows the library to have it's own build processes, QA testing, etc. When QA (or whomever) "blesses" a release of the library, it's copied to a central location available to all developers. It's then up to each project to decide which version of t...
About the only place I agree Goto *could* be used is when you need to deal with errors, and each particular point an error occurs requires special handling. For instance, if you're grabbing resources and using semaphores or mutexes, you have to grab them in order and you should always release them in the opposite ma...
What are the advantages of using SVN over CVS?
|cvs|svn|subversion|versioncontrol|
My company currently uses CVS as our defacto standard for source control. I've heard many people say SVN is better, and know that its newer, but other than that am not sure of the benefits. I should note we use primarily java and eclipse if that matters. I guess what I'm looking for a good, succinct comparison of th...
In SQL Server, how do I identify *all* dependencies for a specific table using system tables/views?
|sql-server|database|mssql|scripting|
I am writing a DDL script to drop a number of tables but need to identify all dependencies for those tables first. Those dependencies include foreign key constraints, stored procedures, views, etc. Preferably, I want to programmatically script out dropping those dependencies using the system tables/views before droppin...
|sql-server|database|scripting|
Retaining HTTP POST data when a request is interrupted by a login page
|language-agnostic|
Say a user is browsing a website, and then performs some action which changes the database (let's say they add a comment). When the request to actually add the comment comes in, however, we find we need to force them to login before they can continue. Assume the login page asks for a username and password, and redir...
Say a user is browsing a website, and then performs some action which changes the database (let's say they add a comment). When the request to actually add the comment comes in, however, we find we need to force them to login before they can continue. Assume the login page asks for a username and password, and redir...
You seem to be closing the connection properly - except for the case where prepStmt.close() throws a SQLException, I can't find a connection leak. What pool implementation are you using? When you close a connection, the pool need not close the underlying MySQL connection immediately - after all that is the point of ...
Querying XML columns in SQLServer 2005
|sql-server|xml|xquery|
There is a field in my company's "Contacts" table. In that table, there is an XML type column. The column holds misc data about a particular contact. EG. <contact> <refno>123456</refno> <special>a piece of custom data</special> </contact> The tags below `contact` can be different for each cont...
There is a field in my company's "Contacts" table. In that table, there is an XML type column. The column holds misc data about a particular contact. EG. <contact> <refno>123456</refno> <special>a piece of custom data</special> </contact> The tags below `contact` can be different for each cont...
There is a field in my company's "Contacts" table. In that table, there is an XML type column. The column holds misc data about a particular contact. EG. <contact> <refno>123456</refno> <special>a piece of custom data</special> </contact> The tags below `contact` can be different for each cont...
There's no shortage of processors willing to store your CC info and exchange it for a token with which you can bill against the stored number. That gets you out of PCI compliance, but still allows on demand billing. Depending on *why* you need to store the CC, that may be a better alternative. Most companies refer t...
If you're just looking for packet capture, libpcap is very popular. It's used in basic tools such as tcpdump and ethereal. As far as "hooking into the stack", unless you plan on fundamentally changing the way the way the networking is implemented (i.e. add your own layer or alter the behavior of TCP), your idea of usin...
<a href="http://commons.apache.org/">Apache commons</a> StringUtils class has a join method.
Don't know if this really is any better, but at least it's using StringBuilder, which may be slightly more efficient. Down below is a more generic approach if you can build up the list of parameters BEFORE doing any parameter delimiting. // Answers real question public String appendWithDelimiters(String delimi...
Using winAPI's you can do almost anything you want and really fast too. It takes some time to figure it out but it works. Go to MSDN, lookup MessageBox(), check out DialogBox() and go from there. I personally do not care for MFC by the way. If you want to use an MFC like approach I'd recommend Borland's C++ Builder...
SELECT cols FROM table WHERE cols IS NULL
While you can use a regular expression to parse the data between opening and closing tags, you need to think long and hard as to whether this is a path you want to go down. The reason for it is the potential of tags to nest: if nesting tags could ever happen or may ever happen, the language is said to no longer be reg...
Greg's answer has the problem that it will modify the original array as the $_ are passed aliased. You need: @filtered = map {my ($new = $_) =~ s/&nbsp;//g; $new} @outdata;
I'm not sure I understand completely what you need to accomplish, but it might helpful to setup virtual domains within your Apache configuration file. You can map them to folders on the drive with different applications installed. Each virtual domain is treated much like a root directory. I have my development environm...
If you want to work with objects (with introspection!), take a look at Fey::ORM which implements ORM based on Moose. It's also has very SQL like syntax so it fits my RDBMS-based brain a bit better than some of other ORM frameworks.
First, let me say that SSIS is your best bet. But, to answer the question you asked... I don't believe you will be able to get away with creating new id's all around, although you could but you would need to take the original IDs to use for lookups. The best you can get is one insert statement for table. Here is ...
|svn|subversion|source-control|cvs|
|svn|version-control|cvs|
My company currently uses CVS as our defacto standard for source control. I've heard many people say SVN is better, and I know that it's newer, but other than that am not sure of the benefits. I should note we use primarily java and eclipse if that matters. I guess what I'm looking for is a good, succinct comparison...
I think something like this should work (but it's untested): $("input[@type='radio']").each(function(i) { if (this.val() == 'E') { radioClicks(); this.get().checked = true; } } $("input[@type='radio']").click(radioClicks);
$(function() { $('input').attr('type:radio').click(radioClicks); });
$(function() { $('input[@type="radio"]').click(radioClicks); });
$(function() { $('#myForm :radio').each(function() { if ($(this).value == 'S') { $(this).attr("checked", true); radioClicks(); } $(this).click(radioClicks); }); });
I also enjoy Dr. Dobb's Journal. But hey, there's a way to leech it for free (at the time of writing, anyway): http://pages.nxtbook.com/nxtbooks/cmp/ddjMMYY/offline/cmp_ddjMMYY_pdf.zip Replace MM and YY with month and year. They're available 8/2006 to date.
Gorgapor, mod_rewrite still often utilizes get. It just allows to translate a friendlier URL into a URL with a GET query string.