El TecnoBaúl de Kiquenet

Kiquenet boring stories

Archive for 10 octubre 2014

DBLink Oracle for Insert Select

Posted by kiquenet en 10 octubre 2014

SCHEMA01@DEV
SCHEMA01@PRE

DBLink to PRE is defined in DEV.

DBLink not support BLOB field.

Now, SQL Insert Select for get rows from PRE to DEV:

insert into  SCHEMA01.LOGS (IDPRO, DateLog, res, idserv, user, machine, etiq, pet, LOG)
SELECT 110940, DateLog, res, 53705, user, machine, etiq, pet, EMPTY_BLOB()  FROM SCHEMA01.LOGS@PRE
where etiq is not null  AND machine LIKE ‘OPERATORS%’ and RESULT = ‘KO’

Insert into SCHEMA01.CODES Select * from SCHEMA01.CODES@PRE

Posted in Oracle | Etiquetado: , , | Leave a Comment »

Open WebServer for SVC (WCF Host) in development

Posted by kiquenet en 9 octubre 2014

From Visual Studio, open WebServer with View in Browser (about svc file):

Using Process Monitor, I get full command line:

"C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\11.0\WebDev.WebServer40.exe" /port:9195 /path:"C:\TFS\VSIntegration\VSIntegration.SvcDespliegue.Host" /vpath:"/"

Scripting

@echo off
SET WEBDEV40="%ProgramFiles(x86)%\Common Files\Microsoft Shared\DevServer\11.0\"
SET WEBSERVER40="WebDev.WebServer40.exe"
START /D %WEBDEV40% /B WebDev.WebServer40.exe /port:9195 /path:"C:\TFS\VSIntegration\VSIntegration.SvcDespliegue.Host" /vpath:"/"
SET mypath=%~dp0

REM Error: WebServer crash when I call Svc ¿? Maybe relative path
REM START /D %WEBDEV40% /B WebDev.WebServer40.exe /port:9195 /path:"%mypath%..\..\VSIntegration\VSIntegration.SvcDeployment.Host"

Powershell

function Start-Webserver
{
    PARAM
    (
        [ValidateNotNull()]
        [int]$port = 8080,

        [ValidateNotNullOrEmpty()]
        [ValidateScript({Test-Path $_})]
        [string]$path = (pwd)
    )

    Set-Variable PROCESSDIRECTORY -Option Constant -value ([System.Environment]::ExpandEnvironmentVariables('%CommonProgramFiles(x86)%\Microsoft Shared\DevServer\11.0\'))
    Set-Variable PROCESSNAME -Option Constant -value 'WebDev.WebServer40.exe'

    $matchingProcesses = Get-WmiObject Win32_Process -Filter " name = '$PROCESSNAME' " |
        Where-Object { $_.CommandLine -like "*/port:$port*" }

    if($matchingProcesses -ne $null)
    {
        # output a warning if another path than given path is used by existing process
        if(-not($matchingProcesses.CommandLine -like "*/port:$port /path:$path"))
        {
            Write-Warning ('Process "{0}" with PID "{1}" already listening to port "{2}"
CommandLine: "{3}"' -f $matchingProcesses.Name, $matchingProcesses.Handle, $port, $matchingProcesses.CommandLine)
        }
        return
    }

    & "$PROCESSDIRECTORY$PROCESSNAME" /port:$port /path:$path
    & start http://localhost:$port/
}

Sources:
http://learningpcs.blogspot.com.es/2011/08/utility-webdevwebserverexe.html
http://blog.gehtnicht.at/p/2014/06/24/start-webdev-webserver40-exe-with-powershell/

Posted in .NET, Comandos, Scripts | Etiquetado: , , | Leave a Comment »

Error in Pre Build (Post Build) Event

Posted by kiquenet en 9 octubre 2014

About this error when you compiles a project.

Unable to copy file "C:\TFS\Main\AddIn\FicPwd.key" to "bin\Debug\FicPwd.key". Access to the path ‘bin\Debug\FicPwd.key’ is denied.

$(TargetDir) = C:\TFS\Main\AddIn\bin\Debug

For PreBuild Event:

attrib -r "$(TargetDir)FicPwd.key"
if ERRORLEVEL 1 goto EXIT

:EXIT

Maybe using Powershell

$computer = gc env:computername

$fileList = Get-ChildItem ".\InfoPath Form Template" | Where-Object {$_.name -like "*.dll" -or $_.name -like "*.pdb" -or $_.name -like "*.xsf"  }

foreach ($fileItem in $fileList)
{
$fileItem.set_IsReadOnly($false) # Remove readonly flag
}

Sources:
http://stackoverflow.com/questions/7151484/fail-on-post-build-event
http://ddkonline.blogspot.com.es/2010/06/how-to-change-read-only-attribute-of.html

Posted in Comandos, Scripts, VisualStudio | Etiquetado: , , , | Leave a Comment »

Undo, unlock file (User’s checkout) in TFS

Posted by kiquenet en 6 octubre 2014

    Like Brett Rogers posted in StackOverflow:

    There are at least 2 different ways to do this:

    Command Line

    There is a command-line utility called Tf.exe that comes with Team Explorer. Find the documentation here. It can be accessed by launching a Visual Studio Command Prompt window.

  • Open up Visual Studio command prompt (Start -> Programs -> Microsoft Visual Studio 200X -> Visual Studio Tools -> Visual Studio 200X Command Prompt)
  • Run the following command: tf.exe

tf Command
http://msdn.microsoft.com/en-us/library/cc31bk2e.aspx

Deleting the workspace

tf workspace /delete WorkspaceName;User
             /server:http://server:8080/tfs/MyTeamCollection 

tf lock /lock:none /workspace:WorkspaceName;USERNAME /recursive $/

To get the list of workspaces for a user, just run the following command from the same prompt:

tf workspaces /owner:username

Real sample:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>tf undo /workspace:TeamAdministration;mydomain\myuser $/Administration/WebUI/App_Data/Web.sitemap /recursive

No pending changes were found for $/Administration/WebUI/App_Data/Web.sitemap.

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>tf lock /lock:none /workspace:TeamAdministration;mydomain\myuser $/Administration/WebUI/App_Data/Web.sitemap /recursive

TF10152: The item $/Administration/WebUI/App_Data/Web.sitemapmust remain locked because its file type prevents multiple check-outs.

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>tf workspace /delete TeamAdministration;mydomain\myuser

A deleted workspace cannot be recovered.

Workspace ‘TeamAdministration;mydomain\myuser’ on server ‘http://myteamserver:8080/ has 0 pending change(s).

Are you sure you want to delete the workspace? (Yes/No) Y

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>tf undo /workspace:TeamAdministration;mydomain\myuser $/Administration/WebUI/App_Data/Web.sitemap /recursive

TF14061: The workspace TeamAdministration;mydomain\myuser does not exist.

GUI

The second is via the GUI, but does not come standard – you have to install the TFS Power Tools. See here for details on how to use this method.

Keep in mind that with either method you will need the appropriate rights. The permissions are called "Undo other users’ changes" and "Unlock other users’ changes". These permissions can be viewed by:

  1. Right-clicking the desired project, folder, or file in Source Control Explorer
  2. Select Properties
  3. Select the Security tab
  4. Select the appropriate user or group in the Users and Groups section at the top
  5. View the "Permissions for [user/group]:" section at the bottom


Another good option, use the free TFS Sidekick application

Sources:

http://stackoverflow.com/questions/1690520/how-to-undo-another-user-s-checkout-in-tfs

http://stackoverflow.com/questions/268865/what-do-you-do-if-the-file-in-tfs-is-locked-by-someone-else

http://stackoverflow.com/questions/14777535/tfs-file-must-remain-locked

http://xavierdilipkumar.com/post/2013/01/24/TF10152-The-item-$-must-remain-locked-because-its-file-type-prevents-multiple-check-outs.aspx

Posted in Comandos, Soporte, TFS | Etiquetado: , , , , | Leave a Comment »