pty 882 Posting Pro

I've come across this before and believe it's related to Access-Control-Allow-Origin. I'd expect it to be a consistent problem rather than something that happens occasionally, though.

Are you serving your frontend and backend on different addresses/ports/vhosts?

pty 882 Posting Pro

Not in Java. You can use ArrayList<MyObject> and make MyObject flexible enough to cope with more than one type.

In other more-flexible languages you can be more direct. In Ruby, for example:

stuff = ["a", :a, 1, ["a", :a], {a: 1}]
=> ["a", :a, 1, ["a", :a], {:a=>1}]
pty 882 Posting Pro

I don't use Windows. You've probably got the old version cached or something, the latest IE and Edge have supported alpha-PNG files for years.

pty 882 Posting Pro

Could you post a screenshot of the problem and the actual .png file? Hard to tell what's going on on mobile

pty 882 Posting Pro

You'd need to check with whoever is hosting your database. The error message you mention is coming from MySQL, so the connection to the DB appears to be fine, just the permissions for your particular user on the server are at fault.

pty 882 Posting Pro

You need to ensure that your user has privileges to connect to your database. Try connecting from the command line, use the grant command to add permissions to a user, and flush privileges to make sure they're applied.

pty 882 Posting Pro

Also make the id field a primary key (or at least unique) to prevent this from happening at the application level.

pty 882 Posting Pro

databases don't have 'Arrays'

While this hasn't been strictly true for a number of years, @ stultuske is correct in suggesting that using an array inside a RDBMS is likely to have drawbacks.

pty 882 Posting Pro

Yes, use a library. Writing robust CSV parsers is very difficult because of the difficulty of nicely dealing with "bad" data.

pty 882 Posting Pro

What's the error?

pty 882 Posting Pro

Unfortunately I am as much in the dark as everyone else here as to how to adapt.

Have a quick look at what's replaced forums in this area.

Take r/learnprogramming for example.

There aren't any "NEED HOTEL BOOKING APP HALP PLS" posts (they do appear but are swiftly dealt with), there's no spam, there's no drama, there are plenty of people offering advice and pointing people in the right direction.

Importantly, there is a set of rules that is rigid and anything that doesn't comply is dealt with so quick most people are unaware that it happens.

rproffitt commented: Well, here you are, weary traveler, one steaming hot cup of justice. No need to thank me, (The Tick) +0
cereal commented: +1 +0
pty 882 Posting Pro

Use Faker or similar. Keep in mind, there aren't an unlimited number of first (or last) names so you'll have to create some random element and append it to avoid clashes.

pty 882 Posting Pro

This is a good question and there are thousands of potential answers, but here's what I'd suggest. Of course this depends on your interests and what you've learned so far.

Start with a problem. It doesn't have to be complicated or wide-ranging and can be as contrived as you like. Say, you have a shelf full of books (don't type them in, just use an existing list!):

  • Which has the longest title?
  • Which was published first?
  • What is the average number of pages (mean, median, mode)?
  • Which language is most popular?

These are all individual problems but you'll also need to 'share' some functionality (namely the loading/parsing of the data). All should be quite straightforward but some moreso than others.

Then add a touch of complexity:

  • Which is the longest book written before 0CE?
  • For each century, which is the most frequently-occuring author in the list?

If you get stuck on any, post back here, someone is likely to help (these are fun tasks!)

pty 882 Posting Pro

That's the best approach. My suggestion makes sense if you don't have a pile of stuff to migrate, because all the hard work has been done. If migration is a big complex task, cereal's approach is very sensible and more portable between databases/stores.

pty 882 Posting Pro

I'd use PostgreSQL which has native network address data types.

pty 882 Posting Pro

Perhaps paste the error instead of a minified jQuery?

pty 882 Posting Pro

I develop on an average machine (a 2014 MBP, i5 with 8GB RAM). I don't need any more grunt because I have AWS at my fingertips. I can have a cluster of massively powered machines at a very reasonable price - you only pay for them while you use them.

If, however, I was a gamer, where latency is a key issue, I'd want that power a bit closer. But, I'd need to spend more money even if I only played three hours a week.

Pros and cons with both approaches.

pty 882 Posting Pro

Seeing as you're already loading Bootstrap, why not just use it?

pty 882 Posting Pro

I'll just leave this here.

rproffitt commented: Sooner or later, time.... +12
ddanbe commented: Indeed +15
pty 882 Posting Pro

That sounds like what he's after. With more than one level you'd need to use a window query to do this. Here's an example I wrote many years ago.

pty 882 Posting Pro

Date already does this, just replace the date (ie 2004/05/07) with the one you want.

$ date -d"20040507" +"%A"

Friday
rproffitt commented: TGI pty +0
pty 882 Posting Pro

Github and Gitlab are both companies that do more or less the same thing; they provide a hosted Git service.

The main difference is that Gitlab is open source and you can download and run the community edition on any machine you want for free. This is why Gitlab's popularity has skyrocketed over the last few years.

Github, while they do offer on-premises services (at a cost), make most of their money through their centralised online offering, github.com. Nearly all open source projects use it (or at least have a presence there) because when they started it made the process of forking and submitting code (in the form of pull requests) simpler than it had been in the past.

Additionally, Gitlab has plenty of extra features that Github doesn't, such as continuous integration, a docker registry.

Github, instead, offers more in the way of integrations with other SAAS providers via the Github marketplace.

Which should I choose?
  • I want to install and run on my own server with as many users as I like. Gitlab

  • I want private repositories but I don't want to run anything on my own server, I'd rather have it managed by a company with a good record of performance and uptime : Bitbucket or Gitlab for free. Or, one of Github's paid plans

  • I want to write open source software and have plenty of visibility online. Github
cereal commented: well said +15
ddanbe commented: great +15
rproffitt commented: More power... +12
pty 882 Posting Pro

While Davy is almost right, setting the width of the surrounding div won't quite work; that will make the div itself 100% wide but not the contents. You'd need to apply the width: 100% to the image, as per this example.

pty 882 Posting Pro

You can't expect anyone to work out what's going on without posting the accompanying JavaScript. I suggest you make a JSFiddle or similar.

diafol commented: Davy has been here 6 years. You'd think... +15
pty 882 Posting Pro

I think the question is "if I compare a string to an integer, what will happen?"

pty 882 Posting Pro

Unfortunately there's not a function that drives traffic to your crappy website either!

pty 882 Posting Pro

Now you can run SQL Server and .NET on Linux, the remaining differences are user familiarity and price. Linux is free but if you already use and know Windows, Linux might seem complicated. Also, Windows isn't as easy to administrate remotely and trickier to secure.

pty 882 Posting Pro

Keeping questions and scenarios fresh helps prevent lesser students (like this one) from just finding the answers online.

This problem has been solved hundreds of times, and there's an exact duplicate in this forum.

I don't mind helping but I like to see some effort first, not just pasting the question directly into a forum. If you want to help the OP do his homework without actually learning anything, go ahead.

pty 882 Posting Pro

I'd ask for the money back on whatever course you're doing, the material hasn't changed for seven years.

pty 882 Posting Pro

You're welcome, glad I could be of service.

rproffitt commented: Fresh eyes, old professor. +12
pty 882 Posting Pro

Ah ok. The original post didn't sound like a typical "do my homework" request.

pty 882 Posting Pro

This problem was solved like 40 years ago.

$ sort -t" " -rnk4 data.tsv
ascon1 201707015 Jack 97.5 11.5 11.5 11.5
ascon1 201707013 Josh 79.5 11.5 11.5 11.5
ascon1 201707011 John 77.5 11.5 11.5 11.5
ascon1 201707012 Grld 70.0 11.5 11.5 11.5
ascon1 201707014 Jess 67.5 11.5 11.5 11.5
  • -t" " to tell sort to split on spaces
  • -r for reverse (highest first)
  • -n to tell sort that it's a numeric field
  • -k4 to tell sort that we're loking at the fourth column
pty 882 Posting Pro

There is only one way, one rule and one method. It's called write some good content. Content is key, and if it's good enough to capture an audience you've cracked it.

You're not going to appeal to everyone. Write for the audience you want, concentrate on topics you're both knowledgeable and passionate about.

pty 882 Posting Pro

Yep can confirm this on Android with Chrome.

pty 882 Posting Pro

So, a quick update.

My spare router that I tried using as a firewall can't block https traffic, which is unfortunate.

Luckily I had Plan B.

I switched the TV to point at my OpenDNS account, after a few hours I checked the logs

link, for some reason the remote image isn't displaying either :/

The image is on imgur because I was getting nginx errors when attempting to upload it to Daniweb.

So, I've blacklisted samsungacr.com . I've had no new adverts, but I suspect the ones already on the TV will expire soon and disappear. If they don't I'll do another soft reset. I'm avoiding that because it means typing in my 35 character Amazon Prime password using the onscreen keyboard, a task I don't enjoy.

For reference, here's my naughty list.

link.

rproffitt commented: Thanks for the list. +12
pty 882 Posting Pro

That's what I thought. Although I believe I may have only done a soft reset, which is the only option available in the standard menus.

There might be a full on as it was when it left the factory factory reset locked away somewhere too.

pty 882 Posting Pro

Tried several factory resets with no joy, it appears to spring back to life at the same firmware version, 1201, as it was before. Samsung explicitly told me that it's impossible to revert to a previous version, even know I know that's a lie.

pty 882 Posting Pro

In addition to my post, something that made the experience worse was that when I contacted Samsung support they said

Please be informed that the adverts or advertisements depend on the app that you have installed or downloaded from the apps panel.

So, their support teams have been trained to push the blame in my direction. Yet the adverts come from apps that are pre-installed that I cannot disable.

pty 882 Posting Pro

This isn't a typical hardware post, but I couldn't find anywhere better for it.

Last October, after my previous TV packed in, I bought a shiny new Samsung Smart TV. My shortlist of requirements was:

  • Excellent picture quality, preferably 4k
  • No advertising built into the UI
  • Within my price range (I ended up spending £1,400 on it)

The reason for my second requirement is that many years ago I bought a Hard Disk Recorder from Panasonic that had the following style of EPG. Note the advert taking up roughly 1/4 of the width of the screen.

.

I have not bought anything from Panasonic since, and when asked for recommendations, I've advised against their products.

So, I found a model of Samsung that met my requirements. It did not have adverts anywhere, and the "Smart" features, like Voice Control could be turned off. It supported Amazon Video and YouTube too, so I wouldn't need my Chromecast. Excellent.

Fast forward to the middle of this year, I received a software update from Samsung. Great, software updates will make my already-great experience better, right? Not so much. Now, periodically, the following abomination appears in the actual UI of my TV.

IMG_20170824_192539.jpg

Amazing. On the actual firmware release notes from the website, there's no mention of adverts being added (so I couldn't have checked, even if I'd have wanted to), and now I'm stuck with an expensive advertising board sat in my front room.

rproffitt commented: At least we don't have to fix the Talkie Toaster (see Red Dwarf for more.) +12
pty 882 Posting Pro

Here's a comprehensive answer why parsing XML with regular expressions is a bad idea. @AndrisP put you on the right track.

pty 882 Posting Pro

Yes, it is possible, and how to do it is outlined in MySQL's excellent documentation.

However, you almost certainly don't need multi-master. You just don't.

rproffitt commented: That's what I thought too. +12
pty 882 Posting Pro

Are you definitely using a Thunderbolt 3 cable between your MBP and the 5K monitor?

Incidentally, slightly jealous, I need to get one of those monitors but I'm worried my 2013 MBP might not be beefy enough to drive it smoothly.

pty 882 Posting Pro
pty 882 Posting Pro

The code I provided is in an entirely different language, you can't just paste Ruby into PHP!

Maybe ignore JavaScript for a while and learn PHP first.

pty 882 Posting Pro

You're not actually adding them to the DOM. Look here.

pty 882 Posting Pro

Hard to tell what's going on without knowing what your server is doing and that you're sending requests to the port it's listening on.

Here's what I'd do, substitute my Ruby for your PHP. First, create a standalone, super-simple API. Here's an example

require 'sinatra'
require 'json'

# world's simplest API
get '/hello' do
  {hello: "world"}.to_json
end

Now, when I run that file in Ruby, it tells me where it's listening.

== Sinatra (v2.0.0) has taken the stage on 4567 for development with backup from Puma

Finally, I just need to make a sensible request:

http get localhost:4567/hello

And here's the response.

HTTP/1.1 200 OK
Connection: Keep-Alive
Content-Length: 17
Content-Type: application/json
Date: Sun, 27 Aug 2017 17:22:05 GMT
Server: WEBrick/1.3.1 (Ruby/2.4.1/2017-03-22)
X-Content-Type-Options: nosniff

{
    "hello": "world"
}

Now, the browser hasn't been involved at all. Everything's simple and visible. If something goes wrong I'll get the feedback right in my terminal window. PHP supports this approach too.

pty 882 Posting Pro

Like I said, access your API (even if it is only one function that returns {"hello": "world"}) using something less complicated. The tools I mention above are a good start. When you know that is working correctly and your url param is right, your server is listening on the right port etc, then integrate your JS.

pty 882 Posting Pro

I'd start by leaning DD-WRT, then use that to build a Captive Portal. You'll need a compatible router.

pty 882 Posting Pro

Ok, so if you run this with your browser's developer tools open, what errors do you see in the console?

pty 882 Posting Pro

Your post doesn't make a lot of sense. What functions don't return anything? Where is ajaxPost defined? Does your API call actually work? Try accessing your API via another program like Postman or HTTPie.