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

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

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

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

No, that's not how the web works. If I want to browse (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?


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 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

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


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

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

Change the database settings perhaps?

pty 867

Did you remove the tape/film from the new colour cartridge before you inserted it?

rproffitt commented: I have made that mistake. "Doh!" +15

pty 867

A small bug, clicking the upvote/downvote button on mobile makes the comment box appear very briefly then disappear.

Happens on Android/Chrome.

pty 867

It's not just the algorithm, as @alan.davies said, the data plays a part. Instead of storing up or down votes as integers, you probably need to introduce a new relation (let's refer to it as Vote) that has a post_id and a user_id which are foreign keys to the posts and users tables respectively.

Now, a user can only vote once per post so add a unique index that covers post_id and user_id. And obviously you need a direction (up or down, perhaps you could store this as a +1 or -1) and timestamps (created_at, updated_at).

Now, it's trivial to work out not only how people voted but when they voted. You have enough data to implement the Hacker News or Reddit algorithms.

pty 867

I created a guide on stopping Samsung from spamming your TV's UI with adverts. The same technique can be used to block skiing vaguely Korean.

alan.davies commented: Outstanding! +0
rproffitt commented: Thanks for the bullets. +0

pty 867

var spamTarget = prompt("What's your email?");

pty 867


rproffitt commented: GIGO? +15

pty 867

Also, once Python is installed, you can use Python's package manager (pip) to download and install other packages. Django comes with a built in web server and there's even a very simple one that comes with Python itself.

pty 867

To anyone other than Davy, you're best using Chocolatey. It's a sane apt/brew like package manager for Windows and does all the hard work for you.

Of course, using a Unix like OS makes it even easier.

rproffitt commented: Thanks for this. Something new to me. +15

pty 867

The pdf files that i am dealing are very complex, containing tables, checkboxes , radio buttons images etc

I wouldn't do this. Whoever came up with this was a masochist. Replace it and don't waste any more time trying to modify PDFs. That's not what they're for.

Trust me, I used to work in the translation industry. We had an entire department who did this kind of thing on an ad hoc basis (customer wants this PDF in French, Bulgarian and Mandarin by Tuesday). The process took about fifteen times longer than working with a text or Word file and was priced accordingly. The results were never perfect, especially for non-standard layouts. Text didn't reflow properly, things didn't always line up.

tl,dr; you're doing it wrong. Start again now you know why.

rproffitt commented: +1 for YDIW. Sometimes that's it, plain and simple. +0

pty 867

That's not how PDF files work. All of the calculations that take place in the layout stage are done and finalised (this sets PDF apart from Postscript).

You need to treat PDF files as if they are paper. If there's an update, reprint it from the new source. It's digital and free, much easier than printing out some words and try to glue them in the right place.

rproffitt commented: And that's how it is. +15

pty 867

I'm not sure what you mean by "I am wanting to select an access database table after gaining the ID for the table."

To find a record with a matching first and last name using SQL you'd do something like

select * from patients where firstname = 'Joe' and lastname = 'Shabadoo';

Nobody in the real world would actually create separate variables for a single record's attributes and populate them manually like that. In Rails, for example, using ActiveRecord to find and modify a record we'd do something like this:

p = Patient.find_by(firstname: 'Joe', lastname: 'Shabadoo')
p.firstname = 'Joseph'

Simple, elegant and pretty self-explanatory. probably has something similar. If it doesn't I'd suggest learning something that does instead.