0 Comments

Some time ago I have written a post about, how to setup Windows 10 to wake it up remotely via network using magic packet. The question that remained unanswered is: how to actually send this packet to the PC to trigger it running.


In the first example I will use Raspberry Pi with Rasbpian Stretch Lite installed:

1) First make sure a tool etherwake is available. If not, this could be fixed with following command, otherwise skip this step:

sudo apt-get install etherwake

2) Then simply invoke it with proper arguments:

sudo etherwake –i <ethernet-interface-name> <PC MAC-address>

Some explanations:

Yes, it will ask you for a password, each time you try to call it. Also MAC address should be specified in format “XX:XX:XX:XX:XX:XX”. That was the easier part.

The harder part is that etherwake by default tries to use eth0 as the network interface, where to send the magic packet. Raspberry has a feature called “Predictable network interface names” enabled by default (since August 2017 I think; was even in Jessie edition, but was disabled by default). With a big probability the name of the interface will be different than eth0 (something like enx?? or wlx?? depending if using LAN or WiFi and ?? should be replaced with Raspberry’s own MAC address).

To list existing network interfaces type this command:

ip link show

Then grab the proper name, which is not a loopback. Or use raspi-config (via command “sudo raspi-config”) and navigate to “2: Network Options” and disable predictable network interface names, so it should go back to using eth0 and wlan0 names.


In the second example I wish to show, how to achieve the same effect on Synology NAS station.

If your DSM is really old, you could use the optional package manager named ipkg. Though this manager make sure wakelan utility is installed. And waking up a PC is just a matter of issuing following command in the console:

export PATH=$PATH:/volume1/@optware/bin/

wakelan –m <PC MAC-address>

MAC this time is in format: “XXYYZZXXYYZZ”.


On the other hand, if you don’t want to play with custom package managers and have a decent DSM 6.x on-board, one could use the build-in synonet utility (as also described here). Then it’s just a matter of calling it this way:

sudo synonet --wake XX:XX:XX:XX:XX:XX eth0

Executable is located at: /usr/syno/sbin/synonet


And that’s all. Have fun!

0 Comments

Yet, Internet connection sharing is an easy-to-use feature on my Xiaomi Redme Note 5 phone that has wasted me whole evening to get it right. Funny thing, really, since as a user I was supposed to enter Settings, navigate to Mobile Hotspot, define password and swipe to enable it. Also from that point of view, that’s all you can do, due to lack of any other configuration options. But as it turned out, there is a subtle “bug”, that causes it not to work on any Xiaomi phone (with MIUI and without).

Short story long… Of course data connection on the phone itself was always working fine. I could browse the net, connect via VPN to work network, watch YT, listen music from Spotify etc. Several times I needed to share this LTE connection with the Windows 10 laptop to perform some immediate tasks and it always failed. No matter what hour I tried, or the part of the city I was sitting. Then I mostly gave up and turned back for few moments to my BlackBerry Passport phone, where it was always working smoothly ;)

Finally I realized it’s time to find a solution to this issue. And here it is, few hours later.

I browsed the Internet and found all those misleading guides, that lead to nothing, so simply skip them:

  1. First I thought it was due to problem with the way my APN (settings for data-connection) was defined:
    • Switched to IPv6 only
    • Reset everything to default
    • Confirmed with my mobile operator, whether default is right
    • Switched APN type to ‘default’
    • Switched MVNO type to ‘GID’
    • Switched to IPv4/IPv6
  2. Set hotspot frequency to 5 GHz
  3. Reset device, place SIM card in secondary slot
  4. That all was wrong, still I could only to connect the PC to the hotspot, but no packets were actually transmitted over the LTE. Then I thought – maybe it’s the problem with Windows itself. So I tried:
    • Forced IPv6
    • Reset network settings to default
    • Hardcoded Google DNS – 8.8.8.8
    • ipconfig /renew
    • ipconfig /flushdns
    • ssh to any external server

Continuously nothing working correct, even when all the guides I have seen were claiming, it should be fine long ago. I have even found info about Samsung and Huawei devices, where IP ranges or default DNS can be defined directly on mobile.

Then boom! What if this is Xiaomi-only related “bug”. And that’s true. It flies around since several years and xda-developers.com has even a fix, that looks like:

  1. install Android SDK
  2. enable developer mode on the device
  3. enable USB debugging and especially USB debugging extra security settings (without it further commands will throw security exception; also it might require registering at Xiaomi portal as developer)
  4. connect the device via USB
  5. in command prompt type adb shell to issue further commands on the device directly
  6. check value of tether_dun_required, that in my case was `null` as described in the original fix, with command: settings get global tether_dun_required
  7. if the value is different than ‘0’, hotspot will not work
  8. to set it type: settings put global tether_dun_required 0
  9. exit shell and reboot the device


And now it works finally!

0 Comments

Some time ago I have shown how to configure automatic build of SSIS projects (SQL Server Integration Services). Unfortunately they require full version of Visual Studio installed on a build machine as it’s an overwhelming plugin (not only a toolset), what potentially could hit me back.

And well, of course it failed and hit me after 30 days! Turned out Visual Studio 2017 Community Edition expired and was refusing to cooperate more, producing this nice error log:


[12:08:30][Step 2/3] Starting: C:\TeamCity\buildAgent\temp\agentTmp\custom_script7138984668293949066.cmd
[12:08:30][Step 2/3] in directory: C:\TeamCity\buildAgent\work\2906b7d01f979ef5
[12:08:51][Step 2/3] 
[12:08:51][Step 2/3] Microsoft Visual Studio 2017 Version 15.0.27428.2027.
[12:08:51][Step 2/3] Copyright (C) Microsoft Corp. All rights reserved.
[12:08:51][Step 2/3] 
[12:08:51][Step 2/3] The license for Visual Studio has expired.
[12:08:51][Step 2/3] 
[12:08:52][Step 2/3] The evaluation period for this product has ended.
[12:08:52][Step 2/3] Process exited with code 1


Nothing simpler, I run Visual Studio and entered my credentials, that created a proper license etc. All the warnings on UI were gone. All was supposed to go back to normal, but somehow the same log appeared again.

Till now, it was actually my naïve thinking, as Visual Studio was launched in a context of a totally different user than the one used when I double-clicked the shortcut icon. Build system operated as the local system account, since it was the “TeamCity Build Agent” service that was configured to start it.

I tried to use RunAs plugin for TeamCity. I installed it, created dedicated BuildTool user, even configured in “Build Features” section of the build configuration. Of course I run Visual Studio as this user and entered obtained again the license. But automatic build process was still failing with this log:

[13:12:58][Step 1/3] MSBuild output
[13:12:58][MSBuild output] Access is denied.
[13:12:58][MSBuild output] The current directory is invalid.

I should have probably focused more on this message and grant read/write access for new user to the buildAgent folder (as this is the place, where the sources gets populated and processed) and that would be probably the final solution (even mentioned here). But since I am hot-tempered, I moved to another try.

Next, I reconfigured the whole TeamCity Build Agent service to start as BuildTool user. I added proper login permissions (to allow it to boot the machine, login as a service etc., more here), along with access to mentioned above folder.

TeamCity Build Agent service log-on properties

Since now on, I had no issue anymore and all builds successfully again.


Congrats!

2 Comments

Some time ago I read a post from Jakub Jędryszek about using a boogie board to make notes. The theory behind it was good enough to convince me to buy one from Gearbest.com. And to be honest I also recommend this toy after such a short period of time. The quality of sketches is amazing for daily tasks for such a low price! Although when I gave it to my kids I wish there was a button (second one) to preserve it and save somewhere as a bitmap image.

Anyway… where is my real problem here?

Well, till that day everything I ordered from Gearbest.com I did using a regular mail. I knew the delivery wasn’t the quickest in the world, but at least it was always predictable. And at the end, if not delivered directly too me, I could pick it up from my local post-office after being notified with aviso.

For that particular order I left the default method – i.e. DPD(UK) carrier service without further thinking. It was really express delivery I must admit. So quick that I almost missed it. Why? Because it’s my fault of course. So please, not treat my further description as a complain. I wish rather to explain, what were my mistakes and where to obtain information they will ask you if you start talking.

The story context is - from Gearbest.com I received a parcel number and I was supposed to use another website (17track.net) to keep tracking of the parcel’s status. What I did, simply checking once per few days, not every hour as I expected it to take at least a month. Then after two weeks, I got a call from an unknown number in the middle of my working hours and the same number tried once again on the next day. That’s it. No email, no info, no SMS about anything, no aviso. Even the status on 17track.net was not updated at that time. I didn’t even expect those calls to be related with my order as there are lots of maniacs in Poland that once you establish a company (be even self-employed) and make your phone number public, they constantly call you trying to sell almost anything, especially a loan.

Then I have seen the “failed” status on 17track.net and called back to be sure. And I was assured, my parcel ended up in a warehouse. Now I could only contact with support (PL phone: 225775555) for help. And here is the crisis: Gearbest provided me 10-digits-long parcel number, while the impatient girl on the other end of the line couldn’t do anything for me without 14-digits-long number. She insisted I should contact the seller first to get the valid number and then contact her again. It changed nothing, when I said, the package was supposed to come from China via DPD(UK). She couldn’t search via name, my phone number nor destination address. Madness!

How could I get the extended number? I didn’t see myself calling Gearbest support and even though, I have seen them saying the number was correct. I could have seen the correct status on the website they provided!

Just by pure accident I opened the www.dpd.co.uk website (not the www.dpd.uk) and entered the short tracking number. What’s even more scary – both sites look exactly the same, but the other website was not giving any results (identically as its polish counterpart www.dpd.com.pl) while the first one produced something like this:

dpd.co.uk


And here I noticed the current status (now: delivered) and full parcel number. The number I got from Gearbest was simply prefixed with “1550” and that’s it. I called DPD(PL) again and this time they believed, this package was for me!


Really funny story! Thx.

0 Comments

Among all the features of ASP.NET framework, there is one I love the most:

moving parts of the configuration (i.e. Web.config) into separate files!

It’s just it, a little something, that makes life so much easier by:

  • less effort while working with GiT (conflicts are subtle and with better context, changing braches mostly let you move also your local changes, or reset parts of it)
  • quicker navigation, as they are files with my custom naming convention (via R# hit Ctrl+T and start typing the name using only first uppercase letters of the file to open it)
  • custom sections can also be put in an another file.


In my typical scenario, I move away sections responsible for:

  • database connection strings (as they change the most)
  • WCF service definitions (behaviors, bindings and services themselves) as they can occupy lots of space
  • and definition of my custom section of continuously evolving list of options (titanSection).


Sample web.config

As the picture above shows separation is achieved simply by using “configSource” attribute inside a section that is supposed to be outsourced. And that’s all – just name the file, create it and inside that file define directly the same section tag as from Web.config. But this time put there a real content.


For example the content of database connection-strings (named by me: Web.Connections.config, that is located next to Web.config), could look like that:

Separate file with database connection-strings


You can name the files whatever you like. However I highly encourage you to have a naming schema. Anything that starts with ‘Web’ and has an extension ‘.config’ would be probably sufficient and also be easy enough to remember, what is inside.


Final though on custom section. It might be placed in separate location in identical way. Only difference is that his kind of section should have a code-behind C# class inheriting from ConfigurationSection with all public properties marked with ConfigurationPropertyAttribute attribute (and inner tags define as separate classes inheriting from ConfigurationElement).

Once the class is completed, inside Web.config there should be a link defined between that class and a custom name of the section. Notice the “configSections” and a “section” entry on the picture above. It contains the name of the “titanSection” section and also points to a TitanConfigSection class (with an assembly name) that will handle accumulation of all settings.

Then only the imagination stops you from creating config complicated as the one below:

titanConfig


I hope it proved useful for you too!