Bohl's Blog

my digital life

FTP-Server on WindowsServer2012/IIS8 <-> Firewall

I wanted to set up a FTP-server on a Windows2012R2-machine with IIS8. Everything wfent fine, however the connection was blocked by the firewall. The Windows-firewall contains ready-made rule for enabling FTP, but it did not work and I couldn't figure out what was wrong with those rules.

Well, in the end I still don't know what was wrong, but this command

sc sidtype ftpsvc unrestricted

fixed it - which I learned about here http://serverfault.com/questions/438314/iis-ftp-server-works-locally-but-cannot-connect-from-remote.

Some fun with Canvas, SVG and JavaScript

Please check out my latest fun project here - simulation of a double pendulum using HTML5-Canvas, SVG and JavaScript.

Welcome to BlogEngine.NET 2.9

If you see this post it means that BlogEngine.NET 2.9 is running and the hard part of creating your own blog is done. There is only a few things left to do.

Write Permissions

To be able to log in to the blog and writing posts, you need to enable write permissions on the App_Data folder. If your blog is hosted at a hosting provider, you can either log into your account’s admin page or call the support. You need write permissions on the App_Data folder because all posts, comments, and blog attachments are saved as XML files and placed in the App_Data folder. 

If you wish to use a database to to store your blog data, we still encourage you to enable this write access for an images you may wish to store for your blog posts.  If you are interested in using Microsoft SQL Server, MySQL, SQL CE, or other databases, please see the BlogEngine wiki to get started.

Security

When you've got write permissions to the App_Data folder, you need to change the username and password. Find the sign-in link located either at the bottom or top of the page depending on your current theme and click it. Now enter "admin" in both the username and password fields and click the button. You will now see an admin menu appear. It has a link to the "Users" admin page. From there you can change the username and password.  Passwords are hashed by default so if you lose your password, please see the BlogEngine wiki for information on recovery.

Configuration and Profile

Now that you have your blog secured, take a look through the settings and give your new blog a title.  BlogEngine.NET 2.9 is set up to take full advantage of of many semantic formats and technologies such as FOAF, SIOC and APML. It means that the content stored in your BlogEngine.NET installation will be fully portable and auto-discoverable.  Be sure to fill in your author profile to take better advantage of this.

Themes, Widgets & Extensions

One last thing to consider is customizing the look of your blog.  We have a few themes available right out of the box including two fully setup to use our new widget framework.  The widget framework allows drop and drag placement on your side bar as well as editing and configuration right in the widget while you are logged in.  Extensions allow you to extend and customize the behavior of your blog.  Be sure to check the BlogEngine.NET Gallery at dnbegallery.org as the go-to location for downloading widgets, themes and extensions.

On the web

You can find BlogEngine.NET on the official website. Here you'll find tutorials, documentation, tips and tricks and much more. The ongoing development of BlogEngine.NET can be followed at CodePlex where the daily builds will be published for anyone to download.  Again, new themes, widgets and extensions can be downloaded at the BlogEngine.NET gallery.

Good luck and happy writing.

The BlogEngine.NET team

building FFmpeg on Windows (11 of n)

...some quick notes:

  • I just updated the cygicl-branch to the latest upstream-version - worked without a flaw it seems, no problems.
  • What does not seem to work - the download of the MakeVSProject4FFmpeg.exe-binary from Codeplex. At least not today and for me... Well, I placed the file here, so you either have to download it manually from Codeplex or change the URL for wget to 'http://www.h-quer.de/Files/MakeVSProject4FFmpeg.exe'.

Create a memory dump of a Windows-system...

...there are times when you need it: creating a kernel dump "on demand". There has always been the option in Windows to crash the system (and create a memory dump) when you press (and hold) the Ctrl-key and then hit twice the Scroll-Lock key. The problem with it - it only worked with PS/2-keyboards, at least until recently. But not any more - now it is working with USB-keyboards as well. I am not sure if that feature appeared in Windows7 or Windows8 - so far I used it with Windows8.

Here is the command to enable the "Ctrl-ScrollLock-crashhandler" for PS/2-keyboards

reg add "HKLM\SYSTEM\CurrentControlSet\Services\i8042prt\Parameters" /v CrashOnCtrlScroll  /t REG_DWORD /d 0x1

and here for USB-keyboards

reg add "HKLM\SYSTEM\CurrentControlSet\Services\kbdhid\Parameters" /v CrashOnCtrlScroll  /t REG_DWORD /d 0x1

I learned this here. See also here.

building FFmpeg on Windows (10 of n)

...just a note to myself:

How to "rebase" the cygicl-branch on github:

If not yet done, set the upstream-server:

git remote add upstream https://github.com/FFmpeg/FFmpeg

Make sure that we are in the master - branch

git checkout master

Pull the upstream changes:

git fetch upstream
git merge upstream/master

Rebase the cygicl-branch (apply all "patches" in the cygicl to the updated master):

git rebase master cygicl

And finally push the updates to github:

git push -f

I don't know why, but the last command only works with the force-option (-f). Maybe I am doing something wrong...

So far this procedure works quite smoothly, and I will try to sync as often as possible (so that cygicl is as up-to-date as possible).

 

And finally, some ideas for the next steps:

  1. It would be cool to automate the "rebase"-process. As long as there is no merge-error, it should not be too hard to automate it and run it maybe once a day.
  2. Add more libraries.
  3. Create a VisualStudio-project which works with the C99-to-C89-converter (so that FFmpeg can be built with the Microsoft-compiler inside VisualStudio - but without the inline-assembly that would be).
  4. Merge the FFmpeg-extensions (small finger exercises that is) from here.
  5. Try to push the changes in the cygicl-branch upstream (into the official FFmpeg-codebase), at least some of them.
  6. Make the OpenCL-code work.
  7. A build for the ARM-platform (with the Microsoft compiler) would be cool - so that the code runs on Windows RT.
  8. have a look at mlpdsp.c - make inline-assembly work with ICL
  9. Re-factor and tidy up the MakeVSProject4FFmpeg
  10. Find a place where to put the scripts (maybe in a source-control site or so, I do not want to repost things for each update...)

BTW - here is a little (cosmetic) update of the build-scripts (from the previous post):

 vsFFmpeg_scripts.zip (2.85 kb)

 

building FFmpeg on Windows (9 of n)

The story continues - some of the recent changes

  • I changed how asm-files are handled. Instead of relying on VSYASM we now use a simple custom-build step.
  • The VS-project now can include x264 and zLib.
  • Some fixes and tweaks.

You now need to have yasm.exe somewhere on the path. If you download it (e.g. from here) make sure that you rename to executable to "yasm.exe". As far as my understanding goes, it does not matter whether you use the x86- or x64-version. Both of them can compile x86- and x64-code it seems. A good place could be "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin" (which is "on the path" for x86-builds) and "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\amd64" (for x64-builds). I am using a hard link (mklink /H "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\amd64\yasm.exe" "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\yasm.exe") which saves a few bytes.

 

I am listing the complete set of steps how to build FFmpeg and create the VisualStudio-project:

First we run this script (iclbuild.sh) - which will get the git-repository, build it (with the Intel-compiler) and finally run FATE:

#/bin/sh

if (icl.exe 2>&1 | grep -q "IA-32"); then
    arch="x86_32"
elif (icl.exe 2>&1 | grep -q " Intel(R) 64"); then
    arch="x86_64"
else
    echo "Could not determine whether to use x86_32 or x86_64."
	exit 1
fi

echo "Building for architecture '$arch'"

git clone https://github.com/ptahmose/FFmpeg.git

cd FFmpeg

git checkout cygicl

# need to add the current path so that "iclwrap.sh" is found
PATH=$PATH:$(pwd)
export PATH
./configure --enable-inline-asm --enable-gpl --enable-nonfree --disable-doc --toolchain=cygicl --host-cc=gcc --arch=$arch

sed 's/%define ARCH_X86_32 [0-1]//' < config.asm | sed 's/%define ARCH_X86_64 [0-1]//' > config.asm_out
sed 's/%define HAVE_ALIGNED_STACK [0-1]/%if ARCH_X86_32 == 1\n %define HAVE_ALIGNED_STACK 0\n%elif ARCH_X86_64 == 1\n %define HAVE_ALIGNED_STACK 1\n%endif/' < config.asm_out > config.asm
rm config.asm_out

sed 's/#define ARCH_X86_32 [0-1]/#if defined( _M_X64)\n #define ARCH_X86_32 0\n#elif defined( _M_IX86)\n #define ARCH_X86_32 1\n#endif\n/' < config.h | sed 's/#define ARCH_X86_64 [0-1]/#if defined( _M_X64)\n #define ARCH_X86_64 1\n#elif defined( _M_IX86)\n #define ARCH_X86_64 0\n#endif\n/' > config.h_out
sed 's/#define HAVE_ALIGNED_STACK [0-1]/#if defined( _M_X64)\n #define HAVE_ALIGNED_STACK 1\n#elif defined( _M_IX86)\n #define HAVE_ALIGNED_STACK 0\n#endif\n/' < config.h_out > config.h
rm config.h_out

make --dry-run  --always-make > makelog.txt

make -j "$(grep -c processor /proc/cpuinfo)" 

make  TARGET_EXEC=tweakpaths.sh fate SAMPLES=/cygdrive/z/home/jbohl/fate-suite/  -j "$(grep -c processor /proc/cpuinfo)"

This script (preparex264.sh) will download x264 and apply some tweaks to it (the file x264patches.diff is to be found in the zip-file, see below):

#/bin/sh

cd FFmpeg
if [ ! -d external ]; then
 mkdir external
fi
cd external
git clone git://git.videolan.org/x264.git

cd x264
patch -p1 < ../../../x264patches.diff

cat > x264_config.h <<EOF
#define X264_BIT_DEPTH     8
#define X264_GPL           1
#define X264_INTERLACED    1
#define X264_CHROMA_FORMAT 0
EOF

./version.sh >> x264_config.h

cat > config.h <<EOF
#define HAVE_MMX 1
#if defined(_M_X64)
 #define HAVE_32B_STACK_ALIGNMENT 1
 #define ARCH_X86_64 1
 #define ARCH_X86_32 0
 #define ARCH_X86 0
#elif defined(_M_IX86)
 #define HAVE_32B_STACK_ALIGNMENT 0
 #define ARCH_X86_64 0
 #define ARCH_X86_32 1
 #define ARCH_X86 1
#endif
#define SYS_WINDOWS 1
#define HAVE_POSIXTHREAD 0
#define HAVE_THREAD 1
#define HAVE_LOG2F 1
#define HAVE_AVS 1
#define USE_AVXSYNTH 0
#define HAVE_VECTOREXT 0
#define fseek _fseeki64
#define ftell _ftelli64
#define HAVE_GPL 1
#define HAVE_INTERLACED 1
#define HAVE_OPENCL 0
#define HAVE_MALLOC_H 0
#define HAVE_ALTIVEC 0
#define HAVE_ALTIVEC_H 0
#define HAVE_ARMV6 0
#define HAVE_ARMV6T2 0
#define HAVE_NEON 0
#define HAVE_BEOSTHREAD 0
#define HAVE_WIN32THREAD 1
#define HAVE_VISUALIZE 0
#define HAVE_SWSCALE 0
#define HAVE_LAVF 0
#define HAVE_FFMS 0
#define HAVE_GPAC 0
#define HAVE_GF_MALLOC 0
#define HAVE_CPU_COUNT 0
EOF


# patch ffmpeg's "config.h" in order to include libx264
cd ../..
sed -i -e 's/#define CONFIG_LIBX264_ENCODER 0/#define CONFIG_LIBX264_ENCODER 1/' config.h
sed -i -e 's/#define CONFIG_LIBX264RGB_ENCODER 0/#define CONFIG_LIBX264RGB_ENCODER 1/' config.h
sed -i -e 's/#define CONFIG_LIBX264 0/#define CONFIG_LIBX264 1/' config.h

And finally, this script (preparezlib.sh) will do the same for zLib.

#/bin/sh

cd FFmpeg
if [ ! -d external ]; then
 mkdir external
fi

cd external

wget http://zlib.net/zlib-1.2.8.tar.gz
tar xzfv zlib-1.2.8.tar.gz
mv zlib-1.2.8 zlib
rm zlib-1.2.8.tar.gz

cd zlib

sed -i -e 's/#ifdef Z_PREFIX/#if 1/' zconf.h
sed -i -e 's/#ifdef HAVE_UNISTD_H/#if 0/' zconf.h
sed -i -e 's/#  define snprintf _snprintf/#ifndef snprintf\n#  define snprintf _snprintf\n#endif/' gzguts.h

cd ../..

sed -i -e 's/#define CONFIG_ZLIB 0/#define CONFIG_ZLIB 1/' config.h
sed -i -e 's/#define CONFIG_ZLIB_DECODER 0/#define CONFIG_ZLIB_DECODER 1/' config.h
sed -i -e 's/#define CONFIG_ZLIB_ENCODER 0/#define CONFIG_ZLIB_ENCODER 1/' config.h



wget -O MakeVSProject4FFmpeg.exe 'http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=makevsproject4ffmpeg&DownloadId=704486&FileTime=130182781120570000&Build=20602'
chmod +x MakeVSProject4FFmpeg.exe
./MakeVSProject4FFmpeg.exe --projname vsFFmpeg --makefileoutput makelog.txt --parse_includes --libx264 --libzlib

That's it - all files are to be found in this zip-archive (also including the diff for x264):

 vsFFmpeg_scripts.zip (2.76 kb)

So, given that everything is set up correctly (see previous posts for how to install Cygwin etc.), all you have to do is to extract this zip-file into an empty folder (don't forget to edit the path for the FATE-samples in iclbuild.sh or remove that line), then run

./iclbuild.sh ; ./preparex264.sh ; ./preparezlib.sh

and after some time you should find the VS-Studio-project 'vsFFmpeg.vcxproj' (in the FFmpeg-folder) which you can open with VisualStudio2012 and which should build (for all targets) without errors.

If you run into trouble or have any questions, comments or rants - please feel free to post your question here.

building FFmpeg on Windows (8 of n)

Here are the next steps:

  • I created a clone of the FFmpeg-repository on Github. The patches (from the previous posts) are included in the branch "cygicl" - find it here.
  • The tool for automatically creating the VisualStudio-project can be found on CodePlex - find it here.
  • The scripts tweakpaths.sh and iclwrap.sh are included in the branch on Github.

So - here is a script that will execute all tasks in one sweep - i.e. get the git-repository, compile FFmpeg with ICL, tweak the headers so that they work for both x86 and x64, download the VisualStudio-project-generator-tool and run it:

#/bin/sh

if (icl.exe 2>&1 | grep -q "IA-32"); then
    arch="x86_32"
elif (icl.exe 2>&1 | grep -q " Intel(R) 64"); then
    arch="x86_64"
else
    echo "Could not determine whether to use x86_32 or x86_64."
	exit 1
fi

echo "Building for architecture '$arch'"

git clone https://github.com/ptahmose/FFmpeg.git

cd FFmpeg

git checkout cygicl

# need to add the current path so that "iclwrap.sh" is found
PATH=$PATH:$(pwd)
export PATH
./configure --enable-inline-asm --enable-gpl --enable-nonfree --disable-doc --toolchain=cygicl --host-cc=gcc --arch=$arch

sed 's/%define ARCH_X86_32 [0-1]//' < config.asm | sed 's/%define ARCH_X86_64 [0-1]//' > config.asm_out
sed 's/%define HAVE_ALIGNED_STACK [0-1]/%if ARCH_X86_32 == 1\n %define HAVE_ALIGNED_STACK 0\n%elif ARCH_X86_64 == 1\n %define HAVE_ALIGNED_STACK 1\n%endif/' < config.asm_out > config.asm
rm config.asm_out

sed 's/#define ARCH_X86_32 [0-1]/#if defined( _M_X64)\n #define ARCH_X86_32 0\n#elif defined( _M_IX86)\n #define ARCH_X86_32 1\n#endif\n/' < config.h | sed 's/#define ARCH_X86_64 [0-1]/#if defined( _M_X64)\n #define ARCH_X86_64 1\n#elif defined( _M_IX86)\n #define ARCH_X86_64 0\n#endif\n/' > config.h_out
sed 's/#define HAVE_ALIGNED_STACK [0-1]/#if defined( _M_X64)\n #define HAVE_ALIGNED_STACK 1\n#elif defined( _M_IX86)\n #define HAVE_ALIGNED_STACK 0\n#endif\n/' < config.h_out > config.h
rm config.h_out

make --dry-run  --always-make > makelog.txt

make -j "$(grep -c processor /proc/cpuinfo)" 

wget -O MakeVSProject4FFmpeg.exe 'http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=makevsproject4ffmpeg&DownloadId=699890&FileTime=130174523610900000&Build=20602'
chmod +x MakeVSProject4FFmpeg.exe
./MakeVSProject4FFmpeg.exe --projname vsFFmpeg --makefileoutput makelog.txt --parse_includes

make  TARGET_EXEC=tweakpaths.sh fate SAMPLES=/cygdrive/z/fate-suite/  -j "$(grep -c processor /proc/cpuinfo)"

You will have to change the path in the last statement to the folder where your FATE-samples reside. That's it - now you should find a file "vsFFmpeg.vcxproj" in the FFmpeg-folder, which you can open with VisualStudio 2012. It should build without errors (for x86 and x64 in Debug and Release), and the executables should also pass FATE without problems. Nice!

building FFmpeg on Windows (7 of n)

Here are some new patches that should cure the problems with Debug-builds in VisualStudio. The changes (related to the Debug-build) are limited to the files ..\libavcodec\x86\mpegvideoenc_template.c, ..\libavcodec\x86\lpc.c, ..\libavcodec\x86\vc1dsp_mmx.c and ..\libpostproc\postprocess_template.c. And they are rather crude ones, just some quick'n'dirty hacks. But they should do the job.

 patches.diff (147.85 kb)