Tutorial by Examples

Set dict = CreateObject("Scripting.Dictionary") Tools> References> Microsoft Scripting Runtime Associated DLL: ScrRun.dll Source: Windows OS Scripting.Dictionary object MSDN-Dictionary Object
public static class MyHelpers { public static MvcHtmlString MyCustomDiv(this HtmlHelper htmlHelper, string text, object htmlAttributes = null) { var mainTag = new TagBuilder("div"); mainTag.MergeAttributtes(htmlAttributes); mainTag.AddCssClas...
First create a disposable class: public class MyDisposableHelper: IDisposable { private bool _disposed; private readonly ViewContext _viewContext; public MyDisposableHelper(ViewContext viewContext) { if (viewContext == null) { throw ne...
Let's create a small piece of code that throws an exception: private void button1_Click(object sender, EventArgs e) { string msg = null; msg.ToCharArray(); } If we execute this, we get the following Exception and stack trace: System.NullReferenceException: "Object reference not...
Set createInternetExplorerObject = CreateObject("InternetExplorer.Application") Tools> References> Microsoft Internet Controls Associated DLL: ieframe.dll Source: Internet Explorer Browser MSDN-InternetExplorer object Controls an instance of Windows Internet Explorer through...
Detailed instructions on getting django-forms set up or installed.
Flexbox is a CSS3 module, standardized by the World Wide Web Consortium. It is a layout mode for element arrangement such that the elements behave predictably when the page layout must accommodate different display sizes. Because it is a part of CSS3, you don't need to install anything. It can be u...
Django Model Form with Django Class Based view is a classic way of building pages to do create/update operations in django application quickly. Within the form we can put methods to execute tasks. Its a cleaner way to put tasks in forms rather than putting in views/models. To give an example using ...
Incorrect code Sub DoSomething() On Error GoTo CleanFail DoSomethingElse CleanFail: Debug.Print Err.Number Resume Next End Sub Why doesn't this work? If the DoSomethingElse procedure raises an error, execution jumps to the CleanFail line label, prints the error number, a...
Built-in forms are great but sometimes there is a need to customize them, adding new fields or simply changing CSS attributes. This example is applicable to several use cases but here it is presented regarding PasswordChangeForm and its use in a Bootstrap website. The solution is to create another...
from django.test import TestCase from myapp.forms import MyForm class MyAppTests(TestCase): def test_forms(self): form_data = {'field1': 'fieldvalue1'} form = MyForm(data=form_data) self.assertTrue(form.is_valid())
In general, the code is placed in the module of a sheet. This is the Worksheet_SelectionChange event, which fires each time a different cell is selected in the active sheet. You can select "Worksheet" from the first drop-down menu above the code window, and "Selection_Change" fr...
To restrict the characters that can be typed into an entry widget, only numbers for instance, a validate command can be added to the entry. A validate command is a function that return True if the change is accepted, False otherwise. This function will be called each time the content of the entry is...
Detailed instructions on getting jq set up or installed. Install on Mac Using brew: $ brew install jq Then test: $ echo '{"name": "john"}' {"name": "john"} $ echo '{"name": "john"}' | jq '.' { "name": "john&quo...
The creators of Swift have put a lot of attention into making the language expressive and error handling is exactly that, expressive. If you try to invoke a function that can throw an error, the function call needs to be preceded by the try keyword. The try keyword isn't magical. All it does, is mak...
The connection between the widget and the scrollbar goes both ways. The scrollbar needs to be expanded vertically so that it has the same height as the widget. text = tk.Text(parent) text.pack(side="left") scroll_y = tk.Scrollbar(parent, orient="vertical", command=text.yview...
The principle is essentially the same as for the Text widget, but a Grid layout is used to put the scrollbars around the widget. canvas = tk.Canvas(parent, width=150, height=150) canvas.create_oval(10, 10, 20, 20, fill="red") canvas.create_oval(200, 200, 220, 220, fill="blue")...
Ubuntu: lshw is a small tool to extract detailed information on the hardware configuration of the machine. It can report exact memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, bus speed, etc. $ sudo lshw | less (or more) $ sudo lshw -ht...
Ubuntu: $ cat /proc/cpuinfo Sample Output: processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 15 model name : Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz stepping : 11 cpu MHz : 1596.000 cache size : 4096 KB physical id : 0 siblings ...
Follow following steps to try out a sample application on AWS ECS service as a proof of concept. Login to AWS management console and go to AWS service catalog - > Compute - > Ec2 Create a VM(EC2 instance) using amazon linux 64 bit OS, this we will use to configure docker, git, AWS ECS agen...

Page 1121 of 1336