instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
I've been working with jQuery and *.asmx web services lately, and I'm trying to be security-conscious in doing so. I figure it would be possible to submit an AJAX request -- even when logged-out -- to a resource that should only be accessible while logged-in. Thus, I include special keys and hashes with each of these A...
stackexchange/codereview
For example, I want just the "filename" of a file in a field. Say I have myimage.jpg I only want to display "myimage" How do I get just that?
stackexchange/codereview
How do I generate an audio sine or square wave of a given frequency? I am hoping to do this to calibrate equipment, so how precise would these waves be?
stackexchange/codereview
I was hoping to do something like this, but it appears to be illegal in C#: public Collection MethodThatFetchesSomething<T>() where T : SomeBaseClass { return T.StaticMethodOnSomeBaseClassThatReturnsCollection(); } I get a compile-time error: 'T' is a 'type parameter', which is not valid in the given context....
stackexchange/codereview
I am working both in the Ruby and Java worlds. I have been inspired somewhat by the merb-assets project, which provides various functionality to make it easy to reference assets (images, CSS, etc.) located on a subdomain (or CDN). I want to do the same in Java: in development and testing, I want to use either JSTL's <...
stackexchange/codereview
I have a form that has multiple fields, and for testing purposes is there a way I could print out the values entered in all the fields, without having to individually print each value.
stackexchange/codereview
I'm working on a system that includes a large number of reports, generated using JasperReports. One of the newer features is that you can define styles for reports. From the available docs I believe there is some way to have an external file defining styles to use, and you can reference that in your jasper reports. Thi...
stackexchange/codereview
What is the best way to write data to the text console at arbitrary locations on the screen and with custom fore/background colors?
stackexchange/codereview
I'd like to return an object with the following signature class AnonClass{ string Name {get;} IEnumerable<Group> Groups {get;} } I have tried the following query, but g only returns a single entity, not all the joined entities var q = from t in dc.Themes join g in dc.Groups on t.K equals g.ThemeK select new {...
stackexchange/codereview
We are developing a plugin for outlook in visual basic 6.0.We have been facing issues like outlook crash ( due to some objects not getting destroyed or some other reason). One way we have been solving this issue is reading code,commenting code( to observe the affect), logging etc. Are there any other ways of debugging?...
stackexchange/codereview
Being an aspiring Apple developer, I want to get the opinions of the community if it is better to learn C first before moving into Objective-C and ultimately the Cocoa Framework? My gut says learn C, which will give me a good foundation.
stackexchange/codereview
I launch a child process in Java as follows: final String[] cmd = {"<childProcessName>"}; Process process = Runtime.getRuntime().exec(cmd); It now runs in the background. All good and fine. If my program now crashes (it is still in dev :-)) the child process still seems to hang around. How can I make it automatically...
stackexchange/codereview
Visual Studio 2008 has built-in unittesting that was previously only available in the Team Suite editions. What unittesting framework is this based on? MbUint, MStest, xUnit or something completely different?
stackexchange/codereview
I am trying to do a search in my Eclipse (Java) workspace to find all instances of static variables that are not final. I tried various regexes but they do not result in any matches. Can someone suggest a regex that will match all lines containing static and not containing final, and not ending in a {? The last part ab...
stackexchange/codereview
I have a pretty generic Article model, with m2m relation to Tag model. I want to keep count of each tag usage, i think the best way would be to denormalise count field on Tag model and update it each time Article being saved. How can i accomplish this, or maybe there's a better way?
stackexchange/codereview
Is there any way of batch renaming files in sub directories? For example: Rename *.html to *.htm in a folder which has directories and sub directories.
stackexchange/codereview
Let's say I have the following table: CustomerID ParentID Name ========== ======== ==== 1 null John 2 1 James 3 2 Jenna 4 3 Jennifer 5 3 Peter 6 5 Alice 7 5 Steve 8 1 Larry I want to retrieve i...
stackexchange/codereview
I have database with many tables. In the first table, I have a field called status. table 1 idno name status 111 hjghf yes 225 hjgjj no 345 hgj yes Other tables could have same idno with different fields. I want to check the status for each id no and if it is yes then for that id number in all t...
stackexchange/codereview
I'm currently working on a project which needs to persist any kind of object (of which implementation we don't have any control) so these objects could be recovered afterwards. We can't implement an ORM because we can't restrict the users of our library at development time. Our first alternative was to serialize it wi...
stackexchange/codereview
I don't know how much information you need for this, but WP-ContactForm-7 is a contact form for WordPress. By default it has one server response message for all forms on the website. I have multiple forms and would like a different server response messages for each one. How can I create different server response messag...
stackexchange/codereview
To test printing in a Visual Basic Project I need to simulate a SLOW printer, how can I do that?
stackexchange/codereview
There are quite a lot of unittesting frameworks out there for .NET. I found this little feature comparison: http://xunit.github.io/docs/comparisons.html Now I am to choose the best one for us. But how? Does it matter? Which one is most future proof and has a decent momentum behind it? Should I care about the features? ...
stackexchange/codereview
XIFF is an implemenation of the XMPP protocol in actionscript. So far, all the examples and documentation I have seen are sparse. Does anyone know a good explanation of the most recent version of XIFF and/or good examples of working Flex/AIR applications?
stackexchange/codereview
I have to preface this with the fact that I love jQuery as a JavaScript language extension and YUI as a rich set of free controls. So here is my question, is there going to be any problems down the line if I mix jQuery and YUI together in an MVC app I am working on. I want to use jQuery for the heavy lifting on the DO...
stackexchange/codereview
What's the accepted way of storing quoted data in XML? For example, for a node, which is correct? (a) <name>Jesse "The Body" Ventura</name> (b) <name>Jesse \"The Body\" Ventura</name> (c) <name>Jesse &quot;The Body&quot; Ventura</name> (d) none of the above (please specify) If (a), what do you do for attributes? If (...
stackexchange/codereview
I believe that we can allow Firefox to sent NTLM data to SharePoint sites to do automatic authentication, and I think that this is doable with IIS. I'd like to do the same thing with an internal Rails site. Does anyone know of way that I could authenticate NTLM type user information through a Apache/mongrel setup (prov...
stackexchange/codereview
How to create an aspect checking for null references on all methods in a class in postsharp. using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace test { [MethodParameterNullCheck] internal class Class { public Class() { } public v...
stackexchange/codereview
If you have a project, that releases a library and an application, how you handle version-numbers between the two. Example: Your project delivers a library, that convert different file-formats into each other. The library is released for inclusion into other applications. But you also release a command-line-application...
stackexchange/codereview
Do you do automated testing on a complex workflow system like K2? We are building a system with extensive integration between Sharepoint 2007 and K2. I can't even imagine where to start with automated testing as the workflow involves multiple users interacting with Sharepoint, K2 workflows and custom web pages. Has any...
stackexchange/codereview
I once heard a prominent scientist say, of global warming, that he didn't realize how much he would have to learn about politics. I just read an excellent article in DDJ about the Jacobsen verus Katzer case. When in university, I didn't know how much I would have to learn about the law. It seems to me that a big hole i...
stackexchange/codereview
Does anyone know of a script to colorize C++ code the same as the default MSVC IDE does?
stackexchange/codereview
Which method is preferred? Session.Remove("foo"); Session["foo"] = null; Is there a difference?
stackexchange/codereview
I'm using Hibernate for a Java-based Web Application and want to add full-text search via Compass. Compass is supposed to support that, but fails to provide any useful Getting Started guide. I could figure out that I have to annotate my Entities with @Searchable and the various @SearchableXXX variations and accessing C...
stackexchange/codereview
I'll simplify the problem as much as possible: I have an oracle table: row_priority, col1, col2, col3 0, .1, 100, {null} 12, {null}, {null}, 3 24, .2, {null}, {null} Desired result: col1, col2, col3 .2, 100, 3 So according to the priority of the row, it overrides previous row values, if given. I'm attempting to work ...
stackexchange/codereview
I really like the way gmail has the archive system implemented. I can archive any file after adding a tag to it (if needed) and I can search for it whenever I want to. Is there any program in Windows/Linux which behaves in a similar fashion?
stackexchange/codereview
We have been trying Scrum but for a while now and are trying to formalize it within as our own version of Agile Application Development. Here's how our current process works. There are two main drawbacks to it as it stands right now. Wanted to get input on whether you have a similar approach and if the community has an...
stackexchange/codereview
I'm working on an RSS feed for a custom tasking system we use, and I'm still wrapping my head around how things should work. What I want to have is a feed for each user that shows tasks assigned to them, and additionally a feed for each task that shows updates for the task. What I want to know right now concerns the u...
stackexchange/codereview
I often marvel at how I can go to www.google.com, from anywhere in the world at any time, and get the returned page so fast. Sure, they compress their output and keep to a minimal design - that helps. But they must have millions of simultaneous hits to the box sitting on the web that DNS lists as "www.google.com". All ...
stackexchange/codereview
I have a table (volunteers_2009) that has all the volunteers stored within, then I have a table (venues) that list all the different venues a volunteer could work (volunteers are assigned to one venue each, and that is stored within volunteers_2009.venue_id, which equals venues.id) The venues table also has a column fo...
stackexchange/codereview
does anybody know how to make a numericupdown control for asp. There's one for making winforms, but I don't know if theres one for making webforms. Is there an addon or something that I can use?
stackexchange/codereview
What is the best way to implement the page view counter like the ones they have here on the site where each question has a "Views" counter? Factoring in Performance and Scalability issues.
stackexchange/codereview
I was thinking about the idea of using Ajax instead of TagLib. The most elegant way would be: Using Java Annotation. The idea is, designers or anybody can make the HTML without any taglib ,just using the "standard" HTML tags with id or name, and call the Javascript. That way any WYSIWYG can be used, developer don't ha...
stackexchange/codereview
I have an associative array in the form key => value where key is a numerical value, however it is not a sequential numerical value. The key is actually an ID number and the value is a count. This is fine for most instances, however I want a function that gets the human-readable name of the array and uses that for the ...
stackexchange/codereview
Do you think changing directories inside bash or Perl scripts is acceptable? Or should one avoid doing this at all costs? What is the best practice for this issue?
stackexchange/codereview
I'm using the SqlMembershipProvider to carry out my ASP.NET website's user management. In particular, the site needs to be multi-lingual (globalized!). When I create users using Membership.CreateUser it's good that I get exceptions for things like duplicate emails, duplicate usernames etc. But what I want is to re-use ...
stackexchange/codereview
[Of course, the question is not restricted to a specific "friend" implementation, feel free though to point out implementation specifics if relevant] Reading through the unanswered questions, I stumbled upon the InternalsVisibleTo attribute: Specifies that types that are ordinarily visible only within the current ...
stackexchange/codereview
I am trying to setup a multi module SpringMVC appfuse applicaiton in Eclipse but it seems that I'm facing lots of errors in Eclipse after I import the project in Eclipse. Can anyone please help me with a step by step guideline showing the ideal way to setup such application in Eclipse?
stackexchange/codereview
I work on a app which has only one way to get a working DB connection: a function that returns a MySQL connection resource. Is there any way for me to convert that MySQL connection to a PDO MySQL connection? I don't have access to the MySQL server in any other way, no username, password, nothing. I can't see/get the fi...
stackexchange/codereview
I am rendering a rails partial and I want to alternate the background color when it renders the partial. I know that is not super clear so here is an example of what I want to do: Row One grey Background Row Two yellow background Row Three grey Background Row Four yellow background sorry stackoverflow sea...
stackexchange/codereview
I'd like to bold the text for a tab page under certain conditions (not, necessarily, GotFocus). Is it true the only 'er easiest way to do this is by overriding the DrawItem event for the tab control? http://www.vbforums.com/showthread.php?t=355093 It seems like there should be an easier way. Like ... tabControl.Tab...
stackexchange/codereview
I have a long form that the user has to fill out. So I broke the form into logical units and created another user control for some elements (they will be reused elsewhere). So say the form has these fields: UserControl3.ascx Username password email -- usercontrol2.ascx address -- usercontrol2.ascx city -- use...
stackexchange/codereview
Let's have a list of some good interview questions for SharePoint developers. Please provide one question per entry, and if possible, the answers. Also, please feel free to suggest corrections if the provided answers are wrong. I will go first: Q: How does SharePoint store pages? A: How-to-locate-sharepoint-document-l...
stackexchange/codereview
I have an ASP.NET web page with a Login control on it. When I hit Enter, the Login button doesn't fire; instead the page submits, doing nothing. The standard solution to this that I've found online is to enclose the Login control in a Panel, then set the Panel default button. But apparently that doesn't work so well ...
stackexchange/codereview
I have been looking at the new database server we are setting up for a client and note the database files are set to grow by 1 meg everytime the file is full and the initial size is 100 MB. I have been considering this breifly and it doesn't sound right. I've checked a few sites on DB considerations and they didn't pr...
stackexchange/codereview
Does anyone know if it is possible to add other controls to a Flex 3 Alert? What I need is a modal dialoge that allows the user to type in a filename before clicking OK or CANCEL. This seems like it would be best achieved with an Alert but in the documentation I don't see an obvious way to add a TextInput (or any other...
stackexchange/codereview
The following seems strange.. Basically, the somedata attribute seems shared between all the classes that inherited from the_base_class. class the_base_class: somedata = {} somedata['was_false_in_base'] = False class subclassthing(the_base_class): def __init__(self): print self.somedata firs...
stackexchange/codereview
I need a SQL query that returns ContactDate, SortName, City, ContactType, and Summary from the tables below. If any value is null, I need it to return the text “No Entry”. ContactTable ContactID ContactDate UserID Summary ContactType SortName UserTable UserID FirstName LastName AddressID AddressTable AddressID...
stackexchange/codereview
Does anyone know where I can find an algorithm that given a set of values (dates) for an axis I can calculate a reasonable scale and tick interval?
stackexchange/codereview
I noticed today that in D2009 (with update 1), TStringStream.ReadString does not move the Position in the Stream anymore like it used to do up to D2007. So, looping on MyStringStream.ReadString(10) would always read the 1st 10 chars of the stream instead of moving along and getting all the stream 10 chars by 10 chars. ...
stackexchange/codereview
I've written a little web site in my effort to learn vb.net and asp.net, fairly happy with it so rented some space and uploaded it, it was written using asp.net express edition 2008 and sql server express .... I've uploaded it and I've found that it was written in .NET 3.5 and my host only deals with 2.01 ... I've sort...
stackexchange/codereview
I'm currently working on a small project with OCaml; a simple mathematical expression simplifier. I'm supposed to find certain patterns inside an expression, and simplify them so the number of parenthesis inside the expression decreases. So far I've been able to implement most rules except two, for which I've decided t...
stackexchange/codereview
I am trying to interpret HttpReferer strings in our server logs. It seems like there is quite a high number of empty values. I am wondering how many of these empty values are due to direct hits from people entering our URL directly into a browser and how many might be due to some kind of blocking utility that prevents ...
stackexchange/codereview
I need to write the content of a map (key is ID of int, value is of self-defined struct) into a file, and load it from the file later on. Can I do it in MFC with CArchive? Thank you!
stackexchange/codereview
I'm having a bit of trouble trying to get class variables to work in javascript. I thought that I understood the prototype inheritance model, but obviously not. I assumed that since prototypes will be shared between objects then so will their variables. This is why this bit of code confuses me. What is the correct ...
stackexchange/codereview
My situation is as follows: I have a normalized database, in which I hold geographic information about airports. The structure is: airport --is in--> city --is in--> country --is in--> continent Now I want to let users administrate this data, without giving them direct access to the database. We need to offer this adm...
stackexchange/codereview
I am creating my application using Django, and am wondering how I can make Django use my CSS file? What settings do I need to do to make Django see the css file? NB: On a local machine
stackexchange/codereview
Is it possible to implement autoboxing for your own classes? To illustrate my example, this is what I might want to write: Foo foo = "lolcat"; And this is what Java would do (as per my own definitions, somewhere, somehow), under the hood: Foo foo = new Foo(); foo.setLolcat("lolcat"); So, is this possible somehow, or ...
stackexchange/codereview
I'm using VS2008 for a C++ project. The code is quite old and has passed through many hands. There are several classes hierarchies, functions, enums and so on which are no longer being used. Is there a way to get the compiler/linker to list out identifiers which have been declared or defined but are not being referred ...
stackexchange/codereview
Let's say I have an array of lots of values (C++ syntax, sorry): vector<double> x(100000); This array is sorted such that x[n] > x[n-1]. I would like a function to retrieve an array of all values in the range [a, b] (that's inclusive). Some interface like: void subarray(const double a, const double b, vector<double> &...
stackexchange/codereview
I am currently looking at different ORM solutions for a project that is planned for this spring. Entity Framework is one of the products I am looking closer at, but EF 2.0 would be quite a lot more interesting. Has there been any indications to when version 2.0 of Entity Framework is planned to be released? With .Net 4...
stackexchange/codereview
How do I create an Application Pool on IIS 6.0 using a PowerShell script? This is what I have come up with so far ... $appPool = [wmiclass] "root\MicrosoftIISv2:IIsApplicationPool" Thanks
stackexchange/codereview
I have been running Apache HTTPD in 64bit mode by stripping out the 32bit architecture from the binary (along with the ppc parts). I did this to make it more compatible for python and mysql. However I have another machine that needs it to be run in 32bit mode (it has all four original architectures still in it). Is it ...
stackexchange/codereview
I believe that Agile is nothing but another implementation of Spiral Model. I am a big supporter of Spiral (The spiral model is a software development process combining elements of both design and prototyping-in-stages, in an effort to combine advantages of top-down and bottom-up concepts) since its beginnings and have...
stackexchange/codereview
How would you maintain the legacy applications that: Has no unit tests have big methods with a lot of duplicated logic have have No separation of concern have a lot of quick hacks and hard coded strings have Outdated and wrong documentation Requirements are not properly documented! This has actually resulted in disput...
stackexchange/codereview
Anyone out there with sufficient knowledge of EMC Documentum and Oracle to know whether it is possible to set up a documentum repository on top of oracle so that it uses Character based field lengths rather than byte based. By Default Documentum seems to use byte based fields so if a field is string(32) it can contain ...
stackexchange/codereview
What open source projects would you recommend as a good place for a starting open source developer? Factors that I think would be important are some obvious ones like well written code and a community that is helpful to newbies. But it might be nice if the code base is such that I can start hacking some small problems ...
stackexchange/codereview
How can I create the "Infinite" symbol in an excel sheet programmatically? Preferably from Java...but other tips are also welcome. Thx.
stackexchange/codereview
I have a set of applications that all rely on a cross-platform library (in-house development), and everything is stored in subversion. Now, this library is part of every app and as such a copy of it has to be in each app's working directory. In order to be able to go back to any version of an app and have the correct ...
stackexchange/codereview
If everything that can be accomplished in MXML can also be accomplished in ActionScript and many things are easier to accomplish in ActionScript (loops, conditionals, etc) why take the time to learn MXML? The best reasons I have at this point are that the structure of the MXML nicely matches the visual hierarchy of the...
stackexchange/codereview
This is the PATH variable without sudo: $ echo 'echo $PATH' | sh /opt/local/ruby/bin:/usr/bin:/bin This is the PATH variable with sudo: $ echo 'echo $PATH' | sudo sh /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin As far as I can tell, sudo is supposed to leave PATH untouched. What's goin...
stackexchange/codereview
I was writing a program in C++ to find all solutions of ab = c, where a, b and c together use all the digits 0-9 exactly once. The program looped over values of a and b, and it ran a digit-counting routine each time on a, b and ab to check if the digits condition was satisfied. However, spurious solutions can be genera...
stackexchange/codereview
How would I print a spinning curser in a utility that runs in a terminal using standard C? I'm looking for something that prints: \ | / - over and over in the same position on the screen? Thanks
stackexchange/codereview
I'd like to do the equivalent of the following in LINQ, but I can't figure out how: IEnumerable<Item> items = GetItems(); items.ForEach(i => i.DoStuff()); What is the real syntax?
stackexchange/codereview
I have a J2EE based web application. In one of the pages there is a button labeled "Print". My problem is something like this: User enters tool names for e.g: ToolName1 ToolName2 ToolName3 Then clicks on "Print". The intended action is that tool details of the 3 tools are retrieved from db and then printed one tool per...
stackexchange/codereview
I have some auto-generated code which effectively writes out the following in a bunch of different places in some code: no warnings 'uninitialized'; local %ENV = %ENV; local $/ = $/; local @INC = @INC; local %INC = %INC; local $_ = $_; local $| = $|; local %SIG = %SIG; use warnings 'uninitialized'; When auto-gen...
stackexchange/codereview
Many C++ books contain example code like this... std::cout << "Test line" << std::endl; ...so I've always done that too. But I've seen a lot of code from working developers like this instead: std::cout << "Test line\n"; Is there a technical reason to prefer one over the other, or is it just a matter of coding style?
stackexchange/codereview
I have been asked to setup a course leaflet system for a college. For whatever reason in the past their current system is not linked to their actual course file, they wish to close this link so course leaflets are related to actual course codes. Unfortunately their course file is a ms access database linked to many of ...
stackexchange/codereview
Why are inline closures so rarely used in Actionscript? They are very powerful and I think quite readable. I hardly ever see anyone using them so maybe I'm just looking at the wrong code. Google uses them in their Google Maps API for Flash samples, but I think thats the only place I've seen them. I favor them because y...
stackexchange/codereview
I am a Cake PHP novice. I want to edit the table "Issue". This table contains a field "priority_id" related to another table called "Priority" by an foreign key. This table contains three values "Severe", "Disaster", "ToDo". User can select the priority using a combobox (input select). The priorities are loaded like t...
stackexchange/codereview
Our application is written in C++ and used on Windows XP. On some client machines with only a C: drive, an error pop ups when the application starts: There is no disk in the drive. Please insert a disk into drive "D" If they hit "Continue" or insert a CD (even an empty one!) and press "Try Again", everything works fi...
stackexchange/codereview
I'd like to compare two consecutive elements in a std::list while iterating through the list. What is the proper way to access element i+1 while my iterator is at element i? Thanks Cobe
stackexchange/codereview
I am trying to download an xml.gz file from a remote server with HttpsURLConnection in java, but I am getting an empty response. Here is a sample of my code: URL server = new URL("https://www.myurl.com/path/sample_file.xml.gz"); HttpsURLConnection connection = (HttpsURLConnection)server.openConnection(); connection.co...
stackexchange/codereview
Does MSTest have standalone GUI similar to nUnit that lets me use it and run test without visual studio? What is the official site for MSTest where I can learn more about how to use it?
stackexchange/codereview
I'm using WinSNMP in c++ to send snmp traps. For backwards compatibility I’m required to send v1 snmp traps. WinSNMP works with v2 traps but is capable of converting those v2 traps to v1 when sending the trap. I use SnmpSetTranslateMode(SNMPAPI_UNTRANSLATED_V1) in order to do that. I also added the sysUpTime oid (1.3.6...
stackexchange/codereview
We all know to keep it simple, right? I've seen complexity being measured as the number of interactions between systems, and I guess that's a very good place to start. Aside from gut feel though, what other (preferably more objective) methods can be used to determine the level of complexity of a particular design or pi...
stackexchange/codereview
Much searching has lead me to find several descriptions of how to create a bootstrapping msi, but these solutions all assume the msi is local or a standard Windows component. Is there a way to make an msi that downloads an installer (which is also an msi) with normal MSI or Wix code rather than by having the bootstrap...
stackexchange/codereview
I have a batch file (in windows XP, with command extension activated) with the following line: for /f %%s in ('type version.txt') do set VERSION=%%s On some computer, it works just fine (as illustrated by this SO question), but on other it kills cmd (the console window just closes) Why ? Note: the computers seem to h...
stackexchange/codereview
I created a new project in VS2008. Project type Visual C# > Office > 2007 > Word 2007 Document Added some code.. got Word to do a few jumps through some custom hoops.. all fine. Now I need to reference another assembly (CopyLocal as false) which is not signed. So I add the project reference. Now the project will not ...
stackexchange/codereview
I need to convert a bundle of static HTML documents into a single PDF file programmatically on the server side on a Java/J2EE platform using a batch process preferably. The pdf files would be distributed to site users for offline browsing of the web pages. The major points of the requirements are: The banner at the t...
stackexchange/codereview
Is there in Ruby some functionality/syntax to compare two floats with delta? Something similar to assert_in_delta(expected_float, actual_float, delta) from test/unit but returning Boolean?
stackexchange/codereview