Re: [OT] Prepaid mobile plans with data, possibly roaming
On 22 August 2012 02:15, Anthony Lucas wrote: > 3 can be quite good with the traffic detection if it's obvious. > > In my experience, 5 or so hours of usage (unauthorised tethering) and they're > on to you. > Pop it back in your phone, reboot or lose the tower, and you're back in > business as far as internet access on the phone, > but you're now on some kind of watch-list and they're a lot faster to catch > on the second time. Ah, really? That's irritating that they bother.. I mean, I'm just using the same bandwidth quota regardless of method :/ Do Three block outbound ports? (ie. Can I just tunnel everything through an ssh or openvpn tunnel so that no traffic inspection can be done..) Toby
Re: How to retrieve a row, biased by populatity?
The single pass approach, as given in perlfaq "How do I select a random line from a file?" adapts to work here too. my $total_weight = 0; my $selected; while ( my $record = get_next_record() ) { my $weight = weight($record); $total_weight += $weight; $selected = $record if $weight > $total_weight * rand; } Weights can be integers or floating point, but must be >= 0. A record is guaranteed to be selected unless all weights are 0 or there are no records.
Re: How to retrieve a row, biased by populatity?
On Tue, Aug 21, 2012 at 9:57 PM, Praveen Chakravarthula < praveen.chakravarth...@gmail.com> wrote: > * Pick a random number between 0 .. 1 from a non-*linear *distribution, > multiply it by the total number of rows. > * SELECT stuff FROM table ORDER BY weight LIMIT rand, 1 > er.. that should read non-uniform distribution. > > > On Tue, Aug 21, 2012 at 9:22 PM, Dave Hodgkinson wrote: > >> >> Possibly a perl question. SQL would do... >> >> Given a set of data, say bands, with each having a ranking, either a >> review metric or a sales ranking, how would you retrieve a random >> row, but biased towards the higher ranking? >> >> >
Re: How to retrieve a row, biased by populatity?
* Pick a random number between 0 .. 1 from a non-linear distribution, multiply it by the total number of rows. * SELECT stuff FROM table ORDER BY weight LIMIT rand, 1 On Tue, Aug 21, 2012 at 9:22 PM, Dave Hodgkinson wrote: > > Possibly a perl question. SQL would do... > > Given a set of data, say bands, with each having a ranking, either a > review metric or a sales ranking, how would you retrieve a random > row, but biased towards the higher ranking? > >
Re: How to retrieve a row, biased by populatity?
On Tue, Aug 21, 2012 at 9:22 PM, Dave Hodgkinson wrote: > > Possibly a perl question. SQL would do... > > Given a set of data, say bands, with each having a ranking, either a > review metric or a sales ranking, how would you retrieve a random > row, but biased towards the higher ranking? > > SELECT * FROM band ORDER BY ranking - RAND() * $BIAS DESC LIMIT 1; Fahad.
Re: How to retrieve a row, biased by populatity?
Sort them by metric and then select the row n where n is a biased random number between 0 and 1 mutliplied by the number of records and integer. The question is then how to generate 'n' and that depends on what you mean by 'biased'. You need to create a function which maps equally distributed random numbers between 0 and 1 to numbers distributed in the way you want, which could be something like n = 1 - rand()^2. Daniel On 21 August 2012 21:22, Dave Hodgkinson wrote: > > Possibly a perl question. SQL would do... > > Given a set of data, say bands, with each having a ranking, either a > review metric or a sales ranking, how would you retrieve a random > row, but biased towards the higher ranking? >
Re: How to retrieve a row, biased by populatity?
On Tue, Aug 21, 2012 at 09:22:42PM +0100, Dave Hodgkinson wrote: >Given a set of data, say bands, with each having a ranking, either a >review metric or a sales ranking, how would you retrieve a random >row, but biased towards the higher ranking? Broadly: convert each ranking into a weight (larger number = "better" item), then index randomly into the weight space. @itemid=(...); %weight={id1 => weight1,...}; @weightspace=map {($_) x $weight{$_}} @itemid; $chosenid=$weightspace[int(rand()*scalar @weightspace)];
Re: How to retrieve a row, biased by populatity?
On Tue, Aug 21, 2012 at 4:22 PM, Dave Hodgkinson wrote: > > Possibly a perl question. SQL would do... > > Given a set of data, say bands, with each having a ranking, either a > review metric or a sales ranking, how would you retrieve a random > row, but biased towards the higher ranking? > If you have access to a copy of _Mastering Algorithms with Perl_, it had some examples like this in chapter 14. The sample code can be downloaded from O’Reilly: http://examples.oreilly.com/9781565923980/ The one you’re interested seems to be the rand-dist-weighted example, pasted below: $ cat rand-dist-weighted #!/usr/bin/perl # $selection = rand_dist_weighted( \%dist, \@key_order, $total_weight ) # Select an element from %dist. The total of the weights, and the # keys sorted by their weights can be provided, or else they are # computed. sub rand_dist_weighted { my( $dist, $key_order, $total_weight ) = @_; my $running_weight; $key_order = [ sort { $dist->{$a} <=> $dist->{$b} } keys %$dist ] unless $key_order; unless ( $total_weight ) { foreach (@$key_order) { $total_weight += $dist->{$_} } } # Get a random value. my $rand = rand( $total_weight ); # Use it to determine a key. foreach my $key (@$key_order) { return $key if ($running_weight += $dist->{$key}) >= $rand; } } %smartie_weights = ( orange => 3, green => 10, pink => 8, brown => 10, tan => 0, red => 6, blue => 11, yellow => 7, purple => 5); print rand_dist_weighted( \%smartie_weights ), "\n"; $smartie_weight = 0; @smartie_order = sort { $smartie_weights{$a} <=> $smartie_weights{$b} } keys %smartie_weights; for (@smartie_order) { $smartie_weight += $smartie_weights{$_} } for ( 0..50 ) { print rand_dist_weighted( \%smartie_weights, \@smartie_order, $smartie_weight ), "\n"; } -- Chris Devers
How to retrieve a row, biased by populatity?
Possibly a perl question. SQL would do... Given a set of data, say bands, with each having a ranking, either a review metric or a sales ranking, how would you retrieve a random row, but biased towards the higher ranking?
Re: [OT] Prepaid mobile plans with data, possibly roaming
On Tue, 2012-08-21 at 17:15 +0100, Anthony Lucas wrote: > 3 can be quite good with the traffic detection if it's obvious. > > In my experience, 5 or so hours of usage (unauthorised tethering) and they're > on to you. > Pop it back in your phone, reboot or lose the tower, and you're back in > business as far as internet access on the phone, but you're now on some kind > of watch-list and they're a lot faster to catch on the second time. There are many ways to do this. If your phone/device supports it I suspect using the device as a wifi hotspot is among the safest but it's true that they are perfectly well able to detect it.
Re: [OT] Prepaid mobile plans with data, possibly roaming
3 can be quite good with the traffic detection if it's obvious. In my experience, 5 or so hours of usage (unauthorised tethering) and they're on to you. Pop it back in your phone, reboot or lose the tower, and you're back in business as far as internet access on the phone, but you're now on some kind of watch-list and they're a lot faster to catch on the second time. -- Anthony Lucas Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Tuesday, 21 August 2012 at 16:38, Jason Clifford wrote: > On Wed, 2012-08-22 at 00:53 +1000, Toby Wintermute wrote: > > Are they likely to even notice if I'm tethering it, sans that fiver? > > > They *can* detect what you are doing based upon user agent detection and > other traffic signatures if they want to. > > My experience is that they cannot be bothered and I suspect they wont be > for anyone who isn't considered to be taking the piss. > > > Now to see if I can get a 3 SIM dispatched to where I'll be staying > > first up in London.. :) > > > > > Pop into a 3 shop and pick one up. Simples
Re: [OT] Prepaid mobile plans with data, possibly roaming
On Wed, 2012-08-22 at 00:53 +1000, Toby Wintermute wrote: > Are they likely to even notice if I'm tethering it, sans that fiver? They *can* detect what you are doing based upon user agent detection and other traffic signatures if they want to. My experience is that they cannot be bothered and I suspect they wont be for anyone who isn't considered to be taking the piss. > Now to see if I can get a 3 SIM dispatched to where I'll be staying > first up in London.. :) Pop into a 3 shop and pick one up. Simples
Re: [OT] Prepaid mobile plans with data, possibly roaming
On Tue, Aug 21, 2012 at 3:48 PM, Nuno Jesus wrote: > I'm also going to London very soon and I was thinking to order a giffgaff > SIM card. They seem to have the best prices. Am I missing something? I use giffgaff and they're absolutely fine, even great, for phone and mobile data service, but I use a 3 mifi for general data tethering applications when the need arises (rather than turn my phone into a battery-sucking hot brick). They're much more set up for this sort of thing than giffgaff are too (e.g. being able to buy a "daily pass" 500Mb for £2.99 -- which actually lasts for up to 48 hours if you get your timings right). Also, being able to buy SIMs/top-up vouchers pretty much anywhere is a boon, too.
Re: [OT] Prepaid mobile plans with data, possibly roaming
On Wed, Aug 22, 2012 at 12:53:36AM +1000, Toby Wintermute wrote: [...] > Now to see if I can get a 3 SIM dispatched to where I'll be staying first up > in London.. :) There's no need. You can't throw a stone in London without hitting at least three shops that will sell you SIMs and top-up vouchers.
Re: [OT] Prepaid mobile plans with data, possibly roaming
On Wed, 2012-08-22 at 00:53 +1000, Toby Wintermute wrote: > On 21 August 2012 01:17, James Laver wrote: > > They're claiming truly unlimited actually. For an extra fiver they even > > officially permit tethering. > > Are they likely to even notice if I'm tethering it, sans that fiver? > (I've always wondered how on earth they could tell) User-agent sniffing of HTTP traffic is the usual method, I believe.
Re: [OT] Prepaid mobile plans with data, possibly roaming
On 21 August 2012 01:17, James Laver wrote: > On Mon, Aug 20, 2012 at 04:03:43PM +0100, Peter Corlett wrote: >> [0] The unlimit appears to be of the order of a few gigabytes. > > They're claiming truly unlimited actually. For an extra fiver they even > officially permit tethering. Are they likely to even notice if I'm tethering it, sans that fiver? (I've always wondered how on earth they could tell) (I'm on a Samsung Note w/Cyanogen 9, so there's not going to be any firmware tethering lockout going on here) Cheers for the advice, everyone! Now to see if I can get a 3 SIM dispatched to where I'll be staying first up in London.. :) Toby -- Turning and turning in the widening gyre The falcon cannot hear the falconer Things fall apart; the center cannot hold Mere anarchy is loosed upon the world
Re: [OT] Prepaid mobile plans with data, possibly roaming
I'm also going to London very soon and I was thinking to order a giffgaff SIM card. They seem to have the best prices. Am I missing something? On Monday, August 20, 2012, David Hodgkinson wrote: > What they said. 3. All the cool kids in the Apple stores buy their > iPhones outright and use 3. > > > On 20 Aug 2012, at 15:42, Toby Wintermute > > wrote: > > > Hello all, > > I'm making a whirlwind visit to London and bits of Europe soon, > > although with awfully poor timing, just missing YAPC:EU :( > > Hopefully I'll manage to run into a few of you while I'm in London > though. > > > > The last time I visited, I picked up an Orange SIM that had "Unlimited > > data" on the plan.. only to discover they meant "unlimited, but at > > <5kb/sec". > > > > So this time around I thought I should get some local knowledge. Can > > you suggest a mobile carrier who has: > > * 3G support for prepaid SIMs > > * Has reasonably priced data plans > > * For bonus points -- will work while roaming in Germany. Although I > > suspect I'll just have to buy yet another SIM over there.. > > > > Alternatively.. I'd be happy to just get a data-only SIM and use Skype > > or similar the whole time. > > I hope this isn't too off-topic! > > > > Thanks, > > Toby > > > > -- > > Turning and turning in the widening gyre > > The falcon cannot hear the falconer > > Things fall apart; the center cannot hold > > Mere anarchy is loosed upon the world > > -- Nuno Jesus