HTML5: video

HTML5: video

HTML5 promises to make putting a video on a website as easy as placing an image on a it. Say goodbye to plugins like Quicktime and Flash (which is dead anyway :) ) and get excited about this native way of embedding video’s!

A huge advantage of embedding a video natively is that you can manipulate it just a easily.

video codecs

To embed a video, first it must be in a format that the browser will understand:

  • H.264 – supported by Safari, Mobile Safari, Chrome and IE9.
    H.264 is not an open standard, so there is no promiss that it will remain free. Firefox does not support it.
    Use,  for example, HandBrake to convert to an H.264 video.
  • Ogg Theora – supported by Firefox and Chrome.
    Ogg Theora is an open standard (free forever).
    Use, for example, firefogg to convert to an ogg video.
  • webm – not much support yet
    Webm is a video codec from Google, it’s high quality and open standard.

As you can see, we’ll have to include at least 2 video formats in our website if we want all users to be able to view it.

Using the tag:

Just one video:
<video src=”videos/myvideo.ogv” width=”500″ height=”500″ controls></video>

The controls attribute will add basic controls to the video.

Multiple videos:
<video width=”500″ height=”500″ controls>
<source src=”videos/myvideo.ogv” type=’video/ogg; codecs=”theora, vorbis” ‘>
<source src=”videos/myvideo.mp4″ type=’video/mp4; codecs=”avc1.42E01E, mp4a.40.2″ ‘>
</video>

The type attribute will tell the browser which codecs are required to play the video. This way, the video will only be downloaded if the browser supports the codec. The codec may vary depending on what software you used to convert the video. If you omit the type attribute, then the browser will try each codec to see if it can play the video, which could result in the use of a lot of unnecessary bandwidth.

Interacting with the video is possible with the use of JQuery. You can have a look at JQuery UI elements as a starting point.

HTML5: a few basics

HTML5: a few basics

Web browsers, generally, only support certain features of HTML5. An easy way to determine which features are supported in a browser, is to use the Modernizr tool.

A few general tag changes:

  1. Simple doc type: <!DOCTYPE html>
  2. Simple encoding scheme: <meta charset=”utf-8″>
  3. The type attribute is no longer required:
    <script src=”js/main.js”></script>
    <script> var now = new Date(); </script>
    <style> body { margin: 0px; } </style>
    <link rel=”stylesheet” href=”css/main.css” media=”screen”>

A few new semantic tags:

  1. <article> = an on-its-own-feet-standing piece of content.
    Ask yourself: would this information make sense if I cut it out of the page and pasted it somewhere else completely?
  2. <section> = used to divide up content (of an article or page) in a logical way.
  3. <aside> = content that is useful, but could be removed while the rest of the content would still make sense.

A few new hierarchical tags:

  1. <hgroup> = used to group multiple <h#> tags into one headline.
    <hgroup>
    <h1>This is my title</h1>
    <h2>This is my smart-ass tag line</h2>
    </hgroup> 
    In this case, only the <h1> element will be considered in the page’s hierarchy. Meaning that everything below this <hgroup> is represented by the <h1>. The information in <h2> is secondary.
  2. <figure> and <figcaption> = groups together an image, table, quote, … and its caption on the page
    <figure>
    <img src=”images/myimage.php”>
    <figcaption>Caption of my image</figcaption>
    </figure> 

 

Accessible (web app) table: a good table with a bad rep

Accessible (web app) table: a good table with a bad rep

The table tag <table> has a bad reputation in HTML. This is mainly due to the past. Before CSS took a large role in HTML design, tables were used by many for the markup of the entire web page. Sometimes, this is still the case and that, along with the bad-accessibility-rumor, gives tables a bad rep. When we see a table in HTML, we, immediately and full of prejudice, cringe a bit. Yet, using tables is not always bad practice.

Accessible web app table

Tables are an essential tool for visualizing data in web apps. A good reason to use a table is for displaying tabular information. An example of a good accessible table would the following:

<table summary=”Give a to-the-point summary of the table, but do also give all information that you think will help understand the table better, even if this means a more lengthy summary.>
          <caption>Short description of my table.</caption>
          <thead>
          
                    <tr>          
                              <td></td>
                              <th abbr=”Column 1” id=”My_column_title_1“>My column title 1</th>
                              <th abbr=”Column 2“ id=”My_column_title_2>My column title 2</th>
                    </tr>
             </thead>
             <tbody>

                    <tr>
                              <th id=”My_row_title_1″>My row title 1</th>
                              <td header=”My_column_title_1 My_row_title_1>Data 1 for column 1</td>
                              <td header=”My_column_title_2 My_row_title_1>Data 1 for column 2</td>
                     </tr>
                    <tr>
                              <th id=”My_row_title_2>My row title 2</th>          
                              <td header=”My_column_title_1 My_row_title_2>Data 2 for column 1</td>
                              <td header=”My_column_title_2 My_row_title_2>Data 2 for column 2</td>
                    </tr>
          </tbody>
</table>

And some additional information with that:

  • The caption will be displayed above the table and can be easily styled with CSS.
  • The summary won’t be visible on the web page, but will make the table more accessible for screen readers.
  • Use table headers <th> for all data that is used as a header. Screen readers will be able to see the header that belongs to a table cell. When you have really long headers, then you can imagine that this can be very annoying. In that case, use the abbreviation attribute. The screen reader will then read the abbreviated version.
  • thead can be nice to have, because you can take the header and easily style it separately. For a small table, though, using th will suffice.
    thead, tbody and tfoot are not required. For large, multi page tables, especially in web applications, though, the use of thead, tbody and tfoot can provide more structure and meaning to the table. You could easily repeat these sections of the table on multiple pages. Remember that if you use thead or tfoot, you have to use tbody to specify what part of the table is the main body part.

Try to avoid too complex tables, because this will make the data hard to understand for users with assistant devices. Sometimes, though, you don’t have a choice. In that case, these are some of the things that you can do to make the experience for those users a bit better:

  • Add an id attribute with the headers (<th>). The screen reader won’t be able to read the id out, but this way you can associate a particular table cell with a particular header.
  • Add a header attribute with all the regular table cells (<td>). This associates the cells with the appropriated headers. In the header attribute, you should put each id of all the headers where this cell falls under, in the proper order and separated by spaces.  The screen reader will read it then as “column x row x” and then the values of the header id’s in the header attribute, plus the value of the cell itself.
    For example: “Data 1 for column 1″ will be read by the screen reader as: “column 2 row 2 My column title 1 My row title 1 Data 1 for column 1″.
  • When you have more than 2 levels of headers, then also include the header attribute in the header tag, stating the name of the id(‘s) of the header(s) where it falls under. Just as you do with the table cells.

Office Web apps error in Sharepoint

Office Web apps error in Sharepoint

I’ve been struggling with Sharepoint and the Office web apps to show word and excel files in the browser. If you have too, take this journey with me as we try to solve it.

Office Web Apps

Server side solutions

First of all, take a look at this article: Deploy Office Web Apps.

Microsoft Technet

In summary, make sure you’ve done these things:

  • Manage services on this server:
    1) Click Start, point to All ProgramsMicrosoft SharePoint 2010 Products, and then SharePoint 2010 Central Administration.
    2) On the SharePoint Central Administration home page, in System Settings, click Manage services on this server.
    3) On the Services on server:<servername>page, start Excel Calculation ServicesWord Viewing Service, and PowerPoint Service. The OneNote Web App does not use a SharePoint service.
    .
  • Manage service applications:
    1) Click Start, point to All ProgramsMicrosoft SharePoint 2010 Products, and then SharePoint 2010 Central Administration.
    2) On the SharePoint Central Administration home page, in Application Management, click Manage service applications.
    3) On the Service Applications page, click New, and then click Word Viewing Service.
    4) In the Word Viewing Service Application dialog box, in Name, type Word Viewing Service Application. In Application Pool, select Use existing application pool, and then in the listbox, select SharePoint Web Services Default. In Add to default proxy list, verify Add this service application’s proxy to the farm’s default proxy list is selected (default), and then click OK.
    5) On the Service Applications page, click New, and then click PowerPoint Service Application.
    6) In the PowerPoint Service Application dialog box, in Name, type PowerPoint Service Application. In Application Pool, select Use existing application pool, and then in the listbox, select SharePoint Web Services Default. In Add to default proxy list, verify Add this service application’s proxy to the farm’s default proxy list is selected (default), and then click OK.
    7) On the Service Applications page, click New, and then click Excel Services Application.
    8 ) In the Excel Services Application dialog box, in Name, type Excel Services Application. In Application Pool, select Use existing application pool, and then in the listbox, select SharePoint Web Services Default. In Add to default proxy list, verify Add this service application’s proxy to the farm’s default proxy list is selected (default), and then click OK.

Note here that you have to make sure that there is only one Excel, Powerpoint and Word service application running. When I had for example 2 Excel or Word services (no matter that they had different names), I kept getting errors. There were already Word and Excel services created for me, so I kept them and I just created the Powerpoint service application like stated above.

  • Activate the Office Web Apps Feature:
    1) In a browser, in the SharePoint site, click Site Actions (for example, go to the central administration page), and then click Site Settings.
    2)  On the Site Settings page, in Site Collection Administration, click Site Collection Features.
    3)  On the Features page, for Office Web Apps, click Activate
    .
  • OR with powershell to activate the Office Web Apps Feature on all site collections:
    Click Start, point to All ProgramsMicrosoft SharePoint 2010 Management Shell.
    $webAppsFeatureId = $(Get-SPFeature -limit all | where {$_.displayname -eq “OfficeWebApps”}).Id
    Get-SPSite -limit ALL |foreach{Enable-SPFeature $webAppsFeatureId -url $_.URL }

___________________________________________________________________________________

 

If you are running the Office Web Apps on a DC, then take a look at this article: Installation Notice for SharePoint 2010 Public Beta

Powershell

In summary, make sure you’ve done these things:

  • If you are using SharePoint on DC, the following Windows PowerShell command would need to be run to enable Sandboxed Solutions.
    $acl = Get-Acl HKLM:SystemCurrentControlSetControlComputerName
    $person = [System.Security.Principal.NTAccount]“Users”
    $access = [System.Security.AccessControl.RegistryRights]::FullControl
    $inheritance = [System.Security.AccessControl.InheritanceFlags]“ContainerInherit, ObjectInherit”
    $propagation = [System.Security.AccessControl.PropagationFlags]::None
    $type = [System.Security.AccessControl.AccessControlType]::Allow
    $rule = New-Object System.Security.AccessControl.RegistryAccessRule($person, $access, $inheritance, $propagation, $type)
    $acl.AddAccessRule($rule)
    Set-Acl HKLM:SystemCurrentControlSetControlComputerName $acl
    .
  • If you are trying to use Office Web Apps on DC(Office Web Application need to be installed seperately, like a language pack or an update. Please also note that Office Web Application cannot be installed on needs to follow the same edit of config.xml to install on Windows 7), then the following commands need to be run to make the services work. Please note that in different languages, Service Application names could be localized. You can find them out by Get-SPServiceApplications, and then change the names in the script as necessary.
    Please do note that Office Web Apps is not supported on a DC. So this configuration should never be used in production.
    $e = Get-SPServiceApplication | where {$_.TypeName.Equals(“Word Viewing Service Application”)}
    $e.WordServerIsSandboxed = $false
    $e.WordServerIsSandboxed $p = Get-SPServiceApplication | where {$_.TypeName.Equals(“PowerPoint Service Application”)}
    $p.EnableSandboxedViewing = $false
    $p.EnableSandboxedEditing = $false
    $p.EnableSandboxedViewing
    $p.EnableSandboxedEditing 

    #(Please use the below script for PowerPointServiceApplication – You need to enter “Y” for the answer of each cmd)
    Get-SPPowerPointServiceApplication | Set-SPPowerPointServiceApplication -EnableSandboxedViewing $false
    Get-SPPowerPointServiceApplication | Set-SPPowerPointServiceApplication -EnableSandboxedEditing $false

  • In the server’s c:windowssystem32inetsrvconfigapplicationHost.config
    Add the line below in the end of the dynamicTypes.
    <add mimeType=”application/zip” enabled=”false” />
    IISRESET

___________________________________________________________________________________

 

If after that, opening an Excel document in sharepoint gives you this error: “Unable to process the request. Wait a few minutes and try performing this operation again.

Excel

Then try this as a solution:

  • Click Start, point to All Programs, Microsoft SharePoint 2010 Products, and then SharePoint 2010 Central Administration.
  • On the SharePoint Central Administration home page, in Application Management, click Manage web application –> Sharepoint – 80—> click Service connections- check/select that excel service.

Note: also make sure that here you have the word and powerpoint services checked here!

___________________________________________________________________________________

 

Also, Check if you are opening your document in protected view. To disable this, follow these steps (from Sharepoint 2010 – how to):

Disable protected view

  1. Run one of the Office 2010 application (e.g. Word 2010).
  2. Click on File menu, and select Options.
  3. In the “Options” dialog, select Trust Center in the left pane.
  4. Click on Trust Center Settings in the right pane.
  5. Select Protected View in the left pane of “Trust Center” dialog.
  6. Disable any of all of the protected view options as below by unticking the check boxes:
    • Enable Protected View for files that fail validation
    • Enable Protected View for files originating from the Internet
    • Enable Protected View for files located in potentially unsafe locations
    • Enable Protected View for Outlook attachments

___________________________________________________________________________________

 

After this point, most doc, docx and xlsx files will open, though there are still some persistent ones that fail to open.

Opening a Word doc gives this error: “Word Web App cannot open this document for viewing because of an unexpected error. To view this document, open it in Microsoft Word.

Word web app

Apparently this happens when the extension isn’t supported by the Web Apps. Yet, the doc format should be supported, since Microsoft says this about it:
Doc can be viewed in Word Web App. Word Web App converts the DOC-file to a DOCX-file so it can also be edited.
See an overview of all the supported file types here.

Note that xls is not supported by the Office Web Apps, not for viewing or editing. This format is only supported on their SkyDrive.

___________________________________________________________________________________

 

Make sure that you check your permissions. For this, read: Account permissions and security settings (SharePoint Server 2010).
This wasn’t a part of my problem, though.

___________________________________________________________________________________

 

Have a look at the logs of Sharepoint.
A very nice way to view them in realtime and record certain action is the ULS Viewer.

ULS Viewer

In the Logs of Sharepoint (default in C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14LOGS), I found this:
Librarian.BeginGetItem(F5a78dec131294bd88974b77dc36ee258mf05929c85d10495083846cfb9519854bm9b1ce232beae4457ab0bc9bbbf4c501fm, Png, docdata.xml)      bdbb85bf-03a5-49c1-ba53-1d24350ceb8e
ViewStore.BeginGetItem(F5a78dec131294bd88974b77dc36ee258mf05929c85d10495083846cfb9519854bm9b1ce232beae4457ab0bc9bbbf4c501fm, Png, docdata.xml)      bdbb85bf-03a5-49c1-ba53-1d24350ceb8e
ViewStore.SetCompleted(F5a78dec131294bd88974b77dc36ee258mf05929c85d10495083846cfb9519854bm9b1ce232beae4457ab0bc9bbbf4c501fm, Png, docdata.xml) – status = ConversionError          bdbb85bf-03a5-49c1-ba53-1d24350ceb8e
Librarian.SetCompleted(F5a78dec131294bd88974b77dc36ee258mf05929c85d10495083846cfb9519854bm9b1ce232beae4457ab0bc9bbbf4c501fm, Png, docdata.xml) – status = ConversionError          bdbb85bf-03a5-49c1-ba53-1d24350ceb8e

So, it seems that my issue is related to a ConversionError.
This seems consistent with what Microsoft says about DOC files: “Word Web App converts the DOC-file to a DOCX-file so it can also be edited.
I read this about it: “Worker processes: The Word Viewing service application and the PowerPoint service application uses worker processes to convert documents and presentations into a series of PNG images or into XAML (if Silverlight is installed), and temporarily stores output locally on-disk. Administrators can configure worker process settings to optimize performance by using SharePoint Central Administration and by using Windows PowerShell.”

Silverlight

Which makes me next step installing Silverlight. Close IE and Install Silverlight. Afterwards, restart it, then the error will change into:
ViewStore.SetCompleted(F5a78dec131294bd88974b77dc36ee258m1d5b8f44cba04d6d8ea29c2e96ab6c3fmc29170dd4f924af69ed2f40ad4367e83m, Silverlight, docdata.xml) – status = ConversionError       3aa0ec44-999c-46e9-ac1d-24ee6ea878d7
Librarian.SetCompleted(F5a78dec131294bd88974b77dc36ee258m1d5b8f44cba04d6d8ea29c2e96ab6c3fmc29170dd4f924af69ed2f40ad4367e83m, Silverlight, docdata.xml) – status = ConversionError       3aa0ec44-999c-46e9-ac1d-24ee6ea878d7

___________________________________________________________________________________

 

Document side

After trying all these thing on the server side, it’s time to have a look at the documents themselves. Why would some of them open without any problems and some wouldn’t? It’s the same extension, so that can’t be an issue.
Turns out that when we save and upload the documents without a header and custom user data, the documents that failed before open nicely in the browser now!!

To inspect a document for user data:

  1. Open the document in the office application (for example Word).
  2. Click on the big, round Office button in the left upper corner.
  3. Click on Prepare.
  4. Click on Inspect document.

I haven’t found an article from Microsoft so far that states which features you can include in a document that you upload to sharepoint and which you can’t.  Has anyone come across such an article?

 

 

 

Synchronize data to FTP with WinSCP

Synchronize data to FTP with WinSCP

I recently discovered WinSCP, a Free SFTP, FTP and SCP client for Windows. It has a graphical interface, but for me the most important feature is that you can easily script your way to a very fast and automated synchronization system with the software.

WinSCP

First download and install the WinSCP software.

Then, create a txt file somewhere on your computer and use a similar script:
# Automatically answer all prompts negatively not to stall the script on errors
option batch on
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
open ftp://user:password@IPaddress
# Change remote directory
cd /myDestinationFolder/myDestinationSubFolder
# Force binary mode transfer
option transfer binary
synchronize remote C:mySourceFoldermySourceSubFolder
# Disconnect
close
# Exit WinSCP
Exit

Then create a bat file in the same directory:
@ECHO off
cd “C:Program FilesWinSCP”
winscp.exe /console /script=C:PathToTxtFileJustCreatedTxtFileJustCreated.txt /log=”C:LogPathwinscp.log”

Then you can use TaskScheduler to schedule the bat file and your synchronization process is complete!

Full and differential backups in SQL

Full and differential backups in SQL

To set up backups automatically, use these scripts in combination with SQL Agent. In general, you make a full backup once a week and the rest of the week differential backups. Each differential backup holds the data between the time the differential backup was taken and the time that the last full backup was taken.

Full and differential backup in SQL

– Full backup

DECLARE @filename AS VARCHAR(255)
DECLARE @backupSetId AS INT

SET @filename = N‘C:DBBackupDailyBackupDBName_‘ + CAST(YEAR(GETDATE()) AS VARCHAR(4)) + CAST(MONTH(GETDATE()) AS VARCHAR(2)) + CAST(DAY(GETDATE()) AS VARCHAR(2)) + N’.bak’
BACKUP DATABASE [DBName] TO  DISK = @filename WITH NOFORMAT, INIT,  NAME = N’DBName-Full Database Backup’, SKIP, NOREWIND, NOUNLOAD,  STATS = 10
select @backupSetId = position from msdb..backupset where database_name=N’DBName’ and backup_set_id=(select max(backup_set_id) from msdb..backupset where database_name=N’DBName’ )
if @backupSetId is null begin raiserror(N’Verify failed. Backup information for database ”DBName” not found.’, 16, 1) end
RESTORE VERIFYONLY FROM  DISK = @filename WITH  FILE = @backupSetId,  NOUNLOAD,  NOREWIND

 

– Differential backup

DECLARE @filename AS VARCHAR(255)
DECLARE @backupSetId AS INT

SET @filename = N’C:DBBackupDailyBackupDBName_Diff_’ + CAST(YEAR(GETDATE()) AS VARCHAR(4)) + CAST(MONTH(GETDATE()) AS VARCHAR(2)) + CAST(DAY(GETDATE()) AS VARCHAR(2)) + N’.bak’
BACKUP DATABASE [DBName] TO  DISK = @filename WITH  DIFFERENTIAL , NOFORMAT, INIT,  NAME = N’DBName-Differential Database Backup’, SKIP, NOREWIND, NOUNLOAD,  STATS = 10
select @backupSetId = position from msdb..backupset where database_name=N’DBName’ and backup_set_id=(select max(backup_set_id) from msdb..backupset where database_name=N’DBName’ )
if @backupSetId is null begin raiserror(N’Verify failed. Backup information for database ”DBName” not found.’, 16, 1) end
RESTORE VERIFYONLY FROM  DISK = @filename WITH  FILE = @backupSetId,  NOUNLOAD,  NOREWIND

 

Note: You can’t make a differential backup before having first created a full backup.
Note 2: Change DBName in the code above in the name of your own database!
Note 3: If you copy/paste this code in SQL Server, please remove the single quotes and type them again. For some reason, my blog makes them into foreign characters for SQL Server.

Save an image from SQL Server to a file using SQL

Save an image from SQL Server to a file using SQL

Images take up a lot of space in a database. SQL Server databases aren’t cheap to come by at a hosting company and especially not big ones. Therefore, the last thing you would want, is to save your images into the database. I’ve never been in favor of this method, to use the image type in SQL Server. I always recommend saving the path as a VARCHAR in the database.

Yet, sometimes, you’re stuck with someone else’s database design and all of a sudden the issue of space comes up and there you are in the middle of a struggle to save the images from SQL Server to a file using SQL. Sure, you could use other programming languages, but I couldn’t resist using SQL :) .

Save an image from SQL Server to file in SQL

This script will help with this task:

DECLARE @SOURCEPATH VARBINARY(MAX),
@DESTPATH VARCHAR(MAX),
@ObjectToken INT,
@image_ID BIGINT

DECLARE IMGPATH CURSOR FAST_FORWARD FOR
SELECT Image_Data, image_ID from T_MyImageTable
OPEN IMGPATH

FETCH NEXT FROM IMGPATH INTO @SOURCEPATH, @image_ID

WHILE @@FETCH_STATUS = 0
BEGIN
SET @DESTPATH = ‘c:mypath’ + CAST(@image_ID AS varchar) + ‘.jpg’

EXEC sp_OACreate ‘ADODB.Stream’, @ObjectToken OUTPUT
EXEC sp_OASetProperty @ObjectToken, ‘Type’, 1
EXEC sp_OAMethod @ObjectToken, ‘Open’
EXEC sp_OAMethod @ObjectToken, ‘Write’, NULL, @SOURCEPATH
EXEC sp_OAMethod @ObjectToken, ‘SaveToFile’, NULL, @DESTPATH, 2
EXEC sp_OAMethod @ObjectToken, ‘Close’
EXEC sp_OADestroy @ObjectToken

FETCH NEXT FROM IMGPATH INTO @SOURCEPATH, @image_ID
END

CLOSE IMGPATH
DEALLOCATE IMGPATH

 

Note 1: Copy/pasting the single quotes in the code above will result in an error in SQL Server Management Studio. You will have to remove them and type them again to make the script work.

Note 2: If your image table is very large then this process will require a lot of resources from your computer. In that case, you might consider using a where clause in the cursor select statement.
For example: SELECT Image_Data, image_ID from T_MyImageTable WHERE image_ID < 10000
Then he will first extract the first possible 10000 images. Next, run the script again with
SELECT Image_Data, image_ID from T_MyImageTable WHERE image_ID >= 10000 AND image_ID < 20000
and so on …

Show multiple rows in one column in SQL

Show multiple rows in one column in SQL

Some websites still use a rather old database to store their data. The one I’m currently facing is MS SQL Server 2000.

Databases - MS SQL Server 2000

I’ve been looking for a way to show multiple rows in one column, one cell. The content of it separated by comma’s.

For example, in stead of:

ProjectID                    Label
————                   ——–
1200                           label1
1200                           label2
1200                           label3

I would like the result of my query to look like this:
ProjectID                    Label
————                   ——–
1200                          label1, label2, label3

In SQL Server 2000 this isn’t such a straightforward thing to do. After some googling, I came across a very useful forum that helped me out. I can use a function to return the list of labels:

USE myDatabaseName
GO
CREATE FUNCTION dbo.ConcatLabels(@projectID int)
RETURNS VARCHAR(8000)
AS
BEGIN
DECLARE @Output VARCHAR(8000)
SELECT @Output = COALESCE(@Output+’, ‘, ”) + CONVERT(varchar(20), b.label_name)
FROM dbo.[T_labelproject] a
JOIN dbo.T_label b ON b.labelID = a.labelID
WHERE a.projectID = @projectID
ORDER BY b.label_Name
RETURN @Output
END
GO

Query it with:
SELECT projectID, dbo.ConcatLabels(projectID) AS Label FROM T_Project

 

 

 

Resizing Lightbox images

Resizing Lightbox images

I’m using Lightbox2 in my newest project to show images. The images, though, are way too big to show in their original size. I was surprised that I couldn’t find a property or something in the code to resize the images. After some researching on Google and figuring out a resize calculation, I made the following adjustments to the code to resize my images without having to resize each one of them before uploading:

Lightbox.css

Change:
#lightbox img{ width: auto; height: auto;}

To:
#lightbox img{ max-width: 600px; }

Lightbox.js

Change:
imgPreloader.onload = (function(){
this.lightboxImage.src = this.imageArray[this.activeImage][0];
this.resizeImageContainer(imgPreloader.width, imgPreloader.height);
}).bind(this);
imgPreloader.src = this.imageArray[this.activeImage][0];
},

To:
imgPreloader.onload = (function(){
this.lightboxImage.src = this.imageArray[this.activeImage][0];
this.resizeImageContainer(600, imgPreloader.height / (imgPreloader.width/600));
}).bind(this);
imgPreloader.src = this.imageArray[this.activeImage][0];
},

I choose to always show the images with a width of 600px. So, if you want a different width, then change the 600 to the number you choose. You can also go with a height in stead of a width, but then you have to change the calculation formula a bit and use the max-height property in the CSS file.

Say no to unwanted anonymous phone calls

Say no to unwanted anonymous phone calls

I’ve received quite a lot of unwanted, anonymous calls lately on my iphone. I find it quite annoying and so I tried to find a way to block them. However, apps like these don’t seem to be allowed in the app store. There are a few apps available for jailbroken iphones, but I have no intention on venturing on that road.

As a workaround, I am now using a silent ringtone :) .

How does this work? Well, if you know the number that is bothering you, then you can follow the instructions of Macworld’s Mac OS X Hints here: http://hints.macworld.com/article.php?story=20080522211148943

If you’re, however, like me and you don’t know the number, then you can download the silent ringtone there and do the following:

  1. Put the ringtone on your iphone
  2. Go to settings -> sounds -> ringtone and select the silent ringtone as your default ringtone. Also set the vibrate function to off, then you won’t notice a call at all anymore!
  3. For every contact in your address book, add a different ringtone.

This way, you’ll hear when a contact in your address book tries to reach you, but you won’t be bothered anymore with any other call.

So peaceful :)