I have an object that is having multiple child objects. I want to perform certain actions only if the current record has child records associated with it. For this I am checking the related list's size first, dynamically.But I am facing issues while saving my code :   for(Lead objLeadRec : lstLead) {     for(LC_Setup_Map_Related_List__c objRelatedList1 : lstRelatedListRecords){         relatedChildObjName = objRelatedList1.tdc_tlc__Child_Object__c.replace('__c','s__r');          System.debug('relatedChildObjName'+relatedChildObjName);         if(objLeadRec.relatedChildObjName.size() &gt;0){             hasRelatedListRecords = true;         }     } }   I am facing issue on this line, since the list name which I want to query, I have created using a string ,   if(objLeadRec.relatedChildObjName.size() &gt;0){   Can anyone suggest any workaround. Can't hardcode object names as this code belongs to a managed package and the object names can be different in different orgs.
I have a contact in a generic sObject in apex and while I'm able to easily get detail field values using   sObject.get('MyContactField__c')  I'm not able to get fields off the related parent object, and I'm sure the related field is in memory, based on the debug logs. This returns a runtime error:  sObject.get('Account.MyAccountField__c')  with the error     Invalid field Account.MyAccountField__c' for Contact   How do I get a field value off of a parent on a generic sObject?
How do I rename all folders and files to lowercase on Linux? I have to rename a complete folder tree recursively so that no uppercase letter appears anywhere (it's C++ source code, but that shouldn't matter).  Bonus points for ignoring CVS and Subversion version control files/folders. The preferred way would be a shell script, since a shell should be available on any Linux box.  There were some valid arguments about details of the file renaming.   I think files with the same lowercase names should be overwritten; it's the user's problem. When checked out on a case-ignoring file system, it would overwrite the first one with the latter, too. I would consider A-Z characters and transform them to a-z, everything else is just calling for problems (at least with source code). The script would be needed to run a build on a Linux system, so I think changes to CVS or Subversion version control files should be omitted. After all, it's just a scratch checkout. Maybe an "export" is more appropriate. I would like to run  something &gt; file   on a remote system through ssh, but if I run  ssh host something &gt; file   the redirection is executed locally as ssh etc &gt; file  I've tried it with ' or '' or dd or with a pipe | instead, but I can't get it to work. How can this be done? How to fully delete a git repository created with init? Opt in "mentor" privilege at 7.5k I am suggesting a Mentor privilege at 7.5k. It would be on a per-user per-site opt in basis.  At some reputation level (perhaps 7.5k) there could be an opt in "mentor" privilege.  If someone opts in then when a new user signs up, they become their Mentor. The new user is the Mentee.  They will get notified of any posts or suggested edits they make, and can help and support them.  While this would by no means help everyone (I'm sure there are more new people signing up than there are 7.5k people willing to help them), it could help mitigate the "new user's bad posts" and such like.  By no means would being someone's mentor mean you are the only person who can edit and help them, and you aren't obliged to do so - but if you have opted in then you should help.  How would this work?   Any Mentor would have no more than 5 active Mentees at once. Once the Mentee gets to 125 rep, the downvote privilege (or any other level deemed sensible) they are no longer a Mentee. If they aren't active for a month, they are no longer a Mentee. If the Mentor has 5 Mentees (i.e. cannot mentor anyone else) then any Mentee not active for 2 weeks is no longer a Mentee. The Mentee can opt out at any time, the Mentor can opt out, but if they opt out a lot (say 5 people in 2 months) they are blocked from the privilege for 2 weeks. The Mentor gets no extra rep. They can still get rep from answering their Mentee's questions and similar. Once the new user gets 20 rep on the site, a chat room is created for them to talk. No user with the association bonus will become a Mentee. This would (maybe) be opt in for sites. For example, this might not be at all useful for this site, or for , but on  or  I imagine this could be quite good.    appears to be asking the same thing, based on the title, but that is asking about people who know each other offline mentoring each other.    Every single one of these suggestions (especially the numbers) is open to discussion. Maybe 125 is to low to stop being mentored, or maybe it's too high. What do you think? Bump right-aligned text to next line iff no room Earlier i was not specifying a custom log format, and the captured request headers were getting printed fine. I wanted to log the unique-id-header, but could not find any way of doing so. So i copy pasted the log-format mentioned on , and unique id started getting logged.  Unfortunately, now the captured request headers are not getting logged. The %hrl and %hsl are coming out as empty strings.  Very weird. Here is my config, plzz help :(  listen server   bind *:80   mode http    option  httplog   option  http-server-close   no option logasap   # disable early logging of HTTP requests so that total transfer time is logged   option  forwardfor   capture request  header    X-Forwarded-For      len 500    capture request  header    Host                 len 500    capture request  header    X-Request-UID        len 500    rspadd  X-Haproxy-Backend:\ server    # Generate the X-Haproxy-Unique-ID and log it to make it easy to track requests   log-format %Ci:%Cp\ [id=%ID]\ [%t]\ %f\ %b/%s\ %Tq/%Tw/%Tc/%Tr/%Tt\ %st\ %B\ %cc\ %cs\ %tsc\ %ac/%fc/%bc/%sc/%rc\ %sq/%bq\ {%hrl}\ {%hsl}\ %{+Q}r   unique-id-format %{+X}o\ %Ci:%Cp_%Fi:%Fp_%Ts_%rt:%pid   unique-id-header X-Haproxy-Unique-ID   Here is the log i see:  Sep 13 17:28:57 localhost haproxy[11979]: 10.161.27.218:41592  [id=0AA11BDA:A278_0AA15B71:0050_505217C5_0014:2ECB] [13/Sep/2012:17:28:37.567]  server www-example-com-healthz/- 19998/0/2/1/+20001 200 +326  - - ---- 10/10/1/1/0 0/0 {} {}  "GET /testing/healthz?merchant=www.example.com&amp;source=elb HTTP/1.1"   Note that %hrl and %hsl are empty strings :( How do i capture the request headers ?? From the movies we know that Obi-Wan Kenobi delivered Luke Skywalker to Owen and Beru Lars to raise on Tatooine shortly after Luke was born at the end of RotS (Episode 3).   The next think we know is Luke running into Ben Kenobi during A New Hope.   There seems to be a hint that there was at least SOME communication between Kenobi and Lars family based on him telling Luke:     Your father wanted you to have this when you were old enough, but your uncle wouldn't allow it.   (though it's possible that was referring to Kenobi offering to leave the lightsaber to Larses at the same time he dropped off Luke)  I was wondering if any details of what transpired between Kenobi and Larses in the years between RotS and ANH were noted in any canonical works (of any canon, including EU books/games/comics/etc...)? Give an example of a convergent series $$\sum_{n=1}^{\infty}a_n$$ such that the series $$\sum_{n=1}^{\infty}a_{3n}$$ is divergent..  I cannot find find any kind of series... I am also be very thankful if you find a divergent series (changing the term convergent)... Don't certain processes decrease entropy? The question is how can I exclude an object from the freestyle render?  What I need to do is create a Clay render with the wire only on the airplane.  My scene is simple I only have two objects the "Toy Plane" and the "floor". For the Clay render I only override the materials to a simple clay material and done.    But this happens when I use freestyle. How can I tell freestyle to ignore the "Floor"? I've seen many of the solutions on the topic, all posted in this site. But I haven't seen any of them mentioning Apple's adapter,   I have that, which was used to connect to my old MacBook Pro 2013.   Now, I'm assuming that all I need is to connect the Mini DisplayPort to an adapter, such as  (as mentioned in one of the posts) and the USB cable to a USB-C adaptor.   Is this correct? The Node Editor won't work for the object selected How do I make the method return type generic? Consider this example (typical in OOP books):    I have an Animal class, where each Animal can have many friends. And subclasses like Dog, Duck, Mouse etc which add specific behavior like bark(), quack() etc.  Here's the Animal class:  public class Animal {     private Map&lt;String,Animal&gt; friends = new HashMap&lt;&gt;();      public void addFriend(String name, Animal animal){         friends.put(name,animal);     }      public Animal callFriend(String name){         return friends.get(name);     } }   And here's some code snippet with lots of typecasting:  Mouse jerry = new Mouse(); jerry.addFriend("spike", new Dog()); jerry.addFriend("quacker", new Duck());  ((Dog) jerry.callFriend("spike")).bark(); ((Duck) jerry.callFriend("quacker")).quack();   Is there any way I can use generics for the return type to get rid of the typecasting, so that I can say      jerry.callFriend("spike").bark(); jerry.callFriend("quacker").quack();   Here's some initial code with return type conveyed to the method as a parameter that's never used.   public&lt;T extends Animal&gt; T callFriend(String name, T unusedTypeObj){     return (T)friends.get(name);         }   Is there a way to figure out the return type at runtime without the extra parameter using instanceof? Or at least by passing a class of the type instead of a dummy instance. I understand generics are for compile time type-checking, but is there a workaround for this? Let $R$ be a commutative ring and $I_1, \dots, I_n$ pairwise comaximal ideals in $R$, i.e., $I_i + I_j = R$ for $i \neq j$. Why are the ideals $I_1^{n_1}, ... , I_r^{n_r}$ (for any $n_1,...,n_r \in\mathbb N$) also comaximal? What is the best way to iterate over a dictionary? I've seen a few different ways to iterate over a dictionary in C#.  Is there a standard way? Understanding slice notation Create SOAP envelope of XML and send it as HttpWebRequest to WebService I haven't used regular expressions at all, so I'm having difficulty troubleshooting. I want the regex to match only when the contained string is all numbers; but with the two examples below it is matching a string that contains all numbers plus an equals sign like "1234=4321". I'm sure there's a way to change this behavior, but as I said, I've never really done much with regular expressions.  string compare = "1234=4321"; Regex regex = new Regex(@"[\d]");  if (regex.IsMatch(compare)) {      //true }  regex = new Regex("[0-9]");  if (regex.IsMatch(compare)) {      //true }   In case it matters, I'm using C# and .NET2.0. Cross tabulation of two categorical variables: recommended techniques Let's say we are talking about the indigenous pukapuka who live in Pluto.  What is correct: "the pukapuka people" or "the pukapuka peoples"?  I've read somewhere the usage of "peoples" in this context, and it has surprised me.