instruction
stringlengths
0
30k
If it's a programming language you want then I'd say something which is known for string processing power so that would mean perl. However the task you require can be rather complicated since you need to 'know' the language, so you would require to follow the same steps the compiler does, being lexical and grammatic...
Start with each include file, and ensure that each include file only includes what is necessary to compile itself. Any include files that are then missing for the C++ files, can be added to the C++ files themselves. For each include and source file, comment out each include file one at a time and see if it compiles...
This tutorial from the [java lobby][1] is easy to follow. The online [Swing trail for JTable][2] that you reference indicates that it has been updated. Did you scan through the whole thing for possible better (isn't newer always better) information? [1]: http://www.javalobby.org/articles/jtable/ [2]: http:/...
This is an issue of upbringing. If somewhere in your educational or professional career you spent time feeding and caring for databases (or worked closely with talented folks who did), then the fundamental tenets of entities and relationships are well-ingrained in your thought process. Among those rudiments is how/wh...
In building a few iterations of CMSs, some of the key things turned out to be: - Having a good rich text editor - end-users really don't want to do HTML. Consensus seems to be that FCKEditor is the best - there have been a couple of questions on this here recently - Allowing people to add new pages and easily c...
Are you not using the [XmlSerializer][1]? It's pretty damn good and makes doing things like this real easy (I use it quite a lot!). You can simply decorate your class properties with some attributes and the rest is all done for you.. Have you considered using XmlSerializer or is there a particular reason why not?...
Are you not using the [XmlSerializer][1]? It's pretty damn good and makes doing things like this real easy (I use it quite a lot!). You can simply decorate your class properties with some attributes and the rest is all done for you.. Have you considered using XmlSerializer or is there a particular reason why not?...
Without knowing the exact structure of your tables or what type of database you're using it's hard to answer. However if you're using MS SQL and if you have a true date/time field that has different times that the records were entered on the same date then something like this should work: select record_id, ...
You should check out Reflection and the Activator class. They will allow you to create objects from strings. Granted, the object has to be in one of the assemblies that you have access to.
Here are a couple of factors to consider: - Can you modify or extend the <code>Thing</code> class. If not, use the former - Can <code>Thing</code> be instantiated. If not, use the later as a static method - If <code>Thing</code> actually get modified (i.e. has properties that change), prefer the latter. If <...
Hibernate does/can use bytecode generation (CGLIB) so that it knows a field is dirty as soon as you call the setter (or even assign to the field afaict). This immediately marks that field/object as dirty, but doesn't reduce the number of objects that need to be dirty-checked during flush. All it does is impact the i...
What is generally understood under the term "Persistence Ignorance" is that your entity classes are not being flooded with framework dependencies (important for N-tier scenarios). This is not the case right now, as entity classes must implement certain EF interfaces ("IPOCO"), as opposed to plain old CLR objects. As an...
They are not actually mutually exclusive, though to your point they usually are so. The advantage of using Object Relational mapping is that you can swap out data sources. Not only database structure, but you could use any data source. With advent web services / Service-oriented architecture / ESB's, in a larger c...
I assume you mean call forwarding? In general terms, the [Telephony API (TAPI)][1] is used for programmatically controlling the phone interface. Call forwarding is specifically handled by [TSPI_lineForward][2]. Microsoft does not offer any built-in or SDK tools for managed developers to use TAPI, and the structure...
Start > Run > cmd.exe (this works in XP and Vista): `ipconfig /all` This displays all info about the interfaces in your computer. The "public" facing interface should have a public IP address. For starters, **it should not** be 192.168.x.x or 10.x.x.x :)
To answer your question I don't believe that there's such a standard as WikiML as Till called it. As strange as it sounds, I've investigated screen scraping a wiki for a co-worker to help him port it to another wiki engine. It turned out that screen scraping would have been easier, quicker and more efficient to writ...
Best way to avoid code injection in PHP
|php|security|code-injection|
My website was recently attacked by, what seemed to me as, an innocent code: <?php if ( isset( $ _GET['page'] ) ) { include( $ _GET['page'] . ".php" ); } else { include("home.php"); } ?> There where no SQL calls, so I wasn't afraid for SQL Injection. But, apparently...
Since each User-Widget combination is unique, you should represent that in your table by making the combination unique. In other words, go with option 2. Otherwise you may have two entries with the same widget and user IDs but different user-widget IDs.
You don't have to have a certificate on your server; it's up to the client whether they are willing to talk to an unauthenticated server. Key agreement can still be performed to establish a private channel. It wouldn't be safe to send private credentials to an unauthenticated server though, which is why you don't see S...
If you use preg_match, use the U flag to make it non-greedy. preg_match("/<p>(.*)<\/p>/U");
If you use preg_match, use the U flag to make it non-greedy. preg_match("/<p>(.*)<\/p>/U", $paragraph);
Ahh, hmm, ATTACH, ok, let me try this once more... Hang on... --- Try the command: .HELP And you'll see that the command to see a pure schematic representation of your database is: .SCHEMA And to dump a table: .DUMP tablename To dump all tables, just ommit the tablename from the .D...
It appears you need to go through the *sqlite_master* table, like this: SELECT * FROM dbname.sqlite_master WHERE type='table'; And then manually go through each table with a SELECT or similar to look at the rows. The .DUMP and .SCHEMA commands doesn't appear to see the database at all.
create table Places ( add Name varchar(30), add Priority bit ) select Name from Places order by Priority desc, Name
Create work mandates that define the problem that needs solving. Your work is constrained by only needing to implement that which is necessary to solve the problem. Any further refinement of the problem then becomes change control.
We follow wireframes in my office. Any change after signoff has to go through a Change Control procedure.
I have used it for convenience for a very small project. It did what I wanted and saved me a couple of days work. The main problem I found was when it came to customising or extending the generated project. You have to spend quite a bit of time trying to understand Ironspeed's way of doing things which, I'll admit, ...
Usually Visual Studio is good at knowing what needs to be compiled for you. If you have multiple projects in a solution then just make sure your solution dependencies are set up correctly and it should just work when you hit Build.
If you want to execute something before the form is posted, for confirmation for example, try the form event onSubmit. Something like: myform.onsubmit = function(){confirm("really really sure?")};
Definitely **ORMs**. More flexible, more portable (generally they tend to have portability built in). In case of slowness you may want to use caching or hand-tuned SQL in hot spots. Generally stored procedures have several problems with maintainability. - separate from application (so many changes have now to be ...
On a recent project that I worked on we used mock objects extensively in our unit testing approach. The project was 100% Java and moderately sized (about 100,000 lines of non-commented code). It was a Swing-based desktop application - and the only effective way that we found to test the user interface logic was through...
Experience. Learn the patterns and real-world examples of their uses. Every time you have a design decision to make, think if a pattern you know would apply to it. Over time, you get better and you discover new ways to apply the patterns to a wider range of problems.
Haskell has a relatively recent language-c project <http://www.sivity.net/projects/language.c> which allows the analysis of C code. If you are familiar with Haskell, then it might be worth a look. Even if you are not, it might be interesting to have a go.
Another great book I found was: Refactoring to Patterns By showing when, where and how you can alter existing code to patterns, it gave me a much better understanding of the concepts, and an ability to identify where they can be used.
Check this From Apple Desicion on APP.![alt text][1] [1]: http://www.geekculture.com/joyoftech/joyimages/1151.jpg
You're opening a big can of worms, this isn't an effective use of your time, blah blah blah, etc. Moving on to an answer, if you're talking about anything beyond trivial analysis and you need accuracy, you will need to parse the C source code. You can do that in any language, but you will almost certainly want to ge...
How did you learn when to use an if statement? I liken it to that because its a larger construct that you need to know the ins and outs of before you can use it effectively. An if statement solves a class of problems needing branching. A bridge pattern solves a class of problems. I really don't view them any diff...
As far as I can see, it'd only be useful from an organizational standpoint. I can't really conceive of any logical value in doing that. Perhaps someone will have a proper example.
getTimeZoneOffset() and toLocaleString are good for basic date work, but if you need real timezone support, look at [Fleegix's Date class](http://js.fleegix.org/plugins/date/date). From the description: > The fleegix.date.Date object gives you full-blown timezone support, independent from the timezone set on the end...
Lex/yacc are appropriate for building parsers.
- [http://www.informit.com/articles/article.aspx?p=605369][1] - [http://www.codeproject.com/KB/cs/genericcache.aspx][2] [1]: http://www.informit.com/articles/article.aspx?p=605369 [2]: http://www.codeproject.com/KB/cs/genericcache.aspx
One reason for doing this is that the variables 'z' and 'zz' would not be available to code below the end of that inner block. When you do this in Java, the JVM pushes a stack frame for the inner code, and those values can live on the stack. When the code exits the block, the stack frame is popped and those values go a...
swfObject + scriptaculous Autocompleter = Fail
|javascript|scriptaculous|swfobject|
For some reason the combination of swfobject.js and script.aculo.us Ajax.Autocompleter on the same page causes the latter to fail. Autocompleter doesn't make its Ajax request. A separate Ajax control on the same page that uses Ajax.Updater doesn't seem to have the same problem.
Exactly one return from any function. That way you can do deallocation there and never miss it. It's too easy to make a mistake otherwise: new a() if (Bad()) {delete a; return;} new b() if (Bad()) {delete a; delete b; return;} ... // etc.
Even if you aren't working in an OO language, where you would have Thing.DoSomething(), for the overall readability of your code, having a set of functions like: ThingDoSomething() ThingDoAnotherTask() ThingWeDoSomethingElse() then AnotherThingDoSomething() and so on is far better. All the code that wo...
ether backup your database logs regularly if you need to recover up to the minute or do other fun stuff like log shipping in the future, or set the database to simple mode and shrink the data file. DO NOT copy, rename, or delete the .ldf file this will break your database and after you recover from this you may hav...
In general, if "something" is an action that "thing" naturally knows how to do, then you should use thing.doSomething(). That's good OO encapsulation, because otherwise DoSomethingToThing(thing) would have to access potential internal information of "thing". For example invoice.getTotal() If "something" is not n...
Try changing the SqlConnection's timeout property, rather than that of the command
You can attach an event handler to AppDomain.CurrentDomain.AssemblyResolve to take part in the process. Your EventHandler should return the assembly that is responsible for the type passed in the ResolveEventArgs. You can read more about it at [MSDN][1] [1]: http://msdn.microsoft.com/en-us/library/system.a...
Have you tried watching [Ayende's Hibernating Rhinos on IT][1]? Seems like he himself isn't all that happy with it. [1]: http://www.ayende.com/Blog/archive/2007/12/19/Hibernating-Rhinos-7-Rhino-Igloo.aspx
If you ask 100 different CMS users about the most important thing about their CMS, you'll probably get 80+ different answers. The biggest roadblock is probably going to be people asking you why you built a new CMS from scratch. If you don't know the answer to that question, I'm not sure why you're going down this ...
ALT.NET is more of an attitude than a set of tools and practices. I don't know that you can "get someone started with ALT.NET," per se.
ALT.NET is more of an attitude than a set of tools and practices. I don't know that you can "get someone started with ALT.NET," per se. ---------- To me it is an attitude born of experience, not something you can put on like a coat. But that is *my* opinion, subject to change.
Something like this? $vals = explode(":", $duration); if ( $vals[0] == 0 ) $result = $vals[1] . " minutes, " . $vals[2] . " seconds"; else $result = $vals[0] . "hours, " . $vals[1] . " minutes, " . $vals[2] . " seconds";
Something like this? $vals = explode(':', $duration); if ( $vals[0] == 0 ) $result = $vals[1] . ' minutes, ' . $vals[2] . ' seconds'; else $result = $vals[0] . 'hours, ' . $vals[1] . ' minutes, ' . $vals[2] . ' seconds';
For X (Linux/Unix), there's [X11::GUITest](http://search.cpan.org/perldoc?X11::GUITest). For Windows, there's [Win32::CtrlGUI](http://search.cpan.org/perldoc?Win32::CtrlGUI), although it can be a bit tricky to install its prerequisites.
I wonder if num_rows() is reporting relative to the current resultset. Try capturing num_rows() prior to fetching the data. e.g. if($statement->prepare($query)) { $statement->execute(); $statement->store_result(); echo $statement->num_rows(); $statement->bind_result($name...
Sounds like you need to write a [Winsock LSP][1]. > Once in the stack, a Layered Service Provider can intercept and modify inbound and outbound Internet traffic. It allows processing all the TCP/IP traffic taking place between the Internet and the applications that are accessing the Internet. [1]: http://en.w...
SAP ABAP programming? "Teach Yourself ABAP in 21 Days" is the best book! It contains no clever tricks or wizardry, but after 3 years, I never came upon a more comprehensive book
I completely agree with pjz. There is no one right way to design software. If you take TDD to an extreme, without any forethought except the next unit test, you may make things harder on yourself. Ditto for the person who sets out on a grand software project by spending months on diagrams and documentation, but no code...
I am in agreement with John, in your scenario you are looking at least 30 seconds of delay, I would say that it is nearly real time.
You need to use a decompiler. Others have suggested JAD, there are other options, JAD is the best. I'll echo the comments that you may lose a bit compared to the original source code. It is going to look especially funny if the code used generics, due to erasure.
Find minimal necessary java classpath
|java|jar|dependencies|
Is there a tool to detect unneeded jar-files? For instance say that I have myapp.jar, which I can launch with a classpath containing hibernate.jar, junit.jar and easymock.jar. But actually it will work fine using only hibernate.jar, since the code that calls junit.jar is not reachable. I realize that reflection m...
|java|dependencies|jar|
Is there a tool to detect unneeded jar-files? For instance say that I have myapp.jar, which I can launch with a classpath containing hibernate.jar, junit.jar and easymock.jar. But actually it will work fine using only hibernate.jar, since the code that calls junit.jar is not reachable. I realize that reflection m...
You never need to loop to find this out. For determining the "last Friday" date for this month, start with the first day of next month. Subtract the appropriate number of days depending on what (numerical) day of the week the first day of the month falls on. There's your "last Friday." I'm pretty sure it can be boil...
That depends on the implementation, if it will be distributed I would go with Java, seeing as you know that, because of its portability. If it is just for internal use, or will be used in semi-controlled environments, then go with whatever you are the most comfortable maintaining, and whichever has the best long-term ...
I agree that there are pros and cons to everything and a lot depends on your architecture. That being said, I try to use ORM's where it makes sense. A lot of the functionality is already there and usually they help prevent SQL Injection (plus it helps avoid re-inventing the wheel). Please see these other two posts o...
You could use an Integer[1] array to make it more concise but I don't think it can directly update a non-final variable from inside an anonymous inner class. final Integer[] result = new Integer[1]; I thought that you had to declare results as final (but that change wouldn't affect your code). Since the curr...
Trying to test Sharepoint it seems that mocking is the only way, and only [typemock][1] will let you mock sealed classes. [1]: http://www.typemock.com/
You can also use os.path.isfile(fname) if you need to be sure it's a file.
You can also use import os.path os.path.isfile(fname) if you need to be sure it's a file.
Ever since SQL 2005 included windowing functions and other neat features, I've been able to eliminate cursors in almost all instances. Perhaps your problem would best be served by eliminating the cursor itself? Definitely check out Ranking functions <http://msdn.microsoft.com/en-us/library/ms189798.aspx> and Agg...
It is NOT an exception if the username is not valid or the password is not correct. Those are things you should expect in the normal flow of operation. Exceptions are things that are not part of the normal program operation and are rather rare.
It is NOT an exception if the username is not valid or the password is not correct. Those are things you should expect in the normal flow of operation. Exceptions are things that are not part of the normal program operation and are rather rare. EDIT: I do not like using exceptions because you can not tell if a metho...
You can write your own array class
I agree with @leppie, but think you deserve an answer to the question in general. It could be that you meant for the question to be in general, but accidentally picked a bad data structure. The order of the values in a dictionary should be considered implementation-specific; according to the documentation it is always...
Here's another answer kind of like pobk's; it uses the instance's dict to do the work of saving/resetting variables, but doesn't require you to specify the names of them in your code. You can call save() at any time to save the state of the instance and reset() to reset to that state. class MyReset: de...
![alt text][1] [1]: http://i.somethingawful.com/jeffk/computarfunnys/4-17-00-02.gif
Looking at this it looks like you've we need two quick checks as detailed: <?php function valid_email($email) { // First, we check that there's one @ symbol, and that the lengths are right if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) { // Email invalid because wrong number of chara...
We have a similar setup that we have been using successfully over a year now. Our CC.Net server is on a Windows 2003 server and all development happens on Windows XP/Vista machines. Code checked into SVN is pulled down onto the Windows 2003 server, built and pushed onto our hosting boxes.
You should not use a Calendar for accessing dates from the database, for this exact reason. You should use `java.util.Date` as so: @Temporal(TemporalType.TIMESTAMP) @Column(name="activationDate") public Date getActivationDate() { return this.activationDate; } `java.util.Date` poin...
You might consider looking at: http://www.webyog.com This is a great GUI admin tool, and they have a really neat HTTP-Tunneling feature (I'm not sure if this is only in enterprise which costs a few bucks). Basically you upload a script they provide into your webspace (php script) and point sqlyog manager to it an...
Sounds like a pre compile issue, particularly because you mention that you get the error and then wait and it disappears. ASP.NET may be still in the process of dynamically compiling your application or it has compiled the types into different assemblies. With dynamic compilation, you are not guaranteed to have diff...
Customizing Search Results Display in Sharepoint Services 3.0 Wiki
|sharepoint|search|asp|wiki|metadata|
I'm looking at using a Windows SharePoint Services 3.0 wiki as a metadata repository. We basically want a community-driven dictionary and for various reasons we're using Sharepoint instead of say MediaWiki. **What can I do to customize or completely replace searchresults.aspx?** Features I'd add if I knew how: ...
well i wrote a CMS for personal use and released it to the biggest chorus of chirping crickets ever! no biggie, though. i did learn a lot and i encourage you to move forward. my clients use it and like it and it's holding up fine. but if i were to start over (and i might) here's the advice i would give myself: 1...
SOAP is useful from a tooling perspective because the WSDL is so easily consumed by tools. So, you can get Web Service clients generated for you in your favorite language. REST plays well with AJAX'y web pages. If you keep your requests simple, you can make service calls directly from your JavaScript, and that com...
Because the timeout is happening on the connection, not the command. You need to set the [connection.TimeOut][1] property [1]: http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectiontimeout.aspx
The Yahoo YUI library helps deal with a cross browser rendering issues. Namely, the Reset component (http://developer.yahoo.com/yui/reset/) will revert all browser specific rendering (margin and padding on certain elements for instance), creating a level playing field to start from when designing your site.
If you use preg_match, use the U flag to make it non-greedy. preg_match("/<p>(.*)<\/p>/U", $blog_post, &$matches); $matches[1] will then contain the first paragraph.
If you use preg_match, use the U flag to make it un-greedy. preg_match("/<p>(.*)<\/p>/U", $blog_post, &$matches); $matches[1] will then contain the first paragraph.
You only have one primary key in either case. The second one is what's called a compound key. There's no good reason for introducing a new column. In practise, you will have to keep a unique index on all candidate keys. Adding a new column buys you nothing but maintenance overhead. Go with option 2.