29 October 2012

Copia solo i file più recenti - copia Dump SQL

Option Explicit

Function GetLatestFile(wPath)
   
 Dim fNewest
 dim oFolder
 dim aFile
  
 Set oFolder = CreateObject("Scripting.FileSystemObject").GetFolder(wPath)
 
 For Each aFile In oFolder.Files
     If fNewest = "" Then
         Set fNewest = aFile
     Else
         If fNewest.DateCreated < aFile.DateCreated Then
             Set fNewest = aFile
         End If
     End If
 Next
    
    Set oFolder = nothing
    GetLatestFile = fNewest
    
End Function


Function DumpCopy()

 dim fs 
 dim src
 dim dst
 dim ele(9)
 dim s
 dim wPath
 dim wFrom
 dim wTo

 set fs = createobject("Scripting.FileSystemObject")
 
 src = "\\sqlsrv\c$\Programmi\Microsoft SQL Server\MSSQL10_50.SQL2005\MSSQL\Backup"
 dst = "C:\- DB Dump\GV"
 
 
 ' -- RINOMINA DST DIR
 fs.MoveFolder dst, dst & "_OLD"
 fs.CreateFolder dst

 
 ' -- COPIA I FILE NELL'ELENCO 
 ele(0) = "ASS_VDS"
 ele(1) = "EuroGVen2000"
 ele(2) = "Eurotax"
 ele(3) = "GVSYS"
 ele(4) = "GVxData"
 ele(5) = "ITPortal_RenaultDacia"
 
 for each s in ele
  if s <> "" then
   wPath = src & "\" & s
   wFrom = GetLatestFile(wPath)
   wTo = dst & "\" & fs.GetFile(wFrom).Name
   
   'MsgBox wFrom & vbCrLf & wTo
   fs.CopyFile wFrom, wTo, True
  end if
 next
 
 
 ' -- ELIMINA OLD
 fs.DeleteFolder dst & "_OLD"
 
 set fs = nothing
  
End Function



const cTitle = "Copia dump SQL"

'if MsgBox("Copio i dump?", vbQuestion + vbYesNo, cTitle) = vbYes then
    DumpCopy
    MsgBox "Fatto!", vbInformation, cTitle
'end if

18 October 2012

Install the PyDev plug-in for Eclipse

Path per installazione:
http://pydev.org/updates/

Path Interpreter
Windows:
C:\Program Files\Python32\python.exe
C:\Python27\python.exe
Mac OSX 10.5:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7

Plugin Eclipse Color Theme
http://eclipse-color-theme.github.com/update

Qui le istruzioni

15 October 2012

Chrome non si apre

Dopo aver killato i processi di Chrome, l'app non si apre. Se nei log viene visualizzato il seguente errore:
ERROR:process_singleton_mac.cc(106)] Unable to obtain profile lock.

Questa è la soluzione:

I had a similar problem I was able to fix by doing the following: Open Finder, go to ~/Library/Application Support/Google. Move the Chrome folder to the trash and then Chrome will start up! This is kind of a bummer because it will erase all of your settings (you'll even have to reselect your default search provider), but if you have sync set it up, you just turn it back on and it's like nothing ever happened.


Trovato qui.

11 October 2012

SQL 2008 - 2012 - Declare and Assign Variable in Single Statement

Vecchio metodo (dichiarare la variabile e poi settarla):
DECLARE @iVariable INT
DECLARE @vVariable VARCHAR(100)
DECLARE @dDateTime DATETIME

SET @iVariable = 1
SET @vVariable = 'myvar'
SET @dDateTime = GETDATE()

SELECT @iVariable iVar, @vVariable vVar, @dDateTime dDT

Oppure:
DECLARE @iVariable INT; SET @iVariable = 1
DECLARE @vVariable VARCHAR(100); SET @vVariable = 'myvar'
DECLARE @dDateTime DATETIME; SET @dDateTime = GETDATE()

SELECT @iVariable iVar, @vVariable vVar, @dDateTime dDT

Nuovo metodo (.NET-style):
DECLARE @iVariable INT = 1
DECLARE @vVariable VARCHAR(100) = 'myvar'
DECLARE @dDateTime DATETIME = GETDATE()

SELECT @iVariable iVar, @vVariable vVar, @dDateTime dDT

Trovato qui.

Color Coding SQL Server Management Studio Status Bar


Trovato qui.

04 October 2012

NTBackup - errore su nuovo supporto (DAT)

NTBACKUP - errore "Impossibile individuare il supporto o la periferica di backup specificati. L'operazione di backup verrà interrotta."


metti
/um
alla fine della stringa di backup: elimina il controllo della label sul nastro.

http://usenet.it.rooar.com/showthread.php?t=640873



C:\WINDOWS\system32\ntbackup.exe backup "@C:\bks per selezione\selezioni backup.bks" /n "mercoledì" /d "Set creato il 06/09/2012 alle 15.47" /n "mercoledì" /v:yes /r:no /rs:no /hc:on /m normal /j "mercoledì" /l:f /p "4mm DDS" /um


http://ss64.com/nt/ntbackup.html

/um  (Windows 2000 only)

Find the first available media, format it, and use for the current backup.

Use with the /p switch to scan for available media pools. 

This command is only for standalone tape devices (not tape loaders.)

The /UM switch must be at the end of the command line.


http://support.microsoft.com/kb/314844/it




Using Multiple Programming Languages in a Web Site Project

By default, the App_Code folder does not allow multiple programming languages. However, in a Web site project you can modify your folder structure and configuration settings to support multiple programming languages such as Visual Basic and C#. This allows ASP.NET to create multiple assemblies, one for each language.

The App_Code folder is not explicitly marked as containing files written in any one programming language. Instead, the ASP.NET infers which compiler to invoke for the App_Code folder based on the files it contains. If the App_Code folder contains .vb files, ASP.NET uses the Visual Basic compiler; if it contains .cs files, ASP.NET uses the C# compiler, and so on.

 
  
  
 


Trovato qui e qui.

01 October 2012

Get Filename without path/extension

All versions of .Net since 2002 (the first version) has the System.IO.Path namespace that is OS independent, meaning if it's running on Mono (linux or Mac, both of which don't use a "\" as the separater character) it'll still work!
System.IO.Path.GetExtension()
System.IO.Path.GetFileName()
System.IO.Path.GetFileNameWithoutExtension()

Trovato qui.