text:
Q: KiCAD: Footprint selection for common through hole parts (resistors and capacitors) I am in the stage that I have finished my schematic and I have to select footprints for my components before heading over to PCBnew.
However, I could not find a guide on how to select footprints for my few through hole resistors and capacitors.
I am very scared of this part, because this is the most important part, if your components will match the footprints.
I looked up the order I did from the website consisting of my components.
The resistors I bought fall under two categories (regarding their size.)
These two categories are:

*

*Body dimensions = 2.5 x 6.8mm AND Leads dimensions = 0.6 x 28mm (like this one: https://www.acdcshop.gr/resistormetalfilmtht2k06w121625x68mm50ppmc-p-28928.html 1)

*Body dimensions = 1.9 x 3.7mm AND Leads dimensions = 0.45 x 28mm (like this one: https://www.acdcshop.gr/resistormetalfilmtht100komega04wplusmn1oslash19x37mm50ppmdeg-p-15162.html)
As far as the capacitors go, there is only one type I  think

*

*Terminal pitch = 5mm (this one: https://www.acdcshop.gr/capacitorceramic100pf100vp350n10005tht5mm5524785c-p-21315.html 1)

NOTE: Another set of capacitors I have is this one (https://www.acdcshop.gr/capacitorceramic100nf100vy5v2024780tht5mm5524785c-p-21321.html 1). As you can see, the terminal pitch is the same. I am just adding this, because I do not know if terminal pitch is the only factor I should care about, but it is the only info provided by the page. There are no datasheets for the capacitors as you can see, unfortunately.

A: Don't be frightened. I've been exactly where you are right now. But it's not as hard as it initially appears.
Think of what you're trying to achieve. You simply want your parts to fit through the holes and have adequate space around them.  Footprint viewer is your friend:-

It shows you any footprint you select via the footprint association section. It has dimensions including hole sizes if you click on them. So simply make sure that your part fits the picture dimensionally. KiCAD will automatically ensure that the components have side to side room as there is the concept of a courtyard area, which is the rectangular white outline in my screen grab.
I use a ruler or vernier gauge to measure the parts. Or you can cheat a little and look for the package type, such as DO-35 for the diode above. You'll need to decide whether to mount vertically or horizontally, and there are footprints for both.
Tip. It's best to source the parts first as that eliminates the risk that the online write up/dimensions are wrong. So for your first capacitor, I'd go with...

= Non polarised ceramic disc capacitor, disc diameter 5mm (I guessed it), width/thickness 2.5mm (I guessed it) and of course lead pitch 5mm. If you're not designing an iPoneXIII, it will fit. See Mr. Mattman944's comment below about printing it out and test fitting first. That's really good advice.
Tip 2. See something like https://jlcpcb.com. $2 for a 100 mm x 100 mm two layer professionally made board.  Unless you're looking for the whole 'I made it in my kitchen with determination, a UV torch and Sharpie' experience, there's no reason (other than speed) that anyone should make their own boards these days. China won. Just try it. What's to loose ($2 + postage)? And the experience will be worth while even if you cock it up on the first attempt. I did.


text:
Q: Should we define getters setters in most of the cases? If I don't need to do any checks (during getters) or update something else (during setters), then having a simple public member variable should suffice?

A: As long as possible, you should avoid setters, and even getters when you are dealing with references. Immutability should always be preferred unless it cannot be done for some particular reason. In Java, I personally prefer to have getters even if I am not doing any check there, it just gives a bit more control.

A: If you don't need to check the value or update it, make it private, and don't provide any other access.
My personal philosophy is to expose access functions only when they are needed, and then, not necessarily to provide set and get in a pair, even.
getters and setters are good when you need safety checks for incoming values or under what conditions the variable is read.
They are bad when you have a simple object with lots of primitives that just need a place to be bundled together. In those cases I would prefer public members.

A: Notice that in scala this problem doesn't exist, since scala autogenerates getter and setter methods for you:
class Person(var name: String)

val p = new Person("Jonh")
p.name = "James"
println(p.name)             // James

Then, if you need you override the default default accessors and mutators:
class Person(private var _name: String) {
  def name = _name
  def name_=(aName: String) { _name = aName }
}

Still works:
val p2 = new Person2("Jonh")
p.name = "James"
println(p.name)             // James

This answer has a explanation on a similar (not equivalent) concept in other languages (C#, Python,...) where you can have a property: a pair of methods (getter and/or a setter).
As Elliott pointed out, when you have immutability in your class, setters doesn't make sense. And even in languages like Java, you could write a getter, but I can say you usually can get away with final public attributes since you can change their value through the constructor, although I would not exactly call it "the Java way" (lol) :
class Person {
  public final int age;

  public Person(int theage) {
    // Let's transforme age here
    // Imagine this could would go in the getter
    age = theage * 2;
  }
}

A: if you are doing something simple, public is the most practical.
As mentioned by Jameson, sometimes you only need getter or only setter ( String.getCharAt() and such...).
If you are doing a big project, you should do them at least for safety checks (Jameson again). Also it makes you look smart using them on correct places, but that really depends on what you do, share a piece of code maybe?

redpajama_set_name: RedPajamaStackExchange


text:
Q: MySQL Multiple Duplicate Rows - Return Only One I imported my iTunes Library into a table via a script.  The script doesn't catch any duplicate song title and artists.  Therefore, I have many duplicate songs.
trackid    song    artist   tracknum
4628       Title1  StackO      2
6846       YMCA    (blank)     11
9043       YMCA    (blank)     11
9381       YMCA    (blank)     11
9382       Title2  StackO      3

How would I write my SQL statement to return only the FIRST "trackid" of YMCA (4628) row when the song, artist and tracknum are all the same?  It should look like this....
trackid    song    artist   tracknum
4628       Title1  StackO      2
6846       YMCA    (blank)     11
9382       Title2  StackO      3

Here is my SQL as it stands right now...
"SELECT DISTINCT * FROM wp_tracks WHERE title LIKE '%" . $song . "%' AND artist LIKE '%" . $artist . "%'
This has been baffling me for awhile now.
Thank you.

A: SELECT song, artist, tracknum, MIN(trackid) AS first_track_id
FROM wp_tracks
GROUP BY song, artist, tracknum

Add a WHERE clause to choose which tracks you want listed.

A: You have to mention what column you want to be DISTINCT, in your case song
SELECT DISTINCT song FROM wp_tracks
WHERE title LIKE '%" . $song . "%' AND artist LIKE '%" . $artist . "%


text:
Q: How to resolve Paypal(2.1.0) live environment error code 589009 in ios? I am using latest paypal(2.1.0) which works fine in simulator and showing error with error code 589009 in device.How to solve this error?
error code: 589009
error message:The payment can not be processed because no payment source is available

A: i am also facing the same issue....I integrated with the latest MPL 2.1.0, when i am testing in sandbox it is working fine. When i test in device with live mode it is giving me an error.
error code: 589009
error message:The payment can not be processed because no payment source is available


text:
Q: Why the Metal triple buffering model matters in official examples? Metal Best Practices suggest using the triple buffering for dynamic data buffers. But the listing provided in the documentation and the default Metal example generated by the Xcode are blocking every frame waiting for GPU to finish its work:
- (void)render
{
    // Wait until the inflight command buffer has completed its work
    dispatch_semaphore_wait(_frameBoundarySemaphore, DISPATCH_TIME_FOREVER);

   // TODO: Update dynamic buffers and send them to the GPU here !

   __weak dispatch_semaphore_t semaphore = _frameBoundarySemaphore;
    [commandBuffer addCompletedHandler:^(id<MTLCommandBuffer> commandBuffer) {
        // GPU work is complete
        // Signal the semaphore to start the CPU work
        dispatch_semaphore_signal(semaphore);
    }];

    // CPU work is complete
    // Commit the command buffer and start the GPU work
    [commandBuffer commit];

}

So how does the triple buffering improves anything here?

A: The important bit you didn't spot in the sample is:

_frameBoundarySemaphore = dispatch_semaphore_create(kMaxInflightBuffers);

As the documentation for dispatch_semaphore_create says:

Passing a value greater than zero is useful for managing a finite pool of resources, where the pool size is equal to the value.

kMaxInflightBuffers is set to 3 for triple buffering. The first 3 calls to dispatch_semaphore_wait will succeed without any waiting.


text:
Q: "git update-index --skip-worktree" suddenly no longer working I am using git update-index --skip-worktree on some files, so changes won't be tracked. But suddenly it no longer works.
Using git ls-files -v | findstr "^S" it shows the files.
But git status still shows them as untracked changes. Normally they would not be shown and not be part of untracked changes.
I tried using git update-index --no-skip-worktree to reset the files, and then redo it, but without success.
I have no idea what is broken or where to even look, or if there was an update to the logic in git and it is now working as intended somehow.
This is on git version 2.29.2.windows.2

A: The files in question were staged automatically when applied from a stash. That's why they were showing up. Unstaging the files fixed it.


text:
Q: integral_constant vs constexpr Could you please explain, why integral_constant and constexpr approaches in the following example result in different behaviours?
#include <iostream>

using namespace std;

struct Logger
{
//    template<typename Type>
//    using IsRawString =
//        std::integral_constant<bool, std::is_same<const char*, Type>::value || std::is_same<char*, Type>::value>;

    template<typename Type>
    constexpr bool IsRawString()
    {
        return std::is_same<const char*, Type>::value || std::is_same<char*, Type>::value;
    }

    template<typename Type, typename Enable = void>
    struct Traits
    {
        static const int Index = 1;
    };

    template<typename Type>
    struct Traits<Type, std::enable_if_t<IsRawString<Type>()>>
    {
        static const int Index = 2;
    };

    template<typename Type>
    struct Traits<Type, std::enable_if_t<std::is_pointer<Type>::value && !IsRawString<Type>()>>
    {
        static const int Index = 3;
    };

};

int main()
{
    cout << Logger::Traits<int>::Index << endl
         << Logger::Traits<char*>::Index << endl
         << Logger::Traits<const char*>::Index << endl
         << Logger::Traits<void*>::Index << endl;

    return 0;
}

integral_constant approach https://ideone.com/WQy71r:
1
2
2
3

constexpr approach https://ideone.com/wPiM1m:
1
1
1
1

If I remove Logger struct and use Traits from the global scope, both approaches give the same result as for integral_constant inside struct (https://ideone.com/WGVuXE https://ideone.com/OpTbDm).

A: It happens because your IsRawString() declared as non static and it require class object for to be called.
When compiler try to generate Logger::Traits<char*>::Index and Logger::Traits<const char*>::Index it use SFINAE(http://en.cppreference.com/w/cpp/language/sfinae) and reject wrong variants with your constexpr function. The first Traits form with template<typename Type, typename Enable = void> generates only. Try declare IsRawString() as static member function


text:
Q: Drag and Drop method for Android StaggeredGrid Is it possible to make Drag and Drop method for Android StaggeredGrid?
I am using PulseLauncherGrid for drag and drop method but when I pass StaggeredGridview instead of gridview it throws ClassCastException.
Here is the code :
private StaggeredGridView grid;
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        grid = (StaggeredGridView) findViewById(R.id.grid);

        if (getScreenOrientation() == 1)
            grid.setNumColumns(3);
        else
            grid.setNumColumns(4);

        items = new ArrayList<LauncherGridItem>();

        deleteZone = (DeleteZone) findViewById(R.id.delete_zone_view);
        dragLayer = (DragLayer) findViewById(R.id.drag_layer);

        adapter = new LauncherGridAdapter(this, items, grid, dragLayer,
                deleteZone);

        adapter.setPersistenceToken("MyLauncherGrid"); // optional, but if you

        adapter.setDragListener(this);


text:
Q: unable to open old email items (pst file) Just before switching to gmail as my mail server, I did an export of my mailbox. Now I need to access some old mails and open my outlook 2013 (I still like this version the most). When I open my old pst file, it's inbox is empty, and I now have a new folder with about 2000 items called Sync Issues and a subfolder for that one called "Local Failures (This Computer only)"
Any suggestions to how I can access my old mails?


text:
Q: C++ : how to define a function in main and then pass it as an argument Firstly, I want to create a function inside main. Secondly, I want to pass this function as an argument to another function. Is it possible please?
For the first point, I know that it is possible using lambda functions or structures, as explained in the following link: Can we have functions inside functions in C++?
However, I did not manage to pass this function as an argument to another function.
More precisely, I want something like:
int main()
{
    void add(int x, int y){cout<<x+y<<endl;}
    int a = 1;
    int b = 2;
    apply_operator(add,a,b);
}

where apply_operator is defined in another file by:
void apply_operator(void (*operator)(int,int),int x,int y)
{
    operator(x,y);
}

A: Using lambdas and refraining from using the operator keyword we get:
#include <iostream>

void apply_operator(void (*op)(int, int), int x, int y)
{
    op(x, y);
}

int main()
{
    auto add = [](int x, int y) { std::cout << (x + y) << std::endl; };
    int a = 1;
    int b = 2;
    apply_operator(add, a, b);
}

Which prints 3 as expected.

A: You can certainly use a lambda.
int main()
{
    auto add = [](int x, int y){cout<<x+y<<endl;};
    int a = 1;
    int b = 2;
    apply_operator(add,a,b);
}

See it work!

A: You may be interested in using a lambda in this case
int main()
{
    auto add = [](int x, int y){ cout<<x+y<<endl; };
    int a = 1;
    int b = 2;
    apply_operator(add,a,b);
}

As long as the lambda does not capture it can decay into a function pointer.

A: You could use function pointers. I have pasted the code below. I have declared a the pointer "f" to a fucntion which takes in two integers and returs nothing in return and assigned the address of the fucntion add to it.
#include <iostream>

using namespace std;

void add(int x, int y)
{
    cout<<x+y<<endl;
}

void apply_operator(void (*f)(int, int),int a, int b)
{
    f(a, b);
}
int main()
{
    void (*f)(int, int);
    f = &add;
    int a = 1;
    int b = 2;
    apply_operator(f,a,b);
}

A: # include<iostream>

# include<conio.h>
using namespace std;
int fun(int a, int b)
{
    if(a>b)
    {
    cout<<"1st number is larger";
    }
    else
    {
    cout<<"2nd number is larger";
    }
}

int main()
{
    int a,b;
    cout<<"enter the two numbers";
    cin>>a>>b;
    fun(a,b);
    getch();

   return 0;

    getch();

}


text:
Q: Transferring UIImage from one class to another I want to take a UIImage from one class (pulled from a server) and use it in a separate class (different View Controller).
UIImage *image = [UIImage imageWithData:imageData];

This is my current code in the SecondViewController. How can I get it so that I can use the UIImage image in my FirstViewController? Thanks!

A: Its very simple... Try NSUserDefaults concept here. You can get UIImage in any view controller of the app if once stored in NSUserDefaults.
Step 1: For Storing
Image Save on NSUserDefaults in second view controller
  [[NSUserDefaults standardUserDefaults] setObject:UIImagePNGRepresentation(image) forKey:@"image"];

Step 2: For Retrieving
Image retrieve on NSUserDefaults in first view controller:
NSData* imageData = [[NSUserDefaults standardUserDefaults] objectForKey:@"image"];
UIImage* image = [UIImage imageWithData:imageData];

A: If you are using .xib to navigate from one ViewController to another then this code might help you.
Suppose you have image in you FirstViewController
UIImage *image = [UIImage imageWithData:imageData];

//------Time to go at another Class lets call it secondViewController

secondViewController *secondview =[[secondViewController alloc] initWithNibName:@"secondViewController" bundle:nil WithImage:image];
[self.navigationController pushViewController:secondview animated:YES];

SecondViewController.h
@interface secondViewController : UIViewController

@property (nonatomic,strong)UIImage *imagefromServer;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil WithImage:(UIImage *)image;

@end

SecondViewController.m
 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil WithImage:(UIImage *)image
  {
       self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
       if (self) {
       // Custom initialization
       imagefromServer= image;
       }
   return self;
  }

Hope helps you


text:
Q: How do I unit test RxJS5 when using promises? This question is about RxJS5.
Context: I tried using TestScheduler, it all works fine until I plug in the promises.
For instance let's take "someFunction" from the example below. How would I validate the output expected within 1 minute period (without actually having to wait 1 minute in the test).
const asyncFunction = new Promise( (resolve) =>
   setTimeout((() => resolve(1)), 0)
);

const someFunction = () =>
  Rx.Observable.fromInterval(15000)
    .flatMap( each => Rx.Observable.from(asyncFunction()))
    .map(each => each + 1)

A: I think this answer sums up basically everything you need to know: How do I test a function that returns an observable using timed intervals in rxjs 5?
Simply said, you should allow the user to set custom delay even thought the default value can be 15000:
const someFunction = (delay = 15000) =>
  Rx.Observable.fromInterval(delay)
  ...

Then for the TestSheduler you need to use delay <= 750 because 750 is hardcoded as the maximum virtual time. See the answer linked above for more details.


text:
Q: Consumed resources in azure Where can I see the resources I've been consumed (like hours of processing, bandwidth, etc ... ) in windows azure?
Thanks.

A: https://portal.azure.com/#blade/Microsoft_Azure_CostManagement/Menu/overview
This option is general at the end of your home panel, the very last one. this is probably the reason you didn't see it


text:
Q: Huawei E3372h usb_modeswitch I'd like to switch my Huawei E3372h-153 from HiLink/router-mode to Stick/modem-mode. I use a Raspberry Pi (Raspbian) and the usb_modeswitch tool.
My command to switch the device:
usb_modeswitch -V 12d1 -v 12d1 -P 1f01 -p14dc

This is my output:
Look for target devices ...
 No devices in target mode or class found
Look for default devices ...
   product ID matched
 Found devices in default mode (1)
Access device 010 on bus 001
Current configuration number is 1
Use interface number 0

USB description data (for identification)
-------------------------
Manufacturer: HUAWEI_MOBILE
     Product: HUAWEI_MOBILE
  Serial No.: not provided
-------------------------
Warning: no switching method given. See documentation
-> Run lsusb to note any changes. Bye!

lsusb output is same as before:
Bus 001 Device 010: ID 12d1:14dc Huawei Technologies Co., Ltd.

So I have to find out what's going wrong. I searched for "no switching method given", but I don't know what to do. usb_modeswtich --help returns this line, maybe I need to add this to my command?
 -H, --huawei-mode             apply a special procedure

So my new command:
usb_modeswitch -V 12d1 -v 12d1 -P 1f01 -p14dc -H -W

And my output:
Take all parameters from the command line

 * usb_modeswitch: handle USB devices with multiple modes
 * Version 2.2.0 (C) Josua Dietze 2014
 * Based on libusb1/libusbx

 ! PLEASE REPORT NEW CONFIGURATIONS !

DefaultVendor=  0x12d1
DefaultProduct= 0x14dc
TargetVendor=   0x12d1
TargetProduct=  0x1f01
HuaweiMode=1
NeedResponse=0

Look for target devices ...
  found USB ID 12d1:14dc
   vendor ID matched
  found USB ID 050d:705a
  found USB ID 0424:ec00
  found USB ID 0424:9514
  found USB ID 1d6b:0002
 No devices in target mode or class found
Look for default devices ...
  found USB ID 12d1:14dc
   vendor ID matched
   product ID matched
  found USB ID 050d:705a
  found USB ID 0424:ec00
  found USB ID 0424:9514
  found USB ID 1d6b:0002
 Found devices in default mode (1)
Access device 012 on bus 001
Current configuration number is 1
Use interface number 0

USB description data (for identification)
-------------------------
Manufacturer: HUAWEI_MOBILE
     Product: HUAWEI_MOBILE
  Serial No.: not provided
-------------------------
Send old Huawei control message ...
-> Run lsusb to note any changes. Bye!

Unfortunately, lsusb returns the same result:
Bus 001 Device 012: ID 12d1:14dc Huawei Technologies Co., Ltd.

Has anyone tips to switch the Huawei mode?


text: Q: IIS HTTP Response Headers Work When Added Globally but Not To Specific Site In IIS, when I add HTTP Response Headers at the server level, the headers work correctly. However, when I remove the headers from the server, and add it to all the sites locally, it no longer works. Would there be a reason the inherited headers work while the local ones don't?


text:
Q: Can't accept/deny individual changes with git merge anymore, can only accent/deny all changes all at once When attempting to merge my main branch into my current branch earlier today (I misclicked a change I didn't want to keep so needed to restart the process), and also when merging in previous projects, I've been able to open each file, view every single change individually, and accept or deny them one-by-one. All of a sudden those options are gone, and I can only accept or deny all changes at once in the source control tab itself. Weirdly enough, I'm still seeing this text around each of my differences without any option to click accept/deny on any of them:
<<<<<<< HEAD
...some changes here
=======
...old code here
>>>>>>> main

Naturally since <<<<<<< HEAD, =======, and >>>>>>> main aren't actually code, I'm getting syntax errors via VS Code automatically adding them around each change during my attempted merge. What I'm confused about is why it's suddenly treating these additions as actual text/additions to my code, rather than the temporary merge UI I was able to use before (with accept or deny buttons directly above each change). There are also no more green or red highlights around these sections showing the merge differences at all.
Rather than accept/deny them individually in each file normally, I was able to use the source control tab of VS Code itself to manage the merge at least somewhat, but it appears that the only options in each file are to accept or deny ALL changes at once, and I cannot verify each change individually. I've attempted to reinstall VS Code and re-cloned my repo and branch as well.
Does anyone have any idea what caused this, or any way to fix it?
Edit: I have verified that the issue involves the "Code Lens" setting in user preferences, however changing its value (or any similar ones) doesn't seem to do anything

A: Solved the issue. Apparently VS Code forces its new "Git: Merge Editor" setting to be enabled by default. Even if you have your corresponding "Code Lens" settings enabled, they will be overridden if you have "Git: Merge Editor" enabled. Disabling that did the trick.


text:
Q: dll hook not updating callstack correctly when returning I am following the process to create a trampoline in order to hook a dll function (in my case Direct3DCreate9 from d3d9.dll) as outlined here: https://www.malwaretech.com/2015/01/inline-hooking-for-programmers-part-1.html and https://www.malwaretech.com/2015/01/inline-hooking-for-programmers-part-2.html
My code differs slightly as I am working out the offset bytes manually using a disassembler rather than using the hde32_disasm function.
Everything seems to work fine, the victim process calls my injected dll wrapper function, the new function does some stuff, then calls the original function (Direct3DCreate9), once the original returns the wrapper should then call some other stuff, before returning to the victim process.
Unfortunately when the original function is called from the hook wrapper it returns back to the victim application and not the hook wrapper, this means it misses out some of the code from the wrapper.
Having stepped through the disassembly it looks as though the call stack is being overwritten so when the Direct3DCreate9 returns it pops back to the victim application instead of my hook function that made the call.
I'm guessing I need to push the hook function manually onto the call-stack? How would I go about this?
Other potentially pertinent information: Both the victim process and the hook have been built in debug mode. Direct3DCreate9 is a __stdcall and I am using vs2010 for the hook dll, but the victim process was compiled with vs2015.

A: It turns out the callstack was being knobbled by the NVidia graphics driver nvd3d9wrap.dll. This dll was injecting into the d3d9 application in the same manner as what I was trying to do. This lead to the madness explained in the original post.
The solution was to open Device Manager in windows and disable the NVidia graphics driver. Thankfully my pc has an integrated graphics chip, so I am able to use that.


text:
Q: Firebase storage rules unauthorized
i'm trying to upload files and unless im using alllow read, write, i'm getting unauthorized.
FirebaseStorageError {code_: "storage/unauthorized", message_: "Firebase
Storage: User does not have permission to…2/dxbdIGnx2Qdm9MfTtG5e/if_spider-
web_345348.png'.", serverResponse_: "{↵  "error": {↵    "code": 403,↵
"message": "Pe…n denied. Could not perform this operation"↵  }↵}", name_:
"FirebaseError"}

I was wondering how does firebase knows that the user is logged in ? In my code i do not send any authentication while trying to upload files.
here is my code for uploading the file :
let uploadTask = storageRef.child(`user_content`).child(uid).child(upload.podcast_id).child(upload.file.name).put(upload.file);
  uploadTask.on(firebase.storage.TaskEvent.STATE_CHANGED,
    (snapshot) =>{
      // upload in progress
      upload.progress = Math.floor((uploadTask.snapshot.bytesTransferred / uploadTask.snapshot.totalBytes )* 100)
    },
    (error) =>{
      // upload failed
      this.flashMessagesService.show('Oh snap! please try again..',  { cssClass: 'alert alert-danger', timeout: 1500 })
      console.log(error)
    },
    () => {
      // upload success
      upload.url = uploadTask.snapshot.downloadURL;
          //  upload.name is the name ref in firebase storage
      upload.name = uploadTask.snapshot.ref.name;
      upload.ref = uploadTask.snapshot.ref.fullPath;
      this.flashMessagesService.show('File was successfuly uploaded!',  { cssClass: 'alert alert-success', timeout: 1500 })

    }
  )
 }

i have an authentication service that requires a user to be logged in in order to even get to this uploading page :
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import {FlashMessagesService} from 'angular2-flash-messages';

import * as firebase from'firebase/app';
import { AngularFireAuth } from 'angularfire2/auth';
import { AngularFirestore, AngularFirestoreCollection, AngularFirestoreDocument } from 'angularfire2/firestore';
import  {Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/switchMap'
import { User } from '../models/user'
@Injectable()
export class AuthService {
user: Observable<User>;
currentUser: firebase.User;
  constructor(
    private afAuth: AngularFireAuth,
    private afs: AngularFirestore,
    private router: Router,
    public flashMessagesService: FlashMessagesService,
  ) {
      // Get auth data, then get firestore user document // null
      this.user = this.afAuth.authState
      .switchMap(user => {
        if(user){
          return this.afs.doc<User>(`users/${user.uid}`).valueChanges();
        } else {
          return Observable.of(null)
        }
      })
 }

getCurrentUser(){
  return this.afAuth.auth.currentUser;
}

getAuthState(){
let currentUser = this.afAuth.auth.currentUser;

  if(currentUser){
    return true;
  }else{
    return false;
  }

}

 googleLogin() {
  const provider = new firebase.auth.GoogleAuthProvider();
   return this.oAuthLogin(provider);
  }
facebookLogin(){
  const provider = new firebase.auth.FacebookAuthProvider();
  return this.oAuthLogin(provider);
}
anonymousLogin(){
  const provider = new firebase.auth.EmailAuthProvider();
  return this.oAuthLogin(provider);
}

  private oAuthLogin(provider){
    return this.afAuth.auth.signInWithPopup(provider)
    .then((credential)=> {
      this.updateUserData(credential)
      this.router.navigate(['/home'])
    })
  }

  private updateUserData(credential){
    const userRef: AngularFirestoreDocument<User> = this.afs.doc(`users/${credential.user.uid}`);
    const data: User = {
      uid: credential.user.uid,
      email: credential.user.email,
      displayName: credential.user.displayName,
      photoURL: credential.user.photoURL,
      accessToken: credential.credential.accessToken,
    }
    if(!data.gender){
      data.gender = 'Unassigned'
    }
    this.flashMessagesService.show('You are now logged in ', { cssClass: 'alert alert-success', timeout: 3000 })

    return userRef.set(data)
  }
  signOut() {
    this.afAuth.auth.signOut().then(() => {
      this.flashMessagesService.show('You are now logged out ', { cssClass: 'alert alert-success', timeout: 3000 })

        this.router.navigate(['/']);
    });
  }
}

i'm using login with google in this example. still it is not clear to me how does firebase knows that the user is logged in , since i do not send any authorization upon uploading a file. if you can shed any kind of light on this, it would be great because i've been breaking my balls on this for 3 days.


text:
Q: creating a Binary tree based on a prefix expression I want to find the value of a the prefix expression -/+8,10,2*3,2 and build its binary tree I am trying to learn this for a math course, but have absolutely no clue how to do it. Any help would be awesome!

A: Hint: Think of a binary operator as a function whose two inputs are the next two numbers that come directly to the right of it. That is, if we define the following functions:
\begin{align*}
s(x,y) &= x-y \\
d(x,y) &= x/y \\
a(x,y) &= x+y \\
m(x,y) &= x*y \\
\end{align*}
then you can interpret the prefix expression to be:
$$
s\left(d \left( a \left(8, 10 \right), 2\right),  m\left(3 , 2 \right) \right)
$$

A: You can even Try using stack to solve it which is much more easy than the binary tree.
In-fact the expression tree is just other form of representation However OS internally invokes stack to compute the result on the real machine..
For you i have mentioned both .
Please feel free to ask if you get any more doubt and/or any other doubt in Data structures or related field.
And Yes the Answer is 3.


text:
Q: Paypal - Possible to refund through RESTFUL API using a web_accept I'm currently looking into the possibility of refunding a web_accept type payment for PayPal.
We accept payments on our website and i'd like to automatically refund a transaction. For example:
I have a web_accept payment: Web Accept Payment Received (Unique Transaction ID #XXXXXXXXX)
$sale = Sale::get('XXXXXXXXX', $apiContext);
My refund Sale:get() argument returns:
'Got Http response code 404 when accessing https://api.paypal.com/v1/payments/sale/6LN17852AX690712B.'
Which obviously isn't working. Any chance someone can help me out?

A: It is not possible to refund a web_accept transaction via REST API.
You will get this error
name:INVALID_RESOURCE_ID

message:The requested resource ID was not found.

So, you will need to use RefundTransaction API to refund this transaction.


text:
Q: Odd behaviour when adding a toolbutton to the delphi ide I was trying out some things and wanted to make a delphi IDE extension.
My basic idea was expanding the ToDo list feature that is currently in the IDE.
Step one was adding a toolbutton to the IDE which would open a form showing the todo items.
But I noticed some weird things that I hopefully caused myself since that would mean it can be easily fixed.
I am adding my toolbutton to the CustomToolbar, which is the one with the blue questionmark (see screenshot later)
The thing that happens: I install my package and the button is added with the correct image, right next to the existing button.
Now I close the modal form with the installed packages and then the blue questionmark changes.

Don't mind the icon I used, I will use a different one eventually but ok.
So basicly the existing item changes to my own icon but disabled for some reason. And I can't figure out why this happens.
As suggested in the guide I found online I used a TDatamodule to implement my code.
My code:
procedure TDatamoduleToDoList.Initialize;
var
  LResource, LhInst: Cardinal;
begin
  LhInst := FindClassHInstance(Self.ClassType);
  if LhInst > 0 then
  begin
    LResource := FindResource(LhInst, 'icon', RT_Bitmap);
    if LResource > 0 then
    begin
      FBMP := Vcl.Graphics.TBitmap.Create;
      FBMP.LoadFromResourceName(LhInst, 'icon');
    end
    else
      DoRaise('Resource not found');
  end
  else
    DoRaise('HInstance Couldn''t be found');
  FToDoAction := TTodoAction.Create(Self);
  FToDoAction.Category := actionCat;
  FToDoAction.ImageIndex := FIntaServices.ImageList.Add(FBMP, nil);
  FToDoAction.Name := 'my_very_own_action_man';
end;

procedure TDatamoduleToDoList.DataModuleCreate(Sender: TObject);
begin
  //Create extension
  if Supports(BorlandIDEServices, INTAServices, FIntaServices) then
  begin
    Initialize;
    if FToDoAction <> nil then
      FCustBut := TSpeedButton(FIntaServices.AddToolButton(sCustomToolBar, 'CstmToDoList', FToDoAction))
    else
      DoRaise('Initialize failed');
  end
  else
    DoRaise('Something went wrong');
end;

DoRaise is my own procedure that simply destroys all of my objects and raises an exception, did this to prevent mem leaks in the ide.
But, I think, I don't do anything weird but yet this problem occurs.
So I'm hoping someone here might have done something simular and sees the error in my code.
Thanks in advance.
P.s. if you need any more info or see the rest of the unit let me know and ill put the entire unit on github or something like that.
Edit:
Thanks to @Uwe Raabe I managed to solve this problem.
The problem was found in the comments of INTAServices.AddImages

AddImages takes all the images from the given image list and adds them
  to the
         main application imagelist.  It also creates an internal mapping array from the
         original image indices to the new indices in the main imagelist.  This
         mapping is used by AddActionMenu to remap the ImageIndex property of the
         action object to the new ImageIndex.  This should be the first method
         called when adding actions and menu items to the main application window.
         The return value is the first index in the main application image list of
         the first image in the source list. Call this function with an nil
         image list to clear the internal mapping array. Unlike the AddImages function from
         the ancestor interface, this version takes an Ident that allows the same base index
         to be re-used.  This is useful when the IDE implements demand-loading of
         personalities so that the images will only get registered once and the same image
         indices can be used.

The solution eventually was adding my image to a local imagelist which was added to the imagelist of IntaServices
Code:
procedure TDatamoduleToDoList.DataModuleCreate(Sender: TObject);
begin
  //Create extension
  if Supports(BorlandIDEServices, INTAServices, FIntaServices) then
  begin
    Initialize;
    if FToDoAction <> nil then
    begin
      FCustBut := TSpeedButton(FIntaServices.AddToolButton(sCustomToolBar, 'CstmToDoList', FToDoAction));
      FToDoAction.ImageIndex := FIntaServices.AddImages(FImages);//This is the fix
    end
    else
      DoRaise('Initialize failed');
  end
  else
    DoRaise('Something went wrong');
end;

A: You are not supposed to fiddle around with the INTAServices.ImageList directly. Instead use either INTAServices.AddMasked or INTAServices.AddImages (in case you have a local imagelist in your datamodule).
You can safely use the INTAServices.ImageList to be connected to your controls, but you should neither Add nor Delete the images in it directly.


text:
Q: Is it true that Java implicitly defines references to the objects used in classes? After reading the books, surfing the nets regarding the type of references in Java, I still have some doubts (or I may have interpreted the concept wrong).
It would be a great help for me if anyone clear my doubts.
Let me take an example of a class containing class variables, instance variables and local variables.
public class Test {
  public static ArrayList<String> listCommon = new ArrayList<String>();
  private HashMap<String, String> mapInstance;

  public Test() {
    mapInstance = new HashMap<String, String>();
  }

  public void doSomething(String key) {
    ArrayList<String> local = new ArrayList<String>();
    if(key != null){
      local.add(mapInstance.get(key));
    }

    System.out.println("Value is added in instance Map: ", mapInstance.get(key));
  }
}

My Question are;
1. are listCommon (static variable) and mapInstance (instance variable) Strong reference towards Garbage Collector?
2. Is variable local (defined and used in method) a Weak reference?
3. How the Phantom reference and Soft reference came in picture?
4. OR above 3 concepts are invalid; means that Java defines the references only if you explicitly used the type defined in java.lang.ref package?
Any help would be great for me.

A: Read this blog post about variable references.
** Update **
An atomic reference is an object referenced in such a way that it is accessed atomically; meaning that there are no race condition accessing it. For example:
class RaceTest {
   static private int count = 0;
   static public void main(String...args) {
      Thread t1 = new Thread(new Runnable() {
         public void run() {
             for (int i=0; i<1000000; i++) {
                 count++;
             }
      });
      Thread t2 = new Thread(new Runnable() {
         public void run() {
             for (int i=0; i<1000000; i++) {
                 count--;
             }
         }
      });

      t1.start();
      t2.start();

      t1.join();
      t2.join();

      System.out.println("Final count (should be 0) = " + count);
   }
}

Will spawn two threads that 1) will increment count and 2) will decrement it. Now, both threads will run in parallel and the program will wait until both terminate (at the join point). A common idea would be that since both threads have the same loop (will loop the same amount of time), each will "cancel" each other's operation and thus count should be 0, but this is not the case. Why? Because while, for example, t1 may want to increase the variable, such operation is not atomic, but is more in the order of : get, inc, set. So there may be cases that, even before the second operation inc is made, t2 would have accessed the variable and dec the variable, thus t1 would have had actually +2 the variable. And vice versa in an indefinite manner. (Each run of the code would produce a different value.)
Now, replacing int by AtomicInteger and using incrementAndGet() or decrementAndGet() will solve the issue by rendering the get, inc, set into a single operation, and eliminating the race condition in the code.

A: Answer to questions:

*

*Yes, they are strong reference. Weak Reference are defined using Weak reference Object.

*No, reason as 1).

*Phantom Reference doesn't apply in your example. By default, all instances are strong reference.

*Yes, you specify weak/phantom reference using the java.lang.ref package. By default, strong reference is used.
Note: A wikipedia explaination of Weak Reference might be useful.

A:

*

*are listCommon (static variable) and mapInstance (instance variable) Strong reference towards Garbage Collector?

They are strong references, yes.

*

*Is variable local (defined and used in method) a Weak reference?

No, it is a local variable, so it is a variable, so it is still a strong reference.

*

*How the Phantom reference and Soft reference came in picture?

If you use them. If you don't use them you don't need to worry about them. They are for writing various kinds of caches really.

*

*OR above 3 concepts are invalid; means that Java defines the references only if you explicitly used the type defined in
  java.lang.ref package?

Reference variables are always strong. The other kinds only arise when you use them explicitly.


text:
Q: Arguments in for loop I am new to programming and had this random question crossed my mind while learning for loop:
import pandas as pd
name = ['Amy','Luke','Anderson']
occupation = ['Data Scientist','Lawyer','Teacher']
df = pd.DataFrame({'name':name, 'occupation':occupation})

for a, b in df.iterrows():
   print(b['name'] + ' is a ' + b['occupation'])

In the print line, b is used in b['name'] and b['occupation'] but not a. Why is it okay that a is not mentioned?

A: Because if you print a you will print just line number while part of each row, is a part that is not needed to be displayed.

A: Because a, while part of each row, is a part that is not needed to be displayed.

A: If you print a you will notice that a is just line number, just like using enumerate wrapping for loop

A: a is the row index, 0,1,2. IT's not required for your loop.

A: a is just the index, but if you don't need it simply replace with _.

A: Because a and b are index and row.


text:
Q: Android SQLite nested transactions in tests In our application we have "mirror tables" - pairs of almost identical tables, and we need to test our app's logic so that handles writing in that mirror tables in proper way. Appears that we can test it on the database level only - we want to check that result of method's work was written in the database correctly. We thought that we can begin outer transaction in @BeforeClass method, perform some changes in nested transactions created and closed in test cases, so in every test case we will have the same basic data set loaded in the database and after some operations made by test case we'll just rollback nested transaction. And, of course, end outer transaction in @AfterClass method without marking it as clean so changes won't appear in the app's database.
It appears that it cannot be achieved because Android doesn't support nested transactions properly - see this answer.
Maybe there is the way to test this behaviour without affecting database? Or there is some workaround for nested transactions?
Thanks!

A: The Android database framework implements nested transactions, but only by suppressing any SQL statements for any inner transactions, any rolling back the outermost transaction if any (outer or nested) transaction is not successful.
Transactions and savepoints have different semantics. If you want to roll back to savepoints, you actually have to use the savepoint statements; in Android, this requires avoiding the framework's beginTransaction() etc. calls everywhere, and executing the savepoint SQL statements directly. In other words, you have to ensure that the tested code uses your own database framework.


text:
Q: Application is running but I cannot see anything on the screen I am working on react native application. I have two components Home and About. I imported them into App.js. I am using createBottomTabNavigator. Below is my App.js file.
import 'react-native-gesture-handler';
/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *
 * @format
 * @flow strict-local
 */

import React from 'react';
import type {Node} from 'react';
import {
  SafeAreaView,
  ScrollView,
  StatusBar,
  StyleSheet,
  Text,
  useColorScheme,
  View,
} from 'react-native';

import {
  Colors,
  DebugInstructions,
  Header,
  LearnMoreLinks,
  ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';

import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { NavigationContainer } from '@react-navigation/native';

import HomeScreen from './components/HomeScreen';
import AboutScreen from './components/AboutScreen';

const Tab = createBottomTabNavigator();

const App: () => Node = () => {
  return (
    <NavigationContainer initialRouteName="Home">
      <Tab.Screen name="Home" component={HomeScreen} />
      <Tab.Screen name="About" component={AboutScreen} />
    </NavigationContainer>
  );
};

export default App;

Here are my components.
import React, { Component } from 'react';
import { Button, View, Text } from 'react-native';

export default function HomeScreen() {
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center', color: 'red' }}>
      <Text>Home Screen</Text>
    </View>
  )
}

About
import React, { Component } from 'react';
import { Button, View, Text } from 'react-native';

export default function AboutScreen() {
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <Text>About Screen</Text>
    </View>
  )
}

After this application is running but I cannot see anything on the screen. Here is the output.

Now what am I doing wrong and how can I fix this?
Following @nithinpp answer I get this error now.
Error: Requiring unknown module "undefined". If you are sure the module exists, try restarting Metro. You may also want to run `yarn` or `npm install`.
MaybeScreen@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mynio&modulesOnly=false&runModule=true:123520:24
RCTView
View
MaybeScreenContainer@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mynio&modulesOnly=false&runModule=true:123489:23
RNCSafeAreaProvider
SafeAreaProvider@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mynio&modulesOnly=false&runModule=true:121702:24
SafeAreaProviderCompat@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mynio&modulesOnly=false&runModule=true:123278:24
BottomTabView@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mynio&modulesOnly=false&runModule=true:111962:30
BottomTabNavigator@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mynio&modulesOnly=false&runModule=true:111824:32
EnsureSingleNavigator@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mynio&modulesOnly=false&runModule=true:116000:24
BaseNavigationContainer@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mynio&modulesOnly=false&runModule=true:115512:28
ThemeProvider@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mynio&modulesOnly=false&runModule=true:121023:21
NavigationContainerInner@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mynio&modulesOnly=false&runModule=true:120883:26
App
RCTView
View
RCTView
View
AppContainer@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mynio&modulesOnly=false&runModule=true:75604:36
mynio(RootComponent)@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mynio&modulesOnly=false&runModule=true:82460:28
 ERROR  Error: Requiring unknown module "undefined". If you are sure the module exists, try restarting Metro. You may also want to run `yarn` or `npm install`.
MaybeScreen@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mynio&modulesOnly=false&runModule=true:123520:24
RCTView
View
MaybeScreenContainer@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mynio&modulesOnly=false&runModule=true:123489:23
RNCSafeAreaProvider
SafeAreaProvider@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mynio&modulesOnly=false&runModule=true:121702:24
SafeAreaProviderCompat@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mynio&modulesOnly=false&runModule=true:123278:24
BottomTabView@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mynio&modulesOnly=false&runModule=true:111962:30
BottomTabNavigator@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mynio&modulesOnly=false&runModule=true:111824:32
EnsureSingleNavigator@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mynio&modulesOnly=false&runModule=true:116000:24
BaseNavigationContainer@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mynio&modulesOnly=false&runModule=true:115512:28
ThemeProvider@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mynio&modulesOnly=false&runModule=true:121023:21
NavigationContainerInner@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mynio&modulesOnly=false&runModule=true:120883:26
App
RCTView
View
RCTView
View
AppContainer@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mynio&modulesOnly=false&runModule=true:75604:36
mynio(RootComponent)@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.mynio&modulesOnly=false&runModule=true:82460:28
 ERROR  TypeError: undefined is not an object (evaluating '_$$_REQUIRE(_dependencyMap[6], "@react-navigation/elements").ResourceSavingView')

This error is located at:
    in MaybeScreen (at BottomTabView.tsx:122)
    in RCTView (at View.js:32)
    in View (at ScreenFallback.tsx:31)
    in MaybeScreenContainer (at BottomTabView.tsx:93)
    in RNCSafeAreaProvider (at SafeAreaContext.tsx:76)
    in SafeAreaProvider (at SafeAreaProviderCompat.tsx:46)
    in SafeAreaProviderCompat (at BottomTabView.tsx:92)
    in BottomTabView (at createBottomTabNavigator.tsx:112)
    in Unknown (at createBottomTabNavigator.tsx:111)
    in BottomTabNavigator (at App.js:44)
    in EnsureSingleNavigator (at BaseNavigationContainer.tsx:429)
    in BaseNavigationContainer (at NavigationContainer.tsx:132)
    in ThemeProvider (at NavigationContainer.tsx:131)
    in NavigationContainerInner (at App.js:43)
    in App (at renderApplication.js:48)
    in RCTView (at View.js:32)
    in View (at AppContainer.js:106)
    in RCTView (at View.js:32)
    in View (at AppContainer.js:133)
    in AppContainer (at renderApplication.js:41)
    in mynio(RootComponent) (at renderApplication.js:57)
 ERROR  TypeError: undefined is not an object (evaluating '_$$_REQUIRE(_dependencyMap[6], "@react-navigation/elements").ResourceSavingView')

This error is located at:
    in MaybeScreen (at BottomTabView.tsx:122)
    in RCTView (at View.js:32)
    in View (at ScreenFallback.tsx:31)
    in MaybeScreenContainer (at BottomTabView.tsx:93)
    in RNCSafeAreaProvider (at SafeAreaContext.tsx:76)
    in SafeAreaProvider (at SafeAreaProviderCompat.tsx:46)
    in SafeAreaProviderCompat (at BottomTabView.tsx:92)
    in BottomTabView (at createBottomTabNavigator.tsx:112)
    in Unknown (at createBottomTabNavigator.tsx:111)
    in BottomTabNavigator (at App.js:44)
    in EnsureSingleNavigator (at BaseNavigationContainer.tsx:429)
    in BaseNavigationContainer (at NavigationContainer.tsx:132)
    in ThemeProvider (at NavigationContainer.tsx:131)
    in NavigationContainerInner (at App.js:43)
    in App (at renderApplication.js:48)
    in RCTView (at View.js:32)
    in View (at AppContainer.js:106)
    in RCTView (at View.js:32)
    in View (at AppContainer.js:133)
    in AppContainer (at renderApplication.js:41)
    in mynio(RootComponent) (at renderApplication.js:57)

A: You will have to wrap your Tab.Screen inside a Tab.Navigator. This will register those screens to the variable created with createBottomTabNavigator();
Simply change your App.js to return
const App: () => Node = () => {
  return (
    <NavigationContainer>
      <Tab.Navigator>
        <Tab.Screen name="Home" component={HomeScreen} />
        <Tab.Screen name="About" component={AboutScreen} />
      </Tab.Navigator>
    </NavigationContainer>
  );
};

https://snack.expo.dev/@nithinpp69/amused-hummus


text:
Q: Entity can still be selected after deleted by hibernate in transaction I have a method to delete record by hibernate. I add a query after deletion. And the record deleted is still in the result list. It should not be.  Here is the code.
@Transactional
public void deleteFoo(long fooId){
    Foo foo = fooDao.find(fooId);
    fooDao.delete(foor);
    List<Foo> brothers = fooDao.findByParentId(foo.getParentId());
    // I think the brothers does not contains foo.
    // Unfortunately, foo is still in the list.
    // I do not know why and how to make sure the brothers does not contains foo.
    ...
}

The record is deleted from database where the transaction committed.

A: You should flush the hibernate session.
When your work with database via Hibernate you are using Hibernate session.
Hibernate sessions flushed to the database by following three situations.

*

*commit()- When you commit a transaction

*Before you run a query

*When you call session.flush()

or you can flush it manually by
session.flush()


text:
Q: Jasmine - Getting "describe is not defined" when run the script using spectron I have install spectron using the following command
 npm install -g spectron
but i am unable to run globally.
So I install locally as you said.
 have installed Jasmine and i have specified test scrips as jasmine in package.json
var Application = require('spectron').Application
var assert = require('assert')
var jasmine = require('jasmine')

describe('application launch', function () {
  beforeEach(function () {
    this.app = new Application({
        path: 'C:\\Users\\ramass11\\AppData\\Local\\Programs\\ng-site-solutions\\ng-site-solutions.exe'
     })
    return this.app.start()
  })
})

If I run my script using the command node First.js, I am getting
"describe is not  defined"
I want to know why i am getting this error and whether the way i am importing the jasmine is right ?

A: It could be that you are missing the TypeScript definitions for Jasmine. Have you added "@types/jasmine": "2.6.0" to your package.json file under devDependencies?
If not run npm install --save @types/jasmine

A: You should run your test with some kind of test runner (which defines describe and it), I would recommend mocha in this case.
npm install mocha --save-dev
node_modules/.bin/mocha First.js


text:
Q: Custom TileSource is not working properly to load initial level image I am trying to make custom tile source, I have simple copy paste the code from here : https://openseadragon.github.io/examples/tilesource-custom/
But i can see the Output as per here : http://screencast.com/t/j7Qvh4URsX
and for the Images related output here.. http://screencast.com/t/nPSGdRRbkn
Here questions are :
1) what is the correct way to load images properly..i cant see there are much documentation for it. if any specific info please provide me..
2) why there is (level-8)... ?
3) How can i make it dynamic.. for example if i want to make load images from my PC related folders dynamically with ajax call using asp.net mvc.. is there any examples...
4) I have much read about but not exact info for custom tile source to load the images to show the output as on Demo page...
I am using below code currently, it will go later based on ajax call to load local folders - level0,1,2,3,4,5,6 etc
var viewer = OpenSeadragon({
    id: "example-custom-tilesource", showNavigator: true,
    wrapHorizontal: true,
    tileSources:   {
        height: 512*256,
        width:  512*256,
        tileSize: 256,
        minLevel: 8,
        getTileUrl: function (level, x, y)
        {
            console.log("URL::->"+ "http://s3.amazonaws.com/com.modestmaps.bluemarble/" +(level-8) + "-r" + x + "-c" + y + ".jpg")
            return "http://s3.amazonaws.com/com.modestmaps.bluemarble/" +
                    (level-8) + "-r" + x + "-c" + y + ".jpg";

        }
    }
});

A: This is being discussed here: https://github.com/openseadragon/openseadragon/issues/547


text:
Q: Android: multiple-user how to change system locale/ language per single User I'm working on the AOSP with multiple-user.
I need to change the default system language (or locale) to single user, all my attempts change the entire system language for all users.
I use the ActivityManagerNative class, updateConfiguration(myConfiguration)
is it possible? if so, how :)
Thanks.

A: I just tried to do this with the settings on my Android 4.4.4 tablet (not AOSP, but Nexus 7 (2013)) and it gave me a warning that it would change the locale for all users.  :(
I think this is not possible, neither programmatically, or physically.


text:
Q: HTTP GET POST -> How to use both at the same time? (.Net environment ) I am not the best with webservices......let me just preface this question with that.
Anyways, I am attempting to write something that will contact a vendor's server and I have been reading their documentation.
They say that I need to submit a HTTP POST request, but I must also submit some configurations via an HTTP GET also.
I am confused when they say this as I didn't think that these could technically be done at the same time.
Essentially, I need to supply my required XML for the Post. :
<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<!DOCTYPE VendorZ>
<VendorZ Service='Info::Customers'>
<Addr>
        <City>toronto</City>
        <Country>ca</Country>
        <Region>on</Region>
        <Street>133 king st east</Street>
</Addr>
</VendorZ>

But then my url and password settings via a url in an http get. :
http://service.megaupload.com/mega/?Config=pwConfigSettings

I have reviewed a couple links on this website. :
https://stackoverflow.com/questions/92522/http-get-in-vb-net
and
HttpWebRequest with POST and GET at the same time
But I am still fairly confused about how to go about doing this.
I know this isn't really that difficult, but hoping someone can shine some light on this.  As I said I have read quite a few posts across the net, but it just isn't clicking for me today.
Any advice/direction is greatly appreciated.
Thanks.

A: In some cases, sets of related network-accessible services are called "APIs" . As examples, Google has a "maps API", and Bing has a "search API".   Facebook exposes their "Graph API".

an aside:
By my mind, these aren't APIs according to the traditional definition: an application programming interface.  Traditionally, an API is  set of related function calls - or a class library in an OO environment - exposed by a library module.  A programmer would link his code to a library in order to be able to call those APIs.
These network-accessible functions are, to my mind, different. They are application network interfaces, not application programming interfaces.  Maybe no one wanted to use the moniker ANI to describe these things. But let's be clear that we are talking about network interfaces here.

Within each ANI/API, whether from Google, Bing, Facebook, or someone else, there are typically numerous functions available. Each of these functions is independently available via some network protocol. In other words, a remote application sends a message, conforming to a particular data format, in order to "use" or "invoke" the function. Each of the network messages is different. Each has independent constraints and requirements.
It sounds to me that some of the functions in the API you are using, require POST.  Some require GET.  When you want to use function A, then use HTTP POST and send a message formatted thusly; if you want to use function B, then use HTTP GET and format your request this way.
It could be as simple as that.
You wouldn't use them at the same time.  You'd use them from the same app, at different times.


text:
Q: How to retreive values in DropwnList for all selected chekboxes, and return to default when unchecked? Default dropdownlist values include locations for all books.  When I select a checkbox the the dropdownlist should populate only the locations where that book is available.In back-end, My Stored procedure is working fine for single parameter and multiple values.
But in UI, I can get locations for only one checkbox, if I click second checkbox the dropdown list does not include the value for that second checkbox.
Also when I unclick all it should return to default.
Any hint or help will be appreciated.
BooksLocations
<asp:DropDownList runat="server" ID="drpdwnListLocationBooks" CssClass="formcontrol">
</asp:DropDownList>

Books
<asp:CheckBoxList runat="server" ID="chkboxListbookStatus">
    <asp:ListItem Text="Book A"></asp:ListItem>
    <asp:ListItem Text="Book B"></asp:ListItem>
    <asp:ListItem Text="Book C"></asp:ListItem>
</asp:CheckBoxList>

A: Add below code
<asp:CheckBoxList runat="server" ID="chkboxListbookStatus"
 AutoPostBack="True" OnSelectedIndexChanged="chkboxListbookStatus_SelectedIndexChanged">

Then in code behind
protected void chkboxListbookStatus_SelectedIndexChanged(object sender, EventArgs e)
{
  CheckBoxList list = sender as CheckBoxList;
  ListItem box = list.SelectedItem;
  //add code to get data from SP to fill data in dropdown
}


text:
Q: I forgot the password for my me.com account. how can I get it? I am trying to get save on my iCloud but I can't remember the password of my me.com account.  how do I reset the password?  I tried everything I thought it might be.  I tried to change it but can't remember my hint.  It doesn't do any good to have an email sent to me when I can't remember the password for the account.  What do I do?

A: Go to https://iforgot.apple.com and follow the instructions there.


text:
Q: How to format time 12:00:00 or 12:00:am to 12:00 AM? I am using strtotime()
its working fine for $time = '12:00:00';
but
$time = '12:00:am';
echo date('h:i A ', strtotime($time));

it return 4:00 PM but I want output is 12:00 AM

A: This Function could help you. It takes a time like your format "12:00:00 or 12:00:am" and output it's as your needs like this "12:00 AM" .
function convert_time($the_time){
    $time_arr = explode(":",$the_time);
    if($time_arr[2] != "am" || $time_arr[2] != "pm"){
        if($time_arr[0] >= "0" && $time_arr[0] <= 12){
            if($time_arr[0] == 12 && $time_arr[1] > 00){
                $time_arr[2] = "pm";
            } else {
                $time_arr[2] = "am";
            }
        } else {
            $time_arr[2] = "pm";
        }
        $new_time = $time_arr[0].":".$time_arr[1]." ".strtoupper($time_arr[2]);
        return $new_time;
    }
    $new_time = $time_arr[0].":".$time_arr[1]." ".strtoupper($time_arr[2]);
    return $new_time;
}

$time = '12:00:am';
echo convert_time($time);


text:
Q: LINQ - check for equality inside join Is it possible to check if in LINQ Join method first object (not)equals the second object?
For example,
Let say I implemented SomeData class with Name and Number property. I made three different instances of this class and stored them inside List<> object.
List<SomeData> data = new List<SomeData>();
SomeData a = new SomeData();
SomeData p = new SomeData();
SomeData v = new SomeData();

a.Name = "Ann";
a.Number = 1;
p.Name = "Peter";
p.Number = 4;
v.Name = "Vicky";
v.Number = 1;

data.Add(a);
data.Add(p);
data.Add(v);

Now, I'd like to get new SomeData object which is created with two SomeData instances in data List have the same Number property.
var joinedData = data
.Join(first => first.Number,
     second => second.Number,
     (first, second) => new SomeData
     {
         Name = first.Name + " & " + second.Name,
         Number = first.Number
      });

However, when this query executes, it creates object even when first and second are the very same instaces. Is there a way to check for this inside query? Something like
var joinedData = data
.Join(first => first.Number,
      second => second.Number,
      if (first != second)
      {
          (first, second) => new SomeData
          {
          ...
          }
      });

Only thing I'd really like is that I get answer in "non-SQL like syntax".
EDIT1:
Current output with code
foreach(SomeData sd in joinedData)
{
 Console.Writeline (sd.Name)
}

is
Peter & Peter
Vicky & Vicky
Vicky & Ann
Ann & Vicky
Ann & Ann

and desired output is
Ann & Vicky

Right, actually above would be perfect-desired output, however,
Ann & Vicky
Vicky & Ann

will do just fine.

A: Join does that per default (ie use a default comparer with x.Equals(y))
If you need a custom comparison you can use the overload where you give an IEqualityComparer (see MSDN)
var myComparer = new MyComparer();  //Must implement IEqualityComparer<T>
var joinedData = data.Join(other, first => first.Number, second => second.Number, (first, second) => {...}, myComparer);


text:
Q: Selecting checkbox in a table from specific row and column using Capybara I am new with Capybara and I need to select checkbox that is in the same column where is Wednesday. How can I select it? I tried several ways but I still get this error that element not found.
HTML part looks like this:

                    From

                    To

                    Monday

                    Tuesday

                    Wednesday

                    Thursday

                    Friday

                    Saturday

                    Sunday

                        <input name="t:formdata" type="hidden" value=
                        "H4sIAAIDOPgvsNqt">

<input class=
                        "timepicker-input patternDailyStart hasDatepicker" id=
                        "patternDailyStart_1470ffb567f" name=
                        "patternDailyStart_1470ffb567f" type="text" value="">

<input class=
                        "timepicker-input patternDailyEnd hasDatepicker" id=
                        "patternDailyEnd_1470ffb567f" name=
                        "patternDailyEnd_1470ffb567f" type="text" value="">

                    <input id="checkbox_1470ffb567f"
                    name="checkbox_1470ffb567f" type="checkbox">

                    <input id=
                    "checkbox_0_1470ffb567f" name="checkbox_0_1470ffb567f" type=
                    "checkbox">

                    <input id=
                    "checkbox_1_1470ffb567f" name="checkbox_1_1470ffb567f" type=
                    "checkbox">

                    <input id="checkbox_2_1470ffb567f"
                    name="checkbox_2_1470ffb567f" type="checkbox">

                    <input id="checkbox_3_1470ffb567f"
                    name="checkbox_3_1470ffb567f" type="checkbox">

                    <input id="checkbox_4_1470ffb567f"
                    name="checkbox_4_1470ffb567f" type="checkbox">

                    <input id="checkbox_5_1470ffb567f"
                    name="checkbox_5_1470ffb567f" type="checkbox">

When I copy the xpath then it looks like this: //*[@id="checkbox_1_1470ffb567f"]
That checkbox's id is every time different ( in the end those numbers change every time when I open the page.) But the checkbox_1 part is the same.

A: You can use the contains() function:
//*[contains(@id, "checkbox_1_")]


text:
Q: How to detect browser support for pageShow and pageHide? How can we do JavaScript object detection for pageShow and pageHide handlers?
if( /* pagehide is supported */ ){
   window.addEventListener('pagehide', exitFunction, false);
}
else{
    window.addEventListener('unload', exitFunction, false);
}

A: if ('onpagehide' in window) {
   window.addEventListener('pagehide', exitFunction, false);
} else {
   window.addEventListener('unload', exitFunction, false);
}


text:
Q: Show that abs(p(x))=e^x has a solution How could I show that $$|P(x)| = e^x$$
Has a real solution, whereas $P(x)$ is a polynomial not identically zero?

A: If $x$ is negative and large enough, the polynomial is more than 1 (or less than -1), so the left-hand side is more than the right-hand side.
If $x$ is positive and large enough ...

A: If $P\ne0$, then $\lim\limits_{x\to\pm\infty}|P(x)|=\infty$, but $\lim\limits_{x\to-\infty}e^{x}=0$ and $\lim\limits_{x\to+\infty}{e^x}-|P(x)|=\infty$. Now use the intermediate value theorem on $|P(x)|-e^x$.


text:
Q: Don't heavier objects actually fall faster because they exert their own gravity? The common understanding is that, setting air resistance aside, all objects dropped to Earth fall at the same rate. This is often demonstrated through the thought experiment of cutting a large object in half—the halves clearly don't fall more slowly just from having been sliced into two pieces.
However, I believe the answer is that when two objects fall together, attached or not, they do "fall" faster than an object of less mass alone does. This is because not only does the Earth accelerate the objects toward itself, but the objects also accelerate the Earth toward themselves. Considering the formula:
$$
F_{\text{g}} = \frac{G m_1 m_2}{d^2}
$$
Given $F = ma$ thus $a = F/m$, we might note that the mass of the small object doesn't seem to matter because when calculating acceleration, the force is divided by $m$, the object's mass. However, this overlooks that a force is actually applied to both objects, not just to the smaller one. An acceleration on the second, larger object is found by dividing $F$, in turn, by the larger object's mass. The two objects' acceleration vectors are exactly opposite, so closing acceleration is the sum of the two:
$$
a_{\text{closing}} = \frac{F}{m_1} + \frac{F}{m_2}
$$
Since the Earth is extremely massive compared to everyday objects, the acceleration imparted on the object by the Earth will radically dominate the equation. As the Earth is $\sim 5.972 \times {10}^{24} \, \mathrm{kg} ,$ a falling object of $5.972 \times {10}^{1} \, \mathrm{kg}$ (a little over 13 pounds) would accelerate the Earth about $\frac{1}{{10}^{24}}$ as much, which is one part in a trillion trillion.
Thus, in everyday situations we can for all practical purposes treat all objects as falling at the same rate because this difference is so small that our instruments probably couldn't even detect it. But I'm hoping not for a discussion of practicality or what's measurable or observable, but of what we think is actually happening.
Am I right or wrong?
What really clinched this for me was considering dropping a small Moon-massed object close to the Earth and dropping a small Earth-massed object close to the Moon. This thought experiment made me realize that falling isn't one object moving toward some fixed frame of reference, and treating the Earth as just another object, "falling" consists of multiple objects mutually attracting in space.
Clarification: one answer points out that serially lifting and dropping two objects on Earth comes with the fact that during each trial, the other object adds to the Earth's mass. Dropping a bowling ball (while a feather waits on the surface), then dropping the feather afterward (while the bowling ball stays on the surface), changes the Earth's mass between the two experiments. My question should thus be considered from the perspective of the Earth's mass remaining constant between the two trials (such as by removing each of the objects from the universe, or to an extremely great distance, while the other is being dropped).

A: I agree. My understanding is the same as well.
Assuming that the earth, mars and moon are of the same size - If the earth and mars where to be suspended in space (mars falling on earth), they would come into contact faster than - if earth and moon were to be suspended in space (moon falling on earth) owing to the fact that mars would cause the earth to accelerate towards it more than moon. This is provided that the distance between the two objects are the same initially. The earth would attract both at the same rate for any given distance.
I have also posted here regarding what would fall first in case of three objects being involved, asking if my understanding is correct.
It is the classic apple-feather experiment revisited. I hope it clarifies @KeithThompson 's  question above.

A:
Disclaimer
I am not a physicist, I am "just" an engineer.

Not sure if that counts as an answer but at least I use some scribbles :).
I would depict the (one dimensional) situation as this:

*

*There are two objects $m_1$ and $m_2$ with mass. The dot in the middle is the center of mass for each object.

*The distance between the centers of mass is denoted as $r$.

*There is also a frame of reference which is not accelerated at all (a so-called inertial frame of reference).

*The two masses are attracted to each other by the force $F$ which is described by Newton's law of universal gravitation.

The absolute acceleration of each object $\ddot{x}_1$ and $\ddot{x}_2$ can be formulated as:

*

*$\ddot{x}_1$ and $\ddot{x}_2$ are measured against the inertial frame of reference.

*The acceleration is proportional ($\sim$) to the mass of the opposite index ($1\to2$ and $2\to1$).

*The closing acceleration $a_{closing}$ (or approaching-each-other acceration) however is proportional to the sum of $m_1$ and $m_2$.

A: Yes, a heavy object dropped from the same height will fall faster then a lighter one. This is true in the rest frame of either object. You can see this from $F=GmM/r^2=m\cdot a=m\cdot d^2r/dt^2$.
The fastest "falling" (since we are re-defining falling) object however is a photon, which has no mass.

A: Inertial Reference Frames
The paradox appears because the "rest frame" of the Earth is not an inertial reference frame, it is accelerating. Keep yourself in the CM (center of mass) reference frame and, at least for two bodies, there is no paradox. Given an Earth of mass $M$, a body of mass $m_i$ will fall towards the center of mass $x_\textrm{CM}=(M x_M  + m_i x_i)/(M+m_i)$ with an acceleration $GM/(x_i-x_M)^2$. Note that $\ddot x_\textrm{CM}=0$
Really we have only hidden the paradox, because of course $x_\textrm{CM}$ is different for each $m_i$. But this is a first step to formulate the problem in a decent inertial frame.
The Paradox Resurfaces
The paradox resurfaces again if you want to get rid of $(x_i-x_M)$. In most applications, now that you are in a non-accelerating reference system, you want to consider distances related to it, i.e., $x_i-X_\textrm{CM}$. The solution is to redefine the mass. As
$x_i-x_\textrm{CM} = M (x_i - x_M) /(M+m_i)$, we can say that the object $i$ falls into the Mass Center with an acceleration $G{M^3 \over (M+m_ i)^2}{1 \over (x_i-x_\textrm{CM})^2}$ You could say that the actual mass of the "earth at center of mass" is this correction.
Reduced Mass of the System
Once you are into the trick of changing the value of the mass, you can still stick to the reference frame of the earth. In this reference frame the quotient between force and acceleration is $Mm_i/M+m_i$. You can claim that this is the actual mass of the body during the calculation. This is called the reduced mass $m_r$ of the system, and you can see that for small $m_i$, it is almost equal to $m_i$ itself. You can even write some of the previous formulae using the reduced mass $m_r$ in combination with the original masses, for instance the above ${M^3 \over (M+m_ i)^2} = M {m_r^2\over m^2}$, but I am not sure of how useful it is.  In any case, you see that you were right about the "heavier implies faster" but that it is perfectly managed.
Three Objects
For three objects, $m_1$ and $m_2$ falling into $M$, the question is how to compare the case to $m_1+m_2$ falling into $M$. You separate the forces between internal, between 1 and 2, and external, against $M$. Look at the point $x_0= {m_1 x_1 + m_2 x_2 \over m_1+m_2}$ . This point is not accelerated by the internal forces. And the external forces move them as
$$\ddot x_0={1 \over m_1+m_2} \left(m_1 {G M \over (x_1-x_M)^2} + m_2 {G M \over (x_2-x_M)^2}\right)={F_1+F_2 \over m_1 + m_2}$$ .
The TLDR Answer
This is becoming long...
¡I can not put all the Principia in a single answer!
So you can forget all the previous stuff, considering that just a means to fix notation and get some practice, and read the answer:
If the two bodies are at the same distance $x$ from the "external" earth, they suffer the same external acceleration $g=GM/(x-x_M)^2$, and the same happens with $x_0$. If both bodies are in an approximation where $g$ can be considered constant, which was the case originally considered by Galileo (and the modern $g=9.8~{\rm m/s^2}$), then they have the same acceleration—and also the combined position $x_0$. If they are not at the same distance nor in an approximation of a constant equal-everywhere field, then you can still save the movement of $x_0$ to work as if it were a gravitational force for some single mass $m_T$, but then the manipulation of the equations will produce in the relative positions of $x_1$ and $x_2$ some accelerations of the order of $1/(x_0-x_M)^3$. Such forces are the "tidal forces".

A: In addition to the already given answears this also might be of interest:
When hammer and feather are dropped simultaneously they arrive at the same time, when dropped independently the hammer attracts the planet more than the feather, so you are right, the total time until impact is then smaller for the hammer.
If you pick up the hammer and let it fall to the ground while the feather lies on the ground and its mass adds to the planet's mass (neglecting desity inhomogeneities) it takes the same time as when you pick up the feather and let it fall down while the hammer is on the ground and its mass adds to the planet, since m1+m2+m3=constant.
When you drop hammer and feather simultaneously, the feather will travel the longer distance in the same time, and is therefore faster than the hammer, since the planet is moving more towards the hammer than to the feather, and the feather is attracted by the largest sum of masses.
The initial distance of the point masses is 1 meter; in the first example you have 1000kg vs 100kg vs 1kg and in the second one 1000kg vs 666.̇6kg vs 500kg. As you can see the "hammer" and the "feather" arrive at the same time:

A: Using your definition of "falling," heavier objects do fall faster, and here's one way to justify it: consider the situation in the frame of reference of the center of mass of the two-body system (CM of the Earth and whatever you're dropping on it, for example). Each object exerts a force on the other of
$$F = \frac{G m_1 m_2}{r^2}$$
where $r = x_2 - x_1$ (assuming $x_2 > x_1$) is the separation distance. So for object 1, you have
$$\frac{G m_1 m_2}{r^2} = m_1\ddot{x}_1$$
and for object 2,
$$\frac{G m_1 m_2}{r^2} = -m_2\ddot{x}_2$$
Since object 2 is to the right, it gets pulled to the left, in the negative direction. Canceling common factors and adding these up, you get
$$\frac{G(m_1 + m_2)}{r^2} = -\ddot{r}$$
So it's clear that when the total mass is larger, the magnitude of the acceleration is larger, meaning that it will take less time for the objects to come together. If you want to see this mathematically, multiply both sides of the equation by $\dot{r}\mathrm{d}t$ to get
$$\frac{G(m_1 + m_2)}{r^2}\mathrm{d}r = -\dot{r}\mathrm{d}\dot{r}$$
and integrate,
$$G(m_1 + m_2)\left(\frac{1}{r} - \frac{1}{r_i}\right) = \frac{\dot{r}^2 - \dot{r}_i^2}{2}$$
Assuming $\dot{r}_i = 0$ (the objects start from relative rest), you can rearrange this to
$$\sqrt{2G(m_1 + m_2)}\ \mathrm{d}t = -\sqrt{\frac{r_i r}{r_i - r}}\mathrm{d}r$$
where I've chosen the negative square root because $\dot{r} < 0$, and integrate it again to find
$$t = \frac{1}{\sqrt{2G(m_1 + m_2)}}\biggl(\sqrt{r_i r_f(r_i - r_f)} + r_i^{3/2}\cos^{-1}\sqrt{\frac{r_f}{r_i}}\biggr)$$
where $r_f$ is the final center-to-center separation distance. Notice that $t$ is inversely proportional to the total mass, so larger mass translates into a lower collision time.
In the case of something like the Earth and a bowling ball, one of the masses is much larger, $m_1 \gg m_2$. So you can approximate the mass dependence of $t$ using a Taylor series,
$$\frac{1}{\sqrt{2G(m_1 + m_2)}} = \frac{1}{\sqrt{2Gm_1}}\biggl(1 - \frac{1}{2}\frac{m_2}{m_1} + \cdots\biggr)$$
The leading term is completely independent of $m_2$ (mass of the bowling ball or whatever), and this is why we can say, to a leading order approximation, that all objects fall at the same rate on the Earth's surface. For typical objects that might be dropped, the first correction term has a magnitude of a few kilograms divided by the mass of the Earth, which works out to $10^{-24}$. So the inaccuracy introduced by ignoring the motion of the Earth is roughly one part in a trillion trillion, far beyond the sensitivity of any measuring device that exists (or can even be imagined) today.

A: The answer is yes: in principle there is such an effect. When the mass of the dropped object is small compared to the mass of the planet, the effect is very small, of course, but in principle it's there.

A: The free fall time of two point masses is $ t = \frac{\pi}{2} \sqrt{ \frac{r^3}{2 G(m1+m2)}}  $.
The free fall time is dependent on the sum of the two masses. For a given total mass, the free fall time is independent of the ratio of the two masses. The free fall time is the same whether m1 = m2, or m1 >> m2.
When a body is picked up to a certain height and then dropped, the time to fall to the Earth does not depend on the mass of the object. If you lift a ping-pong ball and then drop it, it will take the same time to fall to the Earth as a bowling ball. Splitting the Earth into two masses does not change the sum of those masses, or the free fall time.
However, when an external body is brought to a certain height above the Earth and then dropped, the free fall time does depend on the mass of the external body. Because the sum of the Earth and the external body obviously does depend on the mass of the external body.

"Most bodies fall at the same rate on earth, relative to the earth, because the earth's mass M is extremely large compared with the mass m of most falling bodies. The body and the earth each fall toward their common center of mass, which for most cases is approximately the same as relative to the earth. In principle, the results of a free fall experiment depend on whether falling masses originate on earth, are extraterrestrial, are sequential or concurrent, or are simultaneous for coincident or separated bodies, etc. When falling bodies originate from the earth, all bodies fall at the same rate relative to the earth because the sum m + M remains constant.
   -- ArXiv:Deterrents to a Theory of Quantum Gravity

Assumptions:
  The Earth is isolated (there is no moon, sun, etc).
  The Earth is non-rotating.
  The Earth has no atmosphere. (A hot air balloon would fall upwards because it is less dense than the atmosphere it displaces.)

A: A simple explanation is that it takes more FORCE to ACCELERATE an object of greater MASS.
A=F/M....or with a constant FORCE, the ACCELERATION is inversely proportional to the MASS. The is a result of inertia.
A larger mass dropped (on a massive objects) requires a GREATER force to accelerate; additionally a GREATER mass exerts a GREATER gravitaional force.
Setting newtons second law to the gravitional force law cancles mass out and therefore renders MASS not related to the ACCELERATION of two gravitationally related objects.

A: Let's keep it simple. Opening my textbook from 1964, "Physics, 4th ed", Hausmann & Slack, Nostrum Co., NY, 1957. When we are contemplating the laws of everyday objects in free fall near the surface of the earth (our only frame of reference), all other forces removed or neutralized, we are in the realm of Newtonian Physics.
F = G(Mm)/r^2; where G is the gravitational constant, M is the mass of the earth, m is the mass of our object, and r is the radius of the earth.
By definition, when at rest on the surface of the earth, the weight ,W, of the object is the repulsive force in the equation F = ma, and a = g, the acceleration due to gravity. Therefore, W = mg, and g = W/m. Substituting into our general gravity equation between two object, we have:
W = G(Mm)/r^2, thus W/m = GM/r^2
Therefore, W/m is a constant! Thus an object will fall with the same acceleration regardless of mass near the surface of the earth.
Had me worried there for a moment :)

A: Drop a 5 lb iron barbell and a 25 lb iron barbell simultaneously.  The'll hit the ground simultaneously.  The only possible caveat is the recoil effect Ted Bunn brings up above.


text:
Q: How to get the latest gVim on Ubuntu 14.04? I would like to create a gVim AppImage using packages from 14.04 (why not 16.04? Because 16.04 packages are too new as AppImages will only run on distributions newer or the same age as the distribution who's packages they're built from). Now I would like my gVim AppImage to be for the very latest version of gVim, so I need a repository for 14.04 that provides the very latest gVim. I have searched Launchpad for Vim PPAs that are maintained and have not found any (all the ones I found are out-of-date).
My questions:

*

*I know I can build the latest gVim as a Debian package with checkinstall, but I want to use gVim from a package repository to build my gVim AppImage as it makes things a lot simpler. Where can I find a recent Debian package of gVim?

*Alternatively, how can I build an AppImage container from an arbitrary set of binaries (downloaded somewhere or compiled from source)?

A: An AppImage is basically just a self-mounting filesystem image that contains the application and everything it needs to run in a single file.
Here is an example that builds GNU Emacs on Travis CI and packages it as an AppImage: https://github.com/probonopd/Emacs.AppImage
You should be able to to the same for gVim.

*

*Gather suitable binaries. If the application has already been compiled, you can use existing binaries (for example, contained in .tar.gz, deb, or rpm archives). Note that the binaries must not be compiled on newer distributions than the ones you are targeting. In other words, if you are targeting Ubuntu 9.10, you should not use binaries compiled on Ubuntu 10.04. For upstream projects, it might be advantageous to compile special builds for use in AppImages, which is what I would recommend in this case. See the GNU Emacs example above. (For re-using existing binaries, see https://github.com/probonopd/AppImages/tree/master/recipes/meta instead.)

*Gather suitable binaries of all dependencies that are not part of the base operating systems you are targeting. For example, if you are targeting Ubuntu, Fedora, and openSUSE, then you need to gather all libraries and other dependencies that your app requires to run that are not part of Ubuntu, Fedora, and openSUSE in the default installation.

*Create a working AppDir from your binaries. A working AppImage runs your app when you execute its AppRun file. Again, see the GNU Emacs example linked above.

*Turn your AppDir into an AppImage. This compresses the contents of your AppDir into a single, self-mounting and self-executable file. The example above uses the generate_type2_appimage function from functions.sh for this.

*Test your AppImage on all base operating systems you are targeting. This is an important step which you should not skip. Subtle differences in distributions make this a must. While it is possible in most cases to create AppImages that run on various distributions, this does not come automatically, but requires careful hand-tuning.

This sounds more complicated than it actually is, all the steps besides the testing can be done on one small bash script like in the example. As you can see at https://github.com/probonopd/Emacs.AppImage, it is easy to produce an AppImage.
I recommend to work together with the upstream authors of the software, so that the upstream project themselves will provide an official AppImage. This way, the upstream project can control the end-to-end user experience of their software; something many upstream application projects appreciate. Users also can be assured that the AppImage is put together exactly in the way the original authors of the software intended and not changed in some way by intermediaries.


text:
Q: How to dynamically change comboboxes value based on other combobox in AS3 flash I have one xml file like below
<tree>
<branch1><node1/><node2/><node3/><branch1>
<brach2><node1/><node2/><node3/><branch1>
<branch3><node1/><node2/><node3/><branch1>
<branch4><node1/><node2/><node3/><branch1>
</tree>

I have one combobox which is populated with
branch1
branch2
branch3

Now i want that when branch 1 is selected then combobox2 should automatically loads with
node1
node2
node3

My CUrrent code is
for each(var element:XML in testXML.elements()) {
                    comboFar.addItem({label:element.name(),label:element.name()});

                }

A: You should assign an event handler for combobox1 like:
    var myXML:XML= <tree>
                       <branch name='1'><node name='1'/><node name='2'/><node name='3'/></branch>
                       <branch name='2' ><node name='1'/><node name='2'/><node name='3'/></branch>
                       <branch name='3'><node name='1'/><node name='2'/><node name='3'/></branch>
                   </tree> // or something like this

    combobox1.addEventListener(Event.CHANGE,changeListener);

    function changeListener(e:Event):void
    {
         populateCombobox2(myXML.branch.(@name == e.currentTarget.selectedItem.@name));
    }

    function populateCombobox2(combo2Data:XML):void
    {
        combobox2.dataSource = combo2Data;
        combobox2.displayName = "@name"; // I don't remember if this is correct, and I can't
                                         //check it now, but this is the logic.... if its not
                                         //correct tell me, and when I get home I can tell you
                                         //the correct way
    }


text:
Q: Затухание картинки сбоку Здравствуйте. Подскажите, пожалуйста.
Есть картинка с логотипом, нужно сделать, чтобы она постепенно затухала (исчезала), от краёв к центру. Как это можно реализовать? Или, может, есть какой готовы скрипт?
A: *

*Оберните ваш логотип в новый div и назначьте ему класс, например wrapper

*После логотипа вставьте еще один div и назначьте ему класс, например overlay

*Абсолютно спозиционируйте overlay внутри wrapper и задайте ему 100% ширину и высоту.

*Задайте overlay css-свойство pointer-events: none;, чтобы все клики шли по логотипу под ним.

*С помощью ColorZilla сгенерируйте полупрозрачный градиентный фон для overlay


text:
Q: MYSQL Link, Joining two tables my experience with MYSQL and using JOIN is very limited and now come up against a brick wall.
I have a master table which has lists of products. Each product has multipul attributes like colour, size, brand ( a column/field for each ). Instead of storing the text for each i use a number_id.
 1. Yellow
 2. Blue
 3. Sony
 4. Microsoft
 5. Green

so for a record i would have
Name, Colour, Brand

Controller, 1, 3 = Controler, Yellow, Sony.

.
SELECT
product_data.id                         AS id,
product_data.title                      AS title,
product_data.compatability              AS compatability,
product_data.release_date               AS release_date,
product_data.colour                     AS colour,
product_data.brand                      AS brand,
product_data.type_accessory             AS type_accessory,
product_data.created_userinfo           AS created_userinfo,
product_data.created_timestamp          AS created_timestamp

FROM product_data
INNER JOIN product_attributes

But im not sure from this point how to change the 'AS colour' to equal the text 'YELLOW' instead of '1'

[id] => 13413
[title] => Controler
[compatability] =>
[release_date] => 2016
[colour] => 1
[brand] => 3
[type_accessory] => 54
[created_userinfo] => TEST-USER
[created_timestamp] => 1425476393
[category_main_id] => 4
[category_main_description] => Video Game Accessories
[category_sub_id] => 43
[category_sub_description] => Microsoft Xbox One
[colour1] => 1

I have made the following changes, but i get empty values in the colour.

    SELECT
        product_data.title                      AS title,
        colours.name                            AS colour
FROM product_data
    INNER JOIN colours ON colours.id_colour = product_data.colour

WHERE
    product_data.created_userinfo = 'TEST-USER'

ORDER BY
    title

Array
(
[0] => Array
    (
        [title] => Controller
        [colour] =>
        [category_main] =>
        [category_sub] =>
        [brand] =>
    )

[1] => Array
    (
        [title] => Controller Wifi
        [colour] =>
        [category_main] =>
        [category_sub] =>
        [brand] =>
    )
)

A: You should keep your attributes in each different table for example:
CREATE TABLE colours(
   id_colour int PRIMARY KEY,
   name varchar(255)
);

In your main table product_data in a field named colour you should keep an id of a colour. Then you can query like this:
SELECT

   product_data.id                         AS id,
   product_data.title                      AS title,
   product_data.compatability              AS compatability,
   product_data.release_date               AS release_date,
   colours.name                             AS colour

   FROM product_data
   INNER JOIN colours ON colours.id_colour = product_data.colour

PS. You can leave table name in a query if there isn't a conflict in column name.
SELECT

   id                         AS id,
   title                      AS title,
   compatability              AS compatability,
   release_date               AS release_date,
   name                       AS colour

FROM product_data
INNER JOIN colours ON colours.id_colour = product_data.colour

EDIT:
Remember that fields product_data.id_colour and colours.id_colour must have the same data type -> int.

A: You have to define a table called colour with columns id and name, then your query will look like:
SELECT
    product_data.id,
    product_data.title,
    colour.name AS colour
FROM product_data
INNER JOIN colour ON colour.id = product_data.colour