Archives 2005 - 2019

Link - Limiting bandwidth (throttling) with trickle

published Sep 19, 2012 06:02   by admin ( last modified Sep 19, 2012 06:02 )

Untested by me, but seems like something that could be used for testing different connection speeds, i.e. to throttle connections a.k.a. bandwidth shaping (just putting in synonyms so I can find this blog post again if and when I need it).

Although this is an old question, I came across this when looking for an answer to the same question. The OS and interface limits are already addressed in an earlier answer, so here is a way to set up application specific limits. Use an application called trickle. So do sudo apt-get install trickle. You can limit upload/download for a specific app by running trickle -u (upload limit in KB/s) -d (download limit in KB/s) application



Read more: networking - How I can limit Download/Upload bandwidth? - Ask Ubuntu


Länk - Histograms in python

published Sep 16, 2012 02:43   by admin ( last modified Sep 16, 2012 02:43 )

 

Generate histograms from the command line. Dependencies Python 2.7 & numpy required, gnuplot for easy plotting.



Read more: SamChill/hist · GitHub


A Plone System Owners' Association?

published Aug 17, 2012 06:26   by admin ( last modified Aug 17, 2012 06:26 )

Quite some time ago (okay, all the way back in 2009!), at a very well arranged world Plone day at Fry-IT in London we sat in groups brainstorming about what a Plone user group in the UK could be about.

I came up with the idea of a Plone System Owners' Association , but the idea did not get traction, at least not during the limited time we had at the meeting.

Mikko Ohtamaa has now (in 2012) posted about the state of Plone, "Making the world to love Plone again", which triggered me to finally publish this:

I still think a Plone System Owners' Association is a good idea, and here is why:

Over the years of teaching Plone I have got in touch with many organisations that have a vested interest in Plone, since they are running Plone installations, from small ones to massive. A couple of things they say are these:

  1. We do not want to upgrade!
  2. We like Product X, but needs it to be updated/changed, how do we go about that?
  3. We tried to contact the maintainer of product X, but got no reply

There may also be in house development of things, that might be quicker, better and cheaper to do if the development effort was shared between several parties.

 

My take on this is that these Plone system owners need to:

  • Know about each other and have a forum to communicate
  • Find a way to:
  • Contact and interact with the developer community
  • Pool funding of development of software and other services for Plone

 

Better formulate what demands system owners have on Plone with regards to

  • Features
  • Usability
  • Upgrade path
  • Legacy support

Make change easier

  • Direct resources to the developer community while delivering value to the system owners
  • Being an open source citizen
  • Getting funding
  • Funding what you want to have done

Now, I am not foremost a Plone system owner, but one example of a cool thing to do, would be to have a script that automatically upgraded a Plone 2.5 site to Plone 4, similar to how 2to3 can upgrade from python 2 to python 3.

I actually think that this could work, parsing python, ZPT and using Diazo. But I am not going to embark on it, but it would not surprise me if a good number of system owner's wouldn't mind chipping in for such a script to come about.

 

 


HTML Canvas Javascript animation toolkit

published Aug 06, 2012 04:41   by admin ( last modified Aug 06, 2012 04:41 )

 

Amino is 2D scene graph library, 100% open source (BSD), for HTML Canvas using JavaScript.



Read more: Amino Java/JavaScript Scene Graph


Design patterns in python

published Aug 06, 2012 04:40   by admin ( last modified Aug 06, 2012 04:40 )




Do you think out of the many patterns some are unnecessary in a dynamic language like Python (e.g. because they are substituted by a dynamic feature)?


Read more: Are there any design patterns that are unnecessary in dynamic languages like Python? - Programmers

 


Although it usually requires some adaptation, Python makes implementing most of the GoF design patterns trivial.



Read more: The GITS Blog » Six GoF design patterns, Python style

 


Generate decent looking PDF docs and charts from JSON

published Aug 04, 2012 10:33   by admin ( last modified Aug 04, 2012 10:33 )


Source code is free, in Clojure. You can call it over http.

This service accepts POST requests with JSON markup at http://yogthos.net/instant-pdf/ and returns PDFs.



Read more: Instant PDF


Att få det mörkt med bibehållen ventilation

published Jul 21, 2012 07:59   by admin ( last modified Jul 21, 2012 07:59 )

Mörkläggande gardiner är ganska trevligt i dessa ljusa sommartider. Problemet är dock att de ofta är täta inte bara mot ljus utan även mot luftväxling. Ett par bastanta mörkläggande gardiner kan ganska effektivt strypa luftväxlingen mellan luften utanför fönstren och rummet.

Tricket är ju såklart att ha en mörk barriär mot ljus, som ju alltid färdas i raka linjer, men samtidigt låta luftväxlingen kunna sick-sacka genom barriären.

Hur ser då en sådan barriär ut? Ja den kan ju såklart se ut på många sätt, men fågeluppfödare använder sig av M-formade kolsvarta profiler ovanpå varandra:


Optimizing breeder performance requires being able to fully block out light, while allowing adequate ventilation for the birds. Dandy corporation has engineered superior light reduction solutions since 1982. Through independant laboratory testing and actual in- field performance, our light traps are recognized around the world for their effectiveness and durability.


Read more: LIGHT TRAPS 1


Ett sätt att få bort fästingproblemet med Borrelia?

published Jul 03, 2012 01:48   by admin ( last modified Jul 03, 2012 01:48 )


På engelska Wikipedia står det uppgifter om att om man reducerar antalet hjortdjur (hjort, rådjur, älg osv) till 8-10 st per engelsk kvadratmil, vilket  motsvarar 3-4 hjortdjur per kvadratkilometer, så upphör spridningen av Borrelia och andra fästingburna sjukdomar.

For example, in the US, reducing the deer population to levels of 8 to 10 per square mile (from the current levels of 60 or more deer per square mile in the areas of the country with the highest Lyme disease rates), the tick numbers can be brought down to levels too low to spread Lyme and other tick-borne diseases.[106] However, such a drastic reduction may be impractical in many areas.

(min fetstil)

Read more: Lyme disease - Wikipedia, the free encyclopedia


Getting comments to work in a Plone 3 to 4.1.5 upgrade

published Jul 02, 2012 01:55   by admin ( last modified Nov 09, 2012 11:56 )

 

Summary

The upgrade machinery from Plone 3 to Plone 4.1.5 does not upgrade the comments, you need to do that manually.

Furthermore, folderish content types may find their commenting disabled. Read on for how to fix this.

 

I upgraded a customer's web site from Plone 3 to Plone 4, and even though commenting seemed to work fine, while commenting it did not show the same context as on Plone 3. Starting up two stock Plone sites, one with Plone 3 and one with Plone 4 showed that you should indeed see context.

What had happened was that the commenting part of the site had not been upgraded, and this left the commenting system in a usable but limited state. The Plone upgrade machinery, which for the most part in my experience does a good job, had missed out on upgrading the commenting part. See this bug report:

https://dev.plone.org/ticket/12184

It also lists the remedy:

In portal_setup / Import select Plone Discussions from profile-dropdown. Click "Import all steps" at the bottom

Once you've done that, you need to visit the Discussions configlet, enable commenting on the site and update all comments to the new system:

 

If you have folderish content types, that may not be enough. The new commenting system will not allow comments on folderish content, from conversation.py in plone.app.discussion.browser:

# Always return False if object is a folder
        if (IFolderish.providedBy(context) and
            not INonStructuralFolder.providedBy(context)):
            return False

Hmmm... There are two ways around this, either make sure that your content types have the interface INonStructuralFolder, or make a copy of conversation.py and simply delete the above if clause in the copy. I wasn't sure what knock-on effects the INonStructuralFolder interface might start in relationship to how the types are being used, so I made a copy of conversation.py, and stuck it in my custom skin product:

<!-- Conversation view -->
    <browser:page
        name="conversation_view"
        for="Products.CMFCore.interfaces.IContentish"
        layer="..interfaces.IThemeSpecific"
        class=".conversation.ConversationView"
        permission="zope2.View"
        />

The layer declaration there seems to overpower the layer declaration of the original conversation_view stanza:

<!-- Conversation view -->
    <browser:page
        name="conversation_view"
        for="Products.CMFCore.interfaces.IContentish"
        layer="..interfaces.IDiscussionLayer"
        class=".conversation.ConversationView"
        permission="zope2.View"
        />

One could also have used an overrides.zcml instead of using a layer to override.

 

 

 


First person view i radiostyrda flygplan

published Jun 26, 2012 06:06   by admin ( last modified Jun 26, 2012 06:06 )

Det blir mer och mer poppis med radiostyrda flygplan med inbyggd videokamera, med videolänk till marken och "piloten".

 

Här två svenska bloggar:

RCexplorer

FPVStockholm - RC and FPV

 

Hittat via DN.

 


Färgerna på klart.se:s regnkartor stämmer inte

published Jun 24, 2012 06:08   by admin ( last modified Jun 24, 2012 06:08 )

Läste om det myckna regnandet på SvD, och följde en länk till regnkartan på klart.se.

 

...men kunde inte riktigt lura ut vilken färg som stod för vilken millimetermängd i nederbörd. Jag bestämde mig för att se om det var mina ögon som lurade mig eller om något var fel på färgerna, genom att klippa ut färgförklaringen och lägga den direkt över nederbördszonerna:

Och då ser man att färgerna stämmer inte. Den enda färg som tycks stämma ungefär är 0,2mm (se bilden nedan), men den passar för zonen med 0,3 mm i kartan såvitt jag kan se.


Länk - Count the number of occurrences of items in a python sequence

published Jun 13, 2012 03:25   by admin ( last modified Jun 13, 2012 03:25 )

Found this on stackoverflow:

dict((i,a.count(i)) for i in a)



Read more: How to calculate the occurrences of a list item in Python? - Stack Overflow


Länk - Kompakt notation för Google Maps

published Jun 03, 2012 03:17   by admin ( last modified Jun 03, 2012 03:17 )

 

gmaps.js Google Maps API with less pain and more fun



Read more: gmaps.js — the easiest way to use Google Maps


How to reach mobile users with a standard web site

published May 29, 2012 02:15   by admin ( last modified May 29, 2012 02:15 )

Lots of people surf on devices with small screens, and it can be a chore to make a web site that scales well to work well on both small and large screens. Redesigning web sites can also be surprisingly expensive.

One way of getting around that hurdle, and possibly save some money in the process, is to have a mobile site that automatically tracks and translates the standard web site, but presents the information in a format that works on the smaller screens.

This is the idea behind mdotit.com, a service Webworks and Colliberty has started. mdotit takes a standard web site and adds a mobile site that automatically updates from the standard site. No installation needed. If this sounds good to you, take a look. If this text sounds a bit promotional, well I am one of the guys behind mdotit :-)


Sajt som redovisar vetenskapligt stöd för olika kosttillskott

published May 23, 2012 12:29   by admin ( last modified May 23, 2012 12:29 )

För en tio år sedan fanns det en liknande sajt som gav info om olika preparat. Kul att se att det kommit en igen.

Examine.com is a science-focused compendium on supplements, nutrition, fitness, and health.



Read more: A Compendium on Nutrition, Health, & Fitness | Examine.com


Make a dummy REQUEST object in Zope debugger

published May 23, 2012 11:42   by admin ( last modified May 23, 2012 11:42 )

It is listed on zope.org, but I'll just paste it in here from their pages in case it disappears:

from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManager import setSecurityPolicy
from Testing.makerequest import makerequest
from Products.CMFCore.tests.base.security import PermissiveSecurityPolicy, OmnipotentUser
_policy=PermissiveSecurityPolicy()
_oldpolicy=setSecurityPolicy(_policy)
newSecurityManager(None, OmnipotentUser().__of__(app.acl_users))
app=makerequest(app)

and then the request object is in app.REQUEST i noticed. I used the code snippet today to figure out why something did not work in portal_transforms in Plone.

Some things you may want to call in the debugger may require a real REQUEST object, as if they were being published on the web. This zopelabs recipe shows how to make one:



Read more: Zope 2 wiki How to fake REQUEST in debugger

 


Krisens konsekvenser förklarade

published May 16, 2012 04:35   by admin ( last modified May 16, 2012 04:35 )

Jag har tidigare försökt förklara den finansiella krisen. Nu när den ekonomiska krisen är över oss, så kan det vara bra att bena ut vad den beror på, och se varför man inte kan expandera sig ur den, med konstgjort låga räntor och andra åtgärder av det slaget.

Vad som hänt då är en stor snedvridning av ekonomin, där massor av människor arbetar med något som inte ger tillräckligt stort ekonomiskt värde för att vara till nytta för andra människor. 

Vad som då kommer att hända är att dessa människor måste sluta arbeta med dessa saker och försöka hitta något att göra som har ett större värde. Innan de hittar detta kommer de ut i arbetslöshet, eftersom det kommer att råda stor förvirring om vad som egentligen producerar ett större värde. Ekonomin går neråt och vi blir alla fattigare och måste arbeta mer, äta mindre, få mindre sjukvård och ta mindre semester osv.

Den ekonomiska kris vi går in i nu, kan bara lösas av att stora grupper människor börjar arbeta med andra saker än de gör idag. Sänkta räntor och stimulansåtgärder förvärrar bara problemet.

Hela länder kan i extremfall komma se sin ekonomi och valuta halveras.

 

Vad som hänt är att människor förletts, eller förlett sig själva, att arbeta med saker och att köpa saker, som till syvende och sist inte haft något stort ekonomiskt värde.

Detta har har lett tlll något som närmast liknar ett fiasko i någon gammal planekonomi.

Om man ser alla lånefinansierade projekt, vare sig det är företagsprojekt eller lån till ett hus, som små rallybilar, så har följande hänt:

- Alla projekten sätter iväg mot framtiden i varsin rallybil. Fast problemet är att kartläsaren inte har koll på var vägarna till framtiden finns, antingen för att han har fått en felaktig karta eller för att han helt enkelt saknar omdöme. Men, det är i all fall massor av bensin i tanken, för den som lånat ut bensinen tror ordentligt på projektet.

Men, så kommer en kris, när man börjar ifrågasätta om man verkligen kör rätt. Bilarna får inte mer bensin. Men då går staten in och häller i mer bensin, och vips så är det fart på rallybilarna igen och de fortsätter att köra efter kartan och eget omdöme. Men till slut får man erkänna att man kört så långt ut i skogen att man får överge bilen.

Mycket förenklat så är det vad som händer just nu. Massor av projekt, företagsprojekt och lån till hus har fått lån fast det visar sig att de som lånat till hus inte kan betala tillbaka, och de som lånat till projekt inte lyckades skapa något värdefullt i sina projekt. Staten går då in och fortsätter ge låga räntor, så att de dåliga projekten kan fortsätta. Men till slut har de som arbetar i projekten kommit till vägs ände och man måste acceptera att det de gjort inte har något större ekonomiskt värde.

Vi har levt i en bubbla, ekonomin har varit överhettad. Jag har inte tidigare förstått vad ordet överhettad betyder när man talar om ekonomi, men det tycks som om att det har att göra med en överoptimism om att i stort sett allt man företar sig kommer att ge stor ekonomisk vinning. Dvs en manisk period i det ekonomiska livet. En viktig komponent i detta kan vara låga räntor: Långivarna är så säkra på att det de lånar ut till kommer att gå bra och ge vinst, så de sätter en låg ränta.

Vad som nu hänt är att räntan satts artificiellt lågt, för att "hålla hjulen igång". Det innebär att manin fortsätter. Men det som behövs är en rejäl höjning av räntorna, så att långivare kan försäkra sig mot dåliga lån. Räntorna kommer alltså att gå kraftigt upp. Dessutom måste många, många människor sluta arbeta med det de gör idag, och göra något annat, eftersom det de gör idag inte uppskattas ekonomiskt tillräckligt mycket av andra. Stora friställningar alltså, följt av en period av smärtsam omställning.

Oron i framför allt euroområdet pressar ned räntorna i Sverige så några kommande räntehöjningar är inte sannolika, säger ekonomijournalisten och privatekonomiska experten Annika Creutzer



Read more: Så påverkas du av nyvalet i Grekland - DN.SE

 

 

Uttalandena från ledande europeiska politiker om Greklands roll i euron spretar rejält.



Read more: EU splittrat om ”Grexit” | Världen | SvD

 


Orbit tower and Tatlin's tower

published May 11, 2012 09:17   by admin ( last modified May 11, 2012 09:17 )

A new tower sculpture has been unveiled in London. In a Guardian Article the designers liken it to the Tower of Babel in the Bible, but I am reminded of Tatlin's tower, a tower sculpture that was proposed in the Soviet Union, but never built.

Tatlin's idea was to create a monument to the Bolshevik revolution, by way of a 400m tower consisting of four suspended geometric structures designed to make full revolutions over different periods of time.


Read more: Bartlett Year 1 Architecture Diary: Tatlin's Tower - Vladimir Tatlin

 

Doing a search and again ending up on the Guardian web site, I realised the designers were indeed inspired by Tatlin's Tower:

Kapoor and Balmond sat down with a sketch pad and thought what the reference points might be. As well as Eiffel, they thought of Tatlin's Tower (the vast constructivist monument conceived for Petrograd in the year of the Russian Revolution, but never built)



Read more: Anish Kapoor's Orbit tower: the mother of all helter-skelters | Art and design | The Observer

 


Link - A wrapper around python's subprocess

published Apr 30, 2012 12:16   by admin ( last modified Apr 30, 2012 12:16 )

 

Envoy: Python Subprocesses for Humans. Note: Work in progress. This is a convenience wrapper around the subprocess module.



Read more: kennethreitz/envoy · GitHub


How to remove all tickets from a Trac instance

published Apr 24, 2012 03:26   by admin ( last modified Apr 24, 2012 03:26 )

Note that this is if you use bash as your shell. Tested on Debian 5. Please note that this is on a strictly "worked for me" basis. Please test it in a safe environment first.

for f in {4..150} ; do trac-admin /path/to/trac-instance ticket remove "$f" ; done

...will delete tickets numbered from 4 to 150 and their associated data. It's ok to overshoot with numbers, the script will chug on.