Logo

Who is talking?

Archive

Celluloid experiment with MRI / JRuby

over 3 years ago | Rocky Jaiswal: Still Learning

While running a CPU intensive process I wanted to check Sidekiq's performance on MRI vs JRuby. Since Sidekiq internally uses Celluloid, I investigated CPU core usage on Ruby(MRI) and JRuby for a simple prime number generator which uses Celluloid. Code for this looks like -

HTTP Error 500.19 - Internal Server Error

almost 4 years ago | Sumit Bajaj: Sumit Bajaj's Blogs

The requested page cannot be accessed because the related configuration data for the page is invalid.<staticContent> <mimeMap fileExtension=".woff" mimeType="application/font-woff"/></staticContent>This error occurs when there is a problem reading the configuration file for the Web server or Web application. In some cases, the event logs may contain more information about what caused this error.Solution:1. Open IIS and click on hosted website2. On the Featured View tab, double click on MIME type icon and check if .woff extension is present. If on click it gives error not to worry.3. Open web.config file of project solution and check if .woff mimemap entry is present. If yes, remove that entry.4. Go back to IIS and follow Step 1 and Step 2. It should show .woff extension now.5. Check your website and it should work now.Author: Sumit BajajThanks for Reading. Have a great time.

Practical AngularJS Part 2

almost 4 years ago | Dave Kerr: dwmkerr.com

I'm going to be working in F# almost exclusively for a short while, so before I throw myself into that I wanted to wind up my Practical AngularJS Part 2 article. It's ready to rock here: Practical AngularJS Part 2 - Components of an AngularJS Application In this article we

Phonegap Location Tracker in iOS 7 – Pitfalls and solution!

almost 4 years ago | Akshaya Kumar Sharma: Akshaya's World

Scenario My latest adventure took me towards developing a location tracking application using PhoneGap. The goal was to continuously monitor the location of the user (obviously the user had to permit the app for doing so – Privacy alert!) and share the info with the peers. This required interacting with the iOS Location Services to […]

Custom Fetcher for Sidekiq

almost 4 years ago | Rocky Jaiswal: Still Learning

Lately I have been working a bit on Sidekiq. IMHO, it should be one of the default gems for Rails projects, one of the reasons being it also includes Celluloid. When used, the combination of these two awesome libs in conjunction with JRuby can p ...

A better FTP client for Windows you already have: Git bash's curl command

almost 4 years ago | Steve Jansen: /* steve jansen */

My shop has a couple of internal FTP servers to mirror commonly used installers for .Net devs. Installers for apps like Visual Studio can be huge, so GitHub isn’t the best place for this, and it would also smoke most of our Dropbox quotas. So an FTP server seems like the 3rd best option. We are a geographically distributed team, with a VPN to access internal servers. Even with a reliable VPN session over ISP fiber connection, I’ve experience lots of realiability problems downloading large files with the native Windows Explorer / Internet Explorer FTP. The Windows ftp command line client can be a pain to work with. Fortunately, the Git bash emulator for Windows (msysgit) includes a MinGW port of the awesome curl utility. The curl utility has all kinds of awesome features for downloading large files. Here’s a few options I found really useful: 1 curl -C - -v -O "ftp://ftp.example.com/path/to/file.zip" -C - option tells bash to automatically continue an interrupted download, if the server supports this feature. -v prints verbose stats, including an dynamic progress info -O automatically saves the file using the remote file name to the current working directory I crafted this gist to enable downloading a large number of binaries related to .Net development from our FTP server. SETLOCAL PUSHD "%USERPROFILE%\Downloads" IF NOT EXIST "installers" MKDIR "installers" CD "installers" ECHO @ECHO OFF > curl.cmd ECHO TITLE "%~1" >> curl.cmd ECHO IF NOT ".%~p1"==".\" IF NOT EXIST ".%~p1" MKDIR ".%~p1" >> curl.cmd ECHO PUSHD ".%~p1" >> curl.cmd ECHO "%ProgramFiles%\Git\bin\curl.exe" -C - -v -O "ftp://ftp.example.com/path/to/installers%~1" ^&^& PAUSE >> curl.cmd START "" "%COMSPEC%" /D /C "curl.cmd ^"/dotNetFx40_Full_x86_x64.exe^"" START "" "%COMSPEC%" /D /C "curl.cmd ^"/Internet Information Services 7.5 Express/iisexpress_1_11_x86_en-US.msi^"" START "" "%COMSPEC%" /D /C "curl.cmd ^"/Internet Information Services 7.5 Express/rewrite_2.0_rtw_x86.msi^"" START "" "%COMSPEC%" /D /C "curl.cmd ^"/Microsoft SQL Server 2008 Express R2 SP1/SQLEXPRWT_x86_ENU.exe^"" START "" "%COMSPEC%" /D /C "curl.cmd ^"/Microsoft Visual Studio 2010/VS2010PREM_ENU.zip^"" START "" "%COMSPEC%" /D /C "curl.cmd ^"/Microsoft Visual Studio 2010 SP1/VS10sp1-KB983509.exe^"" START "" "%COMSPEC%" /D /C "curl.cmd ^"/Microsoft SQL Server Data Tools/SSDT_10.3.31009.2_EN.iso.zip^"" START "" "%COMSPEC%" /D /C "curl.cmd ^"/Microsoft SQL Server 2012 Tools/SQLManagementStudio_x86_ENU.exe^"" START "" "%COMSPEC%" /D /C "curl.cmd ^"/Microsoft SQL Server 2012 Tools/x86/SqlLocaLDB.MSI^"" START "" "%COMSPEC%" /D /C "curl.cmd ^"/Microsoft Web Deploy V3/WebDeploy_x86_en-US.msi^"" START "" "%COMSPEC%" /D /C "curl.cmd ^"/MSBuild Extension Pack 4.0/MSBuild Extension Pack 4.0.msi^"" DEL /Q curl.cmd POPD ENDLOCAL Be warned, this hack spawns a new command prompt window for each download, so it can get a bit crazy. This seemed like the best worst way to download in parallel while also making sense of each download’s status.

Uploading an Excel and Importing the data in database

almost 4 years ago | Sumit Bajaj: Sumit Bajaj's Blogs

This is very common requirement to read the data from uploaded excel and import it in database. Earlier it was a tedious task but not now, thanks to Nuget packages where you get so many utilities to make your life easy. In this post, we will also use Nuget package and perform the task of uploading excel and importing the data in database.There are two steps to perform this,1. To upload the excel file on server2. Read the uploaded file and import the data to databaseStep1: To upload the excel file on server   <asp:FileUpload ID="excel_upload" runat="server"/>        if (excel_upload.HasFile)    {       bool upload_file = true;       string file_upload = Path.GetExtension(excel_upload.FileName.ToString());       if (file_upload.Trim().ToLower() == ".xls" |             file_upload.Trim().ToLower() == ".xlsx")       {          // Save excel file onto Server          xlsUpload.SaveAs(Server.MapPath("~/Uploads/" + excel_upload.FileName.ToString());       }    }Step2: Read the uploaded file and import the data to databaseTo perform excel read/write, we will use ClosedXML (Nuget package). Install the package using package manager.Once installed, include the namespace in your code file   using ClosedXML.Excel;Now the code starts to get data from uploaded excel file.      FileInfo fi = new FileInfo(filePath);      //Open uploaded workbook            var workBook = new XLWorkbook(fi.FullName);      //Get the first sheet of workbook      var worksheet = workBook.Worksheet(1);      var firstRowUsed = worksheet.FirstRowUsed();      var categoryRow = firstRowUsed.RowUsed();      int coCategoryId = 1;      //Get the column names from first row of excel      Dictionary<int, string> keyValues = new Dictionary<int, string>();      for (int cell = 1; cell <= categoryRow.CellCount(); cell++)      {        keyValues.Add(cell, categoryRow.Cell(cell).GetString());      }      //Get the next row      categoryRow = categoryRow.RowBelow();      while (!categoryRow.Cell(coCategoryId).IsEmpty())      {         int count = 1;         var pc = new ExpandoObject();         while (count <= categoryRow.CellCount())         {          // let this go through-if the data is bad, it will be rejected by SQL           var data = categoryRow.Cell(count).Value;           ((IDictionary<string, object>)pc).Add(keyValues[count], data);                      count++;         }         categoryRow = categoryRow.RowBelow();      }      //Insert the data in SQL which is captured in pc object.Reference: To get more detailed scenarios for excel data manipulation, click here.~~ Happy Coding ~~

Use An Ask, Don’t Tell Policy With Ruby

almost 4 years ago | Pat Shaughnessy: Pat Shaughnessy

Innisfree is an actual island in Lough Gill, County Sligo, Ireland The next time you need to develop a new algorithm, ask Ruby for what you want, don’t tell it what to do. Don’t think of your code as a series of instructions for t

The Common Cold, Common Stock, and TDD; Or: the ‘Cargo-Culting’ of Automated Testing

almost 4 years ago | Christian Lilley: UI Guy

Nearly everyone in software engineering, whether they use automated testing and/or TDD (test-driven development) or not, should read Test Double’s post on “The Failures of ‘Intro to TDD'”. It encapsulates quite nicely the best intentions of TDD, and demonstrates that Test Double are smart people working hard at the Craft of Software. But… here’s my […]

The Common Cold, Common Stock, and TDD; Or: the ‘Cargo-Culting’ of Automated Testing

almost 4 years ago | Christian Lilley: UI Guy

Nearly everyone in software engineering, whether they use automated testing and/or TDD (test-driven development) or not, should read Test Double’s post on “The Failures of ‘Intro to TDD'”. It encapsulates quite nicely the best intentions of TDD, and demonstrates that Test Double are smart people working hard at the Craft of Software. But… here’s my […]