How to set SG200-26P to factory default settings

This thread was helpful, even though it’s for a smaller, 8-port switch.  Basically:

  1. Disconnect the switch from all possible DHCP servers (unless you like playing hide-and-seek).
  2. Connect the link port directly to your laptop’s Ethernet port.
  3. Configure your laptop’s network interface to be in the 192.168.1.1/24 network, but avoid the 192.168.1.254.
  4. Now find a small pin (I used the one from the office stepler) and push into the Reset hole of the switch for about 30 seconds.  You’ll see all the switch ports blink when you are done.
  5. Remove the pin.
  6. Start pinging 192.168.1.254 … it’ll take a few minutes before you get a reply.
  7. Once the ping starts working, navigate to http://192.168.1.254 .  It’ll help if your browser doesn’t have any proxy servers configured.
  8. Login with username cisco, password cisco.
  9. ???
  10. PROFIT!

 

PHP session encoding

I’ve been coding PHP for a few years now, but still once in a while I come across something that I had no idea about.  In a recent project I was working on the single sign on (SSO) integration with the customer’s internal systems.  After doing the initial proof of concept code snippet, I got the logged in user results from a shared caching server.  The string looked something like this:

UserAuth|a:2:{s:8:"username";s:6:"leonid";s:4:"role";s:5:"admin";}UserSettings|a:2:{s:8:"language";s:2:"en";s:8:"timezone";s:5:"GMT+2";}

This was very similar to the results of PHP’s serialize() function, but not quite.  I’ve asked around, but nobody could point me in the right direction, so I went the regular expression way to parse this (do I have two problems now?).

After a code review and discussion with the developers on the customer side, I’ve learned that this is apparently a result of PHP’s session_encode() function, which I haven’t seen in the wild until that day.  Excellent! Now I should be able to use session_decode() to parse that, right?  Well, almost.  According to PHP Sadness #29:

The only way to decode php-session-format serialization (different from normal php serialize) is by calling php session_decode, which can only be called if there is an active session. If there is no active session, you can’t decode session data without starting one first.

So, don’t forget to session_start() before you try to decode.  Which makes it a bit tricky if you already have a session that you don’t want to ruin.  You might want to look into session_name() to work around it.  Gladly, I didn’t have to resolve to that as another customer-specific work around was implemented.

jQuery 3.0 Alpha release

Just a few weeks after we’ve started using jQuery 2, the news come in of the new major release of jQuery being not too far away:

It’s been a long time since we did a major release, and you certainly deserve one. So we’re glad to announce the first alpha of jQuery 3.0!

Despite the 3.0 version number, we anticipate that these releases shouldn’t be too much trouble when it comes to upgrading existing code. Yes, there are a few breaking changes that justified the major version bump, but we’re hopeful these breakages don’t actually affect that many people. The jQuery Migrate plugin can help you to identify compatibility issues in your code as well. Your feedback on the changes in this alpha will help us greatly, so please try it out on your existing code and plugins!

There are actually two releases here. First is jQuery 3.0, which supports modern browsers and environments from IE9 forward. Second is jQuery Compat 3.0, which includes support for IE8. As an added bonus, both jQuery and jQuery Compat will include support for Yandex.Browser, a freeware browser released in 2012. You can get the files from the jQuery CDN, or link to them directly