teleren/devto huggingface dataset:
MySQL Client Configuration
Published: 2017-10-31 19:52:43

---
title: "MySQL Client Configuration"
published: true
tags: 
canonical_url: https://michael.mior.ca/blog/mysql-client-configuration/
---

Perhaps I’m the only one who didn’t know this, but a while back, I discovered a handy trick for configuring the MySQL client. You can create a configuration file in your home directory, `~/.my.cnf` and set options for the MySQL client to use. Really handy if you’re constantly connecting to the same server and tired of entering hostname and port parameters.

Here’s an example:

```
[client]
host = 127.0.0.1
user = root
password = root
port = 4040
```

That’s it for this post. If you know any other time-saving tips for MySQL, please share in the comments!
BF interpreters in XSLT and in Scratch
Tags: brainfuck, xslt, scratch
Published: 2019-06-02 14:48:00

---
title: BF interpreters in XSLT and in Scratch
published: true
tags: brainfuck,xslt,scratch
canonical_url: https://ofdigitalwater.postach.io/post/bf-interpreters-in-xslt-and-in-scratch
---

This release features Brainfuck interpreter in XSLT. It is in [this repository](https://github.com/wincentbalin/BFXSLT).

Most information is in the file `Readme.txt`. From there on, you will know how to use the interpreter.

Another feature in this release is the Brainfuck interpreter in Scratch, which can be found [here](http://scratch.mit.edu/projects/wincent/740588 "Brainfuck interpreter in Scratch"). Feel free to remix it.
Update jqGrid Html helper for ASP.NET MVC
Tags: microsoft
Published: 2020-11-05 10:30:53

---
title: Update jqGrid Html helper for ASP.NET MVC
published: true
date: 2011-12-14 08:00:00 UTC
tags: microsoft
canonical_url: 
---

We released a new version of MvcJqGrid, a fluent html helper which eases the the implementation of jqGrid in ASP.NET MVC applications. I’ll give a short description of the most notable changes in this article. Source code and documentation are hosted on [github](https://github.com/robinvanderknaap/MvcJqGrid). We included a sample application in the source code, a live example can be found [here](http://mvcjqgrid.skaele.it/).

### Razor engine support

Although it was possible to use the previous version with the razor engine, it wasn’t quite obvious how. The following gives you a basic example how to use the new version of MvcJqGrid with the razor view engine:

{% gist https://gist.github.com/robinvanderknaap/abb7a91535ceda1eafbb312e4f335bff %}

### NuGet

MvcJqGrid is now available as a NuGet package which makes installing the helper a trivial task:

install-package MvcJqGrid

You have to install jqGrid and jQuery yourself, we decided not to include these as dependencies.

### Modelbinder

We included the jqGrid modelbinder created by [Ilya Builuk](http://www.codeproject.com/KB/aspnet/AspNetMVCandJqGrid.aspx). The modelbinder makes it easy to handle data requests from the grid in your controllers:

{% gist https://gist.github.com/robinvanderknaap/c918202aa97b8f28d8cbdb1da75f915c %}

### Sample Application

The sample application was also updated. The sample is included in the source code, you can find a live example [here](http://mvcjqgrid.skaele.it/). The sample application is a nice way to get started with the helper, because for every sample grid the source code is displayed below the grid.

One word about the sample data being used. The sample data is contained in a Sql Express Database in the App\_Data folder. Make sure you have installed Sql Server Express 2008 R2. The Web Platform Installer sometimes indicates you have installed R2 when actually you only have SP2 installed. More info on [StackOverflow](http://stackoverflow.com/questions/4257684/sql-server-attach-incorrent-version-661).

### Unit tests

Daan le Duc went out of his way and added 129 unit tests to the project, which improved the overall quality of the Html Helper.

Hopefully, you’ll like this new release. Suggestions, questions and comments are always welcome.
Starting IIS Express from the command line
Tags: iis
Published: 2020-11-05 10:28:55

---
title: Starting IIS Express from the command line
published: true
date: 2011-12-14 08:00:00 UTC
tags: iis
canonical_url: 
---

> I’ve been working with IIS express for some time now, but only as an integrated webserver in Visual Studio. Today I stumbled upon a feature of IIS Express I didn’t know existed. You can start IIS express from the commandline and host a webapplication on the fly. No Visual Studio needed._

To start IIS Express from the command line, first navigate to the IIS Express installation folder:

```
c:\Program Files\IIS Express
```

or for 64-bit:

```
c:\Program Files (x86)\IIS Express
```

With the following command you can host an application in the specified path on port 9090:

```
iisexpress /path:c:\myapp\ /port:9090
```

Very handy when you quickly want to test an application downloaded from the internet. In my case a beta of Umbraco CMS 5.0, I got it up and running in seconds.

For a more complete overview of all command line options of IIS Express read [this](http://learn.iis.net/page.aspx/870/running-iis-express-from-the-command-line/) article.

When you don’t want to fire up the command prompt each time you want to launch IIS Express, Chris McLeod created a [shell extension](http://chrismcleod.net/iis-express-website-here-shell-extension) using some registry edits to add “IIS Express Website Here” to your context menu. It starts IIS Express in the selected directory, making things even more easy.
MySQL Global Vars wait_timeout & max_connections
Tags: sql
Published: 2011-11-22 22:19:00

---
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/y9hxcwi5y92j6zfcxbjx.jpg
title: MySQL Global Vars wait_timeout & max_connections
slug: mysql-global-vars-wait-timeout-max-connections
date: 2011-11-22 22:19
tags: 
 - sql
---
Just some more code for me to bookmark. Problem was the MySQL connections were not being closed, the timeout was set at 8 hours and the connection limit was 400.

    SHOW VARIABLES LIKE "%wait%"
    SET @@GLOBAL.wait_timeout=300
     
    SHOW VARIABLES LIKE "%max%"
    SET @@GLOBAL.max_connections=1000
MySQL Relationships & Foreign Keys
Tags: sql
Published: 2011-11-21 22:18:00

---
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/y9hxcwi5y92j6zfcxbjx.jpg
title: MySQL Relationships & Foreign Keys
slug: mysql-relationships-foreign-keys
date: 2011-11-21 22:18
tags: 
 - sql
---
Just another snippet of code that I will forget...

    ALTER TABLE `accounts`
      ADD CONSTRAINT `FK_myKey` FOREIGN KEY (`customer_id`) 
      REFERENCES `customers` (`customer_id`) 
      ON DELETE CASCADE ON UPDATE CASCADE;
Personal Website update
Tags: general
Published: 2011-09-03 23:17:00

---
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/y9hxcwi5y92j6zfcxbjx.jpg
title: Personal Website update
slug: personal-website-update
date: 2011-09-03 23:17
tags: 
 - general
---
I have been working on my new personal website lately - www.adamkdean.co.uk - which I will integrate with this blog as well as other blogs of mine, to centralise all of the content I put out there.

Check it out!
Collaborate - Redirecting to same Page ASP.NET
Tags: aspnetwebforms, csharp
Published: 2011-09-02 23:17:00

---
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/y9hxcwi5y92j6zfcxbjx.jpg
title: Collaborate - Redirecting to same Page ASP.NET
slug: collaborate-redirecting-to-same-page-asp-net
date: 2011-09-02 23:17
tags:
 - asp-net-webforms
 - csharp
---
[Collaborate: Redirecting to same Page ASP.NET](http://metahat.blogspot.com/2008/12/redirecting-to-same-page-aspnet.html?spref=bl)

Simple concept but still pain in head if unable to figure out :)

    Response.Redirect("#");

Great little snippet, not widely known! Bare in mind that your ViewState won't persist though
XNA An Example Object using VariableService
Tags: csharp, xna, gamedev
Published: 2011-08-26 23:15:00

---
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/y9hxcwi5y92j6zfcxbjx.jpg
title: XNA An Example Object using VariableService
slug: xna-an-example-object-using-variableservice
date: 2011-08-26 23:15
tags:
 - csharp
 - xna
 - gamedev
---
Just a quick example of how you'd lay out an object class, which you could use for items like game objects, the player object, anything that you need to update and draw independently.

    using System;
    using Microsoft.Xna.Framework;
    using Microsoft.Xna.Framework.Graphics;

    namespace SpaceRocks
    {
        public class ExampleObject
        {
            #region Variables
            private VariableService vars;

            public Texture2D Texture { get; set; }
            public int Width { get { return Texture.Width; } }
            public int Height { get { return Texture.Height; } }

            public Vector2 Position { get; set; }
            #endregion

            #region Constructor Methods
            public ExampleObject(Game game)
            {
                vars = ServiceExtensionMethods
                    .GetService<variableservice>(game.Services);
            }

            public void Initialize(Texture2D texture, Vector2 position)
            {
                Texture = texture;
                Position = position;
            }
            #endregion

            #region Update Methods
            public void Update(GameTime gameTime)
            {
                //
            }
            #endregion

            #region Draw Methods
            public void Draw(GameTime gameTime)
            {
                //
            }
            #endregion
        }
    }
Convore PHP 1.1.0 Released
Tags: opensource, php, old
Published: 2020-04-02 06:21:42

---
title: Convore PHP 1.1.0 Released
published: true
date: 2011-07-18 07:00:00 UTC
tags: opensource, php, old
canonical_url: https://www.jaysonjphillips.com/blog/2011/07/convore-php-1-1-0-released/
---

This morning I released a [new version](https://github.com/jaysonjphillips/convore-php/releases/tag/1.1.0) of the Convore PHP API Library on GitHub. The class now has all newly-added API methods since last commit, including:

`account/mentions.json`
`groups/:group_id/request.json`
`groups/:group_id/track.json`
`topics/:topic_id/track.json`
`users/username/:username.json`
`messages.json`
`messages/:user_id.json`
`messages/:user_id/create.json`
`messages/message/:message_id/star.json`
`messages/message/:message_id/delete.json`
`groups/discover/trending.json`

You can pull it down at the repo: [https://github.com/jaysonjphillips/convore-php](https://github.com/jaysonjphillips/convore-php/releases/tag/1.0.1)
Setting up FluentValidation for ASP.NET MVC using Ninject
Tags: ninject, fluentvalidation, dotnet, aspnet
Published: 2020-11-05 10:32:07

---
title: Setting up FluentValidation for ASP.NET MVC using Ninject
published: true
date: 2011-07-02 07:00:00 UTC
tags: ninject,fluentvalidation,dotnet,aspnet
canonical_url: 
---

[_FluentValidation_](http://fluentvalidation.codeplex.com/) _is a powerful library to validate your model objects fluently. Setting up FluentValidation is easy, import the NugGet package to your project and you’re ready to go. It’s possible to setup FluentValidation using an IoC container, which is very useful when your validators contain some dependencies which you would like to remove using dependency injection. In this article I’ll show you how to use Ninject to setup FluentValidation._

### There’s a NuGet package for that!

I’m assuming you already have FluentValidation and Ninject set up for your project. There’s just one little package you need, [ninject.web.mvc.fluentvalidation](https://github.com/ninject/ninject.web.mvc.fluentvalidation), which you also can grab from NuGet. This package contains a custom validatorfactory which puts Ninject in charge of creating instances of your validators.

First you have to create the ninject factory and configure FluentValidation to use this factory instead of the default one. Add the following lines of code to the Application\_Start method in Global.asax or if you’re using webactivator in the start method of the fluentvalidation startup class in App\_Start:

{% gist https://gist.github.com/robinvanderknaap/d74e6e26f5f804332ff563271397cd6e %}

FluentValidation is now using the ninject factory for creating instances of validators. The last step is to bind all validators to their implementation. You can do this with one line of code:

{% gist https://gist.github.com/robinvanderknaap/1d0f52222b95d888f0d5afcd5f4ec9da %}

This method scans the specified assembly (in this case the current assembly) for validators and binds their interfaces to their implementations. You have to add this method to your Ninject startup script.

By now, all validators can take dependencies which are resolved by Ninject.

Happy programming!
MaxCDN PHP 0.5.0 released
Published: 2020-04-02 06:11:34

---
title: MaxCDN PHP 0.5.0 released
published: true
date: 2011-06-19 07:00:00 UTC
tags: 
canonical_url: https://www.jaysonjphillips.com/blog/2011/06/maxcdn-php-0-5-0-released/
---

Now bumped to version 0.5.1, the PHP API now has all methods of the MaxCDN's XML-RPC interface implemented. Only thing left is to finish all the unit tests, create an automated build system (for self), throw in a lightweight tutorial and get to work making extensions for various frameworks (WordPress, Drupal, CodeIgniter, CakePHP, etc).

If you'd like to grab it now, head on over to [GitHub](https://github.com/jaysonjphillips/maxcdn-php-api/releases/tag/v0.5.1) and checkout the latest commit. You can feel free to use this in your project as it is MIT-licensed. Hack away, report any bugs on the GitHub project (yes, I am using GitHub Issues as its issue tracker) and let me know any other comments you have for this.
How to maintain the scroll position of the page after client side validation fails
Tags: dotnet, aspnet, csharp, clientsidevalidation
Published: 2021-10-16 02:09:16

---
title: How to maintain the scroll position of the page after client side validation fails
published: true
date: 2011-04-28 09:59:00 UTC
tags: dotnet,aspnet,csharp,clientsidevalidation
canonical_url: https://waiholiu.blogspot.com/2011/04/how-to-maintain-scroll-position-of-page.html
---

This was something that I was stuck on for a little while today, I was working on a page at work.  
  
I was working on one particular page that had a number of validators and multiple validation summary objects - both client and server side. One position was that some of the client validations (typically for the ones for the control at the bottom), if it failed validation on the client side, it would take you straight to the top of the page. Kind of disorienting for the user.  
  
A google search indicated it was actually quite a common problem which is documented already by Microsoft  and has something to do with the internals with the .NET RequiredFieldValidator which would execute some code within its ScrollTo event.  
    
  
  
It seems the MaintainScrollPositionOnPostBack, as indicated by its name only works AFTER postback. Client validation doesn't include postback.  
  
Most suggestions are to simply override the ScrollTo function with a simple JavaScript function like so...

```
<script type="text/javascript">    window.scrollTo = function() { }</script>
```
  
This didn't work for me unfortunately. Whilst it did fix the problem for the RequiredFieldValidators, it resetted the positions for my CustomValidators which were all server side. Have not done any investigation into why that is happening.  
  
My solution in the end was that instead of ensuring it was to override the ScrollTo only on the onClick event of the control that was initialising the validation like so...  
  
onClientClick="window.scrollTo = function(x,y) { return true; };"  
  
So far this seemed to have fixed the problem. However, I only just fixed it today, so time will tell whether it has caused any other unanticipated behavior.   
  
I hope this post is useful.    
  
  
  
[  
](http://msdn2.microsoft.com/en-us/b0eaf8ew)
No definition found for Table yahoo.finance.quotes
Tags: yql, yahoofinance
Published: 2011-04-14 23:08:00

---
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/y9hxcwi5y92j6zfcxbjx.jpg
title: No definition found for Table yahoo.finance.quotes
slug: no-definition-found-for-table-yahoo-finance-quotes
date: 2011-04-14 23:08
tags: 
 - yql
 - yahoo-finance
---
I am writing a bit of code to grab stock data and Yahoo's CSV data source is absolutely terrible. Commas in the middle of data in a CSV file? madness!

So I turned to YQL the only other source really, without scraping html.. and have strangely found that Yahoo's stock data table has disappeared. `"No definition found for Table yahoo.finance.quotes"`. A few other people have also found this so after less than 30 seconds of digging, I found an answer:

Add `&env=http://datatables.org/alltables.env` to your query.

For example:
http://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.quotes where symbol in ("YHOO","AAPL","GOOG","MSFT")&env=http://datatables.org/alltables.env

There you go. Enjoy.
A smarter console.info
Tags: javascript
Published: 2021-06-03 08:42:17

---
title: A smarter console.info
published: true
date: 2011-02-09 09:05:17 UTC
tags: JavaScript
canonical_url: https://www.recoveryarea.nl/javascript/a-smarter-console-info/
---

Here is a little piece of code you can use in your project for slightly smarter console messages. Objects and arrays are handled differently when logged to the console than strings. Firebug gives you a stringified version of the object while console.dir gives you an expandable object. Both give you the expandable object in Chrome. To work around this you can use this little snippet, it will always give you the correct version.

```

var debug = function(message) {
    "object" === typeof console && ("object" === typeof message || "array" === typeof message ? console.dir(message) : console.info(message));
};

```

The post [A smarter console.info](https://www.recoveryarea.nl/javascript/a-smarter-console-info/) appeared first on [recoveryArea](https://www.recoveryarea.nl).
How to dump all MySQL databases into separate files
Tags: tutorial, vintage, dump, howto
Published: 2019-10-11 07:23:46

---
title: How to dump all MySQL databases into separate files
published: true
date: 2011-01-31 17:21:55 UTC
tags: Tutorial,Vintage,dump,howto
canonical_url: https://www.danielwerner.dev/how-to-dump-all-mysql-databases-into-separate-files/
---

Sometimes we need to to dump all databases form a MySQL server. This can be done using the mysqldump utility with the –all-databases switch enabled. In this case mysqldump will dump all databases to the standard output or to a file if explicitly specified. Let’s assume a situation where we want to backup all of the databases from the server, with the possibility to restore only one database at a time. To achieve this, you need to dump all the databases one by one or to use a pre-made script to do the heavylifting for you.  I’ve found a simple solution here: [http://soniahamilton.wordpress.com/2005/11/16/backup-multiple-databases-into-separate-files/](http://soniahamilton.wordpress.com/2005/11/16/backup-multiple-databases-into-separate-files/). I used this script as a starting point, and made some enhancements to it:

1. MySQL username can be specified from the command line (it’s not hardcoded in the file)

2. The script asks for the corresponding MySQL password for security reasons (the password is not echoed or saved anywhere – as you would expect on a Unix systems)

3. The output dir can also be specified from the command line

4. Support for gzipped output files (optional)

## Usage

Download the [dump-all-databases.sh](https://gist.github.com/daniel-werner/5ab30d2e5c566adaad3022f4da9e141d). Make it executable using chmod +x dump-all-databases.sh.

Run it:

```
./dump-all-databases.sh -u user -o my\_backup\_dir -z
```

The command line options are the following:

- -u – the MySQL user
- -o – output dir (optional, if not specified the dump files will be placed in current directory)
- -z – enables the gzipped output (optional)

## Download

[dump-all-databases.sh](https://gist.github.com/daniel-werner/5ab30d2e5c566adaad3022f4da9e141d)

### System requirements

Unix/Linux system with mysql and mysqldump installed, for gzipped output gzip is also required.

The post [How to dump all MySQL databases into separate files](https://www.wernerd.info/how-to-dump-all-mysql-databases-into-separate-files/) appeared first on [Daniel Werner](https://www.wernerd.info).
Excel Formula - Nice Currency!
Tags: microsoftexcel
Published: 2011-01-26 22:05:00

---
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/y9hxcwi5y92j6zfcxbjx.jpg
title: Excel Formula - Nice Currency!
slug: excel-formula-nice-currency
date: 2011-01-26 22:05
tags: 
 - microsoft-excel
---
I hate it in Excel when my currency has to be either spaced out nicely OR red when negative. There is the currency, which has nice colours, for negatives, which is good. But then the accounting format has nice spacing, with the pound sign on the left.

Well, now I can have both!

`_-£* #,##0.00;[Red]-£* #,##0.00`

Woop!

![Example](http://i.imgur.com/rQhkRyW.png)
MySql Version "Correlated Sub-Queries and Group By Unions"
Tags: sql
Published: 2011-01-20 22:05:00

---
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/y9hxcwi5y92j6zfcxbjx.jpg
title: MySql Version "Correlated Sub-Queries and Group By Unions"
slug: mysql-version-correlated-sub-queries-and-group-by-unions
date: 2011-01-20 22:05
tags: 
 - sql
---
If you look at this SQL article [old link removed], you may either be impressed or insult me for bad coding practise. FYI, it does run on 1000 rows in < 1 second. When I was using MsSql (before I migrated to CentOS/Mono/MySql) I sometimes had to go to extortionate amounts of effort to get stuff done, but with MySql it all seems, a bit too easy.. So from the giant SQL that you saw in the previous article, I can do all that on the same tables (bar one change) with the following SQL:

    SELECT t_Hosts.Id AS Id, t_Records.Id AS RecordId, Hostname, 
     
    Frequency, PingStatus, PingLatency, HttpStatusCode, 
     
    HttpOnlineStatus, HttpLatency, CheckDate
     
    FROM t_Hosts 
     
    LEFT JOIN t_Records ON t_Hosts.Id = t_Records.HostId
     
    WHERE t_Records.CheckDate IS NULL
     
    OR t_Records.CheckDate < DATE_SUB(NOW(), INTERVAL t_Hosts.Frequency MINUTE);

This happens to have caused more trouble than it's worth, so it's back to a datetime now.

Also, make sure that you add an alias for the second Id or it may overwrite the first tables Id!

Edit: It would seem this doesn't work, and is actually flawed. My old logic (@mcfly version) is actually the way to go, not streakys stupid left join crap!

Below is the MySQL Version.

    SELECT t_Hosts.Id AS Id, MAX(Hostname) AS Hostname, MAX(Frequency) AS Frequency
    FROM t_Hosts
    LEFT JOIN t_Records
    ON t_Hosts.Id = t_Records.HostId 
    GROUP BY t_Hosts.Id
    HAVING MAX(CheckDate) <= DATE_SUB(NOW(), INTERVAL MAX(Frequency) MINUTE)
    UNION
    SELECT Id, Hostname, Frequency
    FROM t_Hosts
    WHERE (
       Id NOT IN (
          SELECT HostId
          FROM t_Records
          WHERE (HostId IS NOT NULL)
       )
    )
Flag Arguments
Published: 2023-02-02 05:12:48

---
title: Flag Arguments
published: true
date: 2011-01-20 15:28:00 UTC
tags: 
canonical_url: 
---

Passing a boolean as an argument into a method is not good practice. It complicates the method signature, indicating that this method does more than one thing. It does one thing if the flag is true and another if the flag is false!   
A method or function should do one thing and do it well.

In order to avoid passing flag arguments you should split the method or function into two, using a very descriptive name for each of the methods.

Try refactoring the code in your current project and see if this small change improves the readibility.