8/2 wire for 240v EV charger

Question: I have installed an EV level 2 charger in my garage. It is a 30 amp charger. It is around 8 feet away from the breaker box. I used 8/2 wire to be on the safe side for future possible upgrades and used a 2 pole 40 amp breaker, as required by the EVSE instructions.
The EV charger is working fine. The question I have is that the two hot wires are 8 gauge but the ground wire is a bare 10 gauge wire. Is this OK or should I replace the ground with an 8 gauge wire?
Comment: Does this answer your question? [Why are ground wires required to be so large if a short results in an immediate breaker trip?](https://diy.stackexchange.com/questions/148654/why-are-ground-wires-required-to-be-so-large-if-a-short-results-in-an-immediate), and [this answer](https://diy.stackexchange.com/a/151175/43874) specifically has the NEC chart that lists the conductor sizes.   You should be fine.
Comment: If the data plate on the charger calls for a 30A circuit, you should use a 30A breaker to protect it.  Using bigger wire is fine, but the breaker needs to be sized for the "appliance" requirements.
Comment: For "the next time" consider that it's usually easy to run conduit 8 feet, and if the device's terminals go to 75C (and your breakers do - mine do, certainly) you can carry more current on THHN in conduit than you can on "the same size wire" as a cable (limited to 60C rating.) In the case of 8 Ga copper, 50 rather than 40 A.
Comment: JPhil1618 Thank you for your reply. The appliance requires a 40 amp breaker. My concern is with the ground wire being thinner than the 2 hot wires.
Answer: Yes, a 10 AWG ground wire is fine for up to a 60A circuit.
The 8/2 Romex (NM) cable is good for amperage up to 40 amps. However, the breaker must match the socket / EV charger spec.  If the socket is a NEMA 6-30 or 14-30, the breaker must be 30A.  If the EV charger docs specify 30A breaker, then that must be so.
Again, the 8/2 cable is perfectly fine for 30A or really any size up to 40A.  So if your spec calls for a 30A breaker, you only need to change the breaker. 30A sockets will accept #8 wire.
It is possible that a 30A-nameplate charger might want a 40A breaker. The documentation will tell the tale.
Comment: Thank you so much for your help. So to make sure I have a good enough understanding of this thing, the ground wire is actually not in constant use and it is only there in case of a short or malfunction, that's why it does not need to be as thick as the 2 hot wires, right?
Comment: @Ali Correct.  Flow on equipment safety ground only occurs during fault conditions.
Comment: Thank you so much for your kind help. You guys are AWESOME.
Answer: #10 then is only good for 30 amps , correct this before too many people see this
As requested, correcting this: using the chart from https://diy.stackexchange.com/a/151175/18078
Comment: You are incorrect, and the question is more than 2 years old. But mostly, you're incorrect about the specific case of sizing of grounding conductors, which is the question here.
Comment: This does not provide an answer to the question. Once you have sufficient [reputation](https://diy.stackexchange.com/help/whats-reputation) you will be able to [comment on any post](https://diy.stackexchange.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/160319)

8/2 wire for 240v EV charger


Let user change configuration parameter

Question: In Java web application, I have some configuration parameters that I keep in config file. For example frequency of calling a particular method.
I want to let user change this using a UI. So, how and where such parameters should be defined so that user can change them and changed value comes in effect without need to redeployment.
Further explanation:
Lets say I have a java servlet that takes the back up of few files. I have scheduled this to run daily at noon. Now I want to let user change the time at which he wants to run backup using a interface (web page) that allows to specify new time.
So, how really should I declare this time in application. In a config file ? As a environment variable or something else so that the new changed value comes into effect without deploying the application.
Hope this explains things better.
SOLUTION:
Just to share with everyone... found this post which answers most of my concerns.
LINK
Comment: Answer is Yes. But difficult to say anything further without seeing the code.
Comment: This is not an answerable question. It's too broad, and any answer will depend on your application about which you've said nothing. Create some code and come back with a focused, answerable question.
Comment: Sorry about that. Let me try to explain it further with a edit
Answer: I would suggest you to modify your implementation to achieve this efficiently. Store the parameter for scheduler in your database. Once the user selects from UI, insert into the database.
Now, instead of config file, make your scheduler read from that column in db. No deployment required.
Comment: Thanks a lot. Yea that should work. Is there any other way we can achieve this without using DB ?
Comment: Property files. Won't require a redeployment, but are prone to errors as compared to DB approach.
Comment: So to achieve this using properties files . When user changes the value, we will effectively be modifying/rewriting that value in the properties file ? And how is it not a good practice ?
Comment: And don't we need to reload the properties file ? Is there any way to auto reload ?
Comment: Unless you are caching the values, you don't need to reload. You refer to them everytime your program executes. For any modification you need to write back to file.
Comment: Thanks! .. not able to upvote your answers as I am new here (need at least 15 reputation)... But anyways I think using DB must be more secure and better approach by all means .. What do you suggest ?
Comment: Yes.. writing to db is the better approach. Rather secure and reliable.

Let user change configuration parameter


Can I re-battle the other Mega Men in any way?

Question: I can easily refight all the Pseudoroids like Bifrost, Chronoforce and Buckfire by going back to where they spawned as bosses, but is there any way to fight the other Megamen like Aeolus and Atlas? Going back to where they were doesn't work, and they're not part of the Boss Rush in the final area either.
Is there any way to fight them again or are they only once per playthrough?
Comment: @RavenDreamer basically yes, partially to practice for Hard and mostly for fun
Comment: You just want to fight them, or what?
Answer: You can fight them again in Boss Survival Mode (finish the game with both characters) and Boss Battle Mode (beat Boss Survival Mode), where you can choose which boss to fight.
The difficulty for Boss Battle Mode is always set to Expert, but you will still have your two subtanks.
The Boss Survival Mode order is:
Diaburn -> Chronoforce -> Rosespark -> Condorock -> Kaisemine -> Bifrost -> Tesrat -> Argoyle & Urgoyle -> Atlas -> Siarnaq -> Thetis -> Helios -> Model ZX -> Prometheus & Pandora -> Albert.
Comment: That'll have to do, forgot about that mode (replaying after losing my 100% complete cartridge :c)


Please help to solve Invalid Binary issue

Question: Just received this from app store today.

Dear Developer,
We have discovered one or more issues with your recent binary
  submission for "KwikTap Mobile". Before your app can be reviewed, the
  following issues must be corrected:
Invalid Code Signing Entitlements - The signature for your app bundle
  contains entitlement values that are not supported.
Specifically, value "4J8CVAF9MB.*" for key
  "com.apple.developer.ubiquity-kvstore-identifier" in QR Code Scanner
  is not supported.
Once these issues have been corrected, go to the Version Details page
  and click Ready to Upload Binary. Continue through the submission
  process until the app status is Waiting for Upload and then use
  Application Loader to upload the corrected binary.
Regards,
The iTunes Store Team

Is there anyone who can help in this matter? Your feedback will be most welcomed
Kindest Regards
Comment: Possible duplicate: http://stackoverflow.com/q/6427735/398460
Answer: Have you tried using "." for the "com.apple.developer.ubiquity-kvstore-identifier" entitlement?
Like "4J8CVAF9MB.com.example.myapp".
Also have you checked that "4J8CVAF9MB" is your exact team id?


Door handle fell off — and we can't find a replacement screw

Question: Our door handle fell off — the screw keeping it on the handle fell out, and we couldn't find it anywhere. We've tried every possible screw at Lowe's, but I guess this is special/proprietary in some way?
Answer: The screw is still there:
Your original pic:

Enhanced for clarity:

You need to find a small Allen Wrench which fits the socket in the end of this grub screw.
Slide the door handle back on, then use the Allen-Wrench to back the screw out 1 or 2 turns so that it grips into the hole in the door handle.
What probably happened is that this screw was turned in a little more than necessary when the handle was installed, and now over time the 'pipe' part of the door handle which slides over the 'shaft' of the latch mechanism has worn or expanded slightly - just enough that the end of the screw still sticking out of the shaft no longer grips in the hole in the side of the 'pipe'.
If the screw feels loose when you turn it, then it would probably be a good idea to use a drop of thread locker to make sure the screw doesn't wiggle out in future.
Comment: Or get a longer set screw.
Comment: @Oddthinking the "hole" IS the grub screw. Look slightly farther out instead to see the actual hole.
Comment: Anyway, it's almost certainly not proprietary. All of the modern locks that I know of sold in Chile, where I live, use metric thread (m4-m6) for these set bolts.
Comment: I agree. Fiddle with contrast and brightness and I believe you can see the hex recess. OP (Jenn): it appears to be an Allen-type screw with a hex recess (rather than slot or cross) which you're mistaking for a hole. It's fairly common to find this used where a tight connection is required.
Comment: "a drop of thread locker" - but not a strong one; Loctite 222 (purple) would work. Otherwise, the hex socket may well round out before you can remove it.
Comment: I'm not saying you are wrong, but I cannot see the black grub screw in the black hole in that photo (even after adjusting the levels in Photoshop). So now I am dying to hear back from the OP whether it is turns out it is actually in there, despite the low stakes.
Comment: Your patience in explaining this is commendable.
Comment: @fectin (and Mark): Ohhhhhhh! Thank you.
Answer: They are normally set screws (grub screws), without a visible head.  If you have another door handle, then remove the screw from there to find a replacement.

Door handle fell off — and we can’t find a replacement screw


How to clean up git repository for open source release

Question: I plan to release the code of a HoloLens application to GitHub. I developed it at university and am allowed to make it public since august 2019. I was hired to further develop it. Unfortunately I kept developing in the same repository after this. All commits after a specific one are thereby owned by the university and I might run into legal trouble if anything from there will land in the public repo.
How can I be sure, that everything except the master branch and after a specific commit is completely gone from a repo before pushing it on github?
Thanks in advance :)
Answer: In 4 steps:

Create new banch: git branch github <COMMIT_SHA>.
Checkout this banch: git checkout github.
Create github remote: git remote add -t github github <UrlToRepo>
Push new repo: git push -u github master
Comment: Thank you :) thats pretty much what I did. This is enough? Great :)


Replace glass on Andersen patio door

Question:
One pane of glass on my Andersen patio door was shot out by Black Bart with his Red Ryder.  The grid is between the two panes of glass, and the damaged one is just a window (doesn't swing).
Rep at the hardware store states his only solution is to replace the entire panel for a mere $1500.  We can speculate with the best of them, so my question is: does anyone have experience replacing glass (only) on this door and how was it done?
Comment: Typically there is argon gas between the glass panes to help insulate as well as prevent condensation from developing between the panes, especially in colder climates.  I'm sure it's possible to DIY, the trick is making sure it's fully sealed when you are done.
Comment: Have you contacted Andersen?
Comment: I'd speak directly to Andersen. We dropped a shower door when adjusting it (it had been in place for 10 years). It was another of the brands that mainly are available through Home Depot. Home Depot said our only option was to replace the whole shower, which was about $1,200. I Rang the company direct and they sent out a full new glass enclosure as ours was out of production. They even covered freight!
Comment: No I haven't because their published solution is to replace the panel and they have no info posted on how to replace glass.  https://helpcenter.andersenwindows.com/aw/s/article/Broken-Glass
Comment: Are either of the panes actually damaged or cracked? If not, you could do what we did and drill a small hole top and bottom then draw dried air through until the moisture has been removed and seal.
Comment: When you say "glass only" do you actually mean just the outer glass pane? IMO, although, technically, you could replace a single pane, you would not be able to do it without trapping moisture, and it would be a huge PITA. Realistically, the only option is replacement of the sealed unit (2x panes + Al channel + grid), although $1500 seems steep. I've replaced one half this size for £175.
Comment: I've never done that particular door but I have done windows that appeared unrepairable. I removed them, brought them to the glass shop, had them measured and returned with the window when the panel was in. How they got the panel in and out I don't know. I would check a few glass shops, I would think you can do much better than $1,500. Going through Anderson for the glass with an Anderson certified installer is going to be your most expensive option.
Answer: You might find a local glass company that can make a sealed pane unit like that for you and include the faux-divided light grid. They might even be able to include the one from your original window.
By the time they're done building the window unit, disassembling the stationary door, installing the glass, replacing the trim and any trim that may have broken, repainting, etc, you may find that you're pretty close to the $1500 to get a unit from Andersen and that it probably won't come with the same warranty your original unit had or that a replacement would come with. It probably wouldn't be built to quite the same standard you're expecting, either.
Speaking of warranty, you may want to contact Andersen about it. Our windows (not Andersen) come with a lifetime warranty that includes damage to the glass (from any source, so they claim). If that were to have happened to me, in theory, all I have to do is call the manufacturer and they'll build me a replacement sash and send it out with a tech to install it. Andersen may have something similar.
No, you can't have the name of my window mfgr. They did such a terrible job with the original install, that I'm not certain I'd actually call them for a warranty issue, but that's a totally different question.
Comment: "Andersen _may_ have something similar." (emphasis added), so no, it seems @nobody read the warranty page.
Comment: Some "lifetime" warranties extend only to the original purchaser. A subsequent owner of the house may not be covered.
Comment: That's true, @DavidSupportsMonica. Based on OPs information we don't know if he's the original purchaser or not.
Comment: Did anybody bother to read the OP's link? The Andersen warranty *is* transferable but very specifically excludes this broken glass situation: "Broken glass in your Andersen® window or patio door is not covered under the Andersen® Owner-2-Owner® Limited Warranty."
Comment: Thanks--I have two nephews that work with glass, but they are young and haven't run into anything like this.  We will probably try to take it apart and see what happens.  Hoping to find a junk one at the retailer to practice on first.

Replace glass on Andersen patio door


How do you solve angular typescript errors in d.ts files? Specifically msal

Question: I am using Msal (https://github.com/AzureAD/microsoft-authentication-library-for-js) with the latest angular setup including Typescript 3.1.1 and I get the following error:
ERROR in node_modules/msal/lib-commonjs/UserAgentApplication.d.ts(35,9):
error TS2717: Subsequent property declarations must have the same type.
Property 'callBackMappedToRenewStates' must be of type 'any', but here has type '{}'.

Looking at the code in the node module I can see the problem but obviously I would rather not edit this file or create a custom typing file just to fix this issue. What should I do?
Answer: tsconfig can take a skipLibCheck property which will skip type checking in all declaration files. Going with this until msal gets fixed - dont really want it as it does silence all errors for all packages.
Answer: You should check if you're using the right version of Typescript for this library.
If you are, ignore Typescript errors with // @ts-ignore or any type declarations, and wait for a fix.
Comment: Yeah they want 2.5.3 whereas I have 3.1.1 so that makes sense - but they seem to have their own tsconfig in the node module and I think thats why my setting "noImplicitAny": false did not work.
Comment: Big thanks for answering, it really helped a lot but I found a 'correct' solution so im going to put my own answer.


CRM Dynamics 2011 Custom Workflow Activity

Question: I have an issue with my CRM Workflow which I wrote a workflow activity for and added it as a step in my CRM workflow. The custom workflow references a WCF service which queries data using EF.
I understand well about configuring my endpoint bindings in code and all. All is well until I deploy the workflow and try to run in from CRM. I get the following error

Type 'Microsoft.Crm.Extensibility.InprocessServiceProxy' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. If the type is a collection, consider marking it with the CollectionDataContractAttribute. See the Microsoft .NET Framework documentation for other supported types.

It seems to not be able to serialize the objects properly. I have looked everywhere on the web but no luck at all.
Comment: my actual service doesn't have any properties to serialize. I am failing to serialize CRM Input Parameters.
Answer: If you are going to send data through WCF you need to make your attributes serializables, something like this:
<code>[Serializable]
[DataContract(Namespace = "Some.Name.Space")]
public class ClassResponse
{
     [DataMember]
     public string Error { get; set; }
}
</code>
Comment: Hi Sxntk, my actual service doesnt have any properties to serialize. I am failing to serialize CRM Input Parameters. Please see below                              [DataMember]
[Input("Brand")]
[AttributeTarget("tcn_brand", "tcn_brandid")]
public InArgument Brand { get; set; }

[DataMember]
[Input("Directory Path")]
public InArgument DirectoryPath { get; set; }

 [DataMember]
[Input("File Name")]
public InArgument FileName { get; set; }
Comment: Write your code or at least, the part when you call the service.


Which cards are legal in MTG Arena's pauper format?

Question: MTG Arena doesn't seem to have information available on which cards are legal in its Pauper format.  Does this format only allow cards which have had Common rarity in MTG Arena itself?  Or is it simply Standard Pauper?  I'm not sure if that's the same thing or not—I just started playing Arena recently and am not sure if there has been a set rotation since it began.  I have noticed some cards being played at Uncommon rarity but I think they all have Common printings from another set which are still Standard-legal.
Jon N points out that with the Arena Deckbuilder's Advanced filter set to only show commons, some uncommons will nonetheless appear.
Answer: Although there is no official format definition for Arena, Pauper as an older format has always been defined as: "cards with a common printing in allowed sets". So in Arena, this could be translated as:
Any card which has a common printing in Standard (i.e. sets which are legal in Arena), no matter if the specific printing of the card is in other rarity.
Having said that, I don't think currently there is a card with printings at different rarity in Standard sets.


UVa Online judge-3n+1probelm(Wrong answer)

Question: I am pretty sure my program works,because it gives mw the same result as uv-output. But it said my answer is wrong. Some of you might know about this site. I'm still beginner and inexperienced, so I hope to have some help. Perhaps something that I miss about that problem.
this is the probelm link >>
(http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=3&problem=36&mosmsg=Submission+received+with+ID+13417700)
Here's my  code.
import java.io.*;
import java.util.Scanner;

class Main {
    public static void main(String[] args) throws FileNotFoundException  {
        Main myWork=new Main();
        File inputFile=new File("input.txt");
        if(inputFile.exists()){
            Scanner scan=new Scanner(inputFile);
            while(scan.hasNext()){
                int i=scan.nextInt();
                int j=scan.nextInt();
                int count =0;
                for(int x=i; x<=j;++x){
                    int y= myWork.doAlgorithem(x);
                    if(count <y)
                        count=y;

                }
                System.out.println(i+" "+j+" "+count);
            }}
        System.exit(0);
    }
    public static int doAlgorithem(int i)
    {
        int count=1;

        while( i != 1){
            if(i % 2 != 0){
                count++;
                i= i*3 +1;
            }
            else
            {
                count++;
                i /=2;
            }
        }
        return count;
    }
}

Comment: @Naruto `return 0` from a `void` method? In any case, that cannot possibly cause a problem in this case
Comment: First of all when you complete main , just return 0. do not use System.exit(0).
Comment: Please format your code and add a description of the problem statement. A link to the problem would also be nice.
Comment: sorry my mistake. it's java. so don't return but don't use System.exit(0).
Comment: @NiklasB here is the link for the problem >>
(http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=3&problem=36&mosmsg=Submission+received+with+ID+13417700)
Comment: I think it might have to do with a corner case. Isn't 1 1 supposed to return 2? Yours returns 1.
"For each pair of input integers i and j you should output i, j, and the maximum cycle length for integers between and including i and j."
Comment: @Yarneo i am not sure that i understand that it have to return 2 in 1 1 case :/ !!
Comment: Well it seems that the cycle length includes both numbers, so even in 1 1 it would seem that they might be looking for the answer 2.
Comment: @Yarneo i tried what you said, but still give me wrong error :(
Comment: Well honestly, I always don't like these online judge things just because they are sometimes filled with very odd and unthinkable corner cases. Sorry I couldn't be of more help.
Comment: no you shouldn't be :D thank you very much because you tried :) that's enough for me :D @Yarneo
Answer: I believe the problem with your solution is that you assume that the first integer is always smaller than the second.
Whey you are solving programming problems from / based in contests, you should never make any assumptions.
Try your code with these cases, extracted from here.
1 10
100 200
201 210
900 1000
1000 900
999999 999990

The output should be:
1 10 20
100 200 125
201 210 89
900 1000 174
1000 900 174
999999 999990 259


media query cant get to work for IE any version

Question: Been playing around with media queries and thought I understood how it worked.
I have the following code in my HTML:
<link rel="stylesheet" type="text/css" media="screen and (min-width: 0px)" href="mobile.css">
<link rel="stylesheet" type="text/css" media="screen and (min-width: 350px)" href="tablet.css">
<link rel="stylesheet" type="text/css" media="screen and (min-width: 1050px)" href="screen.css">

Basically using a different css stylesheet depending on the size of the screen.
Works great with firefox and chrome.  Doesn't work at all with IE.
Not even with version 11 that I downloaded today.
In fact IE appears to ignore all the link's and no styling at all is applied.
Have tried for versions 8 and 9 but same problem.
Any one know the reason for this ? Is there a syntax difference for IE ?
Comment: Cause of problem.  Buggy IE11.
It was using version IE7 of IE from my komodo editor.
Not sure why this occurred.
Perhaps it keeps settings based on the last visited website ?
 I think the debugging tools are a little bit buggy at the moment.  I got the whole browser to crash when I tried to look at the network traffic tab.
Answer: Use css3-mediaqueries-js. This library emulates media queries.
Answer: Try closing the link elements, Internet Explorer is (rightly) a stickler for proper HTML so it might be that.
e.g.
<link rel="stylesheet" type="text/css" media="screen and (min-width: 0px)" href="mobile.css" />
<link rel="stylesheet" type="text/css" media="screen and (min-width: 350px)" href="tablet.css" />
<link rel="stylesheet" type="text/css" media="screen and (min-width: 1050px)" href="screen.css" />


My listview is Updating when scrolling up and down in android?

Question: My Listview is Updating when I scroll up and down and the image in the list item is updating every time. How can I overcome that problem?
this is Adapter class
public class CustomAdapter extends BaseAdapter {

    ArrayList<String> p_id;
    ArrayList<String> p_name;
    Context context;
    ArrayList<String> imageId;
    ArrayList<String> wash_v;
    ArrayList<String> dry_v;
    ArrayList<String> iron_v;
    Holder holder;
    Typeface tf;
    ProgressDialog dialog;
    Intent i;
    float washItemCount = 0.0f;
    private static LayoutInflater inflater = null;

    Handler handler;
    Runnable myRunnable;

    public CustomAdapter(Context con, ArrayList<String> pid,
            ArrayList<String> pname, ArrayList<String> pimg,
            ArrayList<String> wash, ArrayList<String> dry,
            ArrayList<String> iron) {
        p_id = pid;
        context = con;
        p_name = pname;
        imageId = pimg;
        wash_v = wash;
        dry_v = dry;
        iron_v = iron;
        inflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    }

    @Override
    public int getCount() {
        return imageId.size();
    }

    @Override
    public Object getItem(int position) {
        return position;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    public class Holder {
        TextView tv1, tv2, tv3;
        ImageView img;
        LinearLayout ll1, ll2, ll3;
    }

    @SuppressLint("UseValueOf")
    @Override
    public View getView(final int position, final View convertView,
            ViewGroup parent) {
        holder = new Holder();

        final View rowView;

        rowView = inflater.inflate(R.layout.dynamic, null);
        holder.ll1 = (LinearLayout) rowView.findViewById(R.id.ll1);
        holder.ll2 = (LinearLayout) rowView.findViewById(R.id.ll2);
        holder.ll3 = (LinearLayout) rowView.findViewById(R.id.ll3);
        holder.tv1 = (TextView) rowView.findViewById(R.id.tv1);
        holder.tv2 = (TextView) rowView.findViewById(R.id.tv3);
        holder.tv3 = (TextView) rowView.findViewById(R.id.tv5);
        holder.img = (ImageView) rowView.findViewById(R.id.ivImage);

        final TextView tvVal = (TextView) rowView.findViewById(R.id.tvVal);
        final TextView tvVal1 = (TextView) rowView.findViewById(R.id.tvVal1);
        final TextView tvVal2 = (TextView) rowView.findViewById(R.id.tvVal2);

        holder.tv1.setText(wash_v.get(position));
        holder.tv2.setText(dry_v.get(position));
        holder.tv3.setText(iron_v.get(position));

        holder.ll1.setTag(new Integer(position));
        holder.ll2.setTag(new Integer(position));
        holder.ll3.setTag(new Integer(position));

        i = new Intent("com.example.safewash");
        final String image = imageId.get(position).toString();
        Log.i("Image in String", "" + image);

        holder.ll1.setOnClickListener(new OnClickListener() {

            @SuppressLint("NewApi")
            @Override
            public void onClick(final View v) {
                int count = 0;
                int colorStart = Color.LTGRAY;
                int colorEnd = 0;

                ValueAnimator animator = ObjectAnimator.ofInt(v,"backgroundColor", colorStart, colorEnd);
                animator.setDuration(800);
                animator.setEvaluator(new ArgbEvaluator());
                animator.setRepeatCount(0);
                animator.start();

                String washItem = wash_v.get(position);
                int washItems = Integer.parseInt(washItem);

                if (washItems != 0) {

                    washItemCount = Float.parseFloat(washItem);
                    i.putExtra("washItemCount", washItemCount);
                    context.sendBroadcast(i);
                    tvVal.setVisibility(View.VISIBLE);

                    count = Integer.parseInt(tvVal.getText().toString());
                    int countVal = ++count;
                    tvVal.setText("" + countVal);

                }

            }

        });
        holder.ll2.setOnClickListener(new OnClickListener() {

            @SuppressLint("NewApi")
            @Override
            public void onClick(final View v) {
                int count = 0;
                String washItem = dry_v.get(position);
                int colorStart = Color.LTGRAY;
                int colorEnd = 0;

                ValueAnimator animator = ObjectAnimator.ofInt(v,
                        "backgroundColor", colorStart, colorEnd);
                animator.setDuration(800);
                animator.setEvaluator(new ArgbEvaluator());
                animator.setRepeatCount(0);
                animator.start();
                washItemCount = Float.parseFloat(washItem);
                int washItems = Integer.parseInt(washItem);
                if (washItems != 0) {

                    washItemCount = Float.parseFloat(washItem);
                    i.putExtra("washItemCount", washItemCount);
                    context.sendBroadcast(i);
                    tvVal1.setVisibility(View.VISIBLE);
                    count = Integer.parseInt(tvVal1.getText().toString());
                    int countVal = ++count;
                    tvVal1.setText("" + countVal);
                }

            }

        });

        holder.ll3.setOnClickListener(new OnClickListener() {

            @SuppressLint("NewApi")
            @Override
            public void onClick(final View v) {

                int count = 0;

                int colorStart = Color.LTGRAY;
                int colorEnd = 0;

                ValueAnimator animator = ObjectAnimator.ofInt(v,
                        "backgroundColor", colorStart, colorEnd);
                animator.setDuration(800);
                animator.setEvaluator(new ArgbEvaluator());
                animator.setRepeatCount(0);
                animator.start();
                String washItem = iron_v.get(position);
                washItemCount = Float.parseFloat(washItem);
                int washItems = Integer.parseInt(washItem);
                if (washItems != 0) {

                    washItemCount = Float.parseFloat(washItem);
                    i.putExtra("washItemCount", washItemCount);
                    context.sendBroadcast(i);

                    tvVal2.setVisibility(View.VISIBLE);
                    count = Integer.parseInt(tvVal2.getText().toString());
                    int countVal = ++count;
                    tvVal2.setText("" + countVal);

                }
            }
        });

        ImageDownloadTask imageDownloadTask = new ImageDownloadTask();
        imageDownloadTask.execute(image);

        return rowView;
    }

    public class ImageDownloadTask extends AsyncTask<String, Void, Bitmap> {

        @Override
        protected Bitmap doInBackground(String... urls) {
            Bitmap map = null;
            for (String url : urls) {
                map = downloadImage(url);

                Log.i("BitMap in DoinBackGround::", "" + map);
            }
            return map;
        }

        @SuppressWarnings("deprecation")
        @Override
        protected void onPostExecute(Bitmap result) {

            BitmapDrawable ob = new BitmapDrawable(context.getResources(),
                    result);

            holder.img.setBackgroundDrawable(ob);
            super.onPostExecute(result);
        }

    }

    public Bitmap downloadImage(String url) {
        Bitmap bitmap = null;
        InputStream stream = null;
        BitmapFactory.Options bmOptions = new BitmapFactory.Options();
        bmOptions.inSampleSize = 1;

        try {
            stream = getHttpConnection(url);
            bitmap = BitmapFactory.decodeStream(stream, null, bmOptions);

            stream.close();
        } catch (IOException e1) {
            e1.printStackTrace();
        }
        return bitmap;
    }

    private InputStream getHttpConnection(String urlString) throws IOException {
        InputStream stream = null;
        URL url = new URL(urlString);
        URLConnection connection = url.openConnection();

        try {
            HttpURLConnection httpConnection = (HttpURLConnection) connection;
            httpConnection.setRequestMethod("GET");
            httpConnection.connect();

            if (httpConnection.getResponseCode() == HttpURLConnection.HTTP_OK) {
                stream = httpConnection.getInputStream();
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return stream;
    }

}

Comment: remove all the image download related code and replace with http://square.github.io/picasso/
Comment: try to put `static` before your `Holder`class. see this link for more info http://developer.android.com/intl/zh-cn/training/improving-layouts/smooth-scrolling.html
Answer: wrong holder pattern
try this code:
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    if(convertView == null){
        convertView = mInflater.inflate(R.layout...., null);
        holder = new ViewHolder();

        holder.img = (ImageView) convertView.findViewById(R.id....);

        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }

    // set row code
}

and you can use image loading library.(fast & useful ...)
if you have imageurl, you can replace to AUIL. (instead of ImageDownloadTask)
Android-Universal-Image-Loader : https://github.com/nostra13/Android-Universal-Image-Loader
example :
ImageLoader.getInstance().displayImage(imageId.get(position).toString(), holder.img, YOUOPTION);

Comment: Or volley and presso ...etc.  whatever
Comment: i am getting this exception like
Comment: at com.nostra13.universalimageloader.core.ImageLoader.checkConfiguration(ImageLoader.java:568)
Comment: You have to make imageloader configuration


How can I prove that a number of the form $2^{2n}-1$ is divisible by 3?

Question: How can I prove that for each positive integer $n$ the number $2^{2n}-1$ is divisible by $3$? $3$?
Answer: Let $u_n:=4^n-1$ so $u_0=0$ while $u_{n+1}=4u_n+3$. Then $3|u_n$ follows by induction.
Answer: You can use induction on $n$. Define $a_n = 2^{2n}-1$. Then for $n = 1$, we have $3|a_1 = 3$. Now suppose, inductively, $n \ge 2$ and the argument holds for all $n$. Then, for $n+1$, we have
$$a_{n+1} = 2^{2n+2}-1 = 4 \cdot 2^{2n}-1 = 3\cdot2^{2n}+(2^{2n}-1) = 3\cdot2^{2n}+a_n$$
Now, by inductive hyphothesis, we have $3|a_n$ and obviously $3|3 \cdot 2^{2n}$. Therefore, we have $3|a_{n+1}$. So by induction, argument holds for all $n$.


What is the role of Glommer?

Question: In Don't Starve: Reign of Giants, you can pick a Glommer Flower from Glommer's Statue during a Full Moon to make Glommer follow you.
What's the point? Is it for cuteness's sake, or is there any strategic advantage whatsoever?
Answer: From the Don't Starve wiki:

When tamed, Glommer provides a Sanity aura of +6.25/min, making it useful in countering the nighttime sanity drain of -5/min. It will also drop Glommer's Goop once every 2–4 days.

As for Glommer's Goop:

Other than its use as fuel for a Fire (with a fuel value equivalent to Boards), it can be eaten, providing 40 health and around 9 hunger, but decreasing sanity by 50.

When killed, it drops Glommer's Wings:

Glommer's Wings are a nonperishable item dropped by Glommer used to craft the Old Bell. It is renewable as the player can obtain one each Full Moon by killing Glommer.
The Wings can also be used as fuel for fires or the Ice Flingomatic.

But note that killing Glommer will immediately summon Krampus.

What is the role of Glommer?


A question about derivative

Question: $f(x)=\int_{0}^{x}\cos(1/t)dt$
Then$f'(0)=?$
I tried $f'(x)=\cos\left(1/x\right)$, but then I get into trouble.
Hope for your help
Answer: You need to go back to the definition:
$$f'(0)=\lim_{x\to0}\frac{f(x)-f(0)}{x}=\lim_{x\to0}\frac1x\int_0^x\cos(1/t)\,dt.$$
Now the integrand oscillates like crazy near the origin, and it's not unreasonable to guess that the limit will be zero.
To prove it, I suggest the substitution $t=1/s$ in the integral, then use $\lvert\cos s\rvert\le1$. Can you take it from there?
(Edit: Fixed typo in the very first formula.)
Answer: You could try integration by parts:
$$
\int_0^x\cos(1/t)dt=-t^2\sin(1/t)|_0^x+2\int_0^xt\sin(1/t)dt.
$$
Both terms are $O(x^2)$.
Comment: @Bacon I integrated the cosine not 1: $$\cos(1/t) = -t^2\frac{\cos(1/t)}{-t^2}=-t^2\frac{d}{dt}\sin(1/t)$$.
Comment: After I posted that I thought perhaps you'd chosen a different $dv$ in the partial integration. My mistake - Thanks!
Comment: shouldn't it be $$
\int_0^x\cos(1/t)dt=t\cos(1/t)|_0^x+\int_0^x \frac{1}{t}\sin(1/t)dt.
$$

A question about derivative


currentKeyboardState pressed

Question: I am working on a game tutorial with XNA but I am modifying it slightly. Instead of adding projectiles to an array based on a duration, I am trying to add them to the array by pressing the SpaceBar. So this way the user has some control over firing the missiles.
  if (currentKeyboardState.IsKeyDown(Keys.Space))
  {
      AddProjectile(player.Position + new Vector2(player.Width / 2, 0));
  }

   private void AddProjectile(Vector2 position)
   {
       Projectile projectile = new Projectile();
       projectile.Initialize(GraphicsDevice.Viewport, projectileTexture, position);
       projectiles.Add(projectile);
   }

However I am running into a minor problem. Since I am using the method IsKeyDown() missiles will be added to the projectiles array until the space bar is released. Is there a method that will register a key press rather than IsKeyDown().
Answer: Add a field that keeps track of the previous keyboard state
KeyboardState _previousKeyboardState = Keyboard.GetState();

You will update this state at the end of the Update. You can now do edge detection:
KeyboardState currentKeyboardState = Keyboard.GetState();
if(_previousKeyboardState.IsKeyUp(Keys.Space)
   && currentKeyboardState.IsKeyDown(Keys.Space))
{
    //action
}
_previousKeyboardState = currentKeyboardState; //update previous state

The thinking is: If on previous pass the key had not been pressed, but now it is pressed, do this action.
Comment: Very clever, this should work. I will give it a run and let you know how it works out.

currentKeyboardState pressed


Stuck on SOMA level

Question: I'm playing SOMA, and I'm around 2-3 hours into the game. The guides for some reason don't seem to make sense, they talk about events I haven't passed and I'm not sure where this part is covered, I'm not sure if I've skipped something.
I'm supposed to find an escape vehicle or something, not exactly sure what. But there's a... thing in the region that keeps killing me, I've tried to outrun it and find an exit, but there doesn't appear to be one. Not sure what I'm supposed to do.
Comment: Just run down the ladder. Then go through that central room, somwhere in hallway you will find a room with escape pod. Press button to close the door and leave. I did automatically so don't remember details.
Comment: When you get to the pod you will be told to switch off the power on the CURIE so you have to go back to do so. After that there will be a funny scene involving you running from the bastard and barely escaping from the guy so in fact you won't push any buttons on the pod since it will be part of a cutscene.
Comment: I had to resort to using the video walkthroughs to get out of a couple places as all the written ones didn't match up with what had actually happened.
Answer: If you listen to the hints you can figure out that you must not look at this guy. He is not too fast but if you see him just look away and try to keep the distance from him. The sounds will help.
I don't want to spoil the fun for you but I believe that Catherine tells you that the shuttle is blocked by CURIE for some reason so you have to turn the power off on the ship.
It is really not that hard to find. Again I don't want to spoil the fun but if you find the room where the reactor is you have to do something...witty. You don't have to do anything anywhere else. I don't remember right exactly but I think you also have to pull some lever to be able to reach the escape shuttle. So in general:

Find a way (I think it was a lever somewhere) to get to the shuttle
Once you get in there you will be told to switch off power on CURIE
Look for the generator room and switch off power there
and never look at the guy
Comment: I believe Catherine says that the escape pod won't activate because the Curie doesn't realize there's been an emergency. She tells you to do whatever you can to convince the ship otherwise, i.e. [sabotage](https://youtu.be/z5rRZdiu1UE).
Comment: I believe that if you move but don't look at him he teleports to fixed points on the ship as you move. To which point he teleports depends on where you are: he always teleports to the closest point to you. If you look at him he starts to use a new strategy: he teleports closer and closer to you until you die. He is scripted though because there are some rooms where he is not present and there is an event after which he starts to teleport closer to you regardless of your facing.
Comment: I don't want to spoil the fun. See it for yourself :)
Comment: I was going to ask this as a separate question, but maybe it's just worth asking here. Does this guy actively pursue you if you aren't looking/hiding? It seems like he just gets really close if he sees you, but as long as you aren't in his way or looking at him, he kind of just forgets about you and walk away.
Comment: So after a given point he does actively try to hunt you?

Stuck on SOMA level


How can I switch the Firefox user interface to German?

Question: I installed Ubuntu GNOME 16.04.2, setting the system language to German during the installation. However, the Firefox user interface uses English. The package firefox-locale-de is installed. I even set general.useragent.locale under about:config to de-DE, de_DE, and de, but none of these helped. How can this problem be fixed?
Comment: When you visit `about:addons` in Firefox and navigate to the "Languages" section, you should see the German language pack there (which you installed with `firefox-locale-de`). Maybe here you just still have English enabled?
Comment: What does the terminal command `locale` output?
Answer: Have a look at this site: https://addons.mozilla.org/de/firefox/addon/deutsch-de-language-pack/
you can disable or enable those packs via the firefox preferences..
Comment: When looking at the language pack list, I saw that all language packs were deactivated because of a version mismatch. I checked and saw that the Firefox version was 51.0.1, while the version of the language packs was 52.0.2. Apparently, updated language packs had been installed during the Ubuntu GNOME installation, but not the corresponding updated Firefox. Running `sudo apt-get update && sudo apt-get dist-upgrade` fixed the problem. It is annoying that the Ubuntu GNOME installer does not install the latest package versions even when told that it should download packages during installation.
Answer: You can set your Firefox locale to any language you want (I tried French and German specifically on Firefox 52 and Ubuntu 16.04) by following these 3 steps below.
Note that it is not necessary to also have that language installed or configured in Ubuntu's System Settings, Firefox can operate independently of that.
Step 1: Install language pack
Install the firefox-locale-?? software package that corresponds to the language you want, replacing the ?? with the right locale code of course (like firefox-locale-de for German).
You can do this most easily by opening a terminal window (Ctrl+Alt+T) and typing:
sudo apt install firefox-locale-de

After this, you must restart Firefox, otheriwse it will not notice the new language pack.
Step 2: Enable the language pack
Start Firefox and open the Add-On settings page (or type about:addons as URL). Go to the "Languages" tab of that settings page.
You should see a list of all installed Firefox language packs. Make sure the one you want is enabled. It is not necessary to disable all others, you can just leave them enabled too, or disable them, whatever you want.
Normally all newly installed language packs should be enabled by default, but it's better to double-check that.
Step 3: Tweak some internal configuration
Visit the advanced configuration page of your Firefox by typing about:config as URL in the address bar. Notice the warning and proceed.
There are two keys that we need to modify:

general.useragent.locale should be set to your preferred locale's language code, like de for German.

intl.locale.matchOS should be set to false. This might not be necessary if your Ubuntu system/user account's primary language is the same as the one you want in Firefox, but the browser will ignore everything you configure if this key is set to true.

Now you have to restart Firefox again, and it should come up with the new user interface language. Enjoy.


Can we uproot a Wheezewort only once?

Question: It seems, that if we uproot a Wheezewort from one Flower Vase (to plant it into another) it get destroyed/used/disappear.
Is this 'by design'?
How can I transport such a Wheezewort from one place to another?
Answer: I think you should submit a bug report on the bug tracker since it is not the intended behavior.
I tried to do this on 3 different saves and had no problem relocating my chilly Wheezewort.
Comment: Are you sure that you tried to relocate from one Flower Vase to another Flower Vase (not from the original place in a ice biom to the first Flower Vase)?

Can we uproot a Wheezewort only once?


Getting the Folder Path of the last location I right clicked in Python

Question: I'm using Glob.Glob to search a folder, and the sub-folders there in for all the invoices I have. To simplify that I'm going to add the program to the context menu, and have it take the path as the first part of,
import glob

for filename in glob.glob(path + "/**/*.pdf", recursive=True):

     print(filename)

I'll have it keep the list and send those files to a Printer, in a later version, but for now just writing the name is a good enough test.
So my question is twofold:

Is there anything fundamentally wrong with the way I'm writing this?
Can anyone point me in the direction of how to actually capture folder path and provide it as path-variable?
Answer: You should have a look at this question: Python script on selected file. It shows how to set up a "Sent To" command in the context menu. This command calls a python script an provides the file name sent via sys.argv[1]. I assume that also works for a directory.
Answer: I do not have Python3.5 so that I can set the flag recursive=True, so I prefer to provide you a solution which you can run on any Python version (known up to day).
The solution consists in using calling os.walk() to run explore the directories and the set build-in type.
it is better to use set instead of list as with this later one you'll need more code to check if the directory you want to add is not listed already.
So basically you can keep two sets: one for the names of files you want to print and the other one for the directories and their sub folders.
So you can adapat this solution to your class/method:
import os

path = '.' # Any path you want
exten = '.pdf'
directories_list = set()
files_list = set()
# Loop over direcotries
for dirpath, dirnames, files in os.walk(path):
    for name in files:
        # Check if extension matches
        if name.lower().endswith(exten):
           files_list.add(name)
           directories_list.add(dirpath)

You can then loop over  directories_list and files_list to print them out.


How to make div with an image and text in exact center in Ionic?

Question: I have a login screen. I want to make it vertically and horizontally in the center. My login screen has a title with an image. It also should be in the center with respect to the text box.
<ion-content>

                        Timesheet Tracking

                <form novalidate name="loginForm" ng-submit="doLogin(loginForm)">

                        <input name="UserName" type="text" ng-model="User.UserName" placeholder="Username or Email" required>

                        Please provide username

                        <input type="password" name="password" id="password" ng-model="User.Password" placeholder="Password" required>

                        Provide password

                      Wrong credentials

                    <button class="button button-block button-lightgreen" type="submit">

                        Submit

                    </button>
                </form>

</ion-content>

I am not providing my CSS file; it's a little complex. If you want, you can change my classes.
Answer: Just give the following CSS will make your screen vertically and horizontally center.
.loginscreen {
    left: 50%;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
}

Fiddle
Answer: Try this one:
.loginscreen {
    text-align: center
}

Comment: @user1697575: No, it is an answer. Code-only answers maybe aren't helpful, but they're still answers.
Comment: Please add some explanation. Your answer is currently flagged "low quality" and might eventually be removed.
Comment: This does not provide an answer to the question. Once you have sufficient [reputation](http://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](http://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](http://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/low-quality-posts/11559421)


Help understanding the role of barycentric coordinates in affine mapping of reference element to actual element

Question: I am slogging through FEM self study leaning heavily on the 1st Zienkiewicz text. I think the book is great but I cannot seem wrap my head around switching between the element of interest and the reference element. I found a paper that talks about implementing a code in MatLab. The paper does some hand holding on the assembly but I am still having some gaps. Hopefully the community can give me a helping hand.
So I pick up with the definition of triangular element
$$
\hat{v}_1 = (1,0), \hat{v}_2=(0,1) \:\mathrm{and}\: \hat{v}_3=(0,0)
$$
So the text says we can generate an affine map translating the reference triangle to any triangle in the mesh by say matching up the verities. I am ok there...
$$
F:\hat{\tau}\rightarrow\tau\;\mathrm{where}\\B=\left[\begin{matrix}x_1-x_3& y_1-y_3 \\x_2-x_3 & y_2-y_3 \end{matrix} \right]and \;c=(x_3,y_3)^T
$$
Things go downhill from here when this gets folded back into integrating over the element
$$
\int_\tau \nabla\lambda_i \cdot\nabla\lambda_jdxdy=\int_\tau(B^{-1}\hat{\nabla}\hat{\lambda_i})\cdot(B^{-1}\hat{\nabla}\hat{\lambda_J})|det(B)|d\hat{x}d\hat{y}
$$
So I know the hat is in terms of the reference element and they also state $\hat{u}(\hat{\mathbf{x}})=u(F(\hat{\mathbf{x}}))$ which explains where B gets introduced. The inclusion of the determinant of B confuses me. Where did that come from?
The next line is that
$$
\int_\tau \nabla\lambda_i \cdot\nabla\lambda_jdxdy= \frac{1}{2}|det(B)|(B^{-1}\hat{\nabla}\hat{\lambda_i})\cdot(B^{-1}\hat{\nabla}\hat{\lambda_j})
$$
I am not clear what took place with the integration. I read that barycentric coordinates add up to 1 if they are homogenous, is that what happened?
If someone could fill in some misconceptions it would be much appreciated.
Answer: In the first equation you are basically doing change of coordinates, similar to cartesian to e.g. polar. The determinant of the change of variables Jacobian needs to be included, since you are changing from $\boldsymbol{x} $ to $ \widehat{\boldsymbol{x}}$ through $\boldsymbol{x} = B \widehat{\boldsymbol{x}}$. Thus,
$$\frac{\mathrm d \boldsymbol{x} }{\mathrm d \widehat{\boldsymbol{x}}} = B \Rightarrow \mathrm d \boldsymbol{x} = B \mathrm d \widehat{\boldsymbol{x}}$$ For the formalization see e.g. this Wikipedia entry for a start, although there are probably lots of better resources out there, like this.
Coming to the second equality, there is no exact integration, but instead Gaussian Quadrature (the standard for FEM), i.e., numerical integration going on. Since only one summand is used, it looks like the order one method is used. This explains also the factor $1/2$ (the weight) in front. All terms are then evaluated at $\hat x = \hat y = 1/3$. This resource might be a good starting point for looking into Gaussian Quadrature.


Can I play Guitar Hero or Rock Band on my PC?

Question: Is there any way to play Guitar Hero or Rock Band on my PC?
I also wonder if there's a way to get the instruments working on a PC.
Any suggestions?
Comment: [Clone Hero](https://clonehero.net/) would be the most popular replacement on PC as of 2023.
Answer: Several of the Guitar Hero games have been released for Windows and Mac, including Guitar Hero III, Guitar Hero: World Tour and Guitar Hero: Aerosmith, and USB-based instruments should work natively with them. None of the Rock Band games have been released for PC, however, and intercompatibility is generally bad.
Try Frets on Fire for a free and open source Guitar Hero-style game which works with all the console instruments. For full details, drivers, and the like, see the Frets on Fire Wiki page on using Guitar Hero and Rock Band controllers. Many of the Guitar Hero and Rock Band series songs have been converted for use with Frets on Fire, and there is an enormous base of user-created content: see the wiki for details on available song packs.
Comment: Can I use a real guitar? What interface I need?
Answer: Performous is a nice alternative for Guitar Hero/Rock Band on the PC. Open source, compatible with GH and RB instruments, most of console games' songs are available as packs on the net, some game features are already implemented better than the console games.
Answer: Frets On Fire - a free, open-source clone that uses your keyboard.
The Xbox controllers may work on the PC - never tried it, but I saw a video and some software a while back that used the Rock Band drum set on PC.
Answer: Guitar Hero III was available on PC. However, it was apparently far inferior to the console versions.
Answer: Update 10 years later:
Now you can play Rock Band, Rock Band 2, Rock Band 3, Green Day Rock Band,
The Beatles Rock Band, and LEGO Rock Band using the RPCS3 PS3 emulator.
You can also play any Rock Band / Guitar Hero game using the Dolphin emulator (the downside is the graphical and sound quality), and any Guitar Hero game on RPCS3 with the sound desynchronised, but if your computer is strong enough, desynchronisation might be even not noticeable.
Comment: Can you expand on "the downside is the quality"? Quality is a general measure of excellence, or a synonym for property, so that phrase is nonsensical.
Answer: I agree with Ignis Umbrae because Guitar Hero has 3 versions released for PC. However, Rock Band for the moment not available for PC.
But there is good news about this, if you reach the goal, ie. There is a project of the same group of creators and Rock Band, that after his last throw me RB4 for PS4 and XBOXone, launch RB4 PC.
Here is the link for more info:
RB4 FOR PC
On the other hand, Frets on Fire (FoF) has strong competition that is similar to this program is called Phase Shift (PS), I personally love this program. It is absolutely equal to the FoF, the exception does not have the vocal instrument and graphics PS is well above the FoF.
It is also configurable on changing 'Themes' fof like, here I leave the link of the program:
PHASE SHIFT (last version v1.7)
And here a variety of 'Themes' you can choose for the PS. (These topics are updated occasionally depending on your designer, so I suggest that you subscribe to their own channels to be more aware of them):
THEMES FOR PHASE SHIFT: (GH / RB ):
GUITAR HERO II
- GUITAR HERO III
- GUITAR HERO METALLICA
- GUITAR HERO 5 (IN PROGRESS - DEMO)
- GUITAR HERO WARRIORS OF ROCK
ROCK BAND 2
- ROCK BAND GREEN DAY
- ROCK BAND THE BEATLES
- ROCK BAND 3
- ROCK BAND 4
Greetings.
Answer: There is a program called Clone Hero which is used by most guitar hero livestreamers and also casual players which you can download on the PC. It is in fact a little better than normal Guitar Hero, because you can easily download songs and charts, just about as fast as your computer can download and extract. The link to the download video is here:

 There is also an online document with download links to various setlists from actual Guitar Hero and Rock Band games, so you can play all the songs from those games:https://docs.google.com/spreadsheets/d/13B823ukxdVMocowo1s5XnT3tzciOfruhUVePENKc01o/htmlview?sle=true#gid=0


Authenticate specific gmail account Google API in PHP

Question: I receive confirmation from users in my gmail account. I want to read them with a server side php script to display confirmation on my website. I got OAuth 2.0 client IDs and a service key from Google APis. How do I use these keys with the specific gmail account to get the emails? I cannot find any simple documentation.
Answer: You can not use a service account to access a normal users Gmail account.  This is because there is no way to preauthorize it.
What you need to do is have the users authenticate your application using Oauth2 and get a refresh token for each user.  Then you will be able to use the refresh token in your server sided script to request a new access token which you can use to read there gmails.    The Google PHP client library team has created some examples for using their library which might help you.  Google-api-php-client
Side note:  If the users you are speaking of are part of a Google domains account then you can do it by giving service account permissions to access the users emails.


Node.js non www to www redirect does not working

Question: I have referred to this:
https://www.hacksparrow.com/how-to-forward-non-www-to-www-domain-name-and-vice-versa-in-node-js-express.html
And to other Stackoverflow questions, but I still get errors when doing what they said:
This code:
app.get('/*', function(req, res, next) {
    if (req.headers.host.match(/^www/) == null ) res.redirect('http://www.' + req.headers.host + req.url, 301);
    else next();
});

Redirects me to www.localhost:8080 ...
I have tried other syntax but still not working:
app.get('/*', function(req, res, next) {
    if (req.headers.host.match(/^www/) == null ) res.redirect('http://www.ride4you.co.il', 301);
    else next();
});

(It redirects too many time until Chrome is timedout).
My question is how to fix this, in order to redirect ANY kind of addresses in the web address bar to https://www.mydomain.co.il,
for example: mydomain.com www.mydomain.co.il http://mydomain.co.il, I want all of them to point to the first I wrote.
Thanks.
Comment: so you are saying first code is working and second one doesn't
Comment: First code redirects me to www.localhost:8080 . I need it to redirect to my domain not localhost...
Comment: I tried second code and it works fine for me. But first code is better than second one. Put the first code and upload it to server and then navigate your domain.
Comment: Again, I have tried this, it redirect me to the address I mentioned above.
Comment: console.log(req.headers.host); // localhost:8080 and not ride4you.co.il why is it?
Answer: Only allow the specific host you want through, and catch the unlikely case that it's a HTTP/1.0 without a host header.
app.use((req, res, next) => {
    if ( !req.headers.host || req.headers.host === 'www.mydomain.co.il' ) return next()
    res.redirect('http://www.mydomain.co.il/', 301)
})

You can keep the users original request path in the new URL.
res.redirect('http://www.mydomain.co.il'+req.originalUrl, 301)

Comment: This page isn't working
www.ride4you.co.il redirected you too many times.
Comment: BTW I am using routers like this: app.use('/rides', require('./routes/ridesServer'));
Comment: This is the code of app.js https://gist.github.com/razaviv/d0bdae716c17d6381eadaecde9169423
Comment: The port is sent as part of the host header, so `www.ride4you.co.il:8080` but if you are in a redirect loop with that code then something must else be responding on port 80?? Do you have something else in front of this app forwarding requests? or some other app running on port 80 doing redirects?


Drag and drop SKSpriteNode with the shape of a oval

Question: I have a scene with one sprite, the image used for the sprites is an oval.

The problem I'm facing is that, whenever I use touchAtPoint it returns the sprite even if the touch occurs at a transparent area of the image.
How can I solve that?
My current code looks like:
-(id)initWithSize:(CGSize)size {

    if (self = [super initWithSize:size]) {

        self.backgroundColor = [SKColor blackColor];
        self.physicsBody = [SKPhysicsBody bodyWithEdgeLoopFromRect:self.frame];
        SKSpriteNode *sprite = [SKSpriteNode spriteNodeWithImageNamed:@"Red"];
        sprite.physicsBody = [SKPhysicsBody bodyWithCircleOfRadius:50.0];
        sprite.physicsBody.affectedByGravity = NO;
        sprite.physicsBody.usesPreciseCollisionDetection = YES;
        [self addChild: sprite];

    }

    return self;
}

- (void)didMoveToView:(SKView *)view {

    UIPanGestureRecognizer *gestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePanFrom:)];
    [self.view addGestureRecognizer:gestureRecognizer];

}

- (void)handlePanFrom:(UIPanGestureRecognizer *)recognizer {

    if (recognizer.state == UIGestureRecognizerStateBegan) {

        CGPoint touchLocation = [recognizer locationInView:recognizer.view];
        touchLocation = [self convertPointFromView:touchLocation];
        SKNode *touchedNode = (SKNode *)[self nodeAtPoint:touchLocation];
        _selectedNode = touchedNode;

    }
    else if (recognizer.state == UIGestureRecognizerStateChanged) {

        CGPoint translation = [recognizer translationInView:recognizer.view];
        translation = CGPointMake(translation.x, -translation.y);
        [self panForTranslation:translation];
        [recognizer setTranslation:CGPointZero inView:recognizer.view];

    }
}

- (void)panForTranslation:(CGPoint)translation {
    CGPoint position = [_selectedNode position];
    [_selectedNode setPosition:CGPointMake(position.x + translation.x, position.y + translation.y)];
}

Answer: OK, so the only relevant code here is...
CGPoint touchLocation = [recognizer locationInView:recognizer.view];
touchLocation = [self convertPointFromView:touchLocation];
SKNode *touchedNode = (SKNode *)[self nodeAtPoint:touchLocation];
_selectedNode = touchedNode;

This needs to change to something like this...
CGPoint touchLocation = [recognizer locationInView:recognizer.view];
touchLocation = [self convertPointFromView:touchLocation];
SKNode *touchedNode = (SKNode *)[self nodeAtPoint:touchLocation];

// Work out if the touch is inside the circle
CGPoint centerOfNode = CGPointMake(touchedNode.position.x + touchedNode.size.width * 0.5, touchedNode.positiony + touchedNode.size.height * 0.5);

CGFloat dx = touchedNode.position.x - touchLocation.x;
CGFloat dy = touchedNode.position.y - touchLocation.y;

CGFloat distanceFromCenter = sqrtf(dx * dx + dy * dy);

if (distanceFromCenter <= touchedNode.size.width * 0.5) {
    _selectedNode = touchedNode;
}

Comment: An SKSpriteNode is always a rectangle, regardless of the alpha of a given pixel. An SKShape Node is essentially a colored CGPath. If your game relied on a complex set of touch interactions, you could subclass SKSprite to have a "custom touch area" property of some sort. Or I suppose the quick and dirty option would be to add an SKShapeNode of the correct shape to each SKSpriteNode and then check against those using nodesAtPoint. I haven't checked lately, but SKShapeNodes have had some issues historically.
Comment: Thanks! And there's no way of making nodeAtPoint aware of the shape? For example, when creating an oval SKShapeNode it doesn't respond to the transparent areas.


Can I install a Honeywell WIFI Thermostat?

Question: I have done quite a bit of research and have not been able to find an answer I am looking for. I currently have a manual digital thermostat that is not programmable made by Braeburn. My system is a Ground A/C unit outside, and my heater/air handler is up in the attic. My thermostat is wired the following way:

Jumper wire between R and RC
Red wire from wall to RC
B terminal on thermostat is empty
Blue wire from wall to O
Jumper wire from Y to W
Yellow wire from wall to Y
No wire to W other than Jumper
Green wire from wall to G
There is a spare wire from the wall harness to nothing as well.

I have not had a chance to go in the attic to check the labels on the air handler, but I am hoping there is an extra wire up there too so I can use it as a C wire.
I am curious how, or if I can use a WiFi thermostat or any other programmable for that matter. I have not come up with any leads yet, and don't want to screw things up before I start.
Comment: So I go up and check the wiring on the Carrier F4 air handler and basically find out where the thermostat wiring should be is gone and wires are just spliced together there. So I took pics of everything but am not sure how to post them. According to the instructions shoved in the air handler the thick brown wire is the common for the unit and it attaches to the white thermostat wire. At my thermostat downstairs I have 2 white wires, one hooked up and one extra. Is there a way to test the 5th wire that is not hooked up to see if it has power to be the common wire? I am hoping it is hooked up at
Answer: The C wire, not to be confused with R or RC is the return path. Think of it as a ground, though technically not. Based on the information above, none of the wires O, B, W, G, R, Y, will work for C.  So they can not be jumped over to the C connection.  The C wire, usually the brown wire on the transformer, the low voltage (24v) is the common. However, no matter the color, there are only two low voltage wires on the transformer, one power (Red, Blk, Yel), one common.  So what ever color not representing the power, is the common C.  Of course, AC current flows both directions, but trying to make this simple.  Anyway, that wire (the non power wire) needs to come in to the thermostat for the C connection. With an extra wire (any color on the wire loom at the thermostat can be traced back to the 24v transformer and connected to the common, usually color brown wire). That extra wire used, the new color will become the C wire. Just a note, one issue I have had with the WiFi thermostat is the fan ON and Auto don't work independently. So for example, if the thermostat is selected to run the fan ON - no cooling or heating, I've seen that not work. It can be fixed too, just not answering that.
Answer: Typically O, and/or B are used to control a reversing valve in the heat pump. Depending on which is energized, the system either provides heating or cooling. You'd have to check the manual for the specific thermostat you'd like to install, but usually thermostats can be configured to work with heat pumps. You might have to move a few jumpers around in the thermostat to configure it, but the information required to do so should be in the installation guide.
If all else fails, Honeywell has great customer support. I'm sure they'll be able to answer any questions you have, and direct you to the specific product that will work for you.

More information

The thermostat gets power from the red wire, which energizes both R and Rc.
The G terminal on the thermostat is energized when the fan switch is placed in the FAN position.
The Y terminal is energized when the thermostat calls for cooling (temperature above set point).
The W terminal is energized when the thermostat calls for heating (temperature below set point).
The B terminal is typically energized when the thermostat is set to heating mode (function switch set to HEAT).
The O terminal is typically energized when the thermostat is set to cooling mode (function switch set to COOL).

Some thermostats require you to set jumpers to determine whether O or B is energized. In this case, it seems the system requires the O terminal to be energized.
When the thermostat calls for heating or cooling, the system makes the decision of which function to activate based on whether or not the O terminal is energized. I'm not sure exactly how your system is configured, but it seems as though the system works as follows.

If O is energized when Y or W is also energized, the A/C comes on.
If O is not energized when Y or W is energized, the heat comes on.


Does TypeScript have a dedicated VM, or is it compile-to-js only?

Question: If not, any plans to deliver a server-side and/or browser-embedded VM?
Answer: Nope - There's no dedicated VM, and no plan to develop one, either.  The goal of TypeScript is to help us all build better JS applications, regardless of where they run.  As JS VMs improve, we improve as well :)
Comment: Thanks! The language is still evolving, but generally we want to err on the side of where the standards are going.  ES6-style destructuring is likely something we'll be thinking about moving forward.
Comment: Worth noting that, as I understand it, since the TS compiler is written in TS, it can be compiled to JS, which would allow you to compile TS on the fly in the browser, which would allow you to skip the dev-time compile step, which would provide all the workflow benefits of a TS VM without actually requiring one (although presumably at the expense of some overhead).
Comment: Good decision, and nice job btw :). I can easily see myself switching some code from coffee to TS very fast, I guess I'll miss the (for x in []) and (for k, v of {}) contructs, any plans to implement these with the foreach keyword for example?
Comment: Great. Thanks for the answer. I'll take a look at ES proposals to have a clue about TS direction then.
Comment: Actually, if enough people start using TS then browsers could start to do optimizations on TS scripts directly and optimize a lot better when the VM knows about type information etc.
Answer: There is Deno. It transparently incorporates a TypeScript to JavaScript transpiler, so to you as end-user it appears as if it was running TypeScript directly.
By default, TypeScript code is not type checked before it is executed, since this can take quite a long time. If you want type checking, enable it by adding --check to the command, e.g.
deno run --check module.ts
# or also type check remote modules and npm packages
deno run --check=all module.ts


Configure & Connect wireless network through the command line in Ubuntu 12.04

Question: The wireless networks are detected, but I am unable to connect to them.
Here is the code I've tried:
sudo iwlist wlan0 scan (Working)
iwconfig wlan0 essid "Network name" key s:"key" (Error for wireless request "Set Encode" (8B2A)) SET failed on device wlan0 ; Invalid argument

wpa_passphrase essid password > /etc/wpa_supplicant.conf
wpa_supplicant -B -Dwext -iwlan0 -c/etc/wpa_supplicant.conf

ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument

Then i tried by adding ctrl_interface=/var/run/wpa_supplicant at the beginning of file wpa_supplicant.conf and running the same wpa_supplicant command but result is
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ctrl_iface exists and seems to be in use - cannot override it
Delete '/var/run/wpa_supplicant/wlan0' manually if it is not used anymore
Failed to initialize control interface '/var/run/wpa_supplicant'.
You may have another wpa_supplicant process already running or the file was
left by an unclean termination of wpa_supplicant in which case you will need
to manually remove this file before starting wpa_supplicant again.

How do I connect to a specified wireless network through command line in Ubuntu 12.04?
Comment: key s:"key" implies that your key is WEP and ASCII. Your wpa_supplicant.conf implies it is WPA. Which is it? Are you able to use vim to amend /etc/network/interfaces?
Comment: It is WPA2. 'vi amend /etc/network/interfaces' contains 'auto lo iface lo inet loopback'. Manually its connecting but i want to connect through command line.(DHCP Client)
Comment: Please explain 'manually it's connecting.' Is Network Manager running or is this a server without a desktop?
Answer: This short article helped me connect my 12.04 LTS server to my WPA2 PSK network: prupert @ WordPress . I run the server without desktop, so it demanded all cmd line.
I am paraphrasing a quick breakdown of the steps, but please click on the link for the full article:
(You Need to be connected to the network at this point)
Install The Software:
(You only need WPASupplicant if it is not an open network)
sudo apt-get install wireless-tools wpasupplicant
Activate your wireless network:
sudo ifconfig wlan0 up

To Check The Wireless Run:
iwconfig

Then:
sudo iwlist scan

(The sacn command should return visible wireless networks, but if it does not it is a sign that there are none visible or something is wrong with your HW/SW outside the scope of the linked article)
Run:
(To recieve you WiFi Key)
wpa_passphrase YOURSSID YOURWIFIPASSWORD

A Sample of The Resulting Text:
(As Provided by the Linked Article)
network={
ssid="YOURSSID"
#psk="YOURWIFIPASSWORD"
psk=fe727aa8b64ac9b3f54c72432da14faed933ea511ecab1 5bbc6c52e7522f709a
}

Copy the "psk" somewhere accessible, this is going to allow you to connect to your network.
Edit your interfaces file:
sudo nano /etc/network/interfaces

Append your WiFi network to the end of this file using the folling options and syntax:
auto wlan0     #change this to the name of your WiFi interface
iface wlan0 inet dhcp     #this is normally fine, if you want a static IP address replace "dhcp" with "static"
netmask 255.255.255.0     #change this as appropriate for your network, this value is usually right
gateway 192.168.1.1     #change this as appropriate for your network
address 192.168.1.100     #only needed for a static IP address
dns-nameservers 192.168.1.1     #only needed for a static IP address
wpa-driver wext     #you shouldn't need to change this
wpa-ssid YOURSSID     #just type the name of your SSID here
wpa-ap-scan 1     #if the name of your SSID is hidden usually, type 2 instead of 1
wpa-proto WPA    #if you use WPA1 type WPA, if you use WPA2 type RSN
wpa-pairwise CCMP     #if you use AES type CCMP, if you use TKIP type TKIP
wpa-group CCMP     #if you use AES type CCMP, if you use TKIP type TKIP
wpa-key-mgmt WPA-PSK     #usually WPA-PSK (if you share a key) but sometimes WPA-EAP (for enterprises)
wpa-psk YOURHEXKEYFROMABOVE     #the hex key that you generated earlier

Example from Author of the linked article:
auto wlan0
iface wlan0 inet dhcp
netmask 255.255.255.0
gateway 192.168.1.1
wpa-driver wext
wpa-ssid MYPLACE
wpa-ap-scan 1
wpa-proto WPA
wpa-pairwise CCMP
wpa-group CCMP
wpa-key-mgmt WPA-PSK
wpa-psk 71c81a844973ae7bb1243141e5caa7b6bb0e2d7eetcetcetc

You may now comment out the top of the Interfaces file, which will disable the ethernet. The author of the article reccommends this to prevent conflicts, but I decided not to as the only way that I can access my server interface is via PuTTY SSH, so I want to have a method of connection if the wireless is down, where I don't need to break out a mouse and monitor:
(Remove the "#" later if you need the ethernet connections to work again)
#auto eth0
#iface eth0 inet dhcp

Write Out the file and Save your Changes
Reboot your Machine
If this doesn't work, you may need to edit the Config file for the WPASupplicant program:
sudo nano /etc/wpa_supplicant.conf

You edit this file with much of the same information, except the wpa- piece:
(A sample below from the author of the linked document)
ap_scan=1
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="MYPLACE"
scan_ssid=0
psk=71c81a844973ae7bb1243141e5caa7b6bb0e2d7eetcetcetc
key_mgmt=WPA-PSK
proto=WPA
pairwise=CCMP
group=CCMP
}

"As far as I am aware, the options are the same. So, edit this file as necessary, make sure you add the ctrl_interface and network={ at the beginning and the } part at the end. Save it and try restarting again. If it still doesn't work, then kick your PC, wish you had installed Windows 7 instead and go off and do some Googling. You'll find the answer on the Ubuntu forums and you'll be happy again.
Comment: Arjun. If you are to attempt to use this answer for your case, then make sure you take into account any changes that you have already made to various conf files as stated in your original question
Comment: thanks for this answer , but how can I set the operation mode to ad-hoc in this configuration ?
Comment: this answer was exactly what I needed to move my headless ubuntu server over from wired to wireless. thank you!


Advice on collaboration with creatives and developers?

Question: Our current workflow has creatives receiving wireframes from a rather green UX designer.  Our creatives then design too constrained to said wireframes.  When I receive the design I find many UX flaws that I feel could have been caught had there been more collaboration among departments.
In a small fast paced agency, typically not all the information is known by the time wireframes are completed.
Are there any experiences that you guys can share with me to assist in helping my team work more efficiently?  What do you all do when dealing with an incomplete picture with an approaching deadline?  How do you avoid restricting the designer, or is that a desire?
Answer:
In a small fast paced agency

...waterfall doesn't work too well. Which you've experienced first hand. ;)
Agile is the way to go. Be it formal, or completely informal. The ultimate goal in either case is to get out of the 'step by step' mentality of wireframes -> visual design -> development.
The best way to get out of that is to make sure all 3 things are happening in parallel. Or, at the very least, all 3 parties need to be communicating from day one.
These 3 tasks can't be done in isolation as you end up with exactly what you've experienced.
I've ran into this problem in larger agencies, where I was acting as a Front End prototyper.
What would happen is that wireframes would get signed off before we'd see them. UI design would then happen before we'd see that. We'd then have to take the two and turn them into interactive prototypes which always led to us finding things on paper that simply don't make any sense in code/interaction.
The solution was simply that we were looped in a lot earlier.

creatives

You didn't ask about this, but did want to comment. I cringe at the term 'creatives' being applied to the visual designers only. A software solution isn't going to be succesful unless EVERYONE is creative. That includes the UX team. That includes the front end devs. That includes the back end coders. I always suggest that organizations not use the term 'creatives' to reference UI design solely as it only encourages a lop-sided way of thinking about creativity.
Comment: I cringe at the term creatives being used about 90% of the time it's used, and I'm a visual/interactive designer and front end developer.
Answer: Marty Cagan, on his product management blog and in his book, makes a very strong case for high fidelity prototypes, because using them…

forces you to think through your product to a much greater degree than paper specs,
enables and encourages the type of collaboration between product manager, interaction designer, and architect/engineer that is
  necessary to discover a valuable, useful and feasible product,
prevents the classic waterfall problem of doing design after the requirements, rather than realizing that functionality and user
  experience are inherently intertwined,
and helps keep the focus of the team on the user experience.

http://www.svproduct.com/high-fidelity-prototypes/
Answer: I disagree that agile is the complete solution. Agile is a developement approach which, if hacked, can offers some good working practices. The danger is for UX to fit into Agile instead of agile adapting to UX. Also some times parts of a waterfall approach do work, it's not a black and white situation.
I do agree that the key, as you suggested, is to increase collaboration. Single location working for a project team where wall space is available is a great way to do things. The designers and developers should have visibility of ideas prior to a final wireframe or prototype or other final documentation (even if it's a white board of sketches).
In short the deliverable should be a reference to what has been agreed upon, hopefully over several iterations, rather than a primary means of communicating the functionality of the UX.
Collaboration with an element of mutual coaching of ideas leads to everyone learning. This works well providing you have no 'rockstars' who are not open to changing their ideas. The 'right' idea is of no use if the team do not understand or buy into it.
Lastly with short projects the key thing is to get a complete picture working quickly before dwelling upon screen level details. The interface design part of UX is the easy bit and only a small bit. Flows and IA are less tangible but more important to UX.
Answer: In a small fast paced firm:
The requirements gatherers, UX designers, developers, supervisors and preferably testers should be kept in the loop as soon as the initial requirements document has been confirmed with the client.
This is to prevent a communication gap and to facilitate flow of ideas to-and-from each group, under a guiding + controlling supervision.
Creativity is required at each stage and it should be encouraged, at the same time, the supervisors should ensure quick and steadfast decision making to prevent time-lapse in what can be called 'over-thinking'.
Agile and/or Extreme Programming methodologies will work wonders in a small firm or a self-sufficient project team.
Answer: This is a common problem among many different organizations that have multiple teams working on multiple projects, especially when the deadlines are tight. The key is always to work out the best way to communicate with each other, and for team members to have similarly aligned goals/visions of the projects.
Rather than prescribing a specific method, it is much better to work out what is missing when the information is passed from one group/member to another, and work out the best way to provide the missing information, whether it is through a different process workflow or a different type of deliverable.
I would suggest reading some of BJ Fogg's work to understand how to use small changes to impact people's behaviour. In fact some of the principles apply equally to interface design as it does to people because it is about underlying motivations and triggers.
Answer: Waterfall is somehow the past because it can not keep up with the market increasing demand, so the solution now it's to go for Agile and with it to make a switch to what we like to call it LEAN UX. (Lean UX & Agile will allow you to build your applications in time even if you don't know all the specs from the beginning)
The best skill to help you in collaboration with creatives & developers is communication.
And the best way to do it is to organize collaborative design meetings where you get all the people together (whole team) and iterate on ideas. And when I say iterate on ideas, I mean getting together around a whiteboard with pens and markers and just do sketches based on everyone's opinion and change them until you all get on the right track.
Learn to use people's expertise and strong points and you will get outstanding results.
This way everybody will know the project details from the beginning and where the project is heading.


Not able to ssh in to GCP compute engine

Question: I am new to gcp, Created custom VPC and launched new compute engine instance in same vpc but unable to ssh.
Answer: did you select the firewall rules while creating VPC. if not you can create firewall rule.
The following links help you to troubleshoot and creating firewall rules in GCP.
[1]. https://cloud.google.com/compute/docs/troubleshooting/troubleshooting-ssh.
[2]. https://cloud.google.com/vpc/docs/using-firewalls.


Resolving a pod's IP by name

Question: First off a disclaimer: I have only been using Azure's Kubernetes framework for a short while so my apologies for asking what might be an easy problem.
I have two Kubernetes services running in AKS. I want these services to be able to discover each other by service name. The pods associated with these services are each given an IP from the subnet I've assigned to my cluster:
$ kubectl get pods -o wide
NAME      READY   STATUS    RESTARTS   AGE   IP         ...
tom       1/1     Running   0          69m   10.0.2.10  ...
jerry     1/1     Running   5          67m   10.0.2.21  ...

If I make REST calls between these services using their pod IPs directly, the calls work as expected. I don't want to of course use hard coded IPs. In reading up on kube dns, my understanding is that entries for registered services are created in the dns. The tests I've done confirms this, but the IP addresses assigned to the dns entries are not the IP addresses of the pods. For example:
$ kubectl exec jerry -- ping -c 1 tom.default
PING tom.default (10.1.0.246): 56 data bytes

The IP address that is associated with the service tom is the so-called "cluster ip":
$ kubectl get services
NAME   TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)    AGE
tom    ClusterIP   10.1.0.246   <none>        6010/TCP   21m
jerry  ClusterIP   10.1.0.247   <none>        6040/TCP   20m

The same is true with the service jerry. The problem with these IP addresses is that REST calls using these addresses do not work. Even a simple ping times out. So my question is how can I associate the kube-dns entry that's created for a service with the pod IP instead of the cluster IP?
Based on the posted answer, I updated my yml file for "tom" as follows:
apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: tom
spec:
  template:
    metadata:
      labels:
        app: tom
    spec:
      containers:
      - name: tom
        image: myregistry.azurecr.io/tom:latest
        imagePullPolicy: Always
        ports:
          - containerPort: 6010
---
  apiVersion: v1
  kind: Service
  metadata:
    name: tom
  spec:
    ports:
    - port: 6010
      name: "6010"
    selector:
      app: tom

and then re-applied the update. I still get the cluster IP though when I try to resolve tom.default, not the pod IP. I'm still missing part of the puzzle.
Update: As requested, here's the describe output for tom:
$ kubectl describe service tom
Name:              tom
Namespace:         default
Labels:            <none>
Annotations:       kubectl.kubernetes.io/last-applied-configuration:
                     {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"tom","namespace":"default"},"spec":{"ports":[{"name":"6010","po...
Selector:          app=tom
Type:              ClusterIP
IP:                10.1.0.139
Port:              6010  6010/TCP
TargetPort:        6010/TCP
Endpoints:         10.0.2.10:6010

The output is similar for the service jerry. As you can see, the endpoint is what I'd expect--10.0.2.10 is the IP assigned to the pod associated with the service tom. Kube DNS though resolves the name "tom" as the cluster IP, not the pod IP:
$ kubectl get pods
NAME                    READY   STATUS    RESTARTS   AGE   IP ...
tom-b4ccbfb97-wfmjp     1/1     Running   0          15h   10.0.2.10
jerry-dd8fbf98f-8jgw7   1/1     Running   0          14h   10.0.2.20

$ kubectl exec jerry-dd8fbf98f-8jgw7 nslookup tom
Name:      tom
Address 1: 10.1.0.139 tom.default.svc.cluster.local

This doesn't really matter of course as long as REST calls are routed to the expected pod IP. I've had some success with this today:
$ kubectl exec jerry-5554b956b-9kpj7 -- wget -O - http://tom:6010/actuator/health
{"status":"UP"}

This shows that even though the name "tom" resolves to the cluster IP there is routing in place that makes sure the call gets to the pod. I've tried the same call from service tom to service jerry and that also works. Curiously, a loopback, from tom to tom, times out:
$ kubectl exec tom-5c68d66cf9-dxlmf -- wget -O - http://tom:6010/actuator/health
Connecting to tom:6010 (10.1.0.139:6010)
wget: can't connect to remote host (10.1.0.139): Operation timed out
command terminated with exit code 1

If I use the pod IP explicitly, the call works:
$ kubectl exec tom-5c68d66cf9-dxlmf -- wget -O - http://10.0.2.10:6010/actuator/health
{"status":"UP"}

So for some reason the routing doesn't work in the loopback case. I can probably get by with that since I don't think we'll need to make calls back to the same service. It is puzzling though.
Peter
Comment: Clusterips are not ping-able.  They exist only in iptables, to help route packets to and fro.  You might want to use curl to verify if services are actually routing request to your pods.  Make sure you have the right selector defined in your kubernetes service to pods.  In your case instead of using tom.default, simply use tom.
Comment: What I'm attempting to do here is provide a service discovery mechanism for my microservices. I need to direct REST calls from one microservice to another. I need to do something like
Comment: wget http://tom:6010/blah
from jerry. I don't need to ping it per se, I just need to have the name "tom" resolve to tom's pod IP not the cluster IP.
Comment: The REST calls I'm experimenting with work fine if use the pod IPs directly, so I know the communications path is there.
Comment: Can you describe the service?  Kubectl describe service tom.  You should find in the endpoints the ips of pod tom.
Comment: I've updated my original post with this new information. As I explain I've had some success.
Answer: This means you didnt publish ports through your service (or used wrong labels). What you are trying to achieve should be done using services exactly, what you need to do is fix your service definition so that it works properly.
apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: xxx-name
spec:
  template:
    metadata:
      labels:
        app: xxx-label
    spec:
      containers:
      - name: xxx-container
        image: kmrcr.azurecr.io/image:0.7
        imagePullPolicy: Always
        ports:
          - containerPort: 7003
          - containerPort: 443

---
  apiVersion: v1
  kind: Service
  metadata:
    name: xxx-service
  spec:
    ports:
    - port: 7003
      name: "7003"
    - port: 443
      name: "443"
    selector:
      app: xxx-label < must match your pod label
    type: LoadBalancer

notice how this exposes same ports container is listening on and uses the same label as selector to determine to which pods the traffic must go

Resolving a pod's IP by name


Does Spark have to finish processing all entries in the reduceByKey step before starting the join step that depends on the results of the reduceByKey?

Question: Question:
Does Spark have to finish processing the all entries in the reduceByKey step before starting the join step?
I think the answer is no. I think each partition/task has to finish the reduceByKey task before moving on to the join.
Details:
In the below example, I reduce an RDD by key userId, and nest all the values with the same user id into a list.
Then I join this RDD of (userid,listOfEvents) with another RDD of (userid, otherEvent).
Note that in this example, the partitioners are the same (default HashParitioner on userId) between reduceByKey and join, so does this change whether reduceByKey has to completely finish processing all data before join?
In this example, the scenario where List(eventA, eventB) is joined with Event K without eventC will never happen, correct?
However, it's possible that List(eventA, eventB, eventC) is joined with Event K, but EventD and Event F are not reduced yet can occur?
<code>Impression Events
userId  Event
1       eventA
1       eventB
1       eventC

2       eventD
2       eventF

Conversion Events
userId  Event
1       eventK

2       eventL
</code>
<code>// The Reduce Step
final JavaPairRDD<Long, ObjectArrayList<Event>> impressionRDD = loadImpressionEvents()
    .mapToPair(event -> {

        final ObjectArrayList<Event> list = new ObjectArrayList();

        list.add(new Event(event.getTimestamp(),
            event.getCampaignIdentifier(), event.getSiteIdentifier()));

        return new Tuple2<>(
            event.getUserId(),
            list
        );
    })
    .reduceByKey((event1, event2) -> {
        // Combine impression events with the same user id
        event1.addAll(event2);
        return event1;
    });

// The Join Step
final JavaPairRDD<Long, Tuple2<ConversionEvent, Event>> conversionImpressions = loadConversionEvents()
    .mapToPair(event -> new Tuple2<>(
        event.getUserId(),
        event
    ))
    .leftOuterJoin(impressionRDD);
</code>
Answer: Spark has to finish shuffle before cogroup and flatten can be started so it is not possible to start join while reduceByKey is in progress.