text:
Q: How to select only a specific set that includes some or all of another set in mySQL I'm trying to extract specific rows from a mySQL table that contains lists of numbers.
I have a single table with 2 columns- id and data. Each row has a sorted, comma separated record of numbers ranging from 1 to 1000. I want to only select records with a partial or full set of specific numbers in it. I've tried using LIKE and IN and also looked at FIND_IN_SET.
t1.id       t1.data
1          2,9,569
2          2,9,991,979
3          9,569,763
4          52,57,569,763,892,897
5          763
6          2,9,10,15,151,569,771,801,888,973

If I'm looking for rows with one or more of the values (2,9,569,763), I don't want to have to write:
SELECT t1.id from t1
WHERE t1.data NOT IN (1,3,4,5,6,7,8,10,11,...........,1000);

to return 3 rows, t1.id = 1,3 and 5.
Is there a simpler way? Something like (in mySQL):
SELECT t1.id from t1
WHERE t1.data "only includes one or more of" (2,9,569,763);

A: Not simple but..
Count single hits and compare it with the number of all values in the data column. They must be equal.
select id, data
from t1
where (find_in_set(2, data) > 0)
    + (find_in_set(9, data) > 0)
    + (find_in_set(569, data) > 0)
    + (find_in_set(763, data) > 0)
    = char_length(data) - char_length(replace(data, ',', '')) + 1

Demo: https://www.db-fiddle.com/f/oLcrz4vmXRWXqYQhCnZA5z/0

A: Paul Spiegel's answer gives the correct result, but it can't be optimized with indexes, because of the use of FIND_IN_SET(). It will always do a table-scan, which will get more and more expensive the more rows you have.
You should take this as a clue that storing lists of numbers as a comma-separated list in a string column is a bad idea when you actually want to do some searches for discrete members of that list.
What you should do instead is store the list as a child table, with one member per row.
CREATE TABLE mydata (
  t1id INT NOT NULL,
  member INT NOT NULL,
  PRIMARY KEY (t1id, member),
  FOREIGN KEY (t1id) REFERENCES t1(id)
);

INSERT INTO mydata VALUES
(1,2),(1,9),(1,569),
(2,2),(2,9),(2,991),(2,979),
(3,9),(3,569),(3,763),
(4,52,(4,57,(4,569,(4,763,(4,892),(4,897),
(5,763),
(6,2),(6,9),(6,10),(6,15),(6,151),(6,569),(6,771),(6,801),(6,888),(6,973);

Now you would join your original table t1 to mydata but exclude the matches to values in your desired list.
mysql> select * from t1 left join mydata on t1.id=mydata.t1id
    and mydata.member not in (2,9,569,763);
+----+------+--------+
| id | t1id | member |
+----+------+--------+
|  1 | NULL |   NULL |
|  2 |    2 |    979 |
|  2 |    2 |    991 |
|  3 | NULL |   NULL |
|  4 |    4 |     52 |
|  4 |    4 |     57 |
|  4 |    4 |    892 |
|  4 |    4 |    897 |
|  5 | NULL |   NULL |
|  6 |    6 |     10 |
|  6 |    6 |     15 |
|  6 |    6 |    151 |
|  6 |    6 |    771 |
|  6 |    6 |    801 |
|  6 |    6 |    888 |
|  6 |    6 |    973 |
+----+------+--------+

You see there are NULLs of id 1, 3, 5 because there are no values that are NOT in your specified list. Those are the id's that you want to return.
mysql> select t1.id from t1 left join mydata on t1.id=mydata.t1id
    and mydata.member not in (2,9,569,763)
  where mydata.member is null;
+----+
| id |
+----+
|  1 |
|  3 |
|  5 |
+----+

A: Try to use the REGEXP function:
SELECT t1.id from t1
WHERE t1.data REGEXP '(2,9,569,763)';


text:
Q: Get album artwork from ID3 tag/Convert function from Java to Objective-C I've got the following question to ask:
How do you compile taglib with an iOS application?
I'm a bit confused as I added the folder into my project, tried to compile it, but instead it failed with 1640 errors.
How do I make it successfully compile - the reason why I ask is taglib allows for the extraction of album artwork from a tag.
If anyone knows an Objective-C based album artwork extraction class it would help - I don't know why Apple don't add a way of doing this in Core Foundation - because there are methods for extracting some of the data from an ID3 tag.
I can't see why there isn't some Objective-C way of doing it.
Any help appreciated.
EDIT:
After hours upon hours of trying to do this, I've found a Java function here that seems to do the job fine, but I haven't got a clue on how to convert it to Objective-C (or let alone C++ for that matter), as its types seem to be completely different from those that are in Objective-C/C++. If anyone knows of a way to convert this it would really help, as this seems as my last option as I've tried so many others.

A: This is just the answer of @hatfinch above but fixed and now working.
- (void)artworksForFileAtPath:(NSString *)path block:(void(^)(NSArray *artworkImages))block
{
    NSURL *url = [NSURL fileURLWithPath:path];
    AVURLAsset *asset = [AVURLAsset URLAssetWithURL:url options:nil];
    NSArray *keys = [NSArray arrayWithObjects:@"commonMetadata", nil];
    [asset loadValuesAsynchronouslyForKeys:keys completionHandler:^{
         NSArray *artworks = [AVMetadataItem metadataItemsFromArray:asset.commonMetadata
                                                            withKey:AVMetadataCommonKeyArtwork
                                                           keySpace:AVMetadataKeySpaceCommon];

         NSMutableArray *artworkImages = [NSMutableArray array];
         for (AVMetadataItem *item in artworks) {
             NSString *keySpace = item.keySpace;
             if ([keySpace isEqualToString:AVMetadataKeySpaceID3]) {
                 NSDictionary *d = [item.value copyWithZone:nil];
                 [artworkImages addObject:[UIImage imageWithData:[d objectForKey:@"data"]]];
             } else if ([keySpace isEqualToString:AVMetadataKeySpaceiTunes]) {
                 [artworkImages addObject:[UIImage imageWithData:[item.value copyWithZone:nil]]];
             }
         }
         if(block) {
             block(artworkImages);
         }
     }];
}

A: If you are merely wanting to access the artwork of the music already stored on the device i.e from the iPod application, then check out this article which demonstrates how to do it using existing frameworks provided by Apple, specifically the MediaPlayer framework.
If not, it may be wise to provide a little more information about what you are trying to achieve and also provide examples of the errors you are getting when trying to compile TagLib.
EDIT:
Another solution could be to use an embedded webview and use a JavaScript library such as this one to load, parse and fetch the album artwork?

A: - (void)loadArtworksForFileAtPath:(NSString *)path completion:(void (^)(NSArray *))completion
{
    NSURL *u = [NSURL fileURLWithPath:path];
    AVURLAsset *a = [AVURLAsset URLAssetWithURL:u options:nil];
    NSArray *k = [NSArray arrayWithObjects:@"commonMetadata", nil];

    [a loadValuesAsynchronouslyForKeys:k completionHandler: ^{
        NSArray *artworks = [AVMetadataItem metadataItemsFromArray:a.commonMetadata
             withKey:AVMetadataCommonKeyArtwork keySpace:AVMetadataKeySpaceCommon];

         NSMutableArray *artworkImages = [NSMutableArray array];
         for (AVMetadataItem *i in artworks)
         {
             NSString *keySpace = i.keySpace;
             UIImage *im = nil;

             if ([keySpace isEqualToString:AVMetadataKeySpaceID3])
             {
                 NSDictionary *d = [i.value copyWithZone:nil];
                 im = [UIImage imageWithData:[d objectForKey:@"data"]];
             }
             else if ([keySpace isEqualToString:AVMetadataKeySpaceiTunes])
                 im = [UIImage imageWithData:[i.value copyWithZone:nil]];

             if (im)
                 [artworkImages addObject:im];
         }

         completion(artworkImages);
     }];
}

A: You could use this: https://github.com/EliaCereda/TagLib-ObjC

redpajama_set_name: RedPajamaStackExchange


text:
Q: AngularJS throws unknown error My code is like this

                    {{prdElement.name}}

                    {{prdElement.itemId}}

                    {{prdElement.shipmentId}}

                    {{prdElement.itemCode}}

                    {{prdElement.description}}

                    {{prdElement.handlingUnit}}

                    {{prdElement.weight}}

                    {{prdElement.class}}

                    {{prdElement.lenght}}

                    {{prdElement.width}}

                    {{prdElement.height}}

                    {{prdElement.flag}}

                    <input type="text" ng-model="prdElement.quantity" placeholder=" Code" required />

                    <button ng-click="newPrdItem( prdElement,$event)">Submit</button>

(function () {
    angular.module('myApp', []).controller('MainCtrl', function ($scope) {

        var counter = 0;

        $scope.palletElement = [{
            name: 'Pallet 1',
            itemId: '284307',
            shipmentId: 'eb44f690-c97a-40e3-be2a-0449559e171a',
            itemCode: '',
            description: 'Bicycle parts - frame',
            quantity: '31',
            handlingUnit: 'CTN',
            weight: '613.04',
            class:'',
            lenght: '102',
            width: '42',
            height: '61',
            flag:'P'

        }, {
            name: 'Pallet 2',
            itemId: '284308',
            shipmentId: 'eb44f690-c97a-40e3-be2a-0449559e171a',
            itemCode: '',
            description: 'Bicycle parts - fork',
            quantity: '22',
            handlingUnit: 'CTN',
            weight: '242.99',
            class: '',
            lenght: '75',
            width: '34',
            height: '18',
            flag: 'P'
        }]

        $scope.newPrdItem = function (prdElement, $event) {
            counter++;
            alert(prdElement.name);
            prdElement.push({
                name: prdElement.name,
                itemId: prdElement.itemId,
                shipmentId: prdElement.shipmentId,
                itemCode: prdElement.itemCode,
                description: prdElement.description,
                quantity: prdElement.quantity,
                handlingUnit: prdElement.handlingUnit,
                weight: prdElement.weight -10,
                class: prdElement.class,
                lenght: prdElement.lenght,
                width: prdElement.width,
                height: prdElement.height,
                flag: prdElement.flag,
            });

        }

    });
}());

All looks okay to me, But this throws an unknown error at button click

TypeError: undefined is not a function
      at Scope.$scope.newPrdItem
Fiddle

A: You are treating prdElement as an array by issuing a call to push on it, but that is actually an object passed from the view:
This line is what's failing.
prdElement.push({

I would create a separate array to track the items being clicked
var items = [];
$scope.newPrdItem = function (prdElement, $event) {
            counter++;
            alert(prdElement.name);
            items.push({
                name: prdElement.name,
                itemId: prdElement.itemId,
                shipmentId: prdElement.shipmentId,
                itemCode: prdElement.itemCode,
                description: prdElement.description,
                quantity: prdElement.quantity,
                handlingUnit: prdElement.handlingUnit,
                weight: prdElement.weight -10,
                class: prdElement.class,
                lenght: prdElement.lenght,
                width: prdElement.width,
                height: prdElement.height,
                flag: prdElement.flag,
            });

        }

A: You can only .push() to an array. But your passed parameter prdElement is an Object, not an Array, thus prdElement.push() is not a defined function!
What you most likely want to push to instead is the palletElement.


text:
Q: Ruby, get hours, seconds and time from Date.day_fraction_to_time I've found this method here.
  start = DateTime.now
  sleep 15
  stop = DateTime.now
  #minutes
  puts ((stop-start) * 24 * 60).to_i

  hours,minutes,seconds,frac = Date.day_fraction_to_time(stop-start)

I have the following error:
`<main>': private method `day_fraction_to_time' called for Date:Class (NoMethodError)

I've checked /usr/lib/ruby/1.9.1/date.rb and I've found it:
def day_fraction_to_time(fr) # :nodoc:
  ss,  fr = fr.divmod(SECONDS_IN_DAY) # 4p
  h,   ss = ss.divmod(3600)
  min, s  = ss.divmod(60)
  return h, min, s, fr * 86400
end

But I have no problem if I run it with ruby1.8. /usr/lib/ruby/1.8/date.rb gives me:
  def self.day_fraction_to_time(fr)
    ss,  fr = fr.divmod(SECONDS_IN_DAY) # 4p
    h,   ss = ss.divmod(3600)
    min, s  = ss.divmod(60)
    return h, min, s, fr
  end

So i went to see the documentation(1.9) and there's no trace of this method. I know it's a dumb question, but why did they remove it? There is even this example on how to use the method in /usr/lib/ruby/1.9.1/date.rb:
 def secs_to_new_year(now = DateTime::now())
     new_year = DateTime.new(now.year + 1, 1, 1)
     dif = new_year - now
     hours, mins, secs, ignore_fractions = Date::day_fraction_to_time(dif)
     return hours * 60 * 60 + mins * 60 + secs
 end

but I'm still getting the error:
test.rb:24:in `secs_to_new_year': private method `day_fraction_to_time' called for Date:Class (NoMethodError)
    from test.rb:28:in `<main>'

A: I don't know why it was made private, but you can still access it:
hours,minutes,seconds,frac = Date.send(:day_fraction_to_time, stop-start)

This way you override the OOP encapsulation mechanizm... This is not a very nice thing to do, but it works.

A: I've found another method which seems more elegant to me:
start = DateTime.now
sleep 3
stop = DateTime.now

puts "Date.day_fraction_to_time using wrapper"
class Date
    class << self
      def wrap_day_fraction_to_time( day_frac )
        day_fraction_to_time( day_frac )
      end
   end
end
hours, minutes, seconds, frac =
    Date.wrap_day_fraction_to_time( stop - start )
p hours, minutes, seconds, frac

Thanks to Colin Bartlett from ruby-forum.com
To understand how it works I suggest to read David Seiler's answer


text:
Q: How to create a deep link similar to firebase dynamic link How dynamic links work for firebase.
I mean how deep link is maintained even when app is downloaded from app store or play store and then opened.


text:
Q: Find column value from one sheet based on the order # on another sheet So, on Sheet1, I have Data based on an Order # and I want the Multiplier that is associated with it. The Multiplier is on Sheet2 with the Order #, but the Order #'s and Multipliers associated always change spots every day so I cannot just copy and paste. I want the Multipler in line with the correct Order # on Sheet1. I figured to use some sort of VLOOKUP function but I am not sure what to do. I attached two pictures to help with the scenario.

A: In Sheet1!D2,
=index(sheet2!d:d, match(a2, sheet2!b:b, 0))
'error controlled
=iferror(index(sheet2!d:d, match(a2, sheet2!b:b, 0)), text(,))


text:
Q: AsyncController OutputCache When implementing an asynchronous controller action in ASP.NET MVC, if I want to output cache the ActionResult, which method do I put the OutputCache attribute on?
public class PortalController : AsyncController {
    /// HERE...?
    [OutputCache(Duration = 60 * 30 /* 30min */, VaryByParam = "city")]
    public void NewsAsync(string city) {

        AsyncManager.OutstandingOperations.Increment();
        NewsService newsService = new NewsService();
        newsService.GetHeadlinesCompleted += (sender, e) =>
        {
            AsyncManager.Parameters["headlines"] = e.Value;
            AsyncManager.OutstandingOperations.Decrement();
        };
        newsService.GetHeadlinesAsync(city);
    }

    /// ...OR HERE?
    [OutputCache(Duration = 60 * 30 /* 30min */, VaryByParam = "city")]
    public ActionResult NewsCompleted(string[] headlines) {
        return View("News", new ViewStringModel
        {
            NewsHeadlines = headlines
        });
    }
}

At first, I assumed that it would go on NewsCompleted, because that is the method which returns an ActionResult.
Then I realized that NewsAsync is associated with VaryByParam, so it probably makes more sense to put the attribute on that method.

A: The OutputCache parameter goes on the void NewsAsync method, not the ActionResult NewsCompleted method.  (determined by experimentation)


text:
Q: Please help me with factorisation of $64x^6-112x^4+56x^2-7$ Is it possible to write $$64x^6-112x^4+56x^2-7$$ in linear factors?
If so, what are they?
(Finding it really difficult to ask this question!!)

A: Using the Rational Root Theorem, after a bit of testing, we see that there are no rational roots. So you won't find "easily accessible" factors of the form $x-r$, where $ r \in \mathbb {Q} $. Also, see here.


text:
Q: Calling method nlohmann::json::dump from visual studio intermediate window I'm trying to dump object from type nlohmann::json into readable string value from visual studio debugger. So in order to invoke the dump method from the nlohmann::json instance, i use visual studio intermediate window.
However, it seems like this method doesn't run well and return too few arguments in function call error although i called it exactly as I should. Also, if I try to set its output to a new std::string type, the debugger cannot identify it.
myJsonObj
{m_type=object (1 '\x1') m_value={object=0x000001303ea66590 { size=2 } array=0x000001303ea66590 { size=1152921422937066337 } ...} }
    m_type: object (1 '\x1')
    m_value: {object=0x000001303ea66590 { size=2 } array=0x000001303ea66590 { size=1152921422937066337 } string=0x000001303ea66590 "0A_>0\x1" ...}

myJsonObj.dump()
too few arguments in function call

std::string x = myJsonObj.dump()
identifier "x" is undefined

Any idea how to do it properly ?

A: In the intermediate window, we cannot use the default parameter for the C++ function. You can invoke the dump method like this:
myJsonObj.dump(4, ' ', true, nlohmann::detail::error_handler_t::strict)

However, in the intermediate window, we cannot see a pretty formatted print. You can use the Visual Studio Watch Window to the display returned string. Please see the link here to know about how to use the Watch window:
How to make Visual Studio's Immediate window give me plain string output?


text:
Q: Firing an event as soon as activity is visible to the user I wanted to create countdown as soon as the user sees an activity. However, there does not seem to be an appropriate callback for that. Neither onResume nor onWindowFocusChanged seem to be the correct callbacks, because the whole code is executed before the user even see anything. As a result I end up with "Go!" on the screen right from the start.
In a nutshell:
Do you have any idea how to implement a countdown without any user interaction as soon as the activity is visible to the user?
EDIT:
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import java.util.concurrent.TimeUnit;
import android.widget.TextView;

public class ChallengeModeTutorial extends AppCompatActivity {

    private void delayOneSec()
    {
        try
        {
            TimeUnit.SECONDS.sleep(2);
        }
        catch (InterruptedException e)
        {
            assert true;
        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_challenge_mode_tutorial);
    }

    @Override
    public void onWindowFocusChanged(boolean hasFocus)
    {
        super.onWindowFocusChanged(hasFocus);
        TextView readySteadyGo = (TextView) findViewById(R.id.challengeModeTutorialReadySteadyGoTextView);
        // TextView tutorialText = (TextView) findViewById(R.id.challengeModeTutorialTextTextView);
        TextView timeUntilStart = (TextView) findViewById(R.id.challengeModeTutorialReadyTimeTextView);

        readySteadyGo.setText("");
        timeUntilStart.setText("5");
        delayOneSec();
        timeUntilStart.setText("4");
        delayOneSec();
        timeUntilStart.setText("3");
        delayOneSec();
        readySteadyGo.setText("Ready!");
        timeUntilStart.setText("2");
        delayOneSec();
        readySteadyGo.setText("Steady!");
        timeUntilStart.setText("1");
        delayOneSec();
        readySteadyGo.setText("");
        readySteadyGo.setText("Go!");
    }
}

A: The problem is that you're blocking the UI thread. When you call setText(String) it doesn't immediately gets drawn. The TextView gets invalidated and it will be draw on the next draw phase. But if you block the thread, this will never happen. You have to use a postDelayed() to execute the next setText(String) a second later.

A: I'm not sure if this works, but you could try using a ViewTreeObserver in onCreate. It gets called once the layout is drawn. (Replace LinearLayout with whatever Layout your "activity_challenge_mode_tutorial" actually is.)
@Override
protected void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_challenge_mode_tutorial);

    final LinearLayout layout = (LinearLayout) findViewById(R.id.YOUR_VIEW_ID);
    ViewTreeObserver vto = layout.getViewTreeObserver();
    vto.addOnGlobalLayoutListener (new OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            // Remove listener to prevent repeat calls.
            layout.getViewTreeObserver().removeOnGlobalLayoutListener(this);

            // Start countdown here.

        }
    });
}

Code is taken from this answer: https://stackoverflow.com/a/7735122/8118328

A: You can start your countdown, inside of your onStart method, which you need to overwrite.

The visible lifetime of an activity happens between a call to onStart() until a corresponding call to onStop(). During this time the user can see the activity on-screen, though it may not be in the foreground and interacting with the user.

From:
https://developer.android.com/reference/android/app/Activity
 @Override
protected void onStart() {
    super.onStart();
}

A: I finally got it to work like this:
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;

public class ChallengeModeTutorial extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_challenge_mode_tutorial);
    }

    @Override
    protected void onStart()
    {
        super.onStart();

        final TextView readySteadyGo = (TextView) findViewById(R.id.challengeModeTutorialReadySteadyGoTextView);
        final TextView timeUntilStart = (TextView) findViewById(R.id.challengeModeTutorialReadyTimeTextView);

        readySteadyGo.setText("");

        Thread t=new Thread(){

            @Override
            public void run(){

                while(continueThread){

                    try {
                        Thread.sleep(1000);

                        runOnUiThread(new Runnable() {

                            @Override
                            public void run() {
                                if(currentCount > 0)
                                {
                                    timeUntilStart.setText(String.valueOf(currentCount));
                                }
                                else
                                {
                                    timeUntilStart.setText("Go!");
                                }
                                switch (currentCount)
                                {
                                    case 2: readySteadyGo.setText("Ready!"); break;
                                    case 1: readySteadyGo.setText("Steady!"); break;
                                    default: readySteadyGo.setText(""); break;
                                }
                                currentCount--;
                                if (currentCount == 0)
                                {
                                    continueThread = false;
                                }
                            }
                        });

                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }

                }
            }
        };

        t.start();
    }

    private boolean continueThread = true;
    private int currentCount = 5;
}


text:
Q: Include scheduled ( future ) posts in WordPress post navigation ( previous_post_link, next_post_link ) Is this possible? How can i change the query for adjacent posts and add 'post_status=future' to display next and previous posts for scheduled ones?
I suppose i should use some kind of filter, but could someone show me how? :)

A: You can do this by using the get_{$adjacent}_post_where filter.
Basically all we are doing is replacing the part of the query that says "find published posts" with "find published or future posts".
/**
 * Amend the 'WHERE' clause in the SQL query to find an adjacent post
 *
 * @param required string $where  The default 'WHERE' clause in the query
 * @param boolean $in_same_term   Whether or not the adjacent post should be in the same taxonomy term (not required here)
 * @param array $excluded_terms   The ID's of terms that should be excluded (not required here)
 * @return string                 The updated, custom 'WHERE' clause
 */
add_filter('get_previous_post_where', 'my_add_future_posts_to_nav', 3, 99);
add_filter('get_next_post_where', 'my_add_future_posts_to_nav', 3, 99);
function my_add_future_posts_to_nav($where, $in_same_term, $excluded_terms){

    return str_replace("p.post_status = 'publish'", "p.post_status IN ('publish', 'future')", $where);

}

While I can't seem to find any Filter Reference for get_{$adjacent}_post_where, there is a Developer Code Reference which you may find useful.


text:
Q: Why do these two methods of finding Taylor's expansion generate the same result? Let's take: $f(x)=e^{2x+1}$
We can find the Taylor-expansion centered around $-\frac{1}{2}$ in two ways:
1) Use the definition: $f(x)=f(a)+\frac{f'(a)(x-a)}{1!}+\frac{f''(a)(x-a)^2}{2!}+\frac{f^{(3)}(a)(x-a)^3}{3!}...$ for a=$-\frac{1}{2}$
2) Expand $e^u$ around $u=0$ which gives: $e^u=1+u+\frac{u^2}{2!}+\frac{u^3}{3!}$ and then substituting $u=2x+1$
Both ways yield the same solution around $x=-\frac{1}{2}$, namely:
$$f(x)=1+\frac{(2x+1)}{1!}+\frac{(2x+1)^2}{2!}+\frac{(2x+1)^3}{3!}+...$$
Question: Why do both methods yield the same result? It "feels" to me as if in the second method we are disregarding the chainrule? I am trying to understand why "under the hood" both methods amount to the same result.
Basically the question boils down to the question of why the substitution is allowed. I think this answer has something to do with it: https://math.stackexchange.com/a/1855698/245761

A: Let $f(x) = g(\alpha(x-a))$.
Then, by chain rule,
$$f^{(n)}(a) = \alpha^n g^{(n)}(0).$$
Thus,
\begin{align*}
f(x)
&= \sum_{n=0}^\infty \frac{f^{(n)}(a)}{n!}(x-a)^n \\
&= \sum_{n=0}^\infty \frac{\alpha^n g^{(n)}(0)}{n!} (x-a)^n \\
&= \sum_{n=0}^\infty \frac{g^{(n)}(0)}{n!}(\alpha(x-a))^n.
\end{align*}

A: The Taylor expansion is unique: If $f(x) = \sum_n a_n x^n$ for $|x| < R$, then
$f(x) = 0$ iff $a_n = 0$ for all $n$.
In particular, if you find $f(x) = \sum_n a_n x^n =\sum_n b_n x^n$ and both series
are valid for $|x| < \rho$, where $\rho >0$, then we must have $a_n =b_n$ for all $n$.
The general result (see Conway, "Functions of one complex variable", ch.IV, Theorem 3.7) is if $U$ is an open connected set and $f$ is analytic on $U$ then
$f=0$ iff there is some $x \in U$ such that $f^{(n)}(x) = 0$ for all $n$ iff the set of zeroes has a limit point in $U$.

A: There are two points to consider here:
1) Validity of a formula for the range of the values of parameters involved in the formula. The formula $$e^{x} = 1 + x + \frac{x^{2}}{2!} + \cdots\tag{1}$$ is valid for all values of $x$ whether real or complex and hence we can replace $x$ by anything which takes real or complex values and hence replacement of $x$ by $2x + 1$ is valid. For that matter you can replace $x$ by a complicated expression like $\sqrt{1 + x^{2}}$ (or more interestingly by $\log x$) and the result will be true. But in such case the resulting series will not be a Taylor series. But if you replace $x$ by $ax + b$ then it will turn out to be a Taylor series in powers of $(x + b/a)$ which will match the Taylor expansion around $x = -b/a$.
2) Next is the concept of Taylor series of function and it can be proved that if a function $f(x)$ has a Taylor series expansion around point $a$ in powers of $(x - a)$ then this Taylor series is unique. By definition of Taylor series, the coefficient of $(x - a)^{n}$ in this expansion is $f^{(n)}(a)/n!$. The uniqueness of Taylor's series says that if we can express $f(x)$ as a power series in powers of $(x - a)$ then the function $f$ is infinitely differentiable around $a$ and the coefficients have to be $f^{(n)}(a)/n!$ no matter how the expansion of $f$ in powers of $(x - a)$ is obtained.


text:
Q: How can I figure out why the Rails 4 gems are getting installed? I recently did a bundle update and noticed that the system was retrieving and installing a lot of Rails 4.0 gems. I didn't request any Rails 4.0 gems explicitly (all the versions I listed explicitly are 3.2 version) and I don't see any 4.0 gems listed in Gemfile.lock, even in the DEPENDENCIES section. Can someone help me understand what's going on?  I've include my Gemfile, Gemfile.lock and gem list output below.  I'm using rvm.
Gemfile
source 'https://rubygems.org'

gem 'rails', '3.2.11'
gem 'rake', '10.1.0'
gem 'nokogiri'
gem 'bootstrap-sass'
gem 'bcrypt-ruby', '3.0.1'
gem 'faker', '1.0.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate'
gem 'jquery-rails', '2.0.2'
gem 'jquery-ui-rails'
gem 'pg', '0.12.2'
gem 'childprocess', '0.3.9'
gem 'highcharts-rails'
gem 'omniauth-facebook'
gem 'google_drive'
gem 'newrelic_rpm'
gem 'thin'
gem 'coffee-script'
gem 'therubyracer', :require => 'v8'
gem 'underscore-rails'
gem 'date_easter'

group :development, :test do
  gem 'rspec-rails', '2.11.0'
  gem 'guard-rspec', '1.2.1'
  gem 'guard-spork', '1.5.0'
  gem 'spork', '0.9.2'
  gem 'annotate', '2.5.0'
  gem 'quiet_assets'
  gem "jasminerice", :git => 'https://github.com/bradphelan/jasminerice.git'
  gem 'guard-jasmine'
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '3.2.5'
  gem 'coffee-rails', '3.2.2'
  gem 'uglifier', '1.2.3'
end

group :test do
  gem 'simplecov', require: false
  gem 'capybara', '1.1.2'
  gem 'factory_girl_rails', '4.1.0'
  gem 'cucumber-rails', '1.2.1', :require => false
  gem 'database_cleaner', '0.7.0'
  # gem 'launchy', '2.1.0'
  gem 'rb-fsevent', '0.9.1', :require => false
  gem 'growl', '1.0.3'
end

Gemfile.lock
GIT
  remote: https://github.com/bradphelan/jasminerice.git
  revision: d93a3b2ed8f9b74249e2f19d179b5b1f1963dfc3
  specs:
    jasminerice (0.1.0)
      coffee-rails

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (3.2.11)
      actionpack (= 3.2.11)
      mail (~> 2.4.4)
    actionpack (3.2.11)
      activemodel (= 3.2.11)
      activesupport (= 3.2.11)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      journey (~> 1.0.4)
      rack (~> 1.4.0)
      rack-cache (~> 1.2)
      rack-test (~> 0.6.1)
      sprockets (~> 2.2.1)
    activemodel (3.2.11)
      activesupport (= 3.2.11)
      builder (~> 3.0.0)
    activerecord (3.2.11)
      activemodel (= 3.2.11)
      activesupport (= 3.2.11)
      arel (~> 3.0.2)
      tzinfo (~> 0.3.29)
    activeresource (3.2.11)
      activemodel (= 3.2.11)
      activesupport (= 3.2.11)
    activesupport (3.2.11)
      i18n (~> 0.6)
      multi_json (~> 1.0)
    annotate (2.5.0)
      rake
    arel (3.0.2)
    bcrypt-ruby (3.0.1)
    bootstrap-sass (2.3.2.1)
      sass (~> 3.2)
    bootstrap-will_paginate (0.0.9)
      will_paginate
    builder (3.0.4)
    capybara (1.1.2)
      mime-types (>= 1.16)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      selenium-webdriver (~> 2.0)
      xpath (~> 0.1.4)
    childprocess (0.3.9)
      ffi (~> 1.0, >= 1.0.11)
    coderay (1.0.9)
    coffee-rails (3.2.2)
      coffee-script (>= 2.2.0)
      railties (~> 3.2.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.6.3)
    cucumber (1.3.5)
      builder (>= 2.1.2)
      diff-lcs (>= 1.1.3)
      gherkin (~> 2.12.0)
      multi_json (~> 1.7.5)
      multi_test (>= 0.0.2)
    cucumber-rails (1.2.1)
      capybara (>= 1.1.2)
      cucumber (>= 1.1.3)
      nokogiri (>= 1.5.0)
    daemons (1.1.9)
    database_cleaner (0.7.0)
    date_easter (0.0.1)
    diff-lcs (1.1.3)
    erubis (2.7.0)
    eventmachine (1.0.3)
    execjs (1.4.0)
      multi_json (~> 1.0)
    factory_girl (4.1.0)
      activesupport (>= 3.0.0)
    factory_girl_rails (4.1.0)
      factory_girl (~> 4.1.0)
      railties (>= 3.0.0)
    faker (1.0.1)
      i18n (~> 0.4)
    faraday (0.8.7)
      multipart-post (~> 1.1)
    ffi (1.9.0)
    formatador (0.2.4)
    gherkin (2.12.0)
      multi_json (~> 1.3)
    google_drive (0.3.6)
      nokogiri (>= 1.4.4, != 1.5.2, != 1.5.1)
      oauth (>= 0.3.6)
      oauth2 (>= 0.5.0)
    growl (1.0.3)
    guard (1.7.0)
      formatador (>= 0.2.4)
      listen (>= 0.6.0)
      lumberjack (>= 1.0.2)
      pry (>= 0.9.10)
      thor (>= 0.14.6)
    guard-jasmine (1.17.0)
      childprocess
      guard (>= 1.1.0)
      multi_json
      thor
      tilt
    guard-rspec (1.2.1)
      guard (>= 1.1)
    guard-spork (1.5.0)
      childprocess (>= 0.2.3)
      guard (>= 1.1)
      spork (>= 0.8.4)
    hashie (2.0.5)
    highcharts-rails (3.0.2)
      railties (>= 3.1)
    hike (1.2.3)
    httpauth (0.2.0)
    i18n (0.6.4)
    journey (1.0.4)
    jquery-rails (2.0.2)
      railties (>= 3.2.0, < 5.0)
      thor (~> 0.14)
    jquery-ui-rails (4.0.3)
      jquery-rails
      railties (>= 3.1.0)
    json (1.8.0)
    jwt (0.1.8)
      multi_json (>= 1.5)
    libv8 (3.11.8.17)
    listen (0.7.3)
    lumberjack (1.0.4)
    mail (2.4.4)
      i18n (>= 0.4.0)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    method_source (0.8.1)
    mime-types (1.23)
    mini_portile (0.5.1)
    multi_json (1.7.7)
    multi_test (0.0.2)
    multipart-post (1.2.0)
    newrelic_rpm (3.6.5.130)
    nokogiri (1.6.0)
      mini_portile (~> 0.5.0)
    oauth (0.4.7)
    oauth2 (0.8.1)
      faraday (~> 0.8)
      httpauth (~> 0.1)
      jwt (~> 0.1.4)
      multi_json (~> 1.0)
      rack (~> 1.2)
    omniauth (1.1.4)
      hashie (>= 1.2, < 3)
      rack
    omniauth-facebook (1.4.1)
      omniauth-oauth2 (~> 1.1.0)
    omniauth-oauth2 (1.1.1)
      oauth2 (~> 0.8.0)
      omniauth (~> 1.0)
    pg (0.12.2)
    polyglot (0.3.3)
    pry (0.9.12.2)
      coderay (~> 1.0.5)
      method_source (~> 0.8)
      slop (~> 3.4)
    quiet_assets (1.0.2)
      railties (>= 3.1, < 5.0)
    rack (1.4.5)
    rack-cache (1.2)
      rack (>= 0.4)
    rack-ssl (1.3.3)
      rack
    rack-test (0.6.2)
      rack (>= 1.0)
    rails (3.2.11)
      actionmailer (= 3.2.11)
      actionpack (= 3.2.11)
      activerecord (= 3.2.11)
      activeresource (= 3.2.11)
      activesupport (= 3.2.11)
      bundler (~> 1.0)
      railties (= 3.2.11)
    railties (3.2.11)
      actionpack (= 3.2.11)
      activesupport (= 3.2.11)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (>= 0.14.6, < 2.0)
    rake (10.1.0)
    rb-fsevent (0.9.1)
    rdoc (3.12.2)
      json (~> 1.4)
    ref (1.0.5)
    rspec (2.11.0)
      rspec-core (~> 2.11.0)
      rspec-expectations (~> 2.11.0)
      rspec-mocks (~> 2.11.0)
    rspec-core (2.11.1)
    rspec-expectations (2.11.3)
      diff-lcs (~> 1.1.3)
    rspec-mocks (2.11.3)
    rspec-rails (2.11.0)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec (~> 2.11.0)
    rubyzip (0.9.9)
    sass (3.2.9)
    sass-rails (3.2.5)
      railties (~> 3.2.0)
      sass (>= 3.1.10)
      tilt (~> 1.3)
    selenium-webdriver (2.33.0)
      childprocess (>= 0.2.5)
      multi_json (~> 1.0)
      rubyzip
      websocket (~> 1.0.4)
    slop (3.4.5)
    spork (0.9.2)
    sprockets (2.2.2)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    therubyracer (0.11.4)
      libv8 (~> 3.11.8.12)
      ref
    thin (1.5.1)
      daemons (>= 1.0.9)
      eventmachine (>= 0.12.6)
      rack (>= 1.0.0)
    thor (0.18.1)
    tilt (1.4.1)
    treetop (1.4.14)
      polyglot
      polyglot (>= 0.3.1)
    tzinfo (0.3.37)
    uglifier (1.2.3)
      execjs (>= 0.3.0)
      multi_json (>= 1.0.2)
    underscore-rails (1.5.1)
    websocket (1.0.7)
    will_paginate (3.0.3)
    xpath (0.1.4)
      nokogiri (~> 1.3)

PLATFORMS
  ruby

DEPENDENCIES
  annotate (= 2.5.0)
  bcrypt-ruby (= 3.0.1)
  bootstrap-sass
  bootstrap-will_paginate
  capybara (= 1.1.2)
  childprocess (= 0.3.9)
  coffee-rails (= 3.2.2)
  coffee-script
  cucumber-rails (= 1.2.1)
  database_cleaner (= 0.7.0)
  date_easter
  factory_girl_rails (= 4.1.0)
  faker (= 1.0.1)
  google_drive
  growl (= 1.0.3)
  guard-jasmine
  guard-rspec (= 1.2.1)
  guard-spork (= 1.5.0)
  highcharts-rails
  jasminerice!
  jquery-rails (= 2.0.2)
  jquery-ui-rails
  newrelic_rpm
  nokogiri
  omniauth-facebook
  pg (= 0.12.2)
  quiet_assets
  rails (= 3.2.11)
  rake (= 10.1.0)
  rb-fsevent (= 0.9.1)
  rspec-rails (= 2.11.0)
  sass-rails (= 3.2.5)
  spork (= 0.9.2)
  therubyracer
  thin
  uglifier (= 1.2.3)
  underscore-rails
  will_paginate (= 3.0.3)

gem list
actionmailer (4.0.0, 3.2.14, 3.2.11)
actionpack (4.0.0, 3.2.14, 3.2.11)
activemodel (4.0.0, 3.2.14, 3.2.11)
activerecord (4.0.0, 3.2.14, 3.2.11)
activerecord-deprecated_finders (1.0.3)
activeresource (4.0.0, 3.2.14, 3.2.11)
activesupport (4.0.0, 3.2.14, 3.2.11)
annotate (2.5.0)
arel (4.0.0, 3.0.2)
atomic (1.1.10)
bcrypt-ruby (3.1.1, 3.0.1)
bootstrap-sass (2.3.2.1)
bootstrap-will_paginate (0.0.9)
builder (3.2.2, 3.1.4, 3.0.4)
bundler (1.3.5, 1.3.0.pre.4, 1.1.5)
bundler-unload (1.0.1)
capybara (2.1.0, 1.1.2)
childprocess (0.3.9)
coderay (1.0.9)
coffee-rails (4.0.0, 3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.6.3)
cucumber (1.3.5)
cucumber-rails (1.3.1, 1.2.1)
daemons (1.1.9)
database_cleaner (1.0.1, 0.7.0)
date_easter (0.0.1)
diff-lcs (1.2.4, 1.1.3)
erubis (2.7.0)
eventmachine (1.0.3)
execjs (1.4.0)
factory_girl (4.2.0, 4.1.0)
factory_girl_rails (4.2.1, 4.1.0)
faker (1.1.2, 1.0.1)
faraday (0.8.7)
ffi (1.9.0)
formatador (0.2.4)
gherkin (2.12.0)
google_drive (0.3.6)
growl (1.0.3)
guard (1.8.1, 1.7.0)
guard-jasmine (1.17.0)
guard-rspec (3.0.2, 1.2.1)
guard-spork (1.5.1, 1.5.0)
hashie (2.0.5)
highcharts-rails (3.0.2)
hike (1.2.3)
httpauth (0.2.0)
i18n (0.6.4)
journey (1.0.4)
jquery-rails (3.0.4, 2.0.2)
jquery-ui-rails (4.0.3)
json (1.8.0)
jwt (0.1.8)
libv8 (3.16.14.1, 3.11.8.17 x86_64-darwin-12)
listen (1.2.2, 0.7.3)
lumberjack (1.0.4)
mail (2.5.4, 2.4.4)
method_source (0.8.1)
mime-types (1.23)
mini_portile (0.5.1)
minitest (5.0.6, 4.7.5)
multi_json (1.7.7)
multi_test (0.0.2)
multi_xml (0.5.4)
multipart-post (1.2.0)
newrelic_rpm (3.6.5.130)
nokogiri (1.6.0)
oauth (0.4.7)
oauth2 (0.9.2, 0.8.1)
omniauth (1.1.4)
omniauth-facebook (1.4.1)
omniauth-oauth2 (1.1.1)
pg (0.16.0, 0.12.2)
polyglot (0.3.3)
pry (0.9.12.2)
quiet_assets (1.0.2)
rack (1.5.2, 1.4.5)
rack-cache (1.2)
rack-ssl (1.3.3)
rack-test (0.6.2)
rails (4.0.0, 3.2.11)
rails-observers (0.1.2)
railties (4.0.0, 3.2.14, 3.2.11)
rake (10.1.0, 0.9.2.2)
rb-fsevent (0.9.3, 0.9.1)
rb-inotify (0.9.0)
rb-kqueue (0.2.0)
rdoc (4.0.1, 3.12.2)
ref (1.0.5)
rspec (2.14.1, 2.11.0)
rspec-core (2.14.4, 2.11.1)
rspec-expectations (2.14.0, 2.11.3)
rspec-mocks (2.14.1, 2.11.3)
rspec-rails (2.14.0, 2.11.0)
rubygems-bundler (1.2.2, 1.0.7)
rubyzip (0.9.9)
rvm (1.11.3.8, 1.11.3.5)
sass (3.2.9)
sass-rails (4.0.0, 3.2.5)
selenium-webdriver (2.33.0)
simplecov (0.7.1)
simplecov-html (0.7.1)
slop (3.4.5)
spork (0.9.2)
sprockets (2.10.0, 2.2.2)
sprockets-rails (2.0.0)
therubyracer (0.11.4)
thin (1.5.1)
thor (0.18.1)
thread_safe (0.1.2)
tilt (1.4.1)
treetop (1.4.14)
tzinfo (1.0.1, 0.3.37)
uglifier (2.1.2, 1.2.3)
underscore-rails (1.5.1)
websocket (1.1.1, 1.0.7)
will_paginate (3.0.4, 3.0.3)
xpath (2.0.0, 0.1.4)

A: I have seen dependency checking get confused at times with rvm. Cleaning up the gemset usually helps.
To diagnose, start with a clean gemset (create a new one) and run bundle install. If this happens again, I would suggest submiting an issue. If it doesn't then you can run with the new gemset.


text:
Q: Pass value between to fragments when I pass parameter between two fragment, the value of string user it is not print in log...why?
This is my code:
ARRAY ADAPTER CLASS:
 public abstract class PlanetAdapter extends ArrayAdapter<Planet> implements CompoundButton.OnCheckedChangeListener

{
    private List<Planet> planetList;
    private Context context ;
    ArrayList<Birra> objects;
    public boolean Checked;
    private Integer[] imageId;
    String ciao;
    static PlanetAdapter plAdapter;
    String selState ;
    private FragmentManager fragmentManager;

   /* public PlanetAdapter(Context context) {
        super(context, R.layout.single_listview_item);
    }
*/

    /*public PlanetAdapter(FragmentManager fm,List<Planet> planetList, Context context,Integer[] imageId) {

        super(context, R.layout.single_listview_item,planetList);

        this.fm=fm;
        this.planetList = planetList;
        this.context = context;
        this.imageId = imageId;
    }
*/
    public PlanetAdapter(List<Planet> planetList, Context context,Integer[] imageId) {
        super(context, R.layout.single_listview_item,planetList);
        this.planetList = planetList;
        this.context = context;
        this.imageId = imageId;
    }

    public FragmentManager getFragmentManager() {
        return fragmentManager;
    }

    public class PlanetHolder {
        public TextView planetName;
        public TextView distView;
        public TextView valuta;
        public CheckBox chkBox;
        public EditText edit;
        public TextView caratteristica;
        public boolean checked;
        public TextView id;
        public ImageView imageView;
        public Spinner spinner;
    }

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

    @Override
    public Planet getItem(int position) {
        return planetList.get(position);
    }

    @Override
    public View getView(final int position, final View convertView, ViewGroup parent) {

        View row = convertView;
        PlanetHolder holder = null;

        if (row == null) {
            LayoutInflater inflater = ((Activity) context).getLayoutInflater();
            row = inflater.inflate(R.layout.single_listview_item, parent, false);
            holder = new PlanetHolder();
            holder.planetName = (TextView) row.findViewById(R.id.name);
            holder.distView = (TextView) row.findViewById(R.id.dist);
            holder.valuta = (TextView) row.findViewById(R.id.valuta);
            holder.chkBox = (CheckBox) row.findViewById(R.id.chk_box);
            holder.edit = (EditText) row.findViewById(R.id.editText);
            holder.spinner = (Spinner) row.findViewById(R.id.simpleSpinner);

            holder.caratteristica=(TextView) row.findViewById(R.id.caratteristica);
            holder.imageView = (ImageView) row.findViewById(R.id.ivImage);
            holder.edit.setVisibility(View.GONE);
            holder.edit.setEnabled(false);
            holder.spinner.setVisibility(View.GONE);

            // holder.id = (TextView) row.findViewById(R.id.id);

            row.setTag(holder);

        } else {
            holder = (PlanetHolder) row.getTag();
        }

        final Planet p = planetList.get(position);
        holder.imageView.setImageResource(imageId[position]);
        holder.planetName.setText(p.getName());
        holder.distView.setText("" + p.getDistance());
        holder.valuta.setText("" + p.getValuta());
        holder.chkBox.setChecked(p.isSelected());
        holder.chkBox.setTag(p);
        holder.caratteristica.setText(p.getCaratteristica());
       holder.edit.setEnabled(false);
        SharedPreferences states = getContext().getSharedPreferences("states", Context.MODE_PRIVATE);
        boolean isChecked = states.getBoolean("holder.chkBox" + holder.planetName.getText().toString(), false);
        System.out.println(isChecked);
        if (isChecked) {
            holder.chkBox.setChecked(true);
            holder.edit.setVisibility(View.VISIBLE);
            holder.edit.setEnabled(true);
            holder.spinner.setVisibility(View.VISIBLE);

            SharedPreferences statess = getContext().getSharedPreferences("states", Context.MODE_PRIVATE);
            String string = statess.getString("finalHolder.edit" + holder.planetName.getText().toString(), holder.edit.getText().toString().trim());
            holder.edit.setText(string);

        } else {
            holder.chkBox.setChecked(false);
            holder.edit.setVisibility(View.GONE);
            holder.edit.setEnabled(false);
            holder.spinner.setVisibility(View.GONE);

         }

        holder.chkBox.setOnCheckedChangeListener(PlanetAdapter.this);
       // final BirraHolder finalHolder = birraHolder;
        final PlanetHolder finalHolder = holder;

        holder.chkBox.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(final View v) {
                if (finalHolder.chkBox.isChecked()) {
                    finalHolder.edit.setVisibility(View.VISIBLE);
                    finalHolder.edit.setEnabled(true);
                    finalHolder.spinner.setVisibility(View.VISIBLE);
                    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
                            getContext(),
                            R.array.country_arrays,
                            android.R.layout.simple_spinner_item);
                    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
                    //finalHolder.spinner.setAdapter(adapter);

                    finalHolder.spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                            finalHolder.spinner.setSelection(position);
                            selState = finalHolder.spinner.getSelectedItem().toString();
                            System.out.println(selState);
                            Toast.makeText(
                                    getContext(),
                                    "Clicked on Planet: " + selState + "", Toast.LENGTH_SHORT).show();

/*
                            Fragment fragment = new Fragment();
                             Bundle bundle = new Bundle();
                            bundle.putString("key", selState);
                            Log.i("BUNDLE", bundle.toString());
                            fragment.setArguments(bundle);*/
                            MyListFragment fragment = MyListFragment.newInstance("my_string");

FRAGMENT:
public  class MyListFragment extends Fragment implements
        CompoundButton.OnCheckedChangeListener{

    ListView lv;
    ArrayList<Planet> planetList;
    static PlanetAdapter plAdapter;
    private TextView txtName;
    private TextView txtEmail;
    private Button btnLogout;
    ListView listView;
    String user="";

    private SQLiteHandler db;
    private SessionManager session;
    BirraAdapter biAdapter;
    PlanetAdapter.PlanetHolder holder;
    private static Context context = null;
    private static FragmentActivity mInstance;

    Integer[] imageId = {
            R.mipmap.androtuto,
            R.mipmap.ic_launcher,
            R.mipmap.ic_launcher,
            R.mipmap.ic_launcher,
            R.mipmap.ok,
            /*R.drawable.image6,
            R.drawable.image7*/

    };
    public static MyListFragment newInstance(String tagName) {
        MyListFragment fragment = new MyListFragment ();
        Bundle args = new Bundle();
        args.putString("key", tagName);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        if (getArguments() != null) {
            user = getArguments().getString("key");
        }

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the custom_spinner_items for this fragment
        //super.onDestroy();

        SharedPreferences settings = getContext().getSharedPreferences("states", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = settings.edit();
        editor.clear();
        editor.commit();

        ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_list2, container, false);

        /*Bundle bundle = this.getArguments();
        String strtext = bundle.getString("key", " ");
        System.out.println(strtext);*/
        System.out.println("prima ancora");

        Bundle arguments = this.getArguments();
        System.out.println("prima");
        if (arguments != null) {
            System.out.println("dopo");

            //String userId = arguments.getString("key");
                //System.out.println("finalmente:"+userId);
             user = getArguments().getString("Key");

        } /*else {
            Log.i("BUNDLE == null", "NULL");
        }*/
        System.out.println("finalmente:"+user);
        Log.d("finalmente:", "" + user);

        lv = (ListView) rootView.findViewById(R.id.listview);
        ListAdapter listAdapter = new MyListAdapter(getContext());
        lv.setAdapter(listAdapter);

        context = getActivity();
        mInstance = getActivity();
        txtName = (TextView) rootView.findViewById(R.id.name);
        txtEmail = (TextView) rootView.findViewById(R.id.numero_telefonico);
        btnLogout = (Button) rootView.findViewById(R.id.btnLogout);

        // SqLite database handler
        db = new SQLiteHandler(context.getApplicationContext());

        // session manager
        session = new SessionManager(context.getApplicationContext());
/*

        if (!session.isLoggedIn()) {
            logoutUser();
        }
*/

        // Fetching user details from SQLite
        HashMap<String, String> user = db.getUserDetails();

        String name = user.get("name");
        //String email = user.get("email");
//      String email = user.get("email");
        String email = user.get("numero_telefonico");

        // Displaying the user details on the screen
        System.out.println(name + email);

        txtName.setText(name);
        txtEmail.setText(email);
    /*  Button mButton = (Button) rootView.findViewById(R.id.button);
        mButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                showResult(v);

            }
        });*/
        //return inflater.inflate(R.custom_spinner_items.fragment_list2, container, false);
        btnLogout.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                logoutUser();
            }
        });

        return rootView;
    }

    private void logoutUser() {
        session.setLogin(false);

        db.deleteUsers();

        // Launching the login activity
//      Intent intent = new Intent(MyListFragment.this, LoginActivity.class);
        Intent intent = new Intent(getActivity().getApplicationContext(), LoginActivity.class);

        startActivity(intent);
        mInstance.finish();
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        lv = (ListView)getView().findViewById(R.id.listview);
        displayPlanetList();

    }

    private void displayPlanetList() {

        planetList = new ArrayList<Planet>();
        planetList.add(new Planet("Margherita", "6", "€","(pomodoro e mozzarella),"));
        planetList.add(new Planet("Diavola", "7","€","(pomodoro,mozzarella e salsiccia piccante)"));
        planetList.add(new Planet("Bufalina", "5","€","(pomodoro e mozzarella di bufala)"));
        planetList.add(new Planet("Marinara", "5", "€","(pomodoro)"));
        planetList.add(new Planet("Viennese", "4", "€", "(pomodoro,mozzarella e wrustel)"));

        plAdapter = new PlanetAdapter(planetList, getContext(),imageId) {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

                int pos = lv.getPositionForView(buttonView);
                if (pos != ListView.INVALID_POSITION) {
                    Planet p = planetList.get(pos);
                    p.setSelected(isChecked);

            /*Toast.makeText(
                    getActivity(),
                    "Clicked on Pizza: " + p.getName() + ". State: is "
                            + isChecked, Toast.LENGTH_SHORT).show();*/
                }

            }
        };

        lv.setAdapter(plAdapter);
    }

    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

        /*int pos = lv.getPositionForView(buttonView);
        if (pos != ListView.INVALID_POSITION) {
            Planet p = planetList.get(pos);
            p.setSelected(isChecked);

            *//*Toast.makeText(
                getActivity(),
                "Clicked on Planet: " + p.getName() + ". State: is "
                        + isChecked, Toast.LENGTH_SHORT).show();*//*
        }*/

    }

    @TargetApi(Build.VERSION_CODES.KITKAT)
    /*public String showResult(View v) throws IOException {
    *//*    //String  result = "Selected Product are :";
        String  result = "";

    //  int totalAmount=0;
        //String  result2 = "";
        //int totalAmount2=0;

        //String a="";
        //String z="";

        for (Planet p : plAdapter.getBox()) {
            if (p.isSelected()){
                result += "\n" + p.getName()+" "+p.getDistance()+"€"+"q.tà :"+p.getQuantità();
            }
        }

        //Toast.makeText(context, result + "\n" + "Total Amount:=" + totalAmount2 + "€", Toast.LENGTH_LONG).show();

        return result;*//*
        String  result = "";

        Gson json = new Gson();
        for (Planet p : plAdapter.getBox()) {
            if (p.isSelected()){
                *//*json.put("name",p.getName());
                json.put("distance",p.getDistance());
                json.put("quantity",p.getQuantità());*//*
                result=result+json.toJson(p);

            }
        }
         //result=json.toString();

        String path = Environment.getExternalStorageDirectory()
                .getAbsolutePath() + "/droidText/";

        //FileWriter file=null;

    *//*    try {
            file = new FileWriter(path+"filename5.json");
            file.write(result);

        }catch(IOException ie){}
        finally{

            file.flush();
            file.close();

        }*//*
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
        String currentDate = sdf.format(new Date());

        try(FileWriter file = new FileWriter(path  + currentDate + " - " + ".json"))  {
        //  file=new FileWriter(path+"filename100.json");
        *//*FileWriter file = new FileWriter(path+"filename31.json");
            file.write(result);
        file.close();
        *//*

            json.toJson(result, file);
        *//*catch(IOException r){

        }*//*
        }catch (IOException e){

        }
        System.out.println(result);
        return result;

    }*/
    public static String showResultTotale2(View v,String user) {

        int totalAmount=0;
        String pizzeOrdinate="";

        for (Planet p : plAdapter.getBox()) {
            if (p.isSelected()){
                pizzeOrdinate+="\n" + p.getName()+ " " + p.getDistance() + "€" + "q.tà :" + p.getQuantità()+ " " + user;

            }
        }
        return pizzeOrdinate;
    }

    public static int showResultTotale(View v) {

        int totalAmount=0;

        for (Planet p : plAdapter.getBox()) {
            if (p.isSelected()){
                int quantitaInt= Integer.parseInt(p.getQuantità() );
                int distanceInt= Integer.parseInt(p.getDistance());
                totalAmount+=distanceInt * quantitaInt;
            }
        }
        return totalAmount;
    }

}

A: Try like this (When creating fragment in android studio, it is done this way):
public  class MyListFragment extends Fragment implements
        CompoundButton.OnCheckedChangeListener{

    ListView lv;
    ArrayList<Planet> planetList;
    static PlanetAdapter plAdapter;
    private TextView txtName;
    private TextView txtEmail;
    private Button btnLogout;
    ListView listView;
    String user="";

    private SQLiteHandler db;
    private SessionManager session;
    BirraAdapter biAdapter;
    PlanetAdapter.PlanetHolder holder;
    private static Context context = null;
    private static FragmentActivity mInstance;

    Integer[] imageId = {
            R.mipmap.androtuto,
            R.mipmap.ic_launcher,
            R.mipmap.ic_launcher,
            R.mipmap.ic_launcher,
            R.mipmap.ok,
            /*R.drawable.image6,
            R.drawable.image7*/

    };

public MyListFragment () { //Always put the empty constructor
        }

    public static MyListFragment newInstance(String tagName) {
        MyListFragment fragment = new MyListFragment ();
        Bundle args = new Bundle();
        args.putString("key", tagName);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        if (getArguments() != null) {
            user = getArguments().getString("key");
        }

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the custom_spinner_items for this fragment
        //super.onDestroy();

        SharedPreferences settings = getContext().getSharedPreferences("states", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = settings.edit();
        editor.clear();
        editor.commit();

        ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_list2, container, false);

        /*Bundle bundle = this.getArguments();
        String strtext = bundle.getString("key", " ");
        System.out.println(strtext);*/
        System.out.println("prima ancora");

        Bundle arguments = this.getArguments();
        System.out.println("prima");

        System.out.println("finalmente:"+user);
        Log.d("finalmente:", "" + user);

        lv = (ListView) rootView.findViewById(R.id.listview);
        ListAdapter listAdapter = new MyListAdapter(getContext());
        lv.setAdapter(listAdapter);

        context = getActivity();
        mInstance = getActivity();
        txtName = (TextView) rootView.findViewById(R.id.name);
        txtEmail = (TextView) rootView.findViewById(R.id.numero_telefonico);
        btnLogout = (Button) rootView.findViewById(R.id.btnLogout);

        // SqLite database handler
        db = new SQLiteHandler(context.getApplicationContext());

        // session manager
        session = new SessionManager(context.getApplicationContext());
/*

        if (!session.isLoggedIn()) {
            logoutUser();
        }
*/

        // Fetching user details from SQLite
        HashMap<String, String> user = db.getUserDetails();

        String name = user.get("name");
        //String email = user.get("email");
//      String email = user.get("email");
        String email = user.get("numero_telefonico");

        // Displaying the user details on the screen
        System.out.println(name + email);

        txtName.setText(name);
        txtEmail.setText(email);
    /*  Button mButton = (Button) rootView.findViewById(R.id.button);
        mButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                showResult(v);

            }
        });*/
        //return inflater.inflate(R.custom_spinner_items.fragment_list2, container, false);
        btnLogout.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                logoutUser();
            }
        });

        return rootView;
    }

    private void logoutUser() {
        session.setLogin(false);

        db.deleteUsers();

        // Launching the login activity
//      Intent intent = new Intent(MyListFragment.this, LoginActivity.class);
        Intent intent = new Intent(getActivity().getApplicationContext(), LoginActivity.class);

        startActivity(intent);
        mInstance.finish();
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        lv = (ListView)getView().findViewById(R.id.listview);
        displayPlanetList();

    }

    private void displayPlanetList() {

        planetList = new ArrayList<Planet>();
        planetList.add(new Planet("Margherita", "6", "€","(pomodoro e mozzarella),"));
        planetList.add(new Planet("Diavola", "7","€","(pomodoro,mozzarella e salsiccia piccante)"));
        planetList.add(new Planet("Bufalina", "5","€","(pomodoro e mozzarella di bufala)"));
        planetList.add(new Planet("Marinara", "5", "€","(pomodoro)"));
        planetList.add(new Planet("Viennese", "4", "€", "(pomodoro,mozzarella e wrustel)"));

        plAdapter = new PlanetAdapter(planetList, getContext(),imageId) {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

                int pos = lv.getPositionForView(buttonView);
                if (pos != ListView.INVALID_POSITION) {
                    Planet p = planetList.get(pos);
                    p.setSelected(isChecked);

            /*Toast.makeText(
                    getActivity(),
                    "Clicked on Pizza: " + p.getName() + ". State: is "
                            + isChecked, Toast.LENGTH_SHORT).show();*/
                }

            }
        };

        lv.setAdapter(plAdapter);
    }

    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

        /*int pos = lv.getPositionForView(buttonView);
        if (pos != ListView.INVALID_POSITION) {
            Planet p = planetList.get(pos);
            p.setSelected(isChecked);

            *//*Toast.makeText(
                getActivity(),
                "Clicked on Planet: " + p.getName() + ". State: is "
                        + isChecked, Toast.LENGTH_SHORT).show();*//*
        }*/

    }

    @TargetApi(Build.VERSION_CODES.KITKAT)
    /*public String showResult(View v) throws IOException {
    *//*    //String  result = "Selected Product are :";
        String  result = "";

    //  int totalAmount=0;
        //String  result2 = "";
        //int totalAmount2=0;

        //String a="";
        //String z="";

        for (Planet p : plAdapter.getBox()) {
            if (p.isSelected()){
                result += "\n" + p.getName()+" "+p.getDistance()+"€"+"q.tà :"+p.getQuantità();
            }
        }

        //Toast.makeText(context, result + "\n" + "Total Amount:=" + totalAmount2 + "€", Toast.LENGTH_LONG).show();

        return result;*//*
        String  result = "";

        Gson json = new Gson();
        for (Planet p : plAdapter.getBox()) {
            if (p.isSelected()){
                *//*json.put("name",p.getName());
                json.put("distance",p.getDistance());
                json.put("quantity",p.getQuantità());*//*
                result=result+json.toJson(p);

            }
        }
         //result=json.toString();

        String path = Environment.getExternalStorageDirectory()
                .getAbsolutePath() + "/droidText/";

        //FileWriter file=null;

    *//*    try {
            file = new FileWriter(path+"filename5.json");
            file.write(result);

        }catch(IOException ie){}
        finally{

            file.flush();
            file.close();

        }*//*
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
        String currentDate = sdf.format(new Date());

        try(FileWriter file = new FileWriter(path  + currentDate + " - " + ".json"))  {
        //  file=new FileWriter(path+"filename100.json");
        *//*FileWriter file = new FileWriter(path+"filename31.json");
            file.write(result);
        file.close();
        *//*

            json.toJson(result, file);
        *//*catch(IOException r){

        }*//*
        }catch (IOException e){

        }
        System.out.println(result);
        return result;

    }*/
    public static String showResultTotale2(View v,String user) {

        int totalAmount=0;
        String pizzeOrdinate="";

        for (Planet p : plAdapter.getBox()) {
            if (p.isSelected()){
                pizzeOrdinate+="\n" + p.getName()+ " " + p.getDistance() + "€" + "q.tà :" + p.getQuantità()+ " " + user;

            }
        }
        return pizzeOrdinate;
    }

    public static int showResultTotale(View v) {

        int totalAmount=0;

        for (Planet p : plAdapter.getBox()) {
            if (p.isSelected()){
                int quantitaInt= Integer.parseInt(p.getQuantità() );
                int distanceInt= Integer.parseInt(p.getDistance());
                totalAmount+=distanceInt * quantitaInt;
            }
        }
        return totalAmount;
    }

}

Just simpler :
public class MyListFragment extends Fragment {

    public MyListFragment () { //Always put the empty constructor
    }

    public static MyListFragment newInstance(String tagName) {
        MyListFragment fragment = new MyListFragment ();
        Bundle args = new Bundle();
        args.putString("key", tagName);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        if (getArguments() != null) {
             user = arguments.getString("key");
            }

        }
}

And where your are creating the fragment instead of this :
MyListFragment fragment = new MyListFragment();
                            final Bundle bundle = new Bundle();
                            bundle.putString("key", selState);
                            Log.i("BUNDLE", bundle.toString());
                            fragment.setArguments(bundle);

Use this:
MyListFragment fragment = MyListFragment.newInstance("my_string");

Question was really NOT clear...
In adpater:
private MyListFragment fragment;
    public PlanetAdapter(List<Planet> planetList, Context context,Integer[] imageId, MyListFragment myFragment) {
            super(context, R.layout.single_listview_item,planetList);
            this.planetList = planetList;
            this.context = context;
            this.imageId = imageId;
this.fragment = myFragment;
    }

When you need it:
fragment.passValue("my string");

Now in your fragment create the method:
public void passValue(String myString){
//Do whatever with myString
}

A: This is because you are calling getArguments() in the wrong place.
Override onCreate() and put the code to fetch the value inside it.
 @Override
    public void onCreate(Bundle savedInstanceState) {
            Bundle arguments = getArguments();
            if (arguments != null) {
                    //String userId = arguments.getString("key");
                    //System.out.println("finalmente:"+userId);
                 user = arguments.getString("key");

            } /*else {
                Log.i("BUNDLE == null", "NULL");
            }*/
            //System.out.println("finalmente:"+user);
            Log.e("MESSAGE","finalmente:"+user);

    }

A: System.out.println("finalmente:"+user); doesn't work in android.
you must use Log.d("MESSAGE","MY MESSAGE");
Bundle arguments = getArguments();
            if (arguments != null) {
                    //String userId = arguments.getString("key");
                    //System.out.println("finalmente:"+userId);
                 user = arguments.getString("key");

            } /*else {
                Log.i("BUNDLE == null", "NULL");
            }*/
           Log.d("finalmente:",""+user);

    }

see answer here Why doesn't "System.out.println" work in Android?

A: You are trying to getArguments() when initiating the Fragment. Better try to handle your Arguments when onViewCreated trigger
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    handleArguments(getArguments());
}

public void handleArguments(Bundle bnd) {
    if (bnd != null) {
         if (bnd.containsKey("key")) {
         user = arguments.getString("key");
         }
    }
System.out.println("finalmente:"+user);
}


text:
Q: Find existence of a record in MySQL table with input data as a list I have a list of ids in text format as a comma separated value like so
("12345", "12346", "12347", etc, etc)
I would like to find their existence or non existence from a table say devices table which has a column called device ids (not primary key)
Ideally i would like to get a list which says if each item exists or not.
So far I have tried to get the query of those that exist and I have to manually find the non existing ones.
Is there a for loop I have to run on stored procedures or something like that. Please help.
Table structure

<pre>
| id   | device_id       | device_name   |
+------+-----------------+---------------+
|   71 | 352701060409650 | 57X           |
|   13 | 352701060409700 | 582           |
</pre>

A: You need to create a query with left join to the same table with 'IFNULL' condition. There already has been a post for this topic. Please check this out here.


text:
Q: Resize iFrame in facebook fan page I want resize the iframe height of my tab page. I am trying FB.Canvas.SetSize method, also I try with jQuery and javascript resize the iframe but don´t work.
My application is not a Canvas.It is a tab page so i think "FB.Canvas method should not work with tab page".
How could resize my tab page on facebook profile?
How could drop the iFrame scrollbars on tab page?
Excuse me I also need to know if I could modify the share button with a custom image.
Thanks in advance

A: *

*Provide some code

*Make sure you have the Canvas Height option is set to Settable under the App Advanced Settings

*Use asynchronous Loading of your JS-SDK and put your FB.Canvas.setSize(); inside the fbAsyncInit function

*Please note that the fbAsyncInit function may fire (and hence your FB.Canvas.setSize();) before all images of your page are loaded! which means actual height of page is not reached yet!


text:
Q: Please help me with this Arithmetic problem. A man arranges to pay off a debt of $3600 by 40 annual instalments which form an arithmetic series. When 30 of the instalments are paid, he dies leaving a third of the debt unpaid : find the value of the first instalment.

A: Since the man has to pay the debt in 40 installments,
$$\sum\limits_{n = 1}^{40} \left( a + \left( n - 1 \right) d \right) = 3600$$
$$\therefore 2a + 39d = 180$$
Also, the last 10 installments is equal to one - third of the total debt.
$$\therefore \sum\limits_{n = 31}^{40} \left( a + \left( n - 1 \right) d \right) = \dfrac{1}{3} \times 3600$$
$$\therefore 10a + 345d = 1200$$
On solving the simultaneous equations obtained above in $a$ and $d$, we get $a = 51 $.
Thus, the first installment should be of $\$ 51$.

A: If $a$ is the first instalment and $r$ the increment of the arithmetic series the sum of the first $n$ terms will be
$$S_n=n{2a+(n-1)r\over 2}$$
We know $S_{30}=2400$ and $S_{40}=3600$ and this translates into the system of linear equations
$$\begin{cases}
30a+435r=2400\\
40a+780r=3600
\end{cases}$$
the solution is $a=51$ and $r=2$


text:
Q: Facebook Like button sometimes appears sometimes not I have strange issue with like buttons on my site. When I enter a page it shows up correctly, than after refresh it doesn't appears and I have javascript error

FB.provide is not a function
[Break on this error] FB.provide('Array',{indexOf:function(a...|c.hasOwnProperty(d))a(c[d],d,c);}});

Initialization and asynchronous including of js looks like this

And heres the input code of like and share buttons:
<fb:like href="<%= link -%>" layout="button_count" font="arial"></fb:like>

<a title="Share" name="fb_share" type="button_count" share_url="<%= link -%>" href="http://www.facebook.com/sharer.php">Share

Any ideas ?

A: I found that order also matters, so when loading files dynamically, all.js should be loaded before FB.share js

A: I think I found the solution.
When I loaded the all.js file the way you did, I also had a problem, but when I downloaded all.js manually and copied it somewhere on the site. After that, loading it through the script tag made this problem went away.

A: After you are done with placing your html in DOM, just call window.fbAsyncInit();.


text:
Q: Root routine in C I'm writing a routine in C. Below is the source:
#include <stdio.h>
#include <math.h> //Este es el numpy de C (para seno y coseno, aqui)

int raices(float r,float discriminante,float a,float b,float c, float *r1, float *r2)
{
    discriminante=b*b-4*a*c;
    if(discriminante<0)
    {
        printf("Raices complejas\n");
    }
    else
    {
        r=sqrt(discriminante);
        *r1=(-b+r)/(2*a);
        *r2=(-b-r)/(2*a);
    }
}

int main(void)
{
    float sina,cosa,a,b,g=9.8,v,h,t1,t2,d1,d2;
    printf("Ingrese la rapidez y el angulo (>0 y <90):");
    scanf("%f,%f",&v,&a);

    if(a<0 || a>90)
    {
        printf("El angulo esta en un rango incorrecto\n");
        return 1;
    }

    printf("Entre la altura final:");
    scanf("%f",&h);

    sina=sin(a);
    cosa=cos(a);
    t1=(1/2)*g;

    raices((1/2)*g,-v*sina,h,&t1,&t2);

    return 0;
}

When I compile it with cc, i get these errors:
cc proyectil.c -o proyectil.out
proyectil.c: In function 'main':
proyectil.c:47:1: error: incompatible type for argument 4 of 'raices'
raices((1/2)*g,-v*sina,h,&t1,&t2);

proyectil.c:6:5: note: expected 'float' but argument is of type 'float *'
int raices(float r,float discriminante,float a,float b,float c, float *r1, float *r2)
    ^
proyectil.c:47:1: error: incompatible type for argument 5 of 'raices'
raices((1/2)*g,-v*sina,h,&t1,&t2);
    ^
proyectil.c:6:5: note: expected 'float' but argument is of type 'float *'
int raices(float r,float discriminante,float a,float b,float c, float *r1, float *r2)
    ^
proyectil.c:47:1: error: too few arguments to function 'raices'
raices((1/2)*g,-v*sina,h,&t1,&t2);
   ^
proyectil.c:6:5: note: declared here
int raices(float r,float discriminante,float a,float b,float c, float *r1, float *r2)
    ^

Why does give me an error when I use *?
This is my first program in C so I don't really know why this is happening.

A: error is here:
int raices(float r,float discriminante,float a,float b,float c, float *r1, float *r2)
{

should be
void raices(float a,float b,float c, float *r1, float *r2)
{
    float r;
    float discriminante;


text:
Q: Why Can't launch React App after closing it? Complete newbie with React, and it seems so much more convoluted than anything i've experienced. the coding is easier than JavaScript. running the applications on the other hand... a complete nightmare...
Just followed a tutorial on youtube and actually managed to finish it without bugging out mid way. But 3 hours later, when I wanted to check out the project again. (just want to run the app in my browser and have a look) I go to vs code and open terminal and type in npm start (newb so idk anything, is this even what i should do? ) and it gives me this
"next start
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info  - Using webpack 5. Reason: no next.config.js https://nextjs.org/docs/messages/webpack5
Error: Could not find a production build in the 'C:\Users\Eric\Downloads\New folder\portfolio_website-STARTER.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
at Server.readBuildId (C:\Users\Eric\Downloads\New folder\portfolio_website-STARTER\node_modules\next\dist\next-server\server\next-server.js:151:355)
at new Server (C:\Users\Eric\Downloads\New folder\portfolio_website-STARTER\node_modules\next\dist\next-server\server\next-server.js:3:120)
at NextServer.createServer (C:\Users\Eric\Downloads\New folder\portfolio_website-STARTER\node_modules\next\dist\server\next.js:1:2935)
at async C:\Users\Eric\Downloads\New folder\portfolio_website-STARTER\node_modules\next\dist\server\next.js:1:3360
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! portfolio_nextjs@0.1.0 start: next start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the portfolio_nextjs@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Eric\AppData\Roaming\npm-cache_logs\2022-03-28T02_41_25_297Z-debug.log"
I can't even begin to decipher with all that was. this is why i'm having so much trouble with React, it's always a complete wall of text... can someone please explain what's going on?

A: Sorry i can't comment due to my low reputation but I'll be explaining Amadan's comment.
Try to read the error message. It literally says try building your app.
As newbies, we may be confused by the meaning of "build". You can refer this as "compile" for quick analogy. (for the sake of quick analogy as you may be familiar with compile)
The message itself recommend you to build your app with 'next build'. Try running the command 'next build' to your terminal and see what happen.
'npm start' (an alias for 'npm run start') itself may not include building the project first. Depending on your scripts in package.json file: you can try 'npm run build' (in case your tutorial includes this).

*

*See the docs for more information: https://docs.npmjs.com/cli/v8/commands

*Also read more about building apps: https://create-react-app.dev/docs/production-build


text:
Q: Maximum width possible inside a container div I am using skeleton css framework and i need some divs to occupy the maximum width possible,something like how SO does in the div holding the search input box.I have this fiddle http://jsfiddle.net/pRmus/1/ showing a simple div i made
.all-width{
    background-color:pink;
    }

Since i am displaying this div inside the container and the container width is 940px,the width cannot cover all the width the browser offers.Is there a solution i can i use to get what i want?.I was thinking z-index on that div,but i am not so sure.

A: Try moving the pink bar outside of container. Make a wrapper around an individual container, so this wrapper can really have 100% width.
JSFiddle http://jsfiddle.net/Y5mB6/
HTML

Skeleton

Version 1.2

hello world

About Skeleton?

...

CSS
.wrapper{
    background-color:pink;
}


text:
Q: What is the best way to get and set selection when using databinding in winforms? I use binding in a win-forms application (.Net 2.0), and I try to find the best way to maintain the selected items in my data bound controls. I read that the best way to access the selection is by using CurrencyManager's (or bindingSource's) "Current" and "Position" properties. The problem is that I can't find a way to select nothing (Position's value will always be set to the index of one of the items in the list), and there is also no way to know if there are many items selected.
Is there a way to solve those problems using CurrencyManager or should I start using the properties that provided by the controls (e.g. DataGridView's SelectedRows property)?
Thanks!

A: I'm not entirely sure what you're asking here.  If you're asking how to bind detail controls to the selected item in a list control or grid, I think the best approach is to use a two BindingSource objects.  One that the grid binds to and one that the detail controls bind to.  Then, when the user selects a row in the grid, use the Filter property of the detail BindingSource to narrow it down to the one selected row.  Then, you will be sure that the selected row's details appear in the controls.
For example:
  DetailBindingSource.Filter = "ID = " & SelectedRow.IDColumn.Value

If this is not what you are looking for, please explain further.
EDIT:
OK, my apologies for not understanding the original question.  I would say that using the control's properties is the best way to go.  Set the SelectedRow / SelectedItem property to the item you want.
Changing the current position of the binding source could affect the values of other controls, for example the detail controls I mentioned originally.

A: Unbelievable that the BindingSource still has no way to have a No Selection.


text:
Q: Node app crashes on Heroku (Express-cors related); app runs fine locally I have deployed my first Node app to Heroku. It runs fine with foreman start but crashes on Heroku.
The procfile is there and valid: foreman check valid procfile detected (web) content web: node app.js
According to the heroku logs there is a problem with the Express-cors module.
2015-05-25T09:29:32.530535+00:00 heroku[web.1]: Starting process with command `node app.js`
2015-05-25T09:29:33.912050+00:00 app[web.1]: Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)
2015-05-25T09:29:33.912079+00:00 app[web.1]: Recommending WEB_CONCURRENCY=1
2015-05-25T09:29:34.264204+00:00 app[web.1]: module.js:338
2015-05-25T09:29:34.264210+00:00 app[web.1]:     throw err;
2015-05-25T09:29:34.264212+00:00 app[web.1]:           ^
2015-05-25T09:29:34.264214+00:00 app[web.1]: Error: Cannot find module 'express-cors'
2015-05-25T09:29:34.264216+00:00 app[web.1]:     at Function.Module._resolveFilename (module.js:336:15)
2015-05-25T09:29:34.264217+00:00 app[web.1]:     at Function.Module._load (module.js:278:25)
2015-05-25T09:29:34.264218+00:00 app[web.1]:     at Module.require (module.js:365:17)
2015-05-25T09:29:34.264220+00:00 app[web.1]:     at require (module.js:384:17)
2015-05-25T09:29:34.264222+00:00 app[web.1]:     at Object.<anonymous> (/app/app.js:2:12)
2015-05-25T09:29:34.264223+00:00 app[web.1]:     at Module._compile (module.js:460:26)
2015-05-25T09:29:34.264224+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:478:10)
2015-05-25T09:29:34.264226+00:00 app[web.1]:     at Module.load (module.js:355:32)
2015-05-25T09:29:34.264228+00:00 app[web.1]:     at Function.Module._load (module.js:310:12)
2015-05-25T09:29:34.264229+00:00 app[web.1]:     at Function.Module.runMain (module.js:501:10)
2015-05-25T09:29:35.085157+00:00 heroku[web.1]: State changed from starting to crashed
2015-05-25T09:29:35.086239+00:00 heroku[web.1]: State changed from crashed to starting
2015-05-25T09:29:35.069352+00:00 heroku[web.1]: Process exited with status 1
2015-05-25T09:29:37.209488+00:00 heroku[web.1]: Starting process with command `node app.js`
2015-05-25T09:29:38.965715+00:00 app[web.1]: Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)
2015-05-25T09:29:38.965737+00:00 app[web.1]: Recommending WEB_CONCURRENCY=1
2015-05-25T09:29:39.288408+00:00 app[web.1]: module.js:338
2015-05-25T09:29:39.288412+00:00 app[web.1]:     throw err;
2015-05-25T09:29:39.288416+00:00 app[web.1]:           ^
2015-05-25T09:29:39.288418+00:00 app[web.1]: Error: Cannot find module 'express-cors'
2015-05-25T09:29:39.288421+00:00 app[web.1]:     at Function.Module._load (module.js:278:25)
2015-05-25T09:29:39.288420+00:00 app[web.1]:     at Function.Module._resolveFilename (module.js:336:15)
2015-05-25T09:29:39.288422+00:00 app[web.1]:     at Module.require (module.js:365:17)
2015-05-25T09:29:39.288425+00:00 app[web.1]:     at Object.<anonymous> (/app/app.js:2:12)
2015-05-25T09:29:39.288424+00:00 app[web.1]:     at require (module.js:384:17)
2015-05-25T09:29:39.288426+00:00 app[web.1]:     at Module._compile (module.js:460:26)
2015-05-25T09:29:39.288428+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:478:10)
2015-05-25T09:29:39.288429+00:00 app[web.1]:     at Module.load (module.js:355:32)
2015-05-25T09:29:39.288432+00:00 app[web.1]:     at Function.Module.runMain (module.js:501:10)
2015-05-25T09:29:39.288431+00:00 app[web.1]:     at Function.Module._load (module.js:310:12)
    2015-05-25T09:29:39.982048+00:00 heroku[web.1]: State changed from starting to crashed
    2015-05-25T09:29:39.971753+00:00 heroku[web.1]: Process exited with status 1
2015-05-25T09:29:41.341772+00:00 heroku[api]: Scale to web=1 by email@gmail.com
2015-05-25T09:29:48.007388+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=immense-spire-2945.herokuapp.com request_id=576a02a2-447d-48aa-ab21-63aa576027c1 fwd="213.113.58.143" dyno= connect= service= status=503 bytes=
2015-05-25T09:29:49.472658+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=immense-spire-2945.herokuapp.com request_id=c18744e7-f029-4035-a0ef-cdf6b0d25305 fwd="213.113.58.143" dyno= connect= service= status=503 bytes=
2015-05-25T09:29:52.332338+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=immense-spire-2945.herokuapp.com request_id=8f5750d3-bb54-43d2-a86d-c1176af43277 fwd="213.113.58.143" dyno= connect= service= status=503 bytes=
2015-05-25T09:29:56.998627+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=immense-spire-2945.herokuapp.com request_id=296fa816-f2f3-458f-8c85-95bc7a53057b fwd="213.113.58.143" dyno= connect= service= status=503 bytes=
2015-05-25T09:33:19.006725+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=immense-spire-2945.herokuapp.com request_id=f99e20dd-f73a-4ccd-b746-0bd8ec021d27 fwd="213.113.58.143" dyno= connect= service= status=503 bytes=
2015-05-25T09:33:21.467535+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=immense-spire-2945.herokuapp.com request_id=2937160d-6635-4d73-8d25-a3ee0c73e472 fwd="213.113.58.143" dyno= connect= service= status=503 bytes=

How do I fix this?
Edit: Heroku support was very helpful.
If you have this issue, firstly you should check that your package.json file contains all of the needed dependencies.
Secondly, you should add the following to your app.js file:
app.set('port', (process.env.PORT || 5000));

app.listen(app.get('port'), function() {
  console.log('Node app is running on port', app.get('port'));
});

Otherwise the app will be attempting http://127.0.0.1:3000/ instead.


text:
Q: How to delete records from a SQL Server database I have 3 tables:
Files (primary key = FileID)
Accounts (primary key = AccountID)
AccFiles (2 fields: FileID and AccountID)

The AccFiles table links the primary keys of the Files table to the Accounts table.
In my scenario, if there is an Account record there will also be 1 corresponding File in the Files table and a reference to both in the AccFiles table. I guess this is a 1 to 1 relationship. Unfortunately due to a bug some files got deleted but their Account and the record in the AccFiles table didn't. I need to write a SQL script that will delete records from the Accounts table and AccFiles table where there is no longer a corresponding File (as referenced by the Accfiles FileID).
I'm using SQL Server and have no idea how to go about doing this. Can anyone help?

A: This will delete all records from AccFiles whose FileId field does not exist in the File table then delete all records from Accounts whose AccountId field does not exist in the AccFiles table:
DELETE AccFiles
WHERE FileID
NOT IN
(
  SELECT FileID
  FROM Files
);

DELETE Accounts
WHERE AccountId
NOT IN
(
  SELECT AccountId
  FROM AccFiles
);


text:
Q: How to return an output table from three separate tables that has one row from each input table in MySQl Workbench? The question asked is as following:
Write a query that shows a student's transcript. The query should output columns:

*

*Student's Name

*Course Title

*Numerical Grade

For extra credit list the grade as a letter instead of a number.
The 3 relevant tables are:
registration
which contains the columns
Section_ID / Student_ID / Grade(this is numerical using the 4 point GPA system with no decimals)
student
which contains the columns
ID  / Name / Email
course
which contains the columns
ID / Title / Description /  Units
The best I could come up with was:
select name, Grade, Title
from SELECT * FROM
(
    student
    join registration
    on registration.Student_ID = student.ID
    join course on course.ID = registration.Section_ID
) as transcript group by student ;

This gave me 1064 syntax error, and I'm not sure why. Trying a nested select statement with just 2 of the tables in question worked, don't know why the select from the triple join is rejected.
As for the extra credit portion, I'm not sure what to do besides running an update table statement on the grades column and setting 1,2,3,4 to D, C, B, A.

A: Your select statement has some syntax issue. The query should be as below. You need to use JOIN properly to establish relation between two tables using Relational Key column.
SELECT name, Grade, Title
FROM Student A
INNER JOIN registration B B.Student_ID = A.ID
INNER JOIN Course C C.ID = B.Section_ID

To get Results per student, Please apply a filter end of the script as-
WHERE A.ID = N --Put Student ID Here.


text:
Q: Swift - Close row when clicking on an action I am creating different actions when the table is in edit mode.
When the user swipes left on a cell to open the options, if the status of the cell is active, it will show the Disable button, instead will show the Enable button.
All fine.
The problem is that I want to close the cell when the user clicks on Enable or Disable buttons.
The only way to close the cell now is to click on the cell itself, instead I want to trigger this action also when the user clicks on Enable or Disable buttons, since I am not deleting the row entirely but just changing options internally.
I am trying to achieve this in this way:
tableView.reloadRowsAtIndexPaths([indexPath.row], withRowAnimation: UITableViewRowAnimation.None)

But for some reasons that piece of code is crashing my app.
Any help?
Thanks
override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject]? {

    let builderModuleStatus = builderModules[indexPath.row].status

    let disableAction = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Disable", handler:{(action, indexpath) -> Void in

        self.builderModules[indexPath.row].status = "disabled"
        tableView.reloadRowsAtIndexPaths([indexPath.row], withRowAnimation: UITableViewRowAnimation.None)
    });

    let enableAction = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Enable", handler:{ (action, indexpath) -> Void in

        self.builderModules[indexPath.row].status = "active"
    });
    enableAction.backgroundColor = UIColor(red: 0.298, green: 0.851, blue: 0.3922, alpha: 1.0);

    if(builderModuleStatus == "active"){
        return [disableAction]
    }else{
        return [enableAction]
    }
}

A: To do that just add this line on your action handlers :
tabelView.setEditing(false, animated: true)


text:
Q: Release toggle effect when clicking on another link I currently have JavaScript that causes a link to change background color when clicked:
$(".button").click(function(){
    $(this).css('background-color', '#555');
});

And it works, but I would like that color to toggle off when I click on another link.

A: You can do like this
$(function() {
  $(".button").click(function() {
    $(this).css('background-color', '#555');
    $(".button").not($(this)).css('background-color', '');

  });
});

JSFIDDLE

A: You could toggle on/off a class.
.toggled {
     background-color: #555;
}

//In JavaScript
$(function() {
    var allButtons = $(".button");
    allButtons.click(function() {
        allButtons.removeClass("toggled");
        $(this).addClass("toggled");
    });
});

A: You need to set background to clicked .button and remove background of another element. You can use .siblings() to selecting sibling element of clicked .button.

$(".button").click(function() {
    $(this).css("background-color", "#555").siblings().css("background-color", "");
});

Button1
Button2
Button3


text:
Q: Add n-textfields with same fieldName with iText i want to use iText to add textfields sharing the same fieldName to a document. The purpose is to be able to set one value and the value should appear on all pages (auto-fill).
My problem is, that with the following code only the first TextField appears in Adobe Reader. After researching it looks like i have to use "one dictionary entry" and multiple visual representations "widgets", but i have no clue how to implement that with iText.
Any suggestions?
thanks
Siegfried
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.PageSize;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfStamper;
import com.itextpdf.text.pdf.PdfWriter;
import com.itextpdf.text.pdf.TextField;

public class ITextAddTextfieldDemo {
    private static final String ORIGINAL = "original.pdf";
    private static final String RESULT = "original_textfield.pdf";

    public static void main(String[] args) throws IOException,
            DocumentException {
        ITextAddTextfieldDemo.createPdf(ORIGINAL, 5);
        ITextAddTextfieldDemo.stamp(ORIGINAL, RESULT);

        System.out.println("done");
    }

    public static void stamp(String src, String dest) throws IOException,
            DocumentException {
        PdfReader reader = new PdfReader(new File(src).getAbsolutePath());
        PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest));

        int pages = reader.getNumberOfPages();

        // test problem by switching true/false
        boolean uniqueName = false;
        String fieldName = "demoField";

        if (uniqueName) {
            TextField textField = new TextField(stamper.getWriter(),
                    new Rectangle(560, 600, 590, 800), fieldName);
            textField.setText(""); // add text to see misrendered output
            textField.setOptions(TextField.MULTILINE | TextField.DO_NOT_SCROLL);
            textField.setRotation(90);

            for (int page = 1; page <= pages; page++) {
                stamper.addAnnotation(textField.getTextField(), page);
            }
        } else {
            TextField[] textFields = new TextField[pages];
            for (int page = 1; page <= pages; page++) {
                int idx = page - 1;
                fieldName += "_" + String.valueOf(page);

                textFields[idx] = new TextField(stamper.getWriter(),
                        new Rectangle(560, 600, 590, 800), fieldName);
                textFields[idx].setText(""); // add text to see misrendered output
                textFields[idx].setOptions(TextField.MULTILINE
                        | TextField.DO_NOT_SCROLL);
                textFields[idx].setRotation(90);

                stamper.addAnnotation(textFields[idx].getTextField(), page);
            }
        }

        stamper.close();
        reader.close();
    }

    public static void createPdf(String filename, int pages)
            throws IOException, DocumentException {
        Document document = new Document(PageSize.A4);
        PdfWriter.getInstance(document, new FileOutputStream(filename));
        document.open();

        for (int i = 0; i < pages; i++) {
            Paragraph p = new Paragraph("Hello page " + String.valueOf(i + 1));
            document.add(p);
            document.newPage();
        }

        document.close();
    }

}

@EDIT: I found a solution but i still have a question. Is this the suggested way and why do i have to stamp the parent on each page? (Stamping it only on the first page doesn't work).
if (uniqueName) {
    PdfFormField parent = PdfFormField.createTextField(
            stamper.getWriter(), true, false, 0);
    parent.setFieldName(fieldName);
    parent.setUserName("Please enter the common demo data.");

    for (int page = 1; page <= pages; page++) {
        TextField textField = new TextField(stamper.getWriter(),
                new Rectangle(560, 600, 590, 800), null);
        textField.setOptions(TextField.MULTILINE
                | TextField.DO_NOT_SCROLL);
        textField.setRotation(90);
        PdfFormField pff = textField.getTextField();
        parent.addKid(pff);

        stamper.addAnnotation(pff, page);
        // why is it necessary to add it on every page?
        stamper.addAnnotation(parent, page);
    }

} else {

A: You don't have to add the parent to each page.  You can set the page for each widget using PdfAnnotation.setPlaceInPage(pagenumber) and add the parent once.  I have adjusted the solution you added to your question:
    if (uniqueName) {
        PdfFormField parent = PdfFormField.createTextField(
                stamper.getWriter(), true, false, 0);
        parent.setFieldName(fieldName);
        parent.setUserName("Please enter the common demo data.");

        for (int page = 1; page <= pages; page++) {
            TextField textField = new TextField(stamper.getWriter(),
                    new Rectangle(560, 600, 590, 800), null);
            textField.setOptions(TextField.MULTILINE
                    | TextField.DO_NOT_SCROLL);
            textField.setRotation(90);
            PdfFormField pff = textField.getTextField();
            parent.addKid(pff);
            // add widget to each page
            pff.setPlaceInPage(page);
        }
        // add parent
        stamper.addAnnotation(parent, 1);
    } else {