Install samba on debian and connect with windows 7

  1. Install samba with ‘apt-get install samba’
  2. Follow the install wizard and enter ‘workgroup’ and if you use a dhcp server
  3. Add a directory for samba shares. ‘mkdir /samba
  4. Add a usergroup for samba. ‘groupadd sambauser’
  5. Give directory to the group. ‘chgrp sambauser /samba’
  6. Change the rights. ‘chmod 770 /samba’
  7. Add a user. ‘useradd -g sambauser windowsclient’
  8. Give the user a password. ‘passwd windowsclient
  9. Add samba password, make it the same as the linux user password. ‘smbpasswd -a windowslcient’
  10. Enable user in samba. ‘smbpasswd -e windowsclient’
  11. Add the following to /etc/samba/smb.conf

      [MyShare]
      path = /samba
      writable = yes
      public = no
      valid users = windowsclient
      force create mode = 0770
      force directory mode = 0770
  12. Restart samba with /etc/init./samba restart’.

Now you should see your server under network on the windows system and can connect using the account windowsclient / password.

Advertisements

Debian 5.0 (lenny) on NSLU2

I had this old Cisco NSLU2 around, doing nothing other than bringing an even older USB HDD to the network. And i honestly never really used it, because the truth is, the NSLU2 is slow.

So i found this great site where they explain how to flash Linux on the device some time ago. And now, after having to set up a few Debian server and no reasonable way to hide from it, i decided to put a Debian on the NSLU2.

The instructions are quite simple as the device is supported by Debian 5.0.

Some advice from personal experience:

  • Use a singe 2,5” (notebook) USB drive. With 2 drives, powered over USB, you might get problems with the power supply. One works great for me.
  • Expect to spend up to 3 hours on this. Without playing, just installing and configuration.
  • Do not expect the NSLU2 to perform like a computer or vps. It is slow, but its performance positively surprised me.
  • Use the provided unofficial image.

Execute batch script on windows 7 logout or login

Sorry, used a german windows version for the screenshots. I am currently on holiday and had to use this version. Will change them next week.

A useful addition to the robocopy backupscript is an automatic execution at specific events. Like on login or logout or system startup.

To configure this you need to edit the group policies. Press start and enter gpedit.msc.

GPEDIT.MSC

Start gpedit.msc

Next you navigate to the user configuration -> windows settings -> scripts section in the application.

Double click on the event you would like to trigger your script. Like logout for example.

GPEDIT.MSC Screen

GPEDIT.MSC Screen

Select your script, in my case backup.bat. Copy the file to the destination shown when you press the button ‘files’.

You might want to activate under admin-templates -> system -> scripts  the output for your script, so you know what your computer is doing.

Nice icons

Wget quick howto: Examples for the most common uses

If you are using linux on your computer or operate your own (virtual-)server you will likely be faced with the problem to transfer data from an other computer/server to your own.

wget is a little linux tool that i usually in a standard installation. Here are a few examples for the most common uses. If you need a more in-depth explanation, please consult the man pages.

Getting a single file from remote location:

Specify the number of downloads attempts:

Continue a interrupted download:

Login credentials needed? No problem:

Download a webpage or something else recursive:

Want to download all pictures from a list of websites?

  • -A jpg,gif,png,bmp,jpeg specifies a acceptlist of file extensions.
  • -i filename to specify a file with the websites
  • -q suppresses messages to the console
  • wget -i mylist.txt -A jpg,gif,png,bmp,jpeg -q -r -l 10

Kinect SDK for windows (beta)

  •  Access to raw data streams.
  •  The capability to track the skeleton image of one or two people moving.
  •  Advanced audio capabilities.
  •  Audio processing capabilities.
  •  Sample code and documentation
  •  Easy installation.

These are the keyfeatures of the new kinect sdk for windows. Microsoft released the beta version a few day ago. You can download the sdk and find amazing demos here.

I think this makes kinect support in the next XNA version much more likely.

Send inkCanvas content with TCP

An inkcanvas can be serialized so that you have a byte array to send over a network.

For the client, in this case the canvas someone draws on, you create a TcpClient.

Fortunately this is handled by the .Net framework for you.

TcpClient client = new TcpClient(“192.168.0.1”, 42000);

Next you create a MemoryStream to save your StrokeCollection on the inkCanvas to. The Networkstream doesn’t support this. But you can send the byte array without problems.

MemoryStream memstream = new MemoryStream();

Get the Networkstream form the TcpClient.

NetworkStream netstream = client.GetStream();

In a real application you should put this in a separate thread, but for this example let us simply assume this is running in the Window with the inkCanvas. This saves the inkCanvas Stroke Collection to the memory as a byte array.

this.inkCanvas1.Strokes.Save(memstream);

The byte array can be send to the networkstream and with that to the TcpServer on the other end of the connection.

netstream.Write(memstream.GetBuffer(), 0, memstream.GetBuffer().Length);

Some cleaning up and the client is complete.

memstream.Close();

netstream.Close();

client.Close();

Please note that you need to at least catch some exceptions before using this in any real application.   #

 

The server looks pretty much the same.

Create the Server in the form of a TcpListener. The framework handles this for you.

TcpListener server = new TcpListener(42000);

Start the server. server.Start();

Tell the server to Accept a waiting connection from a TcpClient and save this client. This will freeze the Thread till a connection is established. So better put this in some other thread that is dedicated to communication.

TcpClient client = server.AcceptTcpClient();

Grab the Networkstream the client is writing to.

NetworkStream netstream = client.GetStream();

Fortunately the StrokeCollection Class has a constructor that take a stream as parameter. StrokeCollection p = new StrokeCollection(netstream) ;

The usual cleanup.

netstream.Close();

client.Close();

server.Stop();

And don’t forget to pass the information somewhere. If you are sure, that nothing will happen with the object you can save the Clone(). But it is more secure to make a copy of the data for the gui. Otherwise you might get into troubles with the next update.

this.inkCanvas1.Strokes = p.Clone();

Chipset 915GV supports no PCIe Videocards

My videocard stopped working last week. So my first solution to this problem was to switch back to the onboard vga card. Problem with that is, that it cannot display the Windows Phone 7 emulator. So i cannot test or screenshot anything for the tutorial series.
I bought a new (cheap) PCIe videocard to solve this. Sadly it did not work and after some searching the web i found out, that my chipset, the old 915GV, does not support PCIe videocards. The only thing working in the PCIe slot is a special DVI Adapter extension for the onboard card.
What i am trying to say is, it might take a few days till i can update the tutorial again. Sorry about the delay.

Implementing a level of Detail (LoD) system in XNA games

If you have big levels and/or a huge amount of 3d models you have to render you will find that the game gets slower and slower.

Before you try to  optimize the draw codes, please use a profiler to make sure, that the problem is not somewhere else. Maybe the update logic is the problem?

You have some ways to tackle the problem:

  1. optimize everything in your draw code and shaders
  2. tell the user to buy a better computer
  3. remove objects
  4. lower the quality of models

Or you could scale the quality with the power of the computer displaying them.

To do so in a quick (and a bit dirty) way go to your class that holds the model and decides which model is to render (might be only one there without a LoD system or damage system).

  • Add a second and third model.
  • Make low poly versions of your model. One really low and one somewhere around the quality you can life with.
  • Load these lower versions of the model in your class
  • Add some code to check the distance to the camera
  • Now simply make some if statements:
    • If(distance >500.0f) do nothing
    • If(distance > 300.0f) draw(lowest_quality_model)
    • If(distance > 100.0f) draw(average_quality_model)
    • else draw (high_quality_model)
  • Play around till the numbers make sense in your game.
  • You might also add a condition that a slow running game never renders the highest_quality_model
  • As my LoD system not only draws the model but the shadows too i could use the lowest quality model to draw the shadow.
  • I also added a condition that the game fist tries to stop drawing shadows and than lowers the quality of models even further till the point where only the lowest poly models really close to the camera a drawn and the rest is ignored.
  • Be carefull with drastic measures. It is not always good to lower the overall quality of models just because the game missed one or two frames somewhere. The problem might not be the draw code at all.

Hope this helps you.

Skype crashing? Skype error may 2011

All your Skype client does is producing windows errors?

This is what helped me. Maybe it is a solution for your problem.

  1. Make sure you display hidden files and folders in the windows explorer.
  2. Navigate to Users/AppData/Roaming/Skype.
  3. Delete the shared.xml (or rename to be on the safe side).
  4. Make sure no skype is running. Use the task manager for this.
  5. Start skype.
%d bloggers like this: