I have some piece of WP8 code which does validation of text field when user starts entering
These event I receive them as KeyEventArgs in WP8
e.Key == System.Windows.Input.Key.D0 .... System.Windows.Input.Key.D9
also System.Windows.Input.Key.A ... system.Windows.Input.Key.Z
I had checked ShouldChangeCharacters that get the replacementString...
Now I should check by getting the ASCII codes for digits 0 to 9 and A to Z from the replacementString.. // How can I do this in a BETTER WAY ?
Related
I am new to tkinter and python, I need an editable textbox that supports null characters but
self.text.insert(tk.END, 'hello\0test')
displays only hello
I tried running print(self.text.get('1.0', tk.END)) which gives only hello
I am replacing the null character before assiging to TextBox for now 'hello\0test'.replace('\0', '\\x00'). but after editing, converting the value '\\x00' back to null character becomes a problem if the input string already had '\\x00' that also will get converted to null.
How do I print a conditional field using PPFA code. When a value is an 'X' then I'd like to print it. However, if the 'X' is not present then I'd like to print an image. Here is my code:
LAYOUT C'mylayout' BODY
POSITION .25 in ABSOLUTE .25 in
FONT TIMES
OVERLAY MYTEMPOVER 8.5 in 11.0 in;
FIELD START 1 LENGTH 60
POSITION 2.0 in 1.6 in;
Where it has FIELD START 1 LENGTH 60 that will print the given text at that location. But based on the value I want to print either the given text or an image. How would I do that?
Here is an answer from the AFP-L list:
I would create two PAGEFORMATS, one with LAYOUT for TEXT and one with LAYOUT for IMAGE. With CONDITION you can jump between the Pageformats (where Copygroup is always 'NULL')
If you work in a z/OS environment, be careful of 'JES Blanc Truncation'.
That means in one sentence:
if there is a X in the data, condition is true
if there is nothing in the data, condition doesn't work and is always wrong (nothing happens)
In this case you must create a Condition which is always true. I call it a Dummy-Condition.
PPFA sample syntax:
CONDITION TEST start 1 length 1
when eq 'X' NULL PAGEFORMAT PRTTXT
when ge x'00' NULL PAGEFORMAT PRTIMAGE;
You must copy this CONDITION into both PAGEFORMATS after LAYOUT command.
Blanc truncation is a difficult problem on z/OS.
In this sample, the PAGEFORMAT named PRTTXT contains all the formatting and printing directives when the condition is true, and the other called PRTIMAGE contains every directive needed to print the image.
HTH
I have been trying to screen scrape from IBM's mainframe and I got stuck trying to convert the Row and Col into a position (Function 99). I have tried my best to debug this simple error but I just cannot find what's wrong with it.
Debug.Print hllapi(99, "AR", 6, 53)
My sessions are connected, everything is working great except the Convert Position or RowCol (99) function I am trying to use. It keeps returning a status code of 9999 which indicates that my data string (i.e. "AR") is not uppercased or the letter P/R does not exist in the second character. ("Character 2 in the data string is not P or R or uppercased").
I have been unable to fix this despite trying all sorts of methods.
I try To extract Arabic Text from PDF file but it extract only number and the result like this :
: 7234569 1439/08/07 : : 1 2375173941 14 08 6 39266 1050672243 2280 30 400 24 415 24 15 720 30 402 30 499 14 07 1 610117038085 0 1069508677 0 :
My code :
public static string GetTextFromAllPages(string pdfPath) {
PdfReader reader = new PdfReader(pdfPath);
string result = null ;
//for (int i = 1; i <= reader.NumberOfPages; i++)
result = PdfTextExtractor.GetTextFromPage(reader, 1, new LocationTextExtractionStrategy()); return result;
}
Any help Please?
The embedded font for Arabic glyphs in your PDF contains this ToUnicode CMap:
/CIDInit /ProcSet findresource begin
12 dict begin
begincmap
/CIDSystemInfo << /Registry (Adobe) /Ordering (UCS) /Supplement 0 >> def
/CMapName /Adobe-Identity-UCS def
/CMapType 2 def
1 begincodespacerange
<0000> <FFFF>
endcodespacerange
endcmap
CMapName currentdict /CMap defineresource pop
end
end
According to ISO 32000-1, section 9.10.3 ToUnicode CMaps:
It shall use the beginbfchar, endbfchar, beginbfrange, and endbfrange operators to define the mapping from character codes to Unicode character sequences expressed in UTF-16BE encoding.
Unfortunately your CMap does not use these operators at all and, therefore, does not define any mappings to Unicode.
Furthermore the font has an Encoding of Identity-H and its descendant CIDFont has a ROS Adobe-Identity-0 which means that character code, CID, and GID values are equal for a character but doesn't imply any mapping of them to Unicode.
Thus, the font is missing the information required for text extraction according to ISO 32000-1 section 9.10.2 Mapping Character Codes to Unicode Values.
(In such a situation text extractors can only guess, and such guesswork usually only works for a special type of documents the extractor is optimized for. You might want to try to enhance iText to be able to guess correctly in your case but that will require you to study the PDF specification, the iText text extraction code, and your sample files in detail.)
By the way, a good first test whether text extraction is feasible is to open the PDF in Adobe Reader and to copy and paste the text in question to an editor or word processor. If this does not work (and in the case at hand it does not work), chances are that the file does have incomplete or misleading information for text extraction (or none at all).
I know how to verify if a specific text is present in a web page using Selenium IDE. But what I wanted to know is, can you verify that any text is present in an element?
For example there's a text box with the title "Top Champion". This text box will be changed daily with the name of a person. Now I just wanted to check whether there is a text in this text box, no matter what the text actually is. I've tried the verify text command and tried blanking the value, but it doesn't work. If the command can return a true or false command that would be really helpful
BTW, verify value doesn't work either since the element that I'm testing is not a form field
Your best bet is as follows (I have written single tests for this for numbers)
Medium rigour:
waitForText | css=.SELECTORS | regex:.+?
This will wait until there is at least 1 character present.
Strong rigour (only works if you have a subset of characters present):
waitForText | css=.SELECTORS | regex:^[0-9]+$
This will wait until there is text. This text must start with a number, have at least 1 number, and then finish. It does not permit any character outside of the subset given. An example you could do to match numbersNAMEnumbers would be.
waitForText | css=.SELECTORS | regex:^[0-9]+[a-zA-Z]+[0-9]+$
This would wait for a string such as 253432234BobbySmith332
Luke
If i have understood your question properly there below is one way you can search for an element contains a string. Not sure if this is what you are looking.
List<WebElement> findElement = webElement.findElements(By.xpath("YOUR_TEXTINPUT_PATH_HERE"));
if( findElement.size() > 0 ){
if( findElement.get(0).getText() != null && findElement.get(0).getText().indexOf("THE_STRING_THAT_YOU_WANT_TO SEARCH") != -1 ) {
// IF IT COMES HERE, THAT MEANS THE ELEMENT IS PRESENT WITH THE TEXT
}
}
store text|[your element]|StoredText
execute script|return ${StoredText}.length > 0|x
assert|x|true
Using these three lines in the Selenium IDE, the first line will extract the text from the element into the variable StoredText.
The second line will store whether the length of that text is greater than zero into the variable x (a true or false result).
The third line asserts that the result was true, failing the test if not. You don't need the third line if all you want is the true or false result.
So if the element contains any text, the extracted text length will be greater than zero, the variable x will be true, and the assert will pass. This verifies that any text is present in the element.