Author: Per Thykjaer Jensen

  • Jquery first fiddle

    Here is a very, very short Jquery introduction on Jsfiddle.



    After a while the document ready function becomes boring. However there is a shorthand version:

    $(function() {
        // ... your code ...
    });
  • Apple Refuses to Hack a Backdoor on the iPhone

    The United States government has demanded that Apple take an unprecedented step which threatens the security of our customers. We oppose this order, which has implications far beyond the legal case at hand.

    This moment calls for public discussion, and we want our customers and people around the country to understand what is at stake.

    The company behind the iPhone refuses to hack backdoors for the iPhone in this appeal to the costumers. Their costumers need the security. The problem is not just the security of americans – but for everyone on the planet using software.

    While we believe the FBI’s intentions are good, it would be wrong for the government to force us to build a backdoor into our products. And ultimately, we fear that this demand would undermine the very freedoms and liberty our government is meant to protect.

    Read the appeal here.

  • David McCandless: The beauty of data visualization (TED)

    “David McCandless turns complex data sets (like worldwide military spending, media buzz, Facebook status updates) into beautiful, simple diagrams that tease out unseen patterns and connections. Good design, he suggests, is the best way to navigate information glut — and it may just change the way we see the world.” (Source TED)

    Data visualization is a huge topic on TED. Here is a collection: TED Visualizations.

  • SVG

    In order to use .svg on WordPress pages. First open the text editor, then: wrap the svg inside code and pre tags. Then the svg will display.

    
      
    
    

  • ER Diagram Solutions

    Cardinalities

    How do you solve cardinalities such as:

    • One to many.
    • Many to many.
    • Multivalue attributes.

    Here are some suggestions.

    A student drawing en ER-Diagram

    Two students explaining ER-Ds

  • Lecturer Exchange With the University of Regina

    Webcam at the University @ Regina, Saskachewan
    Webcam at the University @ Regina, Saskachewan

    Lecturer Exchange

    During March 2016 I’ll travel to the University of Regina in Saskachewan, Canada, and present a talk or workshop about storytelling and blogging at the Faculty of Media, Art and Performance.

    There are close links between multimedia, art and performance – and I hope that the exchange will give new engergy and inspiration to teachers and students in Regina and at the Multimedia Design and Communication Programme in Aarhus.

    At the University I’ll visit lecturers and classes. Of course it’s still work in progress, but so far the plan for the topics is:

    • How fine art exhibitions may benefit from a social media strategy.
    • Storytelling and creative writing for the web.
    • How to make stunning WordPress web sites.
    • Developing wikis as a research tool.

    Later on we hope to see lecturers from Regina at Business Academy Aarhus.



  • Winter in Aarhus

    https://www.flickr.com/photos/pertjensen/23872034673/in/datetaken-public/

  • Python and Philips Hue

    Python and Philips Hue

    The Tkinter window
    The Tkinter window

    By Philips Hue you can control lamps in your home. The lamps are commanded to change color, dim or whatever via JSON PUT. And that’s a cool feature, because you can use JSON with tons of languages such as JavaScript, Jquery, PHP, Lua, Ruby … and of course Python. Here is a very simple Python Tkinter GUI.

    Online you can find tons of Apps. But it is much more cool to write your own code.

    First you have to register a user or get an API key from the box. Register as a developer at meethue. Follow the steps in order to get a whitelisted user, or simply get an API key. Then you are ready to go.

    Python Libraries

    First you have to prepare Python and import libraries:

    from Tkinter import *
    import requests
    import json
    1. Tkinter is a library for GUI making.
    2. Requests is used for POST, GET and PUT with JSON.
    3. Json is Json.

    The GUI class

    Here is a autorunning class called Lamper (i.e. lamps in Danish). First a frame is defined. You can compare the frame with a canvas. It’s where stuff happens. Then we add a label and two buttons. Here you only see the first button:

    class Lamper:
    
        def __init__(self,master):
    
            frame = Frame(master)
            frame.pack()
    
            ''' label '''
            self.label = Label(frame,text="Hue: all lights on / off panel")
            self.label.pack()
            
            ''' turn off light '''
            self.button = Button(frame,
                text="Off",
                fg="red",
                command=self.off)
    
            self.button.pack(side=RIGHT)
    

    The Tkinterbutton has a command. It’s the command=self.off. This line will invoke a function if you click the button. The function looks like this:

        def off(self):
                self.taend = json.dumps({"on":False})
                self.r = requests.put("http://192.168.0.xxx/api/xxxxxxxxxxxxxxxxxxxxxxxxxxxxx/groups/0/action", data=self.taend)

    The second button is constructed in more or less the same way. However the line where you turn off the lamps must be changed: self.taend = json.dumps({“on”:True}).

    Save your work

    • Save your file e.g. as myHueOnOff.py
    • Now try out your program, in a terminal window write:
    python myHueOnOff.py

    If you’re lucky you’ll see a window with two buttons. Try to press the off button. If they dim down to darkness … well then this is a very cool starting point to a new adventure in home automation.

    Perspectives

    Json is a cool data exchange format. You can get all kinds of data via Json. For instance you can get the temperature from the open weathermap API.

    Then you could make a lamp that turns blue in the morning if it’s freezing outside. If you’re on a unix-like system, such as Linux or Mac, the program could fire off via CRONTAB every morning when you rise.

    Get the code from Github

    Here is the code from Github.

  • Vi – cheat sheet

    the vi editor
    Vi with line numbers, dark background and colored syntax in a markup environment.

    Vi is a very powerfull editor, that is … for the initiated. Here are some of my favorite vi commands:

    Colors, syntax, write, quit

    • :syn on – colored syntax
    • :syn off – no colored syntax
    • :set number – line numbers
    • :set background=dark – better color contrast in a dark terminal window
    • :q! – quit without saving
    • :w – save
    • :wq – save and quit

    Copy / Paste

    First mark some text. Move the cursor to the beginning of whatever should be copied. Then press v. Now you can mark something. Press Y to yank or d to delete (= cut). Move the cursor to where you want to put the clipping or copy. Then press p.

    Save Your Favorite Settings

    You may want to save your favorite settings. Vi use the file .vimrc – my .vimrc looks like this:


    set number
    set background=dark
    syn on
    set autoindent
    set shiftwidth=4

  • Bootstrap Menu Builder

    Bootstrap Menu Builder
    Bootstrap Menu Builder

    Building menus in Bootstrap is complicated. And boring because you’ll have to write the same stuff over and over again. Perhaps you could write some PHP functions to do the trick. But what is somebody else developed the tools?

    So I began to google for Bootstrap tools. Here’s a usefull tool for menu building:

    In this builder you can build the menus. Drag and drop to submenus ( the menu item will indent a bit ). The HTML and CSS will be made automaticly. There are even some gradient options. But here I’d prefer to craft the stuff myself via SASS / Compass or even plain CSS.

    If you build a menu, you can download the HTML and CSS. Include this via PHP and you’re up and running in no time.

    So why not try the Bootstrap Design Tools?

     

  • Set up simple webservers

    Here are two ways to test your webpages on simple servers. Open a terminal window in the folder you want to share on the LAN:


    # python -m SimpleHTTPServer 8000

    If you have PHP installed on the system, here’s another method:

    # php -S localhost:8000

    You can also run your php files, and read the error messages if there should be any errors in your code.

    But beware … these simple servers are only meant for development. The methods are not secure at all. So use them wisely.

    In both cases – can open your favorite browser in http://localhost:8000.

  • Learn SASS

    A super fast spoken video. Get inspiration for your SASS studies in the video by Derek Banas.

    30 SASS Videos

    Here’re some 30 videos on SASS. Basicly it’s a good SASSsy course.

Enable Notifications OK No thanks

We use cookies - more information

Multimusen.dk will set a few cookies from Doubleclick, Google and the Social Media plugins they ay set some cookies. Some of my pages use APIs - such as YouTube, LinkedIn, Google Fonts, Google Maps, Mapbox, Spotify, Jetpack, Twitter, Facebook &c.. Such plugins may set the odd cookie.

Close