Solving development problems  |  About this blog

Archive for the ‘Programming Techniques’ Category

Visual Source Safe Analyze and Repair tool problems

This is the solution if you got this error message when trying to do Analyze and Repair some VSS database using does prompt command:
C:\>”C:\Program Files (x86)\Microsoft Visual SourceSafe\analyze.exe” -F -V3 -D “\\my_server\my_vss_database\data

Error was:

Database analysis in progress File ../data/status.dat is already open Cannot rebuild the database while Visual SourceSafe is being run. Make sure all users have exited SourceSafe and try again.

Solution

Make sure there are no users connected to the VSS database (running ssexp, ssadmin, etc), that users cannot connect to the database using the web service (they connect only for short times, so it’s hard to see them listed as logged in with ssadmin), and that VSS LAN Service is stopped (use net stop ssservice), as it may keep a connection open to the database.

Get all project files from Visual Source Safe for a given date

If you are developing some application and use Visual Source Safe as version control software then you probably needed (at least one time) to retrieve all files from your project for specific day from the past.
Visual Source Safe does not allow you to do this from its GUI but there is a DOS command that can help you.

To use the command-line, you must set the Environment Variable for SSDIR to the location of your working SourceSafe database, such as \\Dev1\VSS where Dev1 is the name of the server and VSS is the name of the share where the database is located. You may also need to add ss.exe path to your PATH variable – it is usually in folder: c:\Program Files (x86)\Microsoft Visual SourceSafe\

This is the command:

ss Get "$/your_vss_folder" -R -Vd15-03-2009;2:00a

or just without an hour

ss Get "$/your_vss_folder" -R -Vd15-03-2009
  • First parameter is folder under your Visual Source Safe project
  • -R means to get all files recursively
  • -V means date and in this example we get all files for 15.3.2009

QR Codes API – automatically generated for given content

There are a lot of  QR Code generators on a web and there is also listed our generator – available at http://qrcode.good-survey.com

It already went over simple generator functionality and new features are adding.

QR Codes Generator and API

QR Codes Generator and API

Basically, beside QR Code generation, we are offering as addition:

  • Tracking of generated QR Codes – for marketing managers ti know which locations work best (i.e. posters with printed QR Code)
  • Dynamic QR Codes – if some QR Code is already printed you can make it point to completely different URL without changing the printed code
  • Adding your logo inside QR Code (with readability testing) – branding feature
  • All types of content are supported (hyperlinks, custom text, vCard, Bizcard, Mecard,  vCalendar, social networks – Twitter, Facebook, YouTube, Geo locations and maps, SMS messages, phones,…)
  • Strong use of API – automating generation process and possibility to use from your application/website – this is what we will talk about a little bit more in this article…

Using API is not complicated at all, we wrote a tutorial which is easy to understand.

Here is an example how you can have instantly QR Code image on your website:

This are direct links:

This how it could look like inside your website (just put this hyperlink inside your IMG tag)

<img src="http://qrcode.good-survey.com/api/v2/generate?content=
http%3a%2f%2fmaps.google.com%2fmaps%3ff%3dq%26q%3d46.043286%2c14.492791300000022%
26q%3d30%2bTeslova%2bUlica%252c%2bLjubljana%2b1000%252c%2bSlovenia&
format=png&padding=2&size=10&em=byte&ec=m" alt="Avivo location" />
Try it also by yourself – just download DEMO API application from CodePlex and you can play with supported API features.

How to get Twitter statuses and Retweets together?

Use Twitter API

http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=avivo&include_rts=true

Where avivo is Twitter username (replace with yours)

Check API Rate limitation (anonymous: 150 requests/hour, authenticated: 350 requests/hour)

http://api.twitter.com/1/account/rate_limit_status.xml

Written by Avivo

May 3rd, 2011 at 11:00 pm

Transact SQL paging Store Procedure – LINQ Skip Take alternative

This Transact-SQL Store Procedure allows you to do paging on your SQL table by providing only two parameters:

  • Current page
  • Record to display per page

It returns chosen records and also total count as output parameter if you need to display this information or calculate how many pages you have in paging control.

CREATE PROCEDURE [dbo].[YourProcedureName]
  @CurrentPage int,
  @RecordsPerPage int,
  @Count int OUTPUT
AS
BEGIN
  -- The number of rows affected by the different commands
  -- does not interest the application, so turn NOCOUNT ON
  SET NOCOUNT ON

  -- Determine the first record and last record
  DECLARE @FirstRecord int, @LastRecord int

  SELECT @FirstRecord = (@CurrentPage - 1) * @RecordsPerPage
  SELECT @LastRecord = (@CurrentPage * @RecordsPerPage + 1)
  SET @Count = (SELECT COUNT(*) FROM YourTable);

  WITH TempResult as
  (
    SELECT	ROW_NUMBER() OVER(ORDER BY Field1 DESC) as RowNumber,
            Field1,
            Field2
    FROM    YourTable
  )
  SELECT  TOP (@LastRecord - 1) *
  FROM    TempResult
  WHERE   RowNumber > @FirstRecord AND
          RowNumber < @LastRecord

  -- Turn NOCOUNT back OFF
  SET NOCOUNT OFF
END

Written by Avivo

April 25th, 2011 at 9:03 am