Guitar rig: the switch from beginner to intermediate

Question: A couple of years ago, I brought a cheap Yamaha electric guitar (a pacifica 112j). The guitar is a pretty solid beginner level budget guitar, and was a very good start. Unfortunately, I had to run it through a cheap multi-effects processor and listen to it through my laptop's output speakers. This was good enough for me when I first started playing, but as I'm getting better, I'm finding that my rig is very lacking in both tone and output sound quality.
I'm not looking for anything high-end, but want something that sounds moderately good. I was thinking I could upgrade my guitar's hardware (pickups, bridge, tuners, etc.) and then getting a better multi-effects board (probably a Line 6 POD model). My biggest problem is with the output: Do I get a guitar amp, or can I settle with a high-end set of computer speakers (such as the logitech Z623)? I'm mostly a hobby player, so I don't want anything too loud, but still want something that can give me a high-quality sound.
I guess my question is what's the best way to set up a budget-priced, bedroom guitar rig? Amplifiers? Cabinets? A set of computer speakers? Do I need a specific set of audio cards for my laptop, or should I stick to running my guitar away from a personal computer?
Comment: Even if you are not in a band, go for a 15(-ish) tube amp. Your sound quality will be improven drasitally. Also, why not buy a new guitar? It's always nice to have a backup guitar :).
Answer: I suggest you play your guitar through a real amp/effects setup as-is before deciding to start changing the guitar itself... you may find the guitar is still fine and you just need a multi-FX unit and a cheap practice amp. Can you take it into a local store and try things out, or do you have friends with better kit, you can take your guitar round their houses?
Answer: I'd ask myself… do I ever want to turn this into a recording setup, or am I only wanting to play 'live'?
If you want to record, then invest in good speakers for the compy & maybe look at [if you're keen on Line 6 & there's no reason not to be] a UX1 or UX2 audio interface, which contains all the 'Pod' effects, both 'in the box' & also as VST plugins for your recording setup, plus is a USB audio interface, 2 in, 2 out, + headphones.
If you want to play 'live' either on your own or eventually with a band etc, then I'd look at a dedicated guitar amp - which is a whole subject in itself.
To clarify…
'Better speakers' could be anything from the Logitech Z623 you mentioned, right up to something like the Dynaudio BM6A that I use at home, or onwards & upwards til your bank manager weeps...
&
'a live amp' could be anything from a tiny 10W practise amp to a Marshall stack;)
Answer: Guitar amps are "the right tool for the job" because if you buy anything else, you're simulating a guitar amp anyway. Trouble is they can be pricy for a nice one, with good effects etc (if that's what you're after). Practicae amps are portable though, and some go quite loud so thye're handy if you want to move about or jam with anyone else.
If you're really not looking to play outside of said room, then a nice stereo setup might be a good idea, with an effect box to tame your guitar's output and turn it into something your speakers can handle. Guitars played through home stereo / pc speakers can ruin the speakers because of the the attack & dynamic range. You'd need somethign to tame the output a bit like a Compressor or Amp Simulator. The line6 device you mention would probably do the trick.
One added bonus of a stereo setup is that things like stereo chorus, phaser, reverb or ping-pong echo give the sound a huge depth which you may not (probably won't) get from a mono guitar amp. If you're paying quietly, such things can give the sound some oomph without it being louder - just sounds "bigger".
To me it seems inevitable that you'll eventually want to move on from something like PC speakers as you progress with your guitar playing, so if you do want to upgrade later, the speakers are just speakers (could be used elsewhere) and the line6 is good kit so would probably be useful with other amp setups in the future.
Answer: It depends on what you want to accomplish:
There are basically two routes to go and a hybrid:
PC with Software
You use a VST host and do all the aplifiery bits (the tone shaping, distortion etc.) inside the computer in software.
Software wise you will need a VST host application of your choice (really, any will do), and effects, amplifier modelers and guitar cabinet modeler plugins.
There is both great free and commercial software for this out there: A good starting point would be the excellent free "le poulin" plugins together with effects plugins you may find googling for free "VST effects". Search the interwebs for "cabinet impulse files", which are basically models of guitar cabinets and can be used by most cabinet modeling software (I recommend Le poulin's "Lecab").
In your VST host the signal chain then goes something like this: Input -> Effects -> Amp -> Effects -> Cab simulator -> Effects -> Output
Of course you are free to put any or none effects wherever you want (Reverb generally goes after cab simulator, while distortion goes before amp etc.).
If you want to foray into commercial software, there are three major contenders I know of: Amplitube (which also offers some of it's plugins free), Guitar Rig and Revalver. These come packaged with everything you need effects, amp and modeler wise. At least some of them can also be used in a standalone fashion (you just run the program, no VST plugin host needed).
Hardware wise you can run directly into your sound card, but you will have high latency issues and bad sound quality. You can get yourself a USB audio interface (essentially an external sound card) to alleviate this. They set you back about 130€ if you want a decent one (a cheap one might do the job, too).
Pros:

You can play with headphones or computer speakers and it will sound
good at any volume.
Unlimited flexibility Layout wise. You can use each plugin multiple times without having to buy it again. You can do stuff like reverb after cabinet simulator where you would have to mic a cabined and record it to do in hardware.
Some of the free stuff is professional studio grade. Sound quality is way above practice amps.
Cheap.
You can easily record yourself, practice over it, write yourself some drum loops to play along etc. The sky is the limit. Perfect for improvising.
You are not locked into a limited number of sounds.

Cons:

Can't gig with it.
Suffers from feature overload. You tend to tinker more and play less.
Might be complicated if you are bad with computers.
Lacks the mojo.
Can't gig with it (well, you can, but I wouldn't. It's easier to just buy an amp).

The cheapo practice amp
You get yourself a little practice amp, like a roland cube, Line6, blackstar ID, etc. You can get additional pedals or multieffects units, though most such amps offer some built in effects. Not much to say here. Most of these also have headphone outs.
Pros:

Portable.
Easy to use.
Can gig or just go to a friend and play together.

Cons:

Takes more space.
Might not sound as good as software.
If you want additional good effects, you have to buy them.

The hybrid approach
Get yourself a little practice amp that has a USB audio out. Make sure that it has a "dry" output (that is, the unaltered guitar signal, basically acting as the audio interface). Now you can use both approaches with one device! Most of the newer practice amps have a USB output, I myself have a Yamaha THR-10, which does the job, but I have to confess that nowadays I only use it as an audio interface and never on it's own, as I have other physical amps when not at my PC.

It depends on what you are looking for, at least for my uses (which include recording and jamming with myself) the software setup is superior.
PS: If you use your PC's sound card to connect a guitar, get yourself the free ASIO4All driver. It's a low latency driver so the VST program can directly access your sound card. If you just use the regular driver, there is a noticeable delay between hitting a string and sound coming out of the speaker.
Comment: You definitely can gig with it. My iPad is my entire rig when I play - pedals and amp. And I know there are 'proper' performers who do this too for the convenience when travelling. With something like a MS Surface Pro you can have an entire powerful PC in a tablet form factor!
Comment: Yes, you can gig with it, but you will have to bring your own poweramp with speaker or completely depend on the venue having decent sound and monitoring. We are talking about a beginner here, so it's reasonable to assume that a possible venue (let's say a small bar) might not even have a sound system at all.

There are also more points of failure, from recieving a skype message during a gig to the operating system crashing.
Comment: Fair point. However if you're providing your own PA you're going to need regular speakers anyway for the vocalist and maybe an acoustic guitar. So you can still just mix your modelled output into your own mini-mixer - one benefit is you can control the guitarist's volume :)
Answer: I'm new to this forum but have been playing for over 20 years. It's true that regular tube amps are great (I love them) but I also use Line6 amp-sim technology as well because it's incredibly convenient.
If you're a hobby player (never want to play in a band?) the Line6 stuff is great. You can simulate any amp out there; some sound better than others. For example, I can get a perfect "The Seeker" (Who) sound with my Line6 POD, but the metal sounds aren't as perfect. The presets are good and I rarely spend much time tweaking them (I do with the metal sounds however).
I've played gigs with it too; it works great but I'd use a POD pedalboard with an actual amp for the best of both worlds. Tons of possible amp sounds sent through a regular power amp to smooth it out.
If you're just into home playing and recording it's perfect (for most things). Just starting out? It will be a great thing to build on. You could probably do with a cheaper Line6 amp and drive it with a POD pedalboard. Running it through a good set of speakers is an option, but it's nice to just turn on the amp and start wailing.


Swift / how to get core data entries by valueForKey

Question: I have the following code to return multiple dates as NSDate
    func setUpDays() {

        var datesArray = [String]()
        datesArray.append("28.03.2016")
        datesArray.append("26.03.2016")
        datesArray.append("27.03.2016")

        for i in 0...datesArray.count-1 {

            let dates2Convert = datesArray[i]

            let dateFormatter = NSDateFormatter()
            dateFormatter.dateFormat = "dd.MM.yyyy"
            let day = dateFormatter.dateFromString(dates2Convert)

            print(day)
        }
    }

That is working perfectly. Now I want to get those dates from core data instead of the datesArray
var dates = [NSManagedObject]()

    func setUpDays() {

        for i in 0...2 {

            let currentDates = dates[i]
            let date2Convert = currentDates.valueForKey("date") as? String

            let dateFormatter = NSDateFormatter()
            dateFormatter.dateFormat = "dd.MM.yyyy"
            let day = dateFormatter.dateFromString(date2Convert)

            print(day)
        }
    }

But let currentDates = dates[i] code is throwing the following exception:

The dates are correctly saves in the core data. If I'll print em out, they're correct. What am I missing? Help is very appreciated.
As requested: This is how core data is filled with a date string.
func parser(parser: NSXMLParser, foundCharacters string: String) {

let str = string.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet())

if parsedElement == "eventDates" && str != "" {
    if currentEvent.eventDates.isEmpty {

        currentEvent.eventDates = str
        parsedElement = ""

        let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
        let managedContext = appDelegate.managedObjectContext
        let entity =  NSEntityDescription.entityForName("Calendar", inManagedObjectContext:managedContext)
        let datum = NSManagedObject(entity: entity!, insertIntoManagedObjectContext: managedContext)
        datum.setValue(currentEvent.eventDates, forKey: "date")

        do {
            try managedContext.save()
            //5

            dates.append(datum)
        } catch let error as NSError  {
            print("Could not save \(error), \(error.userInfo)")
        }
    }
}
}

Comment: ps. console says: `fatal error: Array index out of range`
Comment: Well...`dates` seems nil or empty I guess :-) Can you show where/how you declare the `dates` array?
Comment: what is `currentDates` ?  sound like an array, because you have named it in plural.  If it's meant to be a single instance, it should be `currentDate`  When you inspect `dates[]` is it an array of String, or an array of CoreData objects?
Comment: `dates = [NSManagedObject]()`
Comment: I have updated my question
Comment: @pbodsk dates should not nil. I use dates.count as return of how many table rows are visible and the count is correct. as least If I don't use this function. If I use it, the app crashes, before the view is loaded.
Comment: How many objects are there in `dates` when you start your loop?  (`for i in 0...2` assumes three.)
Comment: @Russell yes I guess it shoult be singular, since in that for loop, it's an single element
Comment: @PhillipMills 3 string elements are saved inside the core data (dates)
Comment: But are there three in the array when the loop is entered?
Comment: @PhillipMills actually there are 4 date string in the core data
Comment: but 0...3 crashes, too
Comment: OK, the problem then is - as @PhillipMills says - that you try to reference an element in your `dates` array that isn't there (at least not when you try to fetch it). What happens if you place a breakpoint at the `let currentDates = dates[i]` line and then inspect what the value of `dates` is...I'm guessing it is empty
Comment: well I can't see the elements of `dates`, there is simply nothing shown for `dates`at the breakpoint inspector. But if I print(dates.count), it's empty... so I guess you're right. so.. what's my option?
Comment: ugh...I was hoping you didn't ask me that ;-) OK, I guess it'd be interesting to see how you load the `dates` array. In the above code you just create an empty dates array `var dates = [NSManagedObject]()`, but do you try to populate it somewhere? (apart from `parser(parser: NSXMLParser, foundCharacters string: String)` which I'm guessing isn't called before you call `setupDates()`)
Comment: @pbodsk I'm just populating the `dates` array at the parser function which is located at literally the last function in the whole viewcontroller code as an extension.
Comment: OK, and when do you call `setupDates()`? Before you parse XML I guess, since the `dates` array is empty.
Comment: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/106608/discussion-between-pbodsk-and-david-seek).
Answer: As can be seen in the lengthy chat, the problem was that dates was initialized and attempted accessed in viewDidLoad(). However, it wasn't populated yet, as that happened in the XML parse method.
To make it more crash safe this loop
for i in 0...2 {
   let currentDates = dates[i]
   let date2Convert = currentDates.valueForKey("date") as? String

   let dateFormatter = NSDateFormatter()
   dateFormatter.dateFormat = "dd.MM.yyyy"
   let day = dateFormatter.dateFromString(date2Convert)

   print(day)
}

was replaced with this loop
dates.forEach { currentDate in
   let date2Convert = currentDate.valueForKey("date") as? String

   let dateFormatter = NSDateFormatter()
   dateFormatter.dateFormat = "dd.MM.yyyy"
   let day = dateFormatter.dateFromString(date2Convert)

   print(day)
}

And then the setupDates() method was called after parsing was ended.
Comment: thank you again for your amazing help and high effort!
Comment: You're welcome, just glad to be able to help someone when they're stuck


Parse push notification android device token not saved in some cases

Question: I am using parse as my app back-end service provider. My app has really important feature of Push notification.
Parse is not saving the device token in some cases. Mostly when user is installing the app from America/Los_Angeles region.

Is this Parse.com sdk integration problem or Google is not sending device token in some region? How can i fix this issue?
Comment: I think it's very common problem , you need to retry for getting notification token from GCM server until you success
Comment: its not because of location sir, check your last item in the list, im not quite familiar with parse, but i think you need to post some usefull codes, because i think the other end is quite fine
Answer: I've just ran a quick check on our Parse backend and found that there are also missing device tokens in our database, too.
I think you should not send push notifications based on device token, but based on user on that device.
To do that, first add a new field in Installations table called user. If your app requires explicit login from user, then when user logs in, update the installation with that user's ID. If it is implicit (registers upon installation so App is ready to go as soon as user opens the app), then just associate that user in the same manner on app install.
In the end, you are most likely to want to send your notifications to your user rather than a specific device. This also makes data transferring a lot easier.
Answer: This issue was sometimes observed due to failure to get the token from Google. You should check the device token availability, if you don't get it, you should try it again after some time from your app.
Comment: This should be a comment.


django - Natural key serialization of User

Question: Suppose I have a model of a comment in my project:
class Comment(models.Model):
    text = models.TextField(max_length=500, blank=False)
    author = models.ForeignKey(User)

When serialized to JSON using django.core.serializers the author field comes out as:
"author": 1 // use_natural_keys = False
"author": ["someuser"] // use_natural_keys = True

Suppose I want to output the user's first and last name as well? How would I go about that?
Answer: I assume you're serializing your model in order to transmit it on wire (like in a http response).
django.core.serializers is likely not the way you want to go. A quick approach would be to include a method on the model to return the dictionary you want to be serialized, then use simplejson.dumps to serialize it. E.g.:
def to_json(self):
    return dict(
        author=[self.author.natural_key(), self.author.first_name, self.author.last_name],
        text=self.text,
    )

then just call simplejson.dumps(comment.to_json()).


How do I fix my code for insert into SQL Server with Python 3.7

Question: I try to insert data into a SQL Server table with Python37 (pymssql), but I get an error as shown below. Do you have any suggestion?
These are the values to be inserted into the table
values = ['test','test', 'test', 'test', 'test', 'test','test','test','test','test','test','test','test','test']

SQL string in python code
insSQL = '''INSERT INTO [dbo].[S_LAZ_GET_ORDERS](ORDER_ID,
                                                   ORDER_NUMBER,
                                                   BILL_ADDRESS1,
                                                   BILL_ADDRESS2,
                                                   BILL_ADDRESS3,
                                                   BILL_ADDRESS4,
                                                   BILL_ADDRESS5,
                                                   BILL_CITY,
                                                   BILL_COUNTRY,
                                                   BILL_FIRST_NAME,
                                                   BILL_LAST_NAME,
                                                   BILL_PHONE,
                                                   BILL_PHONE2,
                                                   BILL_POST_CODE)
              VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)'''

  cur.executemany(insSQL, values)
  cur.commit()

This is the error I get:

Traceback (most recent call last):
File "src_mssql.pyx", line 1930, in _mssql._substitute_params
IndexError: tuple index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Python Project\Lazada API\getOrder.py", line 125, in  getorders()
File "D:\Python Project\Lazada API\getOrder.py", line 109, in getorders
cur.executemany(insSQL, values)
File "src\pymssql.pyx", line 476, in pymssql.Cursor.executemany
File "src\pymssql.pyx", line 450, in pymssql.Cursor.execute
File "src_mssql.pyx", line 1070, in _mssql.MSSQLConnection.execute_query
File "src_mssql.pyx", line 1101, in _mssql.MSSQLConnection.execute_query
File "src_mssql.pyx", line 1218, in _mssql.MSSQLConnection.format_and_run_query
File "src_mssql.pyx", line 1240, in _mssql.MSSQLConnection.format_sql_command
File "src_mssql.pyx", line 1932, in _mssql._substitute_params
ValueError: more placeholders in SQL than params available
Answer: The list values should be a sequence of parameters (each element inside values is a single row to be inserted). So if you want to insert one row into your table where each cell in the row has the value 'test' then simply put one 14-element tuple inside values as follows:
values = [('test','test', 'test', 'test', 'test', 'test','test','test','test','test','test','test','test','test')]

If you want to add more rows, simply add more tuples to values.


Recursion Program

Question: I am stuck up in this code:

Problem: A child can hop a staircase of steps n in 1,2 or 3 steps at one time. Given a value of n, print all the permutations of the order in which he can climb the staircase.

This is my code:
    public class HoppingLad
    {
        int count;
        void hop(int n,int present)
        {
            if(n==present)
            {
                count++;
                System.out.println("\nFinished type "+count+" climbing.\n");
            }
            else
            {
                if((n-present)>=1)
                {
                    System.out.print("\nClimbed 1 step.\nReached "+(present+1)+"   ");
                    hop(n,present+1);
                }
                if((n-present)>=2)
                {
                    System.out.print("\nClimbed 2 step. \nReached "+(present+2)+"   ");
                    hop(n,present+2);
                }
                if((n-present)>=3)
                {
                    System.out.print("\nClimbed 3 step. \nReached "+(present+3)+"   ");
                    hop(n,present+3);
                }

            }

        }

        public static void main(String [] args)
        {
            HoppingLad hl=new HoppingLad();
            hl.hop(3, 0);
            System.out.println("There are "+hl.count+" ways to climb.");
        }
    }

The output is :
 Climbed 1 step.
 Reached 1
 Climbed 1 step.
 Reached 2
 Climbed 1 step.
 Reached 3
 Finished type 1 climbing.

 Climbed 2 step.
 Reached 3
 Finished type 2 climbing.

 Climbed 2 step.
 Reached 2
 Climbed 1 step.
 Reached 3
 Finished type 3 climbing.

 Climbed 3 step.
 Reached 3
 Finished type 4 climbing.

 There are 4 ways to climb.

The output I get is partly correct, partly incomplete. The number of ways to climb the staircase is correct but as you notice,

Climbed 2
  Reached 3

part of the output is coming as it is without

Climbed 1
  Reached 1

part coming before it. I have drawn the recursion tree and the tree even suggests that the first part is not there in the output.
However, the user has to be instructed from the ground level. I have tried many things, to no avail. Can anyone fix this out for me please?
Comment: Actually it isn't a homework, i have taken it up independently.. Still for reference, i have done it. :)
Comment: If this is a homework question then please add the homework tag.
Comment: Sorry, I miss read the question
Answer: You are printing the solution as partial results, so they are not repeated when you get a new solution based in that partial solution.
In other words, you do (for n= 3)
        --> state 0
hop(1)  --> state 1 --> print "1"
hop(1)  --> state 2 --> print "1"
hop(1)  --> state 3 --> print "1" --> print "solution";

then you go back to state 2 (no further solutions possible) and back to state 1, and then you
hop(2) --> state 3 --> print "2" --> print "solution"

without printing the "1" that allowed you to get to the state 1
The solution would be passing the list of steps needed to get to the actual state and, when a solution is reached, print all the list. Of course, since you will use an array or List for this, you will need to delete those steps when you go back to previous states.
UPDATE: An alternative (based in the changing the output) could be tabulating the answer based in the number of steps needed. I.e., the output would be something like that (for the same solution as above):
Climbed 1
          -> Climbed 1
                       -> Climbed 1. Solution Found!
          -> Climbed 2. Solution Found!

That would allow the user to rebuild the path by itself. Then again, you need a new parameter to know the current number of steps.
If you want the array / List version but do not want to delete items, you can clone the list and pass a copy to the next function call, but that would be inefficient.
Comment: So I feel that is the only way to go right? the one with arrays?
Comment: Very Very innovative.Thanks a ton for sharing such an idea Sir.
Answer: I have implemented this solution. I will email you only if you have completed your homework.
What you can do is maintain a String and keep concating the current step taken and when the condition is reached, print the entire String, do not print individual steps. That way, you will reduce the overhead of checking at every recursive step how close you are to the solution. You will be sure the path will be printed only if the current step leads to a solution.
For example (suppose n=3)
3,0,"" -> 3,1,"1" -> 3,2,"11" -> 3,3,"111" (one solution over, print "111")
In these kind of problems (generally), where you need to make a series of steps to reach a threshold value, the most efficient solution (generally) is to store the list of steps and then print the entire solution rather than printing individual steps. That whay you know you can be sure you gets all solutions covered, and you are not printing when the current step does not lead to a solution.
Answer: Your problem -- if I've understood the question correctly -- is that when, e.g., you consider the possibilities that start with climbing from step 0 to step 1, you just print out "climbed from 0 to 1" once and then display all the possibilities starting from step 1. (Of which, in general, there will be lots.)
Instead, you need to arrange that as you go through the recursion you keep track of the complete route, and then when you reach the top of the staircase you print out the whole route.
You could do this, for instance, by giving the HoppingLad class an array that, at the start of an invocation of hop(n,k), describes how the lad got to step k. Then, in the n==present case, you can look through that array to output a complete description of how the lad got from 0 to n.
There are a few different ways to organize this, and the problem looks rather homework-y so I'd rather not fill in too many details. I hope the above is helpful despite this.
Comment: you have interpreted it perfectly. Actually I am known to that solution with an array. i was wondering if there exists a work-around which might be just perfect to solve this one rather than me maintaining an array with some pain?
Comment: I doubt you'll find anything that's appreciably simpler than that. You could keep track of a string rather than an array, or something. It wouldn't really be any easier.
Comment: For the avoidance of doubt, when I say "array" I mean any data structure that behaves kinda like an array. It doesn't need to be literally an array; it could be a LinkedList or a Vector or ArrayList or whatever.
Comment: Just because it's homework-y doesn't mean we should answer it. Homework is meant to expand horizons, you cant expand if you can't see. That's why there are solutions in back of book. If they don't take time to understand solution that's on them.
Answer: So here is my solution, it uses javascript though, it uses ES6 (for spread operating on array, default parameters, this will run fine in current versions of Firefox, I did this in Firefox 50):
function getHopPathsCnt(totalsteps, maxhopability, curstep = 0, taken = [], total={count:0}) {
  if (totalsteps === curstep) {
    total.count++;
    console.log('A possible hop path:', taken.join(' '));
  } else {
    for (let hopped = 1; hopped <= maxhopability; hopped++) {
      if (totalsteps - curstep >= hopped)
        getHopPathsCnt(totalsteps, maxhopability, curstep + hopped, [...taken, hopped], total);
    }
  }
  if (curstep === 0) {
    console.error('Total ways to climb', totalsteps, 'steps with up to', maxhopability, 'hops at a time:', total.count);
    return total.count;
  }
}

To use it:
getHopPathsCnt(3, 3);

Outputs:

A possible hop path: 1 1 1
A possible hop path: 1 2
A possible hop path: 2 1
A possible hop path: 3
Total ways to climb 3 steps with up to 3 hops at a time: 4
4

Reason I provided full solution unlike Gareth above
This problem does look homework-y and for that reason I want to share it. Homework is meant to open up new horizons. So sometimes, when I don't have a solution, I keep forcing it with my "current skill/mentality", which may never get me anywhere. Eventually when I see the solution and work in reverse, it just added a new facet to my "skill/mentality". That's why I hate seeing solutions say "I won't fill in too many details because it seems homework-y". As that leads to the only method of learning being - getting the problem wrong, and then our silly grading system giving us a bad grade, and then "learn from our mistakes". I hate learning from mistakes if it can be avoided. I also rather not be classed into a caste of "Wrong"/"F" as a grade, especially if I put in effort. And its not always necessarily true that we learn from "mistakes", especially when you were just casted by our grading system as a "failure"/"got it wrong".

Recursion Program


Obtain Decimal values after Division

Question: How can i obtain the decimal value after division ?
after doing this
days = miliseconds/(24 * 60 * 60 * 1000)
suppose the value(i.e days) is 27.8351
how do i get 8351 ?
Tried
hours = days % (int) days thought it s doing 27.8351 / 27
but still it returned a big Zero, havent tried converting it into string and then splitting based on DOT (.) but i dont like this way have i over looked some thing ?
Answer: You should use BigDecimal for this kind of operations. The divideAndRemainder method is available.
Answer: There are many ways to do this.
If you know in advance the number of decimal places, then subtract the result by the whole number and multiply it 10 to power of the number of decimal places.
Example: # of dec places is 4 and the result is 42.8798
Process:
(1) 42.8798 - 42 = 0.8798
(2) 0.8798 * (10^4) = 8978
Answer: hours = (days - (int) days) * 10000

(to get 4 digits after decimal)

Obtain Decimal values after Division


Consider the matrix form $A\mathbf{x} = \mathbf{b}, \ A\in \mathbb{R}^{m\times n}$.

Question: Consider the matrix form
\begin{equation*}
A\mathbf{x} = \mathbf{b}, \quad A\in \mathbb{R}^{m\times n}
\end{equation*}
of a linear system of $m$ equations in $n$ unknowns $\mathbf{x} = (x_1,\ldots,x_n)$.
1. Show that if $\mathbf{x}_p$ and $\mathbf{x}_p'$ are solutions of this system, then
\begin{equation*}
\mathbf{x}_p-\mathbf{x}_p'\in \text{null}(A).
\end{equation*}
Suppose that $\mathbf{x}_p$ and $\mathbf{x}_p'$ are solutions to $A\mathbf{x} = \mathbf{b}$, i.e. $A\mathbf{x}_p = \mathbf{b} = A\mathbf{x}_p'$. Then $A(\mathbf{x}_p-\mathbf{x}_p') = A\mathbf{x}_p-A\mathbf{x}_p' = \mathbf{b}-\mathbf{b} = 0$, and so $\mathbf{x}_p-\mathbf{x}_p'\in \text{null}(A)$ as required.
2. Show that if $\mathbf{x}_p$ is a solution and $\mathbf{x}_b\in \text{null}(A)$, then $\mathbf{x}_p+\mathbf{x}_b$ is a solution.
Suppose that $\mathbf{x}_p$ is a solution to $A\mathbf{x} = \mathbf{b}$, i.e. $A\mathbf{x}_p = \mathbf{b}$, and if $\mathbf{x}_b\in \text{null}(A)$, then $\mathbf{x}_p+\mathbf{x}_b$ is a solution because $A(\mathbf{x}_p+\mathbf{x}_b) = A\mathbf{x}_p+A\mathbf{x}_b = A\mathbf{x}_p = \mathbf{b}$.
3. Conclude that the set of all solutions is
\begin{equation*}
\mathbf{x}_p+\text{null}(A),
\end{equation*}
provided that there is at least one solution $\mathbf{x}_p$. Give an example where there are no solutions.
I am having trouble with this question. I'm not sure if this helps but if $v$ is a solution (by part 1.), $x:= v-u\in \text{null}(A)$. But $v = (v-u)+u = x+u$.
Thanks!
Answer: Yes. Your idea in (3.) completes the problem. Here is a just a formal reorganization of it:
If $\text{Sol}_{\mathbf{A}, \mathbf{b}}$ is your solution set to $\mathbf{A}\mathbf{x} = \mathbf{b}$, then your work from (2.) shows that $\big(\mathbf{x}_p + \text{null}(A)\big) \subseteq \text{Sol}_{\mathbf{A}, \mathbf{b}}$.
Conversely if $\mathbf{s} \in \text{Sol}_{\mathbf{A}, \mathbf{b}}$ is any arbitrary solution, then your idea shows that $\mathbf{s}_0 = \mathbf{s} - \mathbf{x_p} \in \text{null}(A)$ and you can rewrite $\mathbf{s}$ as $\mathbf{s} = \mathbf{x}_p + \mathbf{s}_0 \in \big(\mathbf{x}_p + \text{null}(A)\big)$. So $\text{Sol}_{\mathbf{A}, \mathbf{b}}  \subseteq \big(\mathbf{x}_p + \text{null}(A)\big)$.
Hence $\text{Sol}_{\mathbf{A}, \mathbf{b}} = \big(\mathbf{x}_p + \text{null}(A)\big)$.
Comment: Great thank you!
Comment: @squenshl Glad to be of help.
Answer: Let $v $ be a solution of $A\mathbf{x} = \mathbf{b}$. So, $Av=\mathbf{b}=A\mathbf{x_p}$, which implies $v-\mathbf{x_p}\in\textrm{null}(A) $. Hence  $v-\mathbf{x_p}=n $ or, $v=\mathbf{x_p}+n $, where  $n\in\textrm{null}(A) $.
Answer: You have essentially finished the proof. You have proved that any solution $u$ of the form $u =v-x=u+(-x)$ where $-x \in null(A)$ (because $x \in null (A)$. Conversely any vector of this form is a solution.  For example where there is no solution take $A=0$ and $b \neq 0$.
Answer: If $v$ is a solution, then put $u=v-x_p$ and show that $v-x_p \in \text{null}(A).$ Hence
\begin{equation*}
v \in x_p+\text{null}(A).
\end{equation*}


What makes Stealing Signs wrong?

Question:
Edit: I originally asked this question in 2016. This was before the scandals of the Astros and Red Sox came to light, where the teams allegedly used devices such as cameras, smartwatches, and trash can lids. As well as coordinating efforts with non-players. My question never pertained to such methods of sign-stealing, as I believe it should be obvious why this is wrong.
The question was more about what made it unethical for a player to attempt to manually analyze and decipher an opposing team's signs, using nothing more than his IQ of the game, skill, and experience.

My question pertains mostly to baseball, but I imagine it is just as relevant in other sports as well. Every so often I hear about a disgruntled team, accusing the other team of stealing signs. I don't get it. What actually makes it wrong?
This just seems like any other aspect of the competition that is fair game. For example, if a pitcher inadvertently "tips" his pitches, and the other team is smart enough to pick up on it and use that knowledge to their advantage, then it is generally considered a flaw of the pitcher. It is now his responsibility to correct the problem, and improve his skills by becoming more deceptive and unpredictable. I wouldn't blame the opposing team for cheating; I would say they played smart baseball. I'm having a hard time understanding how "decrypting" signals is any different?
Additionally, the coach who creates the signals does so with the intention to obfuscate them as much as possible. Obviously this is to maximize competitive advantage. So does that not imply competition even within this narrow aspect of the game?
Someone help me out please. What makes stealing signs wrong that teams rightfully take exception and feel cheated?
Comment: I think "wrong" here is used in the moral sense, not in the factual sense.
Comment: @Nij factual wrongness being a necessity for complaining isn't my question. Complaining regardless of right or wrong happens all the time. Take for instance the tension between a pitcher and hitter after an admired home run and bat flip. There a a lot of polarizing subjective opinions on this without either side necessarily being incorrect. What I'm looking for in my question is something more objective. Like a rule prohibiting it, or generally established guidelines of when stealing signs is OK and what boundaries should not be crossed.
Comment: Well, nothing makes it wrong. Since when has factual wrongness been a necessity for complaining?
Answer: Stealing signs is "wrong" because Baseball's history goes back to the 1800s, when it was more of a "gentleman's game" (as compared to, say, American Football) and things like stealing signs would have been seen as beneath the managers (and players).  The idea is that the purity of the batter versus pitcher matchup should not be tarnished (on either side - pitchers should not use spitballs or pine tar to alter the ball, batters should not rely on information given to them by others).
However, in the modern day no-one would really complain about the simple versions of stealing signs - the runner at second base tipping the batter off.  They specifically use special signs to avoid that happening, and often switch them up mid-game or even mid-at bat.  What the complaints are typically, are that someone is either using technology (such as a hidden camera) or the old-school version of that, namely a person in the bleachers with a phone or similar.  That's considered cheating, since it involves people not in the game communicating information.
This is something that's fairly well covered in the media.  MLB.com published an article on the subject, Fair or Foul?  Sign-stealing is part of the game for example.  They begin:

Nowhere in baseball's rulebook will you find anything prohibiting sign-stealing, although most casual observers figure the spirit of sportsmanship and the unwritten "Code" of the big leagues should say it's a big no-no.

They go on to explain what would be considered a no-no in particular:

"A pair of binoculars staring down the gun barrel of the hitting area? You know what, I don't think any club in baseball ... would take too kindly to that," Rockies manager Jim Tracy said.

But it's pretty clear that it's not cheating, and it's not something that's unexpected in this day and age:

And if you ask the players, managers and coaches of today's game for their thoughts on the subject, most seem to agree on one thing: sign-stealing is not necessarily cheating, since it's not against the rules, but you better be aware of it and you better know when it's happening.
Comment: I absolutely agree "it's not something that's unexpected in this day and age". Baseball is basically based on cheating and stealing. :-)
Comment: Great response. +1 for the reference on the rulebook. The use of technology, binoculars, or people not on the team is a good common sense example of when it becomes unethical to steal signs.
Comment: @Rathony speaking of baseball being based on stealing, it seems that players stealing signs (reasonably) is the ethical equivalent of stealing home. When you've studied the pitcher well enough to discover a vulnerability and window of opportunity, take it.
Comment: The first part of this answer does not make sense.   Stealing signs from the outfield has been mentioned as long as baseball has had outfields.   There were several big moments from the early part of the century that were said to be the cause of stealing signs and the players used to blackmail owners after finishing their career.   Failing to see the gentleman's game thing.

What makes Stealing Signs wrong?


What is the true definition of $this in PHP?

Question: I currently am using PHP and was reading the PHP manual but still have a problem with $this.
Is $this something global or is it is just another variable name to build objects on?
Here is an example:
public function using_a_function($variable1, $variable2, $variable3)
{
    $params = array(
        'associative1' => $variable1,
        'associative2' => $variable2,
        'associative3' => $variable3
    );
    $params['associative4'] = $this->get_function1($params);
    return $this->get_function2($params);
}

How would $this work for the return function?  I guess I am confused on how this function builds.  I understand building the associate array part with a name being a valuekey names => value, but $this throws me off on this example.
Answer: $this is only used in object oriented programming (OOP) and refers to the current object.
class SomeObject{
    public function returnThis(){
        return $this;
    }
}

$object = new SomeObject();
var_dump($object === $object->returnThis()); // true

This is used inside the object to reach member variables and methods.
class SomeOtherClass{
    private $variable;
    public function publicMethod(){
        $this->variable;
        $this->privateMethod();
    }
    private function privateMethod(){
        //
    }
}

Answer: It is refered to as the Object scope, lets use an example class.
Class Example
{
    private $property;
    public function A($foo)
    {
         $this->property = $foo;
         // we are telling the method to look at the object scope not the method scope
    }
    public function B()
    {
         return self::property; // self:: is the same as $this
    }
}

We can now instance our object and use it in another way also:
$e = new Example;
$e::A('some text');
// would do the same as
$e->A('some other text');

This is just a way of accessing the scope of the Object because methods cannot access other method scopes.
You can also extend a class and use the parent:: to call the class extension scope, for example:
Class Db extends PDO
{
    public function __construct()
    {
        parent::__construct(....

Which would access the PDO construct method rather than its own construct method.
In your case, the method is calling other methods that are in the object. Which can be called using $this-> or self::


What is the difference between these ODEs? $F(t)$ vs $F(x,\dot x)$

Question: I need help how to mathematically interpret an ODE (Newton's second law). I used to the ODE in this form:
$$
m\ddot x(t)=F(t)\tag{1}
$$
However, in another book they wrote:
$$
m\ddot x=F(x,\dot x) \tag{2}
$$
where $F: \mathbb{R}^n \times \mathbb{R}^n\rightarrow \mathbb{R}^n$.
Questions:

I guess $F(x,\dot x)$ is an abbreviation for $F(x(t),\dot x(t))$, is it correct?
What it the difference between writing $F(t)$ or $F(x,\dot x)$?
What is the meaning of the notation $F: \mathbb{R}^n \times \mathbb{R}^n\rightarrow \mathbb{R}^n$?

Thanks!
Answer: F is obviously force.
The force on an object can always be considered a function of time. In some scenarios it may be independent of position or velocity.  (E.g. an object falling in a constant gravitational field experiences a constant force.)  In such a case it would be reasonable to give an ODE in the first form for you to solve.
In other scenarios the force is a function of position and velocity.  In these cases it is only indirectly a function of time (because position and velocity are functions of time).  For example, in a non constant gravitational field the force depends on position, and in the air, resistance depends on velocity.  In these scenarios the second form makes more sense.
Comment: This answer would be more directly helpful if you addressed the three numbered questions that the OP has asked.
Answer: To your first question, yes.  The dot notation $\dot{x}$ is used in ODEs and Physics to indicate differentiation with respect to time, so it can be also written as $\dot{x}(t)$ to make the time-dependence explicit.
The difference between $F(t)$ and $F(\dot{x}, \ddot{x})$ can be one of emphasis: the first emphasizes the the time dependence is the main concern, and the second emphasizes that the ODE is the main concern.  If you're interested in the level curves of $F$ though, the choice of variable will determine the curves you draw.  $F(t)$ would be a graph of $F$ against $t$, while $F(\dot{x}, \ddot{x})$ would be a vector field represenation (1-d vs 2-d in a sense).
$F:{\mathbb R}^n \times {\mathbb R}^n \rightarrow {\mathbb R}^n$ tells you the domain and range of $F$.  Here, $F$ is acting on two variables each of which takes values in ${\mathbb R}^n$ and it produces a result which is also a value in ${\mathbb R}^n$.  If you had a constraint, say, that the acceleration $\ddot{x}$ were never negative then you would change the domain to be ${\mathbb R}^n \times [0,\infty]^n \rightarrow {\mathbb R}^n$.  This can be extended to as many variables as $F$ needs in order to produce its output (e.g. if you added the third derivative of $x$ as well then F might act on ${\mathbb R}^n \times {\mathbb R}^n \times {\mathbb R}^n$.


Invalid file name error in eclipse for images

Question: I'm facing the following error:
res/drawable-hdpi/Twitter.png: Invalid file name: must contain only [a-z0-9_.]

Twitter.png looks like a valid filename to me. None of the other images having names like Facebook.png, RSS.png work.
Help please!!
Comment: "still you want to go beyond the Android standards"? He didn't know you couldn't use caps...
Comment: Its already showing that "must contain only [a-z0-9_.)" still you want  to go beyond the Android standards? if yes then its not possible.
Comment: The full error should be: "Invalid file name: must contain only lowercase letters and digits ([a-z0-9_.])".  That is what Android Studio will tell you today.
Answer: uppercase is not allowed for resource names..
only lowercase(a-z), 0-9, .(dot) and _ are valid.
Your image names should be twitter.png, facebook.png, rss.png
Comment: Worth noting that the filename cannot start with a number either. Bounced this around for about 45mins before finding this gold nugget...


Show that $(a^2+b^2)(a^4+b^4) \geq (a^3+b^3)^2$

Question: Show that $(a^2+b^2)(a^4+b^4) \geq (a^3+b^3)^2$
Can we go like this : $(a^2+b^2)=(a+b)^2-2ab \& (a^4+b^4) = (a^2+b^2)^2-2a^2b^2$  and right hand side of the inequality : $[(a+b)^3-3ab(a+b)]^2$
Comment: Typically for two variable inequalities you want to first try algebra, then see if you can use the triangle inequality, Cauchy Schwartz, AM-GM inequality, etc.

If you don't come up with anything obvious, it sometimes makes sense to try the method of Lagrange multipliers. Although, you can run into some pretty messy algebra with Lagrange multipliers. With this specific example, you can try manipulating the inequality with algebra then using the AM-GM inequality.
Comment: Apply [Cauchy-Schwarz inequality](http://en.wikipedia.org/wiki/Cauchy%E2%80%93Schwarz_inequality) to the vectors $(a,b)$ and $(a^2,b^2)$.
Answer: Multiplying out and cancelling leaves $$a^2b^4+a^4b^2\ge2a^3b^3$$ which let's write as $${a^2b^4+a^4b^2\over2}\ge a^3b^3$$ which is true by the inequality of the arithmetic and geometric means.
Answer: Are there any restrictions on $a,b$? RHS is $a^3+b^3 = (a+b)(a^2+b^2-ab)$. Clearly for all $|a|,|b|>1 \ \ a^2+b^2 >a^2+b^2 -ab$ and $ a^4+ b^4> a+b$
Answer: $(a^2+b^2)(a^4+b^4)-(a^3+b^3)^2$
$=(a^6+a^4b^2+a^2b^4+b^6)-(a^6+2a^3b^3+b^6)$
$=a^4b^2+a^2b^4-2a^3b^3$
$=a^2b^2(a^2+b^2-2ab)$
$=a^2b^2(a-b)^2$
$\geq 0$
$∴(a^2+b^2)(a^4+b^4)\geq(a^3+b^3)^2$
Q.E.D.


Mailitem closed in VBA is still locked (can't be reopened)

Question: I have some code (can't share it in full) that runs just fine for most users.
For one user on Windows 10, when the code opens a .msg file and later closes the file and sets olMail to Nothing, the underlying .msg file in the folder is still locked as if it's open (get error message indicating the file is already open). This doesn't happen for others, but consistently happens for this user.
Sample code:
<code>sub checkMail()
    '' standard code above to initiate outlook, etc

    set olMail = Session.openshareditem(filepath & filename)

    ''code checks a bunch of stuff, stores some info about the email

    olMail.close 0
    set olMail = Nothing

    ''later on in the code, after looping through all the emails, we come back to specific
    ''ones that have been identified

    set olMail = Session.openshareditem(filepath & filename) '''THIS STEP FAILS TO OPEN

    ''and so on...
</code>
Comment: Would `olMail.close 1` olDiscard be sufficient? This may have an impact.
Comment: If not successful [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve)
Comment: Since you are initiating Outlook from another application you could tag the question with that other application.
Comment: Why do you open the same item twice in the same sub? Isn't it better to keep the reference until the end of sub and then release it.
Comment: what does `code checks a bunch of stuff` do? Do you access attachments and/or recipients?
Answer: It doesn't make any sense to close the item if you need it in the same VBA function. So, I'd suggest keeping the reference until the end of function/sub in VBA. Otherwise, you need to limit the scope of references and set them to null in the end of scope, so references will be cleaned up. But it is up to the VBA runtime when to release such references.


Can't find a specific Control using Controls.Find()

Question: I'm using Controls.Find() method to find a ListBox that i created dynamically. Name of those ListBoxes come from Directories that i created and named uniquely. Everytime i use this method it says the reference is null. How do i get the actual ListBox that i want?
Here is code:
public DosyaTakipAraci()
{
    InitializeComponent();

    string anaDizin = Properties.Settings.Default.anaDizin;

    if (anaDizin == "" || anaDizin == null)
    {
        dizinSecici.Description = "Lütfen dosyalarınızın kaydedileceği bir dizin seçiniz.";
        dizinSecici.ShowDialog();

        Properties.Settings.Default.anaDizin = dizinSecici.SelectedPath + @"\";
        Properties.Settings.Default.Save();

    }

    string[] dizinler = Directory.GetDirectories(anaDizin);

    if (dizinler.Length > 0)
        DizinleriYukle(dizinler);
}

This method loads all Directories

private void DizinleriYukle(string[] dizinler)
{
    for (int i = 0; i < dizinler.GetLength(0); i++)
    {
        DirectoryInfo dizin = new DirectoryInfo(dizinler[i]);
        DizinYukleyici(dizin.Name);
    }
}

This method is belongs to Directory icon that is created for each Directory

private void DizinSimge_DragDrop(object sender, DragEventArgs e)
{
    string[] dosyalar = (string[])e.Data.GetData(DataFormats.FileDrop);

    PictureBox simge = (PictureBox)sender;

    string dizinAdi = simge.Name;
    string anaDizin = Properties.Settings.Default.anaDizin;

    foreach (string dosya in dosyalar)
    {

        string dosyaAdi = Path.GetFileName(dosya);

        if (File.Exists($@"{anaDizin}{dizinAdi}\{dosyaAdi}"))
            return;

        File.Copy(dosya, $@"{anaDizin}{dizinAdi}\{dosyaAdi}", true);

        DosyaYukleyici(Panel.Controls.Find(dizinAdi, true).FirstOrDefault() as ListBox);
    }
}

This method loads the Directory and creates Controls related to the Directory

private void DizinYukleyici(string dizinAdi)
{
    #region Kontrol tanımları

    PictureBox dizinSimge = new PictureBox
    {
        Name = dizinAdi,
        Image = Properties.Resources.folder,
        Size = new Size(32, 32),
        Location = new Point(this.X, this.Y),
        AllowDrop = true
    };

    TextBox dizinBaslik = new TextBox
    {
        Name = dizinAdi,
        Text = dizinAdi,
        Location = new Point(this.X + dizinSimge.Width + 5, this.Y + 8),
        Font = new Font("Segou UI", 8.25f),
        BackColor = this.BackColor,
        BorderStyle = BorderStyle.None,
        ReadOnly = true
    };

    ListBox Dosyalar = new ListBox
    {
        Name = dizinAdi,
        Text = null,
        Location = new Point(this.X, this.Y + dizinSimge.Height + 5),
        BorderStyle = BorderStyle.None,
        BackColor = this.BackColor,
        Width = dizinSimge.Width + dizinBaslik.Width + 5
    };

    #endregion

    #region Olaylar
    dizinSimge.DragEnter += new DragEventHandler(DizinSimge_DragEnter);
    dizinSimge.DragDrop += new DragEventHandler(DizinSimge_DragDrop);
    dizinBaslik.DoubleClick += new EventHandler(Baslik_DoubleClick);
    dizinBaslik.KeyPress += new KeyPressEventHandler(Baslik_Press);
    Dosyalar.DragEnter += new DragEventHandler(DizinSimge_DragEnter);
    Dosyalar.DragDrop += new DragEventHandler(Dosyalar_DragDrop);
    #endregion

    Panel.Controls.Add(dizinSimge);
    Panel.Controls.Add(dizinBaslik);
    Panel.Controls.Add(Dosyalar);

    DosyaYukleyici(Dosyalar);

    this.X += (short)(dizinSimge.Width + dizinBaslik.Width + 5);
}

This method Loads files of a Directory and adds them to related ListBox

private void DosyaYukleyici(ListBox Liste)
{
    string dizinAdi = Liste.Name;
    Liste.Items.Clear();

    string anaDizin = Properties.Settings.Default.anaDizin;
    string dizin = Path.Combine(anaDizin, dizinAdi);

    string[] dosyalar = Directory.GetFiles(dizin);

    foreach (string dosya in dosyalar)
    {
        Liste.Items.Add(Path.GetFileName(dosya));
    }
}

Answer: You give the PictureBox, the TextBox and the ListBox the same name dizinAdi. Now when you search a ListBox, you may find a PictureBox or a TextBox first. Then you try to cast it with  as ListBox which yields null if it is not the ListBox.
Filter the by type:
Panel.Controls.Find(dizinAdi, true).OfType<ListBox>().FirstOrDefault()

alternatively, you could give different names to different controls like
"lst" + dizinAdi
"txt" + dizinAdi
"pic" + dizinAdi

or
dizinAdi + "ListBox"
dizinAdi + "TextBox"
dizinAdi + "PictureBox"


Qual seria a estrutura de CSS. Como montar esse modelo de galeria?

Question: Gostaria de saber que estrutura CSS precisa ser aplicada para se ter o aumento de divs com uma boa transição de animação a nível de CSS de altura e largura, o conteúdo interno da div não precisa ocorrer, ideia é ser parecido como no link abaixo:
https://www.wonderlandindustry.com/
Código que tenho até o momento:

main {
  height: 100vh;
}

.main_principal {
  height: 70vh;
  background: #0b4c81;
}

.main_cards {
  height: 30vh;
  background: #042a3f;
  display: -webkit-box;
  transition: all .5s;
}

.card {
  width: 20%;
  padding: 10px 7.5px;
  height: 100%;
  transition: all .5s;
  text-align: center;
  position: relative;
}

/*ANIMATION*/

.card:hover {
  -webkit-transform: scale(1.3);
  -moz-transform: scale(1.3);
  -o-transform: scale(1.3);
  transform: scale(1.3);
}

/*ANIMATION*/

.card_info {
  height: 100%;
  background: #0b4c81;
  display: flex;
  justify-content: center;
  flex-direction: column;
  color: #ffffff;
}
<!DOCTYPE html>

  <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

          Lorem Ipsum

          Lorem Ipsum

          Lorem Ipsum

          Lorem Ipsum

          Lorem Ipsum

Comment: Análise de sites externos não está no [escopo do site](/help/on-topic), mas os comentários continuam em aberto caso alguém queira comentar algo do site em questão. Você pode eventualmente [edit] a questão se tiver alguma dúvida sobre a parte específica de programação e, principalmente, dar mais detalhes do que quer fazer exatemente para que a pergunta não dependa do link externo. Talvez isto aqui te interesse: https://threejs.org/
Comment: Jack tirando esse btn de **+** que fica seguindo o mouse o resto da galeria inteira vc consegue fazer só com CSS, nem precisa de JS para fazer esse esquema com as imagens. Como o Bacco falou edite sua resposta, poste o que vc já tem de código, o que vc já tentou fazer e qual a sua dúvida ou dificuldade em realizar e assim podemos te ajudar melhor.
Comment: Que fique próximo a estrutura do site, vou seguir esse meu modelo para ficar próximo ao site.
Comment: Vc quer que fique exatamente igual ao do site de referência ? Ou vc quer seguir o modelo que vc fez, mas só ajustar algumas coisas, tipo não deixar dar barra de rolagem na página, e não deixar a imagem crescer para fora da página?
Answer: Opção 1 replicando a galeria apenas com css
Fiz esse modelo baseado na galeria do exemplo, ela é em flex, e o "macete" é que todos os itens tem flex:1, porém quando faz o :hover passa para flex:2, assim como passa o height de 30vh para 40vh. O resultado é uma galeria super responsiva! Exiba tb em "Página toda"

Segue o código usado para fazer a imagem acima:

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}
body {
    display: flex;
}
.wrapper {
    position: absolute;
    bottom: 0;
    display: flex;
    width: 100%;
    align-items: flex-end;
}
.box {
    background-color: red;
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    margin: 10px;
    height: 30vh;
    transition: all 500ms;
}
.box:hover {
    flex: 2;
    height: 40vh;
}
.box img {
    object-fit: cover;
    height: 100%;
    width: 100%;
}

Opção 2 usando o seu código
Como vc está usando transform e falou no comentário que pretende continuar nessa linha eu te sugiro controlar como o elemento vai "transformar" usando o transform-origen, assim vc controla o primeiro e último elemento para crescerem apenas para dentro da página!
.card:last-child {
  transform-origin: bottom right;
}

.card:first-child {
  transform-origin: bottom left;
}

No exemplo eu tb precisei usar z-index para imagem que crescer sempre crescer por cima das outras, e usai um box-shadow no acabamento, mas isso é perfumaria, o principal é controlar como o scale() vai funcionar.
OBS: Aqui dentro do snippet do StackOverflow não ficou legal, pois o seu código não está totalmente responsivo, mas copie o código e teste no seu projeto que deve funcionar 100%
Veja abaixo

main {
  height: 100vh;
}

.main_principal {
  height: 70vh;
  background: #0b4c81;
}

.main_cards {
  height: 30vh;
  background: #042a3f;
  display: -webkit-box;
  transition: all .5s;
}

.card {
  width: 20%;
  padding: 10px 7.5px;
  height: 100%;
  transition: all .5s;
  text-align: center;
  position: relative;
  transform-origin: bottom;
}

.card:last-child {
  transform-origin: bottom right;
}

.card:first-child {
  transform-origin: bottom left;
}

/*ANIMATION*/
.card:hover {
  -webkit-transform: scale(1.3);
  -moz-transform: scale(1.3);
  -o-transform: scale(1.3);
  transform: scale(1.3);
  z-index: 20;
  padding-bottom: 8px;
}

.card:hover .card_info {
  box-shadow: 0 0 10px black;
}

/*ANIMATION*/

.card_info {
  height: 100%;
  background: red;
  display: flex;
  justify-content: center;
  flex-direction: column;
  color: #ffffff;
  transition: all .5s;
}

        Lorem Ipsum

        Lorem Ipsum

        Lorem Ipsum

        Lorem Ipsum

        Lorem Ipsum


Oracle PL/SQL: Performance of CLOB data type in PL/SQL

Question: If I use many CLOB variables in the PL/SQL stored procedure to store many long length string , are there any performance issues? Is the length of the CLOB is also variable? Are there any known limitations/disadvantages for CLOB instead using varchar2 and long?
Answer: CLOBs are variable in length, yes.  The upper limit varies according to which version of Oracle you are on and your database block size.  For 11G the limit is "4G * value of DB_BLOCK_SIZE parameter" (from 11G PL/SQL Language Reference).  VARCHAR2 values are limited to 32767 bytes in PL/SQL.
I don't have any definitive information on the relative perforance of CLOB vs. VARCHAR2 in PL/SQL, and a brief Google didn't return anything useful either.  However I would strongly suspect that VARCHAR2 performs better than CLOB in general (for data that can be stored in either), since it is simpler.  You could easily set up a test to prove this right or wrong by writing the same simple program once with VARCHAR2 and once with CLOB, and running each 1000s of times and comparing the total elapsed time.  Tom Kyte's Runstats utility is a great help here, and shows other differences between 2 approaches in terms of Oracle resources.
My advice would be: if your data will exceed 32K then you must use CLOB; if not then don't use CLOB, use VARCHAR2.
NB: if CLOB were better than VARCHAR2 for all sizes of character data, Oracle would probably deprecate VARCHAR2, as they did with the LONG datatype - but they haven't.
Answer: CLOBs are substantially more expensive (slower) and more difficult to work with than VARCHAR2.  If you needlessly use CLOB instead of VARCHAR2 you are suffering a performance penalty that is measurable.
In the end you should as was noted earlier, use the right datatype for the right job.
1) if you are storing 4000 bytes or less in the database, use VARCHAR2 otherwise use CLOB.
2) if you are storing 32k bytes or less in PLSQL use VARCHAR2 otherwise use CLOB.
It is all about what you need.  If your data can exceed a VARCHAR2 limit then use CLOB otherwise use VARCHAR2.
As for clear negatives, consider that when working with LOB datatypes of any kind, a LOB can be either TEMPORARY (never stored in a real row in a table) or PERMANENT (stored in a real row in a table).  If you dynamically build a CLOB in PLSQL and pass that CLOB out to JAVA or someother external client then you have created a temporary CLOB and pushed it outside the control of the Oracle database.  This means your code that accepts the temporary CLOB is now responsible for releasing the CLOB when it is done with it.  Your code must have a method native to its environment that you can use for this purpose.  If you fail to do so, you temporary storage tablespace will eventually fill and your database will stall (stop working).  It won't crash, it just does not work.  A reboot will likely be needed.  The problem is that many development tools (many versions of java for example) do not have the needed library call.
Good luck.
Answer: CLOB variables are basically pointers, so they're not inherently slow. The problem is accessing the content of the CLOB. In my experience:

Relying on Oracle's implicit CLOB <-> VARCHAR2 conversions tends to be slow.
Working with the dbms_lob package is reasonably performant. Just do this in a loop:

Get a chunk of data from your CLOB into a buffer
Use the data from your buffer. Maybe transform it into another chunk of data.
Posibly write the transformed chunk of data into a destination CLOB.


Interpreting coefficients in logistic regression after standardizing independent variables

Question: I am working with a dataset where the continuous independent variables are on different scales and I plan on standardizing them before running a binary logistic regression.
However, I am not sure on how to explain the co-efficients from the model after standardizing the variables.
For example, without standardizing my variables I get Exp(B) value of 1.111 for Average Rate of Return (independent variable) and I would explain it as -> For every one percent increase in average rate of return, the odds of being Retirement Ready (dependent variable) is higher by 11%. How do i interpret the model output in a similar format after using standardized variables?
Comment: @whuber: If Average Rate of Return is expressed as a percentage, then a 1-unit increase (i.e., one percent increase) in Average Rate of Return is associated with an 11% increase in the odds of being Retirement Ready. Not quite sure why you believe the interpretation provided in the original question is incorrect?
Comment: @Isabella The use of "percentage increase" is ambiguous.  If it were understood as an *additive increase,* then this question becomes trivial (since standardization merely re-expresses the same data in a different unit of measurement), so I thought it had to be understood as a *multiplicative increase.*
Comment: Great point, @whuber! I edited my answer below to clarify where the increase is additive.
Comment: Your problem is that your current explanation is incorrect, so investigate that first.  In doing so it's likely you will obtain the answer to your question.
Comment: hi @whuber i have recently started learning predictive modeling and was looking for sources that would help me understand how to interpret and explain coefficients in a logistic regression. I found a tutorial online which explained the output like the one above. Apologies if my interpretation is wrong. It would really help me if you can point me to the right source
Comment: See https://stats.stackexchange.com/search?q=explain+logistic+regression+coefficient.
Answer: Let's say Y = Being Retirement Ready, X1 = Average Rate of Return and X2 = (X1 - m1)/s1 is the standardized version of X1, where m1 is the sample mean of X1 and s1 is the sample standard deviation of X1.
Assume we fit the binary logistic regression model:
log(odds of being retirement ready) = beta0 + beta1*X1,

and obtain an estimate b1 of beta1.  If exp(b1) = 1.11, say, then we can state the following:
For every 1-unit additive increase in X1 (Average Return Rate), we
estimate that the odds of being retirement ready increase by a
multiplicative factor of 1.11 (i.e., an 11% increase).

Next, assume we fit the binary logistic regression model:
log(odds of being retirement ready) = gamma0 + gamma1*X2,

and obtain an estimate g1 of gamma1.  If exp(g1) = 1.12, say, then we can state either of the following:
For every 1-unit additive increase in X2 (Standardized Average Return
Rate), we estimate that the odds of being retirement ready increase by
a multiplicative factor of 1.12 (i.e., a 12% increase).

For every s1-units additive increase in X1 (Average Return Rate), we
estimate that the odds of being retirement ready increase by a
multiplicative factor of 1.12 (i.e., a 12% increase).

If Average Return Rate is expressed in percentage points, then a 1-unit additive increase means a 1 percent additive increase.  You need to calculate the value of s1 to figure out how many units additive increase in X1 you are dealing with (e.g., if s1 = 20%, then you are dealing with a 20 percent increase on the additive scale).  You could also say, more generically, something like this:
For every standard deviation additive increase in the value of X1
(Average Return Rate), we estimate that the odds of being retirement
ready increase by a multiplicative factor of 1.12 (i.e., a 12%
increase).

Comment: hi @Isabella Ghement thank you for the detailed explanation. This makes sense. So, if the standard deviation for the Average Rate of Return is 20% and I were to explain it in terms of a unit increase, would it be correct to infer that for every 1% additive increase in X1 (Average Return Rate), we
estimate that the odds of being retirement ready increase by a
multiplicative factor of 1.006 (i.e., a  0.6% increase).
Comment: What odds ratio did you start out with for your calculation?
Comment: i was using the percentage value of 12%
Comment: hi @Isabella Ghement, Rephrasing my question - Given the same outcome - s1 = 20% and exp(g1) = 1.12, What would the multiplicative factor be if I were to explain the result in terms of every 1 unit additive increase in X1 (Average Return Rate) instead of s1-units additive increase?


Clean up private static variables between unit tests

Question: I have a class that looks similar to this:
public class DiscoveryDocumentCache
{
    static DiscoveryDocumentCache()
    {
        cache = new MemoryCache(discoveryDocumentCacheName);
    }

    private static MemoryCache cache;

    // Other stuff...
}

I want the memory cache to be static so that it is shared across all instances of the class.
It is working great for the actual use cases.  Where I am struggling is with my unit tests.  Because the cache variable is static, it accumulates all the different values that get put in it.
My use case does not have a "remove" option.  (They just expire out of the cache.)
I have added this to my DiscoveryDocumentCache class:
    public void __UnitTesting__CleanUpMemoryCacheBetweenTests()
    {
        cache.Dispose();
        cache = new MemoryCache(discoveryDocumentCacheName);
    }

But it feels dirty to add a method that is just to facilitate unit testing.
.NET Framework had some ways to access class's private variables if you really thought you should.  Is there something similar I can do to reset this static variable in my TearDown unit test method?
Comment: Personally I'd shy away from a static object. Maybe inject a cache factory of some sort that gives you a cache object that may or may not be a singleton/static/whatever. Then you get to manually inject into your testable objects a cache object of your choice.
Answer: Not sure if you'll think this is an answer, or just a long comment. :-)
Your tests are working well because they are telling you something. They're saying "This is a bad use of a static instance."
Statics are always suspicious, although not always bad. What's bad here is you use a static to implement the singleton pattern in a way that is subsequently out of your control. That is, your individual instances are deciding for themselves which cache (the singleton) to use, rather than being told what to use.
As @Vaccano suggests, you are better off to use some sort of dependency injection. Translate that to "Tell each object what cache to use rather than having them figure it out for itself." This is one of those things that requires a bit of up-front investment in order to avoid saving trouble later.
As an aside... there is nothing wrong with changing your application to make it more testable. Testability is just another of those "ilities" that define good software design. The trick is to change it so as to improve the software, usually simplifying it rather than complicating it.
Comment: Thanks, I had a similar problem with a static holding a value cached from file. It was being preserved between unit tests so I wanted to clear it, but that is not valid behaviour for the application as a whole.
Your answer pointed me in the right direction: changing another public property should trigger a nullification of the cached value, ready to be reloaded based on the new value of the public property.


Trill in Bach fugue WTC 1 BWV 851

Question: In the second bar of the J.S. Bach d-minor Fugue in WTC 1 (BWV 851), we have

How should this trill be played?
Answer: According to Bach's father's own Explication concerning the trills and ornaments, we are given a guide on how to interpret the trills. The Expliation was later expanded on by C.P.E. Bach.
There is no question that an historically correct interpretation will start the trill on the upper auxiliary note (in this case the A). The ornament does not descent to an F; there are specific types of ornaments that would require that (like the trillo or the second doppelt-cadence und mordent and the trill is not one of them.
After playing the upper auxiliary note on the beat, you should alternate back and forth between the upper auxiliary and principle notes, playing the principal note at least twice. We are given some suggestions:

This suggestion would put a slight rhythmic emphasis on the 5th note in the sequence. For this fugue, that would sound a little awkward. Indeed, in most places in baroque music in general, it would sound awkward, with rare exceptions perhaps (the third beat of a 3/4 measure?).
This would allow a smooth trill and also a healthy suspension from the A to the G for the introduction of the theme in the dominant. This would also promote a controlled tempo. I would definitely recommend playing the trill this way for these reasons.
This seems at first like it could work, but really the A would be too long. We don't want to emphasize the A, we just want to use it effectively to create tension with the G.
If you are playing this at faster tempo, this would be one effective way to execute the ornament.
Playing the trill this way would not allow you to play the next note with the Baroque "ordinary touch". In other words, it would be difficult to play it this way and also have the articulation make sense. Also, in reiterations of the fugue subject, it would be tricky to have this done effectively while it is already sometimes difficult to play a trill at all.
This way, the trill would not sound like a trill, it would just sound like four 16th notes.

So you have a little bit of artistic freedom. Things to consider are the tempo, the note that comes next, and the context of the piece. Is it consistently playable in places where the subject returns? Does the trill sound uneven played at a fast tempo unless you play it a certain way? You'll hear ornaments in all varieties of music played many different ways in different interpretations. There may be no most correct way, but some ways are definitely more correct than others.
Comment: *Idem* is not an ornament name.  It is latin meaning "the same."  In this case, it means "this example is an alternate way of notating and/or performing the thing that was demonstrated by the previous example."
Answer: I'm looking at the imslp.org's photocopy of an original score, so I hope I got the right spot (no images allowed thru corporate proxywall :-( ).  My guess is to start with the upper note of the trill as a sort of grace-note just prior to hitting the triad; then release the full triad prior to the final sixteenth.
At least, that's how I'd approach a similar figure in Bach's cello pieces.
Comment: Not sure if you got the right spot. There's no triad there.
Comment: D minor `R8 d8 e f g e | (f16 d cis d) bes'4 g^"tr" | (a4 a16) g16 f e g f e d |` `R1 | R1 | R8 a8 b c d b|`
Comment: @AmericanLuke  apparently not :-(
Comment: I thought a triad was 3 notes. I'm confused, too.The next bar might be useful to see where the trill goes.
Comment: @Tim yes, it is.  What I read as the second bar was not the bar posted in the original question, hence the confusion.
Answer: I've heard this played two different ways:
Option 1:

Option 2:

I believe the first one may be more technically correct, but you'd have to ask a baroque specialist. There may be other options as well, but these should be fairly in-line with the original style.
Comment: Starting with the auxiliary note is definitely the historically accurate thing. The opposite style didn't become common until later.
Comment: The ornament should also *not* descend to an F; as a *trillo* or *idem* would.
Comment: I should point out that while I would play this as four groups of a-g 32nd notes (as searchfgold suggests), people were expected to improvise ornaments (and more) in that time period. Strict adherence to Bach's markings became a bit of a fetish in the 19th century, and I'm not convinced such strictness is the composer's intention. Rather, I think of them as "training wheels" for students, in which group I most certainly include myself.
Comment: Idem is not the name of an ornament.

Trill in Bach fugue WTC 1 BWV 851


Azure storage queue - geo redundancy

Question: Is there any option to maintain HA specifically on Azure storage queues/tables,  to do read as well as write to the queue on the secondary region if the primary goes down?
Is there any reference to do the programmatic failover switch?
For development & testing, how to simulate "primary" down situation?
If primary location is down, what kind/name of exception to except from Azure storage SDK to implement fail over to secondary?
Answer: This is already enabled within Azure storage, you do not have to do anything further once you configure in the creation step.Azure Storage offers the following types of replication:

Locally redundant storage (LRS)
Zone-redundant storage (ZRS)
Geo-redundant storage (GRS) or read-access geo-redundant storage (RA-GRS)
Geo-zone-redundant storage (GZRS) or read-access geo-zone-redundant storage (RA-GZRS)

You can read more here
Comment: Lets say 'RA-GRS' enabled on my storage instance, will writes & reads continue to happen on secondary incase primary is down or ONLY it will take care of read since its name says "read-access geo-zone-redundant storage"?
Comment: it is supported only with ZRS https://learn.microsoft.com/en-us/azure/storage/common/storage-redundancy
Comment: you can read more on the GRS asynchronous sync here https://learn.microsoft.com/en-us/azure/storage/common/storage-disaster-recovery-guidance
Comment: The "RA" prefix shows that the secondary region can provide read-access at any time, not just after a failover has happened. But your applications need to be aware of how to read data from the secondary instance.

Azure storage queue - geo redundancy


(Topology) In the real line $R^1$ a set is open if and only if it is a union of open segments (a,b).

Question: I am reading Rudin's "Real and Complex Analysis" and came across the statement,
"In the real line $R^1$ a set is open if and only if it is a union of open segments (a,b)."
I have two questions:
1. A subset $A$ of $X$ may be open with respect to a topology $\tau_1$ in $X$, but not open with respect to another topology $\tau_2$ in $X$. Therefore, what does it mean to say that, a set is open in the real line $R^1$, without specifying underlying topology?
2. I see that a collection of all sets which are arbitrary unions of open interval consists a topology $\tau$ in $R^1$. So arbitrary union of open interval is open in X with topology $\tau$.(if part, which is straight forward.) But how can I show that arbitrary open set in X with respect to some random topology $\tau'$ can be expressed as a union of open intervals?(only if part) I think this question is related to the first question since I need clarification regarding the meaning of an open set in X means without any topology specified.
I do realize that $R^1$ is a metric space, and the statement is perfectly clear with the definition of open set in a metric space. But is there a way to understand the above statement without relying on the concept of metric space?
Comment: 1. There is  a "standard" topology on $\Bbb R$.
Comment: [MathJax](https://goo.gl/OWv9nr) tip: `\Bbb{R}` = $\Bbb{R}$
Comment: 2. The quoted statement is false if we consider a topology different from the standard one. Indeed, the statement specifies the basis with which the corresponding topology on $\mathbb{R}$ is generated.
Comment: Intentionally obtuse. -1.
Comment: There are two natural ways to define a topology, namely via a metric from the absolute value, or via its linear order (the order topology). They both coincide for the reals. Rudin's statement holds in general for linearly ordered spaces without min or max, so should IMHO not be seen as a "metric" rather than as an "order" statement.
Comment: Thank you @SangchulLee This is just what I needed!
Answer: Rudin is saying that in the standard topology on $\Bbb R$ induced by the metric $d(x,y) = |x-y|$, every open set can be written as a union of intervals of the form $(a,b)$.
Answer: Whenever they do not specify the topology on $ \mathbb R $, they mean the Standard Topology on   $ \mathbb R $


In a List, get "team" from a player in "all_players" without the "name"

Question: my question is about this list that i have. In the list are 2 things: "meta-data" and "players" in "players" is "all_players". Now i want to get the Player Name and Player Team but i dont know how i can do this. i can do data["data"][i]['players']['all_players'][{name}] but then i only have the name, and i cant get the team when i dont know which player the team i should get.
Here is my List:
{
    "data": [
        {
            "metadata": {
                "map": "Breeze",
                "game_length": 1702289,
                "game_start": 1657464507,
                "game_start_patched": "Sunday, July 10, 2022 4:48 PM",
                "rounds_played": 20,
                "mode": "Competitive",
                "queue": "Standard",
                "platform": "PC",
                "region": "eu",
                "cluster": "London"
            },
            "players": {
                "all_players": [
                    {
                        "puuid": "70f7373a-ba78-5c9a-a963-767fbf27d9ad",
                        "name": "Player 1",
                        "team": "Blue"
                    },
                    {
                        "puuid": "70f7373a-ba78-5c9a-a963-767fbf27d9ad",
                        "name": "Player 2",
                        "team": "Blue"
                    },
                    {
                        "puuid": "70f7373a-ba78-5c9a-a963-767fbf27d9ad",
                        "name": "Player 3",
                        "team": "Red"
                    },
                ]}
        }]
}

This is only a small part, where things are what i want to have. The List is way longer but its unnecessary for this part This List or Data is from a JSON.
Comment: Do you want to get the player's team by player name?
Comment: too! i want to get it without name and the name, just for the tests
Answer: Here's a way to do what your question asks:
all_players = data["data"][0]["players"]["all_players"]
playerNames = [player["name"] for player in all_players]
teamNames = [player["team"] for player in all_players]
teamByPlayer = {player["name"]:player["team"] for player in all_players}

Output
playerNames
['Player 1', 'Player 2', 'Player 3']

teamNames
['Blue', 'Blue', 'Red']

teamByPlayer
{'Player 1': 'Blue', 'Player 2': 'Blue', 'Player 3': 'Red'}

Explanation:

The assignments for playerNames and teamNames each use a list comprehension to create a list based on the items in the for loop.
The assignment for teamNames uses a dict comprehension to add a key:value pair using key player["name"] and value player["team"] for each player in the for loop.

To find the team for a given player, you can do this using accumulate():
from itertools import accumulate
def findTeamOfPlayer(player):
    all_players = data["data"][0]["players"]["all_players"]
    team = list(accumulate(p["team"] for p in all_players if p["name"] == player))
    return team[0] if team else None

target = "Player 2"
team = findTeamOfPlayer("Player 2")
print(team)
team = findTeamOfPlayer("Player 99")
print(team)

Output:
Blue
None

Comment: In a dict comprehension (explained under [Dictionaries](https://docs.python.org/3/tutorial/datastructures.html#dictionaries) in the docs), they give the example `{x: x**2 for x in (2, 4, 6)}` where `x` is the key and `x**2` is the value, with all key/value pairs `x: x**2` in the `for` loop to be added to the dictionary. So in our case, `player["name"]:player["team"] for player in all_players}` is a `dict comprehension` that creates a dictionary with `player["name"]` as key and `player["team"]` as value for every `player` in `all_players`.
Comment: See my updated answer for one example of how to find the team for a given player name.
Comment: Thanks! question: what does this : mean between player["name"] and player["team"]
Comment: Okay! And what if, i dont want all players their teams but only one player? Like i only want the Team of Player 2?


Make an android activity full screen over a button

Question: Im new on android development and I want to know how can I make an android activity fullscreen via a Icon placed on toolbar.
Thank You.
Please click on link for example image:
Click to preview example
Comment: have you read the android documentation thoroughly? there is a fullscreen activity option already in android studio...
Answer: I think this previous post may give you what you are looking for:
Fullscreen Activity in Android?
From post mentioned above:
You can do it programatically:
public class ActivityName extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // remove title
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
        WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.main);
}
}

Or you can do it via your AndroidManifest.xml file:
<activity android:name=".ActivityName"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>

How your code should differ:
public class ActivityName extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // remove title
    Button x = findViewById(R.id.yourButton);
       x.setOnClickListener(new View.OnClickListener() {
          @Override public void onClick(View v) {
            requestWindowFeature(Window.FEATURE_NO_TITLE);
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
             WindowManager.LayoutParams.FLAG_FULLSCREEN);
             setContentView(R.layout.main);
          }
       });
}
}

This would link your button with this code.
Comment: it is posible with this code but not in onCreate...if he put new private void onFullScreenPressed () { .....this code.... }, otherwise it will be fullscreen at start without pressing button
Comment: If you think an answer to another question solves this issue as well then consider flagging the post as a duplicate rather than reposting the answer here.
Comment: I tried your method Alexander N. but its not working. My app crash when I click button from menu bar.
Comment: @user3664679 - What does your code look like for the onClickListener of your menu bar button?  Can you post the error message from logcat?
Comment: Button x = (Button) findViewById(R.id.fullscreen);
        assert x != null;
        x.setOnClickListener(new View.OnClickListener() {
            @Override public void onClick(View v) {
                supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
                getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                        WindowManager.LayoutParams.FLAG_FULLSCREEN);
                setContentView(R.layout.activity_informatica);
            }
        });    and error is
Comment: @user3664679 - Since it is coming from a toolbar, you would want to wire it for the actionbar.  See this link: http://stackoverflow.com/questions/22526498/android-actionbar-item-onclick
Comment: So it sould be something like this: public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        if (id == R.id.fullscreen) {
           // startActivity(new Intent(this, ContactUS.class));
            supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

        }
        }
Comment: Something like this: `@Override
public boolean onOptionsItemSelected(MenuItem item){
    switch(item.getItemId()){
    case R.id.fullscreen:
            requestWindowFeature(Window.FEATURE_NO_TITLE);
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
            setContentView(R.layout.main);
        return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}`
Comment: Now i got  this error: android.util.AndroidRuntimeException: Window feature must be requested before adding content


How to split qr codes in separate images?

Question: I have hundreds of pictures with qr codes (sometimes there are 0, 1, 2 or more qr codes on one page...but they are always in one line). I want to decode the qr codes from left to right. My idea is to split the qr codes in separate images.
Does somebody know a Linux (or Python) solution for this problem?

The order I want is: url1, url2, url3, url4, url5, url6.
Comment: pyzbar does also provide the position of the image in its output, a sort shouldn't be too much trouble.
Comment: Are they all the same size ?
Comment: Looks like pyzbar has no trouble with multiple qr codes.
Comment: @Marco: Yes, they're.
Comment: @tgikal: zbarlight does the job too. The problem is the order.
Answer: I'm on windows, no way of testing on linux right now, but this appears to work as expected.
import sys, os
try:
    from pyzbar.pyzbar import decode, ZBarSymbol
except:
    cmd = ('py -m pip install "pyzbar"')
    os.system(cmd)
    from pyzbar.pyzbar import decode, ZBarSymbol

try:
    from PIL import Image
except:
    cmd = ('py -m pip install "Pillow"')
    os.system(cmd)
    from PIL import Image

decoded = decode(Image.open("C:/Temp/13AZQ.png"), symbols=[ZBarSymbol.QRCODE])
qr_dic = {}
for qr in decoded:
    x = qr[2][0] # The Left position of the QR code
    qr_dic[x] = qr[0] # The Data stored in the QR code

for qr in sorted(qr_dic.keys()):
    print(qr_dic[qr])

Output:
b'url1'
b'url2'
b'url3'
b'url4'
b'url5'

Comment: storing the left position as a dictionary key, then returning the data through sorted keys seemed like the easiest method to me.
Comment: I just managed to get things done (with your help). Thanks you very much! If you post your solution [here](https://stackoverflow.com/q/51195584/7082264) too, I'll accept your answer.
Comment: Yeah, I'm on a pretty locked down computer and it would not let me install zbarlight to even let me see if I could get that one to work in the same way.


Showing correct proof for finding equivalence classes for relation defined on $\mathbb{Z}$ by $aRb$ if $6 \mid (a^2 - b^2)$

Question: For relation defined on $\mathbb Z$ by $aRb$ if $6 \mid (a^2 - b^2)$
I know that the equivalence classes are {0,1,2,3,4,5} but I'm unsure if my method of proof is valid. For the first part of the question, I proved it was an equivalence relation on $\mathbb{Z}$, and now I need to find and prove the equivalence classes.
My thoughts so far:

Let there be $a,r \in \mathbb{Z}$, so that $6 \mid (a^2-r^2)$.
I know by Euclidean Division that  $6 \mid (a^2-r^2) \equiv a^2=6q+r^2$ , $q \in \mathbb{Z}$
Then I also know that $0 \leq r^2 <6$
If $aRr$, the I know $[a]=[r]$ and also $a\in[r]$***
Then by transitivity, since I proved (in my homework) $bRa \land aRr \Longrightarrow bRr$ and therefore, $[b]=[a]=[r]$ and $a,b \in [r]$

***Can I state this? Or am I missing something key concept before I can say this?
Any feedback on my train of thoughts is appreciate. Pls let me know if you see any holes of logic that I need to fill.
Comment: Not following.  What does $[i]$ mean?  There are only $4$ squares $\pmod 6$, namely $\{0,1,3,4\}$.
Comment: Sorry, I re-edited it. Is it better?
Comment: Well, no.  What does it mean to say that, say, $1$ is an equivalence class?  And why would $1,5$ be in distinct classes?  After all $1\sim_R 5$.
Comment: The equivalence classes should be $0+6\Bbb Z,\ldots$ instead of $0,\ldots$
Comment: Is the equivalence class $0+6\mathbb{Z}$ because the relation already implies that $a^2-b^2$ is evenly divided by 6?
Answer: you can use $\pmod 2$ and $\pmod 3$ to describe things, but the result does not fit that well with $\pmod 6$
We always have $x^2 \equiv x \pmod 2,$ so $a^2 \equiv b^2 \pmod 2$ if and only if $a \equiv b \pmod 2.$   For this calculation, we are left with classses even and odd.
Next, squares are $0 \pmod 3$ or $1 \pmod 3.$  As with 2, what we can tell is whether a number is divisible by $3$ or not divisible by $3$.
The equivalence class could be summarized as YY, YN, NY, NN, where the first yes/no is divisbility by $2,$ the second letter is divisibility by $3$
two numbers are equivalent if and only if they have the same pair of letters


When a module has a composer dependency, should it be automatically installed when the module is installed?

Question: Trying to resolve a debate - if a drupal site that is configured correctly installs a module with a composer dependency, should I expect the composer dependency to be installed automatically during the install?
The other person thinks that modules with composer dependencies have to be installed through command line to work, I think that if things were configured correctly it should happen on its own.
Does someone know how it should work?
Comment: See https://www.drupal.org/node/2404989
Answer: If you install the module with composer, yes, dependencies will be fetched. If you download the tar and put it in the site, it will not.


Aplicar estilo em elemento filho de acordo com o elemento pai em SASS Com declaração no filho

Question: Olá, estou construindo uma estrutura de estilos SASS que mudanças irão depender de uma classe definida no meu body. Essa classe dita qual o navegador que o usuário está usando, exemplo:
<code><body class="chrome"> <!-- Google Chrome -->
<body class="firefox"> <!-- Mozilla Firefox -->
<body class="ie"> <!-- Internet Explorer -->
<body class="opera"> <!-- Opera Browser -->
<body class="edge"> <!-- Edge Browser -->
</code>
Eu tenho conhecimento que, em CSS, se eu quiser alterar qualquer coisa para cada elemento, eu devo usar um seletor em conjunto assim:
Em CSS
<code>.chrome  .foo { background-color:red; }
.firefox .foo { background-color:blue; }
.ie      .foo { background-color:yellow; }
.opera   .foo { background-color:pink; }
.edge    .foo { background-color:green; }
</code>
Em SASS (pela lógica)
<code>.chrome {
  .foo { background-color:red; }
}
.firefox {
  .foo { background-color:blue; }
}
.ie {
  .foo { background-color:yellow; }
}
.opera {
  .foo { background-color:pink; }
}
.edge {
  .foo { background-color:green; }
}
</code>
Gostaria de saber se não existe alguma forma mais "legível para escrever diretamente no elemento Child essa modificação baseada na classe Parent, algo assim:
<code>.foo {
  parent(.chrome) { background:red; }
  parent(.firefox) { background:blue; }
  parent(.ie) { background:yellow; }
  parent(.opera) { background:pink; }
  parent(.edge) { background:green; }
}
</code>
Existe alguma forma de eu definir isso no SASS e ele mesmo se encarregar de montar o resto das declarações para quando, em determinada classe ele encontrar isso?
Answer: Encontrei a solução para meu problema. O SASS me deixa declarar uma expressão completa dentro da classe e após ela eu definir o caracter coringa de seletor composto (&) assim:
<code>.foo {
  background-color: black;
  body.chrome & {
    background-color: red;
  }
  body.firefox & {
    background-color: blue;
  }
  body.ie & {
    background-color: yellow;
  }
  body.opera & {
    background-color: pink;
  }
  body.edge & {
    background-color: green;
  }
}
</code>
Answer: O que você pode fazer é criar um EXTEND, você consegue importar uma classe dentro da outra.
<code>// Criamos os extends

%chrome {
    background:red;
}

%firefox{
    background:blue;
}

// Importamos onde queremos inserir

.box-meio {
  // importar a classe chrome
  @extend %chrome;
}

.box-topo {
  // importar a classe firefox
  @extend %firefox;
}
</code>
Comment: Posta aqui nesse post pra gente ver =)
Comment: na verdade eu achei uma forma beem mais funcional, sem extend..., veja no post que to criando
Comment: tai a solução, funcional, e simples... assim eu posso fazer "bugfixe's" dentro de cada elemento quando necessário
Answer: Você pode utilizar o @at-root.
<code>.foo {
  @at-root {
    .chrome & { ... }
    .firefox & { ... }
    .iexplorer & { ... }
  }
}
</code>
Comment: sim, é uma idéia que também achei, mas se eu usar o @at-root só vai servidr se for no body do documento, da maneira que eu coloquei serve para qualquer elemento parent, independente do nível do mesmo