Need Help for FoxPro Select WHERE works, but Replace ALL FOR Fails? - select

I have this select statement that works in a FoxPro command window to return the 7 records where the objname is documents-mltry and the word "roster" appears in the descrip memo field:
SELECT objname, descrip FROM archives where UPPER(OBJNAME)==[DOCUMENTS-MLTRY] AND [ROSTER]$UPPER(DESCRIP)
However, when i then try to do a replace all statement to change the objname to "Roster" it fails telling me the "variable roster is not found". Note: the LIKE command is not available in this version of FoxPro.
Can anybody see what i am doing wrong in the replace command below?
REPLACE ALL objname WITH "Roster" FOR UPPER(OBJNAME)==[DOCUMENTS-MLTRY] AND [ROSTER]$UPPER(DESCRIP)
I have tried using ATC command in the replace statement that results in the same variable not found error message:
REPLACE ALL objname WITH "Roster" FOR UPPER(OBJNAME)==[DOCUMENTS-MLTRY] AND ATC("ROSTER", descrip)
Any suggestions would be appreciated!

This may be a WAG but I noticed that you are not using the (optional) alias or workarea in your REPLACE command. If the table you are REPLACEing is not SELECTed and the work area that is selected is another table, then you will receive a variable not found error. To test out this theory, add an "IN archives" to your REPLACE command. That might fix it.
REPLACE ALL objname WITH "Roster" FOR UPPER(OBJNAME)==[DOCUMENTS-MLTRY] AND ATC("ROSTER", descrip) in archives

Related

Find and replace using wildcard in netbeans

How would one go about using replace in netbeans to modify a PHP script with lots of $_POST[].
For better security it would be a good idea to replace all these $_POST[]
with sanitize($_POST[]) where sanitize is a function that sanitizes user input.
So I could use Replace and search for $_POST[''] and replace with sanitize($_POST['']).
But how do you keep the variable name within each $_POST[''] while adding the closing parenthesis?
For example $_POST['name'] and $_POST['action'] need to become sanitize($_POST['name']) and santize($_POST['action']) respectively.
I am not a PHP programmer or a Regex master but in my very limited test this seemed to work.
Select the project and then choose Edit -> Replace. Choose "Regular Expression" in the drop down list, set containing text to \$_POST\[(.*)\]and replace with to sanitize(\$_POST[$1])

Cross-reference list is empty in Word 2010

I have been given a Word file (.docx) that has about 35 figures and tables. When I try to add a cross-reference I get an empty list like this:
I made sure that:
1) The figures and tables are actually captions. If I delete anyone of them, the rest get updated as expected.
2) Other cross-references already in the file works. They get updated correctly like in (1)
3) The document doesn't have any 'track changes'. This is apparently a problem for some people, so I did an 'accept all changes'. Doesn't seem to help unfortunately.
4) I tried copy all and paste into a new file.
5) I tried selecting all and F9.
I'm perplexed why this is happening. Anyone can help me find the root cause?
I know that it is probably late, but maybe it will help somebody else.
Select caption below table/picture
Right click and select Toggle field codes - the caption show the code in format like SEQ xxx xxx
Go to Insert -> Reference -> Caption and click on New Label button
Insert the text following after SEQ from point 2. E.g. Fig.
Save the new label.
Go to Insert -> Reference -> Cross Reference - select the inserted value from point 4 in the Reference type dropdown list. Now you should see all the values.
The answer is based on the following link.
In Word 2013, instead of Insert>Reference>Caption, right click on a figure or table and select insert caption. A dialogue box including the option New Label will appear.
In my case, I think this issue arose because of changes in language. The tables are all captioned with the French Tableau, but in insert references, it had Table and a blank list.

How to see the CREATE VIEW code for a view in PostgreSQL?

Is there an easy way to see the code used to create a view using the PostgreSQL command-line client?
Something like the SHOW CREATE VIEW from MySQL.
Kept having to return here to look up pg_get_viewdef (how to remember that!!), so searched for a more memorable command... and got it:
\d+ viewname
You can see similar sorts of commands by typing \? at the pgsql command line.
Bonus tip: The emacs command sql-postgres makes pgsql a lot more pleasant (edit, copy, paste, command history).
select pg_get_viewdef('viewname', true)
A list of all those functions is available in the manual:
http://www.postgresql.org/docs/current/static/functions-info.html
select definition from pg_views where viewname = 'my_view'
If you want an ANSI SQL-92 version:
select view_definition from information_schema.views where table_name = 'view_name';
Good news from v9.6 and above. View editing are now native from psql. Just invoke \ev command. View definitions will show in your configured editor.
julian#assange=# \ev your_view_names
Bonus. Some useful command to interact with query buffer.
Query Buffer
\e [FILE] [LINE] edit the query buffer (or file) with external editor
\ef [FUNCNAME [LINE]] edit function definition with external editor
\ev [VIEWNAME [LINE]] edit view definition with external editor
\p show the contents of the query buffer
\r reset (clear) the query buffer
\s [FILE] display history or save it to file
\w FILE write query buffer to file
In psql cli , you can use
\d+ <yourViewName>
\sv <yourViewName>
Output as follows:
\d+ v_ma_students
View "public.v_ma_students"
Column | Type | Collation | Nullable | Default | Storage | De
scription
--------+-----------------------+-----------+----------+---------+----------+---
SOMETHINGS HERE
View definition:
SELECT student.sno,
student.sname,
student.ssex,
student.sage,
student.sdept
FROM student
WHERE student.sdept::text = 'MA'::text;
Options: check_option=cascaded
\sv v_ma_students
CREATE OR REPLACE VIEW public.v_ma_students AS
SELECT student.sno,
student.sname,
student.ssex,
student.sage,
student.sdept
FROM student
WHERE student.sdept::text = 'MA'::text
WITH CASCADED CHECK OPTION
These is a little thing to point out.
Using the function pg_get_viewdef or pg_views or information_schema.views you will always get a rewritten version of your original DDL.
The rewritten version may or not be the same as your original DDL script.
If the Rule Manager rewrite your view definition your original DLL will be lost and you will able to read the only the rewritten version of your view definition.
Not all views are rewritten but if you use sub-select or joins probably your views will be rewritten.
In the command line client psql you can use following command:
\sv <VIEWNAME>
The straightforward way to find the 'CREATE TABLE ...' query is to use this query -
SHOW TABLE your_schema_name.your_table_name

Selenium IDE Fancy Select not working

I'm trying to select from a fancy select drop down menu, but for some reason i can't get the value to change. I've tried recording clicks, using the xpath with the click command, and now I'm trying to use the select command. None seem to work. Has anyone else encountered this/have any ideas about how to change the value of a fancy select?
If you have a select step defined, select (or selectAndWait) would be the Command, xpath=(your xpath) would be the Target, and the item you wish to select from the option list would be the Value. The Value can also be the index of the item in the list, where the topmost entry can be referenced by placing a index=0 as the Value:
select | xpath=[YourSelectElementXPATH] | ValueFromTheList
or
select | xpath=[YourSelectElementXPATH] | index=1
If you are able to include your step or the URL to the page in question, more specific assistance can be provided.

sql server 2000: Short cut for getting stored proc text

what is the short cut to get entire text of the stored proc in query analyzer. I know that I could highlight table name and hit alt + F1 and get the entire table structure.
It seems to not exist a shorcut with your exact request. If you want to see the complete list of query analyzer shorcuts visit the folowing link:
http://msdn.microsoft.com/en-us/library/aa216992(SQL.80).aspx
Anyway you can modify, customize or create your own shorcuts.
For examle ALT+F1 just executes the "sp_help" stored procedure.
Check the documentation at:
http://msdn.microsoft.com/en-us/library/aa216956(SQL.80).aspx
You should be able to add a shortcut that uses sp_helptext, rather then sp_help