working on it ...

Filters

Explore Public Snippets

Sort by

Found 16k snippets matching: move

    public by Uriahs  310484  2  6  0

    Move borderless form VB.NET

    Code to move a borderless winform which is not moveable by default
    Dim drag As Boolean
       Dim mousex As Integer
       Dim mousey As Integer
       Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
           drag = True 'Sets the variable drag to true.
           mousex = Windows.Forms.Cursor.Position.X - Me.Left 'Sets variable mousex
           mousey = Windows.Forms.Cursor.Position.Y - Me.Top 'Sets variable mousey
       End Sub
    
       Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
           'If drag is set to true then move the form accordingly.
           If drag Then
               Me.Top = Windows.Forms.Cursor.Position.Y - mousey
               Me.Left = Windows.Forms.Cursor.Position.X - mousex
           End If
       End Sub
    
       Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
           drag = False 'Sets drag to false, so the form does not move according to the code in MouseMove
       End Sub
    

    public by qxshower  135624  2  5  0

    MoveToCodeItem

    Attempts to move the cursor to the specified code item.
    using EnvDTE;
    using SteveCadwallader.CodeMaid.Model.CodeItems;
    using System;
    using System.Collections.Generic;
    using System.Text.RegularExpressions;
    
    /// <summary>
    /// Attempts to move the cursor to the specified code item.
    /// </summary>
    /// <param name="document">The document.</param>
    /// <param name="codeItem">The code item.</param>
    /// <param name="centerOnWhole">True if the whole element should be used for centering.</param>
    internal static void MoveToCodeItem(Document document, BaseCodeItem codeItem, bool centerOnWhole)
    {
        var textDocument = document.GetTextDocument();
        if (textDocument == null) return;
    
        try
        {
            object viewRangeEnd = null;
            TextPoint navigatePoint = null;
    
            codeItem.RefreshCachedPositionAndName();
            textDocument.Selection.MoveToPoint(codeItem.StartPoint, false);
    
            if (centerOnWhole)
            {
                viewRangeEnd = codeItem.EndPoint;
            }
    
            var codeItemElement = codeItem as BaseCodeItemElement;
            if (codeItemElement != null)
            {
                navigatePoint = codeItemElement.CodeElement.GetStartPoint(vsCMPart.vsCMPartNavigate);
            }
    
            textDocument.Selection.AnchorPoint.TryToShow(vsPaneShowHow.vsPaneShowCentered, viewRangeEnd);
    
            if (navigatePoint != null)
            {
                textDocument.Selection.MoveToPoint(navigatePoint, false);
            }
            else
            {
                textDocument.Selection.FindText(codeItem.Name, (int)vsFindOptions.vsFindOptionsMatchInHiddenText);
                textDocument.Selection.MoveToPoint(textDocument.Selection.AnchorPoint, false);
            }
        }
        catch (Exception)
        {
            // Move operation may fail if element is no longer available.
        }
        finally
        {
            // Always set focus within the code editor window.
            document.Activate();
        }
    }            

    public by p.kontalis  1603  0  5  0

    Move Cell Values from a Table Column to another

    ---Take a look of the join tables before the move
    SELECT * 
    FROM vtigercrm600.vtiger_accountbillads
    LEFT JOIN vtigercrm600.vtiger_accountshipads
    ON vtiger_accountbillads.accountaddressid = vtiger_accountshipads.accountaddressid
    WHERE vtiger_accountshipads.ship_street !="" AND vtiger_accountbillads.bill_street=""
    ---Copy the Values
    UPDATE vtigercrm600.vtiger_accountbillads
    LEFT JOIN vtigercrm600.vtiger_accountshipads
    ON vtiger_accountbillads.accountaddressid = vtiger_accountshipads.accountaddressid
    SET vtiger_accountbillads.bill_street=vtiger_accountshipads.ship_street
    WHERE vtiger_accountbillads.bill_street="" AND vtiger_accountshipads.ship_street != "";
    ---Erase the copied values  (or the values are the same in both cells)
    UPDATE vtigercrm600.vtiger_accountbillads
    LEFT JOIN vtigercrm600.vtiger_accountshipads
    ON vtiger_accountbillads.accountaddressid = vtiger_accountshipads.accountaddressid
    SET vtiger_accountshipads.ship_street=""
    WHERE vtiger_accountbillads.bill_street=vtiger_accountshipads.ship_street;
    ---Validation of all transfers
    SELECT * #vtiger_accountbillads.accountaddressid,vtiger_accountbillads.bill_code,vtiger_accountshipads.ship_code
    FROM vtigercrm600.vtiger_accountbillads
    LEFT JOIN vtigercrm600.vtiger_accountshipads
    ON vtiger_accountbillads.accountaddressid = vtiger_accountshipads.accountaddressid
    WHERE (vtiger_accountshipads.ship_city != "" AND vtiger_accountbillads.bill_city="")
    OR (vtiger_accountshipads.ship_code != "" AND vtiger_accountbillads.bill_code="")
    OR (vtiger_accountshipads.ship_country != "" AND vtiger_accountbillads.bill_country="")
    OR (vtiger_accountshipads.ship_state != "" AND vtiger_accountbillads.bill_state="")
    OR (vtiger_accountshipads.ship_pobox != "" AND vtiger_accountbillads.bill_pobox="")
    OR (vtiger_accountshipads.ship_street != "" AND vtiger_accountbillads.bill_street="");
    

    public by sTiLL-iLL  2178  2  7  27

    Parallyzed.js.....never move again,.... or do....

    .... my pattern for concurrant, Parallel Xekution....sick asyncro stuff!
    // my pattern for executing a full-on parrallel series of async tasks!
    
    function Parallyzed(cBakLst, last) {
      var rzlts = [], cnt = 0;
      cBakLst.forEach(function(step, idx) {
        step(function() {
          rzlts[idx] = Array.prototype.slice.call(arguments);
          cnt++;
          if(cnt == cBakLst.length) {
            last(rzlts);
          }
        });
      });
    }
    
    var taskList = [];
    
    function myAsyncTask1(argz, step) {
      var compRZLT = Math.floor(Math.random() * 5 + 1) * 100;
      console.log('task with \''+argz+'\', return in '+compRZLT+' ms');
      setTimeout(function() {
        step(argz * 2);
      }, compRZLT);
    }
    
    taskList.push(myAsyncTask1);
    
    function myAsyncTask2(url, cBak) {
    	var xhr = new XMLHttpRequest();
    	xhr.open('GET', url, true);
    	xhr.responseType = 'JSON';
    	xhr.onload = function () {
    	if (this.status == 200) {
    			var lst = JSON.parse(xhr.responseText);
    			console.log("paths retreived... ");
    		}
    		cBak(lst);
    	};
    	xhr.send({});
    }
    
    taskList.push(myAsyncTask2);
    
    function myAsyncTask3(lst, xp, s, cBak) {
    	lst.forEach(function (itm) {
    		var mp = document.createElement('li');
    		mp.innerHTML = "<a href='#'>" + itm + "</a>";
    		mp.onclick = wenKlik;
    		xp.appendChild(mp);
    	});
    	s.appendChild(xp);
    	cBak(s);
    }
    
    taskList.push(myAsyncTask3);
    
    function myAsyncTask4(argz, step) {
      var compRZLT = Math.floor(Math.random() * 5 + 1) * 100;
      console.log('task with \''+argz+'\', return in '+compRZLT+' ms');
      setTimeout(function() {
        step(arg * 2);
      }, compRZLT);
    }
    
    taskList.push(myAsyncTask4);
    
    function myAsyncTask5(url, argz, step, cBak) {
    	var xhr = new XMLHttpRequest();
    	xhr.open('POST', url, true);
    	xhr.responseType = 'JSON';
    	xhr.onload = function () {
    	if (this.status == 200) {
    			var rzlt = JSON.parse(xhr.responseText);
    		}
    		step(cBak(rxlt));
    	};
    	xhr.send(argz);
    }
    
    taskList.push(myAsyncTask5);
    
    function lastOne(rzlts) {
      console.log('finished!', rzlts);
    }
    
    
    Parallyzed(taskList, lastOne);
    
                            

    public by cghersi  4295  6  6  2

    Move a file to another location in SQL Server

    Here is the procedure to move a file to another location (e.g. for the database called MyDB). First you need to execute the first part of this snippet (until the comment '/**** Now you need to physically move the file to the other location ***/'). Then you need to move the file and eventually you can execute the last two statements.
    ALTER DATABASE MyDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
    
    ALTER DATABASE MyDB SET OFFLINE;
    
    ALTER DATABASE MyDB MODIFY FILE 
    (
       Name = MyDB_file1,
       Filename = 'c:\DB\MyDB.mdf'
    );
    
    /**** Now you need to physically move the file to the other location ***/
    
    ALTER DATABASE MyDB SET ONLINE;
    
    ALTER DATABASE MyDB SET MULTI_USER;

    public by MarcoDeMagistris  4422  2  6  0

    Clearcase: Move mastership

    Move mastership from server1(replica_name1) to Server2(replica_name2)
    Creates a default dynamic view (i.e. default config_spec) and set it (cleartool setview <view_name>)
    
    Vobs check
     - Moving in vobs path: cd /vobs/<vobs_name>
     - Find checkout file, locked elements and triggers on server1.
    		CT=cleartool
    		VOB=`pwd`
    		echo "CHECK CHECKOUT" > log.log
    		cleartool lsco -all -l >> log.log
    		echo "CHECK TRIGGER" >> log.log
    		cleartool lstype -kind trtype >> log.log
    		echo "CHECK FILE LOCKED" >> log.log
    		cleartool lslock -fmt "%Km:%n@$VOB\n" -all vob:$VOB >> log.log
    
    - Remove them using:
    	-	Undo checkout:
    		Find all views with checkout files:
    			cleartool describe -l vob:<vob tag>
    		Removes view checkout from vobs:
    			cleartool rmview -vob . -uuid <view uuid>
    	- Unlock commands: cleartoolt unlock <label, branch, type>
    		#ct unlock brtype:<branch name>
    		#ct unlock brtype:<label name>
    	- Remove triggers running:
    		#cleartool rmtype -rmall trtype:<.triggers_name>
    
    - Check replica running "cleartool lsreplica" commands
    
    - Change Mastership running:
    	 cleartool chmaster -all -long replica_name2 > ~/log
    
    - Check change mastership:
     	cleartool lsmaster -kind attype,branch,brtype,delem,eltype,felem,hlink,hltype,lbtype,slink,vob <replica>
        
    Insert in new Clearcase server (server2), the locked files and the triggers removed previously.

    public by mporru  2439  1  6  0

    Batch: save current path then move to the local path of the launched file

    Example: I'm here: C:\bar\ I launch C:\test\foo.bat (either with the full path or double clicking on the batch file). This batch file is made as below. This script will do the following: 1) save the current path 2) change directory to C:\test 3) execute the commands 4) go back to C:\bar\ before quitting
    :: save current path
    pushd .
    
    cd /d %~dp0
    
    REM put here the commands...
    
    
    :: restore original path
    popd

    public by JMichaelTX  2367  0  3  0

    [EN] Move a Tag to be a Child of a Parent Tag [JXA] - Evernote Mac, JavaScript for Automation

    [EN] Move a Tag to be a Child of a Parent Tag [JXA] - Evernote Mac, JavaScript for Automation: (EN) How to Make Tag a Child Tag of a Parent Tag JXA.js
    /*
    ⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶
      [EN] How to Make Tag a Child Tag of a Parent Tag [JXA]
    ⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶
    
    DATE:    Fri, Jan 15, 2016
    AUTHOR:  JMichaelTX (in most forums)
               Find any bugs/issues or have suggestions for improvement?
               Post below, or contact me via PM or at blog.jmichaeltx.com/contact/
    REF:     
    ⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶⩶
    */
    
    var app = Application.currentApplication();
          app.includeStandardAdditions = true;
    var ENapp = Application("Evernote");
    
    var tagNameStr
    var tagParStr
    
    var strMsg     = "Enter the Tag You Want to Move Under a Parent Tag"
    var strTitle   = "Move Tag"
    
    app.beep()
    var oAns = app.displayDialog(strMsg,
                {
                  withTitle: strTitle,
                  withIcon: "caution",
                  defaultAnswer: ""
                })
    tagNameStr = oAns.textReturned
    
    strMsg = "Enter the PARENT Tag for Tag " + tagNameStr
    app.beep()
    var oAns = app.displayDialog(strMsg,
                {
                  withTitle: strTitle,
                  withIcon: "caution",
                  defaultAnswer: ""
                })
    tagParStr = oAns.textReturned
    
    var tagObj       = ENapp.tags.byName(tagNameStr);
    var tagParObj    = ENapp.tags.byName(tagParStr);
    
    if (tagObj.exists()) {
        if (tagParObj.exists()) {
        
          //--- SET THE PARENT TAG ---
          tagObj.parent = tagParObj
          
          console.log('Tag: ' + tagObj.name() + '   Parent: ' + tagObj.parent.name())
          app.displayAlert ('SUCCESS! \nTag: ' + tagObj.name() 
            + ' \n    has been moved to a child tag of '
            + '\nParent Tag: ' + tagObj.parent.name()
            );
            
        } else {
          app.displayAlert('Parent Tag: ' + tagParStr + ' does NOT EXIST')
        } // END if (tagParObj.exists())
        
      } else {
        app.displayAlert('Tag: ' + tagNameStr + ' does NOT EXIST')
      } // END if (tagObj.exists())
      
    
    
    

    public by congruityservice  2170  1  5  0

    Move Control Over Placeholder Control

    The snippet moves one control over another control. Useful if you need to design a form with place holders and then move the actual field onto that placeholder.
    *Move TXT_FNAME edit line over the LBL_PLACEHOLDER1 label.
    pcopTarget = @WINDOW:".LBL_PLACEHOLDER1"
    pcopSource = @WINDOW:".TXT_FNAME"
    Gosub PlaceControlOverPlaceholder
    
    *
    * Sub moves control over the specified placeholder control
    *
    PlaceControlOverPlaceholder:
    	*Acronym
    	*pcop - Place Control Over Placeholder
    
    	If Unassigned(pcopOffset_X) Then pcopOffset_X = 0
    	If Unassigned(pcopOffset_Y) Then pcopOffset_Y = 0
    
    	pcopS = Get_Property(pcopSource,'SIZE')
    	pcopT = Get_Property(pcopTarget,'SIZE')
    
    	pcopS<1> = pcopT<1> + pcopOffset_X ;* X
    	pcopS<2> = pcopT<2> + pcopOffset_Y	;* Y
    	*S<3> = 100 ;* Width
    	*S<4> = 20	;* Height
    
    	Call Set_Property(pcopSource,'SIZE', pcopS)
    
    	Call Set_Property(pcopSource,"VISIBLE", 0)
    	Call Set_Property(pcopTarget,"VISIBLE", 1)
    
    	pcopOffset_X = 0
    	pcopOffset_Y = 0
    
    Return
    *
    * End PlaceControlOverPlaceholder
    *
                

    public by cghersi  3367  3  6  4

    Change the location of MS SQL Server database files

    When you start playing with serious DB, one of the most important parts is to place (if possible) the files in different drives (physical, not only logical partitions!!!). But what if you already have your DB in production with tons of data on the same location? This script helps in solving the issue. It should be executed in three steps: 1) p
    -- 1) Execute this first chunk to put the DB offline
    ALTER DATABASE MyDBName SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
    ALTER DATABASE MyDBName SET OFFLINE;
    ALTER DATABASE MyDBName MODIFY FILE 
    (
       Name = MyDBName_Data,
       Filename = 'D:\DB\MyDBName.mdf'
    );
    
    ALTER DATABASE MyDBName MODIFY FILE 
    (
       Name = MyDBName_Log, 
       Filename = 'D:\DBLog\MyDBName_log.ldf'
    );
    
    ALTER DATABASE MyDBName MODIFY FILE 
    (
       Name = MyDBName_Idx, 
       Filename = 'E:\DBIndex\MyDBName_log.ndf'
    );
    
    -- 2) Manually move the files in the right location
    
    -- 3) Execute this second chunk to put the DB online
    ALTER DATABASE my SET ONLINE;
    
    ALTER DATABASE my SET MULTI_USER;
    • Public Snippets
    • Channels Snippets