Tuesday, January 24, 2012

SharePoint Notification Framework

XSLT and JavaScript work on document object model. Neat feature in SP2010 are the SP.UI classes. These can be handled directly in client side scripts and XSLT produced by SharePoint designer.

Status class;
SP.UI.Status.addStatus('loading...');

Notify class;
SP.UI.Notify.addNotification('loading...',false,"",null);

Interesting part with both are the sub-classes for handling colors, images, transition and placement. I've not found much information regarding these but they are fun to play with! :)

Saturday, November 6, 2010

WGET magic

http://mrhassell.wordpress.com/

wget –referer=”http://www.google.com” –user-agent=”Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6″ –header=”Accept:text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5″ –header=”Accept-Language: en-us,en;q=0.5″ –header=”Accept-Encoding: gzip,deflate” –header=”Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7″ –header=”Keep-Alive: 300″ -dnv -r –html-extension –convert-links http://www.somedomain.com

obviously you should change the http://www.somedomain.com to the relative site that you wish to download. As I’m lead to believe this is basically how Mark Elliot “Zuck” Zuckerberg downloaded the contents of the pictures from Harvard University and started “thefacebook.com” – at least according to the Hollywood side of things, in the move “The Social Network” – this would be the WGET magic mentioned. Enjoy!

Wednesday, June 9, 2010

Linked blogs

http://mrhassell.spaces.live.com/ - strange having a Microsoft blog and a Google blog! Need to look into merging these two with a single post..

Monday, February 15, 2010

"Search For" function SSRS Report Manager.

Unfortunately Microsoft in their wisdom decided that the search box should not be removable easily. It is possible with a little javascript and editing of a few aspx pages.

First we hide the label for the search box. This is easy enough as it is stored in the css file.

  1. Open ReportingServices.css - (C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportManager\Styles)
  2. Replace the Label of search box with the css below (basically I am just adding the "display: none" to it)

    /* Label of search box*/
    .msrs-search {
    font-family: Verdana, serif;
    font-size: x-small;
    color: black;
    font-weight: normal;
    text-decoration: none;
    display:
    none;
    }
  3. Use JavaScript to hide the Search textbox and button;

    a. Browse to the folder
    C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportManager\Pages (SQL 2008)

    b. Create a new file using notepad (text file)


    function HideSearchPanel()
    {
    var txtSearch= document.getElementById('ui_txtSearch');
    var btnGo= document.getElementById('ui_btnGo');
    if(txtSearch && btnGo)
    {
    txtSearch.style.display = "none";
    btnGo.style.display =
    "none";
    timer=setTimeout(HideSearchPanel,1);
    }
    }
    var timer;
    timer=setTimeout(HideSearchPanel,1);


    c. Save the file with filename HideSearchPanel.js (include the extension name .js)
    d. Now, open the Folder.aspx with notepad, add the following code to this page, and then save this file:



    e. Repeat step ( d ) in other pages such as Report.aspx, DataSource.aspx

    That should do it!

Wednesday, April 8, 2009

Somehow this just seemed relevant! ;-)

Monday, February 16, 2009

Random Quick Pick tinkerings

While visiting a local newsagent recently, I noticed that the Australian national lottery has a system that generates numbers randomly. For some reason I thought this was kind of interesting as a concept and wondered how it would be done.

The result of playing around with some C# code for a little while is as follows. Feel free to do whatever you like with it and if it wins you a bucket full of cash, let me know and have fun coding!


using System;
using System.Collections.Generic;
using System.Text;

namespace QuickPluck
{
class Program
{
static void Main(string[] args)
{
DisplayBanner();
int required = RequestedGames();
int gameNumMax = GameNumbers();
int numSeries = SeriesSequence();

for (int z = 0; z < style="color: rgb(51, 204, 0);">//time needs to be above 1000 cycles or dupes occur!
int c = 10000;
int[] numb = new int[c];
DateTime dt = new DateTime();
dt = DateTime.Now;
Random rnd = new Random(dt.Millisecond);
for (int i = 0; i < style="color: rgb(51, 204, 0);">//the magic touch!
numb[i] = rnd.Next(1, gameNumMax);
}
Array.Sort(numb);
int k = 0;
int j = 0;
int[] length = new int[50];
int[] result = new int[50];
for (int i = 0; i < style="color: rgb(51, 102, 255);">if (numb[i] == numb[i + 1])
{
result[k] = numb[i];
length[k] = j += 1;
}
else
{
k += 1;
j = 0;
}
}
Array.Sort(length, result);
switch (numSeries)
{
case 1:
Console.WriteLine(result[49]);
break;
case 2:
Console.WriteLine(result[49] + " " + result[48]);
break;
case 3:
Console.WriteLine(result[49] + " " + result[48] + " " + result[47]);
break;
case 4:
Console.WriteLine(result[49] + " " + result[48] + " " + result[47] + " " + result[46]);
break;
case 5:
Console.WriteLine(result[49] + " " + result[48] + " " + result[47] + " " + result[46] + " " + result[45]);
break;
case 6:
Console.WriteLine(result[49] + " " + result[48] + " " + result[47] + " " + result[46] + " " + result[45] + " " + result[44]);
break;
case 7:
Console.WriteLine(result[49] + " " + result[48] + " " + result[47] + " " + result[46] + " " + result[45] + " " + result[44]+ " " + result[43]);
break;
case 8:
Console.WriteLine(result[49] + " " + result[48] + " " + result[47] + " " + result[46] + " " + result[45] + " " + result[44]+ " " + result[43]+ " " + result[42]);
break;
case 9:
Console.WriteLine(result[49] + " " + result[48] + " " + result[47] + " " + result[46] + " " + result[45] + " " + result[44] + " " + result[43] + " " + result[42] + " " + result[41]);
break;
default:
Console.WriteLine("Invalid selection. Please select numbers from 1 to 9!");
break;
}
}
ExitNow();
}
private static void DisplayBanner()
{
Console.WriteLine("Welcome to QuickPluck personal lottery number generator.");
Console.WriteLine("\n");
Console.WriteLine("The idea is simple.");
Console.WriteLine("1 - Enter the number of games to play as required.");
Console.WriteLine("2 - Enter the maximum numbers allowed in the game.");
Console.WriteLine("3 - Enter the numbers per line in each game (1-9) - presto!");
Console.WriteLine("\n");
}
private static int GameNumbers()
{
int myGames = 0;
Console.WriteLine("How many possible numbers? eg; 45 number game");
try
{
myGames = Convert.ToInt32(Console.ReadLine());
}
catch (FormatException)
{
UserFud();
myGames = 0;
}
int gameNumMax = myGames;//required number system. ie; 46 nums
return gameNumMax;
}
private static int RequestedGames()
{
int myValue = 0;
Console.WriteLine("How many games required? eg; 1 to 40");
try
{
myValue = Convert.ToInt32(Console.ReadLine());
}
catch (FormatException)
{
UserFud();
myValue = 0;
}
int required = myValue;//number of results required?
return required;
}
private static int SeriesSequence()
{
int numSeries = 0;
Console.WriteLine("How many numbers per game? eg; (5) numbers, (6) numbers or super 7's? (7)");
try
{
string seriesNum = Console.ReadLine();
numSeries = int.Parse(seriesNum);
}
catch (FormatException)
{
UserFud();
numSeries = 0;
}
return numSeries;
}
private static void UserFud()
{
Console.WriteLine("\n");
Console.WriteLine("must be numeric!");
Console.WriteLine("\n");
}
private static void ExitNow()
{
Console.WriteLine("\n");
Console.WriteLine("Thanks for Plucking! Any key exits.");
Console.WriteLine("\n");
string exiting = Console.ReadKey().ToString();
if (exiting.Length > 0)
{
Environment.Exit(0);
}
}
}
}

Tuesday, October 7, 2008

Threads, Multithreading. How about no threading model?

I'm scratching my head and wondering if I'm alone or is the world just a crazy place with lot's of sheep?

When Assembly was the normal mode of operation, threading didn't seem a problem. You simply had a stack and then pushed, poked, pulled and popped around until you reached the goal. Simple and elegant, it was great fun but any 11 year old has other thing's to do, such as BMX and fishing, equally as important as switching registers and bypassing primitive protection schemes on the Intel 8080.

Thankfully I'm no longer stuck with a 3Mhz processor and can now be a slob and get away with it. Thanks to Intel speeding up and complicating their processors, adding more cores, pushing threads from Erlang to Java and .Net, I can sit back and write sloppy, insecure and half brain code, performs well enough and get away with it. Cheers? Not really...

Anyone who really knows anything about anything will usually not say very much. Today I've stumbled across a man who inspired me by the fact that he has spoken out and against the grain with much my approval - Louis Savain and his Rebel Science work.

Shared states, message queue, wait states.. I'm falling back to sleep and then pow, Ultrasparc T2 Plus pops up and shouts love me! I'm the future and I've arrived! Almost instantly I fall into a depression requiring several months of therapy to relieve the shock. Marc Tremblay took flawed logic, built it into a chip and corrupted the reduced instruction set with a complicated mess as bad as the x86 architecture for what purpose?

People who make hardware today, really need to get with the program and start to think. It's patently clear that outside of the box is just one of the marketing departments glossy catch phrases as they really don't seem to have a clue about what the box even should be, what is outside of it is just another chance to sell unfinished software and tools, then upgrade the 'experts' with fixes and updates.. wow.. brillo.

I've been a fan you could say of Sun, Microsoft and Apple. The Apple "Think Different" campaign was one of the best thing's I recall a company of any kind ever pursing. Boy how that turned sour when Apple dropped IBM and went all Core 2. I suspect that these guys might end up with red faces and jumping camp again when IBM releases 500 cores on a single die all running at 500Ghz but for the meantime it's Bahh Bahh.. were all out to pasture and were going to build a new O/S based on Unix because it's easier than trying to debug Windows and everyone will think it's bullet proof from Trojans and Virus's etc etc... Crickey!

Does anyone even give a damn as I don't and the people who are selling you crap, soon to be obsolete, which can't take a spare battery and is designed for you, as disposable as you the consumer are. Do these people even know what it is to care about anything other than the love of money or was that all too hard?

Shared resources are a joke and I'll tell you why. Nobody is going to share their money and that is the worlds primary resource. If your reading this now, then there is a stream of free information in a read state. Millions could potentially read this, incurring millions of read only threads but if I edit this... so what? Everyone keeps reading and nobody would even notice that it has changed, except their may be a second pause when I save.

Where is the locking? Where is the race condition? Why would this require millions of calculations, timed mutex callbacks, synchronous wait states? The answer is simple as it doesn't.

Man I love reliable software with a passion. It feels great to know that something is reliable and solidly doing it's job the way it should and will keep doing it forever, beyond my fragile existence even. It actually provided for me the first sense of reassurance I can recall outside of being nurtured by my mother. Now if I have to go back to an 8080 chip just to feel that again, then isn't that a shame?

I'm not a fan of Erlang or lightweight threads. I'm not a fan of Java and I'm not a fan of pointers, green threads, red threads or .Net threads. I'm not a fan of threading in PERL, in C or in any other way at all and I try to avoid them as much as possible.

If you can't avoid threading then you have to lock, unlock and get into some real boggling. The reason being is the processors which your programming language is running from is flawed and so is the language that your using to reach your goal. Einstein said something along the lines of our technology being "child like and primitive yet the most precious thing we have". He also stated that "Everything should be made as simple as possible but not simpler".

Firstly look at what needs to be in a read only state, what needs to modify and different ways of implementing modifiers. There are solutions that can be found without thrashing in the water screaming for help, think differently!

The only way that I can see of eliminating threads, is to eliminate the hardware and programming languages which all equally stink of monolithic backwash from the 50's. How about some real innovation Sun, Intel, Anyone?