pty 882 Posting Pro

It's not difficult to get something with Facebook-like functionality up and going on a small scale. I could build a working prototype in a couple of days.

The difficult bit is attracting users. Google couldn't do it with their resources for Google+.

pty 882 Posting Pro

I use fd for this kind of thing.

https://github.com/sharkdp/fd

pty 882 Posting Pro

Also, in addition to find -exec (which is awesome) there's xargs - it works in a very similar fashion but can be used anywhere to do.. anything.

https://en.wikipedia.org/wiki/Xargs

pty 882 Posting Pro

If you're using the latest version of macOS where the default shell changed to zsh you can glob it

/tmp
❯ mkdir -p omg/wtf/bbq

/tmp
❯ touch omg/wtf/bbq/{1,2,3,4,5,6,7,8,9,10}.css

/tmp
❯ tree omg
omg
└── wtf
    └── bbq
        ├── 10.css
        ├── 1.css
        ├── 2.css
        ├── 3.css
        ├── 4.css
        ├── 5.css
        ├── 6.css
        ├── 7.css
        ├── 8.css
        └── 9.css

2 directories, 10 files

/tmp
❯ rm -r omg/**/*.css
rproffitt commented: +1 for Glob. Long live Glob. +15
pty 882 Posting Pro

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 882 Posting Pro

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 882 Posting Pro

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 882 Posting Pro

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 882 Posting Pro

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 882 Posting Pro

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 882 Posting Pro

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 882 Posting Pro

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 882 Posting Pro

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 882 Posting Pro

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 882 Posting Pro

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 882 Posting Pro

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 882 Posting Pro

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 882 Posting Pro

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 882 Posting Pro

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

pty 882 Posting Pro

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 882 Posting Pro

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 882 Posting Pro

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 882 Posting Pro

Change the database settings perhaps?

pty 882 Posting Pro

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 882 Posting Pro

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

Happens on Android/Chrome.

pty 882 Posting Pro

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 882 Posting Pro

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.

https://gist.github.com/peteryates/b44b70d19ccd52f62d66cdd4bcef1e52

alan.davies commented: Outstanding! +0
rproffitt commented: Thanks for the bullets. +0
pty 882 Posting Pro
var spamTarget = prompt("What's your email?");
pty 882 Posting Pro

gtfo.

rproffitt commented: GIGO? +15
pty 882 Posting Pro

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 882 Posting Pro

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 882 Posting Pro

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 882 Posting Pro

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 882 Posting Pro

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'
p.save

Simple, elegant and pretty self-explanatory.

vb.net probably has something similar. If it doesn't I'd suggest learning something that does instead.

pty 882 Posting Pro

Yes sure. Step one, learn SQL. Try CodeAcademy's SQL course, it's very good.

pty 882 Posting Pro

Yeah, I said Stack Overflow and actually meant the Pro Webmasters section of Stack Exchange.

I was referring to the quality of the question more than the topic. It's a terribly low standard, pretty much at the "how is babby formed?" level.

And the suggestions. Ugh. People just posting stuff without any indication of how it might actually help the OP. And Squidoo hasn't existed for fucking years. Nor has Technorati. And what Travel_3 posted is beyond comprehension.

I've all but lost patience here. The core members try to help people and some threads are constructive but the vast majority are low effort questions with low effort replies.

In this thread poor GentleMedia is wading upstream in a raging torrent of shite. And Gliffer, the latest post, they spell their address wrong on their actual website.

As the scholar and gentleman Duncan Bannatyne repeatedly said, "I'm oot".

pty 882 Posting Pro

It's easy

  • Add a new checkbox
  • Create an associated label with text "Select All"
  • Write some code that when the new checkbox is checked checks the other boxes, and vice versa.

Done.

Here are some ways not to do it

  • Ask a vague question on a forum without giving any information on the context and what libraries are available
  • Copy and pasting random code from the internet until it works
  • Wasting peoples time by asking the same question over and over, each time (when pressed) yielding slightly more information
rproffitt commented: +1 easy. +0
pty 882 Posting Pro

Another thread full of useless information. How long would this have lasted on Stack Overflow? Not long. And that is why people go there.

This is why forums fell behind. This right here.

rproffitt commented: Sort of like opening the black sarcophagus found in Alexandria but worse. +15
pty 882 Posting Pro

I use Skype daily and prefer web.skype.com. It runs perfectly in the browser and means I don't have to install anything or touch the client which, to be honest, could suck golf balls through a hosepipe.

rproffitt commented: Something that could suck balls through that sounds very powerful? +15
pty 882 Posting Pro

Not at all. The algorithm he has used copies whatever is in the boolean position in the input: and, or, xor(?) etc (with maybe a conversion to upper case

Yes I see that but once you start adding or statements to a query you have to take precedence and additional brackets into account. It can get very difficult very fast.

Source, I wrote a query builder a few years ago, thought it'd take a couple of days but ended up being more than a week. Should have just taught the users SQL!

pty 882 Posting Pro

Like I said in my post, this is deceptively easy. We're assuming they're all and, and under that assumption you may as well just join.

Once you start adding or into the query, the whole thing becomes much more difficult.

pty 882 Posting Pro

Python is clean, expressive and has a great standard library. It's not just a web development language, it can be used for most tasks.

Where it really pulls ahead of PHP from a development perspective is its general consistency and availability of scientific libraries.

pty 882 Posting Pro
rproffitt commented: And there it is. (answer!) +0
pty 882 Posting Pro

The difference between hardware and software is that you can touch hardware.

And yes, this is a hijacked thread.

dream11indian commented: Nice post +0
pty 882 Posting Pro

Where are you? In the UK we have markets like Music Magpie that will give you quotes for items in your collection. Failing that, you can always sell through eBay or Amazon but if you have lots of CDs, creating lots of ads might be a tedius prospect.

pty 882 Posting Pro

Why are you using PHP for this? Can't you just use anupdate statement with a where clause?

pty 882 Posting Pro

Essentially what you need is something that sits between the web page and the database. We'd often refer to this layer as an API, but just think of it as a simple program that receives HTTP requests and responds with some data.

Here's a really simple example written in Ruby with Sinatra.

require "sinatra"
require "json"

before do
  content_type :json
end

get "/" do
  [1,2,3,4,5].to_json
end

Now, when I run this program and make a request, we can see exactly what happens. By default, Sinatra listens on port 4567

$ http get localhost:4567

HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 11
Content-Type: application/json
Server: thin 1.5.1 codename Straight Razor
X-Content-Type-Options: nosniff

[
    1,
    2,
    3,
    4,
    5
]

Once you have this working you should be able to create a method in JavaScript that makes AJAX requests to your API. The easiest way to do this is to use the new standard Fetch API or something like Axios.

Here's me making the request using fetch in Chrome against the API I just wrote

Screen_Shot_2018-07-09_at_15_24_26.png

Simple, eh? The next step would be to enhance this program (or a similar one written in the language of your choice) and connect it to a database. But, one step at a time.

pty 882 Posting Pro
rproffitt commented: +1 for the enjoining. +0
pty 882 Posting Pro

but searching for "dog mouse cat" will return no results

This is what your query is specifying. To make it match a jumble of words you need to can split up the string and group your criteria with and. This will soon get messy, especially if your searching across multiple columns. Depending on the database you're using I would change the query to use a full text search (available in most RDBMS in one form or another, including PostgreSQL and MySQL).

rproffitt commented: And +1 +0
pty 882 Posting Pro

There's an implementation of SQLRand
available on GitHub and you can read the original paper that proposed the idea here.

Personally I think the approach is over complicated and would instead opt for a sane ORM and coding standards that eliminate the angles of attack.

rproffitt commented: Anti-pattern. Thanks for this. +15