maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   OS2008 / Maemo 4 / Chinook - Diablo (https://talk.maemo.org/forumdisplay.php?f=29)
-   -   Ad blocking (https://talk.maemo.org/showthread.php?t=14729)

coffeedrinker 2008-01-09 20:26

Ad blocking
 
I've posted this before but since some people are having trouble with the Adblock plugin for microb, I thought I'd repost this:

Ad blocking with css:
http://floppymoose.com has a good file (doesn't get everything though).

Save the file userContent.css to /home/user/.mozilla/microb/chrome/userContent.css to enable blocking with that file.

Restart browser once you have the file in place. Make sure permissions and ownership are set right.

This solution is very fast and very easy to setup.

bexley 2008-01-09 20:41

Re: Ad blocking
 
Thanks. I'll give it a go.

So, Adblock still has troubles, eh? My main question is whether there's still no fix for the supposed sluggishness it causes in Microb. Other issues I can deal with, but Microb is slow enough as it is.

I'm guessing there's lots of scripts for Greasemonkey for ad-removal. Has anyone found some that work well with Microb?

Lastly, to shove all of my ad-blocking questions into one post, is there a way to disable Adblock without uninstalling it?

Aciv 2008-01-09 23:29

Re: Ad blocking
 
Quote:

Originally Posted by bexley (Post 124267)
Thanks. I'll give it a go.

So, Adblock still has troubles, eh? My main question is whether there's still no fix for the supposed sluggishness it causes in Microb. Other issues I can deal with, but Microb is slow enough as it is.

I'm guessing there's lots of scripts for Greasemonkey for ad-removal. Has anyone found some that work well with Microb?

Lastly, to shove all of my ad-blocking questions into one post, is there a way to disable Adblock without uninstalling it?

It's not that hard to experiment with it, instead of relying on what other people say. Yes, you can disable it, which is handy because it causes some sites not to load at all, on my system. When it works, I don't notice any slowness penalty. In fact, it speeds things up significantly on many sites because you don't have to wait for innumerable ads to download. Give it a try.

Aciv 2008-01-09 23:34

Re: Ad blocking
 
Quote:

Originally Posted by coffeedrinker (Post 124257)
Make sure permissions and ownership are set right.

I could use a little elaboration on that if you don't mind. Thanks.

coffeedrinker 2008-01-10 00:00

Re: Ad blocking
 
Um, just make sure you can read from the directory and file as your normal user. :)

bexley 2008-01-10 00:10

Re: Ad blocking
 
Quote:

It's not that hard to experiment with it, instead of relying on what other people say.
Experiment with what? It's pretty clear that I couldn't find out how to disable it. It's not listed as a Microb component or in the settings. I've got Adblock Plus installed.

> Yes, you can disable it.

Thanks for telling me how. You chastise me for asking a question and then half-answer it.

Anyway. I'm going to try the CSS script and privoxy.

yueq 2008-01-10 01:31

Re: Ad blocking
 
My (partial) solution is modifying the /etc/hosts to point the ads sites to nowhere. This method takes care of the majority of the ads and has least impact on system performance.

Root privilege is required to modify the /etc/hosts.

munky261 2008-01-10 07:47

Re: Ad blocking
 
adblock does speed up surfing , when you already have a window open , but the 10-15 sec delay when opening a new browser window from the desktop is unacceptable.

Rebski 2008-01-10 11:01

Re: Ad blocking
 
Quote:

My (partial) solution is modifying the /etc/hosts to point the ads sites to nowhere.
I would like to do that but have no idea what it entails. Would you post a how-to, please?

free 2008-01-10 12:13

Re: Ad blocking
 
open xterm
Code:

cd /etc
sudo gainroot
wget http://www.mvps.org/winhelp2002/hosts.txt
mv hosts hosts-orig
cat hosts-orig hosts.txt > hosts
rm hosts.txt

Mvps is one out of 10 major lists existing.
http://pgl.yoyo.org/adservers/
http://www.hosts-file.net/
http://someonewhocares.org/hosts/
http://hostsfile.mine.nu/


If you have a local http server running then you should change 127.0.0.1 to something else or rely on another method.

PJE 2008-01-10 13:11

Re: Ad blocking
 
I've tried various ad blocking techniques over the short time I've had my N800 - GreaseMonkey (+Scripts), Adblock+, fakeweb with modified hosts file and currently the custom userContent.css file.

The userContent.css file blocks quite a lot of ads, although not as many as the large hosts file and fakeweb, and was was wondering about the performance hit from having a large hosts file compared to the relatively small userContent.css script.

yueq 2008-01-11 00:22

Re: Ad blocking
 
Quote:

Originally Posted by free (Post 124703)
If you have a local http server running then you should change 127.0.0.1 to something else or rely on another method.

e.g. 0.0.0.0

Thanks for the nice write-up.

Aciv 2008-01-13 04:38

Re: Ad blocking
 
Quote:

Originally Posted by bexley (Post 124405)
Experiment with what? It's pretty clear that I couldn't find out how to disable it. It's not listed as a Microb component or in the settings. I've got Adblock Plus installed.

> Yes, you can disable it.

Thanks for telling me how. You chastise me for asking a question and then half-answer it.

Anyway. I'm going to try the CSS script and privoxy.

I did not chastise you. I didn't say anything personal at all, not did I mean to imply anything negative.
From the browser menu go to 'tools' -> 'components' : uncheck / check adblock plus

GeneralAntilles 2008-01-13 04:47

Re: Ad blocking
 
Quote:

Originally Posted by PJE (Post 124738)
The userContent.css file blocks quite a lot of ads, although not as many as the large hosts file and fakeweb, and was was wondering about the performance hit from having a large hosts file compared to the relatively small userContent.css script.

The idea is to use both. The big gain with the hosts over almost every other method (minus privoxy), is that it prevents the ads from even being loaded. This saves time, bandwidth, CPU and RAM.

But no, there is no hit with a large hosts. Instead of resolving the URL from a DNS server, it resolves from the hosts, which points nowhere.

PJE 2008-01-14 21:55

Re: Ad blocking
 
Quote:

Originally Posted by GeneralAntilles (Post 126584)
The idea is to use both. The big gain with the hosts over almost every other method (minus privoxy), is that it prevents the ads from even being loaded. This saves time, bandwidth, CPU and RAM.

But no, there is no hit with a large hosts. Instead of resolving the URL from a DNS server, it resolves from the hosts, which points nowhere.

So the userContent.css is post filtering the data being displayed after it's downloaded - similar to what some GreasMonkey scripts do? I was thinking it was also reducing the downloaded data... I need to do some tests.

Also, if I have a 50K host file doesn't the browser have to check every link address with the list before sending it out to the internet DNS? I was thinking about the time taken to perform this check.

GeneralAntilles 2008-01-14 22:17

Re: Ad blocking
 
Quote:

Originally Posted by PJE (Post 127720)
So the userContent.css is post filtering the data being displayed after it's downloaded - similar to what some GreasMonkey scripts do?

The elements are still downloaded, they're just not displayed.

Quote:

Originally Posted by PJE (Post 127720)
Also, if I have a 50K host file doesn't the browser have to check every link address with the list before sending it out to the internet DNS? I was thinking about the time taken to perform this check.

I'm fairly certain it just loads the info into whatever does the DNS looksup (as I believe a restart of the browser is required for changes to stick), so it's not an issue of polling the hosts file (which is a stupidly trivial thing to do anyway) and the impact is nil.

Either way, avoiding loading advertisements would most certainly make up for any slight performance hit of a large hosts file if there actually were one. :rolleyes:

coffeedrinker 2008-01-14 22:57

Re: Ad blocking
 
Make sure you do not mess up your original hosts file. See my post:

http://internettablettalk.com/forums...79&postcount=5

free 2008-01-15 11:21

Re: Ad blocking
 
Quote:

Originally Posted by coffeedrinker (Post 127772)
Make sure you do not mess up your original hosts file. See my post:

http://internettablettalk.com/forums...79&postcount=5

Exactly,
That's why in the few lines, I *append* the ad-blocking host to the current original one.

ghoonk 2008-01-15 11:41

Re: Ad blocking
 
Linux newbie here. How do I append the ad-blocking host to the original one?

PJE 2008-01-15 12:27

Re: Ad blocking
 
Quote:

Originally Posted by ghoonk (Post 128005)
Linux newbie here. How do I append the ad-blocking host to the original one?

You need to install becomeroot or easyroot to allow root access (search www.gronmayer.com/it to find it) to modify the /etc/hosts file. You will also need to install wget if you want to follow the process outlined in post #10 above (copied here):

Code:

cd /etc
sudo gainroot
wget http://www.mvps.org/winhelp2002/hosts.txt
mv hosts hosts-orig
cat hosts-orig hosts.txt > hosts
rm hosts.txt

This assumes your downloading the hosts file from the web directly onto your N8x0. I downloaded the host file via the web browser (which removes the need to install wget) and saved it to the internal SD card, so my equivalent was (assuming the downloaded file was hosts.txt):

Code:

sudo gainroot
cd /etc
mv hosts hosts-orig
cat hosts-orig /media/mmc2/hosts.txt > hosts

The 'mv hosts hosts-orig' line backs up your original file and can be recovered using 'mv hosts-orig hosts' when your in the /etc directory with root access.

I hope this clarified things. I can't stress how much of an improvement running one of these host file additions makes to the quality of web browsing ( unless you like seeing all the ads :p ).

ghoonk 2008-01-15 12:29

Re: Ad blocking
 
Is there any way I can copy the existing hosts file out of the N800, edit it on my PC (WinXP) and then copy it back into the N800?

my commandline skillz is teh fail (i can lolcattalk too), and with things working all fine and dandy on my tablet now, I would REALLY hate to screw it up.

GeneralAntilles 2008-01-15 12:33

Re: Ad blocking
 
Quote:

Originally Posted by ghoonk (Post 128030)
Is there any way I can copy the existing hosts file out of the N800, edit it on my PC (WinXP) and then copy it back into the N800?

The steps outlined on the last page are hardly advanced stuff. Just do exactly as it says and everything will work fine.

PJE 2008-01-15 12:48

Re: Ad blocking
 
Quote:

Originally Posted by ghoonk (Post 128030)
Is there any way I can copy the existing hosts file out of the N800, edit it on my PC (WinXP) and then copy it back into the N800?

You can, using 'mv hosts /media/mmc2/hosts' (at which point the file can be seen via USB on the PC), but be aware that PC files can have different end of line terminators than linux files... so I'd recommend doing it on your N800 directly.

You are not actually editing the host file, all you are doing is making a new host file by joining the current host file (which has your machine ID) and the ad blocking list to create the new super host file.

ghoonk 2008-01-15 12:53

Re: Ad blocking
 
That worked. Application Manager works fine too.

Now to test it over the next couple of days to see what kind of improvement I can get. I've turned off AB+ just to get an idea of how this works.

Thanks, guys!

coffeedrinker 2008-01-15 17:51

Re: Ad blocking
 
Quote:

Originally Posted by free (Post 127995)
Exactly,
That's why in the few lines, I *append* the ad-blocking host to the current original one.

What got me into trouble was using the same hosts file after an OS update. The localhost line changes with each update.

Redshift 2008-03-20 00:27

Re: Ad blocking
 
Thank you for the very clear instructions! I have modified my hosts file using the one from hosts-file.net following the posted instructions. Now however instead of ads I'm seeing the CSS placeholders and messages telling me server could not be found. I think I'm also supposed to use UserContent.css or Greasemonkey scripts to hide those now defunct css elements right? Is there a preference for which one?

Edit: Did some googling and yeah, I figured it out. However, http://www.floppymoose.com isn't working for me. Anyhow, I found a website that suggests that using Mozilla's built in image blocking may be more effective than using CSS filtering.

http://www.gozer.org/mozilla/ad_blocking/

Anyone use this?

n9mjg 2008-03-20 12:56

Re: Ad blocking
 
Frankly, it think privoxy is easier to use and does a more thorough job of ad blocking. Just install the deb and point set the proxy settings and your done.

traveller604 2008-03-20 13:11

Re: Ad blocking
 
Is there by the way some faster way to switch proxies? Most of the time I'm behind privoxy, but every now and then I need to be in my uni's "ip space" and frankly it's a ***** to change those settings.. so many clicks..

iamthewalrus 2008-03-20 20:04

Re: Ad blocking
 
Quote:

Originally Posted by traveller604 (Post 157745)
Is there by the way some faster way to switch proxies? Most of the time I'm behind privoxy, but every now and then I need to be in my uni's "ip space" and frankly it's a ***** to change those settings.. so many clicks..

Create a new connection that doesn't have the proxy settings set, and then switch when necessary.

brontide 2008-03-20 21:24

Re: Ad blocking
 
I did a

mv /etc/hosts /etc/hosts.orig and then created the following script.

Code:

#!/bin/sh
cp /etc/hosts /etc/hosts.bak
wget -q -O - http://www.mvps.org/winhelp2002/hosts.txt | sed -e 's|127\.0\.0\.1  localhost|127\.0\.0\.1 Nokia-N810-50-2 localhost|' > /etc/hosts

Note the one item will need to be changed based on your original hosts file. I love CPU non-intensive adblocking tricks. I also run my own .css rules for the sites I visit.

iamthewalrus 2008-03-28 14:56

Re: Ad blocking
 
Is there a way to log/monitor which HTTP requests are directed to 127.0.0.1 because of the the hosts file, (short of installing apache)? Since I added this here to my hosts file I can't open youtube movies, either from Microb or the MyTube app. So I experimented a bit with tcpdump, but I haven't been able to see the complete http request. Probably probably because HTTP is one level up on the network stack.

ioan 2008-03-28 19:08

Re: Ad blocking
 
I use privoxy and I'm more than happy with it.

iamthewalrus 2008-03-28 20:53

Re: Ad blocking
 
Quote:

Originally Posted by ioan (Post 161589)
I use privoxy and I'm more than happy with it.

I used privoxy as well but it seems to eat up half the bandwidth, while the hosts/userContent.css method does not.

coffeedrinker 2008-03-29 00:23

Re: Ad blocking
 
You really have to be careful which adblock host file you use. I use the one from floppymoose because some I've used in the past blocked a lot more than just ads. If the one you are using isn't suitable, try a different host file.

iamthewalrus 2008-03-29 01:10

Re: Ad blocking
 
Quote:

Originally Posted by coffeedrinker (Post 161816)
You really have to be careful which adblock host file you use. I use the one from floppymoose because some I've used in the past blocked a lot more than just ads. If the one you are using isn't suitable, try a different host file.

Floppymoose only has an example userContent.css file, not a hosts file. Still I would prefer to test and tweak the hosts file myself, so my question remains how to log what has been blocked by it.

coffeedrinker 2008-03-29 03:31

Re: Ad blocking
 
Heh, yep, I got that wrong. I'm way over tired.

I use the same file you listed above:

http://everythingisnt.com/hosts.html

but I don't have seem to have trouble with it.

Redshift 2008-03-29 08:31

Re: Ad blocking
 
I feel really stupid for asking this question, but I tried saving the userContent.css file to a few places and then found it via xterm. However, it won't let me do the command "mv userContent.css /home/user/.microb/chrome". It gives me the error:
"mv: cannot rename 'userContent.css': No such file or directory." What's going on?

iamthewalrus 2008-03-29 08:53

Re: Ad blocking
 
Quote:

Originally Posted by Redshift (Post 161902)
I feel really stupid for asking this question, but I tried saving the userContent.css file to a few places and then found it via xterm. However, it won't let me do the command "mv userContent.css /home/user/.microb/chrome". It gives me the error:
"mv: cannot rename 'userContent.css': No such file or directory." What's going on?

Like the error message said there is no directory '/home/user/.microb/chrome'. You need to create the 'chrome' directory first. B.t.w. another gotcha is to make sure that userContent.css contains unix-style line endings , and it is readable by user 'user'.

Redshift 2008-03-29 09:10

Re: Ad blocking
 
Well, I had made the chrome directory before trying to move it. I also tried moving it to /, /home, those didn't work either, so I knew it wasn't something wrong with the target directory being invalid...

iamthewalrus 2008-03-29 09:18

Re: Ad blocking
 
Quote:

Originally Posted by Redshift (Post 161909)
Well, I had made the chrome directory before trying to move it. I also tried moving it to /, /home, those didn't work either, so I knew it wasn't something wrong with the target directory being invalid...

You forgot to put the filename at the end of the command:

mv userContent.css /home/user/.microb/chrome/userContent.css


All times are GMT. The time now is 16:27.

vBulletin® Version 3.8.8