Nothing to see...

A simple blog about all things in the world that is ridikulouse.

Technological steps, are man kinds greatest achievements

Not a Fighter, but a lover of Tech.

Love of the internet

The Internet is the final frontier for open connected networks, it promotes speech and advances knowledge for any mere person. The internet is fast becoming a need rather a want, and it is recognised by the UN as a necessity for the modern person.

Photography

Photography is more than just Art and expression, it is the manipulation of the light and provokes emotion and memories.

Have a look around

The articles on this blog represent my thoughts and views at the time of writing, I can always change my views through further education...please don't hold me against my views. Some of the articles have been written to assist anyone else with similar issues - it also helps me to remember. Hope you get something out of this.

Wednesday, February 18, 2015

Building your own coils

Personal Vaporizers have suddenly become popular, so popular in fact that in my last trip to Europe and America I noticed that 50% of smokers were vaping. When you first start getting into vaping you will probably start off with a standard kit, as your curioisity grows you'll slowly move up and up in to more technical areas.

The minimum equipment you will need will be :
  1. Rebuildable Atmoizer 
  2. A small screwdriver or drill bit or anything that you can wrap a coil around
  3. Wicking Material
  4. Wire
  5. A blow torch (Butane)
  6. Tweezers 
  7. A cutting tool

This is assuming that you have a battery unit. 

Rebuildable Atomizer

A Rebuildable Atomizer is an Atomizer where you can build and install your own coils. In normal Kanger or Aspire tanks you would normally buy a units with built in coils installed and wicks installed - this is quite handy for most people since it is easy to replace the coils by unscrewing the old unit and replacing it with a new unit. 

Some people prefer to build the coils to their own specification, or you may want to build your own coil to dramatically decrease the costs of vaping. 

A Rebuildable Atomizer can be as cheap as $10USD right through to several hundred USD. If you are just getting into it, you may want to get something cheap to get you started and to make sure you are comfortable with all the fiddling around - please note that this is not for everyone. 

To get cheap "knock-off" rebuildables, head over to www.fasttech.com where you will find duplicates of some of the higher end brands. There is a tonne to choose from, and the duplicates vary in prices as well and they also vary in quality. 

Small Screwdriver

You will also need something that you can wrap the wire around to make the coil. Alot of people use small screw drivers or drill bits, but you can use just about anything you only need someone small enough for your preferred coil size that you can wrap the wire around 

You can also buy equipment that will also help you twist the wire around to make a coil.

You will also need a small screwdriver, usually a phillips head screwdriver, to attach the coil to the atomizer. 

Wicking Material

As I mentioned earlier, when you buy coils from Kanger and Aspire you will have a unit with wicking material. The wicking material is what sucks the juice and passes through the coil, the coil heats up and vaporises the juice in the wicking material. 

There is a lot of material that can be used as wicking material, for example you can use:
  • Silica Material
  • Cotton Balls
  • Cellucotton Rayon Fibers
  • Japanese Organic Cotton (Ken Doh Gen)
  • Ekowool
  • Stainless Steel Mesh
  • Ceramic Wick
Silica is what is commonly used by Kanger and Aspire, but a lot of people who build their own will tend to use Japanese Organic Cotton or Stainless Steel Mesh. It is generally by personal preference. You can purchase these at vape sites or on www.ebay.com.au.

Wire

The wire that you would generally be Kanthal A1 200 wire. There are different wires and different quality of wires. Some wires are advertised with a certain gauge but due to their quality they wont always produce the right ohm level that you would expect. 

Kanthal wires come in 22Gauge right through to 32 Gauge (commonly). Depending on the Gauge and the number of coils (Dual or single Coils) and the size of the coil will determine Ohm. 

For example 32 Gauge with 4 wraps to make the coil would generally give you about 2.2ohms. 
A 30 Gauge wire with 4 wraps will give you about 1.4 Ohm. If you have an electrical battery you probably want to get 30 Gauge wire, if you have a mechanical device you can go lower if you want it to. 

A Blow Torch

A blow torch or an open flame is required to prepare the wire. You generally need to run the blow torch up and down the wire to make it easier to work with (i.e it is more pliable).

Again you can get a butane device from www.fasttech.com or at a hardware store. 

Tweezers

You will need a pair of tweezers to hold the wire while you torch it, or squeezing down the coil to compress it or to space it while it is still hot. 

A Cutting Tool

You are going to cut the wire to the preferred size, and also trim excess wire after you attach the coil to the atomizer. A small scissors, a wire cutter, or even Nail Clippers will do the job. 

Personally I use nail clippers to trim the wick and the wires. 

I'll post pictures of my equipment soon. 


Tuesday, February 17, 2015

Entity Framework and Many to Many Relationship - Simple Example

If you want to do Many to Many relationship in Entity Framework the work is quite simple:

  1. Create two classes say Order and Product
  2. Establish a navigational property between the two classes 
  3. You're done. 
So lets take a look at this, the following, as in the example above is Order class

Public Class Order
{
    public int ID {get; set;}
    public string Description {get; set;}
    public virtual ICollection<Product> Products {get; set;}

    public Order()
    {
         this.Products = new List<Product>();
    }

}

The class is a basic class with an ID that is an integer, another property called Description which is of type string, and finally there is a collection of Products. The collection of products is what starts the relationship to Product entity or class. The collection is then instantiated in the constructor as a List. 

The following is the Product class

Public Class Product
{
    public int ID {get; set;}
    public string Name {get; set;}
    public virtual ICollection<Order> Orders {get; set;}



 public Order()
 {
     this.Orders = new List<Order>();
  }

}


The product class is also quite simple in this example, it contains an ID of type integer, a Name of type string, and another collection - this time it is a collection of Orders. This then completes, for this example the many to many relationship. 

Therefore in reading the two entities you would say an Order has collection of Products (or many products) and Products has a collection of Orders (or many orders).

What is Virtual

You may have noticed that there is a virtual keyword before ICollection. The virtual keyword is to establish Lazy Loading. This means that when you retrieve the entity the collection is not loaded immediately, instead it is loaded when you start using it. 

Lets Continue

So to use the many to many relationship in the code you simply need to use the List functions to add/remove. For example to add a product to an instance of a order you would do something like this:


Order _order = New Order(){Description = "My Description"};
Product _product = new Product(){Name = "My Product"};
_order.Products.Add(_product);

In the above code, what we are doing is creating a new instance of Order and note that I'm assigning the value to the Description at the same time as creating the new object. I then create an instance of a Product, otherwise retrieve a product. I then add the product to the collection of Products in the Order object.

If you were using this in a database context you would need to add the Order to the Database, and then save the changes.  




Saturday, February 7, 2015

[Solved - I think ] Visual Studio High CPU usage

Out of nowhere I started Visual Studio to get some coding happening, and it was almost unusable.

I was editing a CSHTML file, and the CPU usage was through the roof. At one point the CPU usage was over 40% and my Surface Pro 3 started heating up and the only thing I could do was to shutdown Visual Studio.

I don't know why this is happening I was working on the same file last night without a hitch. Here is a screenshot of task manager:




























I'm suspecting that this is has something to do with JS and editing CSHTML files. When I edit a normal class everything is hunky dory.

Just an update: 

I tried closing some of the files, and restarted it. When I open one particular CSHTML file in my solution the CPU idles at 40%. I cannot share the code since it is part of a project. When I close the file it drops back 0% or 1%.




Another Update - I think I've worked it out.


I did some testing as to what was happening, I have a file I was doing some tests on called uploadFiles.cshtml. This was html to manage a ajax file upload. I was looking to integrate this functionality into my overall project.


  1. I opened uploadFiles.cshtml - The CPU usage hit 40% and bounced around from 30+% to 40%. I copied all the code and created a new CSHTML file (newupload.cshtml), pasted all the code without modifications. Once I closed  uploadFiles.cshtml and only newupload.cshtml was open the CPU usage went back down. Strange. I initially thought that it was because I had comments using the razor syntax with references to stackoverflow questions and answers and blog posts while I conducted my tests. 
  2. I closed VS and opened newupload.cshtml and everything was normal. I closed VS again, and reopened VS and this time I opened uploadFiles.cshtml. The CPU hit 40%. So now I realised that it wasn't the code in the uploadFiles.cshtml. Just to make sure I deleted all the code in uploadFiles.cshtml and replaced it with some normal markup. The CPU was still bouncing around from 30% to 40%. The only conclusion i could make is that there is something odd with the file. 
  3. I checked the file permissions and folder locations to make sure that there isn't something odd (like the file is located on another network share or USB etc...). But nothing was out of the ordinary. 
  4. I then checked the Solution, and then I noticed something. The uploadFiles.cshtml was excluded from the project. I then included the file into the project and the CPU was 0%-1% and everything was fine. I repeated this by excluding the file from the solution and re-opened the file and the CPU went to about 40%.  


My Conclusion


My conclusion at this stage is that there is something odd happening with opening excluded files in your solution. If you have this issue then try the following:

  1. Close the open file
  2. Right click on the file in your solution explorer and go to Include In Project. 
  3. Open file 

see if this works, it seems to be working for me. 




Thursday, February 5, 2015

Surface Pro Function Keys

If you are an owner of Surface Pro you may have noticed that you don't have quick access to the function keys. For the general consumer the settings of the function keys are less useful and the standard media and other options are far more convenient.

However, if you are a developer you tend to always try and reach for the function keys (e.g build, run etc...).

What you can do is press the    Fn    key +   Caps   key to lock the function key. Then you no longer need to press the Fn key to access the Function keys.

This may be a Windows feature or not and may work with other Laptops etc...

Tuesday, February 3, 2015

Create your own Android Character

There's a new site out that allows you to create your own Android Character. You can choose from a range body shapes, outfits, and accessories to try and mimic an Android that looks just like you, your friend, or your family member.

Or maybe make character of who you think you are, to check it out click here : https://androidify.com/en/#/

Samsung Galaxy S5 - What I want

I'll soon be in the market for a new smart phone, and I'm eagerly looking forward to what Samsung has been working on under the covers. The last set of rumours indicated that the Galaxy line up is being re-designed from the ground up. This is welcome news, since I didn't get a new phone this year because S5 just didn't cut it enough for me to move from my HTC One M7.

So if Samsung is looking to re-design this from the ground up, then here is my wish list:

TouchWiz

The only Samsung Phone that I have liked to date is the Samsung Galaxy Nexus and this was purely because it ran stock Android. It was snappy, had a slight curve and it just worked. Every time I looked at the Galaxy lineup I'm always greeted by TouchWiz, and it always turns we off.
I know there are people out there who think that TouchWiz is great, and I know that Samsung must do focus groups and the people who like them are attending those focus groups. But Samsung, you need to get out a bit more - A lot of people do not like TouchWiz and compared to Android 5 TouchWiz just looks awful and slow.


If you could get an option say - for technical minded people to download and install pure Android it wouldn't be so bad.

Home Button

I feel like the Home button is holding Samsung back. Android phones in general have embraced on-screen or Capacitive buttons for a while. But Samsung has held on to the home button, and then increased the use of the home button by adding a finger-print reader. I really think that Samsung's design could look a whole lot better if the Home Button disappears.

Loose the Gimmicks

With a lot of Android phones, Samsung and HTC included, in an attempt to stand out from the crowd they've tried to add features. In Samsung's case a lot of features. However, a lot of these features tend to be gimmicks - they look good or ok today and in a couple of months you are not using any of the features. There is so much packed into a Samsung phone, it'd be good if Samsung concentrated on a few features that people would actually want.

More Edge

Last year we saw an Alternative to the Galaxy Note which was the Galaxy Note Edge. This was sold along side Galaxy Note, probably not to disrupt the Galaxy Note Sales. However, I personally thought that this was interesting and I would definitively like to see more. Maybe something along the top or the bottom - something like showing the music controls so that it you can see it peeking out of your pocket.

Overall I just want to see what they can do with curved displays. LG G Flex 2 managed to showcase somewhat of a curved display and now its time for Samsung.

Build Quality

Some people are sick of the plastic build quality, and personally I don't really mind the plasticity of Samsung phones. I would much rather have a phone like the Samsung phones if I had to compromise with removable storage and removable battery.

However, there are a number of manufacturers who have dramatically improved their build quality - namely HTC, Moto,  and Apple, that I believe Samsung cannot ignore this any more and has to seriously think about build quality for their phones.



Visual Studio Code Snippets

I've been working with Visual Studio for years, and all this time I have not come across this feature till now.

Visual Studio has built in code snippets, in order to access them you need to first place your cursor where you want some code to be pasted and then you need to press


CTRL + K + CTRL X

I haven't been able to take a screenshot of this, but what will happen is a dialog box will appear with a set of folders. Simply use your cursor keys to navigate to a folder (in my case it is Visual C#) and then press enter, this will reveal the snippets. Browse through the snippet and then hit enter to when you find the one that you want.


Stuck trying to modify the ApplicationUser and Multiple DbContexts

When you are trying to update the AccountController in ASP.NET MVC - to enhance the ApplicationUser or another related entity during Registration you may quickly realise that the AccountController doesn't have a DbContext for you to use.

So like anyone, and looking at the other sample controllers you'll probably define something like this:

ApplicationDbContext db = new ApplicationDbContext();
You then write your code, everything compiles and you run a quick test. Suddenly you are left with a strange error... your applications dumps with Entity Framework complaining that about contexts. What's go ?

Well, what happens is within the AccountController there is no mention of a DBContext, instead the DBContext is being brought in using OWIN.

Have a look in Sartup.Auth.cs, in there there is a definition of the ApplicationDbContext:
app.CreatePerOwinContext(ApplicationDbContext.Create);
The UserManager then utilises OWIN to get the instance of the ApplicationDbContext, so when you define your own context the entities that you use to either retrieve or save using your own context will be tracked only within your defined context.

If you want to use the same DbContext as what the UserManager uses then it is as simple as using OWIN to get the context.

var db = HttpContext.GetOwinContext().Get<ApplicationDbContext>();
This gets the DbContext from OWIN and it will be consistent with the DbContext that the UserManager uses.

Please note, if you want to use this method in any other controller other than the AccountController then make sure that you use the using statements:

using Microsoft.AspNet.Identity.Owin;

I hope this helps. I spent hours hunting this one down - hopefully you will find this page and save some time.

Monday, February 2, 2015

Get the Current Logged in user

In ASP.NET MVC if you are using Asp.Net Identities, you will need to at times get the current logged in user. You may need to do this to determine whether the current logged in user has access to view, create, modify records etc...

First of all this can be only completed in the Controller. If you need the user inside of another class, you will need to pass this through to the class method/function etc...

In the controller, header set the following properties:
   protected ApplicationDbContext Db { get; set; }
   protected UserManager<ApplicationUser> UM { get; set; }
Then in the class Constructor add the following lines:
this.Db = new ApplicationDbContext();
    this.UM = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(this.Db));

Once you have done this, you can then get the user within the controller using the following :
var user = UM.FindById(User.Identity.GetUserId());

The user will be of type ApplicationUser.