pty 867

They are synonymous, if you check the official docs it says as much. The reason they're both there is for familiarity, SQL Server and DB2 use lcase, Oracle and PostgreSQL use lower.

pty 867

While you're at it Dani, I think there should be a preference somewhere to hide (or group, maybe) the "began watching a topic" and "viewed a topic" cards. Am more interested in posts and replies.

The data can still be presented I think, just maybe a little less promenant. Maybe the watcher avatars like on a GitHub ticket?

pty 867

Did lowering the transaction isolation level to READ COMMITTED make any difference to the timing?

pty 867

I'd just use toLocaleTimeString.

let options = {weekday: 'long', year: 'numeric', month: 'long', day: 'numeric'};
let now = new Date();
console.debug(now.toLocaleTimeString("en-GB", options));

If you need more formatting control then you could use a library like Fecha or moment.js where you can do stuff like this:

// in fecha
fecha.format(new Date(2015, 10, 20), 'dddd MMMM Do, YYYY');

// in moment
moment().format('MMMM Do YYYY, h:mm:ss a');

pty 867

All RDBMs have more-or-less the same Transaction Isolation Levels but sometimes they go by slightly different names and MySQL has a few extra oddities. Before going further understanding what a dirty read is and how to avoid it is important.

READ WRITE and READ ONLY set the level of access that transaction has. If you use READ WRITE you can both read from and write to tables inside your transaction. With READ ONLY, you can't modify data. That bit's easy.

WITH CONSISTENT SNAPSHOT is a tiny bit trickier, but essentially when you open the transaction all data used inside the query will be as if it was read when the snapshot was created (either at the start of the transaction or at the point it's first read), rather than how it currently is. From the docs,

With REPEATABLE READ isolation level, the snapshot is based on the time when the first read operation is performed. With READ COMMITTED isolation level, the snapshot is reset to the time of each consistent read operation.

So, it comes back to transaction isolation levels. READ COMMITTED just means that any data read has beencommitted to the database. If you select a value from a table at the beginning of your transaction, then update it (and commit) in concurrently in another transaction, then finally select it at the end of your first transaction, the value will be the new value.

REPEATABLE READ means that once you've selected a value inside a transaction, it will ...

pty 867

MySQL binds current_timestamp()/now() at the beginning of the statement so I believe all of your records would have the same created_at value.

If you wanted them to differ I think you'd need to use a cursor and separate insert statements.

pty 867

You can also use filters to filter out data from your own networks. This will prevent internal use of your site/app by
employees/testers from influencing statistics.

pty 867

These days, just build responsive.

jQuery Mobile has always been a kludge, I wish it didn't have the jQuery name because that made people think it was actually good. It's not, avoid it.

pty 867

The bugs I linked to are present in the PHP Redis driver, phpredis.

CodeIgniter's Sessions functionality uses it to connect to Redis. There is even a caveat in the documentation stating

Since Redis doesn’t have a locking mechanism exposed, locks for this driver are emulated by a separate value that is kept for up to 300 seconds.

pty 867

This is a really weird use-case, I wouldn't recommend it. A better approach is to use a single database and make your dynamic objects (views, functions, procedures etc) aware of the financial year.

Then you'd reap multiple benefits. Firstly, one version of everything, you know which is the truth. Secondly, you can do more useful things with your data. For example, if you want to compare this year's profits to last year's, it's easy.

In PostgreSQL, you can specify a template when you create a DB, you could use that strategy to make your original approach work. Or you could clone your 2018 database and rename it to 2019, then truncate all the tables.

But like I said, you're best sticking to one database and keeping it simple and obvious.

pty 867

Looks like this has been a problem in PHP for a long time. On a brighter note, it looks like a fix is on the way.

pty 867

Yep looks really good!

In making this reply I encountered a slight bug. I typed some words into the box, hit "post reply" and it took me to the login page. On mobile, the actual form was way off the bottom of the page, but when I found it, I was redirected to a 404.

pty 867

I just realised this thread is six years old. I had no idea that was the case when I answered above. For some reason it was in the main feed (I didn't go digging for ancient threads)

rproffitt commented: I saw that pop up in the feed as well. +15

pty 867

So you have a target database (the one you'll be left with at the end) and a source database, the one you'll copy from. Take a backup of both of your databases before you start.

If you have any unique fields you need to remove them from the source database. So, if you have an auto-incrementing id field, drop it. Once it's ready, you can export it as a CSV. Note that if you miss this step, your import is likely to fail because the ID's assigned to your records and his records will clash.

Now, in your target database, click 'Import from Text File' (this varies depending on the version you're using) and pick the freshly-exported CSV file. Go through the wizard and try it out. Hopefully his data will be alongside yours in the table.

pty 867

*bear with me

pty 867

No, that's not how the web works. If I want to browse 2gud.com (I don't, but bare with me) I can just override my user agent at the click of two buttons. Why go to a load of effort when there's no payback and it might just piss off your audience?

Screenshot_2018-10-02_at_17_42_41.png

If you want to enforce mobile only build an app.

rproffitt commented: And the workaround is given. Don't PO the users. +15

pty 867

Violence at football matches isn't really a thing now. Yes, it happens but incidents are isolated and infrequent.

I'd say the most violent times are Friday and Saturday nights in certain town centres where people drink far too much on a very regular basis. Often the fights don't happen until the clubs are emptying and people are queueing for taxis or kebabs. Someone is accused of pushing in, someone throws a chip at someone else, it all kicks off.

I stick to quiet, unexciting old man pubs and I've never really witnessed any violence while drinking.

pty 867

I think the next big thing is to sign up for forums with a female name and fake avatar and make nothing posts with links to shit websites that like they were created with badly farmed content.

rproffitt commented: "That's Bait!" or Catfishing? +0
jkon commented: are we men so desperate ? +9

pty 867

And these clowns want companies to add backdoors and to circumvent encryption. I hope the GPDR gives them a nice kick up the arse while we embarrass ourselves on the world stage by leaving the EU.

rproffitt commented: Sounds like The Clash to me. +15

pty 867

I still find it funny that the place to go for online tech discussion (Hacker News) still uses nested tables for all layout. I know it's wrong but it works pretty well.

These days CSS Grid does everything tables does better and in a responsive manner.

pty 867

I have optimised this even more so you don't need to worry about those pesky patterns and stuff.

Just use (.*).

Reverend Jim commented: Hah +15

pty 867

Additionally, I forgot the sorting element.

For an array of hashes you'll notice that if you try to sort directly the comparison will fail:

[{name: "Ringo"}, {name: "John"}, {name: "Paul"}, {name: "George"}].sort
ArgumentError: comparison of Hash with Hash failed

You need to tell Ruby how to sort, using #sort_by:

[{name: "Ringo"}, {name: "John"}, {name: "Paul"}, {name: "George"}].sort_by{|b| b[:name]}
=> [{:name=>"George"}, {:name=>"John"}, {:name=>"Paul"}, {:name=>"Ringo"}]

If you go down the class route you would need to implement the comparison method, <=>, as that's what is used to compare elements within sort. For the time being I'd stick to using a hash, it works nicely for this type of puzzle.

pty 867

You have made a decent start. In addition to looping you need to think about how you might store the user-entered results.

In order to loop you're probably best using the #times method of an integer, this means you'll have to convert your gemstoneNumber to an integer before looping.

[1] pry(main)> quantity = "2".to_i    # simulating the gets which always retuns a string
=> 2
[2] pry(main)> quantity.times do |i|
[2] pry(main)*   puts i
[2] pry(main)* end
0
1

Secondly, how do you want to store your data? You could use a hash per gemstone and store the records in an array.

gemstones = []
gemstones.push({name: "Sapphire", color: "Blue", price: 24.0})
gemstones.push({name: "Emerald", color: "Green", price: 21.0})

Or you could create a new Gemstone class with attribute readers and store an array of these:

class Gemstone
  attr_reader :name, :colour, :price

  def initialize(name, colour, price)
    @name, @colour, @price = name, colour, price
  end

end

The beauty of this approach is that you can create a to_s method in your class and call it to print out your "You entered..." line.

Hopefully some of this made sense, but you can get the result you want by looping based on the quantity using times and storing the data in an array. If you get stuck post your updated code and I'll have another look. Good luck.

pty 867

Excluding your aggregate columns you need to group by all you select by. That's just the way it works.

pty 867

Before you start doing any work, if at all possible, create a commit for the last developer with all her changes explaining what happened, then you're starting your own work with a clean slate.

On the plus side, at least there was source control. I've taken on several contracts where there's nothing.

pty 867

Also you should be supplying a relative path and not exposing your file structure. If the root of your server is img_mysql your path should start with images

pty 867

Of course. For one to one tuition you'll need to pay by day rate though.

Or you can buy a book, read the documentation and learn without wasting people's time.

pty 867

They did a whole visual refresh as part of their tenth birthday celebration. Hard to imagine that eleven years ago Firefox was fast catching up to IE and it looked like it was going to be a two horse race for the foreseeable future.

pty 867

So what's missing? Your app needs to call your API with a couple of parameters, your API should respond with success or failure.

pty 867

I agree with Jim. Hands-on learning is the best way by far.

If you're just getting started I'd recommend CodeAcademy.

Finally, in the UK is national coding week this week, there are free courses up and down the country. I'm mentoring at Full Stack Of Pancakes in Manchester.