Tuesday 29 October 2013

WIndows: HOW TO move files in sequent folders

I was found not long ago in a situation where I had a large number of files in one folder that had to be moved in sequent folders (500 files in each folder). Here is the script I managed to make:


echo off
SETLOCAL ENABLEDELAYEDEXPANSION
:: set this number eq to num
set movedFiles=500
:: the number of files in each folder
set num=500
:: location of files 
set location=D:\files
:: destination of files
set destinbation=D:\files\
:: set the starting numbering for the subfolders
set /a sn=5
for %%G in ("!location!"\*) do (
 if !movedFiles! EQU %num% (
  set /a sn=sn+1
  echo Creating !destinbation!!sn!
  mkdir !destinbation!!sn!
  set /a movedFiles=0
 )
 echo "%%G" "!destinbation!!sn!"
 move /Y "%%G" "!destinbation!!sn!"
 set /a movedFiles+=1
)
  
ENDLOCAL

Friday 26 July 2013

Jquery is(':focus') is not working in IE8

I recently encountered a problem when using the is(':focus') with ie8. The only error I got is

SCRIPT5022: Exception thrown and not caught 
jquery.js, line 85 character 139

Not a lot of help.

After further research I found that there is actually a problem with how jQuery is handling this and I had to rewrite it.

jQuery.expr[':'].focus = function( elem ) {
    return elem === document.activeElement && ( elem.type || elem.href );
};

Quoted from Mathias Bynens here:
Note that the (elem.type || elem.href) test was added to filter out false positives like body. This way, we make sure to filter out all elements except form controls and hyperlinks.

Wednesday 27 February 2013

Windows 7 Error "Explorer. exe No such interface supported"

I got this error after I did a mass update of my windows, reaching from a clean installation to SP1. I messed around a lot on the internet but could not find a good solution, most of the final suggestions were "Back up your data and reinstall". But as I didn't wanted to do that (just thinking about all the softwear I have to reinstall gave me a headache ) I keept going until I found exactly what I needed.

The process of fixing this is really easy if you know what you are doing, but I wasn't, so I will have to give credits to Jae Hyuk Lee on his post.

I will rewrite the solution here to keep it for posterity and make it easy to search.

1. open comand prompt as admin
2. run regsvr32 c:\windows\system32\actxprxy.dll
3. restart if needed