Poular Questions

13

answers

mysqli or PDO - what are the pros and cons?

In our place we're split between using mysqli and PDO for stuff like prepared statements and transaction support. Some projects use one, some the other. There is little realistic likelihood of us ever..

19

answers

What's the difference between struct and class in .NET?

What's the difference between struct and class in .NET?..

11

answers

Mercurial stuck "waiting for lock"

Got a bluescreen in windows while cloning a mercurial repository. After reboot, I now get this message for almost all hg commands: c:\src\>hg commit waiting for lock on repository c:\src\McVrsServe..

14

answers

How do I tell if a variable has a numeric value in Perl?

Is there a simple way in Perl that will allow me to determine if a given variable is numeric? Something along the lines of: if (is_number($x)) { ... } would be ideal. A technique that won't throw..

13

answers

What is the easiest way to parse an INI File in C++?

I'm trying to parse an INI file using C++. Any tips on what is the best way to achieve this? Should I use the Windows API tools for INI file processing (with which I am totally unfamiliar), an open-so..

9

answers

How do you get a directory listing in C?

How do you scan a directory for folders and files in C? It needs to be cross-platform...

27

answers

How should I unit test multithreaded code?

I have thus far avoided the nightmare that is testing multi-threaded code since it just seems like too much of a minefield. I'd like to ask how people have gone about testing code that relies on thre..

12

answers

Calling the base constructor in C#

If I inherit from a base class and want to pass something from the constructor of the inherited class to the constructor of the base class, how do I do that? For example, if I inherit from the Except..

6

answers

Browse for a directory in C#

How can I present a control to the user that allows him/her to select a directory? There doesn't seem to be any native .net controls which do this?..

30

answers

Case-insensitive string comparison in C++

What is the best way of doing case-insensitive string comparison in C++ without transforming a string to all uppercase or all lowercase? Please indicate whether the methods are Unicode-friendly and h..

19

answers

How do you kill all current connections to a SQL Server 2005 database?

I want to rename a database, but keep getting the error that 'couldn't get exclusive lock' on the database, which implies there is some connection(s) still active. How can I kill all the connections ..

8

answers

How to parse XML using vba

I work in VBA, and want to parse a string eg <PointN xsi:type='typens:PointN' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xs='http://www.w3.org/2001/XMLSchema'> <X>..

9

answers

Refresh Excel VBA Function Results

How can I get a user-defined function to re-evaluate itself based on changed data in the spreadsheet? I tried F9 and Shift+F9. The only thing that seems to work is editing the cell with the function..

7

answers

What are the proper permissions for an upload folder with PHP/Apache?

Sorry for the basic question - I'm a .NET developer and don't have much experience with LAMP setups. I have a PHP site that will allow uploads to a specific folder. I have been told that this folder ..

16

answers

How can you customize the numbers in an ordered list?

How can I left-align the numbers in an ordered list? 1. an item // skip some items for brevity 9. another item 10. notice the 1 is under the 9, and the item contents also line up Change the char..

23

answers

LINQ query on a DataTable

I'm trying to perform a LINQ query on a DataTable object and bizarrely I am finding that performing such queries on DataTables is not straightforward. For example: var results = from myRow in myDataT..

18

answers

How to programmatically send SMS on the iPhone?

Does anybody know if it's possible, and how, to programmatically send a SMS from the iPhone, with the official SDK / Cocoa Touch?..

18

answers

Compare a date string to datetime in SQL Server?

In SQL Server I have a DATETIME column which includes a time element. Example: '14 AUG 2008 14:23:019' What is the best method to only select the records for a particular day, ignoring the time..

10

answers

Why are my PowerShell scripts not running?

I wrote a simple batch file as a PowerShell script, and I am getting errors when they run. It's in a scripts directory in my path. This is the error I get: Cannot be loaded because the execution ..

12

answers

Differences between MySQL and SQL Server

I'm an ASP.NET developer who has used Microsoft SQL Server for all my database needs (both at work and for personal projects). I am considering trying out the LAMP stack for some of my personal proj..

34

answers

How can I set up an editor to work with Git on Windows?

I'm trying out Git on Windows. I got to the point of trying "git commit" and I got this error: Terminal is dumb but no VISUAL nor EDITOR defined. Please supply the message using either -m or -..

11

answers

Oracle - What TNS Names file am I using?

Sometimes I get Oracle connection problems because I can't figure out which tnsnames.ora file my database client is using. What's the best way to figure this out? ++happy for various platform soluti..

16

answers

Convert a hexadecimal string to an integer efficiently in C?

In C, what is the most efficient way to convert a string of hex digits into a binary unsigned int or unsigned long? For example, if I have 0xFFFFFFFE, I want an int with the base10 value 4294967294...

6

answers

How do I create a Linked List Data Structure in Java?

What's the best way to make a linked list in Java?..

27

answers

How do I remove duplicates from a C# array?

I have been working with a string[] array in C# that gets returned from a function call. I could possibly cast to a Generic collection, but I was wondering if there was a better way to do it, possibly..

8

answers

How do you pass a function as a parameter in C?

I want to create a function that performs a function passed by parameter on a set of data. How do you pass a function as a parameter in C?..

13

answers

How do you create a static class in C++?

How do you create a static class in C++? I should be able to do something like: cout << "bit 5 is " << BitParser::getBitAt(buffer, 5) << endl; Assuming I created the BitParser cla..

9

answers

Removing elements with Array.map in JavaScript

I would like to filter an array of items by using the map() function. Here is a code snippet: var filteredItems = items.map(function(item) { if( ...some condition... ) { return item; ..

32

answers

Select all columns except one in MySQL?

I'm trying to use a select statement to get all of the columns from a certain MySQL table except one. Is there a simple way to do this? EDIT: There are 53 columns in this table (NOT MY DESIGN)..

14

answers

grep a file, but show several surrounding lines?

I would like to grep for a string, but also show the preceding five lines and the following five lines as well as the matched line. How would I be able to do this?..

296

answers

Hidden Features of C#?

This came to my mind after I learned the following from this question: where T : struct We, C# developers, all know the basics of C#. I mean declarations, conditionals, loops, operators, etc. Some..

10

answers

Storing a file in a database as opposed to the file system?

Generally, how bad of a performance hit is storing a file in a database (specifically mssql) as opposed to the file system? I can't come up with a reason outside of application portability that I wou..

16

answers

Accessing MP3 metadata with Python

How can I retrieve mp3 metadata in Python?..

8

answers

Best implementation for Key Value Pair Data Structure?

So I've been poking around with C# a bit lately, and all the Generic Collections have me a little confused. Say I wanted to represent a data structure where the head of a tree was a key value pair, an..

12

answers

How to use XPath in Python?

What are the libraries that support XPath? Is there a full implementation? How is the library used? Where is its website?..

17

answers

Entity Framework vs LINQ to SQL

Now that .NET v3.5 SP1 has been released (along with VS2008 SP1), we now have access to the .NET entity framework. My question is this. When trying to decide between using the Entity Framework and L..

11

answers

Generic type conversion FROM string

I have a class that I want to use to store "properties" for another class. These properties simply have a name and a value. Ideally, what I would like is to be able to add typed properties, so that th..

17

answers

Best way to access a control on another form in Windows Forms?

First off, this is a question about a desktop application using Windows Forms, not an ASP.NET question. I need to interact with controls on other forms. I am trying to access the controls by using, f..

13

answers

What does the [Flags] Enum Attribute mean in C#?

From time to time I see an enum like the following: [Flags] public enum Options { None = 0, Option1 = 1, Option2 = 2, Option3 = 4, Option4 = 8 } I don't understand what exac..

11

answers

How do you redirect HTTPS to HTTP?

How do you redirect HTTPS to HTTP?. That is, the opposite of what (seemingly) everyone teaches. I have a server on HTTPS for which I paid an SSL certification for and a mirror for which I haven't and..

14

answers

How do you determine the size of a file in C?

How can I figure out the size of a file, in bytes? #include <stdio.h> unsigned int fsize(char* file){ //what goes here? } ..

6

answers

Center text output from Graphics.DrawString()

I'm using the .NETCF (Windows Mobile) Graphics class and the DrawString() method to render a single character to the screen. The problem is that I can't seem to get it centred properly. No matter wha..

9

answers

How do you open a file in C++?

I want to open a file for reading, the C++ way. I need to be able to do it for: text files, which would involve some sort of read line function. binary files, which would provide a way to read raw d..

7

answers

Change visibility of ASP.NET label with JavaScript

I have a ASP.NET page with an asp:button that is not visible. I can't turn it visible with JavaScript because it is not rendered to the page. What can I do to resolve this?..

6

answers

How do I enable MSDTC on SQL Server?

Is this even a valid question? I have a .NET Windows app that is using MSTDC and it is throwing an exception: System.Transactions.TransactionManagerCommunicationException: Network access for Distr..

19

answers

How to resolve symbolic links in a shell script

Given an absolute or relative path (in a Unix-like system), I would like to determine the full path of the target after resolving any intermediate symlinks. Bonus points for also resolving ~username n..

23

answers

Database, Table and Column Naming Conventions?

Whenever I design a database, I always wonder if there is a best way of naming an item in my database. Quite often I ask myself the following questions: Should table names be plural? Should column n..

11

answers

How do I remove duplicate items from an array in Perl?

I have an array in Perl: my @my_array = ("one","two","three","two","three"); How do I remove the duplicates from the array?..

11

answers

Are the shift operators (<<, >>) arithmetic or logical in C?

In C, are the shift operators (<<, >>) arithmetic or logical?..

18

answers

Best Practices for securing a REST API / web service

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-Sec..

30

answers

Performing a Stress Test on Web Application?

In the past, I used Microsoft Web Application Stress Tool and Pylot to stress test web applications. I'd written a simple home page, login script, and site walkthrough (in an ecommerce site adding a f..

18

answers

How to autosize a textarea using Prototype?

I'm currently working on an internal sales application for the company I work for, and I've got a form that allows the user to change the delivery address. Now I think it would look much nicer, if th..

10

answers

PDF Editing in PHP?

Does anyone know of a good method for editing PDFs in PHP? Preferably open-source/zero-license cost methods. :) I am thinking along the lines of opening a PDF file, replacing text in the PDF and then..

15

answers

What is Turing Complete?

What does the expression "Turing Complete" mean? Can you give a simple explanation, without going into too many theoretical details?..

63

answers

What is the difference between String and string in C#?

Example (note the case): string s = "Hello world!"; String s = "Hello world!"; What are the guidelines for the use of each? And what are the differences?..

13

answers

How to show a GUI message box from a bash script in linux?

I'm writing a few little bash scripts under Ubuntu linux. I want to be able to run them from the GUI without needing a terminal window to enter any input or view any output. So far the only input req..

5

answers

Graph visualization library in JavaScript

I have a data structure that represents a directed graph, and I want to render that dynamically on an HTML page. These graphs will usually be just a few nodes, maybe ten at the very upper end, so my ..

13

answers

How to create a SQL Server function to "join" multiple rows from a subquery into a single delimited field?

To illustrate, assume that I have two tables as follows: VehicleID Name 1 Chuck 2 Larry LocationID VehicleID City 1 1 New York 2 1 Seattle 3 ..

6

answers

How should I load files into my Java application?

How should I load files into my Java application?..

15

answers

C# loop - break vs. continue

In a C# (feel free to answer for other languages) loop, what's the difference between break and continue as a means to leave the structure of the loop, and go to the next iteration? Example: foreach..

5

answers

Log4Net configuring log level

How do I make Log4net only log Info level logs? Is that even possible? Can you only set a threshold? This is what I have, and it logs Info and above as I would expect. Is there anything i can do to ..

12

answers

Getting the text from a drop-down box

This gets the value of whatever is selected in my dropdown menu. document.getElementById('newSkill').value I cannot however find out what property to go after for the text that's currently displaye..

7

answers

SQL Server Escape an Underscore

How do I escape the underscore character? I am writing something like the following where clause and want to be able to find actual entries with _d at the end. Where Username Like '%_d' ..

8

answers

IsNothing versus Is Nothing

Does anyone here use VB.NET and have a strong preference for or against using IsNothing as opposed to Is Nothing (for example, If IsNothing(anObject) or If anObject Is Nothing...)? If so, why? EDIT:..

2

answers

Tab Escape Character?

I'm just in the process of parsing some text and can't remember what the escape character is for a tab in C#?..

3

answers

Equivalent VB keyword for 'break'

I just moved over to the Visual Basic team here at work. What is the equivalent keyword to break in Visual Basic, that is, to exit a loop early but not the method?..

16

answers

The imported project "C:\Microsoft.CSharp.targets" was not found

I got this error today when trying to open a Visual Studio 2008 project in Visual Studio 2005: The imported project "C:\Microsoft.CSharp.targets" was not found. ..

9

answers

x86 Assembly on a Mac

Does anyone know of any good tools (I'm looking for IDEs) to write assembly on the Mac. Xcode is a little cumbersome to me. Also, on the Intel Macs, can I use generic x86 asm? Or is there a modified..

18

answers

How can I undo git reset --hard HEAD~1?

Is it possible to undo the changes caused by the following command? If so, how? git reset --hard HEAD~1 ..

13

answers

Python, Unicode, and the Windows console

When I try to print a Unicode string in a Windows console, I get an error . UnicodeEncodeError: 'charmap' codec can't encode character .... I assume this is because the Windows console does not accept..

40

answers

Length of a JavaScript object

I have a JavaScript object. Is there a built-in or accepted best practice way to get the length of this object? const myObject = new Object(); myObject["firstname"] = "Gareth"; myO..

5

answers

Accessing post variables using Java Servlets

What is the Java equivalent of PHP's $_POST? After searching the web for an hour, I'm still nowhere closer...

12

answers

SQL Server Management Studio alternatives to browse/edit tables and run queries

I was wondering if there are any alternatives to Microsoft's SQL Server Management Studio? Not there's anything wrong with SSMS, but sometimes it just seem too big an application where all I want tod..

14

answers

Setting a div's height in HTML with CSS

I am trying to lay out a table-like page with two columns. I want the rightmost column to dock to the right of the page, and this column should have a distinct background color. The content in the r..

9

answers

Using ConfigurationManager to load config from an arbitrary location

I'm developing a data access component that will be used in a website that contains a mix of classic ASP and ASP.NET pages, and need a good way to manage its configuration settings. I'd like to use a..

1

answers

Learning Regular Expressions

I don't really understand regular expressions. Can you explain them to me in an easy-to-follow manner? If there are any online tools or books, could you also link to them?..

114

answers

Recommended Fonts for Programming?

What fonts do you use for programming, and for what language/IDE? I use Consolas for all my Visual Studio work, any other recommendations?..

8

answers

SQL Case Expression Syntax?

What is the complete and correct syntax for the SQL Case expression?..

7

answers

How to easily consume a web service from PHP

Is there available any tool for PHP which can be used to generate code for consuming a web service based on its WSDL? Something comparable to clicking "Add Web Reference" in Visual Studio or the Eclip..

20

answers

How do I update Ruby Gems from behind a Proxy (ISA-NTLM)

The firewall I'm behind is running Microsoft ISA server in NTLM-only mode. Hash anyone have success getting their Ruby gems to install/update via Ruby SSPI gem or other method? ... or am I just being..

15

answers

Drop all tables whose names begin with a certain string

How can I drop all tables whose names begin with a given string? I think this can be done with some dynamic SQL and the INFORMATION_SCHEMA tables...

10

answers

How do I retrieve my MySQL username and password?

I lost my MySQL username and password. How do I retrieve it?..

11

answers

How to include PHP files that require an absolute path?

I have a directory structure like the following; script.php inc/include1.php inc/include2.php objects/object1.php objects/object2.php soap/soap.php Now, I use those objects in..

15

answers

Accessing a Dictionary.Keys Key through a numeric index

I'm using a Dictionary<string, int> where the int is a count of the key. Now, I need to access the last-inserted Key inside the Dictionary, but I do not know the name of it. The obvious attempt..

30

answers

What Are Some Good .NET Profilers?

What profilers have you used when working with .net programs, and which would you particularly recommend?..

26

answers

IllegalArgumentException or NullPointerException for a null parameter?

I have a simple setter method for a property and null is not appropriate for this particular property. I have always been torn in this situation: should I throw an IllegalArgumentException, or a NullP..

56

answers

Storing Images in DB - Yea or Nay?

So I'm using an app that stores images heavily in the DB. What's your outlook on this? I'm more of a type to store the location in the filesystem, than store it directly in the DB. What do you think ..

20

answers

Call ASP.NET function from JavaScript?

I'm writing a web page in ASP.NET. I have some JavaScript code, and I have a submit button with a click event. Is it possible to call a method I created in ASP with JavaScript's click event?..

19

answers

Create a new Ruby on Rails application using MySQL instead of SQLite

I want to create my Rails application with MySQL, because I like it so much. How can I do that in the latest version of Rails instead of the default SQLite?..

25

answers

SQL Client for Mac OS X that works with MS SQL Server

How can I connect to a remote SQL server using Mac OS X? I don't really need a GUI, but it would be nice to have for the color coding and resultset grid. I'd rather not have to use a VM. Is there a S..

18

answers

Multiple Updates in MySQL

I know that you can insert multiple rows at once, is there a way to update multiple rows at once (as in, in one query) in MySQL? Edit: For example I have the following Name id Col1 Col2 Row1 1..

6

answers

MAC addresses in JavaScript

I know that we can get the MAC address of a user via IE (ActiveX objects). Is there a way to obtain a user's MAC address using JavaScript?..

6

answers

Capturing TAB key in text box

I would like to be able to use the Tab key within a text box to tab over four spaces. The way it is now, the Tab key jumps my cursor to the next input. Is there some JavaScript that will capture the ..

17

answers

How to set background color of HTML element using css properties in JavaScript

How can I set the background color of an HTML element using css in JavaScript?..

8

answers

Why can't I have abstract static methods in C#?

I've been working with providers a fair bit lately, and I came across an interesting situation where I wanted to have an abstract class that had an abstract static method. I read a few posts on the to..

23

answers

Big O, how do you calculate/approximate it?

Most people with a degree in CS will certainly know what Big O stands for. It helps us to measure how well an algorithm scales. But I'm curious, how do you calculate or approximate the complexity of..

86

answers

Best ways to teach a beginner to program?

Original Question I am currently engaged in teaching my brother to program. He is a total beginner, but very smart. (And he actually wants to learn). I've noticed that some of our sessions have got..

14

answers

Calling a function of a module by using its name (a string)

What is the best way to go about calling a function given a string with the function's name in a Python program. For example, let's say that I have a module foo, and I have a string whose content is ..

38

answers

What is Inversion of Control?

Inversion of Control (IoC) can be quite confusing when it is first encountered. What is it? Which problem does it solve? When is it appropriate to use and when not? ..

9

answers

What's the safest way to iterate through the keys of a Perl hash?

If I have a Perl hash with a bunch of (key, value) pairs, what is the preferred method of iterating through all the keys? I have heard that using each may in some way have unintended side effects. S..