Visio is a great tool for creating explanatory graphics in a hurry. Like the one below.
But one thing that has been botherin me alot is the constant snapping. Snap to grid and snap to object is fine, but snapping fucked up connectors to the middle of your object tends to fuck me over.
However i still got work done and never bother'd to look up how to turn it off. That is untill today, as i sat there spending more than 20 minutes(!) drawing a network diagram.
I will share that know-how:
1. Right click somewhere on the ribbon where there is free space
2. Customice Quick Access Toolbar...
3. All commands --> Snap and Glue --> Add --> OK
4. Voila! You now have a icon on what i assume is the quick access bar, click it!
5. All your snap and glue can now be disabled
Tuesday, November 18, 2014
Friday, October 24, 2014
Friday, October 17, 2014
OPC server not functioning? Turn on PUT/GET
I am currently working on a SCADA project consisting of a number of sensors, computers and Siemens PLC's interconnected with regular ethernet in a managed LAN.
Every PLC has some IO connected, some of witch are sensors that we also want to monitor outside of the PLC. The key element to this is the OPC server SIMATIC NET. This server talks to the PLC's, and makes the different tags available to other pc's.
This makes the OPC server really critical for the function of the other parts of the system.
I literally just spent days trying to get this up and running. Every option was set correctly, except this hidden "enable communication" setting on the PLC:
Every PLC has some IO connected, some of witch are sensors that we also want to monitor outside of the PLC. The key element to this is the OPC server SIMATIC NET. This server talks to the PLC's, and makes the different tags available to other pc's.
This makes the OPC server really critical for the function of the other parts of the system.
I literally just spent days trying to get this up and running. Every option was set correctly, except this hidden "enable communication" setting on the PLC:
Monday, August 18, 2014
Removing severely rusty brake discs
Well, im not big on buying new and expensive cars, loaning money for buying a used car is a form of russian roulette that i don't play. This leads me to always be driving around in throwaway style whip's trying to squeze the most milage out before they can no longer pass the road safety test.
Anyways, my brake system looked like this:
Now im no mechanic, but ey, how hard can it be?
Most stuff about replacing brake parts was found on youtube, but i ran into some trouble when trying to replace the brake discs. 10 years of rust made it impossible to remove the old ones. Luckily the discs are made to be removed by design.
There are two extra holes in the discs. Simply screw any 8mm bolt in there, it will jack the disc straight off! Didn't even have to use a sledgehammer...
New discs, no problems
Anyways, my brake system looked like this:
Now im no mechanic, but ey, how hard can it be?
Most stuff about replacing brake parts was found on youtube, but i ran into some trouble when trying to replace the brake discs. 10 years of rust made it impossible to remove the old ones. Luckily the discs are made to be removed by design.
There are two extra holes in the discs. Simply screw any 8mm bolt in there, it will jack the disc straight off! Didn't even have to use a sledgehammer...
New discs, no problems
Sunday, July 13, 2014
Diskpart fixes broken USB thumb drives
Ever used a thumbdrive for some funky stuff, like shipping a PS2 bootloader or a linux distro and afterwards your drive reports to only being a fraction of it's original size?
A simple format will often fix that, but this time i wasn't so lucky. Even in computer management it was impossible to format the unallocated space.
But there is another tool in the shed, and it's called diskpart.
Simply type diskpart in CMD to start it.
Then follow the procedure below to clean the master boot record on your device and replace it with a fresh new one.
Be aware that choosing the wrong disk in this dialog will ruin your day.
But once that is done you can go format the thumb drive like usual, and it's now back to it's full potential again.
A simple format will often fix that, but this time i wasn't so lucky. Even in computer management it was impossible to format the unallocated space.
But there is another tool in the shed, and it's called diskpart.
Simply type diskpart in CMD to start it.
Then follow the procedure below to clean the master boot record on your device and replace it with a fresh new one.
Be aware that choosing the wrong disk in this dialog will ruin your day.
But once that is done you can go format the thumb drive like usual, and it's now back to it's full potential again.
Such space... wow!
Saturday, July 12, 2014
Single file .exe installer for Get Money Game
Having finished a project is always nice, but when trying to share your work you might find that a few things could be done better. For example it's not very convenient for other people to download shared folders.
And expecting the end user to keep track of the dependencies for you project is something only a Linux developer would consider sane.
This is the reason that the absolute majority of widely adopted software is being distributed as single file installers. Whether it's an self extracting archive, .msi or .exe doesn't matter much, as long as it follows the routine of: 'double click' ---> next ---> next ---> next ---> finish
And so i made my own custom installer for the game i made:
The project is on GitHub (Get Money Game installer)
And the installer can be downloaded directly
Now, this is a bit more work than using Install Shield or the OneClick installer, but it feels damn good to avoid the bloat and junk that comes with Install Shield. Currently the installer just installs, no uninstall is available, but the files are dropped to desktop and you just delete them if you want.
This shows an example on how an embedded resource can be retrieved and used.
And expecting the end user to keep track of the dependencies for you project is something only a Linux developer would consider sane.
This is the reason that the absolute majority of widely adopted software is being distributed as single file installers. Whether it's an self extracting archive, .msi or .exe doesn't matter much, as long as it follows the routine of: 'double click' ---> next ---> next ---> next ---> finish
And so i made my own custom installer for the game i made:
The project is on GitHub (Get Money Game installer)
And the installer can be downloaded directly
Now, this is a bit more work than using Install Shield or the OneClick installer, but it feels damn good to avoid the bloat and junk that comes with Install Shield. Currently the installer just installs, no uninstall is available, but the files are dropped to desktop and you just delete them if you want.
This shows an example on how an embedded resource can be retrieved and used.
Sunday, June 29, 2014
I finally made a 3D game!
It's called Get Money Game
This is the very first 3D game project i have finished. And im rather pleased about the result. I do admit it might not be the most groundbreaking entry in its genre. This is not GTA V for pc, but it's a smooth running FPS with every thing one would expect from a low budget, single dev game.
It includes sound effects, a menu system, background music and a score counter. Also custom textures and instructions.
The description reads as following:
You run around in a randomly generated maze and chase a cube of money.
Every time you find the cube you get stacks added to your score, then
the cube respawns somewhere else in the maze and the game continues.
After two minutes the round is up and you are presented with your
total score so you can take screenshots and brag about it to your friends.
This is one of the cash-cubes you are looking for
All the images are in-game screenshots.
The project is available for download at Github:
https://github.com/studiefredfredrik/GetMoneyGame
The game requires the XNA 4 framework to be installed:
http://www.microsoft.com/en-us/download/confirmation.aspx?id=27598
The installer in a .ZIP here (File -> Save As)
[very long link to a google drive with a .zip file]
Saturday, June 21, 2014
Dealing with complex numbers and equations on the TI84
The TI84 is a graphing calculator from Texas Instruments, and it's been doing a great job of offloading my brain while doing maths for the last few years. I know alot of people that have far fancier calculators, sporting color screens and built in Laplace conversion and Fourier transforms. But the TI84 have always gotten the job done and once you learn your way around the menus it's a really good piece of tech. And also the buttons on it are great.
However when i had my last electronics class i ran into abit of a problem when we started dealing with AC power and every question contained complex numbers. There are two issues:
-The TI84 does not support Matrixes with complex numbers
This almost got me buying a new calculator, but i decided to google for 3rd party apps before buying one. And lo and behold the amazing community around these TI devices came to the rescue:
Linear System Solver 4.0
Frankly this is even better than working with complex numbers in matrixes, as we can avoid setting up the matrixes entirely. Just plug in the equations and you're good to go.
-The TI84 does not fully support degrees when working with numbers on polar form
This issue had me fooled for hours. You see, the TI84 has a setting for working with radians or degrees. And when choosing degrees the calculator spits out answers in degrees. However when giving the input one is forced to always use radians.
Like in this image, what i wanted was to input a vector of length 5 at angle 90 degrees and the calculator gives back a vector of length 5 at 116.62 degrees.
This is actually stated in the manual, but was not particularly intuitive. The soulution is simply converting to radians in the expression ((degrees/360)*2pi).
However when i had my last electronics class i ran into abit of a problem when we started dealing with AC power and every question contained complex numbers. There are two issues:
-The TI84 does not support Matrixes with complex numbers
This almost got me buying a new calculator, but i decided to google for 3rd party apps before buying one. And lo and behold the amazing community around these TI devices came to the rescue:
Linear System Solver 4.0
Frankly this is even better than working with complex numbers in matrixes, as we can avoid setting up the matrixes entirely. Just plug in the equations and you're good to go.
-The TI84 does not fully support degrees when working with numbers on polar form
This issue had me fooled for hours. You see, the TI84 has a setting for working with radians or degrees. And when choosing degrees the calculator spits out answers in degrees. However when giving the input one is forced to always use radians.
Like in this image, what i wanted was to input a vector of length 5 at angle 90 degrees and the calculator gives back a vector of length 5 at 116.62 degrees.
This is actually stated in the manual, but was not particularly intuitive. The soulution is simply converting to radians in the expression ((degrees/360)*2pi).
Thursday, June 19, 2014
Make Excel plot on tick marks
One irritating default setting in MS Excel (at least 2010) is how plots are set to connect with it's axes. This is one of those issues that i find myself changing every time i have to write some report where some quick graphics are in order.
Well, normally the tick marks on the axes corresponds to a value on the plot line by a straight line. So for the X-axis value 10, if you go straight up from that point on the axis one would find the corresponding value on the plot line. However in Excel the default setting is for the value to be between the ticks.
Take a look at this picture, you see the X-axis is skewed. 0 for the X-axis is not in origo, its above the number 0 on the X-axis. For some reason the Y-axis is displayed correctly by default.
Now what you need to do is right click the axis and choose 'Format axis' then on the bottom of 'Axis options' select 'On tick marks'.
Well, normally the tick marks on the axes corresponds to a value on the plot line by a straight line. So for the X-axis value 10, if you go straight up from that point on the axis one would find the corresponding value on the plot line. However in Excel the default setting is for the value to be between the ticks.
Take a look at this picture, you see the X-axis is skewed. 0 for the X-axis is not in origo, its above the number 0 on the X-axis. For some reason the Y-axis is displayed correctly by default.
Now what you need to do is right click the axis and choose 'Format axis' then on the bottom of 'Axis options' select 'On tick marks'.
Wednesday, June 11, 2014
Dropped Plupload and went with AjaxControlToolkit
So it seems the choice of upload control was based on some hasty testing and it turned out my implementation of Plupload did not fix the large file issue (files were transferred but server-side messed up, and no files were saved).
I tried troubleshooting Plupload, but in the process stumbled upon the updated AjaxControlToolkit. Supplied as a NuGet package with excellent setup guide made it hard to resist.
This also forced a update from .NET 3.5 to .NET 4.5, as the updated toolkit requires 4.5. That was merely a symbolic update tho, and no code had to be changed.
As per this commit everything should be functional, i even did some deployment testing this time, and at least a 2.1GB movie transferred without issues.
Project is hosted at github:
The code still contains the legacy Plupload JS, it will probably be removed during the next commit-session.
Tuesday, May 13, 2014
Webpage for uploading really large files to your webserver
Background:
I have a website hobby project named GAC (for reasons not so obvious to anyone thats not me). Anyways, this website is hosted locally only on an old laptop of mine and it is connected to my TV and also an arduino board that drives a couple of SSR's for in-house light switching.
One of the features of GAC is it's mediacenter controls. I would upload a file to the server using SMB on the LAN and the video files then got listed on the website, where i could then start playback on the TV directly from the browser. A handy feature that makes me start playback from any device in the house with a web browser.
Now i'm a C# guy and not much of a web developer, so when i started wandering over to the world of websites i choose the natural path of continuing to use Visual Studio and create websites with ASP.NET.
The problem:
This went great, up till GAC 1.4 when i added a file-upload feature. There is a file upload control in Visual Studio that you can use, but it has one hidden limitation, and it's a big one.
When you add a file to the FileUpload control and call SaveAs the runtime behind that will start buffering the file, so it has the whole file in RAM before it writes anything to disc. Now this is a reasonable aproach for small files as it lessens the disk load, but in my case it meant i would need to alocate many gigabytes of ram just for the file transfer.
I also hit some bogus limitation with web.config not letting me set the MaxRequestLength above ~4gb. And after spending hours on google and not really getting where i wanted i decided to simply ditch ASP.NET and implement some HTML5/PHP magic for this feature.
I went with Plupload, and you can download it here and also get examples and good documentation:
http://www.plupload.com/
I'm very happy with Plupload, it's providing easy and limit-free implementation, that work well with every browser and configuration i have tried.
And as always my project is available on GitHub, called GAC
I have a website hobby project named GAC (for reasons not so obvious to anyone thats not me). Anyways, this website is hosted locally only on an old laptop of mine and it is connected to my TV and also an arduino board that drives a couple of SSR's for in-house light switching.
Showing GAC 1.5 in Chrome |
Now i'm a C# guy and not much of a web developer, so when i started wandering over to the world of websites i choose the natural path of continuing to use Visual Studio and create websites with ASP.NET.
The problem:
This went great, up till GAC 1.4 when i added a file-upload feature. There is a file upload control in Visual Studio that you can use, but it has one hidden limitation, and it's a big one.
When you add a file to the FileUpload control and call SaveAs the runtime behind that will start buffering the file, so it has the whole file in RAM before it writes anything to disc. Now this is a reasonable aproach for small files as it lessens the disk load, but in my case it meant i would need to alocate many gigabytes of ram just for the file transfer.
I also hit some bogus limitation with web.config not letting me set the MaxRequestLength above ~4gb. And after spending hours on google and not really getting where i wanted i decided to simply ditch ASP.NET and implement some HTML5/PHP magic for this feature.
I went with Plupload, and you can download it here and also get examples and good documentation:
http://www.plupload.com/
I'm very happy with Plupload, it's providing easy and limit-free implementation, that work well with every browser and configuration i have tried.
And as always my project is available on GitHub, called GAC
Thursday, April 24, 2014
How to avoid the safe volume 'feature' on Samsung devices
I have a Samsung Galaxy S4, and as with many Samsung devices this phone has a feature that lowers the volume when you put a minijack connector in the headphones jack. The reasoning being that users are idiots, and if this feature wasnt there we would all sit with our headset on at earbleeding volumes till we would need hearing aids.
This 'feature' was never a good idea, but it's made worse by the fact that you cannot turn it off.
And the extra fiddle to adjust the volume up is especially annoying when using the phone to listen to music in the car. A reoccurring annoyment every day.
That is untill now. I found a workaround using the app Tasker. Tasker is an app that lets you configure stuff to happen when different events occur, and as such makes a perfect fit for this problem.
<---The tasker icon. You can find Tasker on the app store for next to nothing.
What we will do is create a task that sets the volume to MAX everytime the headphone jack is plugged in, effectively overriding the 'idiot blocker'.
Step 1: Install Tasker
Step 2: Create a new context by pressing the + sign on the bar at the bottom, you then want to select the "State" context from the menu. (I've already done this, so the finished task is visible in the background)
Step 3: Select State category "Hardware" then "Headset plugged"
Step 4: Create a new task, name it something descriptive like "Volume to max"
Step 5: Add a new action by pressing the + on the bottom bar. Select "Audio" action
Step 6: Then "Media volume"
Step 7: Now just set the volume level to maximum and you've created a nice little tweak for your phone.
This 'feature' was never a good idea, but it's made worse by the fact that you cannot turn it off.
And the extra fiddle to adjust the volume up is especially annoying when using the phone to listen to music in the car. A reoccurring annoyment every day.
That is untill now. I found a workaround using the app Tasker. Tasker is an app that lets you configure stuff to happen when different events occur, and as such makes a perfect fit for this problem.
<---The tasker icon. You can find Tasker on the app store for next to nothing.
What we will do is create a task that sets the volume to MAX everytime the headphone jack is plugged in, effectively overriding the 'idiot blocker'.
Step 1: Install Tasker
Step 2: Create a new context by pressing the + sign on the bar at the bottom, you then want to select the "State" context from the menu. (I've already done this, so the finished task is visible in the background)
Step 3: Select State category "Hardware" then "Headset plugged"
Step 4: Create a new task, name it something descriptive like "Volume to max"
Step 5: Add a new action by pressing the + on the bottom bar. Select "Audio" action
Step 6: Then "Media volume"
Step 7: Now just set the volume level to maximum and you've created a nice little tweak for your phone.
Monday, February 24, 2014
Fixing Aspire 3680 - No sound on headphone jack
I have an old laptop laying around, an Acer Aspire 3680. It's been a thrusty companion for the years i used it. But about a year ago i replaced it with another cheap, slightly newer office spec laptop. And since then my Aspire has mainly been gathering dust altho it's occasionally booted linux, to avoid dual booting my main machines.
But now recently i found a use for this laptop as a Youtube watching station for my treadmill. And so i flushed my linux install and spun up Windows 7 on it. Installed drivers and all was good. Until i mounted it by my treadmill and plugged it to the speakers with the 3.5mm jack.
... and nothing happened. No sound.
After reinstalling drivers, newer drivers and googling a bit i found the solution to be odd, but simple:
Simply putting the computer to sleep.
After waking it up again the audio jack will work just fine.
The headphone jack will continue to work untill you restart the computer. Then you will have to put it to sleep again in order to use the headphones again.
Way back when i used the laptop for work i never turned it off, just put it to sleep, so chances are i this issue has always have been there without me noticing.
But now recently i found a use for this laptop as a Youtube watching station for my treadmill. And so i flushed my linux install and spun up Windows 7 on it. Installed drivers and all was good. Until i mounted it by my treadmill and plugged it to the speakers with the 3.5mm jack.
... and nothing happened. No sound.
After reinstalling drivers, newer drivers and googling a bit i found the solution to be odd, but simple:
Simply putting the computer to sleep.
After waking it up again the audio jack will work just fine.
The headphone jack will continue to work untill you restart the computer. Then you will have to put it to sleep again in order to use the headphones again.
Way back when i used the laptop for work i never turned it off, just put it to sleep, so chances are i this issue has always have been there without me noticing.
Tuesday, February 4, 2014
How to force SQL Server 2012 to do what you want
SQL is a pain.
I've been hating on it ever since i first was forced to use it, about a year and a half ago.
I first started out working with MS Access, and while SQL Server 2012 only sucks about half as much, it's still a sore and painful experience.
Now one of the worst things about SQL Server 2012 is that by default it requires you to be 100% flawless in you database design. You're not allowed to change a single thing after deploying the database, and if you try, then you get this error:
And being a grade A noob at database management i assumed there was no way around this. So i have been redoing entire databases from scripts way to many times now. And i must admit that i got a bit mad when i found the solution to this problem ;)
Just go disable this error dialog in:
Tools -> Options -> Designers
And uncheck "Prevent saving changes that require table re-creation"
And voila! no more silly errors!
I've been hating on it ever since i first was forced to use it, about a year and a half ago.
I first started out working with MS Access, and while SQL Server 2012 only sucks about half as much, it's still a sore and painful experience.
Now one of the worst things about SQL Server 2012 is that by default it requires you to be 100% flawless in you database design. You're not allowed to change a single thing after deploying the database, and if you try, then you get this error:
And being a grade A noob at database management i assumed there was no way around this. So i have been redoing entire databases from scripts way to many times now. And i must admit that i got a bit mad when i found the solution to this problem ;)
Just go disable this error dialog in:
Tools -> Options -> Designers
And uncheck "Prevent saving changes that require table re-creation"
And voila! no more silly errors!
Wednesday, January 29, 2014
How to delete backlog items in TFS
I'm currently taking a course in software engineering, focusing on the agile development model. And in this course we are using Visual Studio Online. Visual Studio Online is an instance of Team Foundation Server (TFS) hosted by Microsoft, and is free for teams up to 5 people (with some restrictions).
And so at this course we are split into groups of 5 for the whole semester, avoiding spending ;-)
Anyways, one of the things i found non-intuitive with TFS was in the handling of backlog and work -items. Especially deleting items.
One would think that just right-clicking on the item would bring up the option, but thats not the case.
And so at this course we are split into groups of 5 for the whole semester, avoiding spending ;-)
Anyways, one of the things i found non-intuitive with TFS was in the handling of backlog and work -items. Especially deleting items.
One would think that just right-clicking on the item would bring up the option, but thats not the case.
Not here |
In order to delete a backlog item you need to doubble-click the item and set it's state to "removed":
Select 'remove' and it will move to trash |
And once selected removed, you can still find the item if you do a query for removed items. The trash can model.
As a first time user i find TFS to be way more time consuming than it should need to.
Sunday, January 26, 2014
Coke is IR transparent
Link here to the original post:
turn-normal-webcam-into-ir-webcam
Now i recently came across something interesting. It turns out that Coke is actually IR transparent. It's rather mind boggeling how something so dark in color can look like water with a NIR camera.
Here are some photos:
In the background you can see the webcam feed, seeing the glass as transparrent |
How a normal camera sees this glass |
Taken with the modified web cam |
Another one |
You can see thru the whole Coke bottle |
Thursday, January 2, 2014
Side-scroller skateboard game with C# and XNA
This summer i was reading this book on game development, and even tho i did make a couple fun projects, i forgot to post them here.
But these past few hours i've been trying to clean up my messy folder structures and import all my repos to GitHub. And going thru all my stuff i found a few nice bits of code.
And this little skating game i made with C# and the XNA framework. The game is called ScrollinBackground.
Skate, avoid the obstacles and grind the rails.
Arrow keys to control the skater.
Space to jump.
Arrow up to grind rails.
Gameplay footage |
Subscribe to:
Posts (Atom)