This is a blog about AAC or Adventures and Annoyances in Coding.
Don't wanna be here? Send us removal request.
Link
0 notes
Text
Here's something I always forget in VB6
So if then else statement in VB6. Well it goes like this:
If variable = 0 Then SOME CODE ElseIf variable = 1 Then SOME CODE End If
However, if you write it like this:
If variable = 0 Then SOME CODE ElseIf variable = 1 Then SOME CODE End
it will pass if you press Start and try to debug. but if you compile/make this then you get an error Functionality not supported in DLL. The problem is that if you don't make the project, you might encounter this error very late and be totally confused with the message. I know I have been, not only once.
So I always use Start with Full Compile, instead just Start option.
0 notes
Photo

Arduino and motion sensor. Here I didn't have breadboard nor proper wires. Mess.
0 notes
Text
Life, Raspberry Pi, Arduino, Experiments
It's been a while since I added a post here. It's mostly because I was occupied with some coursera courses, learning french and also my full time job. On my job we were doing one quite interesting project finally using something new like WCF and Entity Framework.
But there has been some wrestling with VB6 which is annoying to the bones because every second line in the project is a trap. Either it's something monolythic copy pasted from God knows where. It could be something that I would call reversed logic, like when it's completely opposite from what would you normally expect etc. Oh then binary compatibility nightmare where I have to copy paste dll from some central machine that we are using for compiling VB6, to my machine and then make the code. Then putting this dll on your computer to act as proxy, and on the actual server putting compiled version from that machine etc. It's legacy code and it's full of traps!
Oh I was using some PHP gif manipulation which was frustrating a lot because at the end of the day you find out that some PHP basic functions have bugs. Like a bug where if you separate animated gif into frames and try to get size of each frame, getimagesize gives wrong result, so I had to use Imagemagick.
But there have also been some happy moments!
On coursera I am taking Algorithms: Design and Analysis Part 1 by Tim Roughgarden and I must say it's an excellent course. I am taking it because even though I finished University, the algorithms were always my weak spot. I mean I know a lot of software engineering concepts, software architectures etc. but I believe I lack algorithm knowledge. My plan is to take Part 2 next, and after that I want to take Machine Learning, that I failed to follow miserabely.
Anyway, a lot has been happening. It seems that my Raspberry Pi problems concerning ssh unavailability were actually connected with non constant power voltage or something like that. I am powering it with some cheap mobile phone charger, and it seems that during the winter power voltage was not constant(I don't know how to express this in engineering terms). So now it's running for a week already. I was also trying installing autossh because I thought it was a problem with ssh keys but seems the problem was power.
I have also bought Arduino and some sensors. Every time I start it I find that I miss something. First I bought Arduino, temperature/humidity sensor and some ultrasound detector. I am buying stuff on ebay and some chinese super cheap page lightake.com, everything is working for now. Then I bought led, then I found out that I need resistors. After that found out I should better buy breadboard, and then wires. I mean it's actually fun finding out this stuff, I really wish I had access to all this while I was younger, I believe I would understand electronics much better. I tried this ultrasound sensor. What I would perhaps like to try to achieve is to connect Arduino to RPi to make some surveillance system, where upon some move or sound(oh yes sound sensor is arriving too) I would through RPi somehow notice myself about something happening in my room. But I need to learn and relearn a lot about electronics, I forgot all basics that I knew like ohm's law, resistors, capacitors etc.
Stay tuned, I have been playing with Ruby on Rails too.
1 note
·
View note
Text
Raspberry Pi, Yaws, port forwarding and evil Squid
Last week I was trying to set up Yaws web server to serve dynamic web pages written in erlang. I thought that I succeeded because I was accessing it from my mobile device and computer. But what I forgot to notice was that I wasn't on 3G network, I was on local network. So next day I was going to work and couldnt access my webpage from the bus.
I thought it was probably a configuration issue of Yaws web server. When I got back from work I was trying all combinations to figure the problem out, but I wasn't able to solve it. I thought it might be because I made local_install from Yaws source but I wanted to be sure before reinstalling it. After that I figured out that the page was reachable from computer on my work, and also from friend's iphone. I was like omg it is probably IE problem on Lumia, but it wasn't. I found out that my mobile carrier is using Squid proxy for optimizing network traffic, so I thought it is refusing connections to my web page. So I called technical support but they didn't hear about Squid. And I was trying to figure out what else can I do, so i tried to open port 80 on router and make a port forwarding toward Yaws. And it worked.
The conclusion is that Squid proxy was for some reason blocking port 50001, and it works on port 80.
However... i wasn't connecting to my Raspberry Pi for few days now, because of New Year etc. and now it is refusing SSH, doesn't serve web page etc :(. So, I can't access it remotely, and I don't have a screen connected to it. It seems that I have to regenerate SSH keys, as answer in this question suggests. But... tomorrow.
I also bought a new charger so RPi is online 24/7.
0 notes
Text
Erlang Yaws on Raspberry Pi
Yesterday I installed Yaws server with apt-get install option. When you do that it is kind of not clear what version you'll get, as Steve Vinoski says on stackoverflow answer so I have removed it from the system and built it from the source, as Vinoski states in his answer. After that it was much easier, everything was put into my user account directory. it was also much easier to figure out where to make changes to support more ports on localhost. So I put application on localhost:8081 and mapped it on my router to be available from outside.
And after that I was trying to follow instructions in book Building Web Applications in Erlang, an example from page 52, extract can be found here. And it says that I should put mnesia initialization into .erlang file, what it doesn't say is how the hell can I make airport record available in the .erlang file. I have to figure that out, when i hup yaws server it reports:
pi@raspberrypi ~ $ ./bin/yaws --hup
=ERROR REPORT==== 26-Dec-2012::21:01:09 ===
file:path_eval([".","/home/pi"],".erlang"): error on line 3: 3: evaluation failed with reason error:{undefined_record,airport} and stacktrace [{erl_eval,exprs,2,[]}]
hupped: ok
I am not sure how to fix this, the instructions are so vague. Tomorrow I have to go on my job, so I hope to fix this tomorrow night, or go to some simpler examples first!
P.S. I have to find out how to write code here to look like on stack overflow.
0 notes
Text
Raspberry Pi DynamicDNS and XBMC
Today I was trying to use dynamicDNS on my raspberry pi. As I was not experienced with it I have been trying to use freedns and ddclient. That was a fail. Because ddclient does not support freedns out of the box I was searching on forums and figured out that some patch is needed. But I decided to find a script on freedns that will update freedns. I used this script but I have no idea what is rc-update, so I would have to learn concepts behind it and after already few hours of surfing I hoped for some simpler idea, so I ditched that idea too. On my router, which is Thomson ST780 I found option for dyndns, and tried to put freedns there, but the update of IP address was failing. So I switched to no-ip.org. Opened a new host and entered it into this router dynamic dns. It works.
And the other part, so it seems that this router has options for port forwarding. After some time of trying to figure out what does port trigger mean I found some old pdf manuals for this router and figured out that port triggering should be left blank. So now I am forwarding port 49999 on router to 22 on raspberry pi. Putty ssh works now. Btw don't forget to change password once you put raspberry pi available on the net. Ok so there was only one more thing I wanted to do now. it was RDP (Remote Desktop) availability. And all I did was adding another port forwarding rule for port 50000 on router to 3389 on raspberry pi.
And it works! :D
Btw yesterday I was trying to put xbmc on my raspbian, but I didn't manage to do it. First I followed this raspbianXBMC instructions and then I found out it needs 12h to compile, so I stopped. Then I tried these instructions to install from already compiled version, but I failed on sudo apt-get install xbmc, dependencies could not be resolved. I will try tomorrow or some other day some new approach again, probably comiling from source, 12h. I mean the reason I stopped for the first time was that I had to fill my Nokia Lumia, and I didn't have spare charger.
If you need some help with this you can send me a message to avoid some time wasting.
1 note
·
View note
Text
Just got a Raspberry Pi
Yesterday I got a Raspberry Pi, immediately bought 16GB microSD card with adapter, installed Raspbian wheezy, used my Nokia Lumia USB charger as a power source.
I bought also an HDMI cable and to connect it to TV. As my TV is pretty far from the nearest router, I remembered that I have old USB WiFi adapter, so I found it and surprisingly it installed drivers automatically and almost immediately wlan was working. It is D-Link USB adapter .
After that I installed Chromium browser. I am a bit dissapointed for not being able to play Youtube videos but I think it can get managed. I also installed VLC but perhaps RaspBMC is a better alternative, I want to install it on existing Raspbian distribution, and not from the image on their site.
Also, I installed erlang with apt-get without difficulties. The next thing I will probably try to do is install Yaws and connect it with dyndns.
Also, accessing it with putty works like expected, I found IP address of Pi on my router, it is identified as raspberrypi on it. And I have put xRDP on it, so I can access it via Remote Desktop from Windows and it works ok.
I haven't thoroughly tested all the things mentioned in the post, but all of them seem to work.
1 note
·
View note
Quote
Hard Work Beats Talent When Talent Fails To Work Hard
Kevin Durant
0 notes
Conversation
Question
Colleague: What will this return in SQL? SELECT - - - - - - - - - - - - - 1 - - - - - - - - - - - - - - - 1
Me: -2 :)
0 notes
Quote
Live in the future, then build what's missing.
Paul Graham on how to get startup ideas
3 notes
·
View notes
Photo
Coding horror.
We have a wizard, .NET and modified version of ADO recordset. The controls are bound to the recordset. The recordset always has only one row.
What happened here today was that when assigning to MasterRecordset[0]["reference_orderer"] a value of concat.Trim(), the recordset automagically returns values that were initially loaded when wizard was loaded, and since they are bound to UI controls like numericEditBoxAccInterest control they lose changes from the previous wizard steps. So on the next line when updating accrued_interest it just overwrites itself with the same value.
This is pretty annoying I lost like an hour to find the problem and I was fixing the form the whole day already. I haven't found real solution because of time constraints. What I did is that I just saved numericEditBoxAccInterest.Value to temporary variable and later applied that value to accrued interest in recordset and now it "works".
0 notes
Video
vimeo
Interesting talk about open source Erlang VoIP implementation. I was recently thinking about would it be a good idea to create a VoIP implementation that works only inside a LAN or VPN network. I am not good at network infrastructure so this might be an insane idea, it can probably be made by network configuration.
Actually I was thinking about the idea of a unified communication system that would allow voice and chat only inside a LAN or VPN, with logging of calls and messaging. In that way you can guarantee to institutions like banks which need high security, that your system is far more secured because it cannot be used from outside of the network and it stores communication of the users.
0 notes
Quote
With a physical keyboard, I actually find myself working faster on the iPad than I do on a regular computer because I’m less distracted thanks to the one-app-at-a-time aspect.
MG Siegler about how it's great to have open only one app at a time on the screen. Yeah right, true innovation.
0 notes
Quote
Your users are stupid. Really stupid. You can't believe how stupid they are, they constantly forget how to do simplest things and often make dumb mistakes with your applications. You never consider maybe it's your application that’s stupid because you're incapable of writing decent software.
Damien Katz in Signs you are crappy programmer (and don't know it)
0 notes