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 .classpath file so that I can see the javadoc for the dependency in Eclipse. Then when I run Maven's eclipse plugin to regenerate the .classpath file it of course wipes out that change. Is there a way to configure Maven's eclipse plug-in to automatically add classpath attributes for javadoc when running Maven's eclipse plug-in? I'm only interested in answers where the javadoc and/or sources are not provided for the dependency in the maven repository, which is the case most often for me. Using downloadSources and/or downloadJavadocs properties won't help this problem.
<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. Optionally use the link checker extension for firefox to check it all 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 determining the current page number...?
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 variable like `*browse-buffer*` or something and just initialize that variable if not already initialized the first time the user does `[C-c C-s g]` or whatever, and always have the resulting code shown in `*browse-buffer*`. Then the user can put the `*browse-buffer*` wherever he wants it.
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 base 8 number literals?
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 and resolve performance bottlenecks, and attack vectors -Adam
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 be (at last!) taking precedence over hitting ship dates exactly, so don't hold your breath... [1]: http://dn.codegear.com/article/36620
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 required." error in the admin interface on attempted submission. How does one accomplish what <tt>core=False</tt> is meant to do using newforms admin?
> 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 resigning the assembly.
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 or Vista bling depending on the OS they are running.
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 new column style class is very clean, and if you have to use the same formatting again in another datagrid, it's as easy as pie to reuse it. Here's the [Microsoft Documentation][1] that may get you started in the right direction. [1]: http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridcolumnstyle.aspx
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]: http://beta.stackoverflow.com/questions/37464/iphone-app-minus-app-store
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 views. However, from a people-perspective, trying to manage and figure out what "hundreds" of views are doing is probably impossible, so you likely have a lot of duplicated code in there. What happens if some business rules change that are embedded in these redundant views? The main point of views is to encapsulate business logic into a pseudo table (so you may have a person table, but then a view called "active_persons" which does some magic). Creating a view for each report is kind of silly unless each report is so isolated and unique that there is no ability to re-use.
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 above link was just googled and picked from the results (first one that opened quickly). I do not think it is a very good tutorial, it just has all the pointers you need... Check out msdn etc. if you need more information!
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 when looking for a particular view. Also, unless you really need transactional isolation, consider using the NOLOCK table hint in your queries. -- Kevin Fairchild
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) >>> print z None >>> x {'a': 1, 'b': 10, 'c': 11} So I want that final merged dict in z, not x. How can I do this?
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 Service Available Across Domain Boundaries][1] MSDN article for more detailed information. [1]: http://msdn.microsoft.com/en-us/library/cc197955%28VS.95%29.aspx
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 bool b) { ostringstream ss; ss &lt;&lt; boolalpha &lt;&lt; b; return ss.str(); } int main() { cout &lt;&lt; bool_cast(true) &lt;&lt; "\n"; cout &lt;&lt; bool_cast(false) &lt;&lt; "\n"; } </code></pre>
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 using HTTPS, right?) and return 200 with a valid/invalid status. Once the password has been validated, you can use it with XHR.
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 them with &lt;p> tags without attributes. Just to be on the safe side.
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 initialize using <pre><code>myCombo.DataSource = this.typedDataSet; myCombo.DataMember = "Table1"; myCombo.DisplayMember = "ColumnB"; myCombo.ValueMember = "ColumnA";</pre></code> I have tried setting <pre><code>this.typedDataSet.DefaultView.Sort = "ColumnB DESC";</pre></code> But that makes no difference, I have tried setting this in the control constructor, before and after a <code>typedDataSet.Merge<code/> call.
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 when writing the code which the most important things are, and can therefore ensure they are logged Using some form of code injection, profiling or tracing tool to generate logs would most likely generate verbose, less useful logs that would be harder to dive into. They may be useful as a debugging aid, however.
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. Otherwise, I prefer using Visual Studio's capability to put traces in the code as special breakpoints (i.e. you insert a breakpoint and right-click it, then select "When hit..." and tell it what to display in that case). There is no need to recompile and it is easy to enable/disable the traces on the fly.
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 end PS: not all dynamically typed languages are unable to do dispatch based on type; some can infer type, or failing that, can used forced casting to pick the proper method among the overloaded options.
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 command needs to be issued? Or something other method that I'm not aware of?
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 used, so that only one command needs to be issued? Or something other method that I'm not aware of? I ask this because a common pattern at my current shop seems to be to format up an XML document containing all the changes, then send that string to the database to be processed by the database engine's XML functionality. However, using XML in this way seems rather cumbersome, especially given the simple nature of the task to be performed. Any thoughts?
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 string object created with new?
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 could even throw all of it up on a server and post a link. I'm sure you'd gets lots more advice that way (some of it undoubtedly unrelated to your question).
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 does a similar task: b(1) = 1 b(n) = b(n-1) + lcm(n,b(n-1)) then the ratio of successive numbers, minus one [b(n)/b(n-1)-1] is prime. A full account of all this can be read at [Recursivity][2]. [1]: http://www.cs.uwaterloo.ca/journals/JIS/VOL11/Rowland/rowland21.html [2]: http://recursed.blogspot.com/2008/07/rutgers-graduate-student-finds-new.html
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 does a similar task: b(1) = 1 b(n) = b(n-1) + lcm(n,b(n-1)) then the ratio of successive numbers, minus one [b(n)/b(n-1)-1] is prime. A full account of all this can be read at [Recursivity][2]. For the sieve, you can do better by using a wheel instead of adding one each time, check out the [Improved Incremental Prime Number Sieves][3]. [1]: http://www.cs.uwaterloo.ca/journals/JIS/VOL11/Rowland/rowland21.html [2]: http://recursed.blogspot.com/2008/07/rutgers-graduate-student-finds-new.html [3]: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.52.835
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 does a similar task: b(1) = 1 b(n) = b(n-1) + lcm(n,b(n-1)) then the ratio of successive numbers, minus one [b(n)/b(n-1)-1] is prime. A full account of all this can be read at [Recursivity][2]. For the sieve, you can do better by using a wheel instead of adding one each time, check out the [Improved Incremental Prime Number Sieves][3]. Here is an example of a wheel. Let's look at the numbers, 2 and 5 to ignore. Their wheel is, [2,4,2,2]. [1]: http://www.cs.uwaterloo.ca/journals/JIS/VOL11/Rowland/rowland21.html [2]: http://recursed.blogspot.com/2008/07/rutgers-graduate-student-finds-new.html [3]: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.52.835
|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 more here: [http://www.adobe.com/devnet/flashplayer/articles/flash_player9_security_update.html][1] A typical example of a crossdomain.xml is [twitters][2], more info about how the file works can be found [here.][3] [1]: http://www.adobe.com/devnet/flashplayer/articles/flash_player9_security_update.html [2]: http://twitter.com/crossdomain.xml [3]: http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14213
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.uk/gdsc/html/noframes/PersonName-1-1-Release.htm
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 app can consume the service but it's just so much quicker on both ends to just serialize the object and send it down the pipe. Here is a PDF from IBM on the subject: [http://i-seriesusergroup.org/wp-content/uploads/2006/09/PHP%20for%20i5OS%20NESDND.pdf][1] [1]: http://i-seriesusergroup.org/wp-content/uploads/2006/09/PHP%20for%20i5OS%20NESDND.pdf
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 initialize using <pre><code>myCombo.DataSource = this.typedDataSet; myCombo.DataMember = "Table1"; myCombo.DisplayMember = "ColumnB"; myCombo.ValueMember = "ColumnA";</pre></code> I have tried setting <pre><code>this.typedDataSet.Table1.DefaultView.Sort = "ColumnB DESC";</pre></code> But that makes no difference, I have tried setting this in the control constructor, before and after a <code>typedDataSet.Merge<code/> call.
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 missing keys errors. If I were to look again, I'd check HKLM\Software\WOW6432Node, guessing that the installer writes to the x64 HKLM\Software node, but not the x86 one.
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 probably shouldn't be throwing exceptions, but returning error codes. Which leads me to think that [irobinson's][1] approach should be the one to take in this case, especially since the form is only a small part of the UI being displayed. I have now implemented this solution and I am returning xml containing a status and an optional message that is to be displayed. I can then use jQuery to parse it and take the appropriate action: - success: function(data){ var created = $("result", data).attr("success"); if (created == "OK"){ resetNewUserForm(); listUsers(''); } else { var errorMessage = $("result", data).attr("message"); $("#newUserErrorMessage").text(errorMessage).show(); } enableNewUserForm(); } However [travis'][2] answer is very detailed and would be perfect during debugging or if I wanted to display an exception message to the user. I am definitely not receiving JSON back, so it is probably down to one of those attributes that travis has listed, as I don't have them in my code. (I am going to accept irobinson's answer, but upvote travis' answer. It just feels strange to be accepting an answer that doesn't have the most votes.) [1]: http://stackoverflow.com/users/326/irobinson [2]: http://stackoverflow.com/users/1414/travis
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 \s # whitespace .* # anything up to > # close angle brackets - with attributes ) # close positive lookahead ) # close negative lookahead # if we have got this far then we don't match # a p tag or closing p tag # with or without attributes \/? # optional close tag symbol (/) .*? # and anything up to > # first closing tag / This will now deal with p tags with or without attributes and the closing p tags, but will match pre and similar tags, with or without attributes. It doesn't strip out attributes, but my source data does not put them in. I may change this later to do this, but this will suffice for now.
|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 vwCustomersWhoHavePaid is "Select * from customers where paid = 1" and the query you are running returns the customers who have paid after August first is formatted like this "Select * from vwCustomersWhoHavePaid where datepaid > '08/01/08'" The query you are actually running is "Select * from (Select * from customers where paid = 1) where datepaid > '08/01/08'" This is something you should keep in mind when creating views, they are a way of storing data that you look at often. It's just a way of organizing data so it's easier to access.
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 that can reproduce the bug. Without that, it's just about impossible to troubleshoot. [1]: http://docs.jquery.com/Release:jQuery_1.2.6
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 it. For example, if your dictionary had key/value pair "FirstEnabled"/boolean, you could do this: class ContainerObject { public IDictionary<object, object> _dict; public DeployUtils(IDictionary<object, object> dict) { _dict = dict; } public bool FirstEnabled { get { return (bool) _dict["FirstEnabled"]; } set { _dict["FirstEnabled"] = value; } } } You can change the member "_dict" to private or protected and have a accessor function if you want.
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 a useful cheatsheat for using gdb. Set a breakpoint for the function that is producing the bug, and see what the value of exampleString is. Also do the same for whatever parameter you are passing to exampleString. This should at least tell you if the std::strings are valid. I found the answer from [this article][2] to be a good guide about pointers. [1]: http://www.cs.princeton.edu/~benjasik/gdb/gdbtut.html [2]: http://stackoverflow.com/questions/5727/understanding-pointers
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 example, this: System.out.println(new BigDecimal("1234567890.123456789", new MathContext(20))); System.out.println(new BigDecimal("1234567890.123456789", new MathContext(10))); System.out.println(new BigDecimal("1234567890.123456789", new MathContext(5))); will output: 1234567890.123456789 1234567890 1.2346E+9
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. While I understand REST intentionally does not have specifications analogous to WS-* I am hoping best practices or recommended patterns have emerged. Any discussion or links to relevant documents would be very much appreciated. If it matters, we would be using WCF with POX/JSON serialized messages for our REST API's/Services built using v3.5 of the .NET Framework.
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 a newer technique and used it for rounding purpose. However it turned into nightmare because it started rounding even mentissa part of number. For example, Number = 1.5294, is rounded to 1.5 Number = 10.5294, is rounded to 10 Number = 101.5294 is rounded to 100 .... and so on So this is not the behavior I expected for rounding (as precision = 2). It seems to be having some logic because from patter I can say that it takes first two digits (as percision is 2) of number and then appends 0s till the no. of digits become same as unrounded amount (checkout the example of 101.5294 ...) Regards, Jatan
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 environment and then can run from there: <http://unxutils.sourceforge.net/> Or are you talking about executing shell commands from within your code? If you're in the .net sphere, there is the Process.Start() method that will give you a lot of options. Hope this helps!