Shabat Closer

Sunday, July 19, 2015

JS SCRIPT : multiple release domains lock on 1&1 hosting.

JS SCRIPT : Unlock a Domains for Transfer


1.login to your account on 1&1.
2.goto domains page.
3.open console mode (F12)
4.pate this code and click enter.

function run(index){
 $(".checkbox-button").eq(index).click();
 setTimeout(TransferDomain,1000);
}

function TransferDomain(){
 $("#auth-info-value").html("");
 $("[for='menu_transfers_1']").click(); 
 printCode();
}
function printCode(){
 if ($("#auth-info-value").text()==""){
  setTimeout(printCode,1000);
  return;
 }
 console.log($(".form-key").parent().find("span:first").text());
 releaseDomain();
}

function DialogOk(){
 if ($(':contains("Edit Domain Transfer Lock"):last').length==1){
  $(':contains("Edit Domain Transfer Lock"):last').parent().parent().find(".rain_modal_button:last").click();
 }
 setTimeout(RunNext,5000);
}

function releaseDomain(){
 if ($("#transferlock-value").text()=="Enabled"){
  $("#transferlock-value").parent().find("div:first").find("div:first").find("div:first").find("span:first").click();
 }else{
  setTimeout(RunNext,1);
  return;
 }
 setTimeout(DialogOk,5000);
}
var run_index=0;
function RunNext(){
 run(run_index);
 run_index++;
}
RunNext();


Thursday, May 22, 2014

TECH Windows Server 2008 - Power Shell: Auto delete old Shadow copies - script

TECH Windows Server 2K8 - Power Shell: Auto delete old Shadow copies - script

this script keep only the follwing  shadow copies
last 7 days : Daly at 12 A.M
after 7 days : only the days  Sunday and Wednesday for each week. (at 12 A.M)



$vss=vssadmin List Shadows
$vssContents=($vss,"" -split("Contents of shadow copy"))
foreach ($vssContent in $vssContents){
  if ($vssContent.length -gt 620 ){
  $ContentId=($vssContent,"" -split("Shadow Copy ID: {"))[1]
  $ContentId=($ContentId,"" -split("}"))[0]
  
  $CreationTime=($vssContent,"" -split("time: "))[1]
  $CreationTime=($CreationTime,"" -split("  "))[0]

  $CreationTime=[datetime]::Parse($CreationTime)
  $Diff=(New-TimeSpan $($CreationTime) $(Get-Date)).Days

  if  ($Diff-ge 1)
   if (($CreationTime.Hour -ne 0))
    cmd /c "vssadmin Delete Shadows /shadow={$ContentId} /Quiet"

  if  ($Diff-gt 5) 
   if (($CreationTime.DayOfWeek -ne "Sunday") -and ($CreationTime.DayOfWeek -ne "Wednesday"))
    cmd /c "vssadmin Delete Shadows /shadow={$ContentId} /Quiet"
 }
}
exit

Monday, December 30, 2013

TECH - Exchange 2010 : No existing ‘PublicFolder’ matches the following Identity. ‘\’.

TECH - Exchange 2010 :  No existing ‘PublicFolder’ matches the following Identity. ‘\’.

Error:
No existing ‘PublicFolder’ matches the following Identity. ‘\’.  Make sure that you specified the correct ‘PublicFolder’ Identity and that you have the necessary permissions to view ‘PublicFolder’.  It was running the command ‘get-publicfolder -getchildren -identity ‘\’ -server ExchangeServer

Solution:
  1. I try to fix the homeMDB  homeMTA  in ADSI Edit but it's not fix my problem
  2. I remove my admin mailbox and create it again. <- that's fix my problem.

Sunday, December 29, 2013

Mysql - Function : Count Occurence of Character in a String / Word

Mysql : Count Occurrence of Character in a String / Word  Function

CREATE FUNCTION `getCount`(`myStr` VARCHAR(4096), `myword` VARCHAR(100)) RETURNS int(11)
    READS SQL DATA
    DETERMINISTIC
RETURN 
    ROUND (   
        (
            LENGTH(myStr)
            - LENGTH( REPLACE ( myStr, myword, "") ) 
        ) / LENGTH(myword)        
    )




Usage :



Select  getCount('Moshe Test My Code','M')
#Returns : 2

Thursday, August 1, 2013

C# : Disable Alert box javascript in c# webbrower control

if you want to disable all alerts in a website in your webbrower.

the following code disable :

  • Alert window.
  • Print window
  • confirm window.


/************Disable alert/print function()**********************/
HtmlElement head = WebBrowser1.Document.GetElementsByTagName("head")[0];
HtmlElement scriptEl = WebBrowser1.Document.CreateElement("script");
IHTMLScriptElement element = (IHTMLScriptElement)scriptEl.DomElement;
string alertBlocker = @"window.alert = function () { }; 
                        window.print=function () { };
                        window.confirm=function () { };
                    ";
element.text = alertBlocker;
head.AppendChild(scriptEl);
WebBrowser1.ScriptErrorsSuppressed = true;
/****************************************************************/


Enjoy!

Tuesday, July 30, 2013

TECH - MySQL 5.5 / 5.6 : disable MySQL slave replication

if you want to disable the slave replication.

run the query :
  • RESET SLAVE ALL;
to verify run the query
  • SHOW SLAVE STATUS
enjoy!

Tuesday, April 23, 2013

TECH: auto load many sitemaps to google webmaster

upload multiple sitemaps to google, by automation javascript script.

auto load many sitemaps to google webmaster

  1. Login to google webmaster
  2. go to Sitemap TAB.
  3. Press F12 on keyboard.
  4. go to Console TAB.
  5. click on Multi Line Mode
  6. paste the following 

/****************************************************
* Variables :                                       *
* the following variables will upload               *
* the sitemap files                                 *
*   from : xmlmap.php?index=0                       *
*   to   : xmlmap.php?index=10                      *
*                                                   *
*  Upload FILE: baseSiteMapName + (jump * index)    *
*****************************************************/
var jump = 1;                               //Jump index count(Only if you need it...).
var index = 0;                              //Start index position.
var end = 10;                               //End index position.
var baseSiteMapName = "xmlmap.php?index=";  //sitemap file.
var UploadDelay = 1000;                     //Delay between uploads.
/**************
* the code   *
**************/
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = '//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js';
head.appendChild(script);
function upload_smap() {
    document.getElementById("gwt-uid-58").click();
    document.getElementById("gwt-uid-77").click();
    $("input[type='text']").val(baseSiteMapName + (jump * index));
    document.getElementById("gwt-uid-67").click();
    console.log(index);
    index++;
    if (index > end)
        clearInterval(uploadInt);
}
var uploadInt = setInterval(upload_smap, UploadDelay);

  1. change the variables to your site configuration.
  2. Click "Run Script"

Enjoy!