UILabel not showing text inside ScrollView for big Content - html

My ScrollView's ContentView consists of just a UILabel which has leading space 8, trailing space 8, top space to container 8dp, and number lines set to 0. ScrollView ContentView height is to 9000.
I'm adding a big html content dynamically to the label..
public override void ViewDidLoad()
{
base.ViewDidLoad();
var attr = new NSAttributedStringDocumentAttributes();
var nsError = new NSError();
attr.DocumentType = NSDocumentType.HTML;
contentLabel.AttributedText = new NSAttributedString(GetContent(), attr, ref nsError);
contentLabel.Font = UIFont.FromName("Helvetica", 11f);
contentLabel.Layer.BorderWidth = 1f;
contentLabel.Layer.BorderColor = AZConstants.SeparatorColor.CGColor;
contentLabel.Layer.CornerRadius = 4f;
contentLabel.ClipsToBounds = true;
}
string GetContent()
{
var myHtmlText = "<h4 style=\"text-align: center;\">TERMS OF SERVICE AGREEMENT</h4>\n <p>\n " +
"PLEASE READ THE FOLLOWING TERMS OF USE AGREEMENT CAREFULLY. BY ACCESSING OR USING OUR SITES AND OUR SERVICES, YOU HEREBY AGREE\n " +
"TO BE BOUND BY THE TERMS AND ALL TERMS INCORPORATED HEREIN BY REFERENCE. IF YOU DO NOT EXPRESSLY AGREE TO ALL OF THE TERMS AND CONDITIONS, THEN PLEASE DO\n" +
"NOT ACCESS OR USE OUR SITES OR OUR SERVICES. THIS TERMS OF SERVICE AGREEMENT IS LAST REVISED AS OF July 1, 2014. \n </p>";
myHtmlText += "<h4>ACCEPTANCE OF TERMS</h4>";
myHtmlText += "<p>\n The following Terms of Service Agreement (the \"TOS\") is a legally binding agreement that shall " +
"govern the relationship with our users and others which may\n interact or interface with Simple Healthcare LLC " +
"(SHL), also known as Green Circle Health(GCH), located at 5 Portofino Drive, Suite 2101, Pensacola Beach, " +
"Florida 32561, and our\n subsidiaries and affiliates, in association with the use of the SHL websites, which includes " +
"GOGCH.COM (the \"Site\") and its services (\"Services\"), which shall be defined below.\n </p>";
myHtmlText += "<h4>DESCRIPTION OF SERVICES OFFERED</h4>\n <p>\n Green Circle Health (GCH) is a platform for patients to store " +
"and share personal medical data including vitals and documents. GCH provides medical forms needed to check-in at a medical " +
"facility. GCH enables remote monitoring of patient vitals and fitness activities for population health management and " +
"clinical research trials.\n </p>";
myHtmlText += "<p>\n <strong>GCH enables you to store your personal data</strong>\n </p>";
myHtmlText += "<p>\n Any and all visitors to our site, despite whether they are registered or not, shall be deemed " +
"as \"users\" of the herein contained Services provided for the\n purpose of this TOS. Once an individual registers " +
"for our Services, through the process of creating an account, the user shall then be considered a\n \"member.\"\n </p>";
myHtmlText += "<p>\n The user and/or member acknowledges and agrees that the Services provided and made available through " +
"our website and applications, which may include some\n mobile applications and that those applications may be made " +
"available on various social media networking sites and numerous other platforms and\n downloadable programs, are " +
"the sole property of SHL. At its sole discretion, SHL may offer additional websites or services and/or products, " +
"or update, modify or\n revise any current content and Services, and this Agreement shall apply to any and all " +
"additional services and/or products and any and all updated,\n modified or revised Services unless otherwise " +
"stipulated. SHL does hereby reserve the right to cancel and cease offering any of the aforementioned Services\n " +
"and/or products. You, as the end user and/or member, acknowledge, accept and agree that SHL shall not be held " +
"liable for any such updates, modifications,\n revisions, suspensions or discontinuance of any of our Services " +
"and/or products. Your continued use of the Services provided, after such posting of any\n updates, changes, and/or " +
"modifications shall constitute your acceptance of such updates, changes and/or modifications, and as such, " +
"frequent review of this\n Agreement and any and all applicable terms and policies should be made by you to " +
"ensure you are aware of all terms and policies currently in effect. Should\n " +
"you not agree to the updated, modified, revised or modified terms, you must stop using the provided Services.\n </p>";
myHtmlText += "<p>\n Furthermore, the user and/or member understands, acknowledges and agrees that the Services offered " +
"shall be provided \"AS IS\" and as such SHL shall not assume any responsibility or obligation for the timeliness, " +
"missed delivery, deletion and/or any failure to store user content, communication or personalization settings.\n</p>";
myHtmlText += "<h4>REGISTRATION</h4>\n <p>\n To register and become a \"member\" of the Site, you must be 18 years of age " +
"to enter into and form a legally binding contract. In addition, you must be in\n good standing and not an individual " +
"that has been previously barred from receiving SHL's Services under the laws and statutes of the United States or " +
"other\n applicable jurisdiction.\n </p>";
myHtmlText += "<p>\nFurthermore, the registering party hereby acknowledges, understands and agrees to:\n</p>";
myHtmlText += "<ol type=\"a\">\n <li>\n furnish factual, correct, current and complete information with regards to yourself " +
"as may be requested by the data registration process, and\n </li>\n <li>\n maintain and promptly update your " +
"registration and profile information in an effort to maintain accuracy and completeness at all times.\n </li>\n </ol>";
myHtmlText += "<p>\n If anyone knowingly provides any information of a false, untrue, inaccurate or incomplete nature, " +
"SHL will have sufficient grounds and rights to suspend or\n terminate the member in violation of this aspect of the Agreement, " +
"and as such refuse any and all current or future use of SHL Services, or any portion\n " +
"thereof.\n </p>";
myHtmlText += "<p>\nIt is SHL's priority to ensure the safety and privacy of all its visitors, users and members, " +
"especially that of children. Therefore, it is for this reason\n that the parents of any child under the age of 18 " +
"that permit their child or children access to the SHL website platform Services must create a \"family\"\n " +
"account, which will certify that the individual creating the \"family\" account is of 18 years of age and as such, " +
"the parent or legal guardian of any child\n or children registered under the \"family\" account. As the creator of the " +
"\"family\" account, s/he is thereby granting permission for his/her child or\n children to access the various Services provided, " +
"including, but not limited to, message boards, email, and/or instant messaging. It is the parent's and/or\n legal " +
"guardian's responsibility to determine whether any of the Services and/or content provided are age-appropriate for his/her child.\n</p>";
myHtmlText += ..... there are more characters in between, I can't add them all because of the character limit in stackoverflow
myHtmlText += "<p> " +
"Should you intend to create or to join any service, receive or request any such news, messages, " +
"alerts or other information from our Services concerning healthcare, treatment, devices, companies, stock " +
"quotes, investments or securities, please review the above Sections Warranty Disclaimers and Limitations of Liability again. In addition, for this " +
"</p>";
return myHtmlText;
}
Upto this everything works fine.
Now if I add just one word to myHtmlText, (In addition, for this particalur "</p>") the label text becomes invisible. Though the label border is visible. Is there some maximum content size? I couldn't find anything about it when I searched.
What am I doing wrong here? Any help is appreciated...

You need to use UITextView with scrolling enabled and editable/selected disabled (instead of UIScrollView & Content view & UILabel).

Related

Caffeine Cache - How to get information of creation date of an element

Is there any way to access the creation timestamp of an element from the CaffeineCache?
Kind of cache.get("x").getTimestamp()?
The cache tries to store the minimal metadata required to perform its operations, so some conveniences are left out to avoid waste. In those cases you should consider adding that metadata by wrapping your value.
The cache does expose runtime metadata, but this often depends on how it was constructed. That can be accessed by using Cache.policy(). For example cache.policy().expireAfterWrite() offers an ageOf(key) method to determine how long the entry has resided since its expiration timestamp was last reset. To calculate how much time until the entry expires, you could subtract the age from the policy's duration (via getExpiresAfter()).
Cache interface provides getPolicy method to inspect and perform low-level operations based on the cache's runtime characteristics. For example below snippet return the age of an entry in the cache using after write policy.
private static void printAgeOfEntryUsingAfterWritePolicy(Cache cache, Object key) {
Optional<FixedExpiration> expirationPolicy = cache.policy().expireAfterWrite();
if (!expirationPolicy.isPresent()) {
return;
}
Optional<Duration> ageOfEntry = expirationPolicy.get().ageOf(key);
if (!ageOfEntry.isPresent()) {
return;
}
Duration duration = ageOfEntry.get();
System.out.println("Element with key " + key + " is in the cache from " + duration.getSeconds() + " seconds....");
}
Reference link.

Displaying the "agreement" field of a DAML contract

How can I display the contents of the "agreement" field of a DAML contract in Navigator?
For instance this parameterized text from the test_project contract:
agreement
toText landlord <> " promises to let "
toText tenant <> " live at " <> address
" until " <> toText expirationDate
Unfortunately, this feature is not implemented in Navigator.
Some technical background:
The Ledger API does include everything needed to compute the agreement text:
The agreement text expression is included in the DAML-LF package returned by the package service.
The contract argument (the value of variables used in the agreement expression) is given by the transaction service
However, Navigator currently does not support DAML-LF expressions.

Using a Hyperlink in an Input Message

In my current spreadsheet, when you enter in a certain value a input message will be displayed. However, the input message should have a link in it which takes you to another tab.
Here's the code I have so far:
if (cellSheet !== sheet && cellColumn === 4) {
if (cellValue === "PT1 - Induction Training") {
Browser.msgBox("PT1 - Induction Training: This is a Theory Based course and does not require you to be on the server. It should take 15-20 minutes.)"); //Add the course name and the message that I want to popup. Course name should be exactly the same as in the list (case sensitive)
}
else if (cellValue === "PT2 - Traffic & Communications - Part 1") {
Browser.msgBox("PT2 - Traffic & Communications - Part 1 - Starting a Patrol: This is a Practical Based course and does require you to be on the server. It should take 10-15 minutes. The manual for this course can be viewed here: https://docs.google.com/document/d/1EUAtzKHaDXGMJLcGy5usXiHE7QU7B7g98OSUuKd94ss/edit"); //// add as many "else if" conditions as you want"
} else if (cellValue === "PT2 - Traffic & Communications - Part 2") {
Browser.msgBox("PT2 - Traffic & Communications - Part 2 - Traffic Stops: This is a Practical Based course and does require you to be on the server. It should take 10-15 minutes. The manual for this course can be viewed here: https://docs.google.com/document/d/1EUAtzKHaDXGMJLcGy5usXiHE7QU7B7g98OSUuKd94ss/edit");
} else if (cellValue === "PT2 - Traffic & Communications - Part 3") {
Browser.msgBox("PT2 - Traffic & Communications - Part 3 - Checkpoints: This is a Practical Based course and does require you to be on the server. On average, it takes around an HOUR to do, so please bare in mind if you are able to do it. The manual for this course can be viewed here: https://docs.google.com/document/d/1EUAtzKHaDXGMJLcGy5usXiHE7QU7B7g98OSUuKd94ss/edit");
} else if (cellValue === "PT2 - Traffic & Communications - Part 4") {
Browser.msgBox("PT2 - Traffic & Communications - Part 4 - Basic Communication: This is a Theory Based course and does not require you to be on the server. It should take 10-15 minutes. The manual for this course can be viewed here: https://docs.google.com/document/d/1EUAtzKHaDXGMJLcGy5usXiHE7QU7B7g98OSUuKd94ss/edit");
} else if (cellValue === "PT2 - Traffic & Communications - Part 5") {
Browser.msgBox("PT2 - Traffic & Communications - Part 5 - Communication with Officers: This is a Theory Based course and does not require you to be on the server. It should take 10-15 minutes.The manual for this course can be viewed here: https://docs.google.com/document/d/1EUAtzKHaDXGMJLcGy5usXiHE7QU7B7g98OSUuKd94ss/edit");
} else if (cellValue === "PT3 - Officer Advancement - Part 1") {
Browser.msgBox("PT3 - Officer Advancement - Part 1: This is a Theory Based course and does not require you to be on the server. It should take 25-30 minutes.");
} else if (cellValue === "PT3 - Officer Advancement - Part 2") {
Browser.msgBox("PT3 - Officer Advancement - Part 2: This is a Practical Based course and does require you to be on the server. On average, it takes around an HOUR to do, so please bare in mind if you are able to do it.");
} else if (cellValue === "PT4 - Air Support ") {
Browser.msgBox("PT4 - Air Support: This is a Practical Based course and does require you to be on the server. It should take around 30-40 minutes");
} else if (cellValue === "PT5 - Interceptors") {
Browser.msgBox("PT5 - Interceptors: This is a Practical Based course and does require you to be on the server. It should take around 40-50 minutes");
}
else if (cellValue === undefined) { }
else {
Browser.msgBox("You have entered an invalid course, please select a correct course."); //This is in case they put a wrong course name
}
}
}
Where the links are, at the end of the messages, for example: "The manual can be viewed here:", I would like them to form a hyper link, so when clicked on, takes you to that manual.
Here's the link to the spreadsheet: https://docs.google.com/spreadsheets/d/1QBVvQkkmLJ3Ro2uHAmQm2yulmJ8Tg38p5Ke3YIe-FwI/edit#gid=1161230471
Many Thanks,
Shaun.
You appear to be using the alert dialogue, which will not allow you to add a link.
Instead, I imagine you're looking to create a custom HTML dialogue which will allow you to create the HTML for the dialogue box, allowing you to use an tag for links.
Note: It's been some time since I checked, but I think Apps script displays a warning to the user when clicking on a link like this.

Processing ELF relocations - understanding the relocs, symbols, section data, and how they work together

TL;DR
I tried to make this a short question but it's a complicated problem so it ended up being long. If you can answer any part of this or give any suggestions or tips or resources or anything at all, it would be extremely helpful (even if you don't directly solve all my issues). I'm banging my head against the wall right now. :)
Here are the specific issues I am having. Read on below for more information.
I'm looking for guidance on how to process relocation entries and update the unresolved symbols in the section data. I simply don't understand what to do with all the information I've pulled from the relocations and the sections, etc.
I'm also hoping to understand just what is going on when the linker encounters relocations. Trying to correctly implement the relocation equations and use all the correct values in the correct way is incredibly challenging.
When I encounter op codes and addresses and symbols, etc, I need to understand what to do with them. I feel like I am missing some steps.
I feel like I don't have a good grasp on how the symbol table entries interact with the relocations. How should I use the symbol's binding, visibility, value, and size information?
Lastly, when I output my file with the resolved data and new relocation entries used by the executable, the data is all incorrect. I'm not sure how to follow all the relocations and provide all the information necessary. What is the executable expecting from me?
My approach so far
I am trying to create a relocation file in a specific [undocumented] proprietary format that is heavily based on ELF. I have written a tool that takes an ELF file and a partially linked file (PLF) and processes them to output the fully resolved rel file. This rel file is used to load/unload data as needed in order to save memory. The platform is a 32bit PPC. One wrinkle is that tool is written for Windows in c#, but the data is intended for the PPC, so there are fun endian issues and the like to watch out for.
I've been trying to understand how relocations are handled when used to resolve unresolved symbols and so on. What I've done so far is to copy the relevant sections from the PLF and then for each corresponding .rela section, I parse the entries and attempt to fix up the section data and generate new relocation entries as needed. But this is where my difficulty is. I'm way out of my element here and this sort of thing seems to typically be done by linkers and loaders so there's not a lot of good examples to draw upon. But I have found a few that have been of help, including THIS ONE.
So what is happening is:
Copy section data from PLF to be used for rel file. I'm only interested in the .init (no data), .text, .ctors, .dtors, .rodata, .data, .bss (no data), and another custom section we are using.
Iterate over the .rela sections in the PLF and read in the Elf32_Rela entries.
For each entry, I pull out the r_offset, r_info, and r_addend fields and extract the relevant info from r_info (the symbol and the reloc type).
From the PLF's symbol table, I can get the symbolOffset, the symbolSection, and the symbolValue.
From the ELF, I get the symbolSection's load address.
I compute int localAddress = ( .relaSection.Offset + r_offset ).
I get the uint relocValue from the symbolSection's contents at r_offset.
Now I have all the info I need so I do a switch on the reloc type and process the data. These are the types I support:
R_PPC_NONE
R_PPC_ADDR32
R_PPC_ADDR24
R_PPC_ADDR16
R_PPC_ADDR16_LO
R_PPC_ADDR16_HI
R_PPC_ADDR16_HA
R_PPC_ADDR14
R_PPC_ADDR14_BRTAKEN
R_PPC_ADDR14_BRNTAKEN
R_PPC_REL24
R_PPC_REL14
R_PPC_REL14_BRTAKEN
R_PPC_REL14_BRNTAKEN
Now what?? I need to update the section data and build companion relocation entries. But I don't understand what is necessary to do and how to do it.
The whole reason I'm doing this is because there is an old obsolete unsupported tool that does not support using custom sections, which is a key requirement for this project (for memory reasons). We have a custom section that contains a bunch of initialization code (totaling about a meg) that we want to unload after start up. The existing tool just ignores all the data in that section.
So while making our own tool that does support custom sections is ideal, if there are any bright ideas for another way to achieve this goal, I'm all ears! We've floated around an idea of using the .dtor section for our data since it's nearly empty anyway. But this is messy and might not work anyway if it prevents a clean shutdown.
Relocations plus example code
When I process the relocations, I'm working off of the equations and information found in the ABI docs HERE (around section 4.13, page 80ish) as well as a number of other code examples and blog posts I've dug up. But it's all so confusing and not really spelled out and all the code I've found does things a little differently.
For example,
R_PPC_ADDR16_LO --> half16: #lo(S + A)
R_PPC_ADDR14_BRTAKEN --> low14*: (S + A) >> 2
etc
So when I see this kind of code, how do I decipher it?
Here's one example (from this source)
case ELF::R_PPC64_ADDR14 : {
assert(((Value + Addend) & 3) == 0);
// Preserve the AA/LK bits in the branch instruction
uint8_t aalk = *(LocalAddress+3);
writeInt16BE(LocalAddress + 2, (aalk & 3) | ((Value + Addend) & 0xfffc));
} break;
case ELF::R_PPC64_REL24 : {
uint64_t FinalAddress = (Section.LoadAddress + Offset);
int32_t delta = static_cast<int32_t>(Value - FinalAddress + Addend);
if (SignExtend32<24>(delta) != delta)
llvm_unreachable("Relocation R_PPC64_REL24 overflow");
// Generates a 'bl <address>' instruction
writeInt32BE(LocalAddress, 0x48000001 | (delta & 0x03FFFFFC));
} break;
Here's some from another example (here)
case R_PPC_ADDR32: /* word32 S + A */
addr = elf_lookup(lf, symidx, 1);
if (addr == 0)
return -1;
addr += addend;
*where = addr;
break;
case R_PPC_ADDR16_LO: /* #lo(S) */
if (addend != 0) {
addr = relocbase + addend;
} else {
addr = elf_lookup(lf, symidx, 1);
if (addr == 0)
return -1;
}
*hwhere = addr & 0xffff;
break;
case R_PPC_ADDR16_HA: /* #ha(S) */
if (addend != 0) {
addr = relocbase + addend;
} else {
addr = elf_lookup(lf, symidx, 1);
if (addr == 0)
return -1;
}
*hwhere = ((addr >> 16) + ((addr & 0x8000) ? 1 : 0)) & 0xffff;
break;
And one other example (from here)
case R_PPC_ADDR16_HA:
write_be16 (dso, rela->r_offset, (value + 0x8000) >> 16);
break;
case R_PPC_ADDR24:
write_be32 (dso, rela->r_offset, (value & 0x03fffffc) | (read_ube32 (dso, rela->r_offset) & 0xfc000003));
break;
case R_PPC_ADDR14:
write_be32 (dso, rela->r_offset, (value & 0xfffc) | (read_ube32 (dso, rela->r_offset) & 0xffff0003));
break;
case R_PPC_ADDR14_BRTAKEN:
case R_PPC_ADDR14_BRNTAKEN:
write_be32 (dso, rela->r_offset, (value & 0xfffc)
| (read_ube32 (dso, rela->r_offset) & 0xffdf0003)
| ((((GELF_R_TYPE (rela->r_info) == R_PPC_ADDR14_BRTAKEN) << 21)
^ (value >> 10)) & 0x00200000));
break;
case R_PPC_REL24:
write_be32 (dso, rela->r_offset, ((value - rela->r_offset) & 0x03fffffc) | (read_ube32 (dso, rela->r_offset) & 0xfc000003));
break;
case R_PPC_REL32:
write_be32 (dso, rela->r_offset, value - rela->r_offset);
break;
I really want to understand the magic these guys are doing here and why their code doesn't always look the same. I think some of the code is making assumptions that the data was already properly masked (for branches, etc), and some of the code is not. But I don't understand any of this at all.
Following the symbols/data/relocations, etc
When I look at the data in a hexeditor, I see a bunch of "48 00 00 01" all over. I've figured out that this is an opcode and needs to be updated with relocation information (this specifically is for 'bl' branch and link), yet my tool doesn't operate on the vast majority of them and the ones that I do update have the wrong values in them (compared to an example made by an obsolete tool). Clearly I am missing some part of the process.
In addition to the section data, there are additional relocation entries that need to be added to the end of the rel file. These consist of internal and external relocations but I haven't figured out much at all about these yet. (what's the difference between the two and when do you use one or the other?)
If you look near the end of this file at the function RuntimeDyldELF::processRelocationRef, you'll see some Relocation Entries being created. They also make stub functions. I suspect this is the missing link for me, but it's as clear as mud and I'm not following it even a little bit.
When I output the symbols in each relocation entry, they each have a binding/visibility [Global/Weak/Local] [Function/Object] and a value, a size, and a section. I know the section is where the symbol is located, and the value is the offset to the symbol in that section (or is it the virtual address?). The size is the size of the symbol, but is this important? Maybe the global/weak/local is useful for determining if it's an internal or external relocation?
Maybe this relocation table I'm talking about creating is actually a symbol table for my rel file? Maybe this table updates the symbol value from being a virtual address to being a section offset (since that's what the value is in relocatable files and the symbol table in the PLF is basically in an executable)?
Some resources:
blog on relocations: http://eli.thegreenplace.net/2011/08/25/load-time-relocation-of-shared-libraries/
mentions opcodes at the end: http://wiki.netbsd.org/examples/elf_executables_for_powerpc/
my related unanswered question: ELF Relocation reverse engineering
Whew! That's a beast of a question. Congrats if you made it this far. :) Thanks in advance for any help you can give me.
I stumbled across this question and thought it deserved an answer.
Have elf.h handy. You can find it on the internet.
Each RELA section contains an array of Elf32_Rela entries as you know, but is also tied to a certain other section. r_offset is an offset into that other section (in this case - it works differently for shared libraries). You will find that section headers have a member called sh_info. This tells you which section that is. (It's an index into the section header table as you would expect.)
The 'symbol', which you got from r_info is in fact an index into a symbol table residing in another section. Look for the member sh_link in your RELA section's header.
The symbol table tells you the name of the symbol you are looking for, in the form of the st_name member of Elf32_Sym. st_name is an offset into a string section. Which section that is, you get from the sh_link member of your symbol table's section header. Sorry if this gets confusing.
Elf32_Shdr *sh_table = elf_image + ((Elf32_Ehdr *)elf_image)->e_shoff;
Elf32_Rela *relocs = elf_image + sh_table[relocation_section_index]->sh_offset;
unsigned section_to_modify_index = sh_table[relocation_section_index].sh_info;
char *to_modify = elf_image + sh_table[section_to_modify_index].sh_offset;
unsigned symbol_table_index = sh_table[relocation_section_index].sh_link;
Elf32_Sym *symbol_table = elf_image + sh_table[symbol_table_index].sh_offset;
unsigned string_table_index = sh_table[symbol_table].sh_link;
char *string_table = elf_image + sh_table[string_table_index].sh_offset;
Let's say we are working with relocation number i.
Elf32_Rela *rel = &relocs[i];
Elf32_Sym *sym = &symbol_table[ELF32_R_SYM(rel->r_info)];
char *symbol_name = string_table + sym->st_name;
Find the address of that symbol (let's say that symbol_name == "printf"). The final value will go in (to_modify + rel->r_offset).
As for the table on pages 79-83 of the pdf you linked, it tells us what to put at that address, and how many bytes to write. Obviously the address we just got (of printf in this case) is part of most of them. It corresponds to the S in the expressions.
r_addend is just A. Sometimes the compiler needs to add a static constant to a reloc i guess.
B is the base address of the shared object, or 0 for executable programs because they are not moved.
So if ELF32_R_TYPE(rel->r_info) == R_PPC_ADDR32 we have S + A, and the word size is word32 so we would get:
*(uint32_t *)(to_modify + rel->r_offset) = address_of_printf + rel->r_addend;
...and we have successfully performed a relocation.
I can't help you when it comes to the #lo, #hi, etc and the word sizes like low14. I know nothing about PPC but the linked pdf seems reasonable enough.
I also don't know about the stub functions. You don't normally need to know about those when linking (dynamically at least).
I'm not sure if I've answered all of your questions but you should be able to see what your example code does now at least.
Just answering the question: What is relocation?
When you write assembly program, if it is position-dependent, the program will be assumed to be loaded in a specific part of memory. And when you load your program to another memory address, then all the memory relative addressing data will have to be updated so that it will load correctly from the new memory area.
For example:
load A, B
Sometimes B can be an address, sometimes it is just pure constant data. So only compiler will know when they generate the assembly. Compiler will construct a table of all entries containing the offset, and its original loading relative address, assuming a fixed global address where it is laded. This is called the relocation table.
It is linked to the symbol table, PLT table, and GOT etc:
http://blog.k3170makan.com/2018/10/introduction-to-elf-format-part-vi_18.html
https://reverseengineering.stackexchange.com/questions/1992/what-is-plt-got
What does the concept of relocation mean?
How does C++ linking work in practice?
Try to llok into ELF Specification. It takes about 60 pages, and greatly clarifies things. Especially part 2, the one about linking.

Javamail - How to handle large attachments?

Over imap im trying to get attachments from several messages.
It works fine, but if there is an attachment with about 20 mega-bytes, then it seems stuck and java is not continuing.
Here is where the problem occurs:
I want to get the content of the attachment and save it into a String:
...
MimeBodyPart attachment = (MimeBodyPart) multipart.getBodyPart(1);
if(!Part.ATTACHMENT.equalsIgnoreCase(attachment.getDisposition())) {
log.error("Part is not an attachment!");
} else {
log.debug("Checking " + localFile.getName() + " with " + attachment.getFileName() + ". Attachment-Size: " + (attachment.getSize()/(1024*1024)) + " mega-bytes.");
InputStream remoteFileIs = attachment.getInputStream();
remoteFileContent = IOUtils.toString(remoteFileIs); //stucked here, when attachment is large
remoteFileIs.close();
...
}
...
Are there any solutions to this?
Regards!
What does IOUtils.toString do? Since you're just giving it an InputStream, with no charset information, it can't possibly be converting the byte stream into characters properly. And whatever it's doing it may be doing it inefficiently for large data.
You can turn on JavaMail Session debugging and see the protocol trace as it's fetching the attachment, to determine whether it's really "stuck" or just slow.
You can also control the buffer size for fetches from the IMAP server by setting the mail.imap.fetchsize property.
But perhaps you should question whether you really want a 20MB attachment in a String. What are you going to do with that String once you have it?