BrownBot Logo BrownBot Head

Real Time Warping of the background texture (Fisheye lens ripple thiny)

8:01 am Filed under: Uncategorized

 Zett headed to the movies with the work girls tonight, so I’ve spent the whole night looking at a special effect for Ride the Fury.

This is just a proof of concept but I’m pretty stoked I got it working to this stage, basically I’ve taken the bump map effect they use in modern water rendering and applied it to the UV co-ordinates of my background texture, nothing too special there, the difference with my implementation is that I’m generating the ripple texture in real time.

The idea is to have to back ground ripple and react to the players power moves!

I’ve still got to generate some better source offset textures but it proves that it works.

I’d better go grab some dinner, I’ve been so carried away with this that I’ve forgotten to eat… more updates soon.

Setup email from MS SQL Server 2000 via a Notes server

11:02 pm Filed under: MS SQL
  1. First install Outlook 2000 on the server.
  2. Login as the user that you SQL service starts as (SQLService in our case).
  3. Run Outlook making sure you choose the Corporate or Workgroup option.
  4. Then Select the Pop3 account type.
  5. Setup the pop3 account with some valid credentials (in our case we’re only sending so in doesn’t matter if you use your own just make sure you tick the “leave messages on server” check box)
  6. Ok the account setup and you should see your unread emails flood in, test the sending with a test email to someone you like.
  7. Exit outlook and fire up enterprise manager and bring up your SQL Servers properties.
  8. On the “Server Settings” tab there in an “SQL Mail” section, hit the “Change” button and select the MAPI profile you just created in Outlook ( there should only be the one in there).
  9. Now open up the properties of your “SQL Server Agent” and check that the “Mail session” “Mail Profile” is set to the same MAPI profile you just set in the SQL Server properties and hit the test button to make sure it can send.

After the Agent service restarts itself you’re right to setup email notifications for Alerts and Agent Jobs.

Convert a String to a GUID in C#

11:01 pm Filed under: C#

This is a simple one that didn’t take all that long to find a solution for but I thought it was worth putting up here anyhow seeing it’s not all that obvious.

To convert most other data types (Strings, Ints, Chars etc) you use the Convert. system function eg.

char myChar = Convert.ToChar(myString);

char myInt = Convert.ToInt(myString);

But GUIDs are treated a little differently, you actually create a new instance seeded with the string value eg.

Guid myGuid = new Guid(myString);

Hide a textbox in RS when value is Null

10:56 pm Filed under: Uncategorized

This is one I’ve had to use a few times and keep forgetting so I’ll stick it here for next time. Stick this into the visibility property on a textbox in Reporting Services to show/hide in when there is a value in the vairable you are displaying.

=not Fields!SharePercent.Value is System.DBNull.Value

List your scheduled tasks next run time and average duration MSSQL

10:55 pm Filed under: MS SQL

Here’s a handy little query I came up with to list your scheduled jobs, what time they’re going to run next and their average duration on your MSSQL box. I’ve been chasing performance on my sever for months, tweaking things here and there, I found that windows was having massive page fault spikes every 5 minutes. Further investigation indicated that multiple (up to 10) scheduled tasks within SQL Server were fireing at the same time.

I used the query below to randomise the schedules (adding a random number of seconds to the start time) spreading the load more evenly over time.

A small gain but a nice one to finally nut out.

SELECT
    j.name, 

    endTime = CONVERT
    (
        DATETIME,
        RTRIM(next_run_date)
    )
    +
    (
        next_run_time * 9
        + next_run_time % 10000 * 6
        + next_run_time % 100 * 10
    ) / 216e4,

   (
        select avg(run_duration)
        from sysjobhistory jh
        where j.job_id = jh.job_id and run_duration is not null
   )
FROM
    msdb..sysjobschedules j
WHERE
	next_run_date <> 0
	and (name <> 'Schedule_1' and name <> 'Schedule 1')

order by
CONVERT
    (
        DATETIME,
        RTRIM(next_run_date)
    )
    +
    (
        next_run_time * 9
        + next_run_time % 10000 * 6
        + next_run_time % 100 * 10
    ) / 216e4

CLear MSSQL DB log file without backing it up

10:54 pm Filed under: MS SQL

This is one that has come in hand a few times, if you’ve accidentaly filled up you data drive on your SQL server and don’t have the space left to clear out the log file and reclaim the space just run the following command then shrink the DB.

BACKUP LOG "MyDatabaseName" WITH TRUNCATE_ONLY

Calling C++ Defined Functions from C source

10:53 pm Filed under: Uncategorized

Came across this one today, I’m sure I’ve hit it before but of course I didn’t remember. The worst part of the problem is that the error message is not very descriptive (Unresolved external refrence) but the solution is nice and easy.

------------------
foo.h:
------------------
#ifdef __cplusplus
extern "C" {
#endif 

int foo( int ); 

#ifdef __cplusplus
}
#endif 

------------------
foo.cpp
------------------
#include "foo.h" 

int foo( int i ) { ... } 

------------------
main.c
------------------
#include "foo.h" 

int main() { foo(1); }

New Code Blog

10:50 pm Filed under: Uncategorized

 Welcome all, I’ve setup this blog to separate the code and XNA articles from my regular  blog.

The hope is to focus the two blogs more, freeing me up to go as silly as I want on my regular blog and as nerdy and techy as I want in the other.

Should be a win for everyone… first up I’m going to copy over the few good tips from the old BrownBot code lib, enjoy!

Powered by WordPress