Network Logon script – Windows 2008 Domain

Posted on September 1st, 2010 by admin  No Comments »

Ever wanted to Map Network drives for your Domain users when they log on ? How about automatically adding a printer ? Or Map a Network Drive for specific users only ?

No problem ! :)

@echo off
net use * /delete /y
net use R: \\DATA_SERVER\HOME_DRIVES$\%USERNAME% /persistent:no
net use W: \\DATA_SERVER\SHARE /persistent:no
start \\PRINT_SERVER_IP_ADDRESS\PINTER_NAME /MIN
IF (%USERNAME%) == (SOME_USER_NAME) net use N: \\DATA_SERVER\SOME_SHARE /persistent:no

Put the above code into a text file on windows and rename it to logon_script.bat or any name really, as long as it is a .bat file.

Place the .bat file into your SYSVOL folder, and now, using Active Directory, Users and Groups, add the logon script to each user of your domain, and your done :)

To test, please log off and log on again, your printer should be added now, and your drives mapped.

forfiles – Remove Files older than XX days on Windows 2008

Posted on August 3rd, 2010 by admin  No Comments »

Ever wanted to remove files older than XX days and have it run as a sheduled task on Windows 2008 Server ?

Create a .bat file and paste the following into it, save it and add it as a Scheduled Task in Control Panel


forfiles /p c:\path\to\folder /s /m *.* /d -XX /c "cmd /c del /Q /S /F @file"

Easy huh :)

How to bring in Related Product Data into View.phtml with Downloadable Sample Links

Posted on July 26th, 2010 by admin  No Comments »

Morning Guys and Girls,

Today we will learn how to bring in related product data into the View.phtml or product colum or middle column.

To see a demo of this have a look at this page:

3AM Psytrance Timecode Records – Multistate – Collaborating with machines

Ready? Let’s do it!


<?php foreach ($_product->getRelatedProducts() as $related_product) {
 if (sizeof($_product->getRelatedProducts())>0):
 ?>
 <?php

$ids[] = $related_product->getId();

echo $relatedproduct->getName(); ?>

That will get you related products. However, I actually extended it quite a bit more, in the sense that my related products are downloadable products, and I needed to get the sample link from these products. The complete code that I used therefor looks like this:


<?php $i = 1; ?>
 <?php foreach ($_product->getRelatedProducts() as $related_product) {
 if (sizeof($_product->getRelatedProducts())>0):
 ?>
 <?php
 $ids[] = $related_product->getId();

 //Download product samples code :)  Ninja Go!!
 $_myprodsamples = Mage::getModel('downloadable/sample');
 $_mySampleCollection = $_myprodsamples->getCollection()->addProductToFilter($related_product->getId());

 $relatedproduct = Mage::getModel('catalog/product');
 $relatedproduct->load($related_product->getId());

 if (sizeof($_mySampleCollection)>0):
 ?>

 <?php
 foreach ($_mySampleCollection as $_sample) {
 //$_samplelink = $this->getUrl('downloadable/download/sample/sample_id/'.$_sample->getId());
 $_samplelink = Mage::getModel('downloadable/sample')->load($_sample->getId())->getUrl();
 ?>
 <span><?php echo $i++; ?><?php echo $this->__('. ') ?><a href="javascript:void(0)" onclick="player1.sendEvent('STOP'); player1.sendEvent('LOAD', {'image':'<?php echo $_product->getImageUrl(); ?>', 'file':'<?php echo $_samplelink ?>', 'provider':'sound', 'buffer':0, 'autostart':true});" title="Click to play <?php echo $relatedproduct->getName(); ?>"><?php echo $relatedproduct->getName(); ?></a></span>
 <?php } ?>
 <?php /*endforeach;*/ ?>

 <?php endif; ?>

 <?php //Mage::Helper('debug')->log($_sample) ?>
 <?php endif; ?>
 <?php } ?>
 <?php /*endforeach;*/ ?>

Beer time!
There you have it, if you don’t come right, use the contact form to contact me, and I will set this up for you.

Have a wonderful day!

Winston

Magento Cape Town

Posted on July 19th, 2010 by admin  No Comments »

We work with Magento all day long, and know this system very well now.
At BUYX Online, we will be able to support, host, and develop your on-line store. We have also made Magento Partners throughout the world and can recommend someone in Europe, America, and India.

Should you have a Magento related query, contact us here.

HOWTO Compile JW Player from Longtail on Windows

Posted on July 17th, 2010 by admin  No Comments »

Okay today we will learn howto compile Actionscript, and JW Player on Windows Vista.

Normally I only work on Linux but since I have never done this I took the dummy way out. Sue me :P

Okay We will need this software:

* Flex SDK 3.3: http://opensource.adobe.com/wiki/display/flexsdk/Downloads
* Ant 1.7.0: http://ant.apache.org/bindownload.cgi
* FlexUnit 4: http://opensource.adobe.com/wiki/display/flexunit/FlexUnit (for testing the player)

Make sure you get Flex version 3.3!! This is so Important otherwise you’ll get strange errors.

Okay I put Flex in this directory:

C:\Program Files\Adobe Flex Builder 3\sdks\3.3.0\

Inside this directory is the following contents:

ant
asdoc
bin
build.properties
build.xml
frameworks
lib
license-mpl.htm
readme-open.htm
samples
templates

That’s Flex done.
Now for Ant

I downloaded ant and put it in the directory

C:\ant

There is no install, just copy the files. Inside the directory is the following contents:

bin
docs
etc
fetch.xml
get-m2.xml
INSTALL
KEYS
lib
LICENSE
NOTICE
README
WHATSNEW

That’s Ant done.

Now for JAVA SDK. I downloaded this file:
jdk-6u21-windows-i586.exe and installed it. I chose the location:

C:\jdk_6

That’s JAVA SDK done.

Now grab your version of the JW Player source, and copy it to your C drive. My source is in this directory.

C:\trunk\fl5\

Inside this directory is the following contents:

assets
bin-release
build
doc
libs   ###NOTE### THIS DIRECTORY I COPIED FROM THE FLEX DIRECTORY
C:\Program Files\Adobe Flex Builder 3\sdks\3.3.0\frameworks
player.swf
player.xml
README.txt
src
test
yt.as
yt.fla
yt.swf

That’s our source Done!
Now before we compile to open up our command line and give the following commands. You have to do this everytime you restart Windows and before you want to compile.

set ANT_HOME=c:\ant
set JAVA_HOME=c:\jdk_6
set PATH=%PATH%;%ANT_HOME%\bin

Now for the goodstuff or the bad stuff, to compile the source code in the command line, navigate to

C:\ant\bin and give this command
ant -buildfile C:\trunk\fl5\build\build.xml

And that’s it! Good luck! Let’s go have a beer :P

Winston