instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
I am a .NET webdev using ASP.NET, C# etc... I "learned" javascript in college 5+ years ago and can do basic jobs with it. But I wonder if it is useful to become proficient in it. Why should I learn Javascript? Is it more advantageous then learning JQuery or a different library?
stackexchange/codereview
I have a real-time embedded app with the major cycle running at 10KHz. It runs on a TI TMS320C configured to boot from flash. I recently added an initialized array to a source file, and all of a sudden the timing is screwed up (in a way too complex to explain well - essentially a serial port write is no longer comp...
stackexchange/codereview
In Bash, how do I count the number of non-blank lines of code in a project?
stackexchange/codereview
I want to have a PHP script send a XML formatted string to another PHP script that resides on a different server in a different part of town. Is there any nice, clean way of doing this? (PHP5 and all the latest software available)
stackexchange/codereview
When adding new properties to classes, I find myself typing the same things over and over in xcode: add TYPE *NAME; (in .h interface) add @property (nonatomic, retain) TYPE *NAME; (in .h) add @synthesize NAME; (in .m) add [NAME release]; (in .m dealloc) (I'm in a non-garbage collected environment.) How can I do this ...
stackexchange/codereview
What is the best way to resolve a conflict when doing a git svn rebase, and the git branch you are on becomes "(no-branch)"?
stackexchange/codereview
Is there any way to get Python to use my ActiveTcl installation instead of having to copy the ActiveTcl libraries into the Python/tcl directory?
stackexchange/codereview
What property in Netbeans to I need to change to set the name of my java swing app in the OS X menubar and dock? I found info.plist, but changing @PROJECTNAMEASIDENTIFIEER@ in multiple keys here had no effect. Thanks, hating netbeans.
stackexchange/codereview
It's common knowledge that using System.Diagnostics.Process.Start is the way to launch a url from a C# applicaiton: System.Diagnostics.Process.Start("http://www.mywebsite.com"); However, if this url is invalid the application seems to have no way of knowing that the call failed or why. Is there a better way to launch a...
stackexchange/codereview
I have an application which behaves as a slideshow for all pictures in a folder. It is written in Borland's C++ Builder (9). It currently uses some borrowed code to throw the filenames into a listbox and save the listbox items as a text file. I want to update this so that the filenames are stored in a proper database ...
stackexchange/codereview
I have a problem with a string in C++ which has several words in Spanish. This means that I have a lot of words with accents and tildes. I want to replace them for their not accented counterparts. Example: I want to replace this word: "había" for habia. I tried replace it directly but with replace method of string clas...
stackexchange/codereview
I have developed a couple of extensions for Firefox, and am annoyed that it is so hard to get the extension signed. When an extension isn't signed, it says "Author not verified" when it is installed, and to me that just looks wrong. I have a simple build script that builds my .xpi file from sources, and I have a licen...
stackexchange/codereview
I have a page in my vb.net web application that needs to toss a bunch of data into a text file and then present it to the user for download. What's the best / most efficient way to build such a text file on a .net web server? Edit: to answer a question down below, this is going to be a download once and then throw-awa...
stackexchange/codereview
I am in the process of designing a Web Services course for students in an Information Technology program. Some students stop after getting a two-year associates degree, but other students in the program go on to a four-year bachelor's degree. This course would be for students going on to the four-year degree. My init...
stackexchange/codereview
I have a project the requires the use of the exec family. My project consist of making an interactive shell. The shell will implement a few basic commands like cd, ls, echo, etc. I have been researching the use of exec, but have not found a useful site. Any suggested links would help. int ret; ret = execl ("/bin/ls", "...
stackexchange/codereview
I currently have a fairly robust server-side validation system in place, but I'm looking for some feedback to make sure I've covered all angles. Here is a brief outline of what I'm doing at the moment: Ensure the input is not empty, or is too long Escape query strings to prevent SQL injection Using regular expressions...
stackexchange/codereview
Are there any other IDEs worth my time for Lotus Notes development? We're doing mostly LotusScript development and would kill for features of Eclipse or Visual Studio, like "Show Declaration". I know there's an Eclipse plugin for Java development in Notes, but seems like it only does Java, and we have too many pieces o...
stackexchange/codereview
I use Eclipse 3.3 in my daily work, and have also used Eclipse 3.2 extensively as well. In both versions, sometimes the Search options (Java Search, File Search, etc) in the menu get disabled, seemingly at random times. However, with Ctrl+H, I am able to access the search functionality. Does anyone know why this hap...
stackexchange/codereview
I am running VS Team Studio 2008. I have created a web test that I want to use for monitoring a company web site. It interacts with the site and does some round trip processing. I want to create a standalone EXE file that can be run remotely. I have tried converting it to VB code and C# code and then creating compili...
stackexchange/codereview
Consider these classes. class Base { ... }; class Derived : public Base { ... }; this function void BaseFoo( std::vector<Base*>vec ) { ... } And finally my vector std::vector<Derived*>derived; I want to pass derived to function BaseFoo, but the compiler doesn't let me. How do I solve this, without copying...
stackexchange/codereview
One of the basic data structures in Python is the dictionary, which allows one to record "keys" for looking up "values" of any type. Is this implemented internally as a hash table? If not, what is it?
stackexchange/codereview
I'm writing a program that uses SetWindowRgn to make transparent holes in a window that belongs to another process. (This is done only when the user explicitly requests it.) The program has to assume that the target window may already have holes which need to be preserved, so before it calls SetWindowRgn, it calls GetW...
stackexchange/codereview
Can someone explain what exactly the string "0 but true" means in Perl? As far as I understand, it equals zero in an integer comparison, but evaluates to true when used as a boolean. Is this correct? Is this a normal behavior of the language or is this a special string treated as a special case in the interpreter?
stackexchange/codereview
My site has quite a deep navigation structure and quite often it looks like the out of the box navigation is leaking memory, especially the SPWeb objects. The log message looks like Potentially excessive number of SPRequest objects (14) currently unreleased on thread 5. Ensure that this object or its parent (such as ...
stackexchange/codereview
Is the D language a credible alternative to Java and C++? What will it take to become a credible alternative? Should I bother learning it? Does it deserve evangelizing? The main reason I ask is that with the new C++ standard (c++0x) almost here, it's clear to me that the language has gone well past the point of no retu...
stackexchange/codereview
Is there any way to create the query parameters for doing a GET request in JavaScript? Just like in Python you have urllib.urlencode(), which takes in a dictionary (or list of two tuples) and creates a string like 'var1=value1&var2=value2'.
stackexchange/codereview
Ok, so my method in my webservice requires a type to be passed, it is called in the ServiceMethod property of the AutoCompleteExtender, I am fuzzy about how I should do that so I called it like this: ServiceMethod="DropDownLoad<<%=(typeof)subCategory%>>" where subCategory is a page property that looks like this: prote...
stackexchange/codereview
I'm sending mail from my C# Application, using the SmtpClient. Works great, but I have to decide if I want to send the mail as Plain Text or HTML. I wonder, is there a way to send both? I think that's called multipart. I googled a bit, but most examples essentially did not use SmtpClient but composed the whole SMTP-Bod...
stackexchange/codereview
What would be your preferred way to concatenate strings from a sequence such that between every two consecutive pairs a comma is added. That is, how do you map, for instance, ['a', 'b', 'c'] to 'a,b,c'? (The cases ['s'] and [] should be mapped to 's' and '', respectively.) I usually end up using something like ''.join(...
stackexchange/codereview
I want to use an image or icon as a custom cursor in WPF app. How can I do that?
stackexchange/codereview
I have several different locations in a fairly wide area, each with a Linux server storing company data. This data changes every day in different ways at each different location. I need a way to keep this data up-to-date and synced between all these locations. For example: In one location someone places a set of images...
stackexchange/codereview
Between Eclipse/SWT or Netbeans/Matisse, what does either Java GUI editor give you in terms of rapid development and maintainability?
stackexchange/codereview
Is there a way to collect (e.g. in a List) multiple 'generic' objects that don't share a common super class? If so, how can I access their common properties? For example: class MyObject<T> { public T Value { get; set; } public string Name { get; set; } public MyObject(string name, T value) { Name = n...
stackexchange/codereview
I'm attempting to make a DTS package to transfer data between two databases on the same server and I'm getting the following errors. Iv read that the Multiple-step OLE DB operation generated error can occur when you are transferring between different database types and there is loss of precision, but this is not that c...
stackexchange/codereview
I assume that char* = "string" is the same to char* = new char[6]. I believe these strings are created on the heap instead of the stack. So do I need to destroy them or free their memory when I'm done using them or do they get destroyed by themselves?
stackexchange/codereview
Is it possible to convert a com.vividsolutions.jts.geom.Geometry (or a subclass of it) into a class that implements java.awt.Shape? Which library or method can I use to achieve that goal?
stackexchange/codereview
Does anyone know of any way to convert a simple gif to xaml? E.G. A tool that would look at an image and create elipses, rectangles and paths based upon a gif / jpg / bitmap?
stackexchange/codereview
The official J2ME implementation of Hessian seems to have serious limitations : complex objects are not supported. This limitation is not mentioned anywhere on the online documentation, but if you google "hessian j2me" you will find posts about this problem. No solutions found with google though. Does anyone have a so...
stackexchange/codereview
What is the easiest way to extract the original exception from an exception returned via Apache's implementation of XML-RPC?
stackexchange/codereview
I am a MFC programmer who is new to C# and am looking for a simple control that will allow number entry and range validation.
stackexchange/codereview
I'm trying to write some C# code to get to a specific folder in an Outlook mailbox. I have the following code: Outlook.Application oApp = new Outlook.Application(); Outlook.NameSpace oNS = oApp.GetNamespace("mapi"); Outlook.Recipient oRecip = oNS.CreateRecipient("AccountNameHere"); oRecip.Resolve(); if (oRecip.Resolved...
stackexchange/codereview
I know that that is not a question... erm anyway HERE is the question. I have inherited a database that has 1(one) table in that looks much like this. Its aim is to record what species are found in the various (200 odd) countries. ID Species Afghanistan Albania Algeria American Samoa Andorra Angola .... Western Sahara...
stackexchange/codereview
Should each class in my C# project get its own file (in your opinion)?
stackexchange/codereview
I have a couple applications that I would like to be able to add scheduled tasks from within them. I've been Googling for how to add tasks in both XP and Vista. Apparently, Vista has a new Task Scheduler that is very different from the one in XP. Does anybody know if there is a single API to tackle both of them, or do ...
stackexchange/codereview
Say I have: void Render(void(*Call)()) { D3dDevice->BeginScene(); Call(); D3dDevice->EndScene(); D3dDevice->Present(0,0,0,0); } This is fine as long as the function I want to use to render is a function or a static member function: Render(MainMenuRender); Render(MainMenu::Render); However, I really wa...
stackexchange/codereview
We've developed a Java application and would like to use this application from a C# client. The application has dependencies on Spring, Log4j, ... What would be the most efficient mechanism - make DLL(s) from Java code, ... - to achieve this ?
stackexchange/codereview
I always seem to have a hard time starting a new Firefox extension. Can anyone recommend a good extension skeleton, scaffold, or code generator? Ideally one that follows all the best practices for FF extensions?
stackexchange/codereview
Some context upfront: Imagine a 200+ developers company finally setting up a more or less independent architecture team/department. The software portfolio consisting of 20+ "projects"/applications of varying sizes in production was taken care of by team-leads/technical-leads, who were responsible for and in charge of t...
stackexchange/codereview
I have a Rails 2.0.2 application running with a postgresql db. The machine will receive data on a TCP port. I already have coded a working ruby multithreaded tcp server to receive the requests, but I need this code to run alongside my Rails app. So I guess I need to know how to span a new process inside Rails, or how t...
stackexchange/codereview
Can anyone recommend a dropdownlist control for asp.net (3.5) that can render option groups? Thanks
stackexchange/codereview
I have an app that needs to open a new window (in the same domain) so the user can view a report, but on some browsers* the new window doesn't share the non-persistent cookie of the original window, which causes the user to have to sign in again. Is there anything I can do to stop the user having to sign in again in th...
stackexchange/codereview
I want to use the macports version of python instead of the one that comes with Leopard.
stackexchange/codereview
Please read the whole question. I'm not looking for an approach to managing multi-lingual content, but I'm looking for a way to actually get that multi-lingual content. This usually falls within technical recommendations on most projects I work on, and I hope someone can offer some help. We are working with a client no...
stackexchange/codereview
I'm using TinyXML to parse/build XML files. Now, according to the documentation this library supports multibyte character sets through UTF-8. So far so good I think. But, the only API that the library provides (for getting/setting element names, attribute names and values, ... everything where a string is used) is thro...
stackexchange/codereview
Is there a built-in editor for a multi-line string in a PropertyGrid.
stackexchange/codereview
When people download files from my website, I don't want them to be able to download faster than 300KB/sec per file. Is there anyway to do this? I'm running IIS 6.0 on Windows Server 2003.
stackexchange/codereview
We have a large codebase that takes approx 12 minutes on the developer machines to auto-generate some Java 5 classes using JavaCC and then compiles all the classes as well as running the units test. The project consists of multiple projects which can be built in groups, but we are aiming for a full a build in under 10 ...
stackexchange/codereview
The sample below has two TextBoxes. The second TextBox has a handler for the LostFocus event which calls Clear() on itself. Changing focus between the two text boxes works fine; however, if the focus is on the second text box when the window is closed, TextBox.Clear() generates a NullReferenceException. Is this a b...
stackexchange/codereview
In an AI application I am writing in C++, there is not much numerical computation there are lot of structures for which run-time polymorphism is needed very often, several polymorphic structures interact during computation In such a situation, are there any optimization techniques? While I won't care to optimize...
stackexchange/codereview
Is anyone successfully using the CJ web services? I just keep getting java.lang.NullPointerExceptions even though my app is .net (clearly their errors). CJ support doesn't even know what a web service is. I googled and found many people getting this or other errors. Question is: is it a temporary problem or am I doomed...
stackexchange/codereview
I am a firm believer in the idea that one of the most important things you get from learning a new language is not how to use a new language, but the knowledge of concepts that you get from it. I am not asking how important or useful you think Assembly is, nor do I care if I never use it in any of my real projects. Wh...
stackexchange/codereview
How can I access UserId in ASP.NET Membership without using Membership.GetUser(username) in ASP.NET Web Application Project? Can UserId be included in Profile namespace next to UserName (System.Web.Profile.ProfileBase)?
stackexchange/codereview
This is a bit of a weird one, and I could well be coding this completely wrong - hence why I've hit the same error twice in two days, in completely different parts of a script. The code I'm using is below: public function findAll( $constraints = array() ) { // Select all records $SQL = 'SELECT * F...
stackexchange/codereview
Is there a good reason why there is no Pair<L,R> in Java? What would be the equivalent of this C++ construct? I would rather avoid reimplementing my own. It seems that 1.6 is providing something similar (AbstractMap.SimpleEntry<K,V>), but this looks quite convoluted.
stackexchange/codereview
Yet again, my teacher was unable to answer my question. I knew who may be able to... So, I've never really learned C. In C++, I would, obviously, use a cout statement all of the time. In a recent assignment, my teacher told us to make sure to put setbuf( stdout , NULL ); at the top of main() in order to get an unbuff...
stackexchange/codereview
The title is self explanatory. Is there a way of directly doing such kind of importing?
stackexchange/codereview
When using mercurial, I'd like to be able to diff the working copy of a file with the tip file in my default remote repository. Is there an easy way to do this? I know I can do an "hg incoming -p" to see the patch sets of changes coming in, but it'd be nice to just directly see the actual changes for a particular file...
stackexchange/codereview
I'm using a few (2 or 3) master pages in my ASP.NET MVC application and they must each display bits of information from the database. Such as a list of sponsors, current fundings status etc. So my question was, where should I put these master-page database calling code? Normally, these should goes into its own controll...
stackexchange/codereview
From this post. One obvious problem is scalability/performance. What are the other problems that transactions use will provoke? Could you say there are two sets of problems, one for long running transactions and one for short running ones? If yes, how would you define them? EDIT: Deadlock is another problem, but data i...
stackexchange/codereview
I'm working on a web-based contest which is supposed to allow anonymous users to vote, but we want to prevent them from voting more than once. IP based limits can be bypassed with anonymous proxies, users can clear cookies, etc. It's possible to use a Silverlight application, which would have access to isolated storage...
stackexchange/codereview
Has anyone had and solved a problem where programs would terminate without any indication of why? I encounter this problem about every 6 months and I can get it to stop by having me (the administrator) log-in then out of the machine. After this things are back to normal for the next 6 months. I've seen this on Windo...
stackexchange/codereview
I'm using C# and i have written a locally installed application that dynamically generates files which need to be on an FTP server. Do i generate them to disk then upload them to the FTP server? or is there a way to open a stream to an FTP server and write the files directly?
stackexchange/codereview
I often use the "top" command to see what is taking up resources. Mostly it comes up with a long list of Apache httpd processes, which is not very useful. Is there any way to see a similar list, but such that I could see which PHP scripts etc. those httpd processes are actually running?
stackexchange/codereview
OK, this might sound a bit confusing and complicated, so bear with me. We've written a framework that allows us to define friendly URLs. If you surf to any arbitrary URL, IIS tries to display a 404 error (or, in some cases, 403;14 or 405). However, IIS is set up so that anything directed to those specific errors is sen...
stackexchange/codereview
Is it possible to get the progress of an XMLHttpRequest (bytes uploaded, bytes downloaded)? This would be useful to show a progress bar when the user is uploading a large file. The standard API doesn't seem to support it, but maybe there's some non-standard extension in any of the browsers out there? It seems like a p...
stackexchange/codereview
I have a question about best practices regarding how one should approach storing complex workflow states for processing tasks in a database. I've been looking online to no avail, so I figured I'd ask the community what they thought was best. This question comes out of the same "BoxItem" example I gave in a prior quest...
stackexchange/codereview
I'm a bit of a DI newbie, so forgive me if this is the wrong approach or a silly question. Let's say I have a form which creates/updates an order, and I know it's going to need to retrieve a list of products and customers to display. I want to pass in the Order object that it's editing, but I also want to inject the Pr...
stackexchange/codereview
How do I set an attribute on a field anywhere in my assembly, then reflect on those field attributes in my entire assembly and get/set the field values that the attribute is attached too?
stackexchange/codereview
I would like to turn the HTML generated by my CFM page into a PDF, and have the user prompted with the standard "Save As" prompt when navigating to my page.
stackexchange/codereview
In JavaScript, what is the best way to determine if a date provided falls within a valid range? An example of this might be checking to see if the user input requestedDate is part of the next valid work week. Note that this is not just checking to see if one date is larger than another as a valid date would be equal to...
stackexchange/codereview
I have somehow misconfigured fingers. This leads to a very annoying situation. I select a block of text to copy; I move the cursor the place where I want to paste the code; I accidentally press Ctrl+C again instead of Ctrl+V; My block of copied text is replaced by an empty block; I have to go back and do it all over a...
stackexchange/codereview
I've begun to use TDD. As mentioned in an earlier question the biggest difficulty is handling interface changes. How do you reduce the impact on your test cases as requirements change?
stackexchange/codereview
I mean, how does Java decide which protocols are available? I run some code from inside Eclipse, and it works just fine. Then I run the same code from outside Eclipse, and I get "unknown protocol" MalformedURLException. Probably it has to do with the code base, or something? Any hints would be helpful. Thanks!
stackexchange/codereview
For an embedded system I need to place a few data structures at fixed addresses, so that a separate control CPU can access them at a known location. I'm using linker scripts for the embedded target to accomplish this, plus #defines of those same addresses for the control CPU. It bothers me that these address constants ...
stackexchange/codereview
Is there any way to see an overview of what kind of queries are spent the most time on every day on MySQL?
stackexchange/codereview
I have the following problem: I have an HTML textbox (<input type="text">) whose contents are modified by a script I cannot touch (it is my page, but i'm using external components). I want to be notified in my script every time the value of that textbox changes, so I can react to it. I've tried this: txtStartDate.obser...
stackexchange/codereview
I'm using C and sometimes I have to handle paths like C:\Whatever C:\Whatever\ C:\Whatever\Somefile Is there a way to check if a given path is a directory or a given path is a file?
stackexchange/codereview
At my house I have about 10 computers all different processors and speeds (all x86 compatible). I would like to cluster these. I have looked at openMosix but since they stopped development on it I am deciding against using it. I would prefer to use the latest or next to latest version of a mainstream distribution of Li...
stackexchange/codereview
We run full re-indexes every 7 days (i.e. creating the index from scratch) on our Lucene index and incremental indexes every 2 hours or so. Our index has around 700,000 documents and a full index takes around 17 hours (which isn't a problem). When we do incremental indexes, we only index content that has changed in the...
stackexchange/codereview
We are putting up a company blog at companyname.com/blog but for now the blog is a Wordpress installation that lives on a different server (blog.companyname.com). The intention is to have the blog and web site both on the same server in a month or two, but that leaves a problem in the interim. At the moment I am using...
stackexchange/codereview
I am working with a log of events where there are about 60 different "types" of events. Each event shares about 10 properties, and then there are subcategories of events that share various extra properties. How I work with these events does depend on their type or what categorical interfaces they implement. But it seem...
stackexchange/codereview
I have a table UserAliases (UserId, Alias) with multiple aliases per user. I need to query it and return all aliases for a given user, the trick is to return them all in one column. Example: UserId/Alias 1/MrX 1/MrY 1/MrA 2/Abc 2/Xyz I want the query result in the following format: UserId/Alias 1/ MrX, MrY...
stackexchange/codereview
fossil http://www.fossil-scm.org I found this recently and have started using it for my home projects. I want to hear what other people think of this VCS. What is missing in my mind, is IDE support. Hopefully it will come, but I use the command line just fine. My favorite things about fossil: single executable with...
stackexchange/codereview
I'm trying to make some of my code a bit more friendly to non-pure-ascii systems and was wondering if there was a particular character encoding used for NEEDED entries in ELF binaries, or is it rather unstandard and based on the creating system's filesystem encoding (or even just directly the bytes that were passed to ...
stackexchange/codereview
I need to pad numbers with leading zeros (total 8 digits) for display. I'm using oracle. select to_char(1011,'00000000') OPE_NO from dual; select length(to_char(1011,'00000000')) OPE_NO from dual; Instead of '00001011' I get ' 00001011'. Why do I get an extra leading blank space? What is the correct number formatting ...
stackexchange/codereview
I'm just trying to time a piece of code. The pseudocode looks like: start = get_ticks() do_long_code() print "It took " + (get_ticks() - start) + " seconds." How does this look in Python? More specifically, how do I get the number of ticks since midnight (or however Python organizes that timing)?
stackexchange/codereview
I have seen another program provide traceroute functionality within it but without needing root (superuser) privileges? I've always assumed that raw sockets need to be root, but is there some other way? (I think somebody mentioned "supertrace" or "tracepath"?) Thanks!
stackexchange/codereview
How can I set the protected DoubleBuffered property of the controls on a form that are suffering from flicker?
stackexchange/codereview
What's the best way to implement a SQL script that will grant select, references, insert, update, and delete permissions to a database role on all the user tables in a database? Ideally, this script could be run multiple times, as new tables were added to the database. SQL Server Management Studio generates scripts for...
stackexchange/codereview
My server already runs IIS on TCP ports 80 and 443. I want to make a centralized "push/pull" Git repository available to all my team members over the Internet. So I should use HTTP or HTTPS. But I cannot use Apache because of IIS already hooking up listening sockets on ports 80 and 443! Is there any way to publish a Gi...
stackexchange/codereview