Can I defeat the Eater of Worlds with only Iron Armor and a Demonite Broadsword? if not, what do I need?

Question: The Eater of Worlds is rather tough to kill. I have iron armor and a demonite broadsword, but he eats me quickly. What equipment do I need to beat him?
Comment: Sunfury melts him.
Answer: You've got a number of options open to you (aren't sandbox games grand!):

You could go mine out some better ores.  For instance, you should be able to dig a shaft, find Silver and/or Gold, and mine enough to make better armor.
You could go into the Jungle and try to make some gear - the Thorn Chakram is easy to recommend.  Jungle Armor might be tricky, as the resources required are likely going to be difficult to collect in quantity at your current health/armor level.  The Chakram is pretty straightforward and low resource cost, though.
You could fight the Goblin Army, which has a chance to spawn after you start breaking Shadow Orbs.  They drop Harpoons, which are recommended for use against the pre-hardmode bosses and apparently make pretty short work of them.  The Army's not tough to fight if you have a pretty defensible area and a fast-firing weapon that does decent knockback.

I'd also suggest constructing a boss arena (in the corruption, if that wasn't already clear) if you haven't already.  It doesn't need to be particularly long or tall - 75 or so blocks wide and two jump-heights high should be enough.  Just put wooden platforms around the inside so that you can maneuver should the Eater dive through it.
Comment: @NoneOfYourBusiness, In addition to what Retrosaur mentioned, you can use dynamite or bombs to break corrupted stone.  I've always fought EoW the first time by breaking 3 orbs.
Comment: @NoneOfYourBusiness Actually, you can break corrupted stone.  If you kill the Eye of Cthulu, the Dryad can be an NPC, and with some purification powder, all you need is a pickaxe to get to shadow orbs.
Comment: You can't fight him an an arena that is not corrupted. I also cannot break shadow orbs since they are behind corrupted stone which an only be mined with a demonite pickaxe which requires shadow scale.
Comment: @NoneOfYourBusiness, yes.  So you should probably build your arena in the corruption.  You can build it out of whatever, though.  I imported dirt blocks.
Comment: So it's not necessarily a requisite to have Shadow gear to get to the Eater of Worlds
Comment: After banging my head on various explosive objects, I want to emphasize that Dryad purification powder is the way to go for dealing with corruption.
Answer: Preferably, your ideal weapons are weapons that pierce through  multiple enemies, weapons with fast swing times, or weapons that can hit multiple times.
First Time
Armor
When it comes to armor, you'd be hard pressed to find ores.  At that stage of the game, the best armor you can get is either Gold or Meteroite* armor. If you play a more Melee approach, it's best to use the Gold armor, as the set bonus grants a +3 defense.  If you play more Ranged based approach, using Meteroite Armor + Space Blaster can work wonders.
Basically, your choice of armor all comes down to your playstyle, Melee or Ranged.
*Only happens under certain conditions
Weapons
I find that weapons with big hitboxes work better than other weapons for the most part. Weapons that are easy to find at this level include the Blade of Grass, and the Gold Broadsword.  Not to mention, coupled with a decent swing speed, the Blade of Grass has a 25% proc chance of causing poison, which can greatly help with your fight.
Misc
It's advisable to bring Accessories that grant health regen, for example, the Band of Regeneration. Bring potions.  Always bring potions, because you never know what you need.  Ironskin potions also work wonders, granting extra defense, which increases your survivability.
Farming
A trick I use is to combine high tier armor (typially Shadow), combined with a Flail (You can find these in Chests), combined with wooden platforms, allows you to quickly take him out without dying too easily.
Comment: Eater of worlds drops shadow scale, so no shadow armor.
Comment: I'm not sure about the armour; the EoW is the only thing that drops it, and at a 50% chance of 1-2 Shadow Scales per segment. It'll be hard to get the 45 Shadow Scales (needing about 60 segment kills) to craft Shadow Armour.
Answer: This is my entire process on how I've beaten the eater of worlds. It is not my intention to brag, but instead provide credibility; using these exact steps, I have defeated the eater of worlds using a brand new hardcore character without the assistance of any other players or items.

Obtain all of the following:

At least iron armor (or better) - set bonuses help
Gold bow
250-500-ish arrows (some flaming arrows greatly help)
several suspicious looking eyes
several vacant houses for NPCs

Brew several archery potions, ironskin potions, regeneration potions, and healing potions
Under the effect of all buff potions, summon the eye of cthulhu and defeat him. Depending on how fast you are at this point in the game, you may or may not be able to defeat more than one per night. If the moon is past the halfway mark in the sky, don't summon another until the next Terrarian night.
After obtaining enough demonite ore, craft a war axe of the night and demonite bow.
Talk to the dryad to obtain purification powder, or the demolitionist to obtain bombs, and head over to the corruption. using either to access shadow orbs, break 3 of them (keep in mind the third will summon the eater of worlds). If any of these drop from shadow orbs, you can use them as weapons:

Musket - an excellent ranged weapon, especially for this stage of the game.
Ball O' Hurt - An excellent weapon to fight against the eater of worlds. Definitely a good idea to use it during the boss battle.
Vilethorn - if you have any mana, using this whenever possible is highly recommended. Cast it parallel to the eater of worlds' body for maximum damage.

When the eater of worlds is awakened, you'll want to be equipped with the following for the boss fight:

War axe of the night
Several ironskin potions, regeneration potions, and healing potions
Several grenades, if possible (arrows or musket would work too)
Any shadow orb weapons, and an ample supply of mana if using the vilethorn

Chances are you'll be in a pit, and this is actually a good thing since it protects you from any eaters of souls (which are a nuisance during the boss fight). Use several wooden platforms so you can navigate vertically, and start swinging your war axe or flail.
During battle, simply move next to or below his body when it attacks you so you can deal constant damage with your weapon. If you're confident you aren't going to hit yourself, lob a couple grenades, as they do a hefty 60-ish damage to multiple segments.
As segments die, they drop hearts, which are instantly collected at melee range - this greatly improves your survivability at this stage of the fight. If you die partway through, you'll still have a few shadow scales - see if you can make a piece of shadow armor, and attempt the boss battle again.

Repeat these steps until you have full shadow armor. Equipping this full set and an ironskin potion makes the battle a walk in the park. At that point, you don't even need to artfully dodge his attacks; just sit there swinging your axe and reap the rewards.
Answer: Try to get silver or gold armor.Mine around until you have enough gold or silver.
Have you tried to break ebonstone with dynamite or bombs?
Answer: If you get a nights edge you can do one hit kills but you need at least iron for the nights edge you need a firey great sword (drag needed to mine the hell stone) you'll need a murumasa (found in dungeons) a blade of grass (stingers and green orb plant things) and a blood butcher or demonite sword.
Comment: Actually, if you're able to craft the Night's Edge, you don't even have to care about defeating that worm boss. He's weaker than Skeletron which guard Muramasa.
Comment: I agree with the above comment.  The tier of weapons to get to the Night's Edge is enough that you'd be easily able to handle the Eater of Worlds.
Answer: If you've smashed a demon orb, you should also start getting meteorite ore.  You can make some decent armor out of it (better than any standard ore), but the real prize of meteorite ore is a Phaseblade, which has a wide swing radius and works great against Eater of Worlds.  Swing for the head to prevent him from splitting too soon.
Also with meteorite ore, you can create a few neat guns.  I favor the Space Gun, which does low damage but cuts through several parts of the Eater and can be fired rapidly.  This, with the Meteorite Armor and a lot of mana, can help get some long-range damage going.
Of course...you'll need a proper pickaxe to farm any of this (I believe Gold is required for meteorite ore), and if you feel your Nightmare Sword is good enough, you may be better served using the gold for armor.  Vilethorn down the length of it also works GREAT against the Eater, if you're lucky enough to get it from a drop.
Answer: You don't need much in the way of equipment to beat him, just grenades.  The easiest way to beat him is to build an arena above ground.  Make several levels of wooden planks on top of one another, and make it plenty long (over a screen wide).  Make sure you are still in the corruption even at the top level.  If you need to break shadow orbs to summon him, it's ideal if you have a magic mirror and can create an area where you place a bed to use as your spawn point, so you can get back quickly.
Pre 1.2, this was easy (he typically couldn't get past a certain height, and you could just rain down grenades).  The Eater has been given a bit of a buff as of 1.2, though, and he can actually get to you so be prepared to dodge.  But the tactic is the same.  Throw grenades at him.  You will damage many segments with each solid hit.
This method can produce lots of separate worm segments, and in 1.2 this is trickier.  But I still beat him while wearing only one piece of armor (ancient shadow mail, which I luckily scavenged) and 7 hearts.  It typically takes 30-40 grenades and I might use a bow to finish off the last few bits (gold if I am lucky, iron if not).  I then make a nightmare bow if I want to keep farming him.
I don't think it's difficult to get enough gold to buy all the grenades you need.  But it helps to start on a world with good natural caves, so spelunking with minimal digging will be very rewarding.
Answer: Suggested
Place a platform(any) about 3-4 tiles above any ground, place campfire within range, heart lantern if any, wear the highest armour you have, get the strongest flail type weapon you have, hold about 15 health potions.
Use a hook to cling onto the platform and drop the flail onto the ground beneath and wait for that stupid worm to suicide. Heal when needed. Towards the end of the fight before the worm dies if you are sure of the direction it is attack from you may retract your flail and attack it directly.
Minimum gear I have done with this is Silver Set with 240 Health plus Ball O'Hurt. Took almost all of the 15 potions though.
With Gold Set(or Platinum) plus a Ball O'Hurt that have increased damage, and accessories that boost Defence. It is possible to kill it w/o a single potion.
This DOES NOT work well on Expert
Iron Armour and Demonite Broadsword
If you insist on using sword it will be significantly hard but not impossible - like any other bosses a good arena is what you need.
Find the largest open area in the corruption near the orb you need to break to summon the worm. Use dynamite Carefully(you do not want to summon that worm w/o building anything) to open an area if needed. Combining the Dynamite with Gel to make it sticky can remove the chance of it bouncing towards the orb and destroying it.
Build the arena multi with at least 5 tile and at most 8 tile (or less if your char cannot even reach 8) gap between each layer. Ensure campfire and heart lantern covers the entire arena(some parts near the corners can be neglected but make sure the center have bonus heal).
During the fight, if the worm attacks from below, jump to the side away from it and drop down on layer. This will result in the worm arcing over you, giving a few seconds to attack it's body. If it attacks from the side, drop and run towards it at the last moment before it reaches you an similarly you will have a few seconds to hit it. If it attacks from above, jump away from it and up one level to get opening from the worm.
Once it breaks, focus on the smaller segment(s) and completely kill it before attacking the main slower body again.
Any combat potions will be helpful, but Health potions are most important. Do Not wait for last minute heals. Use potions as long as a single potion cannot over heal you. Any others like Ironskin, Regeneration, are good to have.
Using high knock back weapons(like musket or even hammers) against small segments can force them to bounce away from you like Most flying enemies. Using on large segment only halt it momentarily(enough to prevent getting hit).
Comment: I placed more words on answer the question, but if anyone wants more details on my suggested method just drop a comment, I'll expand it
Answer: Personally, I'd Smash one shadow orb, collect up the meteorite and make the full set of meteorite armor. Next, Buy the pistol looking gun from the arms dealer and upgrade it to the space gun. With the full set of armor, your bonus is the space gun gets infinite amo, without using mana.
Answer: It took me maybe 30 seconds to beat him I had meteorite armour I had a molten pick axe and mined a tunnel in ebonstobe then i dug a small square i spawned Gina and all his segments went in the square then I just hit him with fiery greatsword
Answer: I would say that the vilethorn works incredibly great. if you dont have it, just chuck grenades at him. also you should build a house in the corruption so that if you die he does not despawn. I would recommend farming this boss as he gives you great pre-hardmode armour, and gives you access to a nightmare pickaxe, so you can mine hellstone and craft a firey greatsword. also bring some ironskin potions as well as healing potions.
Answer: I would recommend gold or higher armor. A light's bane a demon bow a war ax of night. Unholy arrows are awesome for the fight the slime gun is also effective.    Bring ironskin, regeneration, archery, and health potions. That is how i defeated that boss. :)
Answer: If on the mobile version, I suggest using flamelash because it fires continuously. I am using that always to farm the Eater of Worlds. The only thing is you need a lot of mana for that.
Answer: I killed it with iron armour and a vile thorn I had 220 mana and i also used a few grenades but once u get the technique down its fairly easy.
Answer: I recommend you have Water Bolt or Muramasa (I killed Eater of World with that) and use Copper or higher armour. You need at least 220 Life and arena that uses platforms. If underground, you just need to kill his tail or his head, if you kill his body, he will turn into two Eater of Worlds or more.
Comment: Muramasa is only available in the dungeon, which is inaccessible until you've beaten Skeletron. Water Bolt can spawn in the "lobby" of the dungeon, but it's rare. The dungeon itself is also quite dangerous for early-game characters. If you're able to defeat Skeletron and survive the dungeon, beating Eater of Worlds should be pretty trivial, even without Muramasa.
Answer: it can be done i did it with nothing but a wooden bow.
and a new Character
Comment: ...and an arena, and a couple of potions.
Comment: well the only potion i used was shine potion and a hunter potion. beside that i didn't use anything that would buff my stats of a wooden bow and the whole inventory full of arrows. it took almost 3 stack of arrow to down him the second try. he kind of de-spawned the first time.  i think i spent around 20-30 min on EOW before he went down and it all happen in 1,1


Neigh effect when playing a unicorn

Question: If I Play a Unicorn from my hand to my stable, is it possible for another player to neigh this action?
And if it is possible will the unicorn be moved to the discard pile?
Answer:
I've never played this game but looking up the card it seems clear. The text on a neigh card says :-

Play this card when any player tries to play a card. Stop that
player's card from coming into play and send it to the discard pile
instead.

So yes, it is possible for another player to 'neigh' playing a unicorn from hand to stable.
Also yes, it will be moved to the discard pile.

Neigh effect when playing a unicorn


samba net command on Debian Wheezy

Question: Which package for Debian Wheezy holds the 'net' command?
I am running Raspbian 7 (Debian Wheezy) with samba-common and samba packages installed. But can not locate net.
Answer: This answer is correct as written previously:
Install samba-common-bin with
apt-get install samba-common-bin

In the case of Raspbian,  peterretief was incorrect. I have just verified it. I had installed samba-common and was unable to use net. after installing samba-common-bin, it works.  peterretief  also said that there were other ways to accomplish the same thing. As a Raspbian newbie, I would love to know what those are. Some references to articles or man pages would have been quite helpful.
Comment: I think you meant "peterretief was **correct**" since he was presumably asking why the answer you have also said is correct was downvoted.  *"As a Raspbian newbie, I would love to know what those are..."* -> Raspbian == [Debian](http://en.wikipedia.org/wiki/Debian), questions about which mostly (including any and all those involving samba) belong on [Unix & Linux](http://unix.stackexchange.com/).
Answer: Install samba-common-bin with apt-get install samba-common-bin.
Comment: Why is this answer wrong? net is part of samba common - I don't use it because there are so many tools in Linux that do the same thing

samba net command on Debian Wheezy


when we express in words can it be anything else but an opinion based on learning and experience?

Question: When we think and later express in works can it be anything else but an opinion, a summary of perceived learning and experience?  Facts?  There are more disproved facts in science than accepted ones.  When two or more people are in agreement, do the individual opinions turn into one fact?
Repeating something, which has come from a reputable source, is this make it a fact?  Is its origin not still the opinion of the person behind the reputable source?
Comment: At first, I thought it was just me that couldn't quite decipher this. There's a lot going on here, but I take it the central claim that you're aiming for is that everything is just opinion. But I'm really not seeing a clear question here.
Answer: It's not super clear what you're asking, but I'll take a stab at it. It looks like you're interested in finding out what makes something a fact. I'll deal with your question directly, and then provide some comments to point you in the right direction.

When we think and later express in [words] can it be anything else but an opinion, a summary of perceived learning and experience?

We can utter sentences without endorsing the propositions expressed by those sentences. Similarly for what we think. So not everything we think or say is an opinion. For instance, suppose I utter "it is raining outside," even though I believe that it is not raining. I can say it, but that doesn't mean I endorse/believe it.

When two or more people are in agreement, do the individual opinions turn into one fact

Not in general. Sharon and I may both hold the opinion that the Earth is flat but that doesn't entail that the Earth is flat. Also your terminology here is a bit weird. Even if someone's opinion is correct it's not as if it 'turns into' a fact - nothing like a transformation of the opinion happens. Rather, opinions express or correspond to facts just when the proposition expressed by the opinion is true (very roughly).

Repeating something, which has come from a reputable source, is this make it a fact?

No. In general the fact (sorry) that a reputable source said P doesn't make it true that P (barring cases where P is a claim about being uttered by a certain person). Even reputable sources can be mistaken about the facts. But it could be that you're warranted in believing what reputable sources tell you, even though those sources can be mistaken. Still, this shouldn't be mistaken for fact-making.
Here's a rough characterization of what makes something a fact. It's not going to satisfy everyone, but it is a decent place to start. First note that we can use sentences to say things about the world - for instance that certain objects stand in certain relations to each other, as when I say "the chair is to the left of the table." According to a popular theory of truth, the statement "the chair is to the left of the table" is true just when the chair is actually to the left of the table. So that statement is false when the chair is to the right of the table, or on top of the table, or whatever. Basically a statement is true when it correctly describes how the world is (again, very roughly). Facts are what we get when our statements are true.
Comment: Thanks for your answer.  It helps me clarifying my question.


Making my question (and sub-questions) rigorous and readable?

Question: Question for this post: In my post, how do I make the motivation and question rigorous and  readable to get a proper answer. (It received downvotes when I first originally sent it to math overflow but I believe if it's asked properly it can be answered here or there).
Comment: **Comments have been [moved to chat](https://chat.stackexchange.com/rooms/142835/discussion-on-question-by-bharath-krishnan-making-my-question-and-sub-questions); please do not continue the discussion here.** Before posting a comment below this one, please review the [purposes of comments](/help/privileges/comment). Comments that do not request clarification or suggest improvements usually belong as an [answer](/help/how-to-answer), or in [chat]. Comments continuing discussion may be removed.
Comment: It is sufficient to link your question (on main) here rather than including it in full. I have moved the comments to chat because they are related to your background and getting bit personal and perhaps distracting from the meta question here (you may add some of it to the question on main site).
Comment: Also it is best to edit your question so that the meta part can be separated from the question on main (for example consider removing the first sentence altogether). Will close the post for now and it can be reopened after a proper edit.
Comment: @ParamanandSingh I made edits. Is this better?
Answer: At the time of writing, your question has one answer, also from yourself, where you've begun with:

I'm not finished.
I am posting my attempt here instead of the post since the answer is too long.

I think this must be an indication that the question as written is too broad.
There is always a chance that a query will match up with some known thing in the literature, and someone will say "ah, yes, this is Dave's Theorem" and give you a brief, satisfying answer. But it will also often be the case that a great deal of work or insight is needed in order to connect known results to the query at hand. Random Internet volunteers are not necessarily inclined to do that work so there is a probable bias against engaging with a question that "smells like" it will be too much effort to try to answer.
Some of those smells on a question in general might be if the question is very long, or has lots of sub-questions. In your case, even before trying to read or understand the mathematics, we see that there is a "main question" which itself entails several different cases ("linear or superlinear", "...or a method", what is a "natural" choice function), followed by explicit subquestions of which at least part (4) seems to be strictly beyond the scope of the main question. It also refers transitively to a couple of previous questions, which enhances the impression that there is a lot of context to consider. Overall, this feels like a more open research question, where you have a hunch that something like the thing you want might possibly exist, and you are looking for assistance in navigating the conceptual space around it. You have a sense that there ought to be a "meaningful" extension, and some idea about how to make "meaningful" more precise, and you're asking for a great deal: for someone to come up with the proper criterion, and a construction meeting the criterion, and some further analysis.
This site is a better fit for questions that are more tightly scoped, so you should begin by trying to pull out some precise and answerable question out of the progress you have made so far. It is perfectly possible that this site is not going to be much help for you, compared to any of the other resources available in the universe. But if you do have a more specific version of a question, you could then focus on presenting it clearly for the purposes of this site, and that's when we would get into detailed issues of readability and rigour.
Comment: Ask a threshold Question, one that exposes the first point where you need help.  Don't try to find a place to ask about a topic that requires multiple subproblems to complete your understanding.  That is not how the Stackexchange communities engage with Q&A posts.
Comment: Thank you for responding. I made edits to adress these issues. Hopefully this time it can be answered here.
Comment: If my question is too broad where else can I ask it?


Git merge: is it possible to avoid auto-merge for non fast-forwarded files?

Question: When I do a git merge I would like that only the files that can be fast-forwarded (i.e. the files that have changed only on one of the branches being merged since the last common revision) are automerged, while all the other files (that have changed on both branches, even if on different lines) are marked as conflicts. I have looked around but it seems that there is not a "simple" way (e.g. an option to pass to git merge) to do that. Here there is a similar question, but not quite this one. Here there is a very similar question, but it is 4 years old and it has no conclusive answer.
Comment: For what it's worth, "fast forward" is not the right phrase here as it refers to branch label operations, which are based on the commit graph.  The content of any given commit is not controlled by the graph (although certain degenerate graph cases do limit the possibilities for content-changes).
Answer: As far as I know it's not possible to do this without using some sort of script (shouldn't be too difficult). I looked for a similar solution a couple months back and I simply ended up disabling the fast-forwarded merge. I think they mention how in some of the questions you added:
git merge --no-ff

Answer: Put * -merge in .git/info/attributes of the repository where you're performing the merge. This will prevent any auto-merging, introducing merge conflicts instead.
Note that .git/info/attributes has the highest precedence of all .gitattribute files, so none of those would cancel it out.


Package tsql with application

Question: How can I release a winform application to a user that takes advantage of a local sql database. I would assume that I need to install the database during some kind of setup phase, but is this kind of thing possible? Is there a free version of tsql that can be used in this way? Mysql?
Answer: TSQL is a language specification, not an actual database.
If you're talking about MS SQL Server, it is possible to bundle and install an instance of SQL Server Express, if you want to distribute a database with your app.  There's some documentation on it over on MSDN, specifically, Embedding SQL Server Express into Custom Applications.
Answer: SQL Server Compact Edition is suitable for this. It has some limitations in that it does not support the full set of functionality that SQL Server supports (ie. stored procedures is one example), but it does mean that you don't need an installation of SQL Server to use it. If you are only using the database as a "bit bucket" to store and retrieve data, then it should suffice.
Another alternative is to use SQL Server Express Edition. This does require installing a proper SQL Server instance, but basically gives you a cut down version of the full SQL Server, enabling you to use more of its features.
Both of these are free.
Answer: You might also want to check out VistaDB.  It is syntactically compatible (although not perfectly) with sql server.  All managed code.  But it is not free.
SQL Server Compact Edition does not support stored procs, fyi.  But is a single file deployment plus your data file.
SQLite is extremely fast and lightweight.  Deployment is single file plus data file.  But it has some syntactic limitations and has limitations to its dotnet integration (although I am pretty sure there IS a ado.net provider for it.)
I support an application built on sql express edition and it is a PAIN.  It has a lot of install failures.  (Probably about 10k installs over the last 3 years.)  But if you need to power, hot backup, full sp and function support, connection pooling, etc it will work for you.
Never used mysql so I can't comment.
Seth

Package tsql with application


Is chess haram even if you're not intending to gamble?

Question: I HEARD CHESS IS HARAM  but it seems ok if you want to have fun and not gamble
Comment: how does this even qualify as a good stackexchange question? no offense to the poster. this is more addressed to the admins/mods. i think this should be closed more as a unclear rather than a duplicate. i've noticed a lot of questions on islam se that are like this.
Answer: Most scholars and Islamic schools say that playing chess is haram (Imam Malik, Ahmed, Abu Hanifa). However, there are few scholars who say it is OK to play chess if it does not distract you from doing compulsory things such as doing prayers at the right time or attending to your parents when they need you.
Comment: Chess being haram is most retarded thing I have heard. It's like other form of entertainments magically aren't like chess.
Comment: @Hegao disagree unless you count equally retarded that fortnite is haram while csgo isn't because fortnite has 'magic'. LOL https://islam.stackexchange.com/questions/67176/i-play-a-game-called-fortnite-there-are-two-elements-in-it-shield-potion-and-ma p.s. i think it's politically incorrect to say 'retarded' unless you have some neurological disorder, neurodevelopmental disability or ADHD or autism or something
Comment: @BCLC Magic and sihr is literally two different things. Afaik shir means getting help from satans and its kinda illusions tricks. But magic is bending, changing laws or reality and things called mana to use magic. Which is completely fictional.
Comment: These 'fatwas' are historic. Whether they are still relevant or not is something for contemporary scholars to comment on. I think for historic 'fatwas' it is more important to focus on the rationale behind it, rather than the subject (chess). The rationale here is protecting people from being addictive to habits that are unproductive or distracting. Take computer games as an example. Many parents restrict screen time of their children, why? It is the same reason. My personal opinion is that video and computer games 'can' be by far much more harmful than chess.


Change middle mouse button function in Windows

Question: Is there a way to assign a function (like cut/copy/paste) to the middle mouse button or scroll wheel in Windows 7?
Answer: Try X-Mouse!

X-Mouse Button Control is a windows application to remap your mouse
  buttons. This software can handle, including things like copy, cut,
  and paste, volume control, media player control, send a custom
  keystroke sequence, launch your email (or any other) application,
  capture screen (or active window) image to clipboard, click-drag, and
  save and restore desktop icon positions.
Comment: download from authors website http://www.highrez.co.uk/downloads/XMouseButtonControl.htm works with windows 10
Answer: Out of the box, no, the mouse button is used for putting the machine in scroll mode.  If you have a Microsoft or Logitech mouse, there is some driver software (eg Intellipoint) that allows greater customization of the mouse buttons (including middle scroll button).
You can however find software (usually free) that gives you some of this functionality.  The most popular of these is: X Mouse Button Control: http://www.highrez.co.uk/downloads/XMouseButtonControl.htm
Answer: Another possibility is to use AutoHotkey and assign the middle button to the action you want to perform. The example below sends a "back" signal when on a web page (to visit the previous page)
<code>; Wheel click = back on navigator
~MButton::Send {Browser_Back}
</code>
Comment: Is it possible to not go back if the middle button was clicked on a tab header to close the tab?
Comment: That's great. A bit complex to get into but seems powerful
Comment: Similarly with my Thinkpad TrackPoint I set the middle button to close programs be executing: `MButton Up::Send !{F4}`
Comment: @thorn: (sorry for the slight delay in my answer, I doubt that it is still useful :)) I do not think so - when using Spy Window (part of AHK) the tabs are not seen as anything special (just part of the general browser window).


No voice on front headphone port.

Question: I have a strange problem. It just happen recently, when I accidentally unplug my headphone. But I unplugged it before and nothing happen. Basically now, when I use my headphone through front jack, when playing videos, I can't hear voice. Only background music. Using kde sound setup, pressing front left and front right test button, result in a mono sound. No distinction between right and left. This only happen with front jack. Rear jack is working fine.
Comment: See if guest account is working fine. If yes, try solutions from http://askubuntu.com/questions/201780/how-do-i-debug-issues-with-pulse-audio
Comment: I have the same problem. As a workaround, you can try shifting the headphone balance. When I set it all the way left or right, the sound seems OK.
Comment: Can you tell me what happens when you do a test sound on the Sound Settings window? In my case, whether I press "Front Left" or "Front Right", now I get sound coming out of both speakers.
Answer: For me, I also had this problem when using my Apple 3.5mm headphone on Kubuntu, but when I held the volume up or down button, it had no effect on the actual volume, but my headphone had a sound.
To solve this problem, simply pull the plug a little and the sound will recover.
Probably because the top connector is for controlling audio input, but the input and output on the motherboard are separate, so you can't insert the wrong interface if you want to use the output function normally. Of course, the input function is not available when the output function is used normally.
Forgive me for my poor English, good luck
Answer:
You can try to launch  "pulseaudio volume control" from multimedia  menu   then change profile in right tab (sound like you switch to a 5.1 profile)  .
(if   "pulseaudio volume control" is not installed: sudo apt-get install pavucontrol)

No voice on front headphone port.


Lenz's Law for Moving Loops

Question:
This image above intrigued me since it shows different instances of Lenz's Law. I am learning about magnetic fields, but I get confused on the direction of induced magnetic fields. I was wondering what would happen if I moved the loop towards the magnet instead for each of these scenarios, would it be the same as the magnet moving? For instance, focus on b,c,d,e in particular. If I moved the loop towards the magnet, would the flux/induced current directions be the same?
Answer: Yes, moving the magnet down or moving the coil up will yield the same result.

Lenz's Law for Moving Loops


Bowser and Mario in a Pinch!

Question: Our little hero starts off in a round (or square) pit with very high walls, an escape does not seem possible. However also in the pit is Bowser! How did that happen? Both of them are now facing off each other, which means, Mario is on the run and Bowser chases him.
Both of them run at the same constant speed.
The question now is: Can Mario outrun Bowser and will never be caught or is he sooner or later doomed to be caught by it? Do both of them have an optimal strategy to run?
(No attack moves, jumps, power ups etc. allowed! Just running!)
Answer: If the pit is a square, Mario is doomed.
Suppose the pit is a square 1 m x 1 m. Mario ($M$) has to maximize the distance from Bowser ($B$) and $B$ minimize it. The strategy for $B$ is to stand in the middle of the square. The most distant point for $M$ to stand is at one of the corners which is at ${\sqrt2 \over 2}m$  which is greater than ${1\over2}m$, the distance from the center to one of the sides.
If $M$ starts to run following one of the sides, $B$ has only to run, at the same speed, towards that side. They will met at $1\over2$ of the side itself, and $M$ is captured.
$B$ has to run towards $M$ following the diagonal of the square, decreasing the dimension of the square until $M$ is captured.
When running towards the edge of the pit, $B$ has to run in a straight orthogonal line. If $M$ runs back $B$ runs on a $45°$ line orthogonal to the diagonal of the square. In this way $B$ runs a shorter path since he now runs on the cathetus instead of the hypotenuse of the triangle made with the diagonal of the pit, assures that $M$ doesn't escape and decreases the distance between them when getting back to the diagonal.
If $M$ at some point decide to run diagonally, $B$ only has to decrease the run and wait $M$ intersect his path.
Answer: If this pit goes through the entire planet in one long line, then Bowser will not be able to catch Mario.
But if the pit is round, then Mario has no chance. No matter where he runs, Bowser will run towards him. When Mario reaches the wall, he has to go left or right. Depending where he goes, Bowser will slightly move too that side too making the distance smaller.
Mario will probably keep on running in circles, but Bowser will make some corrections and shorten the distance with every turn of Mario.
So, Mario is doomed.

Bowser and Mario in a Pinch!


How to restore screen to normal size after turning off the MIUI optimization?

Question: My phone is Xiaomi Redmi Note 9, how can I restore the screen size of my phone after turning off the MIUI optimization even if I turned it back on? Before i have small screen size and small fonts 'coz it's what i prefer and now they got bigger. Please help i don't know what to do.
Answer: You need to go to Additional Settings > Accessibility > Vision > Display (or simply search for Display size) and change that setting if you have it to on and off, for example I had it on XS but it showed bigger, so I put it on S, saved it, then put it back on XS and it's back as it used to be.


Why are there differences in data between Google Analytics and Google Webmaster Tools?

Question: Why are there differences between Google Analytics And Google Webmaster Tools in external links data? Generally this data do not coincide with each other.
Comment: As far as I know, GA shows you how your website is seen and visited on the internet, when GW is about how your website behaves exactly at Google Search Results. But I still can't understand why my website have 0 hits on GA, but has some on GW..
Answer: Google Analytics and Google Webmaster Tools are collecting different kinds of data, and they are sampling the data differently. That's why it's different.
Google Analytics "Referrals" measure a person who clicks a link to get from the external site to get to yours. Their browser must report that referral via HTTP_REFERER, and it must execute the Google Analytics JavaScript to report that. Some mobile browsers are no longer reporting the HTTP_REFERER value, so you will see those numbers start to go down.
Google Webmaster Tools "Links to Your Site" measure links to your site that the Googlebot spider finds when crawling the web. That is entirely different than what Google Analytics is measuring.
Also, neither Google Webmaster Tools nor Google Analytics will ever give you exact numbers. Both databases contain a ridiculous amount of data, so they need to sample it. You're supposed to be looking at this sampled data for trends over time to see if your marketing is helping or hurting your efforts.
Also, I've had this suspicion that Google never really wants to give you all the data. They ultimately don't want you monkeying around with your SEO too much because it undermines what they're trying to do in providing objective, relevant results.
Answer: The difference is because Google Webmaster data is updated monthly whereas in Google Analytics you can see the daily activity.
Google webmaster tools has all the data, even if it does shows in Webmaster dashboard
Check out the following links to see the answers from the Google itself
http://support.google.com/webmasters/bin/answer.py?hl=en&answer=1213138
Comment: But even if I take this into account I still have discrepancy with some external links which refer to the site ie. some of links are on GW but not on GA...
Comment: Ya, true even I  faced the similar problem. One of my sites is getting a back-link from Microsoft.com (Home page of Microsoft official site) as per the GW, which is no where possible in any case. Bro, to me it seems as a bug in GW.


Can assembly make sampling faster on an Arduino Uno? Can assembly run alongside normal Arduino IDE code?

Question: We are doing a school project making an oscilloscope.  Our teacher told us that we can use assembly to take measurements faster.
Comment: (1) Yes and (2) yes.
Comment: (2)  It depends on what you mean by "run alongside".  Can you use both assembler and C/C++? Yes.  Can two pieces of code sxecute simultaneously? No.
Comment: Actual hard limit is how you output data from arduino. ADC on arduino is fast enough to completely saturate serial port (at 3M baud rate). You can achieve this with normal C/C++ code.
Answer: I will assume that by "measurements", you mean the analogRead function.
The first point were you can gain significant time is by increasing the ADC clock frequency (by reducing the prescaler). This is discussed in this post on arduino forum. Please note that the (rather) slow default is not a random choice : it enables better noise immunity, and allows for enough time to charge the ADC's internal capacitor even if the input signal has "high" output impedance/resistance (up to 10kohms if I remember right). If you increase the clock frequency, make sure you have a low impedance signal (for example by adding an Op-amp as follower (it might also do amplification if you want). If you push it far, you can reach the point were the least significant bits become noisy (but most scopes are 8 bits, so you might accept to loose the 2 least significant bits).
Another point were you can gain lots of speed is that, as far as I remember, by default all 6 analog ports are read in turn : if you only need 2 of them, disabling the 4 others should improve speed.
Then, it is true that most arduino functions do lots of "useless" checks on the pins, so you can gain a bit of performance by doing direct port manipulation (skipping all the tests checking to which port the pin maps)
Finally, you can look in the datasheet of the Atmega328P for the different ADC modes : there might be some better suited than the one used by the Arduino library (for example, if I remember well, you can get an interrupt when conversion is finished instead of the blocking behavior from analogRead).
So globally, there are plenty of ways you can increase the speed of analogRead : the simplest consist in changing the ADC clock, then if still more performance is needed, you can start disabling pins, using simplified code and/or playing with different ADC modes. For all those solutions, you do not need to write assembly code yourself. You do however need to write registers (in C), and therefore either to follow tutorials or read the datasheet of the micro-controler (Atmega328P).
Writing directly assembly is probably not a good idea : excepted if you are an assembly expert, your code will probably worse than the one generated by the compiler (and you get a far less readable code, and spend far more time writing it). Nowadays, even for commercial products, assembly is seldomly used, and when used, it's only for short bottleneck sections that where previously identified.
Finally, for your question about running assembly along side arduino code :

if you mean "at the same time" : you can't, the arduino has only a single core

if you mean to mix both types of codes, you can, using the asm volatile construction (see this post ) :
<code>asm volatile ("

  ; your assembly code here

");
</code>

if you mean having them in pseudo parallel, you can use interrupts to execute some code (arduino style or assembly) when the interrupt is trigered (by timer, external interupt, ADC conversion finished, ...)

But don't forget : don't use assembly until everything else failed, and only in the most critical sections
Comment: Excellent answer; just to add: actually getting the data out through the serial port will consume a lot of cycles. So for best performance, capture enough data in a buffer to fill a screen, then pause the capture to flush the buffer through the serial port.
Comment: @EricDuminil : yes, you can send binary data using the Serial.write() functions. I usually do it that way as soon as I'm retrieving data from another program on the PC side (it's easier that processing strings). You can get quite fast on the serial port if using the right baudrate (as far as I remeber you can go to at least 1Mb/s, ie 125kB/s). EEPROM is very slow for writing (3.3ms), so not a good option. If really maximal write speed is needed, then an external parallel input memory would be the optimal solution : using port writes, it should only take 3 clock cycles to write 8bits.
Comment: @Paul : good point. If only short recordings are required (short enough to fit in RAM), then buffering all data then sending it is definitively the best option. If longer storage is required, it starts to get tricky. Maybe using the ADC in non blocking way, and send each value individually, using the highest baudrate possible. Or maybe (or not) it is possible to do the whole reading in interrupt routines, and the sending in foreground (but there might be some no_interrupt in the serial routines prevening this)
Comment: @Paul: Can binary data be sent through the serial port, in order to deliver data faster than just ASCII+newlines? A script could listen to the output, and either display the data as an oscilloscope, or write it down to a CSV file? Also, would it be faster to write data to the EEPROM instead of outputing it via Serial.print()?
Comment: @Sandro : yes, this only works for short recordings, but you usually use a scope for repeating patterns (or an overlay of a few different versions of a pattern, like this https://keysight-h.assetsadobe.com/is/image/content/dam/keysight/en/img/prd/scopes-analyzers-meters/oscilloscopes/infiniium-scopes/mxr/MXR-2-800x450.png), so recording a single screen width at a time may be an acceptable limitation
Answer: The Arduino functions are very slow. For instance a digitalWrite() to a pin takes several 10s of cycles.
You could use assembly, but C code would be the first thing to try. That compiles to instructions that are usually as small as assembly would be.
It's always better to make working code go faster, than make fast code work.
This means code up your application in as high level code as is available, so using the Ardunio functions, and get it working properly. Then see which bits are taking the most time, and make just those small bits go faster by rewriting in C. Rinse and repeat, until it's fast enough.
For instance, get it going with digitalWrite(pin, data) for each bit in a port. Later, replace that with PORTD = D_data_byte, to update all 8 bits on port D in a single cycle. Leave the original working but slow code in the source, but commented out, so you know what you've done.
Comment: "Leave the original working but slow code in the source, but commented out, so you know what you've done." Shouldn't it be git's job?
Comment: Direct port manipulation (in C) is faster than using high level C functions.
Comment: Arduino AnalogRead() is already a C function which may not require C++ and can't really be much faster if you rewrite it yourself or rewrite it in assembly language. The point is, if you select a channel, start conversion, wait conversion to complete and read the result will not improve things much
Answer: Well written C or C++ code can be as fast as assembler.
But I can't say how efficient analogread() is compared to the same in assembler.  and also I think analogread() locks you up for several clock cyctles while the ADC is running. This is a limitation you can escape by going direct to the hardware.


Git for version controlling Android project

Question: For some mysterious reasons, I ended up deleting my local repository. I now cloned my remote repo back into my Eclipse workspace and it shows that I am working on the master branch of my Android project rather than the local repo and it makes sense.
The reason why I started using Git is so that I can make wild changes to the project and if anything breaks, I can go back to the last stable state. Now, with a local repo gone and me working straight on my master branch of the project, I do not know how that can be done.
Please tell me how that can be done.
PS: I need to have Android project in my workspace or else Eclipse starts complaining cause it cannot find user libraries
Comment: you can make brach say masterbrach and dev barch :

master brach means most stable code is in , dev brach means after any changes u willing to take backup u can push to dev brach and dont push to master until and unless u r sure of it
Answer: If you cloned the remote repo back into your workspace, you have a local repo once more.
And you can always create new branches for your wild changes instead of working directly on the master branch.
Comment: yup thats what i said
Comment: Ok and where can I find the local repo? it is not in `C:\Users\Little\git` or the clone itself is the local repo? :)
Comment: where hv u clone new repo?
Comment: @adcom Into Eclipse workspace `E:\AndroidProjects` :)
Comment: then that ur repo and u can perform all git operations on it
Comment: @adcom Screw eGit I am going command line. Where do I get that for Windows?
Comment: @adcom Where can I find it for Windows?
Answer: You can make brach say masterbranch and dev barch : master brach means most stable code is in , dev brach means after any changes u willing to take backup u can push to dev brach and dont push to master until and unless u r sure of it.
Create local brach
git checkout -b your_branch

Push it to the remote server.
git push <remote-name> <branch-name>


Knocking prior art, is it necessary?

Question: I am working on software process patent. There is a significant body of prior art, which I believe is inferior. But proving that would require to go into a lot of technical details of prior art. Should I do that in my application or just state believe in my solution superiority?
Answer: At the time of filing your patent application, it is not mandatory to state the difference between your invention and the prior art that you have, in the application. You may, however, have to differentiate your invention from the prior art while filing a response to an Office Action issued by the Examiner if the Examiner cites that particular reference questioning the patentability of your invention. The Examiner would be interested in the novelty and non obviousness/inventiveness of your invention in light of the above mentioned prior art, and describing how your solution is superior may further your cause.
However, as a duty you may disclose this particular piece of prior art in an Information Disclosure Statement (IDS) to the PTO. You may disclose any kind of relevant (material) information to the PTO which you may come to know of while or after filing the patent application, through the IDS to avoid facing negative consequences later. For details on the duty to disclose relevant information to the PTO and the Information Disclosure Statement (IDS), you may visit http://www.invntree.com/blogs/duty-of-disclosure-in-a-patent-application
Answer: No - the current trend is not to even mention prior art. Importantly, there is no requirement to be better that what was already done. If it isn't better, you might have a hard time selling it, but that's your concern, not the UPTO's. If it is novel and not obvious, you can get a patent. Explaining how it differs from what was done in the past, and why that difference is non-obvious will be needed. But it will be in response to the examiner saying "I think putting the concepts of X and Y and Z put together somehow makes yours obvious."
We no longer mention prior art for several reasons. One is the concept of prior art itself. There are requirements a document must meet to technically be prior art. But if you say it is prior art then it is - even if it wouldn't otherwise qualify. If you bash a particular thing from the past over a feature and you get a patent, a judge might say that anything with that feature can't possibly be your thing and is outside your claims even if it otherwise would be covered.
Comment: So I shouldn't even mention prior art in description but must refer to it in IDS?
Comment: Anything you know about that might contribute to a rejection needs to be on an IDS. When in doubt, include it. The current thinking on not mentioning specific prior art includes a concern that you will be hit with "inequitable conduct" if you ever get to court. The senario is you say X can't do Y but it can. Or you say X never mentions Z, but it does. Anything you say about prior art will be used against you. The good news is the most likely time the validity of your patent will challenged is ten years from now, and the words you write today will be judged by the law and mood prevailing then.
Answer: Adding to the answer, applicant doesnot need to say about priorart at the time of drafting application but he may submit IDS- information disclosure statement. In some instances if prior art too close as you feel best would be characterize or identify atleast one example wherein you get clear articulated result to show significant superiority.

Knocking prior art, is it necessary?


Allow an app to override Do Not Disturb in Oreo

Question: In Nougat, there used to be a per-app option to control which apps could override Do Not Disturb. In Oreo, I only see the Low/Medium/High/Urgent options, none of which say that they override Do Not Disturb. Is there still a way to do this for Oreo apps? If so, how?
Answer: On stock Oreo 8.0 (MiA1)
Settings → Apps and notifications  →App Info  → Choose app (not all apps have this permission)  →App Notification  → Enable override
Comment: If your device is rooted, gravity box xposed module offers notification control that can do this
Comment: It looks like that's only there for legacy apps, not ones that target Oreo and use its new notification channels.
Comment: Is that so? Can you quote an example app?
Comment: Chrome is one such app. I see "Allow notification dot" and then a bunch of categories, none of which contain that option.
Comment: +1. I see your point. Maybe you should ask a separate question( using this as reference) to ask how it can be done for such apps. I have no answer


Applying for German Study Visa with past visa refusal

Question: I am from Pakistan. I applied for a study visa to the UK in 2022, which was refused due to false information. Now I am applying for German study visa, which requires which has this requirement in it. Is it now necessary to show the past refusal etc. and if not shown what are the consequences?
Comment: The application form asks for details about previous refusals. Why do you even consider that it may not be necessary to answer that point in the visa application? I ask because I never understand why such questions are even necessary.
Comment: Why was false info submitted the first time?
Comment: @Tor-EinarJarnbjo, here are some thoughts that people may have: UK is not in the Schengen zone so Germany should not not care; my application will be scrutinized more thoroughly with higher chances of refusal if I do provide information; I threw away all the documents related to refusal so cannot provide them anymore; etc.
Answer: A refusal for the production of false information in the UK usually automatically leads to a UK visa ban for 10 years for deception (Immigration rules 320 (7a/7b))
This is an extremely bad thing and really hurts your credibility but doesn't prevent you to get a visa elsewhere, it is just going to be extremely hard

Is it now necessary to show the past refusal etc.

It is not in the application form, but yes, you need to follow the list of documents required and join the refusal letter for your UK visa

and if not shown what are the consequences?

A lot can happen, they may :

refuse you for deception again, which will put your refusal in the Visa Information System, letting all other Schengen members know about your refusal for five years.

Only the following categories of data shall be recorded in the VIS:

on the applicant for a long-stay visa or a residence permit and on long-stay visas and residence permits requested, issued, refused, withdrawn, revoked, annulled, extended or renewed as referred to in Article 22a and Articles 22c to 22f;

Visa Information System

If they hear about your deception after issuing the visa, they can and very likely will, revoke your visa/residence permit and make you leave/deport you from Germany, which will make your life a lot harder

A foreigner can be expelled if he or she has furnished false or incomplete information in order to gain a German residence permit or a Schengen visa.
The applicant is obliged to provide all information to the best of his or her knowledge and belief. If he or she refuses to provide data or knowingly furnishes false or incomplete information, the visa application may be refused or, if a visa has already been issued, the applicant may be expelled from Germany.
In signing this document, the applicant certifies that, before submitting the application, he or she was informed of the legal consequences of refusing to provide data or furnishing false or incomplete information in the visa application process.

From the application form

Don't try to stack deception on deception, this is not a good thing.
Having a visa refusal usually doesn't mean that all other visas will be denied, you just need to be honest about it


Can you bleach human poop to use as fertilizer?

Question: I was thinking about how in The Martian the astronaut used the crew members poop to fertilize the soil and grow potatoes and decided to learn more about that. I read, though, that unprocessed human waste has pathogens that make it risky to use. The only way I saw to make it safe is to let it sit for a year and then compost it but to only use it on non edible plants. Instead of doing all that, couldn't you just soak the poop in bleach and then let the bleach evaporate to kill all the pathogens? Then you know it would be safe to use for edible plants.
Comment: The bleach would not kill the pathogens inside the poop. Also, the spores of spore-forming bacteria (clostridium etc) will not be killed in any case by bleach. Pressure cooking for at the correct time, pressure and temperature will work fine.
Comment: I tend to agree that it wouldn't kill everything (just some things). A better approach than bleach might be to incinerate the poop into fine ash. Make sure there's no medication in it or the fumes could be harmful, and the medication might not be good for plants. Note that poop ash isn't the same nutrient-wise as wood ash, and would probably be safe to use as far as pH goes. A wood stove fire can get up to 2000° F., which I believe would kill pretty much anything.
Comment: Wouldn't incinerating it make it lose some of the nutrients as gas?
Answer: The soil that potatoes grow in is a machine whose function is to process nutrients and store water in a form that the root hairs of the plant can absorb. Apart from the mineral element there is a community of other organisms that facilitate this process. Chlorine is an effective killer of many organisms but so is radiation. My understanding of radiation is limited but it seems to me that just putting the human waste out in the Martian fresh air would expose it to heavy radiation effectively killing over time many if not all the organisms in the waste.
The problem with chlorine and radiation is they are both broad spectrum killers. As far as I am aware Martian soil at the surface is inert, so mixing dead soil with dead waste provides no soil community to process complex materials in the waste into primary stuff that the root hairs can handle. Normal composting has the effect of suppressing those organisms of no use in the growing process and encouraging those that help plants to grow.
The availability of potatoes was a convenient happenstance. Not only is the potato more able to process raw nutrients and sit around waiting for them to become available, but also can be thinly peeled where there is a suspicion of pathogens on the surface of the tubers, the peel being recycled back into the soil.
"F U Mars."


Convert String to Integer in QGIS tables

Question: I want it to know how to convert string field values to integer values in QGIS Dufour... there are numbers and strings in the same field, when I use toreal(string) it stops and it won´t create the field.
Answer: Update for QGIS 3.12 București:
The function names are now to_int() and to_real(). If you want to convert Integers stored as QStrings to integers, try to_int() directly without the extra step of to_real() first.

I just tried to convert a string to an integer in QGIS Dufour with no issues.  I had a text string that was 7 characters long.  I did the following:

Create a new field (temp2) that is a whole number and holds 10 characters (longer than my source)
Field calculate temp2 with: toreal( "temp1" )
Field calculate temp3 with: toint( "temp1" )

Both examples worked and produced numbers from text.  Make sure you only have numeric values in the source field.  If you have any alpha values (a - z) or special characters (* # $ _ etc.) the conversion will not work.  The source field must only contain numeric values (0 - 9)
Comment: Carlos, are the GPS values uniform?  What I mean is do they follow a pattern?  In the example I had a text string that was hal1000000, hal1000001, hal1000002....What I did was to do a substr(  "BLDGID" , 4, 7)   This takes the source text field and chops out only the number values (starting at the 4th place and counting 7 values out).  Here is a conversion to do it all in one.  If you have number values in between letters you may need to be creative with the starting and ending numbers, or do it in two steps.
Comment: Dear Ryan, that is the point, I have GPS data, some are numbers, others are descriptive string in the same field, I just want the numbers
Comment: Well, sometimes the answer is in your question... I will just select the values that I want to be converted! Works perfectly!
Comment: Ryan, I just sort by name then select the first ones (who has numbers) then use the field calculator and done!.. problema resuelto amigo. Gracias!
Comment: Glad you got it figured out.


Near point and focal length of the eye

Question: What is the relationship between near point and focal length of the eye?normally in a convex lens when the object is kept at 2f we get the same size image as shown . A healthy human eye can see objects without any trobles. Then is the near point of the eye, 2f of the eye lens? Im really confused about focal length of eye lens and near pont.
Answer: As I recall, a relaxed lens of a healthy eye puts the image of nearby (but not close) objects on the retina of the eye. For distant objects, the muscles around the lens must make minor adjustments to the shape of the lens (unless you are far-sighted).  For nearby objects, the muscles must work harder to shorten the focal length of the lens. When the object is brought in so close that it can no longer be kept in focus, it is inside of the near point.
Comment: Correct - at least for young folks;  as we get older,  the lens stiffens, leading to "presbyopia" and the need for reading glasses because our eye can't change focal length.

Near point and focal length of the eye


Can I write an object that behaves like a hash?

Question: In Perl there is tie. Python supports various protocols so that objects can behave like i.e. a dictionary.  Is there something similar in Raku?
I.e. Can I define an object that behaves like a Hash? That is: can I write $myobject<key> to end up in a routine that I can specify myself?
Comment: See also [How to pass hash-like object which does associative role to a constructor expecting a hash?](https://stackoverflow.com/q/55557297/2173773)
Comment: The link in the question (https://docs.raku.org/language/subscripts#Methods_to_implement_for_associative_subscripting) is what I searched for. Thanks.
Comment: @KonradEisele please flesh out the answer yourself below, so that it's clearer for everyone.
Answer:
Perl has the Hash feature baked into the language.
So to extend it so that an object behaves like a Hash you needed to tell the runtime to do something different.
That is not the case for Raku.
A Hash in Raku is just another object.
The Hash indexing operation is just another operator that can be overloaded the same way you can overload other operators.
So you can create your own object that has the same features as a Hash, or even just inherit from it.
class Foo is Hash {
}

class Bar does Associative {
  # delegate method calls to a Hash object
  has %!hash handles Hash;
}

The reason to have does Associative is so that you can use it as the type to back an associative variable. (Hash already does Associative so you would inherit that too.)
my %f is Foo;
my %b is Bar;

To find out which methods you can write to implement Hash indexing operations you could look at the methods that Hash implements.
Since we know that methods that automatically get called are uppercase, we only need to look at them.
Hash.^methods.map(*.name).grep(/^<:Lu + [-]>+$/)
# (STORE BIND-KEY WHICH AT-KEY ASSIGN-KEY DELETE-KEY
# DUMP BUILDALL ASSIGN-KEY EXISTS-KEY AT-KEY STORE ACCEPTS BUILDALL)

It should be fairly obvious that the methods ending with -KEY are the ones we would want to write. (The other ones are mostly just object artifacts.)
You currently don't have to write any of them to make your object type Associative.
If you don't write a particular method, that feature won't work.
class Point does Associative {
  has Real ($.x, $.y);

  multi method AT-KEY ( 'x' ){ $!x }
  multi method AT-KEY ( 'y' ){ $!y }

  multi method ASSIGN-KEY ( 'x', Real $new-value ){ $!x = $new-value }
  multi method ASSIGN-KEY ( 'y', Real $new-value ){ $!y = $new-value }

  multi method EXISTS-KEY ( 'x' --> True ){}
  multi method EXISTS-KEY ( 'y' --> True ){}
  multi method EXISTS-KEY ( Any --> False ){}
}

my %p is Point;
%p<x> = 1;
%p<y> = 2;

say %p.x; # 1
say %p.y; # 2

Note that above has a few limitations.

You can't assign to more than one attribute at a time.
  %p< x y > = 1,2;

You can't assign the values in the declaration.
  my %p is Point = 1,2;
  my %p is Point = x => 1, y => 2;

In the multi-assignment, the method that gets called is AT-KEY. So to make it work those must be marked as raw or rw
class Point does Associative {
  …

  multi method AT-KEY ( 'x' ) is rw { $!x }
  multi method AT-KEY ( 'y' ) is rw { $!y }

  …
}

…

%p<x y> = 1,2;

That takes care of multi assignment, but that still leaves the initialization in the declaration.
If you declared an attribute as is required the only way to write it would be:
 my %p := Point.new( x => 1, y => 2 );

If you didn't do that you could implement STORE.
class Point does Associative {
  …

  method STORE ( \list ) {
    ($!x,$!y) = list.Hash<x y>
  }
}

my %p is Point = x => 1, y => 2;

That also makes it so that you can also assign to it later.
%p = x => 3, y => 4;

Which is possibly not what you wanted.
We can fix that though.
Just make it so that there has to be an :INITIALIZE argument.
class Point does Associative {
  …

  method STORE ( \list, :INITIALIZE($) is required ) {
    ($!x,$!y) = list.Hash<x y>
  }
}

my %p is Point = x => 1, y => 2;

# %p = x => 3, y => 4; # ERROR

In the case of Point we might want to be able to declare it wit a list of two elements:
my %p is Point = 1,2;

Or by name:
my %p is Point = x => 1, y => 2;

To do that we can change how STORE works.
We'll just look at the first value in the list and check if it is Associative.
If it is we will assume all of the arguments are also Associative.
Otherwise we will assume that it is a list of two values, x and y.
class Point does Associative {
  …

  method STORE ( \list, :INITIALIZE($) is required ) {
    if list.head ~~ Associative {
      ($!x,$!y) = list.Hash<x y>
    } else {
      ($!x,$!y) = list
    }
  }
}

my %a is Point = x => 1, y => 2;
my %b is Point = 1,2;

Answer: In raku the syntactical <> seems to be an postcircumfix operator that can be overloaded via a multi method AT-KEY and EXISTS-KEY as described in https://docs.raku.org/language/subscripts#Methods_to_implement_for_associative_subscripting
Answer:
Can I define a object that behaves like an hash? That is: if I write $myobject<key> I endup in a function that I can specify myself?

The short answer is. No, there is not in core Raku.  But there is a module that makes it easy for you to do, having only to define 5 methods to create full functionality as a "real" Hash: Hash::Agnostic
The longer answer is: read the other answers to this question :-)


Would the USB-C MacBook Pro chargers work with the new (Oct-2018) iPadPro?

Question: I have been going through the newly launched iPad Pro models and noted that Apple has decided to put a USB-C port rather than Lightning, for charging. Would that mean that one could use the same (87W) charger for the MBP and iPP?
Answer: The iPad uses a 13W Power Adapter while the Macbook Pro, depending on the size uses a 61/81W Power Adapter.
Using the Macbook charger with the iPad
This safe to do so and Apple does mention it in one of their articles, saying it might charge faster.

If you have a higher-wattage USB-C power adapter — such as the one that came with your Mac notebook — you can use it with iPad Pro, and you might see faster charging. You can also charge iPad Pro by connecting it to the USB-C port on your computer.

(Source)
Answer: There is no obvious reason why it shouldn't work, but no one can answer for sure until they've actually got their hands on one of the new iPad Pro models in a bit over a week.
Comment: I have read some comments about people complaining why Apple chose to go with the 18W charger instead of 30W fast charging adapters, so I figured if it's just a matter of wattage, one could easily use the same adapter as the MBP.


Map drive but only on workstations, not servers

Question: In our Windows domain I would like to map a file server's share to drive letter whenever an authenticated user logs in to a desktop, but not when a user (any user) logs into a server.  Is there a way to do this through GPO?  Basically a GPO based that matches user and computer?
Comment: Why would your users be logging into servers?
Comment: Administrators that manage applications do (not ADMINISTRATOR)
Comment: I think you can apply logon scripts via GPOs, so it may be possible to create the desired mappings based on the OU rather than the user profile.
Answer: One way to do this is to detect the operating system in the script and only map the drives if the operating system doesn't contain the word "server" in it.  (Perhaps with a Powershell (gwmi win32_operatingsystem).caption.)
Another is to apply a WMI filter on the group policy object assigning the logon object.  If you filter for select * from Win32_OperatingSystem where ProductType="1" this will limit the execution to client operating systems.

This WMI filter can be added where the GPO is linked.


Why there isn't a feature that lets any user on SO to request other user to answer their question?

Question: When I browse through other questions to find my answer, sometimes I'll find answers similar to what I'm looking for, and though they don't exactly answer my question, the author might be able to do so. Could we have a feature on SO that will let me request that another user answer my question, in case I find someone who could potentially answer my question?
Answer: This feature would not be very constructive.
If this feature was included, it would be a problem for the high-reputation users. And there is no need for this kind of feature. Questions get answers in just a few minutes in 90% of cases.
And there's always chat.
Comment: @vikas when closing a question as a duplicate, you *do* have to specify which question it is a duplicate of. The information is at the top of the question
Comment: user will have their setting to allow requests. then only the users who have kept their setting to allow, can receive request. its up to you whether you want request or not.....and chat is not allowed for low reputation users
Comment: @vikasdevde but its very low its just the 20 reputation just one or two good answer get you
Comment: there should also be a feature that the high rep users, who are closing questions, because of duplicate question, they should post the question, which according to them is duplicate of....isn't that unfair with low rep users?
Comment: no its not unfair not at all ... how would you like if a user just make the changes which is not good ... or upload some thing vulgar ..
Comment: what if it isn't vulgar? is this question contains anything vulgar? they can at least post a comment with the link to that duplicate question.
Comment: its not about you its about the other who really not much appreciate  the stackoverlow
Comment: @vikasdevde: so your solution to not being allowed to so much as enter a chat room is to instead be allowed to directly poke any user of your liking? Right. You haven't thought this one through, I'm afraid.


Parsing Office Documents

Question: I`d like to be able to read the content of office documents (for a custom crawler).
The office version that need to be readable are from 2000 to 2007. I mainly want to be crawling words, excel and powerpoint documents.
I don`t want to retrieve the formatting, only the text in it.
The crawler is based on lucene.NET if that can be of some help and is in c#.
I already used iTextSharp for parsing PDF
Answer: If you're already using Lucene.NET you might just want to take advantage of the various IFilters already available for doing this. Take a look at the open source SeekAFile project. It will show you how to use an IFilter to open and extract this information from any filetype where an IFilter is available. There are IFilters for Word, Excel, Powerpoint, PDf, and most of the other common document types.
Answer: There is an excelent open source project POI, only drawback - it is written for Java.
The .net port is somehow very beta.
Answer: Here is a good list of various tools for converting Word documents to plaintext, which you can then do whatever with.
Answer: Here's a nice little post on c-charpcorner by Krishnan LN that gives basic code to grab the text from a Word document using the Word Primary Interop assemblies.
Basically, you get the "WholeStory" property out of the Word document, paste it to the clipboard, then pull it from the clipboard while converting it to text format.  The clipboard step is presumably done to strip out formatting.
For PowerPoint, you do a similar thing, but you need to loop through the slides, then for each slide loop through the shapes, and grab the "TextFrame.TextRange.Text" property in each shape.
For Excel, since Excel can be an OleDb data source, it's easiest to use ADO.NET.  Here's a good post by Laurent Bugnion that walks through this technique.
Answer: You might also consider checking out DtSearch (www.DtSearch.com). Although it is primarily a searching tool, it does a great job of extracting text from a large number of file types and is considerably cheaper than other options like the Oracle/Stellent OutsideIn technology or the equivalent from Autonomy.
I've been using DtSearch for years and find it indispensible for this type of task.

Parsing Office Documents


What happens to an open file handle on Linux if the pointed file gets moved or deleted

Question: What happens to an open file handle on Linux if the pointed file meanwhile gets:

Moved away -> Does the file handle stay valid?
Deleted -> Does this lead to an EBADF, indicating an invalid file handle?
Replaced by a new file -> Does the file handle pointing to this new file?
Replaced by a hard link to a new file -> Does my file handle "follow" this link?
Replaced by a soft link to a new file -> Does my file handle hit this soft link file now?

Why I'm asking such questions: I'm using hot-plugged hardware (such as USB devices etc.). It can happen, that the device (and also its /dev/file) gets reattached by the user or another Gremlin.
What's the best practice dealing with this?
Answer: If the file is moved (in the same filesystem) or renamed, then the file handle remains open and can still be used to read and write the file.
If the file is deleted, the file handle remains open and can still be used (This is not what some people expect). The file will not really be deleted until the last handle is closed.
If the file is replaced by a new file, it depends exactly how. If the file's contents are overwritten, the file handle will still be valid and access the new content. If the existing file is unlinked and a new one created with the same name or, if a new file is moved onto the existing file using rename(), it's the same as deletion (see above) - that is, the file handle will continue to refer to the original version of the file.
In general, once the file is open, the file is open, and nobody changing the directory structure can change that - they can move, rename the file, or put something else in its place, it simply remains open.
In Unix there is no delete, only unlink(), which makes sense as it doesn't necessarily delete the file - just removes the link from the directory.

If on the other hand the underlying device disappears (e.g. USB unplug) then the file handle won't be valid any more and is likely to give IO/error on any operation. You still have to close it though. This is going to be true even if the device is plugged back in, as it's not sensible to keep a file open in this case.
Comment: I'm interested in one thing: if you use cp command to overwrite a file, is it the first case or the second case?
Comment: "_The file will not really be deleted until the last handle is closed._" interesting. thanks
Comment: I suppose that your second point applies equally if a containing directory of the file is deleted. Is that so?
Answer: File handles point to an inode not to a path, so most of your scenarios still work as you assume, since the handle still points to the file.
Specifically, with the delete scenario - the function is called "unlink" for a reason, it destroys a "link" between a filename (a dentry) and a file. When you open a file, then unlink it, the file actually still exists until its reference count goes to zero, which is when you close the handle.
Edit: In the case of hardware, you have opened a handle to a specific device node, if you unplug the device, the kernel will fail all accesses to it, even if the device comes back. You will have to close the device and reopen it.
Answer: I'm not sure about the other operations, but as for deletion: Deletion simply doesn't take place (physically, i.e. in the file system) until the last open handle to the file is closed. Thus it should not be possible to delete a file out from under your application.
A few apps (that don't come to mind) rely on this behavior, by creating, opening and immediately deleting files, which then live exactly as long as the application - allowing other applications to be aware of the first app's lifecycle without needing to look at process maps and such.
It's possible similar considerations apply to the other stuff.
Answer: if you want to check if the file handler(file descriptor) is okay, you can call this function.
/**
 * version : 1.1
 *    date : 2015-02-05
 *    func : check if the fileDescriptor is fine.
 */

#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>

/**
 * On success, zero is returned.  On error, -1  is  returned,  and  errno  is  set
 *      appropriately.
 */
int check_fd_fine(int fd) {
    struct stat _stat;
    int ret = -1;
    if(!fcntl(fd, F_GETFL)) {
        if(!fstat(fd, &_stat)) {
            if(_stat.st_nlink >= 1)
                ret = 0;
            else
                printf("File was deleted!\n");
        }
    }
    if(errno != 0)
        perror("check_fd_fine");
    return ret;
}

int main() {
    int fd = -1;
    fd = open("/dev/ttyUSB1", O_RDONLY);
    if(fd < 0) {
        perror("open file fail");
        return -1;
    }
    // close or remove file(remove usb device)
//  close(fd);
    sleep(5);
    if(!check_fd_fine(fd)) {
        printf("fd okay!\n");
    } else {
        printf("fd bad!\n");
    }
    close(fd);
    return 0;
}

Comment: What's the point of `if(!fcntl(fd, F_GETFL)) {` check? I guess you're looking for `EBADF` there. (You also probably forgot to initialize `errno` to 0).
Comment: This is not work for me. I have tried to use this approach with `open(O_WRONLY|O_APPEND)` - st_nlink always stay >= 1 while my descriptor is opened.
Answer: The in-memory information of a deleted file (all the examples you give are instances of a deleted file) as well as the inodes on-disk remain in existence until the file is closed.
Hardware being hotplugged is a completely different issue, and you should not expect your program to stay alive long if the on-disk inodes or metadata have changed at all.
Answer: The following experiment shows that MarkR's answer is correct.
code.c:
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <strings.h>
#include <stdio.h>

void perror_and_exit() {
  perror(NULL);
  exit(1);
}

int main(int argc, char *argv[]) {
  int fd;
  if ((fd = open("data", O_RDONLY)) == -1) {
    perror_and_exit();
  }
  char buf[5];
  for (int i = 0; i < 5; i++) {
    bzero(buf, 5);
    if (read(fd, buf, 5) != 5) {
      perror_and_exit();
    }
    printf("line: %s", buf);
    sleep(20);
  }
  if (close(fd) != 0) {
    perror_and_exit();
  }
  return 0;
}

data:
1234
1234
1234
1234
1234

Use gcc code.c to produce a.out. Run ./a.out. When you see the following output:
line: 1234

Use rm data to delete data. But ./a.out will continue to run without errors and produce the following whole output:
line: 1234
line: 1234
line: 1234
line: 1234
line: 1234

I have done the experiment on Ubuntu 16.04.3.
Answer: Under /proc/ directory you will find a list of every process currently active, just find your PID and all data regarding is there. An interresting info is the folder fd/, you will find all file handlers currently opened by the process.
Eventually you will find a symbolic link to your device (under /dev/ or even /proc/bus/usb/), if the device hangs the link will be dead and it will be impossible to refresh this handle, the process must close and open it again (even with reconnection)
This code can read your PID's link current status
#include <unistd.h>
#include <stdio.h>
#include <dirent.h>

int main() {
    // the directory we are going to open
    DIR           *d;

    // max length of strings
    int maxpathlength=256;

    // the buffer for the full path
    char path[maxpathlength];

    // /proc/PID/fs contains the list of the open file descriptors among the respective filenames
    sprintf(path,"/proc/%i/fd/",getpid() );

    printf("List of %s:\n",path);

    struct dirent *dir;
    d = opendir(path);
    if (d) {
        //loop for each file inside d
        while ((dir = readdir(d)) != NULL) {

            //let's check if it is a symbolic link
            if (dir->d_type == DT_LNK) {

                const int maxlength = 256;

                //string returned by readlink()
                char hardfile[maxlength];

                //string length returned by readlink()
                int len;

                //tempath will contain the current filename among the fullpath
                char tempath[maxlength];

                sprintf(tempath,"%s%s",path,dir->d_name);
                if ((len=readlink(tempath,hardfile,maxlength-1))!=-1) {
                    hardfile[len]='\0';
                        printf("%s -> %s\n", dir->d_name,hardfile);

                } else
                    printf("error when executing readlink() on %s\n",tempath);

            }
        }

        closedir(d);
    }
    return 0;
}

This final code is simple, you can play with linkat function.
int
open_dir(char * path)
{
  int fd;

  path = strdup(path);
  *strrchr(path, '/') = '\0';
  fd = open(path, O_RDONLY | O_DIRECTORY);
  free(path);

  return fd;
}

int
main(int argc, char * argv[])
{
  int odir, ndir;
  char * ofile, * nfile;
  int status;

  if (argc != 3)
    return 1;

  odir = open_dir(argv[1]);
  ofile = strrchr(argv[1], '/') + 1;

  ndir = open_dir(argv[2]);
  nfile = strrchr(argv[2], '/') + 1;

  status = linkat(odir, ofile, ndir, nfile, AT_SYMLINK_FOLLOW);
if (status) {
  perror("linkat failed");
}

  return 0;
}


NiFi Avro Kafka message nano-timestamp (19 digits) cast to timestamp with milliseconds

Question: I'm now facing an issue converting Kafka's message record of type long for nano-seconds (19 digits) to a string timestamp with milliseconds. The messages are coming in Avro format and contain different schemas (so we can`t statically define one schema) stored in Confluent Schema Registry. The current process is:
1) ConsumeKafkaRecord_2_0 which reads the message and stores the Avro schema coming from Confluent Schema Registry into avro.schema attribute
2) UpdateAttribute which is looking for a pattern of a timestamp record in the avro.schema and adds "logicalType":"timestamp-micros" (because i can`t find timestamp-nanos type in the Avro specification)
3) ConvertRecord which converts the Avro flowfile using avro.schema into JSON. It uses the logicalType assigned in the previous step and converts the 19 digits long into the yyyy-MM-dd HH:mm:SS.SSSSSS. Here the issue is that 19 digits is a nano-timestamp type which is missing in Avro specification, so we only can use timestamp-micros type and receive the year 51000+ values.
4) ReplaceText - this processor gives us a workaround for an issue described above and we are replacing the values of the 5-digits-year pattern with a "correct" datetime (with milliseconds, because Java somehow can`t work with microseconds) using and expression: ${'$1':toDate('yyyyy-MM-dd HH:mm:ss.SSSSSS'):toNumber():toString():substring(0, 13):toNumber():toDate():format('yyyy-MM-dd HH:mm:ss.SSS')}
After that we go on with other processors, the workaround works but with a strange issue - our resulting timestamps differ for a few milliseconds from what we receive in Kafka. I can only guess this is the result of the transformations described above. That`s why my question is - is there a better way to handle 19-digit values coming in the Avro messages (the schemas are in Confluent Schema Registry, the pattern for timestamp fields in schema is known) so that they are cast into correct millisecond timestamps? Maybe some kind of field value replacement (substring of 13 digits from 19-digit value) in Avro flowfile content based on its schema which is embedded/stored in avro.schema attribute?
Please let me know if something is unclear and if some additional details are needed. Thanks a lot in advance!
Comment: the problem appears when you try to convert string(with nanosec date) to date with following the format: `whatever.SSSSSS`. juva could return unexpected millis for this. in your expression you are just cutting off last three digits. So, just use a substring or replace...
Comment: @daggett the issue is that i can change the Avro schema logicalType for a known pattern of timestamp field, but i don`t know how i can substring the value in the avro content based on this pattern in the schema. That`s why i have to convert the type first to timestamp-millis or timestamp-micros (only those logical types are in Avro, no timestamp-nanos), and only then i can use the pattern with 5-char year number to "recalculate" the datetimes by converting them back to long ints, substring 13 digits, convert back to datetime.
Answer: The following solution worked for our case, a Groovy script which converts one avro file into another (both schema and content):
<code>@Grab('org.apache.avro:avro:1.8.2')
import org.apache.avro.*
import org.apache.avro.file.*
import org.apache.avro.generic.*

//function which is traversing through all records (including nested ones)
def convertAvroNanosecToMillisec(record){
    record.getSchema().getFields().forEach{ Schema.Field field ->
        if (record.get(field.name()) instanceof org.apache.avro.generic.GenericData.Record){
            convertAvroNanosecToMillisec(record.get(field.name()))
        }

        if (field.schema().getType().getName() == "union"){
            field.schema().getTypes().forEach{ Schema unionTypeSchema ->
                if(unionTypeSchema.getProp("connect.name") == "io.debezium.time.NanoTimestamp"){
                    record.put(field.name(), Long.valueOf(record.get(field.name()).toString().substring(0, 13)))
                    unionTypeSchema.addProp("logicalType", "timestamp-millis")
                }
            }
        } else {
            if(field.schema().getProp("connect.name") == "io.debezium.time.NanoTimestamp"){
                record.put(field.name(), Long.valueOf(record.get(field.name()).toString().substring(0, 13)))
                field.schema().addProp("logicalType", "timestamp-millis")
            }
        }

    }
    return record
}

//start flowfile processing
def flowFile = session.get()
if(!flowFile) return

try {

flowFile = session.write(flowFile, {inStream, outStream ->
  // Defining avro reader and writer
  DataFileStream<GenericRecord> reader = new DataFileStream<>(inStream, new GenericDatumReader<GenericRecord>())
  DataFileWriter<GenericRecord> writer = new DataFileWriter<>(new GenericDatumWriter<GenericRecord>())

  def contentSchema = reader.schema //source Avro schema
  def records = [] //list will be used to temporary store the processed records

  //reading all records from incoming file and adding to the temporary list
  reader.forEach{ GenericRecord contentRecord ->
      records.add(convertAvroNanosecToMillisec(contentRecord))
  }

  //creating a file writer object with adjusted schema
  writer.create(contentSchema, outStream)

  //adding records to the output file from the temporary list and closing the writer
  records.forEach{ GenericRecord contentRecord ->
      writer.append(contentRecord)
  }

  writer.close()

} as StreamCallback)

session.transfer(flowFile, REL_SUCCESS)
} catch(e) {
   log.error('Error appending new record to avro file', e)
   flowFile = session.penalize(flowFile)
   session.transfer(flowFile, REL_FAILURE)
}
</code>


Usage of "I am done"

Question: Why is I am reached incorrect while I am done is correct?
Ex: I reached office at 9am today is correct while I am reached at 9am is incorrect.
But I am done with this project is correct. Can someone please explain me the difference here?
Comment: @JamesK: your comment raises an interesting point. "give the book to me" -> "give me the book": why can't "explain the difference to me" become "explain me the difference"? Because **give** is ditransitive- it can take two objects- and **explain** is not. https://en.oxforddictionaries.com/definition/give
Comment: Note the word "explain" is followed by the thing that you are explaining. So you should say "explain the difference to me"
Answer: did and reached are both past forms: they can be used to make a simple past sentence:

I reached the office
  I did my homework

done and reached are both past participle forms. You can use a past participle to form one of the three perfect tenses:

I had reached the office...
  I have reached the office...
  I will have reached the office...

You can also use a past participle of a transitive verb to form a passive voice sentence:

I reach him - active voice
  He is reached - passive voice
  He is reached by me - passive voice

Note that the object him of the active voice sentence becomes the patient he in the passive voice sentence, and the subject I either disappears or becomes the agent attached with by
Looking at your two sentences:

I reached the office at 9am
  I am reached at 9am

In the first sentence, reached is the past form of reach. The sentence is past simple, active mood, with I as the subject - I reached the office.
In the second sentence, reached is a past participle form of reach. The sentence is simple present, passive mood, with I as the patient- something reached me. It sounds strange to use simple present to describe an event that happened in the past, but this technique is a perfectly acceptable narrative style.
Both sentences are grammatically correct, but the meaning of the second version is probably not what you intended.
If you look at the Cambridge Dictionary entry for done, you will find that it can be both a verb-form and an adjective. The reason that you can use I am done without switching to passive voice is that done can be used as an adjective. Here is a definition of the adjective form:

If something is done, or you are done with it, it is finished, or you have finished doing, using it, etc.

If you look in the same dictionary for reached, you will find that there is no adjective form.

Usage of "I am done"


perlbrew switch claims version is not installed

Question: I'm trying to downgrade my version of perl to 5.18.2 using perlbrew.
The installation terminates successfully (logs here and here), I can run the binary, it is listed as installed and when I try to install 5.18.2 again, perlbrew complains that it is already installed:
mb029:~ yueren$ perl5/perlbrew/perls/perl-5.18.2/bin/perl --version

This is perl 5, version 18, subversion 2 (v5.18.2) built for darwin-2level
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2013, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

mb029:~ yueren$ perlbrew list
   perl-5.18.2

mb029:~ yueren$ perlbrew install --notest 5.18.2

ABORT: perl-5.18.2 is already installed.

However, when I try to switch to 5.18.2 perlbrew complains that it is not installed:
mb029:~ yueren$ perlbrew switch 5.18.2
5.18.2 is not installed

Is there a way to fix this behaviour or at least get more information on why perlbrew switch thinks the version is not installed?
edit: Sorry, my mistake. The correct call is
perlbrew switch perl-5.18.2

Answer: Switch module is deprecated. See: perldoc

Switch
Switch is buggy and should be avoided. You may find Perl's new given/when feature a suitable replacement. See Switch statements in perlsyn for more information.

See: https://perldoc.perl.org/5.30.0/perlsyn.html#Switch-Statements
Comment: Does `perlbrew switch` have anything to do with the perl `Switch` module? I don't think so.


Philodendron (Philodendron bipinnatifidum maybe?) is turning into liquid

Question: I just got a Philodendron (Philodendron bipinnatifidum maybe?) and the plant was beautiful and lush and within a day of me getting it home it looked like it was rotten. Some of the leaves got brown and liquified and some of the leaves turned translucent. I have never seen this happen before. Can anyone help me? Thanks so much!!
Answer: Assuming that you live in an area where it is currently late winter, and given the looks of the leaves and the fact that the plant's collapse occurred within hours of your getting it home, I'd say that the plant has undergone a large temperature swing during its trip to your house - in fact, the "liquid" and translucent leaves possibly indicate that it froze.
According to The Ultimate Care Guide for that plant

Philodendron bipinnatifidum can survive outdoors as long as temperatures don't drop below 55 °F (13 °C). The plant is not tolerant to frost, which will wilt the leaves and damage the roots. Older, well-established plants might survive cool temperatures during winter.
As long as the roots have not been damaged by frost, your Philodendron should develop new growth in spring. However, it's best to note that repeated exposure to temperatures below 55 °F (13 °C) will stress the plant. It might not make a successful recovery the following year.