instruction
stringlengths
0
30k
I use Eclipse, Maven, and Java in my development. I use Maven to download dependencies (jar files and javadoc when available) and Maven's eclipse plug-in to generate the .project and .classpath files for Eclipse. When the dependency downloaded does not have attached javadoc I manually add a link for the javadoc in the ...
<http://www.httrack.com/> Have used for this purpose a few times, may need to do a little tidying up of urls, and some css linked images might not make it, depends on how good a job you want to do. If you have dreamweaver, you can use that to manage the links if you need to clean up the file names afterwards. ...
Well, if you know the current page, it's pretty trivial to just subtract the number by 1, and add it by 1, then check those numbers against the bounds and display the first and last page always, then if they aren't in sequence, add the ellipses. Or are you asking about getting the total number of pages and determini...
Well, I decided to not be a reputation-whore and find the answer myself. I looked in cscope.el as shown on the Emacs wiki, as well as the xcscope.el that comes with the cscope RPM package on RHEL. Neither appear to give a way to do what I'm wanting. The way is probably to edit the ELisp by adding a package variabl...
I am new to some aspects of web programming but I was reading up on this the other day. I believe you need to use a [Nonce][1]. [1]: http://www.intertwingly.net/blog/1585.html
Your update panel is sitting inside the other panels. Should that be the other way around? AFAIK only controls within the update panel will get updated in via the AJAX call.
Octal number literals: when? why? ever?
|c|numbers|old-school|
I have never used octal numbers in my code nor come across any code that used it (hexadecimal and bit twiddling notwithstanding). I started programming in C/C++ about 1994 so maybe I'm too young for this? Does older code use octal? C includes support for these by prepending a 0, but where is the code that uses these...
My logging philosophy is pretty easily summarized: 1. Log that which is required to be logged (in the financial industry, for example, every change to nearly every DB is logged) 2. Log that which will aid in debugging, but use a switch to turn this on and off as needed 3. Add later logging as needed to find ...
Delphi pointers are 32-bit. Period. Your Delphi developer may be able to 'store' the 64-bit values you want to return to him, but he can't access the memory that they point to, so it's pretty futile. A 64-bit version of Delphi is on [Codegear/Embarcadero's road map][1] for "middle of 2009". Product quality seems to ...
Django ImageField core=False in newforms admin
|python|django|
In the transition to <tt>newforms admin</tt> I'm having difficulty figuring out how specify <tt>core=False</tt> for <tt>ImageField</tt>s. I get the following error: TypeError: __init__() got an unexpected keyword argument 'core' I'm using svn revision 8696.
In the transition to <tt>newforms admin</tt> I'm having difficulty figuring out how specify <tt>core=False</tt> for <tt>ImageField</tt>s. I get the following error: TypeError: __init__() got an unexpected keyword argument 'core' [Edit] However, by just removing the core argument I get a "This field is requ...
> What does unexpectedly mean in this context? Does it mean it core dumped or just exited non-zero? It means it died with an unhandled exception, i.e. it crashed.
Print Odd-Even numbers using signals
|c|signals|
The problem is to print natural nos. 1,2,...n such that the parent process prints all odd numbers and child all even numbers using POSIX signals. Output should be: Parent : 1 Child : 2 Parent : 3 and so on...any suggestions?
|c|homework|signals|
Resharper 4.0 encapsulation question...
|resharper|
When using Resharper to encapsulate a classes properties, is there a way to get it to do more than one property at a time?
It helps because the executable is expecting a strongly named assembly. It stops anyone maliciously substituting in another assembly for one of yours. Also the user might grant an assembly CAS permissions based on the strong name. I don't think you should be distributing the .pfx file, you keep that safe for resign...
One other thing to also check is that your controls have the **FlatStyle** property set to **System** instead of Standard. What this will do is make sure that the app uses the system defaults for radio buttons, standard buttons and the like. This takes all your apps from the flat Win 2000 look and gives them the XP ...
My personal opinion is that a datagridcolumnstyle is the way to go. Without seeing the code that you have, I can't say for certain why your formatting isn't taking hold when no style is defined - but mixing in formatting with data calculations and other parts of the code can get very messy very quickly. Creating a ...
How do you beta test an iphone app?
|iphone|beta|
How can you beta test an iPhone app? I can get it on my own device, and anyone that gives me a device, I can run it on theirs, but is there a way to do a limited release via the app store for beta testing?
How can you beta test an iPhone app? I can get it on my own device, and anyone that gives me a device, I can run it on theirs, but is there a way to do a limited release via the app store for beta testing? Update: Also, see this question on [getting your app onto phones without using the App Store][1]. [1]: ...
For the most part, it doesn't matter. Yes, SQL Server will have more choices when it parses SELECT * FROM table (it'll have to look in the system catalogs for 'table') but it's highly optimized for that, and provided you have sufficient RAM (most servers nowadays do), you won't notice a difference between 0 and 1,000 v...
The easiest way is probably to plop an Internet Explorer onto one of your forms. Check out this site: http://www.acky.net/tutorials/vb/wbrowser/ Since you can reference that object in Access, you will only need to point the webbrowser control to the path of the .jpg (NavigateTo() if I remember correctly). **EDIT:...
The views are only going to take up cpu/memory resources when they are called. Anyhow, best practice would be to consolidate what can be consolidated, remove what can be removed, and if it's literally only used by your reports, choose a consistent naming standard for the views so they can easily be grouped together ...
Why not use a Dictionary<ServerEnum, ClientEnum>? This could be a static property of your class, initialized with those fancy schmancy object initializers we got in 3.0? You would not be typing more code (the mapping has to be done even with the Attribute sollution).
How can I merge two Python dictionaries as a single expression?
|python|dictionary|
I have two Python dictionaries, and I want to write a single expression that returns these two dictionaries, merged. The update() method would be what I need, if it returned its result instead of modifying a dict in-place. >>> x = {'a':1, 'b': 2} >>> y = {'b':10, 'c': 11} >>> z = x.update(y) >>> ...
I use the CarbonEmacs version on the Macports progam. It installs all the dependencies with just one line: sudo port install emacs For anyone intesrested in Macports (www.macports.org)
If I understand your question correctly you would need to have a clientaccesspolicy.xml file in the domain web root of the server that you wish to call (ie www.example.com/clientaccesspolicy.xml) that defines that it is ok for services from other domains to call services on that domain. Read the [How to Make a Servi...
This should be fine: <pre><code> inline const char* bool_cast(const bool b) { return b ? "true" : "false"; } </code></pre> But, if you want to do it more C++-ish: <pre><code> #include &lt;iostream&gt; #include &lt;string&gt; #include &lt;sstream&gt; using namespace std; string bool_cast(const bo...
IIRC, the browser pops the auth dialog when the following comes back in the request stream: - Http status of 401 - WWW-Authenticate header I would guess that you'd need to suppress one or both of those. The easy way to do that is to have a login method that'll take a Base64 username and password (you are usi...
There is no official way of doing what you want, because the dll interface is a C api. The compiler itself uses mangled names as a workaround, so you should use name mangling when you don't want to change too much in your code.
You should probably also remove any attributes on the &lt;p> tag, since someone bad could do something like: <p onclick="document.location.href='http://www.evil.com'">Clickable text</p> The easiest way to do this, is to use the regex people suggest here to search for &ltp> tags with attributes, and replace th...
What is the best way to sort a data bound combo box?
|c#|data-binding|
I have done a bit of research into this and it seems that the only way to sort a data bound combo box is to sort the data source itself (a DataTable in a DataSet in this case). If that is the case then the question becomes what is the best way to sort a DataTable?
I have done a bit of research into this and it seems that the only way to sort a data bound combo box is to sort the data source itself (a DataTable in a DataSet in this case). If that is the case then the question becomes what is the best way to sort a DataTable? The combo box bindings are set in the designer ...
I take what I consider a traditional approach; some logging, surrounded by conditional defines. For production builds, I turn off the defines.
I agree with Adam, but I also would consider logging things of interest or things that you can demonstrate as achievements as a kind of proof of them happening.
It's useful for the `chmod` and `mkdir` functions in Unix land, but aside from that I can't think of any other common uses.
I choose to log deliberately as I go, as this means the log data is meaningful: - Depending on logging framework you can add level/severity/category information so that the log data can be filtered - You can make sure that the right level of information is present, not too much, not too little - You know whe...
I start by asserting a lot of conditions in my code (in C#, using `System.Diagnostics.Assert`), but I add logging only where I find, while debugging or putting the system under stress, that I really need to have a way to follow what's happening inside of my code without having a debugger permanently attached. Otherw...
For those of you like me who hadn't heard of sharding: [http://highscalability.com/unorthodox-approach-database-design-coming-shard][1] [1]: http://highscalability.com/unorthodox-approach-database-design-coming-shard
My recommendation is to use the former approach. There are pluses and minuses for each approach. The former is harder to maintain as the number of Room types grows; the latter is harder as the number of Cleaner types grows. In Ruby, you could try def accept(x) send "accept#{x.class}".to_sym, x e...
What's the best way to insert/update/delete multiple records in a database from an application?
|sql|database|
Given a set of entities to insert, delete, or update in an application, what is the best way to perform the necessary database operations? Should multiple queries be issued, one for each entity to be affected? Or should some sort of XML construct that can be parsed by the database engine be used, so that only one com...
Given a small set of entities (say, 10 or fewer) to insert, delete, or update in an application, what is the best way to perform the necessary database operations? Should multiple queries be issued, one for each entity to be affected? Or should some sort of XML construct that can be parsed by the database engine be u...
As far as I can tell your code is correct. Assuming exampleString is an std::string that has class scope like you describe, you ought to be able to initialize/assign it that way. Perhaps there is some other issue? Maybe a snippet of actual code would help put it in context. Question: Is exampleString a pointer to a ...
It could be heap corruption, but it's just as likely to be stack corruption. Jim's right. We really need a bit more context. Those two lines of source don't tell us much in isolation. There could be any number of things causing this (which is the real joy of C/C++). If you're comfortable posting your code, you c...
A Rutgers grad student recently found a [recurrence relation that generates primes][1]. Take the difference of successive numbers will generate either primes or 1's. a(1) = 7 a(n) = a(n-1) + gcd(n,a(n-1)). It makes a lot of crap that needs to be filtered out. Benoit Cloitre also has this recurrence that...
A Rutgers grad student recently found a [recurrence relation that generates primes][1]. The difference of its successive numbers will generate either primes or 1's. a(1) = 7 a(n) = a(n-1) + gcd(n,a(n-1)). It makes a lot of crap that needs to be filtered out. Benoit Cloitre also has this recurrence that ...
A Rutgers grad student recently found a [recurrence relation that generates primes][1]. The difference of its successive numbers will generate either primes or 1's. a(1) = 7 a(n) = a(n-1) + gcd(n,a(n-1)). It makes a lot of crap that needs to be filtered out. Benoit Cloitre also has this recurrence that ...
|web-services|iis|ssl|
myStr.Replace("([^\r])\n", "$1\r\n"); $ may need to be a \
How do I find the 'temp' directory in Linux?
|linux|directory|temp|
How do I find the 'temp' directory in Linux? I am writing a platform neutral C++ function that returns the temp directory. In Mac an Windows, there is an API that returns these results. In Linux, I'm stomped.
|linux|api|
This likely causeed by a change made in the Flash Player version released in early April, I'm not too sure about the specifics, but I assume there were security concerns with this functionality. What you need to do is indeed add that to your crossdomain.xml (which should be in your servers webroot) You can read m...
How do I display a PDF in Adobe Flex?
|apache-flex|pdf|adobe|
Looking for a way to display a PDF in Flex. I'm sure there are several ways. Looking for the easiest to maintain / integrate / most user friendly. I'm guessing it's possible to display a browser window in the app and render it, but if it goes off of IE / FireFox it's not acceptable for this project. Thanks...
In standard c, you could try: P_tmpdir
Better to use the FolderBrowserDialog for that. using (FolderBrowserDialog dlg = new FolderBrowserDialog()) { dlg.Description = "Select a folder"; if (dlg.ShowDialog() == DialogResult.OK) { MessageBox.Show("You selected: " + dlg.SelectedPath); } }
Be POSIX compliant, and use tmpnam (which will give you a full filename in a temporary location).
[UK Government Data Standards Catalogue][1] details the UK standards for this kind of thing. It suggests 35 characters for each of Given Name and Family Name, or 70 characters for a single field to hold the Full Name, and 255 characters for an email address. Amongst other things.. [1]: http://www.govtalk.gov.u...
Rather than setup a 2nd box, why don't you look into the PHP Connector for iSeries? My mainframe guys said it was very easy to setup on our iSeries here. We wrote a simple server in PHP that loads data models from DB2 data, serializes them, and returns them to the caller. This approach means that only another PHP a...
I have done a bit of research into this and it seems that the only way to sort a data bound combo box is to sort the data source itself (a DataTable in a DataSet in this case). If that is the case then the question becomes what is the best way to sort a DataTable? The combo box bindings are set in the designer ...
Are you required to have it run as x86? I had similar issues with web apps under Visual Studio's dev web server (which is x86), but switching over to IIS (x64) worked for me. Since I was deploying to IIS x64, I called it a day at that point. I tried tracing with Filemon and Regmon, but didn't get any denied or missi...
Now I have a problem as to which answer to accept. Further thought on the problem brings me to the conclusion that I was incorrectly throwing exceptions. Duplicate user names, email addresses etc are expected issues during a sign up process and are therefore not exceptions, but simply errors. In which case I probabl...
I came up with this: <(?!\/?p(?=>|\s.*>))\/?.*?> x/ < # Match open angle bracket (?! # Negative lookahead (Not matching and not consuming) \/? # 0 or 1 / p # p (?= # Positive lookahead (Matching and not consuming) > # > - No attributes | # or ...
|python|syntax|dictionary|
A view is a query that you run often with preset parameters. If you know you will be looking at the same data all the time you can create a view for ease of use and for data binding. That being said, when you select from a view the view defining query is run along with the query you are running. For example, if...
What version(s) of IE is it failing under? Is it failing for a specific complex selector? I think we need an example.
What version(s) of IE is it failing under? Is it failing for a specific complex selector? I think we need an example. Edit: Does the problem go away if you upgrade to 1.2.6? 1.2.6 is primarily a bug-fix release according to [this page][1]. Failing that, the best way to find the problem is to create a minimum page...
You could go with Rob's solution; that's the prettiest for development. Your "carrier object" could contain the entire IDictionary and have typed properties to help intellisense. The properties could update the IDictionary. When you're done, you can pass the carrier object back and fetch the IDictionary directly from i...
How about **find ./ -type f** (which will find all files in the currently directory)? Take off the ***-type f*** to find everything.
Try using: find . -type f -maxdepth 1 This will only list the files in the directory, leave out the -type f argument if you want to list files and directories.
Things to try: Check ls isn't aliased? alias ls Perhaps try find instead? find . \( -type d -name . -prune \) -o \( -type f -print \) Hope this helps.
You can redirect output and run the ls process in the background. ls > myls.txt & This would allow you to go on about your business while its running. It wouldn't lock up your shell. Not sure about what options are for running ls and getting less data back. You could always "man ls" to check.
Your code as I can see has no errors. As has been said more context is needed. If you haven't already tried, install gdb (the gcc debugger) and compile the program with -g. This will compile in debugging symbols which gdb can use. Once you have gdb installed run it with the program (gdb <your_program>). [This][1] is...
If I'm understanding you correctly, it sounds like you're expecting the MathContext to control how many digits should be kept after the decimal point. That's not what it's for. It specifies how many digits to keep, *total*. So if you specify that you want 3 significant digits, that's all you're going to get. For ...
This can be done via SQL Enterprise Manager or like this: ALTER DATABASE <database> SET COMPATIBILITY_LEVEL = { 80 | 90 | 100 } Use 90 for 2005 compatibility. This was replaces the functionality used for previous releases, the stored procedure *sp_dbcmptlevel*.
This can be done via SQL Enterprise Manager or like this: ALTER DATABASE <database> SET COMPATIBILITY_LEVEL = { 80 | 90 | 100 } Use 90 for 2005 compatibility. This replaces the functionality used for previous releases, the stored procedure *sp_dbcmptlevel*.
Best Practices for securing a REST API / web service
|security|wcf|rest|
When designing a REST API or service are there any established best practices for dealing with security (Authentication, Authorization, Identity Management) ? When building a SOAP API you have WS-Security as a guide and much literature exists on the topic. I have found less information about securing REST endpoints....
It's not for fun. Actually I found some online example, which stated the use of MathContext to round the amounts/numbers stored in BigDecimal. For example, If MathContext is configured to have precision = 2 and rounding mode = ROUND_HALF_EVEN BigDecimal Number = 0.5294, is rounded to 0.53 So I thought it is...
Are you asking about Linux shell as in an environment to work in? For that CygWin I think has been around the longest and is pretty robust: <http://www.cygwin.com/> A while ago I found a windows port of all the popular linux commands I use (ls, grep, diff) and I simply unzip those to a file, add it to my PATH enviro...