Summary: Windows batch script to generate timestamp for a filename.
People who write Windows Shell (AKA batch or .BAT) scripts for living sometimes need to create file (or directory) names using timestamp values based on local current date and time. This is not as trivial as it may sound. First, there is no shell command that would return a timestamp in a custom format, and the standard command may return a value containing illegal (for filenames) characters, such as colons.
There are articles that address this issue, but many proposed solutions do not accommodate region specifics, so they may work for an OS configured for one region, but fail for another.
The following script will generate a filename-friendly local timestamp for any region:
@echo off
rem -----------------------------------------------------------------
rem MAIN routine
setlocal & pushd
call :GET_TIMESTAMP
set timestamp=%ret%
echo %timestamp%
rem End of the main routine.
popd & endlocal
goto :EOF
rem -----------------------------------------------------------------
rem Generate current timestamp in the format:
rem
rem YYYYMMDDhhmmss (as shown here), or
rem YYYYMMDD_hhmmss (commented out), or
rem YYYMMDDhhmmssmmm (commented out), or
rem YYYMMDD_hhmmss_mmm (commented out)
rem
rem Uncomment the block that generates the desired format and comment
rem out the alternate implementations.
rem
rem Returns %ret%.
:GET_TIMESTAMP
setlocal
for /f "usebackq tokens=1,2 delims==" %%i in (`wmic os get LocalDateTime /value 2^>NUL`) do (
if '.%%i.'=='.LocalDateTime.' set ldt=%%j
)
rem Without milliseconds, without underscore: 20160421140125
set timestamp=%ldt:~0,4%%ldt:~4,2%%ldt:~6,2%%ldt:~8,2%%ldt:~10,2%%ldt:~12,2%
rem echo %timestamp%
rem Without milliseconds, with underscore: 20160421_140125
rem timestamp=%ldt:~0,4%%ldt:~4,2%%ldt:~6,2%_%ldt:~8,2%%ldt:~10,2%%ldt:~12,2%
rem echo %timestamp%
rem With milliseconds, without underscores: 20160421140125202
rem set timestamp=%ldt:~0,4%%ldt:~4,2%%ldt:~6,2%%ldt:~8,2%%ldt:~10,2%%ldt:~12,2%%ldt:~15,3%
rem echo %timestamp%
rem With milliseconds, with underscores: 20160421_140125_202
rem set timestamp=%ldt:~0,4%%ldt:~4,2%%ldt:~6,2%_%ldt:~8,2%%ldt:~10,2%%ldt:~12,2%_%ldt:~15,3%
rem echo %timestamp%
endlocal&set ret=%timestamp%
goto :EOF
Summary: A walk-through explaining how to create and share a public school calendar.
I have three kids enrolled in two schools that operate under different calendars. To keep track of their schedules, I set up the school calendars on my phone (and PC), so that I get event notifications and reminders. It works well, but comes at a cost: in the beginning of each school year I spend 1-2 hours manually entering the information about the school events (minimum days, holidays, days off, back to school nights, etc.) into my personal calendar. And so do other parents at my kids' schools, as well as millions of parents nationwide. Sooner or later the schools will learn how to make the process more efficient, but in the meantime, you -- a school administrator, a teacher, or a volunteer -- can help us. It won't be hard.
In this article, I'll explain how to make it easy for parents to see a school calendar on a mobile device (iPhone, Android device, Windows phone or tablet) and keep this calendar up-to-date. You will no longer need to print calendars on paper (yay, trees!) or have parents enter them manually. A public calendar allows you to add new events, update existing events, delete cancelled events, set reminders, provide helpful event details (such as instructions or locations of off-site events) and subscribers will see them instantly. It lets you share the same calendar online (at your school's website). And it does not limit you to a school schedule. You can follow the same approach to set up a calendar for any organization or activity, such as a sports team or a volunteering project.
Before we get down to the nitty-gritty, let me first clarify the requirements and limitations.
REQUIREMENTS: A user must have a Google account.
While you may keep a personal calendar locked to your your mobile phone or computer, inside of iCloud, or in Outlook, for a public calendar you better use Google Calendar. It supports all major platforms (iPhone, Android, Windows), has wide adoption, and offers most features.
If you (a school calendar administrator or creator) do not have a Google account, you can easily create one (it's free). A Google account gives you access to the Calendar features including ability to create public calendars. You may prefer to create a special Google account that would "own" the school calendar, so you can transfer it to someone else in case you no longer want to manage it (Google makes it really easy to switch between multiple accounts).
To get real time updates, Google calendar subscribers (parents) will also need Google accounts. As a subscriber, you do not need to actively use a personal Google calendar (if you prefer something else), but you will need it to sync the school calendar with your mobile device.
WARNING: If you have a fundamental objection to using Google, there may be a similar approach to sharing a school calendar using a different provider (say, Apple, Yahoo!, or Microsoft), but it'd be more complex (if possible at all), so let's assume that at this point both calendar administrators and subscribers have Google accounts.
Calendar creation process
To set up a school calendar, follow these steps:
Create a public calendar
First, you create a public Google calendar for your school online. Here is a short video explaining how to do this (if you prefer a written tutorial, read Create & manage a public Google calendar):
Although you can change it later, try to give the calendar a meaningful name (or title). Keep in mind that a long name may not show completely on mobile devices, so place the most significant parts of the name in the beginning. Here are some examples of calendar names that I used, so you may want to follow a similar format:
If you want to allow other administrators to maintain the calendar (create and make changes to the events), set appropriate sharing permissions (read the Control what others can see help section).
Add events to the calendar
To make sure you add an event to the wright calendar, when you work with your school calendar, temporarily turn off all other calendars. Here are some tips.
When naming events, follow the same naming convention. To make it easier for subscribers identify which calendar an event belongs to, include a short name of the school in the name of event. Here are some examples of event names that I used for a California Montessori Project's school calendar (you can browse the calendar to see more examples and details):
Minimum Day (CMP)
School Break (CMP)
School Holiday (CMP)
School Closed (CMP)
Last Day of School/Minimum Day (CMP)
As you may have noticed, I prefer to keep titles short and simple, but I also use the description field for additional information.
Include details that parents may find useful in the event description. You can use description for special instructions or any type of information you would normally provide in a letter or email invitation.
For off-site events, specify the address in the location field. The address will help parents find location on map and use navigation apps.
For some events, such as minimum days, it may make sense to set up reminders. Keep in mind that that parents may need time to travel, so give them enough time (I'd say, for a full-day event, a 12-hour advanced reminder would be fine, while for all other events, an hour would be enough). Use pop-ups for reminders.
For repeating or multi-day events (such as regular after school activities or school breaks), set up occurrence rules (do not duplicate events).
Instead of creating each event from scratch, use the Duplicate Event feature, which allows you to copy an existing event, and then update all relevant information. For example, when defining school holidays, set up an even for the Labor Day (I think it's the first holiday in a typical school year), make sure you use proper naming convention and define event details. Then duplicate it to make an entry for Veteran's Day (don't forget to adjust event information), and continue doing the same for other school holidays.
Advertise the calendar
Once you get the calendar up and running, you send its address (the URL of the calendar's ICS file) to the parents. At the time of writing, you could locate the calendar address by following this steps:
Make sure that the address ends with the .ics extension. This is the address of the calendar that you will need to share with parents.
Maintain the calendar
You can use the same calendar year over year and make changes to it at any time. All changes to the calendar will be automatically delivered to the subscribers. As a bonus, you can also add a Google calendar to your website.
Calendar subscription process
To see calendar events on your mobile device, such as phone or tablet, do the following:
Subscribe to calendar
Parents subscribe to the calendar using the provided address of the iCAL (.ics) file. The steps are outlined in the Add someone else's Google calendar article (see the Add using a link section). Alternatively, you can subscribe to a calendar by clicking the Add to Google Calendar shortcut displayed at the bottom right corner of the calendar's HTML page.
Sync calendar with phone
If you do not see the school calendar events reflected on your phone (or other mobile device's) calendar, you may need to make a couple of adjustments. First, follow the instructions outlined in the Sync Calendar with a phone or tablet article. Depending on the device configuration, it may not be enough, so follow your device maker's recommendations. For example, here are instructions for Windows and iPhone users. For an Android device, you many need to clear calendar data and resync the calendar (if you are not sure how to do this, search for: <your device name> +clear +calendar +data and <your device name> +sync +calendar).
* You can add this school calendar by clicking the iCAL / YEARLY link at the top of the calendar page. ** You can add this school calendar to your Google calendars by clicking the link at the bottom right corner of the calendar page.
Easy? I think so.
I'm almost done, but before we part, one final though. In fact, this is the first question you need to address:
How many calendars do you want to keep?
Do you want to maintain a single district calendar or multiple calendars? Do you need a separate calendars for primary, middle, and high schools? Do you want the calendar to include the information relevant to teachers and staff (such as training)? Depending on the size of your district, differences in school schedules, and other factors, you may choose one approach over another. As a parent, I'd like a single school calendar with information relevant to students only and a class calendar reflecting class-specific events, such as field trips, project deadlines, and due dates. I do not care when and where teachers and staff attend training, but I do care when the school is closed, but others may have other preferences.
I hope this information was helpful. If you have questions or want to leave feedback, please leave a comment.
Summary: How to build awesome API documentation using Visual Studio, XML code comments, Microsoft Markup Assistance Language (MAML), and Sandcastle Help File Builder (SHFB).
The presentation explains how to build first-class API documentation using Visual Studio, Sandcastle, and other tools and technologies. The goal of the presentation is to show how to build documentation with less effort and more fun.
The PowerPoint file (with links and notes) and the demo project can be found here:
101 Essential Free Fonts for Web Designers
Fonts that are genuinely free (not just one style or weight free), a balance of fonts that work well for body text as well as display, and a full collection of fonts that are pleasing to the eye.
DVDStyler
Free slide show and DVD authoring tool. Important features: allows creation of interactive menus (from templates), support for multiple video formats.
GlassWire
Free network monitor & security tool with a built in firewall.
LightWorks Free
The free version of a video editing application (see limitation in the version comparison charts).
MP3 Diags
Identifies and fixes problems in MP3 files, such as duplicate tags, wrong audio duration, character encoding, and many others.
Summary: Materials for the Sacramento .NET User Group presentation.
Thanks a lot to everyone who attended my presentation yesterday. You have been an awesome audience. Also, many thanks to Josh Gurin (TEKsystems) for the pizzas and wings and Jason Singh (Microsoft) for the excellent meeting space. I was a bit concerned about parking, but there were lots of free after 6 PM parking spaces around the building.
The PowerPoint slides provide the same information as the web application built by the demo project. If you only want to check references and resources mentioned at the session, just use the slides. If you intend to see how the concepts were applied in the actual application, get the project. When you run the demo app, you will see the same content available in the presentation, although in a slightly different format. Links should work from both the presentation and the demo app.
If you run into any issues or have questions, please post a comment below or contact me directly.
Summary: How to detect different modes of installation.
When building an application installer, it's often necessary to distinguish between different modes of installation, i.e. initial installation, repair, upgrade, uninstall, etc. And as with everything important in MSI, detecting the mode of installation is a PITA (and by PITA, I do not mean flat bread of Mediterranean origin). To help you a little bit, here is a table adopted from a StackOverflow topic (and comments), that shows the values of various Windows Installer properties can help you determine the installation mode:
Install
Uninstall
Repair
Modify
Upgrade
INSTALLED
FALSE
TRUE
FALSE
TRUE
TRUE
REINSTALL
TRUE
FALSE
TRUE
FALSE
FALSE
REMOVE="ALL"
FALSE
TRUE
FALSE
TRUE
TRUE
UPGRADINGPRODUCTCODE
TRUE
FALSE
TRUE
TRUE
TRUE
You can use logical operators NOT, AND, OR to build complex conditions.
Here is how you can detect some common conditions:
First-time installation
NOT Installed
Any installation
NOT Installed AND NOT PATCH
Installation and repairs
NOT REMOVE
First-time installation and repairs
NOT Installed OR MaintenanceMode="Modify"
Upgrades only (during uninstall phase)
Installed AND UPGRADINGPRODUCTCODE
Upgrades
Installed AND NOT REMOVE
Full uninstall (except when triggered by a major upgrade)
(REMOVE="ALL") AND (NOT UPGRADINGPRODUCTCODE)
Any uninstall
REMOVE~="ALL"
If you notice errors or want to include some other conditions, please post a comment.
Summary: Lessons from my Walmart account hacking incident.
Out of the blue, I get an email from Walmart:
Dear Alek Davis,
Personal information associated with your Walmart.com account - name, email address and/or
password - has been successfully updated as requested. If the account change included an update to
the email, for your added security this account update confirmation is sent to both the new and old
email addresses. All future emails will be sent to the new address only.
If the account information update is correct, no further action is needed.
If you did not make these changes to your account, please call us immediately at 1-800-966-6546.
If you have any questions, please reply to this email and let us know how we can help.
We appreciate the opportunity to assist you and look forward to your next visit.
Sincerely,
Your Walmart.com Customer Service Team
I try to log on to my Walmart account and fail to authenticate. I attempt to use the I Forgot My Password feature, but get a message stating that my email address is not registered with Walmart. It's obvious: someone hacked my Walmart account!
I call the above mentioned 1-800 number, but the customer support department is closed (it's around 10 PM PST, but apparently, the world's largest retailer cannot afford 24x7 customer support). There is no option to report the problem online. What's a girl to do?
The best thing I can do is send an email reply describing the problem. I get a canned response indicating that I will get a human response within 24 hours. Okay, what's next?
Results from a quick Google search suggest that a common pattern of Walmart hacking involves using saved credit card data to purchase digital goods. So, I log on to my credit card's account (for the card that I normally use at Walmart.com) and see two unauthorized transactions: one in the amount of $60 (turns out to be 2 Straight Talk 1000-Minute, 1000-Text, 30MB Web Access Service Cards), and another in the amount of $50 (2 SKYPE $25 Prepaid eGift Cards). I call the credit card company to report fraud. I also checked other credit cards that could've been on file with Walmart, but do not notice anything suspicious.
I try logging on to Walmart.com again, and notice a strange address popping up in the email field of the Sign In form for a second just before it is overwritten by my original (and no longer good) address filled in by LastPass. Apparently, I have a low-security personalization cookie, that is not good for anything important (like checking or changing account info, or submitting orders), but it could give me some info about the hacker. I disable LastPass and reload the form. Get the email field populated with this address: ssuper981@yahoo.com. Hello, hacker. How're you doing?
Silly idea: what if I try to log in with my original password? The hacker can't be that careless, but... One... two... three... I'm in! Dear, ssuper981@yahoo.com, thank you for failing Hacking 101. I change my email address back, change the password, and remove all credit card info from the account. I see the two orders in the processing state, and successfully cancel one of them. I use a form to send an order cancellation request for the second purchase, but apparently the Skype eGift cards have been already sent. Well, it's now between Walmart and my credit card company to dispute the charge.
What else can I do? I go to the Yahoo! Security Center and try to find an option to report fraudulent activity coming from a Yahoo! email, but Yahoo! does not provide any way to do this (via a form, email, or phone).
The next morning, I call Walmart (thank God Walmart can afford customer support during normal business hours) to report the incident to a human and have a short conversation with a nice woman (btw, have the companies started bringing customer support back from the foreign lands? talking to a motivated native speaker is so refreshing!). Now, it's time to get back to life, but first, lessons learned:
Never save credit card information when shopping online! Yeah, it's convenient, but may eventually cause more hassles.
Read #1.
And a couple of comments:
Walmart: No 24x7 customer support? Seriously? Even for security issues? Come on, you can do better!
Walmart: Good call on sending notification to old customer's email on personal profile changes. Have I not seen this message, it would have taken me much longer to realize that my account was hacked.
Walmart: Shouldn't user activity that starts with personal profile (and email) changes and is followed by an immediate purchase of digital goods raise a flag for suspicious activity? I know that you rush to get a payment, but you see: you lost $60 (which could've easily been $110), and I'm sure you need that money to hire more support people (at the very least, for security related issues).
Yahoo!: Would it be too much to ask for some way of reporting fraudulent activity originating from a Yahoo! email account? Just asking.