teleren/devto huggingface dataset:
Runaway SQL Log growth
Tags: itadmin, backup, sqlserver, systemadministratio
Published: 2020-01-27 22:17:46

---
title: Runaway SQL Log growth
published: true
date: 2015-06-12 07:49:57 UTC
tags: ITAdmin, backup, sqlserver, SystemAdministratio
canonical_url: https://www.funkysi1701.com/2015/06/12/runaway-sql-log-growth/
---

Today is my day off, but I wake up and have a quick look at [nagios](https://dev.to/funkysi1701/i-love-nagios-5dlp-temp-slug-241322) to see if there is anything I need to worry about. Yes there is, SQL Server has run out of disk space on its data disk.

I race downstairs and VPN onto the server to find out what has happened. One of my monitoring databases has had runaway log growth and is over 80Gb is size.

> BACKUP LOG [DBName] WITH TRUNCATE\_ONLY  
> DBCC SHRINKFILE(‘DBName\_Log’)

Free disk space is back to normal, all users will be unaware of the problem and everything is fine again. I create a daily job that runs the above code, that way it should stay a manageable size.

Next I need to find out why it happened and to prevent it happening again in the future (Next time I have a day off I want to lie in!)

I check the SQL logs and notice

> BACKUP LOG WITH TRUNCATE\_ONLY or WITH NO\_LOG is deprecated. The simple recovery model should be used to automatically truncate the transaction log.

Then I remember what I have done to cause this issue. I have a separate disk for my backup files and earlier in the week I noticed this disk was filling up, a large amount of space was taken up by transactional backup files. I thought I don’t need to backup the transactions for this non critical database, I will just do a full backup at the start of everyday.

However what I forgot is that a transactional backup keeps the log file under control, once this backup was stopped the log file grew uncontrollably. The answer, change the database from FULL mode to SIMPLE.[![image002](https://i1.wp.com/www.funkysi1701.com/wp-content/uploads/2015/06/image002-300x270.png?resize=300%2C270)](https://i0.wp.com/www.funkysi1701.com/wp-content/uploads/2015/06/image002.png)

This is my understanding of how backups work in FULL mode. A full backup is done at the start of the day which resets the log file, then changes in the database are stored in the log file, this is backed up into a transactional backup and the log file gets reset. If you have regular transactional backups throughout the day the log file doesn’t grow too much, however with no transactional backups your log file contains an entire days worth of changes and so for a monitoring database this could be quite large.

In SIMPLE mode you can’t do transactional backups and the log doesn’t grow uncontrollably. This shouldn’t be used for production databases as if there is a problem you could loose data.

 

The post [Runaway SQL Log growth](https://www.funkysi1701.com/2015/06/12/runaway-sql-log-growth/) appeared first on [Funky Si's Tech Talk](https://www.funkysi1701.com).
Modules not Globals
Tags: javascript, node, programming, development
Published: 2021-03-26 18:46:26

---
title: Modules not Globals
published: true
tags: js,node,programming,Development
canonical_url: http://designfrontier.net/modules-not-globals
---

Often newer JS developers ask when they should turn something into a standalone module. When should that function turn into its own file? There are lots of things we could talk about with componentized architecture. But there is a single thing that should be a massive flashing sign that you need a module.

That thing is global variables. Anytime you touch window. or global. or some other shared variable scope.

Next time you are trying to share things through a global scope... grab a module that you can require into many modules. Usually these wrappers are incredibly light, and they will make your code much cleaner.
Configuring Your Social Sharing Buttons
Tags: socialsharing
Published: 2020-10-05 10:52:25

---
title: Configuring Your Social Sharing Buttons
published: true
date: 2015-06-09 00:00:00 UTC
tags: SocialSharing
canonical_url: 
---

Social sharing button offers an easy way to distribute your content to a wider audience. The major social providers allow options to configure the content that will be shared programmatically. In this guide we explore the options that you can use in order to configure the shared…

   
[Read On](https://www.loginradius.com/engineering/blog/configuring-social-sharing-buttons/)
Don’t Live with Broken Windows
Published: 2022-08-31 18:55:22

---
title: Don’t Live with Broken Windows
published: true
date: 2015-06-08 20:00:45 UTC
tags: 
canonical_url: https://www.funkysi1701.com/posts/2015/pragmatic-programmer-broken-windows/
---

![](https://storageaccountblog9f5d.blob.core.windows.net/blazor/wp-content/uploads/2015/06/1-ucIHdOcnByPsF5eX0j_mhg.jpeg?resize=1024%2C696&ssl=1)

Last night I started reading [The Pragmatic Programmer by Andrew Hunt and David Thomas](https://www.amazon.com/Pragmatic-Programmer-Journeyman-Master-ebook/dp/B003GCTQAE/ref=mt_kindle?_encoding=UTF8&me=).

One practical tip that immediately jumped out at me as useful in my quest to be a better programmer: **Don’t live with broken windows**.

![](https://storageaccountblog9f5d.blob.core.windows.net/blazor/wp-content/uploads/2015/06/tpp.jpg?w=1324&ssl=1)

The theory goes like this: an abandoned building with a single broken window attracts additional broken windows, graffiti, litter, and a sense that no one cares about this building. However this can be avoided if the authorities repair the window straight away.

You can apply this theory to other walks of life, too, like keeping your kitchen clean. After you’ve spent hours cleaning your kitchen to make it spotless, you make an effort to keep it clean. But if your kitchen is piled high with dirty pans, leaving out an extra mug or dirty bowl isn’t going to feel like it makes any difference.

The software engineering implications of this theory are that if you take care to keep your code tidy, it will stay that way. If you know something is broken but never make time to fix it, other bugs and issues will creep into it, until it’s a mess that no one dares touch.

We have a website that is starting to get a bit buggy. It’s not broken, but it’s been a while since anyone has given it any love. Bits of its functionality are starting to get flaky.

Being the only programmer in my place of work, I seldom have time to think about this website — let alone sit down and maintain it.

But the number of related support calls have been gradually increasing — more windows are breaking — and I’m spending more and more time patching its bugs to keep people happy.

Know that I’m aware of the broken windows principle, I know exactly what to do: sit down with this website for a couple of days and find out what exactly is causing these issues.

Then I’ll rebuild the flaky bits, replace the proverbial cracked glass, and wash down a few walls while I’m at it.
Copying files from one container to another
Tags: docker, linux, osx
Published: 2015-06-07 15:56:00

---
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/y9hxcwi5y92j6zfcxbjx.jpg
title: Copying files from one container to another
slug: copying-files-from-one-container-to-another
date: 2015-06-07 15:56
published: true
tags:
 - docker
 - linux
 - osx
---

This only works on OS X as I'm using `pbcopy` and `pbpaste`. You may replace these as you see fit. Also I'm using superdocker here, you can swap that for docker if you like, it makes no difference.

What I needed to do was copy some SSL certificates from one container to another. I wanted the easiest way of doing this for the future. Thus I came up with this somewhat messy solution. I like it though. In this case the source container is called 'registry' and the destination container is a data volume container called 'publisherd-data'.

    superdocker exec -ti $(superdocker ps | grep registry | awk '{print $1}') \
        cat /go/src/github.com/docker/distribution/certs/domain.crt | \
        pbcopy && \
        superdocker run --rm -ti \
            --volumes-from publisherd-data \
            ubuntu bash -c "echo '$(pbpaste)' > /etc/nginx/certs/registry.domain.com.crt"

    superdocker exec -ti $(superdocker ps | grep registry | awk '{print $1}') \
        cat /go/src/github.com/docker/distribution/certs/domain.key | \
        pbcopy && \
        superdocker run --rm -ti \
            --volumes-from publisherd-data \
            ubuntu bash -c "echo '$(pbpaste)' > /etc/nginx/certs/registry.domain.com.key"
            
To break it down, we first grab the certificate by running docker exec on the source container, which we find by doing a quick docker ps | grep | awk.

    superdocker exec -ti $(superdocker ps | grep registry | awk '{print $1}') \
        cat /go/src/github.com/docker/distribution/certs/domain.crt
        
Next we pipe that to pbcopy, the OS X clibpoard utility. 

    superdocker exec -ti $(superdocker ps | grep registry | awk '{print $1}') \
        cat /go/src/github.com/docker/distribution/certs/domain.crt | \
        pbcopy
        
Then we run an ethereal container which we connect to the destination data volume container. We then simply empty our clipboard into the destination file.

    superdocker exec -ti $(superdocker ps | grep registry | awk '{print $1}') \
        cat /go/src/github.com/docker/distribution/certs/domain.crt | \
        pbcopy && \
        superdocker run --rm -ti \
            --volumes-from publisherd-data \
            ubuntu bash -c "echo '$(pbpaste)' > /etc/nginx/certs/registry.domain.com.crt"
            
It's a figurative mouthful, but it does the trick without saving your certs anywhere. You might also want to clear that clipboard afterwards though.

    echo '' | pbcopy
I’m a developer now
Published: 2022-08-31 18:55:41

---
title: I’m a developer now
published: true
date: 2015-06-03 20:00:45 UTC
tags: 
canonical_url: https://www.funkysi1701.com/posts/2015/im-a-developer-now/
---

For a while now I have been at the door of describing myself as a developer, but I think I have finally gone through that door.

It is all a state of mind, its not about having x amount of knowledge, its just about saying “Yeah, I’m a developer now.”

One thing that pushed me through that door, was an application form for something in which I ticked the software developer box instead of the IT Manager box.

The other thing is some of the tasks I worked on recently. One of our databases has a Web Service running that supplies a website with some figures, and we found out recently that this needed changing due to a change on this website. Our contractor quoted us to do this work, I think it was 8 hours. My boss said why don’t you have a go at doing it instead and save us money.

So I had a go, thinking this will take me a couple of days at least, as I will have to figure out how the code works and end up not understanding it. But no I had the changes done in less time than the contractor had quoted us. Go Me! I will say that these changes have yet to be fully tested, so I still might end up spending more time on this.
Shopify Embedded App
Tags: shopify, php
Published: 2020-10-05 11:33:53

---
title: Shopify Embedded App
published: true
date: 2015-06-02 00:00:00 UTC
tags: Shopify,PHP
canonical_url: 
---

Recently, I was working on an implementation to build an embedded app on Shopify with PHP. I realized that the 3rd party PHP SDK recommended by Shopify called "phpish" does not support the feature to "PUT" assets into your shopify shop's theme. The link to "phpish" git repository…

   
[Read On](https://www.loginradius.com/engineering/blog/shopify-embedded-app/)
Share directories between two containers
Tags: docker, linux
Published: 2015-06-01 23:15:00

---
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/y9hxcwi5y92j6zfcxbjx.jpg
title: Share directories between two containers
slug: share-directories-between-two-containers
date: 2015-06-01 23:15
published: true
tags:
 - docker
 - linux
---


_Originally posted on June 1st, 2015_ ([more info](https://dev.to/adamkdean/migrating-to-dev-to-190))

_Note: this was posted back in 2015 during the infancy of docker and modern containerisation. These days, we're able to simply use volumes. For more information on the modern way to do this, see [docker volumes](https://docs.docker.com/storage/volumes/)._

Create data volume container:

    docker run -d \
        -v /var/test/ \
        --name test-data \
        busybox

Start one container using it:

    docker run -d \
        --name test-1 \
        --volumes-from test-data \
        adamkdean/baseimage bash -c "while true; do echo 'ping'; sleep 5; done"

Start another using it:

    docker run -d \
        --name test-2 \
        --volumes-from test-data \
        adamkdean/baseimage bash -c "while true; do echo 'ping'; sleep 5; done"

Attach to the first:

    docker exec -ti test-1 bash
    root@7bfff33a2309:/# cd /var/test/
    root@7bfff33a2309:/var/test# ls
    
Attach to the second:

    docker exec -ti test-2 bash
    root@7bfff33a2309:/# cd /var/test/
    root@69e9a3cc34a2:/var/test# ls
    
Create a file in the first one:

    root@7bfff33a2309:/var/test# touch test-file
    
Check in the second one:

    root@69e9a3cc34a2:/var/test# ls
    test-file
    
Both `test-1` and `test-2` are sharing the data on the data volume container `test-data`.
User Groups and F#
Published: 2022-08-31 18:56:02

---
title: User Groups and F#
published: true
date: 2015-05-30 20:00:45 UTC
tags: 
canonical_url: https://www.funkysi1701.com/posts/2015/user-groups-and-f/
---

For a while I have been threatening to try a user group. Well this week I went to my first meeting.

The user group I went to is called [Leeds Sharp](https://www.meetup.com/Leeds-Sharp/) who are celebrating their third birthday, happy birthday guys and thanks for the cake.

The talk was all about F#. I know nothing about [F#](https://fsharp.org/) other than it is in visual studio. The speaker was [Phil Trelford](https://twitter.com/ptrelford) an expert in F# and former game developer who regularly speaks at conferences. Phil is an expert programmer, one of his stories was that while he had a broken arm, he wrote a copy of Excel in F#. Even with two hands I wouldn’t know where to start on something like that.

![](https://storageaccountblog9f5d.blob.core.windows.net/blazor/wp-content/uploads/2015/05/CGHJLlbWEAAbl14.jpg?w=1024&ssl=1)

There are plenty of advantages to using F# over C#, fewer lines of code was one. In Phil’s example he had some C# code which was about 30 lines but the F# was 2, part of the reason for this is F# has no {}.

I found myself thinking this must be too good to be true there must be some disadvantages to using F#?

I don’t know what they are yet, I am guessing you need to play around with the language a bit to really understand them.

One claim that was made was that F# has less bugs. I am unsure how this can be true. Code is written by humans, humans will make mistakes which ever language they choose, there will be bugs.

After the group I came away with a few things to try out. Try the F# tutorial that can be found in Visual Studio, try a Koan, this is a piece of code that contains failing tests, in the process of fixing the tests you learn the language, come back next time to Leeds Sharp and learn something else.
Remove all exited containers
Tags: docker, linux
Published: 2015-05-27 17:03:00

---
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/y9hxcwi5y92j6zfcxbjx.jpg
title: Remove all exited containers
slug: remove-all-exited-containers
date: 2015-05-27 17:03
tags:
 - docker
 - linux
---

This removes all exited containers.

    docker ps -a | grep 'Exited' | awk '{print $1}' | xargs --no-run-if-empty docker rm
    
Use with care as it will also removed Data Volume Containers.
Visual Studio
Published: 2022-09-09 15:02:47

---
title: Visual Studio
published: true
date: 2015-05-26 20:00:45 UTC
tags: 
canonical_url: https://www.funkysi1701.com/posts/2015/visual-studio/
---

I recently replaced my installation of Visual Studio 2013 with Visual Studio 2015 RC.

I like the new version, I am not a Visual Studio expert so it will probably take me a while to find all the good stuff but here are some initial thoughts.

Being as my MSDN subscription is still valid I have installed the professional version to take advantage of its extra features like CodeLens.

One of the first things I spotted was that the integration with Azure has been improved. In the last version it was difficult to sign in to Azure with the correct credentials, especially if you have more than one Azure account. Now you can add multiple Accounts and Subscriptions.

![](https://storageaccountblog9f5d.blob.core.windows.net/blazor/wp-content/uploads/2015/05/i1.png)

CodeLens is a feature that has been around in Visual Studio since 2013, but in 2015 it is available in Professional meaning more people have access to it.

CodeLens gives coders useful information at a glance. Above each class/method is listed how many references there are. If you click on the number of references you can see where that class or method is referenced in the rest of your code. Useful to be able to see which methods or classes are not being used.

Next CodeLens shows who (according to git) last changed the class or method and how many days ago that was. Clicking on it shows a cool graph of when changes have happened and who did them.

Next you can see the number of changes that have been made, basically a source control history, but without having to load up your git client.

For code that doesn’t contain classes or methods such as T\_SQL you can see at the bottom of your code window the last two CodeLens information to help you track down what changes have happened recently.

The last new feature that I have noticed is the Light Bulbs that keep showing up all over my code. I think the Light Bulbs might be called Quick Actions, but whatever they are called they are suggestions on how to improve your code. So far they have suggested to be to get rid of using references that are not used, simplify a fully qualified name, drop unneeded this keywords. I am sure more will popup as I do more coding.

These improvements to Visual Studio I like, and I am sure there are many more that I haven’t noticed. I expect support for the vNext .net framework is also in there somewhere which hopefully I can play around with soon.
API Debugging Tools
Tags: engineering, googlechorme, mozilafirefox, soupui
Published: 2020-10-05 11:34:49

---
title: API Debugging Tools
published: true
date: 2015-05-26 00:00:00 UTC
tags: Engineering,GoogleChorme,MozilaFirefox,SoupUI
canonical_url: 
---

Are you having trouble with accessing API endpoint? Unsure why your API is not returning data? Most modern browsers have tools or plugins that allows you to quickly and easily test your API calls and see the sample returned data. In this post we go through some tools available…

   
[Read On](https://www.loginradius.com/engineering/blog/api-debugging-tools/)
Overflow
Published: 2022-09-09 19:10:52

---
title: Overflow
published: true
date: 2015-05-22 20:00:45 UTC
tags: 
canonical_url: https://www.funkysi1701.com/posts/2015/overflow/
---

Today I encountered a new error.

![](https://storageaccountblog9f5d.blob.core.windows.net/blazor/wp-content/uploads/2015/05/error.jpg?w=385&ssl=1)

Run-time error ‘6’: Overflow doesn’t really tell me much. The error was occurring in the Access ADP front-end of our main database. It was only occurring for one particular Id number which was really confusing me.

First thing I tried was to remove the most recent changes I had made, this made no difference. So time to look at the VBA code that was run just before the error.

```
Dim iPropertyId As Integer
iPropertyId = DLookup(“PropertyId”, “Survey”, “[ProjectNo]=” & Me.ProjectNo)

```

All looks good, even running the Dlookup query in SQL Management Studio threw no errors.

```
SELECT PropertyId FROM dbo.Survey WHERE ProjectNo =

```

Next thing I tried was explicitly setting iPropertyId to the problematic Id, still the same error.

This made me look at the error message again. Overflow suggest something being too big, but what could it be.

Integer has a size limit of 32,767 and the value I was trying to pass into iProperty was 32779. This was what was causing the problem, my database had grown to such a size that Integer was too small, I needed to change it to a Long Integer. Long has a size of 2,147,483,647 so my database should keep working for a while more.

The famous programming help website [Stack Overflow](https://stackoverflow.com/) is named after such an error. This error shows how difficult it is to decide what variable type to use, as you don’t know how quickly your database will grow.
Compiling xslcache 0.7.1 for PHP 5.4
Published: 2019-12-23 21:12:13

---
title: Compiling xslcache 0.7.1 for PHP 5.4
published: true
date: 2015-05-22 19:46:09 UTC
tags: 
canonical_url: 
---

We make heavy use of xslt at work (parsing xml data generated by php controllers), so the [xslcache pecl module](http://pecl.php.net/package/xslcache/0.7.1) is pretty fundamental to our infrastructure. Of course, if you are using PHP 5.4 or above, like many pecl modules, [it breaks](https://bugs.php.net/bug.php?id=62856). Here’s how to get it to work.

Currently, trying sudo pecl install xslcache-beta with PHP \>= 5.4 throws the following error at make:

```
/tmp/pear/temp/xslcache/php\_xsl.c: In function 'xslcache\_objects\_new': /tmp/pear/temp/xslcache/php\_xsl.c:211:52: error: 'zend\_class\_entry' has no member named 'default\_properties' make: \*\*\* [php\_xsl.lo] Error 1 ERROR: `make' failed
```

### Download xslcache

Download the original source from the pecl svn repository, the 5.4 patch, and patch it manually:

```
svn checkout [http://svn.php.net/repository/pecl/xslcache/trunk](http://svn.php.net/repository/pecl/xslcache/trunk) xslcache cd xslcache wget -O php\_xsl.c.patch 'https://bugs.php.net/patch-display.php?bug\_id=62856&patch=xslcache-php5.4-compat&revision=1362641549&download=1' patch \< php\_xsl.c.patch
```

### Make and install

This is a pretty straightforward make process for most linux software (you may need to adjust the location of xslcache.ini):

```
phpize ./configure make make test sudo make install sudo nano /etc/php5/cgi/conf.d/xslcache.ini #add "extension=xslcache.so"
```

Note that if you make test the tenth may fail with the following:

```
=================================================================== FAILED TEST SUMMARY 
------------------------------------------------------------------- Test 10: EXSLT Support [tests/xslt010.phpt] ===================================================================
```

If you’re using XSLT 2.0, you probably [don’t need](http://stackoverflow.com/a/5899319/114900) to worry about it.

### Verify that xslcache is installed and enabled

Since we’re already in the command line, let’s check there:

```
php -i | grep XSLCACHE
```

Hopefully, you will see the following line:

```
XSLCACHE =\> enabled
```

Furthermore, you should be able to actually know it’s _doing its job_ because your benchmarks should improve.

_Originally published at_ [_michaelsanford.com_](http://michaelsanford.com/compiling-xslcache-0-7-1-for-php-5-4/) _on March 22, 2013._