quoting

KSH scripting: how to split on ',' when values have escaped commas? [solved]

I try to write KSH script for processing a file consisting of name-value pairs, several of them on each line. Format is: NAME1 VALUE1,NAME2 VALUE2,NAME3 VALUE3, etc Suppose I write: read l IFS="," set -A nvls $l echo "$nvls[2]" This will give me second name-value pair, nice and easy. Now, suppose that the task is extended so that ...

Giving estimates for large scale projects in an Agile Environment

My firm just got its first large-scale development project inquiry and I would like to use an Agile process. The client has a vision for the application but openly admits to having very few requirements and recognizes that we will have to charge by the hour. Because of this, I've all but sold him on an Agile approach. The problem is tha...

\\\\$ converted to \$ in jsp template data

I just stumbled unto a weirdness in my JSP code. It seems that a double backslash followed by a dollar or percent symbol gets converted to a single backslash (plus symbol). That is, the following JSP: <%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %> \\# \\$ \\% \\^ gets rendered as: \\# \$ \% \\^ I'm using JD...

Stripping single and double quotes in a string using bash / standard Linux commands only

Hello Stack Overflow :-) I'm looking for something that will translate a string as follows, using only bash / standard Linux commands: Single-quotes surrounding a string should be removed Double-quotes surrounding a string should be removed Unquoted strings should remain the same Strings with unmatched surrounding quotes should remain...

PHP: Using quote() on strings in MDB2 with MYSQL

Hi I'm using Pear's MDB2 and really enjoying it, but there is something that is starting to annoy me. I build the SQL string in the following way, using the quote method of the mdb2 package: $sql = sprintf("INSERT INTO profiles(email, fullName) VALUES(%s,%s)", $mdb2->quote($email), $mdb2->quote($fullName)); (as explained in...

Estimate quote for a Flash Application with server side interaction

I am building a Flash AS3 application that allows users to modify images, (drag and drop, select, scale, alter saturation, etc) and then submit-save them to a server. The user will then have the ability to log in and access these saved images via a separate admin tool in a thumbnail gallery. They can either delete an image or click a t...

My Zend Framework 'quoting' mess.

I've got a probably very simple issue to which I can't find a satisfactory (subjectively seen) answer in the Zend Framework manual or elsewhere... There are so many ways how I can hand over my php variables to my sql queries that I lost the overview and probably I lack some understanding about quoting in general. Prepared Statements $...

Using Make $(dir) or $(notdir) on a path with spaces

I'm using code similar to the following in a Makefile: empty:= space:= $(empty) $(empty) path_escape = $(subst $(space),\$(space),$(1)) TOP=$(call path_escape,$(abspath .)) TARGET=$(TOP)/foo $(info TOP='$(TOP)') $(info TARGET='$(TARGET)') all: $(TARGET) $(TARGET): touch '$(notdir $@)' .PHONY: $(TARGET) If I use this in a dire...

BASH, escaping single-quotes inside of single-quoted strings

There is an example of "how to do this" on Stuart Colville's blog, but the example used there and the explanation of why it works is unclear. To keep things simple: Let's say you have a bash alias like alias rxvt='urxvt' which works fine. alias rxvt='urxvt -fg '#111111' -bg '#111111'' won't work, and neither will: alias rxvt='u...

BASH - Single quote inside double quote for SQL Where clause

I need to send a properly formatted date comparison WHERE clause to a program on the command line in bash. Once it gets inside the called program, the WHERE clause should be valid for Oracle, and should look exactly like this: highwater>TO_DATE('11-Sep-2009', 'DD-MON-YYYY') The date value is in a variable. I've tried a variety o...

How to call popen() with a pathname containing spaces under Windows in C/C++ ?

I'm trying to call popen() using mingw like this: #define RUN_COMMAND "\"C:\\Program Files\\CA\\BrightStor ARCserve Backup\\ca_qmgr.exe\" \"-list\"" int main() { outputPointer = popen(RUN_COMMAND, "r"); ... } But I can't get it working. I think it's a quoting nightmare ... ...

quoting constants in php: "this is a MY_CONSTANT"

I want to use a constant in php, but i also want to put it inside double quotes like a variable. Is this at all possible? define("TESTER", "World!"); echo "Hello, TESTER"; obviously outputs "Hello, TESTER", but what I really want is something like: $tester = "World!"; echo "Hello, $tester"; ouputs "Hello, World!". ...

PHP-generated javascript and quote marks

I'm generating some javascript in my PHP code, and I need to assign some php variables to javascript variables. Unfortunately, sometimes my PHP variables contain quote marks. for instance: $foo = "'Dis here be a \"string\""; print "<script type='text/javascript'>var foo = '{$foo}';</script>"; will generate a javascript error because t...

Write CSV To File Without Enclosures In PHP

Is there a native function or solid class/library for writing an array as a line in a CSV file without enclosures? fputcsv will default to " if nothing is passed in for the enclosure param. Google is failing me (returning results for a whole bunch of pages about fputcsv), and PEAR's libraries do more or less the same things as fputcsv. ...

Escape backquote in a double-quoted string in shell

For the command: /usr/bin/sh -c "ls 1`" (a backquote after 1). How to make it run successfully? Adding a backslash before "`" does not work. ` is a special char as we know, and I tried surrounding it with single quote too (/usr/bin/sh -c "ls 1'`'"), but that doesn't work either. The error always are: % /usr/bin/sh -c "ls 1\`" Unmatc...

Quoting of decimal values

I am storing a running total in a Decimal(10,2) field and adding to it as items are processed. update foo set bar = bar + '3.15' About 20% of the times a warning is issued "Data truncated for column 'bar' at row 4" This warning is never issued if the update value is not quoted. Should decimal values be quoted? ...

Python __setattr__ and __getattr__ for global scope?

Suppose I need to create my own small DSL that would use Python to describe a certain data structure. E.g. I'd like to be able to write something like f(x) = some_stuff(a,b,c) and have Python, instead of complaining about undeclared identifiers or attempting to invoke the function some_stuff, convert it to a literal expression for my ...

Invoicing vs Quoting or Estimating

If invoices can be voided, should they be used as quotations? I have an Invoices tables that is created from inventory associated with a Job or Order. I could have a Quotes table as a halfway-house between inventory and invoices, but it feels like I would have duplicate data structures and logic just to handle an "Is this a quote?" bit....

How do I disable quoted identifiers when scripting out SQL Server database objects in Visual Studio?

Hi, I'm using Visual Studio 2005 to script out a database so that I can put it in subversion. Now one complaint that I have is that it puts my stored procedure code in a single literal string, like in the example. below. /****** Object: StoredProcedure [dbo].[MyStoredProc] Script Date: 08/19/2010 16:40:14 ******/ SET ANSI_NULLS ON...

Is &gt; ever necessary?

I now develop websites and XML interfaces since 7 years, and never, ever came in a situation, where it was really necessary to use the &gt; for a >. All disambiguition could so far be handled by quoting <, &, " and ' alone. Has anyone ever been in a situation (related to, e.g., SGML processing, browser issues, XSLT, ...) where you found...