instruction
stringlengths
0
30k
What's the DRY issue with defining the attachment_fu settings twice? Unless the files are of the same type and being stored in the same place, you're not going to be repeating anything in the configuration. Sure, you'll have two has_attachment declarations, but the options will mostly differ (one declaration for...
see this example of how reader macros can extend the lisp reader with complex tasks like XML templating: [http://common-lisp.net/project/cl-quasi-quote/present-class.html][1] this **user library** compiles the static parts of the XML into UTF-8 encoded literal byte arrays at compile time that are ready to be writ...
Extreme Programming
|xp|extreme|agile|
As developers and as professional engineers have you been exposed to the tenants of Extreme Programming as defined in the "version 1" by Kent Beck. Which of those 12 core principles do you feel you have been either allowed to practice or at least be a part of in your current job or others? * Pair programming[5]...
|agile|xp|extreme-programming|
WPF UI's are easier to design implement and maintain than the current C# alternatives, so if a lot of your codebase is responsible for handling UI, migrating may serve beneficial-- as in, you'll find your team will save time in dealing with their UI layer. If most of your code is business logic, it won't help all that ...
- Self-contained modules that have yet to be started - Lacking development tools they can integrate (like an automated build manager) Primarily I'm thinking of things that let them stay out of the currently developing people's way. I do agree with Mythical Man-Month, but I also think there are exceptions to ever...
We are following these practices you've mentioned: - Planning game - Test driven development - Whole team (being empowered to deliver) - Continuous integration - Refactoring or design improvement - Small releases - Coding standards - Collective code ownership - Simple design And I m...
I have P & G-- how do I use the Wincrypt API to generate a Diffie-Hellman keypair?
|cryptography|diffie-hellman|wincrypt|
There's an MSDN article [here](http://msdn.microsoft.com/en-us/library/aa919730.aspx), but I'm not getting very far: p = 139; g = 5; CRYPT_DATA_BLOB pblob; pblob.cbData = sizeof( ULONG ); pblob.pbData = ( LPBYTE ) &p; CRYPT_DATA_BLOB gblob; gblob.cbData = sizeof( ULONG ); g...
haystack.magnet().filter(needle);
Linq 2 SQL on shared host
|linq-to-sql|hosting|shared|
I recently ran into an issue with linq on a shared host. The host is Shared Intellect and they support v3.5 of the framework. However, I am uncertain to whether they have SP1 installed. My suspicion is that they do not. I have a simple "News" table that has the following structure: NewsID unique...
I was actually trying to do this today, and I found typing this into the interpreter worked: (EXT:SAVEINITMEM "executable.exe" :QUIET t :INIT-FUNCTION 'main :EXECUTABLE t :NORC t) where main is the name of the function you want to call when the program launches, :QUIET t suppresses the startup banner, and :EX...
To second @John Downey, I've gotten connectivity to work with PHP on an AS/400 with unixODBC. Check your phpinfo() to see if unixODBC is available in it. I didn't have to compile it in on SLES 10.
I can help with the Linux version: the function backtrace, backtrace_symbols and backtrace_symbols_fd can be used. See the corresponding manual pages.
How can I get Google Charts to display multiple colors in a scatter chart?
|google|charts|scatter|
I would like to display multiple colors (and potentially shapes and sizes) of data points in a Google Chart scatter chart. Does anyone have an example of how to do so? Thanks, Kent Beck
Bah, you young kids and your new-fangled garbage collectors... Very strong rules on "ownership" - what object or part of the software has the right to delete the object. Clear comments and wise variable names to make it obvious if a pointer "owns" or is "just look, don't touch". To help decide who owns what, fo...
Easiest, probably a small python script that will use something like os.walk to go through all the files below a folder and then use [pyexiv2][1] to actually read and then modify the EXIF data. A tutorial on pyexiv2 can be found [here][2]. [1]: http://tilloy.net/dev/pyexiv2/index.htm [2]: http://tilloy.net/d...
When I run into these I write a script to do the conversion rather than trying to do it in SQL. It is typically much faster and easier for me. Pick any language you are comfortable with.
You could probably get clever and query the system tables for the column names, and then build a dynamic query string to execute, but honestly that will probably be uglier than a quick script to generate the SQL statements for you. Hopefully you don't have too much dynamic SQL code that accesses the old tables burie...
We wrap all our allocation functions with a layer that appends a brief string at the front and a sentinel flag at the end. So for example you'd have a call to "myalloc( pszSomeString, iSize, iAlignment ); or new( "description", iSize ) MyObject(); which internally allocates the specified size plus enough space for your...
Widget notifying other widget(s)
|gwt|
How should widgets in GWT inform other widgets to refresh themselfs or perform some other action. Should I use sinkEvent / onBrowserEvent? And if so is there a way to create custom Events?
Can you be more specific? This may fall under "policies and procedures" management software. Here are some: http://www.softscout.com/software/Human-Resources/Policy-and-Procedures.html I'd like to find one that's more wiki-like or easier to integrate into a a website serving as a more general company knowlege b...
PHP set up as a cron job lets you keep it in your source code management system, and if you're using a database abstraction layer it'll be portable to other databases if you ever decide to switch. For those reasons, I tend to go with scripts over stored procedures.
If the volume of data is big enough that calculating it on the fly is too much, then either: 1. Cron job with php script to denormalise the totals 2. Trigger on inserts that increments totals
Go with the **cron job** way. Simple, solid, works. In the PHP/MySQL world I would say stored procedures are no-go.
I saw this in the "Notes" section of the [PHP documentation][1]: > **If** you're using PHP with Oracle Instant Client, you can use easy connect naming method (...) So I think it's rather clear that you can connect to an Oracle DB without the Oracle Instant Client, using only the PHP Oracle extension. [1]: h...
there are a couple of steps you need to go through to make this work. First, you need to install the oracle driver for whatever OS you have. Then, create a DSN for odbc to use to connect the php function call to the oracle database. On windows, you can find this on the Control Panel -> ODBC Sources Once you hav...
This isn't the definitive argument, by any means, but with CSS you can take the same markup and change the layout depending on medium, which is a nice advantage. For a print page you can quietly suppress navigation without having to create a printer-friendly page, for example.
Logging activities in multithreaded applications
|java|logging|log4j|
I have a layered application in Java which has a multi thread data access layer which is invoked from different points. A single call to this layer is likely to spawn several threads to parallelize requests to the DB. What I'm looking for is a logging tool that would allow me to define "activities" that are compose...
What's the best way to return variables from a syncExec?
|swt|java|multithreading|
In my SWT Java app I often want to return information from inside a Display.syncExec() call. The best way I've found so far to do this is: ArrayList<Integer> result = new ArrayList<Integer>(); GUI.display().syncExec(new Runnable(){ public void run() { MessageBox mb = /* ... */; /* set up m...
|java|multithreading|swt|
In my SWT Java app I often want to return information from inside a Display.syncExec() call. The best way I've found so far to do this is: final ArrayList<Integer> result = new ArrayList<Integer>(); GUI.display().syncExec(new Runnable(){ public void run() { MessageBox mb = /* ... */; /* se...
Rhino Mocks: Is there any way to verify a constraint on an object property's property?
|.net|rhino-mocks|
If I have class ObjA { public ObjB B; } class ObjB { public bool Val; } and class ObjectToMock { public DoSomething(ObjA obj){...} } Is there any way to define an expectation that not only will DoSomething get called but that obj.B.Val == true? I have tr...
This worked, but now if I sort twice, on the first one it sorts, and then does the popup as the first selected item of the grid . If I close the popup grid, and then try to sort a second time, it stack overflows, and crashes firefox out. I'm thinking I may need to rethink working in silverlight until the system get...
I have implemented solutions like [Walking Disaster][1]'s before, but his StreamWrapper code doesn't take into account if the Dispose() methods called on the member variables throw an exception for one reason or another, the subsequent Dispose()es will not be called and resources could dangle. The safer way for that o...
You can get away with just calling csc.exe on the pre-build event if you don't want to mess with the .proj file directly and add build events.
If you send your Ajax requests to a different subdomain they won't interfere with the connection limit of your regular pages. It will cost an extra DNS lookup though
It depends on if you want a truncating conversion or a rounding one and at what precision. By default, C will perform a truncating conversion when you go from float to int. There are FPU instructions that do it but it's not an ANSI C conversion and there are significant caveats to using it (such as knowing the FPU roun...
If I've understood what you'd like to do, you'll need to write a Gecko plugin. Via a plugin, you will be able to register your own MIME type and then manipulate Javascript & the DOM. The information you're after is available on Mozilla's developer website: - [Gecko Plugin API Reference][1] - [Plug-in Basics][2]...
If I've understood what you'd like to do, you'll need to write a Gecko plugin. Via a plugin, you will be able to register your own MIME type and then manipulate Javascript & the DOM. This means you would need to include an `<object />` or `<embed />` tag on the page to load your plugin, but you could then look for `...
If you would like another means of running the function, try the following: Dim obj As New Access.Application obj.OpenCurrentDatabase (CurrentProject.Path & "\Working.mdb") obj.DoCmd.RunMacro "MyMacro" obj.CloseCurrentDatabase Set obj = Nothing Where '**MyMacro**' has an action of '*...
This is a loaded question :) There's a couple of database programming architecture designs you should know of, and what their costs/benefits are. 2 Tier generally means you have a client connecting to a DB, issuing direct SQL calls. 3 Tier generally means you have an "application server" that is issuing direct SQL c...
getting this: problem PHP Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for chris.mahan@gmail.com in c:\inetpub\wwwroot\mailtest.php on line 12 from this page: <?php $to = "chris.mahan@gmail.com"; $subject = "test"; $body = "this is a test"; if ...
getting this: problem PHP Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for chris.mahan@gmail.com in c:\inetpub\wwwroot\mailtest.php on line 12 from this page: <?php $to = "chris.mahan@gmail.com"; $subject = "test"; $body = "this is a test"; if ...
|php|iis|smtp|
getting this: problem PHP Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for chris.mahan@gmail.com in c:\inetpub\wwwroot\mailtest.php on line 12 from this page: <?php $to = "chris.mahan@gmail.com"; $subject = "test"; $body = "this is a test"; if ...
Beside the fact that the volatile keyword is used for telling the compiler not to optimize the access to some variable (that can be modified by a thread or an interrupt routine), it can be also **used to remove some compiler bugs** -- *YES it can be* ---. For example I worked on an embedded platform were the compile...
( revised ) how to generate a stacktrace when my C++ app crashes ( using gcc compiler )
|stack|trace|crash|c++|assert|
When my c++ app crashes I would like to generate a stacktrace. I already asked this but I guess I needed to clarify my needs. My app is being run by many different users and it also runs on Linux, Windows and Macintosh ( all versions are compiled using gcc ). I would like my program to be able to generate a st...
How to generate a stacktrace when my gcc C++ app crashes
|c++|gcc|crash|assert|stack-trace|
A simple database like SQLite sounds appropriate - it will let you store file metadata in a consistent, transactional way. Then store the path to each image in the database and let the file system do what it does best - manage files. The newest version of SQL Server has a data type built for in-database files, but t...
Our CMS stores all of the check images we process. It uses a database for metadata and lets the file system handle the scanned images. A simple database like SQLite sounds appropriate - it will let you store file metadata in a consistent, transactional way. Then store the path to each image in the database and let ...
Rather than using raw sockets, some applications use a higher numbered tcp or udp port. By directing that tcp port at port 80 on a known webserver, you could traceroute to that server. The downside is that you need to know what ports are open on a destination device to tcpping it.
How about this one <http://sourceforge.net/projects/sqlitebrowser/>: > SQLite Database browser is a light GUI editor for SQLite databases, built on top of QT. The main goal of the project is to allow non-technical users to create, modify and edit SQLite databases using a set of wizards and a spreadsheet-like interfa...
Do a project you can get **involved** in and passionate about. Hopefully a product you use every day.
> I guess it's true that using the table element for layout has little to do with tabular data. So what? Does my boss care? Do my users care? Google and other automated systems **do** care, and they're just as important in many situations. Semantic code is easier for a non-intelligent system to parse and process.
CausesValidation is set to "False" but the client side validation is still firing
|asp.net|c#|validation|javascript|
I have several RequiredFieldValidators in an ASP.NET 1.1 web application that are firing on the client side when I press the Cancel button, which has the CausesValidation attribute set to "False". How can I get this to stop? I do not believe that Validation Groups are supported in 1.1. Thanks Mark
I have several RequiredFieldValidators in an ASP.NET 1.1 web application that are firing on the client side when I press the Cancel button, which has the CausesValidation attribute set to "False". How can I get this to stop? I do not believe that Validation Groups are supported in 1.1. Here's a code sample: ...
|c#|asp.net|javascript|validation|
I have several RequiredFieldValidators in an ASP.NET 1.1 web application that are firing on the client side when I press the Cancel button, which has the CausesValidation attribute set to "False". How can I get this to stop? I do not believe that Validation Groups are supported in 1.1. Here's a code sample: ...
I think your hope is woefully naive. Specifically, it needs to deal with the issue that Integer can potentially be null, whereas int can not be. That alone is reason enough to store the object pointer. That said, the actual object pointer will be to a immutable int instance, notably for a select subset of integers. ...
persistence.xml not found during maven testing
|java|testing|maven-2|automated-tests|jpa|
I'm trying to load test data into a test DB during a maven build for integration testing. persistence.xml is being copied to `target/test-classes/META-INF/` correctly, but I get this exception when the test is run. > javax.persistence.PersistenceException: > No Persistence provider for > EntityManager named aimDat...
Public Shared Function LoadALLUsersInRole(ByVal Code As Integer, ByVal Role As String) As ArrayList Dim pb As ProfileBase Dim usersArrayList As New ArrayList Dim i As Integer Dim AllUsersInRole() As String = Roles.GetUsersInRole(Role) For i = 0 ...
Public Shared Function LoadALLUsersInRole(ByVal Code As Integer, ByVal Role As String) As ArrayList Dim pb As ProfileBase Dim usersArrayList As New ArrayList Dim i As Integer Dim AllUsersInRole() As String = Roles.GetUsersInRole(Role) For i = 0 ...
s/###(.*?)###/ if you want the ###'s then you need s/(###.*?###)/ for playing around with regular expressions. I highly recommend http://www.weitz.de/regex-coach/ for windows. you can type in the string you want and your regular expression and see what it's actually doing. Your selected text will be...
Stating your requirement/spec might help arrive at the 'best design'. Your question is too 'subject-to-reader-interpretation' at the moment.
Qt includes an example screenshot app in examples\desktop\screenshot. Qt works on a range of platforms, including MacOSX. <http://trolltech.com/products/qt/>
x = {'a':1, 'b': 2} y = {'b':10, 'c': 11} z = dict(x.items() + y.items()) print z For items with keys in both dictionaries ('b'), you can control which one ends up in the output by putting that one last.
In your case, what you can do is: z = dict(x.items() + y.items()) This will, as you want it, put the final dict in z, and make the value for b be properly overridden by the second dict's value: >>> x = {'a':1, 'b': 2} >>> y = {'b':10, 'c': 11} >>> z = dict(x.items() + y.items()) >>> z ...
**For C#**: - [CLR via C#][1] - [C# in Depth][2] [1]: http://www.amazon.com/CLR-via-Second-Pro-Developer/dp/0735621632 [2]: http://www.manning.com/skeet/
**For C#**: - [CLR via C#][1] ![alt text][2] - [C# in Depth][3] ![alt text][4] [1]: http://www.microsoft.com/MSPress/books/6522.aspx [2]: http://www.microsoft.com/MSPress/books/imgt/6522.gif [3]: http://www.manning.com/skeet/ [4]: http://www.manning.com/skeet/skeet_cover150.jpg
Here's a scenario you should think about: Composition (the 2nd example) is preferable if the same User can be both an Employee and a Member. Why? Because for two instances (Employee and Member) that represent the same User, if User data changes, you don't have to update it in two places. Only the User instance conta...
Yes private assemblies ***DO NOT** require* reset of the IIS. So you should just xcopy new version to the application's Bin directory and refresh the page. But there are some trade offs. You should increase trust level in application web.config file: <system.web> ... <trust level="WSS_Medium" originUrl="" ...
Yes private assemblies ***DO NOT** require* reset of the IIS. So you should just to *xcopy* new version to the application's Bin directory and refresh the page. But there are some trade offs. You should increase trust level in application web.config file: <system.web> ... <trust level="WSS_Medium" originUr...
Yes private assemblies ***DO NOT** require* reset of the IIS. So you should just to *xcopy* new version to the application's Bin directory and refresh the page (i.e. by VS post build event as I did). But there are some trade offs. You should decrease trust level in application web.config file: <system.web> .....
Generally, you can trust the compiler to be efficient and correct. There is usually nothing to be gained by rolling your own functions for something that already exists in the compiler.
generate a random, something fairly long, then tack the score to the end, and maybe the name or something else static, then sha1/md5 it, and pass both to the server, verify that the random hashes, to be equal to the hash. After-thought: If you want to make it harder to reverse engenier, then multiply your random by ...
Optimisation is what makes JVMs viable as environments for long running applications, you can bet that SUN, IBM and friends are doing their best to ensure they can optimise your bytecode and JIT-compiled code in an efficient a manner as possible. With that being said, if you think you can pre-optimise your bytecode ...
Though I haven't personally tested, I have good reason to believe that the above stated AT COMMAND solution will work for XP, 2000 and Server 2003. Per my and Bryant's testing, we've identified that the same approach does not work with Vista or Windows Server 2008 -- most probably due to added security and the /interac...