Supertext Home
Chief of the System Blog

Recursive file copy with wildcard on Windows

July 30th, 2010 by

I was looking for a way to copy only certain file types from one folder to another. Basically a recursive copy with a filter.

There are different solutions, but here I found the best one, that does not need any additional tools.

http://www.vistax64.com/powershell/30490-copy-item-recurse-wildcard.html

 

Just open the Windows Powershell and type the following command:

copy-item -rec -filter *.resx C:\source_dir  C:\target_dir

This will copy all files with the ending .resx from source_dir to target_dir.

Problem solved.


WordPress XML-RPC Issues

May 5th, 2010 by

After upgrading my wordpress blog I could not connect my Windows Live Writer anymore. Funny enough it will worked with my other blog (blog.supertext.ch). The only difference that I could find, was that remy.supertext.ch was configured to use iso-8859-1 and blog.supertext.ch used utf-8. But changing that did not actually help. Could be that the issue is some info that is still in the database.

Using the WordPress iPhone App, I got the following error:

NSXMLParserErrorDomain error 73

Does not really help either. But I found some posts, suggesting all kind of things that all didn’t apply or work.

Now, getting a little desperate, I installed Fiddler (which is really an awesome tool) and discovered that if I rerun the rpc call that Windows Live Writer is doing, I get a Content-Length mismatch Error:

image

Here is the request in raw form, you can try it yourself to see what results you get. Password/Username do not matter for the test, but you have to set the POST and Host value correctly:

POST http://blog.yourhost.ch/xmlrpc.php HTTP/1.1
Accept: */*
Accept-Language: en-US, en, *
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Writer 1.0)
Content-Type: text/xml
Host: blog.yourhost.ch
Content-Length: 491
Connection: Close

<?xml version="1.0" encoding="utf-8"?>
<methodCall>
 <methodName>blogger.getUsersBlogs</methodName>
 <params>
  <param>
   <value>
    <string>ffffffabffffff716</string>
   </value>
  </param>
  <param>
   <value>
    <string>admin</string>
   </value>
  </param>
  <param>
   <value>
    <string>password</string>
   </value>
  </param>
 </params>
</methodCall>

I don’t really have an idea on how to fix this for real, but what helped is to just add 2 to the length of the response. Edit the class-IXR.php file from the wp-includes directory on line 396. I’m using WordPress Version 2.9.2

function output($xml) {
    $xml = '<?xml version="1.0"?>'."\n".$xml;
    $length = strlen($xml);
    header('Connection: close');
    header('Content-Length: '.$length  + 2);
    //+2 Solves the Live Writer issue
    header('Content-Type: text/xml');
    header('Date: '.date('r'));
    echo $xml;
    exit;
}

Just FYI:
I’m using IIS 6.0 on Windows 2003.


Access denied for user ‘root’@'localhost’

May 5th, 2010 by

Ever got the following error message after installing MySQL on a Windows Server:

ERROR 1045 (28000): Access denied for user ‘root’@'localhost’ (using password: YES)

Sounds like this is quite a common problem if you look check in google.

This issue could have several roots:

  • The MySQL Service is not running
  • Service is not configured to accept network connections
  • Wrong password/username
  • Firewall setup
  • Wrong port (standard is 3306)

The mysql help actually has some good hints for these issues:

http://dev.mysql.com/doc/refman/5.0/en/access-denied.html

(From my own experience, port 3306 actually does not need to be open in order to use the MySql command line tool or the MySQL Workbench.)

My service was running and configured for tcp/ip, the firewall was disabled and the port was correct. So it had to be something with the password.

You can reset the root password like this:

  1. Stop the MySQL service:
    sc stop mysql
  2. Start MySQL with the –skip-grant-tables option, this disables the password checks. You might wanna start it in a different command prompt window.
    mysqld.exe –skip-grant-tables
  3. Run the following commands:
    mysql -u root mysql
    mysql> UPDATE user SET Password=PASSWORD(‘your_new_password’) where USER=’root’;
    mysql> FLUSH PRIVILEGES;
  4. Stop the Server:
    mysqladmin -uroot -pyour_new_password shutdown
  5. You should be able to login now
    mysql -uroot -pyour_new_password

If this does not help, there is a long discussion in the MySQL forum about this issue:

http://forums.mysql.com/read.php?11,34014,34014#msg-34014

Good luck!


Collection was modified; enumeration operation may not execute

July 29th, 2009 by

Ever tried to remove or change something in a C# Enumeration while you iterate over it? Yes, it does not work very well.

But there are ways around it.

foreach (Item item in items.ToArray())
{
    if (item.Visible == false)
    {
        items.Remove(item);
    }
}

The simplest way is to use ToArray(). No much coding, no complicated loops, but obviously not very efficient for larger lists.

A few alternatives are presented by Kevin Ransom.


Float Drop Problem

July 14th, 2009 by

For our Orders, Jobs and Documents pages we switched from using tables to using lists (ul/li) with left floating div’s. This is nice in terms of modern CSS driven HTML and is easier to adopt to the iPhone. But it does bring a few issues with it. For example that the div’s tend to drop below the one on their left if the content is too large and they have no size attribute.

I’ve built a page where I tried out different ways to prevent this with example code.

Float Drop Examples

What we used at Supertext is to have the 2nd column with a fixed position. But this is only possible if you have only 2 columns and if the width of the first column is fixed too.

 

<div>
    <div>Test</div>
    <div style="position: absolute; left: 40px;">
        <b>Long Text and very long Text. Long Text and very long Text. Long Text and very long Text.</b><br />
    </div>
</div>

Let me know if you have a better solution!


Breadcrumbs to indicate the Checkout Progress

June 18th, 2009 by

According to webdesignpractices, about 45% all all major websites use Breadcrumbs in some way. Either to help navigation or to indicate some type of progress.

At Supertext we didn’t do anything like this so far. During the ordering process, we just had a title to tell the user at which step he was and some info about the order on the right column.

Supertext Order Process

So we tried a simple approach by just adding some text breadcrumbs into the title bar this like this:

Process with Breadcrumbs (Bad example)

But this example is bad for multiple reasons:

  1. No indication where the user is at the moment. Address should be highlighted or in a different color.
  2. No information about the following steps
  3. Look and feel is poor

We’ve now decided on something like this:

New Version

Just look at the new part below the title. There some other changes on this mockup too. Just ignore them. They will go online later this year. What do you think? It covers pretty much all issues that I mentioned above. No?

We modeled it after the example from swiss airlines:

image


Here are some other examples we looked at:

image

Doodle with their KISS approach. Not really breadcrumbs, but gives a progress indication too. Just not much more.

image

Did you find them? On the upper right corner. Yeah, I had to search for them too. But it’s all there. Where I am, next step, last step. But it does have some potential for improvments :-)

image

Another nice example is Amazon with the cart indicating where I am. Maybe we could use a pencil for Supertext?

image

Not very surprising, Apple also delivers with a simple yet elegant solution.


Another article that covers some of these topics is 12 Tips For Designing an Excellent Checkout Process on Smashing Magazin.



  • Topics
  • Archive
  • Subscribe
  • Facebook
  • Twitter