Tutorials
Welcome to Farid's tutorials,a simple blog that i use to document some nice code pattern that i find useful for my reference in future projects and also to share links that are useful. I do lots of C#/ ASP.NET, MSSQL, bit of R, Python, Arduino, RaspPI, bit of linux and IOS and Android development on a professional/ personal basis. Hope this blog is useful for you as how i find it useful for me.
Thursday, September 08, 2016
Cross platform mobile development with flutter
https://medium.com/@develodroid/flutter-i-intro-and-install-a8bf6dfcc7c8#.opbknlh7v
Sunday, February 01, 2015
MVC Basics 01 (viewbag)
Started to resume learning MVC lately, overall its clean, feels nice as compared to Web.Form, here are some basics to share
1. Passing Data from Controller to Views. (using viewbag)
public ActionResult Index()
{
List<selectlistitem> color = new List<selectlistitem>();
color.Add(new SelectListItem { Text = "red", Value = "1" });
color.Add(new SelectListItem { Text = "blue", Value = "2" });
color.Add(new SelectListItem { Text = "green", Value = "3" });
ViewBag.Colors = color;
ViewBag.Time = DateTime.Now.ToString("dd/MM/yyyy hh:mm");
return View();
}
in Controller, use @ViewBag to get access to the passed data
<div>
<p>Message from Viewbag @ViewBag.Time</p>
<div class="panel">
<div class="panel panel-heading"><h1>List from Controller</h1></div>
<div class="panel panel-body">
Select a Color from viewbag @Html.DropDownList("Colors")
</div>
<div class="panel-body">
<div class="btn btn-default">@Html.ActionLink("Back to Main Index","Index","Home")</div>
</div>
</div>
</div>
1. Passing Data from Controller to Views. (using viewbag)
public ActionResult Index()
{
List<selectlistitem> color = new List<selectlistitem>();
color.Add(new SelectListItem { Text = "red", Value = "1" });
color.Add(new SelectListItem { Text = "blue", Value = "2" });
color.Add(new SelectListItem { Text = "green", Value = "3" });
ViewBag.Colors = color;
ViewBag.Time = DateTime.Now.ToString("dd/MM/yyyy hh:mm");
return View();
}
in Controller, use @ViewBag to get access to the passed data
<div>
<p>Message from Viewbag @ViewBag.Time</p>
<div class="panel">
<div class="panel panel-heading"><h1>List from Controller</h1></div>
<div class="panel panel-body">
Select a Color from viewbag @Html.DropDownList("Colors")
</div>
<div class="panel-body">
<div class="btn btn-default">@Html.ActionLink("Back to Main Index","Index","Home")</div>
</div>
</div>
</div>
Thursday, January 01, 2015
Migrate tfs on premises to vso
Link to article with link to a free tool that can migrate projects including change history.
Friday, November 28, 2014
Recommended Videos (For Learning)
Recently, as im trying to understand Agile/ SCRUM concepts, i started to download a bunch of youtube videos via Dirpy. Then loaded the 100MB++ MP4 video into my Android Phone, and played them while i drive to work.
Since they are mostly presentation, the audio is what i hear and the occasion glance at a change in slide. Some videos were really good, (especially if the speaker is engaging) some are really Boring, rather i zone out. Here are list of recommended videos (that will be updated regularly)
1. Transforming to an Agile PMO
I loved the 'source of big waste' and the Practical example, its really a great follow up presentation after you get the basic concepts of agile and want to see "what actual real things do people in agile so as in report, tracking etc". Presenter presents well, do feel engaged most of the time.
Rating: 7/10
2. Scott
2. Hanselman's Intro to Xamarin 'How C# Saved My Marriage, Enchanced My Career, and Made Me an Inch Taller'
3. Agile Connect 2011 - How to Write Great User Stories: Defining Customer Value
Good explanation on ideas to improve requirement gathering/ user stories
Rating: 7/10
Since they are mostly presentation, the audio is what i hear and the occasion glance at a change in slide. Some videos were really good, (especially if the speaker is engaging) some are really Boring, rather i zone out. Here are list of recommended videos (that will be updated regularly)
1. Transforming to an Agile PMO
I loved the 'source of big waste' and the Practical example, its really a great follow up presentation after you get the basic concepts of agile and want to see "what actual real things do people in agile so as in report, tracking etc". Presenter presents well, do feel engaged most of the time.
Rating: 7/10
2. Scott
2. Hanselman's Intro to Xamarin 'How C# Saved My Marriage, Enchanced My Career, and Made Me an Inch Taller'
If you have seen Scott Hanselman in action, its the most entertaining and educational presentation ever, really funny, i enjoyed it so much and was inspired to research about ASYNC in C# 5.0
Rating: 9/10
3. Agile Connect 2011 - How to Write Great User Stories: Defining Customer Value
Good explanation on ideas to improve requirement gathering/ user stories
Rating: 7/10
Command Prompt in ASPX
While i was looking at this video 'Why a Hacker Can Own Your Web Servers in a Day'' i realize that we can create an ASPX page to run command Prompt command!
Its a vulnerability, but if properly controlled with proper access rights, very useful!
So here is a version of it:-
Taken off CodeProjects
Its a vulnerability, but if properly controlled with proper access rights, very useful!
So here is a version of it:-
Taken off CodeProjects
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(Page.IsPostBack)
{
string exec = TextBox1.Text;
// Get the full file path
string strFilePath = Server.MapPath("fine.bat");
// Create the ProcessInfo object
System.Diagnostics.ProcessStartInfo psi =
new System.Diagnostics.ProcessStartInfo("cmd.exe");
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.RedirectStandardInput = true;
psi.RedirectStandardError = true;
// Start the process
System.Diagnostics.Process proc =
System.Diagnostics.Process.Start(psi);
// Open the batch file for reading
//System.IO.StreamReader strm =
// System.IO.File.OpenText(strFilePath);
System.IO.StreamReader strm = proc.StandardError;
// Attach the output for reading
System.IO.StreamReader sOut = proc.StandardOutput;
// Attach the in for writing
System.IO.StreamWriter sIn = proc.StandardInput;
// Write each line of the batch file to standard input
/*while(strm.Peek() != -1)
{
sIn.WriteLine(strm.ReadLine());
}*/
sIn.WriteLine(exec);
strm.Close();
// Exit CMD.EXE
string stEchoFmt = "# {0} run successfully. Exiting";
sIn.WriteLine(String.Format(stEchoFmt, strFilePath));
sIn.WriteLine("EXIT");
// Close the process
proc.Close();
// Read the sOut to a string.
string results = sOut.ReadToEnd().Trim();
// Close the io Streams;
sIn.Close();
sOut.Close();
// Write out the results.
string fmtStdOut = "<font face=courier size=0>{0}</font>";
this.Response.Write("<br>");
this.Response.Write("<br>");
this.Response.Write("<br>");
this.Response.Write(String.Format(fmtStdOut,
results.Replace(System.Environment.NewLine, "<br>")));
}
}
}
Thursday, November 27, 2014
Resize all image in MS Outlook via Macro
Its a Pain to keep doing image resize manually, and i found this:-
http://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/Q_27768384.html
So here is ME shamelessly copying the solution here:-
1. Start Outlook
2. Press ALT+F11 to open the Visual Basic Editor
3. If not already expanded, expand Microsoft Office Outlook Objects
4. If not already expanded, expand Modules
5. Select an existing module (e.g. Module1) by double-clicking on it or create a new module by right-clicking Modules and selecting Insert > Module.
6. Copy the code from the code snippet box and paste it into the right-hand pane of Outlook's VB Editor window
7. Click the diskette icon on the toolbar to save the changes
8. Close the VB Editor
Here's how to add a button to the QAT for running the macro with a single click.
Outlook 2010. http://www.howto-outlook.c om/howto/m acrobutton .htm#qat
http://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/Q_27768384.html
So here is ME shamelessly copying the solution here:-
1. Start Outlook
2. Press ALT+F11 to open the Visual Basic Editor
3. If not already expanded, expand Microsoft Office Outlook Objects
4. If not already expanded, expand Modules
5. Select an existing module (e.g. Module1) by double-clicking on it or create a new module by right-clicking Modules and selecting Insert > Module.
6. Copy the code from the code snippet box and paste it into the right-hand pane of Outlook's VB Editor window
7. Click the diskette icon on the toolbar to save the changes
8. Close the VB Editor
Here's how to add a button to the QAT for running the macro with a single click.
Outlook 2010. http://www.howto-outlook.c
Sub ResizeAllPicsTo75Pct()
Const wdInlineShapePicture = 3
Dim olkMsg As Outlook.MailItem, wrdDoc As Object, wrdShp As Object
Set olkMsg = Application.ActiveInspector.CurrentItem
Set wrdDoc = olkMsg.GetInspector.WordEditor
For Each wrdShp In wrdDoc.InlineShapes
If wrdShp.Type = wdInlineShapePicture Then
wrdShp.ScaleHeight = 75
wrdShp.ScaleWidth = 75
End If
Next
Set olkMsg = Nothing
Set wrdDoc = Nothing
Set wrdShp = Nothing
End Sub
Wednesday, November 26, 2014
Visual Studio PRO is FREE
Im using VS Express, at home, it works, does all that i need, but wish i had the same VS as the one at work.
Just found out the following from a co-worker:-
Before that here is the Link to get Free VS:-
http://www.visualstudio.com/en-us/products/free-developer-offers-vs
Just found out the following from a co-worker:-
Before that here is the Link to get Free VS:-
http://www.visualstudio.com/en-us/products/free-developer-offers-vs
Visual Studio Community Edition
Q: How does Visual Studio
Community 2013 compare to other Visual Studio editions?
A: Visual Studio Community 2013 includes all the great functionality of Visual Studio Professional 2013, designed and optimized for individual developers, students, open source contributors, and small teams.
A: Visual Studio Community 2013 includes all the great functionality of Visual Studio Professional 2013, designed and optimized for individual developers, students, open source contributors, and small teams.
Q:
Who can use Visual Studio Community?
A: Here’s how individual developers can use Visual Studio Community:
A: Here’s how individual developers can use Visual Studio Community:
- Any individual developer can use Visual Studio
Community to create their own free or paid apps.
· Here’s
how Visual Studio Community can be used in organizations:
o
An unlimited number of users within an organization can use
Visual Studio Community for the following scenarios: in a classroom learning
environment, for academic research, or for contributing to open source
projects.
- For all other usage scenarios: In non-enterprise
organizations, up to 5 users can use Visual Studio Community. In
enterprise organizations (meaning those with >250 PCs or > $1
Million US Dollars in annual revenue), no use is permitted beyond the
open source, academic research, and classroom learning environment
scenarios described above.
o For
more information, please refer to the Visual Studio Community 2013 License Terms and the Visual Studio Licensing Whitepaper.
Summary of Visual studio and
.NET road map for 2015 to 2016
Tuesday, November 25, 2014
Developing Utils for Redmine (notes)
I'm trying to develop a report page for selected task in redmine (in .net), so the journey started with:-
Links: http://www.redmine.org/projects/redmine/wiki/Rest_api
Where i learned that
This is where i see my issues > http://myredmine:88/redmine/issues/3239
This is where i see it in XML > http://myredmine:88/redmine/issues/3239.xml
This is where i see it in json > http://myredmine:88/redmine/issues/3239.json
But it keeps asking me to login, and i cant figure out where the API key will i re-read and found that:-
You can find your API key on your account page ( /my/account ) when logged in, on the right-hand pane of the default layout.
Hence Now you just modify and add a querystring with your API key and it loads
Loading an Issue as XML:
http://myredmine:88/redmine/issues/3239.xml?key=bf13332d3dda.....
Then i found a .NET library with very little documentation:- API .NET Library: https://code.google.com/p/redmine-net-api/
It allows you to add, search, delete, but with the very little doc kind of hard to make it work when u used alot of custom fields.
Links: http://www.redmine.org/projects/redmine/wiki/Rest_api
Where i learned that
This is where i see my issues > http://myredmine:88/redmine/issues/3239
This is where i see it in XML > http://myredmine:88/redmine/issues/3239.xml
This is where i see it in json > http://myredmine:88/redmine/issues/3239.json
But it keeps asking me to login, and i cant figure out where the API key will i re-read and found that:-
You can find your API key on your account page ( /my/account ) when logged in, on the right-hand pane of the default layout.
Hence Now you just modify and add a querystring with your API key and it loads
Loading an Issue as XML:
http://myredmine:88/redmine/issues/3239.xml?key=bf13332d3dda.....
Then i found a .NET library with very little documentation:- API .NET Library: https://code.google.com/p/redmine-net-api/
It allows you to add, search, delete, but with the very little doc kind of hard to make it work when u used alot of custom fields.
Subscribe to:
Posts (Atom)