set VERSION="1.2.3.4 (%date%)" set FILEDESCR=/s desc "sample foodll description" set BUILDINFO=/s pb "Built by %USERNAME%" set COMPINFO=/s company "sample company" /s (c) "(c) Sample copyleft 2009" set PRODINFO=/s product "sample product" /pv "1.0.22.33" verpatch /va foodll.dll %VERSION% %FILEDESCR% %COMPINFO% %PRODINFO% %BUILDINFO%
Tuesday
change exe or dll file description
exe or dll file properies can be changed by verpach:
Monday
powershell search string
this is powershell script to search into log files but it could search into any text base files like csv,xml or json:
id displays list of files when search string found:
cd c:\inetpub\Data\logs Get-ChildItem -Recurse *.* | Select-String -Pattern "my search string" | Select-Object -Unique Path
Wednesday
startup podcast shows list
- The Art of Product
- Build Your SaaS
- Bootstrapped Web
- Founder’s Journey
- Hooked on Product
- RogueStartups
- The Tropical MBA
- Indie Hackers
- ZenFounder
- This Week in Startups
- Startup
- Akimbo
- Stacking Benjamins
- Money For The Rest Of Us
- Planet Money
- Reply All
- Daily Tech Headlines
- Current Geek
- 99% Invisible
- System Mastery
Friday
Tuesday
sitecore upload image programmatically to media library
here is how controller class looks like:
using MyCorp.MyLib.Entities.WebService; using Sitecore.Configuration; using Sitecore.Resources.Media; using Sitecore.SecurityModel; using Sitecore.Services.Infrastructure.Web.Http; using System; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Threading.Tasks; using System.Web; using System.Web.Http; namespace MyCorp.MyLib.Feature.EmailService { [OverrideExceptionFilters] public class ImageServiceController : ServicesApiController { /// <summary> /// Save stream as file into sitecore /// </summary> /// <param name="stream"></param> /// <param name="req"></param> private void SaveFileIntoSitecore(Stream stream, ImageRequest req ) { var mediaCreator = new MediaCreator(); var options = new MediaCreatorOptions { AlternateText = req.AltText, OverwriteExisting = true, FileBased = false, Versioned = false, IncludeExtensionInItemName = false, Database = Factory.GetDatabase("master"),//web? Destination = req.DestinationName ///logo.jpg }; using (var memoryStream = new MemoryStream()) { stream.CopyTo(memoryStream); using (new SecurityDisabler()) mediaCreator.CreateFromStream(memoryStream, req.DestinationName, options); } } [HttpPost, OverrideExceptionFilters] public async Task<HttpResponseMessage> Upload() { if (!Request.Content.IsMimeMultipartContent()) { throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType); } string root = HttpContext.Current.Server.MapPath("~/App_Data"); var provider = new MultipartFormDataStreamProvider(root); try { // Read the form data and return an async data. var result = await Request.Content.ReadAsMultipartAsync(provider); ImageRequest req = new ImageRequest(); // This illustrates how to get the form data. foreach (var key in provider.FormData.AllKeys) { foreach (var val in provider.FormData.GetValues(key)) { // return multiple value from FormData if (key == "DestinationName") { req.DestinationName = val; } else if (key == "DestinationFolder") { req.DestinationFolder = val; } } } if (result.FileData.Any()) { // This illustrates how to get the file names for uploaded files. foreach (var file in result.FileData) { FileInfo fileInfo = new FileInfo(file.LocalFileName); if (fileInfo.Exists) { //Save every file to sitecore var s = fileInfo.OpenRead(); SaveFileIntoSitecore(s, req); } } } HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, req); return response; } catch (System.Exception e) { return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e); } } } }
Monday
javascript next month date formatting coupon source code
function NextMonth1() { var now = new Date(); if (now.getMonth() == 11) { return new Date(now.getFullYear() + 1, 0, 1); } else { return new Date(now.getFullYear(), now.getMonth() + 1, 1); } } function formatDate(date) { var monthNames = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]; var day = date.getDate(); var monthIndex = date.getMonth(); var year = date.getFullYear(); return day + ' ' + monthNames[monthIndex] + ' ' + year; } var div = document.getElementById('couponText'); div.innerHTML += "Effective till " + formatDate(NextMonth1());
Subscribe to:
Posts (Atom)
test smtp server with powershell
Send-MailMessage -SMTPServer smtp.domain.com -To [email protected] -From [email protected] -Subject "This is a test email" -Body ...
-
Here is instruction how to make blinking text in rainmeter: 1.right click and select " Edit skin " 2.add following code to temp...
-
Error:The element 'Schedule' has invalid child element 'RecurrenceRule'. List of possible elements expected: 'Occurring...
-
If you use Visual Studio to open a Web project that was developed for the .NET Framework 2.0, the .NET Framework 3.0, or the .NET Framework...