Wednesday, October 03, 2012

PowerShell elevated privileges

Just a quick note: if you need to perform any task that requires elevated privileges, you can throw the following command in PS and gain it: PS> Start-Process powershell -Verb runAs It's the same as "Run as Administrator" bye

Sunday, July 22, 2012

raspberry pi experiences, and some related windows phone apps

So, after some weeks, I received my Raspberry PI card. If you don’t know anything about it please check http://en.wikipedia.org/wiki/Raspberry_pi and http://www.raspberrypi.org/.

I started a hunt to find the “right” setup for my needs: link the thing to my LCD tv, and use the PI both as a media center and a linux box to surf internet, read mail, download torrents, and to give my sons an idea of a “different” approach to computers :-).

I tried some distribution, Debian, Raspbian, RaspBMC, OpenELEC… and every single setup had its pros and cons. Actually I decided to stick with Debian “Wheezy” and OpenELEC 4 Debian on it (http://www.raspberrypi.org/phpBB3/viewtopic.php?t=9210); when I launch OpenELEC I can also use my Windows Phone to control remotely the media center, and it’s quite fun (also the geekness factor in doing that is very high). The WP app I use is “XBMC Remote”, from 7illusions - http://www.windowsphone.com/it-it/apps/7eb3b1d3-0183-46c0-8c55-5f1cf652eb30 – they also build a Squeezebox remote control for WinPhones, “SqueezeRemote”.

Right now I’m installing on Debian X session a torrent client (Transmission) and at the same time verifying disk space and network configuration thru ssh with another Windows Phone client (the name is “The SSH Client”, it’s free and it works http://www.windowsphone.com/it-it/apps/e8aa1299-e011-486c-9f61-3232c892b17b )

Another approach I’m interested into: Squeezeplug - http://www.squeezeplug.eu/?p=201 – I have another empty SD Card… eheh

I’ll tell you how it goes… happyPI :-)

Tuesday, May 08, 2012

Sql Server 2008, disk space

Found these commands useful, when dealing with Sql Server 2008 disk space allocation and log shrinking; in sql 2008 as you probably know you cannot use any more the command BACKUP LOG databasename WITH TRUNCATE ONLY as shown for example here: to obtain the same result you can do the following:

alter database [database_name] set recovery simple        
go
checkpoint        
go
alter database [database_name] set recovery full        
go
backup database [database_name] to disk = 'd:\temp\filename.bak' with init        
go
dbcc shrinkfile (N'DATABASE_NAME_log' , 1)        
go

To monitor disk space allocated, check for the usage of

EXEC sp_spaceused @updateusage = N'TRUE';

The following procedure uses the sp_spaceused procedure to list each table’s space:

CREATE PROCEDURE GetAllTableSizes      
AS
-- Lists spaced used data for ALL user tables in the database
DECLARE @TableName VARCHAR(100)    --For storing values in the cursor
--Cursor to get the name of all user tables from the sysobjects listing
DECLARE tableCursor CURSOR
FOR
    select [name]
    from dbo.sysobjects
    where  OBJECTPROPERTY(id, N'IsUserTable') = 1
FOR READ ONLY
--A procedure level temp table to store the results      
CREATE TABLE #TempTable
(
    tableName varchar(100),
    numberofRows varchar(100),
    reservedSize varchar(50),
    dataSize varchar(50),
    indexSize varchar(50),
    unusedSize varchar(50)
)
--Open the cursor      
OPEN tableCursor
--Get the first table name from the cursor      
FETCH NEXT FROM tableCursor INTO @TableName

--Loop until the cursor was not able to fetch      
WHILE (@@Fetch_Status >= 0)
BEGIN
    --Dump the results of the sp_spaceused query to the temp table
    INSERT  #TempTable
        EXEC sp_spaceused @TableName

    --Get the next table name      
    FETCH NEXT FROM tableCursor INTO @TableName
END
--Get rid of the cursor      
CLOSE tableCursor
DEALLOCATE tableCursor
--Select all records so we can use the reults      
SELECT *
FROM #TempTable
--Final cleanup!      
DROP TABLE #TempTable
GO 

Friday, March 30, 2012

Speed Up Windows 7 Taskbar Navigation with a Registry Hack

As you can read on Lifehacker (here), and on a number of other sites, with a simple registry hack you can modify the way windows handles clicks on stacked apps in the taskbar.

Here is the tweak:

  • Launch regedit.exe (Win+R, then paste regedit.exe)
  • Navigate in the left tree control to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
  • Go to Edit->New->DWORD (32-bit) Value
  • Name the value LastActiveClick
  • Hit enter to assign the value and change it to 1
  • Restart Explorer and you're good to go.

To restart Explorer without rebooting, open the Task Manager (Ctrl+Shift+Esc) and end the Explorer.exe process. Then create a new task (under "File") and paste "explorer.exe".

Tuesday, March 06, 2012

Facebook again–apps on fan page

How can I publish an app on a fan page?

Obviously you need to have admin rights on the destination page, then you can use this url:

https://www.facebook.com/dialog/pagetab?app_id=APP_ID&next=APP_URL

Substitute APP_ID with your app id (get it from the settings page on https://developers.facebook.com/apps) and insert the “Secure canvas url” (find it on the same settings page).

Then, if everything’s ok, you will be prompted with a list of pages; choose one and you’re done.

New Fan page look (“Timeline”)

After the switch to the new fanpages look and feel, I noticed that there is a limit on the number of apps that you can “pin” in the apps thumbnails list. The limit is 12 (three rows of 4 apps).

This is not a limit to the number of apps that a fan page can host; only a limit to the thumbnails list.