KVM's Virt-Manager is not able to PXE boot KVM machines from MAAS Server

Question: I am using virt manager for deploying maas on kvm and other maas nodes for openstack cloud and juju controller running on those KVMs in a dediated single server. For that purpose i have made 2 networks one is br0 attached with eth0 (physical interface) for maas public access and other is "isolated private network" for maas nodes. i have attached my maas-server running on one of the kvm with these two networks by making 2 interfaces (i.e public and private). Now i am trying to PXE boot juju controller machine from MAAS private network but it does not pxe boot that machine and instead giving an error "No bootable device".  Why this is happening? MAAS is supposed to builtin provide a dhcp and tftp server but juju controller is not able to pxe boot fom MAAS server.. Do i need to configure my network ?? Kindly help
Answer: maas server can not be deployed on dual interface .
you must deploy 2 instancesof maas :

a maas api   server
a maas rackd controller , it will provide dhcp,pxe,and proxy api call .

And you must deploy maas 2.5 .
The simple setup is too have only one network interface  by maas server .
Comment: You mean 2 instances on 2 KVMs with a single interface (or it can be dual i.e public or private)??


Is projection of a convex polyhedron on a plane a convex polygon?

Question: If we have a convex polyhedron with vertices $\mathbf{V}$ and project it on a plane $\mathbf{P}$, is this procedure equivalent to projecting points in $\mathbf{V}$ on the plane $\mathbf{P}$ and then computing the 2D convex hull of the projected vertices? In other words, is the projection of a convex polyhedron on a plane a convex polygon? If so, how we can prove it mathematically?
Answer: Hint: A set $\mathbf{P}$ is convex iff for any points $x,y\in \mathbf{P}$ the segment $[x,y]$ joining them belongs to $\mathbf{P}$.
Answer: If $P$ is any linear map and
$$
x = \sum_i \lambda_i x_i
$$
then
$$
Px = \sum_i \lambda_i Px_i
$$
which means: yes! Convex combinations are preserved under any linear map.


Builtin Commands in Unix

Question: In Unix or Unix like systems, The command is in the type of "shell builtin". The commands like cd, echo are shell builtin. Is there any way
to list all the shell builtin commands or Is there any command available to list all the builtin command of the shell ?
Comment: Please check that answer http://stackoverflow.com/a/949006/524743
Answer: It depends upon the shell. So read the documentation of your particular shell.
For bash, see here.
For zsh, see here.
For fish, see this.
For tcsh(which I don't recommend, STFW for csh considered harmful), see here.
For the POSIX shell specification, read that. If you want to code somehow "portable" shell scripts, you should restrict yourself to that specification.
Some rescue shells have many builtins, to be useful on a severely corrupted or broken system which e.g. has no more any /bin/mv or /bin/cp executables. For example sash.
Some shells are able to load plugins (somehow possibly defining new builtins), or to define functions.
Some shells have a restricted form, which removes some builtins (notably cd). For restricted  bash see here.
Comment: thanks. These are documentation. The command which I expected is in following link. stackoverflow.com/a/949006/524743
Comment: Unfortunately for you, that link is specific to `bash`. It won't work with other shells. And it would be incomplete if your `bash` has loaded plugins, or might be excessive for restricted `bash`
Answer: Look up the man page for your shell.
There should be a section "SHELL BUILTIN COMMANDS"
$ man bash

Answer: TAB shows the available commands, from PATH and builtins.
Reset your PATH and enter [TAB] twice and answer y
$ PATH=
$ [TAB][TAB]
Display all 123 possibilities? (y or n)
-                         compgen                   fg                        _ooexp_                   spwd
:                         complete                  fi                        path                      startx
!                         compopt                   for                       _pkcon                    _strip
.                         _compreply_               function                  __pkconcomp               suspend
..                        continue                  _gdb_                     _pkcon_search             test
...                       coproc                    getopts                   popd                      then
[                         __dbus_send               hash                      ppwd                      time
[[                        declare                   help                      printf                    times
]]                        dir                       history                   pushd                     trap
{                         dirs                      if                        pwd                       true
}                         disown                    in                        rd                        type
+                         do                        jobs                      read                      typeset
alias                     done                      kill                      readarray                 ulimit
beep                      echo                      l                         readonly                  umask
bg                        elif                      la                        rehash                    unalias
bind                      else                      let                       remount                   unmount
break                     enable                    ll                        return                    unset
builtin                   esac                      local                     _scout                    until
caller                    eval                      logout                    _scpm                     wait
case                      exec                      ls                        select                    while
cd                        exit                      ls-l                      set                       _yast2
_cd_                      _exp_                     _man_                     shift                     you
cd..                      export                    mapfile                   shopt                     _zypper
command                   false                     md                        skipthis
command_not_found_handle  fc                        o                         source

Answer: just type help on the shell, and a list will appear

Builtin Commands in Unix


RAD Seq Data Analysis without barcode

Question: I received a ddRAD Seq data from my supervisor without barcodes and restriction enzymes. I asked him for both and he said I don't need it since the data has been cleaned by the company. Now, I am kinda confused and don't know where to start.
Comment: How about having an honest face2face conversation with him rather than asking strangers in the internet. Lack of proper conversation with peers is in my experience a major source for poor production, just talk to him and ask for clarity why you don't need it and how you should proceed.
Answer: Wow Biobash, that's kinda harsh. It is cool that sometimes you unexpectedly learned something new. What Michael mentioned is pretty interested, no one has ever mentioned that or I have never heard that.
So, my approach would be that you now are doing a Poolseq study, since you can't identify individuals. The other way to try to catch the paralogues is to map your reads to a sister species. My question is what are you trying to estimate? Genetic differentation? Genetic diversity? Pop Gen structure?
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6116966/
https://onlinelibrary.wiley.com/doi/full/10.1002/ece3.5240
https://www.g3journal.org/content/9/12/4159
One semi-robust approach to assess usefulness is thinking about your system and defining what you expect to find, let's say in terms of genetic differentiation or genetic structure, and estimating that from your data. If that hypothesis is confirmed, your dataset might be useful. You can test the same by first estimating the loci by mapping your reads to a sister reference genome, to try to detect paralogues. Since you don't have barcodes, then each "locus" is independent, and you lose power, but there is nothing else you can do.
Good luck;
Answer: The fundamental problem with RAD is that if you hit paralogue - you're done.
Identifying a paraologue isn't necessarily easy depends on the species. Essentially if you're doing pop gen you need homologues and RAD has too many situations where it can fall over without you knowing.
What happens if you've a paralogue is that you start confusing concerted evolution (pop gen of a genome) with population structure between individuals. I do agree that without barcodes identifying individuals - thats a bit tricky ;-) , however RAD an approach loaded with pitfalls.
Pop gen means being able to identify populations and on face value that will not be trivial without barcodes (I suspect they are still there), but RAD is far from an ideal tool and can give weird and wonderful metrics which have little to do with the population structure.
Its not the only problem with RAD for the purpose you are using it.
Comment: Thanks @all, I really appreciate your kind responses.
Comment: @BioBash upvotes preferred

RAD Seq Data Analysis without barcode


How do i prevent users from selling NFTs they earned from my platform to any external marketplaces like openSea

Question: I am building my platform where users will do several tasks to earn NFTs as a reward, I don't want them to sell these NFTs on any external marketplace. Is there a way through which I can restrict my NFTs to my ecosystem only? Please let me know if anyone has any suggestions!
Answer: Yeah just disable the transfer functions.
If you are using the openzeppelin then you can do something like this
Just add this code and transfer functions will always revert.
Even if you are not using openzeppelin this will work, you just need to remove the override keyword, coz it's not needed here.
function _safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal pure override {
        revert("No batch transfer allowed");
    }

      function _safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal pure override {
        revert("no transfer allowed");

Comment: Thanks It worked !!
Comment: Glad to hear that :)
Answer: I see 3 possible options depending what fits best current and future use cases for your contract:
contract XXX is ERC721, Ownable {}
1- You can override the _safeTransferFrom function to include an option for pausing all transfers (when paused = true then all transfers, including sales, are disabled):
bool public transfersPaused = false;

function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
        require(transfersPaused = false), "transfers paused")
        safeTransferFrom(from, to, tokenId, "");
    }

function setTransfersPaused(bool _setPause) public onlyOwner {
        transfersPaused = _setPause;
    }

2- You can also blacklist/block specific contracts addresses (Marketplaces = operators) from initiating transfers (given you identified their addresses).
bool public transfersPaused = false;
address[] public blockedOperators;

function blockOperators(address[] calldata _blockList) public onlyOwner {
    delete blockedOperators;
    blockedOperators = _blockList;
}

function isBlocked(address _contract) public view returns (bool) {
    for (uint i = 0; i < blockedOperators.length; i++) {
        if (blockedOperators[i] == _contract) {
        return true;
        }
    }
    return false;
}

function setTransfersPaused(bool _setPause) public onlyOwner {
    transfersPaused = _setPause;
}

function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
    require(transfersPaused = false, "transfers paused");
    if (isBlocked(msg.sender) == true) {
        revert("no transfer allowed");
    }
    safeTransferFrom(from, to, tokenId, "");
}

3- Similarly than with the _safeTransferFrom function, you can also act on the _setApprovalForAll function. It restricts access to the operator approval required to manage tokens on the user's behalf (which basically block most Marketplaces' ability to swap tokens).
bool public approvalsPaused = false;
mapping(address => mapping(address => bool)) private _operatorApprovals;

function _setApprovalForAll(address owner, address operator, bool approved) internal virtual override {
    require(owner != operator, "ERC721: approve to caller");
    require(approvalsPaused = false, "Approvals paused");
            if (isBlocked(msg.sender) == true) {
        revert("no transfer allowed");
    }
    _operatorApprovals[owner][operator] = approved;
    emit ApprovalForAll(owner, operator, approved);
}

Note that any approval already granted (prior restrictions) can't be revoked with this code. You also need to include the blockOperators and isBlocked functions to the contract (see 2)
Comment: Can you just mark the answer as correct?


Does WCF Run the session on more than one thread?

Question: I have a wcf service (hosted in IIS) that is setup to use sessions.  It seems to work.  When Application_PostAcquireRequestState is called I have a session ID.
I end up using it like this (in my Global.asax):
if (Context.Handler is IRequiresSessionState)
{
    log4net.ThreadContext.Properties["sessionId"] = Session.SessionID;
}

That seems to work fine.  The value is stored off into my log4net property.
But when my service operation begins (my actual WCF service code) the log4net property is null again.
Since the property is stored per thread (ThreadContext), I can only assume that this means that the session is setup on one thread then executed on another thread.  Am I right?
Is there anyway to get my log4net property set on the on the correct thread (without having to remember to make the above call at the start of every single service operation)?
Comment: I always expect multiple threads to be involved. I'm not sure where I picked that up though. Did you look into (custom) behaviors on the service it self to achieve what you want?
Answer: Yes, IIS may use multiple thread to service multiple WCF requests.  See http://msdn.microsoft.com/en-us/library/cc512374.aspx for more detail.
You might consider using different instances of a logger for each WCF request.
Comment: You say "multiple thread to service multiple WCF requests".  I am talking about a single WCF call...  (not multiple)
Answer: There are multiple scenarios where WCF might change threads on you:

The Global.asx thread is not guaranteed to be used for a service call (in fact its unlikely).
If there are multiple calls during the same session, the thread may also change between calls to the same service instance.

In theory state information like this should be stored in an Operation Context object. However because log4net uses thread local storage it becomes an awkward solution.

Is there anyway to get my log4net property set on the on the correct
  thread (without having to remember to make the above call at the start
  of every single service operation)?

Yes. Create a custom IOperationInvoker. The best example I know of is Carlos Figueira's blog. If you apply this as a service behavior your log4net property should always be defined for the service code.
One warning: When adding to thread local storage be sure to clean up. That's why log4net.ThreadContext.Stacks[].Push() returns a IDisposable. In other words your Invoke method should look like (incomplete and untested):
public object Invoke(object instance, object[] inputs, out object[] outputs)
{
    using (log4net.ThreadContext.Stacks[key].Push(value))
    {
        return this.originalInvoker.Invoke(instance, inputs, out outputs);
    }
}

See Carlos' blog to understand why you are calling the "originalInvoker". Note that if you want to support async operations that you need to implement additional methods.
Answer: Custom properties do not need to be strings. So you could store an instance of the following class in the global context:
public class SessionIdProperty
{
    public override string ToString()
    {
        // error handling omitted
        return Session.SessionID;
    }
}

This way log4net can access the Session object directly when it logs a message. Log4net calls the ToString() method on non-string properties.


Is there any data structure in Ruby which is similar to Pascal records?

Question: Is there any data structure in Ruby which is similar to Pascal records?
I would like to define a record type which has about 15-20 fields, all of them are strings.
I tried to define a class for this purpose, but I realized that I have to define getter and setter methods:
class Data
   def description
        @description
   end

   def size
        @size
   end

   def address
        @address
   end

   .
   .  all other (about 15 variables...)
   .

   def description=( value )
        @description = value
   end

   def size=(value)
        @size=value
   end

   def address=(value)
        @address=value
   end
  .
  . more setter method (about 15 times...)
  .

end

To define all the 15-20 fields and getters/setters this way is quite annoying. Is there any shorter way to do it? For example:
class Data
 desc, size, address=""
end

Or something similar, and then I would be able to create a new instance of the Data class:
d=Data.new

and then set the instance variables:
d.desc="bla"
d.size="50.66"
d.address="Bla street 20."

I already have a method, that can parse an XML file with the XMLSimple gem, and I would like to create a record (or class) from the parsed data and return it back with the "return" keyword. Then I want to access the fields of the record simply: d.size, d.address, d.description and so on. For example:
def data_import(fname="1.xml")
  data = XmlSimple.xml_in(fname,{'SuppressEmpty' => ""})
  d=Data.new()
  d.desc=data['desc'][0]
  d.size=data['size'][0]
  d.address=data['address'][0]
  d. ... =
  d. ... =  (about 15-20 times)
  d. ... =
  return d
end

my XML (1.xml):
<entity>
 <desc>bla</desc>
 <size>50.66</size>
 <address>Bla street 20.</address>
 .
 . (15-20 more fields)
 .
</entity>

In the Pascal language (and as far as I know in C++) there were a data structure called "record" for this purpose.
Answer: Yes, there is, it uses the C/C++ name instead of record: Struct. Struct is a class factory, if you call Struct.new, it will return a class which has the desired fields:
Data = Struct.new(:description, :size, :address, …)

If you need to modify the behavior, you can pass a block to Struct.new:
Data = Struct.new(:description, :size, :address, …) do
  def my_custom_method; end
end

or use inheritance:
class Data < Struct.new(:description, :size, :address, …)
  def my_custom_method; end
end

Then:
d = Data.new

d.description = …
d.size = …
d.address = …

or alternatively:
d = Data.new(…, …, …)

Comment: In Pascal there were a feature "with":
`with d do
begin
Answer: You cand use a Hash as a bucket for your attributes/properties or you can make use of Ruby's metaprogramming abilities for generating getters and setters using accessors like this:
attr_accessor :desc, :size, :address

You can also collect the attributes in an array and use splatting like this to expand the array in a list needed by the previously mentioned method:
attributes = [:desc, :size, :address]
attr_accessor *attributes


How do I take off this shower head?

Question: I have been trying to take it off for a while now. The damage to it was like that when it was installed before I moved in.
Comment: Hello, and welcome to Stack Exchange. It's hard to tell, but the shower head may be cross-threaded onto the pipe.
Comment: It is helpful if you state what you did try - so we don't tell you to do the same things as you have already done.
Answer: The shower head side would appear to have wrenching flats so normally one would use an adjustable wrench on that side. Someone has used pliers and badly scored the surface so if you want to discard the head, then just do the same.
On the supply pipe I use pliers over a rag. It appears that Teflon tape was used to seal the threads, but normally sealing these threads is not necessary. There is supposed to be a soft rubber seal inside the shower head fitting which the end of the supply tube presses against. The water is stopped at that point and never reaches the threads.
I tighten just enough to stop it from leaking. There is no point in over tightening because this over compresses the seal. If it would leak, the leak is only when the shower is on and the leaked water goes down the drain (as opposed to a leak inside a wall).
Answer: A Good set of locking channel locks on the shower head is what I would use, you could also use a small filter wrench where the tensioning belt gets tighter as you pull to loosen. Sometimes you might find a tool with a grip that works in the same manner as the tension belt style oil filter tools sold for vehicles.
If none of this works - get a dremel tool and cut a slot down the left and right side - pry the thing apart off of the threads - as if it was a clam shell on the pipe.
Comment: I also like locking pliers (Vise Grips is one brand). If you know how to use locking pliers correctly, then they are very effective at griping without crushing. Used incorrectly they will scratch a surface severely. I don't have a strap wrench, but I intend to get one. I think a strap wrench would grip the tubing without marring.

How do I take off this shower head?


At the end of Dreamfall, what is the fate of April Ryan and Zoe Castillo?

Question: At the end of Dreamfall, April Ryan (spoilers hidden)

 appears to have been killed, and Zoe is in a coma.

Are there any hints throughout the game that their fate is really different than what it appears to be on the surface?
Comment: Can you edit the title to remove the **[SPOLIERS]** bit in the title? Besides the spelling, it's not necessary with the *spoiler* tag.
Comment: @Juan Manuel - You bet. I hope someone knows something.  The way things ended, Zoe didn't exactly "Save April".  It's like the whole thing ends in failure.
Answer: Unfortunatly there is some speculation as to whether there will be a sequel. The head writer Ragnar Tørnquist seems to be very involved in getting Funcom's latest offering The Secret World MMO developed and launched. He has however indicated that an episodic format of Dreamfall Chapters is floating around at Funcom. I enclose an excerpt of what he said as his blog seems to be down to link to:

Nothing major is currently happening on Dreamfall Chapters. The people who will be involved when it does happen – myself included – are tied up in other projects, primarily The Secret World. TSW will continue to be my (and their) primary focus for a while longer…but that doesn't mean nothing at all is happening with Chapters. It just means that it's not (at least not officially) in production – for now.
Comment: This answer is considerably out of date now that all 5 parts of Dreamfall Chapters are out.
Answer: Yes, there's at least one hint to the fate of April in The Longest Journey.

 While it's never explicitly stated, but Lady Alvane, (the mysterious old woman who tells the story) appears to be April herself. At least if you take into account that she knows the story of April very detailed and that Crow is with her, and as it seems he was for a longer time as he asks "You don't plan to go on an adventure again, do you?" (or similar) at the end of The Longest Journey.
Answer: Lady Alvane could also be Zoe:

Remember how she says at the very end of TLJ that it had been a long time since she remembered "April Ryan"? Unless she is refering go herself in third person, it could be that it's someone else, talking about april.
Remember how Crow tells Zoe "From now on, I'll be your sidekick" after both of them are mad at april for not wanted to help them out? In that last scene from TLJ we see him in Lady Alvanes house.
Answer: It's a cliffhanger. They're planning to do a sequel, so the characters can't all be dead/incapacitated. I'm guessing at least Zoe is going to come out of the coma somehow and April might not be completely dead after all.
According to wikipedia work on the sequel has not (yet?) begun, so there's nothing definitive on the fate of the characters.
Answer: As of the 21st of October a sequel has been published named 'Dreamfall Chapters', in which it is clear from the first minutes what happened to Zoe and April.

 April died. Her body burned in a burial ritual reminiscing that of a viking burial ritual, yet more magical. Zoe has been in a comatose state ever since the incident and you join her side again after 12 months has passed.
Answer: Technically the following count as out of game hints, but they do clarify the in game occurances at the end of Dreamfall.  I also include this info here because some of the other answers are now out of date.
Dreamfall: Chapters, the sequel to Dreamfall, has been funded via Kickstarter and is in development.  The Kickstarter description indicates that while it focuses on wrapping up Zoe's story, it is also a continuation of April's story wherein we learn her destiny.  It also notes that April was "fatally wounded" at the end of Dreamfall, which presumably means she will not be dead at the start of Chapters.
As a further OOC hint, Red Thread tried unsuccessfully to raise enough extra money to start work on The Longest Journey home which concludes April's story.  This also strongly implies April will survive Dreamfall and Chapters.
So, Zoe is definitely in a coma, and April is fatally wounded but not dead yet.  However, both their stories will continue in Dreamfall: Chapters and possibly The Longest Journey Home.  So things are either not as they seem, or more plausibly, likely to change quickly within Dreamfall: Chapters.


How to invert image colors from black to white

Question: Inkscape installed on Debian. How to invert SVG image colors from black to white?
Tried to select all the paths (Select all) and use extensions > color > negative - but this method don't work.
Answer: Your shape has no strokes, all paths are closed areas filled with black. Doing exactly what you asked i.e. changing black fill color to white makes your shape invisible against white background. To make it visible again insert a colored background:

I'm afraid you have also secret hopes like make something black. If I'm right, reveal them, too to get an useful answer.
Comment: I want to save white pattern without background, I need only pattern (for printing it on black material)
Comment: @minto Not my business, but printing on solid black which already covers the surface needs something else than a printer which uses CMYK inks. You need opaque white ink. No idea which printer allows it.
Comment: The file is for t-shirt printing service, they using some special printer.
Answer:
Touch the 3 shapes.
Touch a color. I used orange just to play with it.

And Paul Johnson is right. There is no white background to be inverted. You need either to add one with color or use the SVG on, let's say a web page with a color background.
To avoid being lost when using white shapes on a white background, I do not use pure white while working with it.
Comment: The background is already transparent. The 3 shapes are the inner circle, the outer, and the middle pattern. Depending on how you select them you select them separately or joined.
Comment: Thank you for tips. I used the mouse pointer to touch the black ornament in some place. This made it possible then to change the color at the bottom panel.
Which 3 shapes did you have in mind? I'm still not sure how to change the background to transparent. I want to save without backrground - I need only white patterns. (for printing it on black material)
Comment: Just send it as it is to the printer, they probably need it... black, so they generate the prepress negative or positive to print it with white ink.
Answer: Select everything, and in the Fill and Stroke panel, change the fill to White.
Note that this will make everything appear invisible, since a white object on a white background (the default in Inkscape) will not show up. Note also that this is not an actual white background, it is merely shown as white for display purposes. SVGs have no actual background.
You can then go to Edit > File > Document Properties, choose the chequered background option which shows transparent areas with a chequered pattern, then hit the Page colour square, and choose a light grey. Note that the colour you choose is not important as this is just a background for display purposes in Inkscape, and not a real background colour. This will make the white object visible again.
Comment: Well, but none of the above methods work for this simple SVG [image](https://de.wikipedia.org/wiki/Schwarze_Sonne#/media/Datei:BlackSun.svg). What is wrong?
Comment: @Minto That's only because it has strokes and fills, and so you'd need to change both to white, unlike the first example which only has fills. This is pretty basic stuff TBH. Perhaps have a look at this tutorial I found for you [on youtube](https://youtu.be/o86MLSQHtMg?si=JJZByl42HA6byNcP) - it describes the concepts and uses of strokes and fills.  This functionality exists in all vector image editors by the way, not just Inkscape.


Is it worth to learn to make a MD5-hash cracker?

Question: I found a puzzling site where one puzzle was to find a string whose MD5-hash is given. Is such a puzzles good for learning? I mean, I believe that hash might be cracked by using enough computing resources. You might learn distributed computing or GPU/assembly programming if you try to make a cracker as fast as possible. On the other hand, why should one spend weeks to crack some hashes?
Comment: My guess would be that there's a better technique than brute force, especially considering that multiple strings may have the same md5 hash...
Comment: Unless the string is constrained to just a few characters, then you have no chance.  There are some weaknesses in md5, but I doubt that they will help to crack an arbitrary hash.
Answer: I have used a similar idea - writing an SHA-1 hash cracker - as a mini-project for students learning Java. These students had previously learned to program in other languages, so they had experience with variables, if/else, loops and functions; the main goal was to get them used to Java's syntax, but some of the specific things they had to do were:

Import and use a library method (DigestUtils.sha1 from the Apache Commons library).
Write a for loop over a range of characters instead of a range of integers.
Use nested for loops to generate every combination of characters, of a fixed length.
Use recursion to generate every combination, where the password length is a parameter.
Estimate how long it would take to crack a password of a particular length by brute force.
Read from a text file with one word on each line.
Test their code.

Your question implies you are thinking of writing your own implementation of the hash function itself. I think that's probably less worthwhile, since you'll just be directly translating from the hash function's specification into code, or from an implementation in one programming language to another. You would be practicing your skills in reading and making sense of specifications or code, and you might learn some things about bitwise operators; but the design of a hash function is arbitrary and opaque to almost everybody, and there would not be much real "problem solving" required.
I think for a learner-programmer, there is more to gain from using a library for the actual hash function, and writing the rest of the cracking program yourself - i.e. the part which generates the candidate passwords to feed into the hash function. For example, the next mini-project I got those students to do involved generating all combinations of playing cards to work out probabilities of winning in a simple card game; this is not entirely unlike generating combinations of characters for a password, and some students did notice the similarity.
Comment: Welcome, fellow teacher :)


Why does a particular radioactive decay chain terminate at the same isotope regardless of different decay paths

Question: If we start with a particular unstable isotope and this begins a decay chain, and if at some steps along the way the parent nuclide can decay by either beta or alpha decay, why is it that we end up with the same isotope at the end in all cases?
Comment: In particular any decay chain that involves a spontaneous fission almost certainly has multiple end states.
Comment: Consider the alternative - multiple possible end isotopes. But, that would require that they all are equally stable, or else decay could continue.
Comment: I doubt that the assertion is true. Do you have evidence for this? I would certainly be willing to believe that in most cases, all the chains terminate in the same isotope, and that in nearly all cases, there is a high probability of terminating at the same isotope.
Answer: The assertion that radioactive decay chains terminate at the same isotope regardless of different decay paths is not correct. Potassium-40, for example, can decay to calcium-40 via $\beta^-$ decay, or to argon-40 either via electron capture or via $\beta^+$ decay. Both calcium-40 and argon-40 are stable nuclides.
In addition to the above example, decay chains that involve fission inevitably end up with a number of stable end states.
Answer: Some decay chains "terminate" in the same isotope, but this is part coincidence and part a testament to the stability of that particular isotope. The decay chain of silicon-22 (simplified map below), for example, has several branches which terminate with neon-21.
The neon-21 is generated through the decay of two different elements (from beta+ decay both times) with extremely different half-lives. But the chains "stop" here because neon-21 is stable, and not for any other reason. The fact that two different chains start at different isotopes but terminate at the same one is not because of some property of these chains, it is because of a property of the final isotope (its stability). And it's important to note that our definition of "stable" usually means that we have not yet learned an isotope's half-life. All isotopes will eventually decay into what is basically just particle soup. All chains will end up the same at the end of the universe!
Matter is constantly trying to reach the lowest-possible-energy configuration (most stable isotope, here). Some ways of getting there are better than others, and some isotopes are more stable than others. These are the ways that are preferred probabilistically. As a result, many chains - but not all - "pass through" or even terminate at the same isotope. A counterexample for the idea that all chains pass through the same isotopes would be the comparison of something like gold-196 with silicon-22; the gold stops at a stable mercury and platinum isotopes, and never makes it down to isotopes with atomic numbers as low as silicon. @David Hammen's answer gives a similar counterexample with isotopes much closer together in mass. And as @Patrick Weith touched on in their answer to your question above, isotopes of similar mass or atomic number are generally more likely to have similar decay chains, just because there aren't that many options for how they can decay.
In conclusion, it's sort of just coincidence that certain chains end together, and also kind of fate.
Answer: If you look at a table of nuclides (http://www.creation-science-prophecy.com/u238series.gif) and the possible paths, you'll realize that the decay processes are all diagonal steps, either to top-left or down-left. In the case of alpha decay it is a double step to down-left. So there are 2 types of processes, one type reduces protons and neutrons (alpha and ß+) and another type that turns a neutron into a proton (ß-). For each atom the stable isotope lies somewhere in the middle and if you go to high neutron numbers, the processes that turns neutrons into protons have a high rate (-> low half-life), where on the other side, low neutron numbers, the process that reduces neutrons and protons at the same time dominates regarding rates (-> has low half-life). Now take into account that the curve of stable isotopes is a bit curved, so this means, it is possible with these processes to return to a stable isotope and the direction towards stable isotopes is favored.
This answer is for over 99% of the mass of an isotope. There are always other possible decay processes with really low rates (high half-life), that also happen but are not important for over 99% of involved mass. Always consider half-life ranges from microseconds to thousands of years. Whenever there is a process happening on the seconds scale, we don't care about the process happening in years, but in fact it is there and offers for a different path along the nuclides. So if you take into account all small fractions, then the statement that all isotopes end at the same isotope is not true. But for the vast majority of atoms this is true, since moving away from the stable isotopes means the processes pushing back to the stable isotopes becomes faster than the process pushing away (left side: alpha/ß+, right side: ß-)


How to make Angularjs application crawalable

Question: Im building single page app using Angular.js,  My question is how to make application crawlable because routing is handled using ng-view on client side and server just return simple header file.
Site Link:http://india-elections.in/
Answer: The only working solution I know is the one the core AngularJS team uses for its documentation website.

First they use HTML5 history for URLs and a fallback with a hashbang. URLs with a hashbang make Google crawl them with <code>_escaped_fragment_</code> in the query string.
Then they use AngularJS string interpolation and directives on the backend to render the templates as they will be in the DOM when the user loads the page and AngularJS parses it.
They pass that to Google and thus they have the same content in the search index as in the users' browsers (so this is not cloaking).

This was mentioned by the core developers in the AngularJS Google group. [1] [2] [3]
Also from the rest of the threads there I think they are using PhantomJS and NodeJS to parse the pages.
[1] https://groups.google.com/d/msg/angular/yClOeqR5DGc/4YXGx9z8EpAJ
[2] https://groups.google.com/d/msg/angular/EGwg49uAmMI/j-kj9nytT-IJ
[3] https://groups.google.com/d/msg/angular/EGwg49uAmMI/j-kj9nytT-IJ
Comment: could you please provide link to the suggestion
Comment: @Ajaybeni I am looking for that. Until now I found that - https://groups.google.com/d/msg/angular/yClOeqR5DGc/4YXGx9z8EpAJ
Answer: I implemented crawling in my site using above all points and below link
https://developers.google.com/webmasters/ajax-crawling/
http://www.yearofmoo.com/2012/11/angularjs-and-seo.html
http://india-elections.in
Created Static template using PhantomJs
Comment: What did you use to create the HTML snapshots?
Comment: I created the snapshots manually be replacing scripts sections and css sections manually
Answer: I came across this service that might be worth checking out.  It runs a PhantomJS server and does all the legwork for you.
Comment: the documentation on this site is very limited should we use hash based url or html5 based url
Answer: Making a single page app Crawl able yet interactive is not a straight forward task. You have to think about access points from the UX perspectives that will allow the back button, and jump in access. When the back button is pressed, for instance, marks for object states needed to be recreated on the server without user interaction generating the same markup as the usage to get to that access point would create on the client. Phantom.js can be used for this task, or client/server agnostic js can be used to run on both ends, or like in the good ol php days the entire logic to replicate the state of the access point can be re-written for the server. @Ajay Beniwal has detailed some links on how to create html snapshots.
Assuming you have a webserver that can throw out bootstrapping markup given a particular object state. The state can be supplied via a state identifier, this needs be the url to make your code crawlable. Libraries like Angular js and Backbone.js supply mechanisms like the Backbone.Router, which in turn either use link fragments or HTML5 pushState() method to store the state identifier on the client. The beauty of HTML5 is however that a refresh makes a straight call for the right object state to the server without having to load an initial page that parses the hash supplied and redirects to the proper object state url, tho there is no other option for old browsers, architecting your application around the HTML5 paradigm will make them a cake for crawlers, and most implementations of HTML5 pushState such as Backbone.Router degrade gracefully in to hash tag state marking implementations for older browsers to still allow the back button.
Answer: Since October 2015 you don't need to do anything in order to make your application crawlable (I assume you're referring to Google crawling).
Check this article :
https://webmasters.googleblog.com/2015/10/deprecating-our-ajax-crawling-scheme.html


Is a RMD required from a 401(k) if one is over 70 1/2 and still working full time and contributing to the 401K each week?

Question: Is an RMD required from a 401(k) if one is over 70 1/2 and still working full time and contributing to the 401(k) each week?  If so, can it be done online from the 401(k) site?
Answer: No. Depositing or not, if you are still working, RMDs are not required. The following citation is from the IRS article 401(k) Resource Guide - Plan Participants - General Distribution Rules

The required beginning date is April 1 of the first year after the
later of the following years:
Calendar year in which you reach age 70½.
Calendar year in which you
retire.
However, a plan may require you to begin receiving distributions by April 1 of the year after you reach age 70½, even if you have not retired.

I added the last line after seeing the comment below. Thus the answer morphs to "The post 70-1/2 401(k) RMD while working, is not required by the IRS, but might be, by the plan itself. Therefore, one should check with their plan administration, or read the fine print." Keep in mind, the company running the plan makes money on volume, the 70-1/2 year old on average, would have a far higher balance than the young worker, and it's not in the company's benefit to force these withdrawals.
I am retired, and yes, the plan lets us handle the transactions on line.
Comment: But that's followed by "However, a plan may require you to begin receiving distributions by April 1 of the year after you reach age 70½, even if you have not retired."  I suppose it's also possible that the rules are somewhat different for 401(k) and IRA RMDs.  Since I'm self-employed, I wound up rolling my 401(k) into an IRA, so those are the rules I was looking at.
Comment: Are you sure of that?  Everything I've read (admittedly not extensively) says the 70 1/2 deadline is pretty much set in stone.  Could you give a reference?
Comment: One more edit. Better? Yes, IRAs have different rules. RMDs are required, by law. 401(k)s also have a 20% mandatory withholding. With no other income, most people have an average tax rate far lower than this. In the withdrawal phase, it's better for most to first transfer to an IRA account.
Comment: Better, though still confusing - though the confusion is not your fault.  It would have been just too simple to use the same set of rules for both IRA & 401k, there might even be unemployed lawyers :-(
Comment: I could not agree more. Different rules between the 401K and the IRA and a multitude of other retirement accounts, makes no sense. In our case, when we retired my wife was over 55 but under 59 1/2, So 401(k) withdrawals had no penalty but the IRA would. Just add that to the list.


How does a balancing toy work?

Question: I know that the balancing toys have their center of mass under the axis on which they are balancing. That's why they stay still. But when we give a little tap on it, it re-balances itself. But how does it happen? Does the center of mass acts like a pendulum?
Answer: You are correct that the bird is a carefully disguised pendulum.
Notice the tips of the wings are slightly forward of the beak and slightly lower. The wing tips have heavy weights in them. This allows them to balance out the tail of the bird, and places the center of gravity below the beak. A CG below the pivot point makes it stable to small perturbations.
Answer: It is the same concept as with the tumbling self righting toys: what makes it stable is that the center of gravity is located at a point that will move up when the object starts to tip over. So gravity will make the center of gravity fall down again, which makes it move to the upright position again. In this case the wings that are pointing down place the center of gravity a bit below the beak, which from this position will be at the lowest possible point.

How does a balancing toy work?


Create A Web Part For SharePoint Store

Question: Since sandbox solutions are no longer supported in SharePoint Online how can a visual Web Part that will be made available on the SharePoint Store for purchasing be created?
Answer: There's no real concept of Web part in SP Online.
You have two alternatives:

Create a SharePoint add-in containing an app part. But technically app parts have nothing to do with Web part. They're purely declarative (in a simple XML file) and are actually a simple IFrame pointing to a configured URL external to the current site.
Use the new SPFx (SharePoint Framework) tools to create a pure client-side "Web part". See this link.

Create A Web Part For SharePoint Store


Ringtone for each sender in whatsapp

Question: I want to give different sound for each sender in whatsapp ( not group )
Example: i have 10 contacts in whatsapp so i want each person when send massage i give it different sound means 10 different sound for 10 different contacts. Thank you
Answer: This isn't possible. Since WhatsApp messages are (technically) iOS notifications, and WhatsApp (as of now) does not allow this customization within the app itself, you cannot achieve this.

Ringtone for each sender in whatsapp


Why do I think Lebesgue's number lemma is wrong...

Question: Counterexample: $[0,1]\times[0,1]$ with induced subspace topology from $\mathbb{R}^2$ is compact. The open cover $\mathscr{U}$ is just the two circular sectors. When we look at the up-left corner and down-right corner, it fails - there is no such $\delta$, such that let the open ball be only in one of  circular sectors... what is wrong?
Comment: There is no way to make those two quarter disks open and to include the corners $(1,0)$ and $(0,1)$.
Answer: The upper-left and bottom-right corners are not contained in either open circle. That is, your claimed counterexample fails to cover the square.
Moreover, I think you may have misunderstood what is important about Lebesgue's number lemma. The following statement

Let $\mathcal U$ be a cover. For any $x$, there is some $\delta$ and some $U\in \mathcal U$ such that $B(x,\delta)\subseteq U$

is clearly true of any cover - no need for compactness. This is basically just writing down what "open" and "cover" are defined to be. Given that your counterexample fails this condition, it is clear that it is not an open cover.
Note that Lebesgue's number lemma exchanges the quantifiers and says that there is some $\delta$ that works for all $x$. This is what requires compactness.
Comment: Thanks for pointing out. I did not thought in that way, I though the lemma was weirdly wrong, because when I fix a $\delta$ and then moving a small ball towards that two corner, there must be a time point that the small ball is not fully contained in any circular sectors. But yes.. there are another two sectors missing to cover the two corners.

Why do I think Lebesgue’s number lemma is wrong...


Glade: How do I pass more than one argument to a signal handler?

Question: Glade: How do I pass more than one argument to a signal handler?
Answer: What you can do in glade is very limited. You can pass zero or one object as userdata to a signal handler. The object has to be a widget (or other object) also present in the glade project.
If you connect the signal from code on the other hand, you can pass a structure containing various stuff as you please.
And if you create signals yourself you can utilize marshallers to create how many arguments you want (for the signal handler prototype), but still just one userdata argument. So this will not let you specify more argument then connecting the signal, only then invoking it.
Answer: from here:
http://library.gnome.org/devel/gtkmm-tutorial/2.21/sec-connecting-signal-handlers.html.en
...
We just told you that the button's clicked signal is expecting to call a method with no arguments. All signals have requirements like this - you can't hook a function with two arguments to a signal expecting none (unless you use an adapter, such as sigc::bind(), of course). Therefore, it's important to know what type of signal handler you'll be expected to connect to a given signal.
Answer: Why don't you just simply obtain a reference to each of the objects that you need to access in the Event Handler when the application loads?  If you store these references as global variables, then it wouldn't matter how many parameters you need to pass to the event handler.  All of the Gtk Widgets would be available within your function to use however you see fit.


Low gaming performarnce

Question: I recently started with Ubuntu, and i have been facing some problems when it comes to gaming. Im getting very low frame rates on games like CS:GO or Spec Ops The Line, wich are very playable on other OS like Windows 10.
I use an A10-7850K with 8gb of RAM. Other than this im enjoying a lot learning how to get the most out of Ubuntu, so if you can give me some ideas about how to try to fix this issue that would be great! Thank you for your time and have a good day!
Comment: We'll need to know what video driver you're using, what CPU type and speed, how much system RAM, whether the games are Linux native or you're running under Wine -- and probably some other information.
Comment: Thanks for replying! The driver im using is the default ones that comes with the system, i didnt installed anything else. The CPU im using is the A10-7850K 3.7Ghz with the Integrated AMD Radeon R7 Series Graphics, without overclock.  I use 2x4 GB of 2133 Ram. And the game are runing natively by the Steam Client.
Comment: So there's your big difference when comparing with Windows running in the same machine: AMD drivers. The default driver is from the community (open source), it does the job acceptably in most cases but the performance can be the same, at best, and often noticeably worse. Then there's DirectX (Windows only). Games designed around it (and for Windows) always perform better with it. When ported to OpenGL they don't perform as good as with DirectX.
Comment: All current AMD APUs are also supported by `amdgpu-pro`, the new proprietary driver.
Comment: Thanks for replying! And Nvidia do better on the drivers? I will have to upgrade my machine soon, so if Nvidia performs better on Ubuntu i will give it a try. I will try the proprietary drivers and see if they perform better, thanks for the info!
Answer: AMD had decided to use AMDGPU-Pro drivers now (fglrx is done). From the official AMD site:
Do a system update:

sudo apt update
sudo apt dist-upgrade
sudo reboot

Once you reboot, now check if you have the 'latest' AMDGPU-Pro driver installed:

dpkg -l amdgpu-pro

It could be that you already have the AMDGPU-Pro driver installed. If it says no packages found, then it's not installed. Then go to the site I linked and follow the instructions to install the latest AMDGPU-Pro package as described there.
There might also be an issue with your CPU downclocking to save energy. That can at times have a performance degrading effect.
Comment: `amdgpu` and `amdgpu-pro` are two different drivers. The former is the default (and open source) for current chips (`radeon` for legacy); `amdgpu-pro` (proprietary) has to be downloaded from AMD and installed.

Low gaming performarnce


In what languages/platforms is Invoke for GUI operations required?

Question: I understand that in .NET, one needs to use Control.Invoke(delegate) to perform operations on a control. This lead me to wondering in which environments Invoke is actually required. As far as i know, it was not required in older versions of, say, Visual Basic and Pascal. In particular, what is the status of Java (possibly version-dependent?) and "old style" windows GUI programming (manually reading the message queue)?
Answer: You are mistaken.  Control.Invoke is not required to perform operations on a control.
Control.Invoke is a useful tool to help marshall code across thread boundaries, but it is not the only way to do it.  You will see this used most often when you do some work in a background thread.
When you call code from a background thread that must update a Windowed control (that is, a control that has a Windows window handle and processes messages via message pump), change it's properties, or some other manipulation of the control then you must pass control to the MessagePump thread, and Control.Invoke is a useful way to acocmplish that.
In ALL programs that run under Windows, you cannot call functions that update controls on a background thread.  Some languages may handle this detail in the background, but I don't know of any that do.
Answer: In most languages Invoke for GUI operations is necessary. In Java there is SwingUtilities.invokeLater. Actually a method like that would be necessary in any environment if more than one threads are used. The reason is that the main UI thread runs an event notification mechanism. A second thread to be able to interact with this mechanism needs somehow to be synchronized with it.
These invoke methods are actually a convenience for the developer. In platforms that do not exist, it doesn't mean that is allowed to access UI items from a different thread. It may just means that the developer should implement a custom mechanism (sending events) to do so. UI code is very rarely thread safe. I have worked with many platforms and technologies and I am always following this rule: touch the UI from a single thread only.
Answer: Invoke is just a wrapper around the Win32 API PostMessage.  Only the thread that owns a window is allowed to access the window.  This is legacy going all the way back to when Windows was single threaded.  That means that PostMessage is the correct way to access a true window on Windows no matter what you are using (VB6, Delphi, .NET, or whatever), but the different programming languages provide wrappers to make life easier for us.
Answer: Actually, NO. It's only needed if you're GUI is running more than 1 thread. With WinForm (and WPF) applications the GUI is running on a single threaded STA thread (this dates back to COM and don't ask me why it's like that, because I don't honestly know).
If you try to call objects created on the STA thread from a different thread, there are checks in place to make sure an exception is thrown. This same goes with WPF although, WPF makes this a lot more elegant.
Anyway, you can actually check when Invoke is required because there's a property for that. This pattern has been suggested to help with handling several threads in WinForm applications.
<code>public void MyTextSetMethod(string text)
{
    if(control.InvokeRequired)
    {
        control.Invoke(new Action<string>(MyTextSetMethod), text);
    }
    else
    {
        control.Text = text;
    }
}
</code>
The above code provides a all around method for setting the Text property, you can tailor this to suit your needs.
Comment: This has nothing to do with STAthread or not.  It's true, STAthread is related to COM, but only for interop purposes.  Windows requires that updates to a control happen on the same thread as the thread that created it, STA or MTA, doesn't matter.


A minor confusion in digitalWrite command

Question: Will the Arduino IDE interpret digitalWrite(13,x), where x>0, as digitalWrite(13,HIGH)?
And will it interpret digitalWrite(13,x), where x<=0, as digitalWrite(13,LOW)?
Comment: 0 is low, everything else is HIGH
Comment: but some joker could make an arduino core where LOW is defined as 2. the AVR code for digitalWrite and digitalRead would work. it doesn't assume that LOW is 0. so your code shouldn't do that either. (but in my sketches I often assume that LOW is 0).
Comment: the esp8266 core digitalRead and digitalWrite functions ignore LOW and HIGH  and use `if (val)` and return the state of the register bit
Answer: Every other value than 0 or LOW will result in setting the pin to HIGH. In the following I explain why:
The function digitalWrite() can be seen in the file hardware/arduino/avr/cores/arduino/wiring_digital.c. The important lines here are:
if (val == LOW) {
    *out &= ~bit;
} else {
    *out |= bit;
}

As you can see, it checks, if the given value (from the parameter) is equal to LOW and if so will set the corresponding pin to 0. In every other case it will set the pin to 1. The definition of LOW can be found in arduino/hardware/arduino/avr/cores/arduino/Arduino.h:
#define HIGH 0x1
#define LOW  0x0

So the code checks, if the value is equal to 0 and sets the pin also to 0. Every other value will result in a 1 (meaning HIGH). Also have a look at the definition of digitalWrite():
void digitalWrite(uint8_t pin, uint8_t val)

The value is an unsigned type, so every signed type will be casted to an unsigned type. A negative number would result in a positive number inside the function.
Comment: Just nitpicking: Also `False` and anything other, which evaluates as 0, works here :) (And it is common to use boolean variables/expression as the val)


Disable user_node_load

Question: Is there a way to disable user_node_load on non-admin pages without hacking core modules? My theme doesn't use user data so this function results in needless database queries.
Answer: Disclamer
I am using a hook in a way that is different from the usage that is documented on Drupal.org API. See the notes at the end of the question.
You could achieve what you want by implementing two hooks:

hook_module_implements_alter()
function mymodule_module_implements_alter(&$implementations, $hook) {
  if ($hook == 'node_load') {
    unset($implementations['user']);

    // Put mymodule_node_load() to the beginning of the list.
    $group = $implementations['mymodule'];
    unset($implementations['mymodule']);
    $implementations = array('mymodule' => $group) + $implementations;
  }
}

hook_node_load()
function mymodule_node_load($nodes, $types) {
  if (path_is_admin($_GET['q'])) {
    $uids = array();
    foreach ($nodes as $nid => $node) {
      $uids[$nid] = $node->uid;
    }

    $user_fields = db_query("SELECT uid, name, picture, data FROM {users} WHERE uid IN (:uids)", array(':uids' => $uids))->fetchAllAssoc('uid');

    // Add these values back into the node objects.
    foreach ($uids as $nid => $uid) {
      $nodes[$nid]->name = $user_fields[$uid]->name;
      $nodes[$nid]->picture = $user_fields[$uid]->picture;
      $nodes[$nid]->data = $user_fields[$uid]->data;
    }
  }
}

The code I used for hook_module_implements_alter() is different from the example code shown in the documentation, which just alters the order in which different implementations of the same hook are invoked.
function hook_module_implements_alter(&$implementations, $hook) {
  if ($hook == 'rdf_mapping') {
    // Move my_module_rdf_mapping() to the end of the list. module_implements()
    // iterates through $implementations with a foreach loop which PHP iterates
    // in the order that the items were added, so to move an item to the end of
    // the array, we remove it and then add it.
    $group = $implementations['my_module'];
    unset($implementations['my_module']);
    $implementations['my_module'] = $group;
  }
}

In general, it is not a good idea to avoid a hook implemented from another module is invoked. Modules that change their behavior because a hook implemented from another module is invoked normally use module_exists(), rather than module_implements(), which means those modules normally make the assumption that the module being enabled is sufficient for that specific hook to be invoked.
Generally speaking, there could be modules that depend from the data injected from the hook you are trying to block. It is not said that avoiding user_node_load() executes its SQL queries would avoid another module executes its own SQL queries with a decrement of performance even worse.
If you are sure that none of conditions I described are verified, you could implement the code I shown, at your own risk. Be prepared to verify there aren't any unwanted consequences, and check what the code used by the modules you use in the site is doing.
Answer: I think you're out of luck here (I'd love to be proven wrong though).
You can stop the hook from running with hook_module_implements_alter(), but the only way I can think of making that happen only on non-admin pages would incur quite a performance hit.
The return from that hook is cached so you'd pretty much have to flush the caches on every page to make that method work (so the cache could be regenerated and your implementation of the hook could check the current path).
Either way a code example for this would be something like:
function MYMODULE_module_implements_alter(&$implementations, $hook) {
  if ($hook == 'node_load') {
    unset($implementations['user']);
  }
}

You'd need to add your condition in there, but that's the basic code. The proof that this works is in the following error message that appears on all node pages, as my theme has a requirement for the data added by user_node_load():

Commenting out the unset() line and clearing the caches removes the error message, confirming the function's success.
There are some awful methods I can think of involving subclassing the NodeController class and overriding its attachLoad() method to become path aware...but you really don't want to go down that path.

Disable user_node_load


How Can Create Line Renderer Runtime When Player in Gravity

Question: I want to Create functionality Like Rock Runner Game.when player into the gravity and hold the button then generate line and player hold the line and move forward. After So many Research i couldn't find anything in google and also in YouTube then i post the question. I put some snippets to very well understand what i want actually. if any one have idea how to do this then tell me. thanks in advance

Answer: Watching a video of the game this looks like a simple straight line between the player and the object of the ceiling.
For that you can use a Line Renderer component
When holding the finger pressed and the player is within the range of the "ceiling object" you just

create an empty game object
add a line renderer component
and add some script like

[RequireComponent(typeof(LineRenderer))]
public class LineController : MonoBehaviour {

    public GameObject startObject;  //e.g. the player
    public GameObject endObject;    //e.g. the object on the ceiling

    private LineRenderer lineRenderer;

    void Start () {
        lineRenderer = GetComponent(); //stackoverflow cut out the generic part ;-)
    }

    void Update () {
        lineRenderer.SetPosition(0, startObject.transform.position);
        lineRenderer.SetPosition(1, endObject.transform.position);
    }
}

The rest should be configuration of the line renderer component to match the look of the line as you want it. And if the player releases his finger delete the line game object.
Comment: first thanks for very useful ans..i do this.. and successfully create line between player to "ceiling object" using Line Renderer component find the distance between player to "ceiling object" using Vector3.distance.
Comment: but i want when the player holding the finger Press then player hold the Edge of Line Renderer can't fall into the ground .. how can i do any idea.??
Comment: Oh. In the game showen above the player can tap/press anywhere on the screen. Do I understand it right you want to limit the "touchable screen space" to the end of the line? Since the player character is at the end of the line it would mean you could make the character clickable/pressable and check if the player clicks/presses the character.
Comment: If you mean the flying behaviour (for not falling into the ground) you would add some force while the player presses (if you use physics). Like in this question (http://stackoverflow.com/questions/24266065/accelerated-addforce-for-rigidbody)
Answer: I found the solution to Create Line when player in Gravity.
When holding the finger pressed and the player is within the range of the "ceiling object" i Create a LineRenderer , create One Empty Object Child of "celling object" and attached linerenderer to Empty Object.&
For Calculate the Distance using Vector3.distance
public GameObject StarObj,EndObj;
private LineRenderer lineRenderer;
private HingeJoint2D hingJoint;

// Use this for initialization
void Start () {

    lineRenderer = GetComponent<LineRenderer> ();
    hingJoint = GetComponent<HingeJoint2D> ();
}

// Update is called once per frame
void Update () {

    if (Vector3.Distance (transform.position, StarObj.transform.position) <= 8f) {
        lineRenderer.enabled = true;
        lineRenderer.SetPosition (0, StarObj.transform.position);
        lineRenderer.SetPosition (1, EndObj.transform.position);

        if (DemoLongPress.instance.jointTrue) {
            hingJoint = EndObj.GetComponent<HingeJoint2D> ();
            hingJoint.connectedBody = StarObj.GetComponent<Rigidbody2D> ();
            hingJoint.connectedAnchor = new Vector2 (0, 1f);
            hingJoint.anchor.Set (0, 1);
        }

    } else {
        lineRenderer.enabled = false;
    }
}

When Player Hold the finger Player Can Stick to the LineRenderer using HingJoint2D
When player enter to the distance to create line between player to "ceiling object" and when player hold the finger then joint is connected between player to "ceiling object" and player stick to the line. And if the player releases his finger delete the line game object.
if any correction or mistake then tell me i correct it...The rest should be configuration of the line renderer component to match the look of the line as you want it. Thanks


Why do I need to have exact same code to load contract from address in Remix IDE?

Question: I tried to interact with the deployed contract and i don't have its code. so i found out the contract address and tried to load contract from address in Remix IDE! isn't this possible? WHY?
Answer: You will need the contract ABI (at least) to load it from an address. Remix (or any other client) should know HOW to interact with the contract at that address: function names, parameters format and return values
Answer: Remix IDE is a programmer tool. Its primary purpose is to help you code, test and debug your smart contracts.

I tried to interact with the deployed contract and i don't have its code.

In this case you are not a developer but a layman user. A non-expert user does not use Remix to transact/interact with the smart contract. You are bound to use the UI or API your dapp developer provided to you. So, since Remix does not the know what functions or api your smart contract has, having its address only will not help you to interact with it. You need to know its ABI as well.
Application Binary Interface provides you the public function interface. Get the contract ABI. Construct a simple contract interface based on its ABI with the public function declarations only and you will be ready to interact with the contract from Remix.
For example, following is ABI from an unknown contract :
[
{
    "constant": true,
    "inputs": [
        {
            "name": "a",
            "type": "string"
        }
    ],
    "name": "check",
    "outputs": [
        {
            "name": "",
            "type": "string"
        }
    ],
    "payable": false,
    "stateMutability": "pure",
    "type": "function"
}
]

Contract interface constructed from the abi :
contract Test {
  function check(string a) public pure returns(string);
}

Now, load the contract Test with the actual address and interact with the contract.
Answer: As far as I know, there are 3 options:

Have an interface that declares the functions you want to access to.
Have the exact source code.
Have the abi in json format.

All of these options expose the structure of the functions you want to interact with.


Raspbian and Logitech K400 on PI4B

Question: It a fresh install of raspbian (10 buster) on a Raspberry PI4B. I use a Logitech K400. the keyboard and mouse are discovered at boot. But the touchpad does not go to the right end of the screen, it stops about 5 centimeters!
I cannot use some control! I have created /etc/modprobe.d/hid_logitech_hidpp.conf with options hid_logitech_hidpp disable_raw_mode=1 ...no idea more,  help please!
Answer: I know it's late but my Logitech K400r worked on a fresh install
after I turned on the keyboard and installed fresh batteries Duh
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).

Raspbian and Logitech K400 on PI4B


How to draw a curved arrow in Keynote 09?

Question: I don't find how to draw a curved arrow in a Keynote'09 presentation... I'm sure is really before my eyes but .....
Answer: Create the Arrow

From the Insert Shape menu choose the "Draw with Pen" tool:

Click once at one end of your curved arrow:

Click and drag at the other end of your arrow:

Hit the Escape key to stop drawing.
From the line ends menu, choose an arrowhead you like:

Edit the Arrow

To reshape the curve, click on it once, then click on it again;
When the endpoints turn red you can change things:

Click and drag the round circles at the end of the gray Bezier
handles to reshape the curve (a little practice makes perfect):

Click and drag one of the red endpoints to change the start or end:
Comment: Do you know how to reset curve handles on a point? It's very common for me to have a point with handles that cannot be dragged anymore.
Answer: Maybe you should look at this Thread. They speak about Keynote 4, but I think you can do that in Keynote '09 as well.


LoadLibrary fails: First chance exception 0xC0000139 (DLL Not Found) - How to debug?

Question: I have a dll "mytest.dll" that when loaded via LoadLibrary(), returns NULL (and 127 as the GetLastError()).  If I use DependencyWalker on "mytest.dll", it reports that it should load correctly and that all DLLs are found correctly.  Running the profiler option of DependencyWalker on the host exe gives me this relevant section in the log:

00:00:55.099: Loaded "mytest.DLL" at address 0x07860000 by thread 0xBBC.  Successfully hooked module.
00:00:55.115: First chance exception 0xC0000139 (DLL Not Found) occurred in "NTDLL.DLL" at address 0x76E24285 by thread 0xBBC.
00:00:55.115: Unloaded "mytest.DLL" at address 0x07860000 by thread 0xBBC.
00:00:55.115: LoadLibraryW("mytest.dll") returned NULL by thread 0xBBC. Error: The specified procedure could not be found (127).

Is there a way to debug this to find out what the DLL Not Found message that NTDLL.DLL reports is trying to look for?  Or should I be looking elsewhere for the source of the problem?
Note that loading this same "mytest.DLL" from another application seems to work correctly.
Comment: Did any of our answers help solve this?
Answer: Using Process Monitor or FileMon from SysInternals might give you a clue as to whether myTest.dll is simply not where it's being looked for.
Answer: Could your application be trying to call a specific DLL function via GetProcAddress after the initial load (perhaps) which is not found?  Is it a 32 or 64 bit application?
If it is loading correctly in another application as you suggest, then it probably has a correct entry point.
A quick google search suggests that the error code you are getting back is likely from a missing function name (or specific function's ordinal value) in the DLL.  I'd suggest opening the DLL in something like Exescope and inspect the exports list.
It might also explain why the DLL works with another application (perhaps the other application uses different exported functions in the DLL)?
Comment: Exescope was quite helpful in figuring this out.  Turns out the other application (and its DLL) were compiled with a different compiler and therefore different naming conventions.  The "DLL Not Found" message apparently was bogus.
Answer: DependencyWalker shows implicit dependencies (dependencies that are automatically handled by the Windows loader).  DLLs you load with LoadLibrary are explicit dependencies and DependencyWalker has no way to find them (for example, the library names might be read from an ini file, and there's no way that DependencyWalker could infer this).
It's not at all unusual for a DLL to work in one app and not in another.  In the most common scenario, one application already has a required dll loaded and the other does not.  If the dll is not on the path, your dll will work in the first case and not in the second.
Anyway, go with Michael Burr's suggestion and use FileMon.  Even though the SysInternals web site says that FileMon is outdated, it's still a lot easier to use than ProcMon.


An upper bound for $1+\sum_{k=1}^\infty (\frac{a}{k})^k$, better than $\exp(a)$

Question: For $a>0$ is the result of $1+\sum_{k=1}^\infty (\frac{a}{k})^k$ known, or can it be upper-bounded? There is an obvious upper bound of $exp(a)$ resulting from $k^k\ge k!$ and hence:
$$1+\sum_{k=1}^\infty (\frac{a}{k})^k \le \sum_{k=0}^\infty \frac{a^k}{k!} = \exp(a) $$
But can this bound be made tighter?
Comment: Given that $k^k \geq c_{\lambda}k!\lambda^k$ for all $\lambda < e$, you have $\sum_{k \geq 0}{(\frac{a}{k})^k} \leq c_{\lambda}^{-1}\exp{\frac{a}{\lambda}}$. However, since $k^k =o(e^kk!)$, $e^{a/e}$ is negligible for large $a$ wrt your series.
Answer: This bound derives from asymptotic analysis and works best for large $a,$ although it works for any $a \ge 0.$  For convenience, I'm dropping the +1.  I'll show
$$g(a):=\sum_{k=1}^\infty \big(\frac{a}{k}\big)^k < \sqrt{2 \pi x} \exp(x) \text{ where } x=a/e.$$
From Stirling's formula for the factorial,
$$ \frac{k!}{k^k} = e^{-k}\sqrt{2 \pi k} \ \Big(1+\frac{1}{12k} + \frac{1}{288k^2} - ...\Big)$$
The important thing is that the terms eventually get negative signs, so if we want a bound, we can't go any further than the ones shown.  Now it's an asymptotic series, so for small $k,$ we don't expect it to be terribly accurate.  However, numerically it can be seen that
$$ k^{-k} \le \sqrt{2 \pi k} \  \frac{ e^{-k} }{k!}\Big(1 + \frac{1}{11.84k} \Big) \text{ where } k=1, 2,...$$
Thus
$$g(a) < \sqrt{2 \pi} \sum_{k=1}^\infty  \frac{x^k}{k!}\sqrt{k} \Big(1+ \frac{1}{11.84k} \Big)\quad,\quad x=a/e. $$
It can be shown (MSE 3309513) that
$$ \sum_{k=1}^\infty \frac{x^k}{k!} k^\epsilon \sim x^\epsilon e^x\Big(1 - \frac{\epsilon(1-\epsilon)}{2x}+...\Big) $$
Use $\epsilon=1/2$, and collect the terms properly to get
$$g(a) < \sqrt{2 \pi x}e^x\Big( \big(1 - \frac{1}{8x} \big) + \frac{1}{11.84 x} \Big) .$$
The coefficient before the 1/x term is -0.0405, the important thing being it is negative.  Dropping the 1/x term means the inequality will still be satisfied.
I've checked this for all $a<100,$ and of course the large $a$ case reverts to asymptotics, of which this is the first term.  For $a$ as small as 14, the error between 'truth' and the bound is about 1%. For numerical checking, $g(14)=971.09$ and the approximation $\tilde{g}(14)=981.203.$
Answer: Define $$f(a)=1+\sum_{k=1}^{\infty}\left({a\over k}\right)^k$$therefore $$f'(a){=\sum_{k=1}^{\infty}{ka^{k-1}\over k^k}\\=\sum_{k=1}^{\infty}{ka^{k-1}\over k^k}\\=\sum_{k=1}^{\infty}{a^{k-1}\over k^{k-1}}\\=\sum_{k=0}^{\infty}{a^{k}\over (k+1)^{k}}\\=1+\sum_{k=1}^{\infty}{a^{k}\over k^{k}}({k\over k+1})^k}$$Since the sequence $(1+{1\over k})^k$ is strictly increasing, then $({k\over k+1})^k$ becomes strictly decreasing and $\le {1\over 2}$ (which can be visually checked in https://www.desmos.com/calculator). Hence $$f'(a)\le 1+{1\over 2}\exp(a)$$and by integrating we obtain $$f(a)\le{1\over 2}+a+{1\over 2}\exp(a)$$or

$$1+\sum_{k=1}^{\infty}\left({a\over k}\right)^k\le {1\over 2}+a+{1\over 2}\exp(a)$$
Answer: First, let us obtain the integral representation of the series.
Note that
$$
\frac{1}{k^k} = \frac{1}{(k-1)!}\int_0^\infty e^{-kx}x^{k-1}dx, \quad k\in \mathbb{N}_{\ge 1}.$$
We have
\begin{align}
1 + \sum_{k=1}^\infty \left(\frac{a}{k}\right)^k &= 1 + \sum_{k=1}^\infty a^k \frac{1}{(k-1)!}\int_0^\infty e^{-kx}x^{k-1}dx\\
&= 1 + \int_0^\infty ae^{-x} \sum_{k=1}^\infty \frac{(ae^{-x}x)^{k-1}}{(k-1)!} dx\\
&= 1 + \int_0^\infty ae^{-x} e^{ae^{-x}x} dx\\
&= 1 + \int_0^1 ay^{-ay} dy\\
&= 1 + \int_0^1 ae^{-ay\ln y} dy.
\end{align}
Note that $-y\ln y \le \frac{1}{e} - \frac{5}{2e}(y- \frac{1}{e})^2$ for $0 < y < 1$.
An upper bound is given by
\begin{align}
1 + \int_0^1 ae^{-ay\ln y} dy
&\le 1 + e^{a/e}a\int_0^1 e^{-a\frac{5}{2e}(y- \frac{1}{e})^2} dy\\
&= 1 + e^{a/e}a \frac{\sqrt{\pi}}{2\sqrt{q}}
\Big[\mathrm{erf}(\sqrt{q}\, e^{-1}) - \mathrm{erf}(-\sqrt{q} + \sqrt{q}\, e^{-1})\Big]\qquad (1)
\end{align}
where $q = \frac{5a}{2e}$. The following figure shows the upper bound (1) and the upper bound $1+\sqrt{2\pi a/e}e^{a/e}$ derived by skbmoore.
It can be seen that when $a$ is small, the upper bound (1) is better than $1+\sqrt{2\pi a/e}e^{a/e}$.
However, when $a > 4.5$, the upper bound (1) is worse.

I think that we can obtain better (or simpler) upper bounds by analyzing $1 + \int_0^1 ae^{-ay\ln y} dy$.


Dev Environment Facebook Graph API

Question: I have doubts about how could I create objects, actions and aggregation and test it on development environment. Since facebook needs to scrap my webpage to get the object when i register an action. How could I configure my dev environment?
Answer: I've had my network guys poke a hole in the firewall to my dev server and have updated  DNS point my development subdomain (ie dev.domain.tld).

Dev Environment Facebook Graph API


Why is InDesign creating strange patterns in several viewers?

Question: When creating pdfs with InDesign CS6 my target pdfs show sometimes strange patterns in the pdf. These patterns are sometimes black horizontal lines straight over the whole page, sometimes a square around a graphic I included, or some others. I experienced these patterns only on A4-pages which are completely filled up with one colour and a semi-transparent image (meaning only a part of the square-sized image is transparent) copied over it afterwards.
My problem is that I have problems with reproducing it. These patterns only show up when (in my current case) I am viewing the resulting pdf in Foxit PDF Reader at a specific size. When I zoom in, they are gone. When watching the pdf with the integrated Windows pdf reader, I can not see any lines regardless of the zoom level. Same goes for the integrated reader in Ubuntu. In InDesign I can not see these lines either. According to a friend he can see the lines when watching the pdf with the Adobe Reader.
Where do these lines come from? And how can I remove them? Or is it a simple bug of the viewers (Adobe InDesign -> Adobe Reader: Bug? Seriously?)?
Comment: They are rendering artifacts in the PDF viewer, it happens to software renderers form time to time. I mean even Photoshop is not immune to this (Photoshop has several known rendering bugs, as does Reader). Not much you can do except report bug. You can not really avoid quantization problems.
Answer: These lines come about because of flattened transparency effects in the PDF and the method used by the PDF reader to render them on a low-resolution device like a monitor. "Transparency" includes any kind of glow or shadow effect, any blend mode other than Normal and any opacity other than 100%.
Any legacy PDF format based on Postscript, such as PDF/X-1a, requires InDesign to flatten transparency, because there the Postscript language doesn't recognize it. PDF versions earlier than 1.5 are based on Postscript, so will require transparency to be flattened.
What happens under the hood is that parts of the page are rasterized at a very high resolution, and what you see as weird white lines are the result of your PDF reader trying to anti-alias the edges of these rasterized regions -- the "seams" where they meet -- to cope with the very low resolution of the screen. "Low resolution," where PDF is concerned, very much includes so-called "High DPI" and "Retina" displays. (You can see these blocks if you open the PDF in Illustrator. When you try to select things with the Direct Selection tool you'll see these image blocks that don't seem to have any relationship to the objects in your original layout.)
Because the anti-aliasing is based on the resolution of your monitor, the ghost lines show up or disappear at different zoom levels depending on whether the "seams" fall on a (screen) pixel boundary or not. You'll note that they never get thicker, no matter how far you zoom in, because their size is a function of your monitor, not of the content of the PDF.
Because a PDF goes through a much higher-resolution raster image processor when going to press, these lines don't appear in print. You can also turn them off by changing the view settings in some PDF readers.
If your PDF will mostly be seen on screen, and printed, if at all, only to desktop printers, you can export as an Interactive PDF, which is designed for screen rendering. You could also choose "High Quality Print" or just change the PDF version in the export dialog to 1.5 or later in the Print PDF settings. In any of these cases, the PDF will contain "live" transparency, no flattening will occur, and you won't see the hairlines when you view them.
Answer: Those kind of artifacts can appear depending of the version of your PDF export. I already had the problem :
- Recent version of PDF (PDF1.4+) display fine on screen but squares around transparent background images when you print it.
- Older version display little white lines around elements of the page on screen but they are invisible on print.
My advice would be to try different exports with different versions so you can find the best compromised according to your project.


Welcome emails being blocked by receivers email clients

Question: Our site is hosted by a company on a remote server. Our welcome emails used to be received fine, but as we've grown many customers are complaining about never seeing their emails. Some end up in junk/spam folders, which isn't ideal but is fine since it still gets through. But some email domains, such as comcast.net, aren't evening letting them hit the inbox. Is there anything I can do about this? Or do I need to contact our server host? Is there somewhere else I should ask about this?
Answer: You should start by contacting your hosting provider. It is possible that you IP address has been out on a blacklist and Comcast blocks them. It is also possible that your reverse DNS lookup is incorrect and Comcast is rejecting the emails for that reason. The fact that they once worked and now don't point to the conclusion that your IP address and been registered on a blacklist site.
If you are on a shared host it is possible that another site on the same server caused the issue. In the end your hosting provider will have to help solve the issue.
Comment: You beat me to the answer.. My ADD kicked in and I was in another window :)
Answer: We frequently run into this problem and have no end of issues with generic PHP mail. We have taken to offloading all mail to a dedicated service (like google apps), creating appropriate DNS/MX record modifications and then sending all mail via SMTP using something like
http://www.magentocommerce.com/magento-connect/smtp-pro-email-free-custom-smtp-email.html
MXtoolbox is a great service for checking if you domain/IP has fallen afoul of any blacklists.
Comment: The given url is not exist now
Answer: This is outside the scope of the Magento forum, however a starting point would be:

Ensure your sending email server has a reverse DNS entry
Check to make sure your email server and/or IP are not on any spam / block lists
Implement SPF (Sender Policy Framework)


How to test if sum of two coefficients of ols model is greater than zero using R?

Question: The regression model is:
y = b0 +b1x1 + b2x2 + b3x3 + e

I want to test if b1 + b2 > 0.
the R package car has a function linearHypothesis that can test if b1 + b2 = 0 by
linearHypothesis(lm_model, "b1 + b2 = 0")

but this is a two-sided test. I want a one-sided test.
linearHypothesis(lm_model,"b1 + b2 > 0") can't work, it seems that linearHypothesis can only do two-sided test. Are there some R packages can do this one-sided test?
Answer: Doubtless there are packages to do it, but you could also try using the bootstrap, which will work for nearly arbitrary contrasts. Here's a simple implementation that gets a bootstrap sampling distribution for b2 + b1, from which the p value can be computed by asking what proportion of estimates are positive. To change the statistic(s) you're interested just change the second line of the stat function and rerun.
We'll first set up some fake data
set.seed(1234)

d <- data.frame(X1 = rnorm(500), X2 = rnorm(500), X3 = rnorm(500))
d$Y <- 1 + d$X1 * -1 + d$X2 * 0.9 + d$X3*0.2 + rnorm(500)

noting that the 'true' population value is -0.1.
Now fit a regular (correctly specified, in this case) model and get a point estimate for b2 + b1.
mod0 <- lm(Y ~ X1 + X2 + X3, data = d)
cfs <- coef(mod0)
cfs['X2'] + cfs['X1'] # About -0.072

That's the statistic we're interested in getting a sampling distribution and thereby a p-value for, so we wrap up this process in a function:
stat <- function(dat, inds){
  cfs <- coef(lm(Y ~ X1 + X2 + X3, data = dat[inds,]))
  cfs['X2'] + cfs['X1'] # return the statistic in this sample
}

where inds are the indices of rows in dat in a single bootstrap sample. The
boot function will provide those, so we just have to be sure to use them
in the call to lm.
Now to get a lot of bootstrap samples of b2 + b1:
library(boot)

cores <- parallel::detectCores() # because we are impatient
res <- boot(d, stat, R = 10000, parallel = "multicore", ncpus = cores)

(If the parallelization has problems then just remove the parallel and ncpus arguments to boot and be prepared to wait a bit longer). For more
precision, increase R, the number of (re)samples.
Anyway, here's the whole bootstrap sampling distribution
hist(res$t, breaks = 100, xlab = "Estimated b2 + b1",
     main = "Bootstrap Sampling Distribution of b2 + b1")

Now we might ask how often b2 + b1 is greater than 0 (a.k.a. the bootstrap one-sided p-value)
sum(as.numeric(res$t > 0)) / length(res$t) # about 15% of the time

Alternatively, we might ask whether 0 is outside the lower 95% of estimates
quantile(as.numeric(res$t), prob = 0.95) # about .038 which is greater than 0 obvs.

or we could just use the the bootstrap samples to get a standard error and do things more parametrically, but in any case it looks like we should 'fail to reject' that b2 + b1 > 0.
This answer has been a bit fast and loose on the inferential side of things, e.g. glossing over some bootstrap decisions, with the aim of getting the machinery in place. Hereafter, and as noted above, you can just keep adjusting stat to get bootstrap sampling distributions for increasingly weird and wonderful quantities. Though if you do that you might want to read up on the limits, assumptions, and strategies of bootstrapping.
Comment: thank you for your help! I think this command may give us better understanding of why we can't reject b1 + b2>0. `quantile(as.numeric(res$t), prob = c(0.025,0.975)) `, the result is (-0.20138144  0.05926924)。 since 0 is between this 95% quantile (confidence interval?), so we can't reject the hypothesis under  the significance level of 5%.
Comment: Sure, I guess. I did it that way because you asked for a one-sided test, and that interval corresponds to a two-sided test. fwiw the last computed quantity is the upper value of a one-sided interval (with lower value $-\infty$, naturally).
Answer: You could bootstrap this. Example:
fit <- lm(Sepal.Length ~ Petal.Length + Petal.Width, data = iris)

sum(coef(fit)[c("Petal.Length", "Petal.Width")])

library(boot)
bootfun <- function(DF, ind, origfit) {
  #bootstrap residuals:
  DF$Sepal.Length <- fitted(origfit) + residuals(origfit)[ind]

  fit <- lm(Sepal.Length ~ Petal.Length + Petal.Width, data = DF)

  sum(coef(fit)[c("Petal.Length", "Petal.Width")])
}

set.seed(42)
myboot <- boot(iris, bootfun, 9999, origfit = fit)

mean(myboot$t <= 0)
#[1] 0.00970097
#--> reject H0: alpha_1 + alpha_2 <= 0

Comment: Ooh, beat me too it ;-)
Answer: Using multcomp
The multcomp package offers the capability of testing linear equalities or inequalities of coefficients. Here, I'll use the same data generated by @conjugateprior to illustrate the package:
library(multcomp)

# Generate data and fit model
set.seed(1234)

d <- data.frame(X1 = rnorm(500), X2 = rnorm(500), X3 = rnorm(500))
d$Y <- 1 + d$X1 * -1 + d$X2 * 0.9 + d$X3*0.2 + rnorm(500)

mod0 <- lm(Y ~ X1 + X2 + X3, data = d)

# Specify the linear hypothesis
glht_mod <- glht(
  model = mod0
  , linfct = c("X1 + X2 >= 0")
)

# Inspect summary and confidence interval
summary(glht_mod)
confint(glht_mod)

Which produces the following output (truncated).
Linear Hypotheses:
             Estimate Std. Error t value Pr(<t)
X1 + X2 >= 0 -0.07211    0.06284  -1.148  0.126

Linear Hypotheses:
             Estimate lwr      upr
X1 + X2 >= 0 -0.07211     -Inf  0.0314

We see that the p-value for the null hypothesis that $\beta_{X1} + \beta_{X2} \geq 0$ is $0.126$. So the test provides little evidence against the null hypothesis.
The one-sided 95%-confidence interval is $(-\infty, 0.0314]$ so the data is compatible at the 95%-level that the sum of the two coefficients is up to $0.03144$. The upper limit is larger than $0$ so the data indicate that $0$ is among the plausible values for the sum. This confidence limits is in good agreement with the confidence interval obtained by @conjugateprior using the bootstrap.
Using restriktor
The restriktor package allows you to fit linear equality or inequality restrictions about parameters and effects. The packages has its own website with a tutorial and other explanations. Again, using the same data as above:
library(restriktor)

# Generate data
set.seed(1234)

d <- data.frame(X1 = rnorm(500), X2 = rnorm(500), X3 = rnorm(500))
d$Y <- 1 + d$X1 * -1 + d$X2 * 0.9 + d$X3*0.2 + rnorm(500)

# Fit the model
mod0 <- lm(Y ~ X1 + X2 + X3, data = d)

Now we'll have to specify the constraints, which we can do easily using text-based description (important: the constraint syntax has to be enclosed within single quotes). Then, refit the model using the restriktor function:
myconstr <- '(X1 + X2) > 0'

constr_mod <- restriktor(
  object = mod0
  , constraints = myconstr
)

To test the hypothesis, let's use the iht function:
iht(constr_mod)

This generates the following output (truncated):
Overview of all available hypothesis tests:

Global test: H0: all parameters are restricted to be equal (==)
         vs. HA: at least one inequality restriction is strictly true (>)
       Test statistic: 818.0010,   p-value: <0.0001

Type A test: H0: all restrictions are equalities (==)
         vs. HA: at least one inequality restriction is strictly true (>)
       Test statistic: 0.0000,   p-value: 1

Type B test: H0: all restrictions hold in the population
         vs. HA: at least one restriction is violated
       Test statistic: 1.3169,   p-value: 0.1259

Type C test: H0: at least one restriction is false or active (==)
         vs. HA: all restrictions are strictly true (>)
       Test statistic: -1.1475,   p-value: 0.8741

The relevant hypothesis in your case is B, which features a p-value of $0.1259$ and thus offers little evidence against the null hypothesis that $\beta_{X1} + \beta_{X2} > 0$.
The package offers several different methods to calculate the standard errors of the coefficients, including the bootstrap or heteroscedasticity-consistent standard errors.
Comment: Thank you for your detailed explanation. I've tried to run linear hypotheses with the package "multcomp". Unfortunately, it seems that there is no library(multcomp) for the install.packages("multcomp"). Which package should I install?
Comment: Have you successfully installed the package using `install.packages("multcomp")`? After installation, you can load it with `library(multcomp)`.
Comment: Yes, I have done it before. I've restarted R and it is now working. Strange. No idea why. Thanks anyway!


Can I use jQuery Mobile if I am developing a native app?

Question: I am new to jQuery and mobile apps development. I know the features of jQuery Mobile. I want to know where and why to use it. Can I use jQuery Mobile if I am developing a native app?
Answer: To really give an exact answer to your question: Yes.
Although JQueryMobile is meant for web applications (as pointed out by Yannis Rizos), you can use Phonegap to create native applications with JQuerymobile.
What Phonegap does, is create a native app with a webkit browser embedded. So it still is kind of a web application, but also kind of a native app, so it can be downloaded from the Market/Appstore, etc.
Also see Phonegap and JQuerymobile.
Comment: +1 I did write that `Some web applications are intended for local use but you would still need a browser to access them`, but that's far from actually giving a practical example. And now that I re-read it, although I had phonegap in mind there's no sane way to decipher that from my answer.
Comment: Yeah, my answer was really meant as an addition to your answer :)
Answer: jQuery Mobile is:

A unified, HTML5-based user interface system for all popular mobile device platforms, built on the rock-solid jQuery and jQuery UI foundation.

Its use is to provide a consistent experience across mobile devices UI for web applications. Web applications are applications that are accessible via a web browser through the Internet. Some web applications are intended for local use but you would still need a browser to access them.
So if your intentions are to build a native mobile application (your question wasn't very clear), jQuery Mobile is not of much use to you. But if you are developing a web application that targets mobile devices, jQuery Mobile is a valid option. If it's better than other similar options is not a question that's considered on topic here, you should decide for yourself. Personally, I like it and use it but I don't have much experience on the mobile domain, so don't take my word for it.
Comment: No problem, also I upvoted you, I feel sad when I see an accepted answer with a score of "0" :-)
Comment: @Jalayn Well it was a very low hanging fruit :)
Answer: For all these reasons here: http://tech.amikelive.com/node-22/7-reasons-to-use-jquery-as-the-javascript-framework-in-your-web-20-apps/ (ok, maybe not the last one if you don't care about John)
Also, see https://stackoverflow.com/questions/176324/why-does-everyone-like-jquery-more-than-prototype-script-aculo-us-or-mootools-or and the accepted answer.
I use JQuery because I like how it has evolved, how there seems to be a plugin for everything I want, and most of all in the Javascript world, because the documentation is great. Also, I like the fact that you write very few lines of code to great effect. You really don't need to write rich UIs to have a reason to use JQuery.
But honestly, prototype or scriptaculous are also great. In the end, it's just a matter of personal taste I think.
Comment: +1 for answering the "why" in the question instead of going for the very low hanging fruit of the "what"...
Answer: You CAN. Your whole native application could be a single web browser screen (on iOS that would be a UIWebView) loading up local html and js content, and for that you absolutely can use any js library you like, including jQuery Mobile, JQ Touch, Sencha, or whatever.
SHOULD you? Maybe. Depends on whether you have the time and inclination to learn the native stuff for the platform you're developing for. Wrapping a web application has its benefits--it's how things like PhoneGap and Titanium work. You'll never build something that's as nice or fast or integrated as a native app, but it's quicker to develop.
Comment: Titanium actually creates real native applications these days..
Comment: Really? It doesn't just wrap a web application into a native wrapper? That's new since I considered it a year or so ago.
Comment: Its new since about a year or so ;)
Comment: Well there you go.


Get background images from an installed themes android

Question: I am having some themes in my device.How can i get the icons,background images of those themes in my application? please help me guys
Thanks
Answer: If you mean like HandsetSMS or other applications in which you can download new themes from the market and install them to skin your app, then check out this link. It is OpenIntents, and it is a bunch of different applications (open-source) that have skinning capabilities. Take a look at OINotepad and check out the source to see how it works.
Good luck and I hope this helped!
EDIT: I know this question isn't answered yet, but you should keep checking up on it to see if it gets any answers because I think it's the same question as yours.