Selenium IDE - storedVars exception - regex

I am using selenium IDE and i want to store a data:
storeEval | storedVars['varRate'].match(/EUR.\d+.\d+/); |rate01
echo |${rate01}
storeEval |storedVars['rate01'].match(/\d+.\d/);|rate
The first one works just fine but second one throws an exception:
[error] Threw an exception: storedVars.rate.match is not a function
Can you please help me? Thank you.

The problem was that match is a string method and I didn't use it correctly. First result was an array so i added another comand to cast it to string:
store | ${rate01} | rate02 followed by
storeEval | storedVars['rate02'].match(/\d+.\d/);| rate

Related

Parse output of bash tool --> only get strings with matching pattern (with nothing between)

I use a can-discovery tool which gives me an output like this one below:
-------------------
CARING CARIBOU v0.3
-------------------
Loaded module 'uds'
Sending Diagnostic Session Control to 0x0710
Verifying potential response from 0x0710
Resending 0x710... Success
Found diagnostics server listening at 0x0710, response at 0x077a
Sending Diagnostic Session Control to 0x07df
Verifying potential response from 0x07df
Resending 0x7df... Success
Found diagnostics server listening at 0x07df, response at 0x077a
Sending Diagnostic Session Control to 0x07e0
Verifying potential response from 0x07e0
Resending 0x7e0... Success
Found diagnostics server listening at 0x07e0, response at 0x077a
Sending Diagnostic Session Control to 0x07ff
Identified diagnostics:
+------------+------------+
| CLIENT ID | SERVER ID |
+------------+------------+
| 0x00000710 | 0x0000077a |
| 0x000007df | 0x0000077a |
| 0x000007e0 | 0x0000077a |
+------------+------------+
Now I want to process the results in my Java Script application and save it to my database as Client and Server IDs. But to do this I need to parse this output above to get just the IDs as client and server IDs.
The first step now would be to get the Hex IDs fromt he output and specify if Client or Server.
The problem is I dont know grep/awk/sed good enough to think of any bash command to solve my problem.
Would be great if somebody could help me a little bit out :)
I tried all sorts of grep commands like
grep 0x000 disc_log_temp.txt
, also with different options like -w -x -o ect.
With this commands I get outputs like this one:
Sending Diagnostic Session Control to 0x0710
| 0x00000710 | 0x0000077a |
| 0x000007df | 0x0000077a |
| 0x000007e0 | 0x0000077a |
But I need just the single ID strings and also dont understand why my grep displays the first line....
Now if somebody could tell my how I can manage to get just the IDs and also know which ones are Client and which ones are Server IDs it would be really great.
Thank you very much in advance.
If you use awk, the first field of the line you want is "|" and the number of fields is 5. I'm not sure how you want it formatted, it should be easy to modify though.
awk '$1=="|"&&NF==5{print "client: " $2 ", server: " $4}' disc_log_temp.txt

Git Bash regex to match latest tag

My VCS has these tags
0.0.3.156-alpha+2
0.0.3.154
0.0.3.153
build-.139
build-.140
build-.142
build-0.0.1.28
build-0.0.1.29
build-0.0.1.30
build-0.0.1.32
I want to git describe --match "<regex>" to get the latest tag of the form number.number.number.number (so it's 0.0.3.154 in this case)
I have tried with git describe --match "[0-9]*.[0-9]*.[0-9]*.[0-9]*$" but it doesn't result in anything, and neither do these pattern:
"[0-9]*.[0-9]*.[0-9]*.[0-9]+"
"[0-9]*.[0-9]*.[0-9]*.[0-9]{1,}"
I need to get the latest tag in other to bump version for the next release. So i'm thinking of doing this automatically. Please let me know if I miss anything
Thanks
UPDATE:
In my build.gradle file I have a function to get tag like this (follow #Marc reply):
version getVersionFromTag()
def getVersionFromTag() {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'tag', '|' , 'grep', '^\([0-9]\+\.\?\)\+$', '|', 'sort' , '-nr', '|', 'head', '-1'
standardOutput = stdout
}
return stdout.toString().trim()
}
Here it gives errors Unexpected Char '\' in the regex above. Hence I removed them to becomes '^([0-9]+.?)+$', then it runs fine but in my final artifact, it does not have the version appended to the name (i.e helloword.jar instead of helloword-0.0.3.154.jar
=> My question is how should I put #Marc's suggested command to the gradle function correctly?
For testing I've put the output of your git describe in a file. This will do:
cat file | grep '^\([0-9]\+\.\?\)\+$' | sort -nr | head -1
0.0.3.154
Suppose you've created some irregular formatted tags and you want to use those as well (like your build--tags) for finding the highest tag:
sed -E 's/^[^0-9.]*//' | grep '^\([0-9]\+\.\?\)\+$' | sort -nr | head -1

CloudFoundry - Application 'controlealunos' does not exist

I think that i'm suffering a bug problem. I created a application on Cloud Foundry with the name "controle*A*lunos" with the upper case letter A.
When i execute the command
cf-apps
i get this result:
+----------------+----+---------+---------------------------------+---------------+
| Application | # | Health | URLs | Services |
+----------------+----+---------+---------------------------------+---------------+
| controleAlunos | 1 | RUNNING | controlealunos.cloudfoundry.com | mysql-86d568b |
+----------------+----+---------+---------------------------------+---------------+
But when i try to update my project whit the command :
prod cf-update controleAlunos controleAlunos-0.1.war
i receive an error
Error Application 'controlealunos' does not exist.
I think that it should be the name of my application. I put it with one Upper Case letter controle*A*lunos and i'm receving the error with no upper case letter controlealunos.
I tried to rename it, but i still get the error.
Any Sugests ?
I guess the project name you created is "controlealunos" which resulted in the app.name property in application.properties is a lower case name, while the name used to push onto CF is "controleAlunos". You can try change the value in the properties file and update again.

"YYYYMMDD": Invalid identifier error while trying through SQOOP

Please help me out from the below error.It works fine when checked in oracle but fails when trying through SQOOP import.
version : Hadoop 0.20.2-cdh3u4 and Sqoop 1.3.0-cdh3u5
sqoop import $SQOOP_CONNECTION_STRING
--query 'SELECT st.reference,u.unit,st.reading,st.code,st.read_id,st.avg FROM reading st,tunit `tu,unit u
WHERE st.reference=tu.reference and st.number IN ('218730','123456') and tu.unit_id = u.unit_id
and u.enrolled='Y' AND st.reading <= latest_off and st.reading >= To_Date('20120701','yyyymmdd')
and st.type_id is null and $CONDITIONS'
--split-by u.unit
--target-dir /sample/input
Error:
12/10/10 09:33:21 ERROR manager.SqlManager: Error executing statement:
java.sql.SQLSyntaxErrorException: ORA-00904: "YYYYMMDD": invalid identifier
followed by....
12/10/10 09:33:21 ERROR sqoop.Sqoop: Got exception running Sqoop:
java.lang.NullPointerException
Thanks & Regards,
Tamil
I believe that the problem is actually on Bash side (or your command line interpret). Your query contains for example following fragment u.enrolled='Y'. Please notice that you're escaping character constants with single quotes. You seem to be putting entire query into additional single quotes: --query 'YOUR QUERY'. Which results in something like --query '...u.enrolled='Y'...'. However such string is stripped by bash to '...u.enrolled=Y...'. You can verify that by using "echo" to see what exactly will bash do with your string before it will be passed to Sqoop.
jarcec#jarcec-thinkpad ~ % echo '...u.enrolled='Y'...'
...u.enrolled=Y..
.
I would recommend to either escape all single quotes (\') inside your query or choose double quotes for entire query. Please note that the later option will require escaping $ characters with backslash (\$).

problem in decoupling urls.py , while following a tutorial of django

http://docs.djangoproject.com/en/dev/intro/tutorial03/
I was at the step Decoupling the URLconfs where the tutorial illustrates how to decouple urls.py. On doing exactly what it says, i get the following error-
error at /polls/1/
nothing to repeat
Request Method: GET
Request URL: http://localhost:8000/polls/1/
Exception Type: error
Exception Value:
nothing to repeat
Exception Location: C:\jython2.5.1\Lib\re.py in _compile, line 241
Python Executable: C:\jython2.5.1\jython.bat
Python Version: 2.5.1
Python Path: ['E:\\Programming\\Project\\django_app\\mysite', 'C:\\jython2.5.1\\Lib\\site-packages\\setuptools-0.6c11-py2.5.egg', 'C:\\jython2.5.1\\Lib', '__classpath__', '__pyclasspath__/', 'C:\\jython2.5.1\\Lib\\site-packages']
Server time: Mon, 12 Apr 2010 12:02:56 +0530
Check your regex syntax. In particular, see if you are missing an opening parenthesis before a ? towards the beginning of the pattern, as in
r'^?P<poll_id>\d+)/$'
# ^ note the missing parenthesis
The above should read
r'^(?P<poll_id>\d+)/$'
instead.
(An explanation: "nothing to repeat" is a regex error which arises due to an ? regex operator occurring where it is not preceded by something which it can sensibly attach to. The ? in (?P<...>...) is treated specially, but if you forget the opening parenthesis, the regex engine will treat ? in the regular way, which makes no sense right after ^.)