• How to install Nginx 1.6.0 on Elementary OS.

    install nginx elementary ubuntu
    3
    3 Posts
    1k Views
    ScuzzS
    @Schamper You can build it from source and i think i read that Freya beta will be coming out soon.
  • Graphics Card

    5
    5 Posts
    1k Views
    ScuzzS
    My mate just bought a 280x and he said its amazing. I might spend the extra £50 and get a 290x.
  • What do with a spare computer?

    12
    12 Posts
    1k Views
    ScuzzS
    I think I may have sold it to my mate for like £200 ahah
  • What's your speed?

    8
    8 Posts
    1k Views
    1
    [image: 3537988746.png]
  • Systems programming languages

    3
    3 Posts
    870 Views
    AlmostA
    For anyone who’s interested, here’s a talk from Mozilla on rust: https://air.mozilla.org/guaranteeing-memory-safety-in-rust/ It’s a good introduction to the ideas behind what rust does and why it does them.
  • This topic is deleted!

    Locked
    1
    1 Posts
    11 Views
    No one has replied
  • Water cooling loop

    3
    3 Posts
    652 Views
    ScuzzS
    Well i drained it. With some effort, paper towels and some tilting. All I need now is another heat sync and i’ll have another computer. I was thinking about setting up a server but not sure what for. Maybe a few game servers, minecraft maybe? I can’t really let this i7 go to waste.
  • Android Wear

    19
    19 Posts
    1k Views
    AlmostA
    @Scuzz I don’t think anything actually uses Wear yet. I think the SDK and emulator are just out in beta to get developers a head start. That said, it is android Wear and not android Watch, so I wouldn’t be surprised if Glass ended up with it soon. I would expect wear to have a LOT of different interaction types and each device would only expose those that it supports. It’s definitely something I want. Although the price point is going to be a deterrent for a while (I bet the moto360 is going to cost the same or even more than a full phone)
  • Ghost blogging software, 1 year anniversary.

    4
    4 Posts
    816 Views
    SchamperS
    I’m currently using it more for a “site” than a blog really. http://schamper.nl
  • Buying a Monitor

    10
    10 Posts
    1k Views
    LeoL
    You have 2ms, ha. Sucker.
  • RIP Windows XP

    2
    2 Posts
    814 Views
    SaNiTYs_EnDS
    yaaay my current Operating system is done -_-
  • Chromecast

    1
    1 Posts
    590 Views
    ScuzzS
    Does anyone have a Chromecast? I started to use Netflix over the weekend, I don’t see why I didn’t start using it sooner. I have a “Smart” TV and because it is supposed to be smart I presumed there would be a Netflix app available on it. My TV is too old to have a Netflix app according to Samsung even though it has Youtube, BBC iPlayer and even a RightMove app. I had to dust off my PS3 and use that to play Netflix, this also solved the problem of networking up my TV. The main problem in my house is the networking, my TV has only LAN, my Raspberry Pi is only LAN and I don’t have a wireless adapter for it, and the TV in the living room has no network capability. When I want to use a different room to watch anything I usually have to FTP whatever i want to my RPi, unplug it all, take it to the other room and plug it all in. This takes time and effort, in this day and age it seems a bit medieval. I saw Googles advert on http://google.co.uk today for their Chromecast device and it seems to solve all my issues. It’s wireless, plugs straight into HDMI port and it can stream Netflix, youtube and I have read that it can stream UPNP from other devices connected on the same network. This means I can just unplug it from one TV and plug it straight into another without the hassle of all the leads, HDD and power for my RPi. I can still keep my RPi as an XBMC device and use that for my network streaming, I can just leave it switched on and connected up to my router. The only issue I can see with this is streaming 1080p content over wireless. It may not be able to handle it. What are your thoughts on this setup and the Chromecast device? Chromecast
  • Nest

    3
    3 Posts
    749 Views
    S
    I’ve known about Nest for a long while now, but never knew they were bought by Google; @almost your reply in the wearable Android thread makes sense now.
  • Using websockets in your plugin

    1
    1 Posts
    1k Views
    SchamperS
    The Problem Say you want your plugin to communicate between client and server using websockets. There isn’t a documented (or “official”) way on how to hook into the websockets API of NodeBB. I was facing this issue with the Shoutbox plugin, and had to find a clever way to get it to work. The way I found is a bit “hackish” but actually works really well and is now actually being used by a core developer in one of his plugins. The Process of finding a Solution When digging around a bit in the NodeBB source you can see how their socket implementation works. For this we navigate to src/socket.io. In this folder we see some files. You can quickly see that index.js is controlling everything, and that all the other files are socket “namespaces” (e.g. all the socket calls that have the user prefix will be handled by the user.js file. I won’t go into too many details on how this works, you’ll just have to believe me on this :) When playing around with this, you find out that when you add another js file in that folder, you’ll have working sockets on that namespace! But we don’t want to change anything in core… We want to do this from a plugin! We will further investigate one of these files. I chose the modules file because I thought it would fit a Shoutbox the most. It’s some pretty basic stuff in here. SocketModules is defined as a new object, and so is every “module”, like SocketModules.composer. At the very end you can see that this file sets the module.exports to the SocketModules object. This means that when you require(..) this file, you’ll have access to everything in the SocketModules object, but nothing outside of it. This gave me an idea. Exploring the Idea From your plugin you can require(..) files from NodeBB using module.parent.require(..). In this way you can also require the modules.js file like so: var ModulesSockets = module.parent.require('./socket.io/modules'); ModulesSockets will now be whatever this file has given us as their export. In our case, the SocketModules object, which includes everything that was defined in the modules.js file, which are basically all the socket handlers for the composer, chat, etc… Here I enter my idea: What happens if I add my own custom sockets to this object? I simply tested this with something like this (from within my plugin): var ModulesSockets = module.parent.require('./socket.io/modules'); ModulesSockets.test = function(socket, data, callback) { console.log("Working?"); console.log(data); callback(null, "It worked!"); } Then, on the client, I entered something like this in the console: socket.emit('modules.test', {data: "Some data"}, function(err, result) { alert(result); }); And hit enter. And it worked! I saw the logs in the NodeBB log and was alerted with “It worked!”. Using all this information I came up with the following solution. #The Solution So the solution is quite easy. All you have to do is require the namespace you want to extend, and add your custom handlers. You could even replace the default handlers with your own in this way! In a bit of code: var ModulesSockets = module.parent.require('./socket.io/modules'); ... //I prefer to execute this in the "action:app.load" handler method ModulesSockets.shoutbox = Shoutbox.sockets; //in this case, my handlers will listen to "modules.shoutbox.*" ... Shoutbox.sockets = { //Bunch of socket handlers here } I hope you guys learned something from this :D If you have any corrections or enhancements please call me out on it :P
  • Learning JavaScript?

    4
    4 Posts
    776 Views
    J
    @GoaNy – your avatar needs nyan cat music for full enjoyment
  • Tabs vs Spaces for formatting

    1
    1 Posts
    559 Views
    AlmostA
    There was some confusion in the shoutbox about formatting with tabs and spaces, namely: “Why does it look fine on my computer, but look like shit on github?” The answer is in the difference between tabs and spaces. Part 1 - Tabs vs Spaces In a monospaced font, a space character is exactly 1 character in width. In a monospaced font, a tab character’s width is defined by whatever is rendering it. It is common for a tab character to have a width of 4 characters, but 3, 6, and 8 show up on occasion. For example, this markdown and the gist below it are using the exact same text: Hello - 4 spaces Hello - 1 tab https://gist.github.com/Kern--/52be2592e8517d6b7625 (Sorry -- become – outside of quotes) You’ll notice that the top line looks the same in both places, but the line below it is aligned on the forum, but not aligned in the gist. That’s because the forum uses 4 character wide tabs but the gist uses 8 character wide tabs. Part 2 - Why are tabs stupid? You may be thinking “why would you want tabs to render differently? Why isn’t there a standard width?” The answer is because people have preference. Lets say you think everything should be indented 6 spaces and your reaction is “6 spaces?!? Are you fucking out of your mind? 3 spaces is the perfect indentation!” If I go out and use 6 spaces, while you’re using 3, our code would look terrible and inconsistent and no one is happy. If we both agreed to use tab characters, I can set my editor to display tabs as 6 characters, and you can set yours as 3 characters. Then, we each see indentation how we want and even if we both look at a computer that’s using 8 characters and think “This is the ugliest code ever”, at least the indentation is consistent. So actually tabs aren’t stupid. They allow the look you want without causing inconsistency with other people’s look. Part 3 - Text Editors FTL At some point the idea that tabs are stupid came back. “Why does this look different here? Why aren’t we all seeing the code the same way? Minimizing differences between our view of the code is the only way we can be productive” So let’s pretend we’ve agreed that tabs are dumb. We’ve all decided we can live with 4 spaces of indentation, but I’m a lazy computer scientist and that tab button was really convenient. :/ But wait! We’re not using tabs any more! So the tab button won’t be used, right? Why don’t we make the tab button insert 4 spaces? Most text editors let you override tab to insert a specified number of spaces. That way, you can still use the tab button, but it will look the same for everyone. In my opinion, this is a huge mistake. Especially if you’re using a number spaces corresponding to a common rendering of tab, it makes it easy to accidentally mix them. E.G. on my computer, tab inserts 4 spaces. Then I switch computers and keep working, but I forgot to set the editor on this computer to replace tab characters. Well, if this editor renders tabs as 4 characters, it looks fine on my computer, but once I switch back to my old computer (which used 8 characters), I’ve got the same inconsistency issues I was trying to get rid of! The “replace tab with x space characters” is a useful option for the lazy programmer, but it also pushes the issue into the background, making it easy to accidentally mix tabs back in. Part 4 - Conclusions There were a few things I wanted you to get out of this post: The difference between tabs and spaces Why people want to use tabs Why people don’t want to use tabs How text editors made the whole issue that much more confusing What does this all mean for you? Make sure you know whether the existing codebase is using tabs or spaces AND know whether your editor is replacing tab characters with spaces Keep that in mind, and formatting issues should be easy to resolve. (P.S. the nodebb source uses tab characters) I hope you guys got something out of this. <3 Almost
Online Users