tag:blogger.com,1999:blog-55762697748390734362024-03-08T07:37:39.476+01:00Götling kodarmaGo!http://www.blogger.com/profile/14830406701050125142noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-5576269774839073436.post-13421849017297798052011-01-04T01:14:00.003+01:002011-01-04T01:37:25.815+01:00Randomize picture namesThe following is a console application written in C# for randomizing names of jpg-files in the current directory and all sub directories. I made it so my mother can make pictures appear in random order on the digital picture frame I gave her last Christmas as it lacked that feature.<br />
<br />
All output is in Swedish.<br />
<a href="https://docs.google.com/a/gotling.se/leaf?id=0B24nVfbVLYBBZjZjOWU4MjktMGI2ZS00YTI3LTlmNGMtMjdiY2QyZGI4YTdh&sort=name&layout=list&num=50">Download binary</a><br />
<pre class="brush: csharp">using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace se.gotling.tools
{
class RandomizeFileNames
{
private static string extension = ".jpg";
static void Main(string[] args)
{
string fullPath = System.Reflection.Assembly.GetAssembly(typeof(RandomizeFileNames)).Location;
string directory = Path.GetDirectoryName(fullPath);
Console.WriteLine("Katalog: {0}\n" ,directory);
string[] fileNames = Directory.GetFiles(directory, "*" + extension, SearchOption.AllDirectories);
if (fileNames.Length > 0)
{
Console.WriteLine("Hittade {0} filer med filändelsen {1}\n", fileNames.Length, extension);
}
else
{
Console.WriteLine("Inga filer hittades med filändelsen {0}\nTrycka på valfri tangent för att avsluta", extension);
Console.ReadKey(true);
return;
}
Console.WriteLine("Tryck \"r\" för att slumpa fram nya filnamn\n");
if(!Console.ReadKey(true).Key.Equals(ConsoleKey.R))
{
Console.WriteLine("Avbröt ändring av filnamn. Trycka på valfri tangent för att avsluta");
Console.ReadKey(true);
return;
}
foreach (string fileName in fileNames)
{
string filePath = Path.GetDirectoryName(fileName);
while (true)
{
string newFileName = filePath + Path.DirectorySeparatorChar + Path.GetRandomFileName().Split('.')[1] + extension;
if (!File.Exists(newFileName))
{
File.Move(fileName, newFileName);
Console.WriteLine("Före: {0}\t Efter: {1}", fileName.Remove(0, directory.Length + 1), newFileName.Remove(0, directory.Length + 1));
break;
}
}
}
Console.WriteLine("\n\nFärdig! Trycka på valfri tangent för att avsluta");
Console.ReadKey(true);
}
}
}
</pre>maGo!http://www.blogger.com/profile/14830406701050125142noreply@blogger.com0tag:blogger.com,1999:blog-5576269774839073436.post-20198263726170465732010-03-09T01:14:00.000+01:002010-03-09T01:39:21.224+01:00Customize Touch in Internet Explorer 8I'm currently working on a project involving a web based system controlled by touch. Internet Explorer 8 will be used for it running in kiosk-mode on one single machine.<div><br /></div><div>A problem I ran into was that IE8 has some new clever feature that opens links in a new tab if they are dragged a few pixels using touch. Flicks I think they call it. This caused pages to be accidentally open in tabs if the user didn't touch the screen right.</div><div><br /></div><div>Nowhere on the Internet could I find any way to disable this feature. So I started digging in the Windows registry. There I found the following key:</div><div><br /></div><div><blockquote><b>HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Touch</b></blockquote></div><div><br /></div><div>That only contained one value, FlickEducatorInfo, which wasn't what I was looking for.</div><div><br /></div><div>So I searching for the reg-key on Google and found two results, both some forum posts in French. There some user had dropped a lot of info from Hijack This or some similar tool. I searched for "Touch" on the page and found the same key as above but it had an additional value:</div><div><br /></div><div><blockquote><b>"TouchDragBuffer"= 0x0000000007 (7)</b></blockquote></div><div><br /></div><div>Changed that to:</div><div><blockquote><b>"TouchDragBuffer"= 0x0000001000 (4096)</b></blockquote></div><div><br /></div><div>Worked perfectly! Now the user that can't point straight needs to drag the link more than a screen-length away before a new tab is opened.</div><div><br /></div><div>Would be nice if there were touch settings in Internet Explorer though. Maybe IE9?</div><div><span class="Apple-style-span" style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:100%;color:#333333;"><span class="Apple-style-span" style=" ;font-size:12px;"><br /></span></span></div>maGo!http://www.blogger.com/profile/14830406701050125142noreply@blogger.com0