Quantcast
Channel: JPHellemons
Viewing all 132 articles
Browse latest View live

7 Reasons not to use no-reply email address

$
0
0

There are still companies out there who use noreply@companyname.com which is wrong imho. Here are 7 reasons why:

  1. You won’t get out of office notices, because you are not listening3660230-3568764363-i-am-
  2. Noreply addresses won’t get added to whitelists
  3. In many countries you are obligated to have a working reply-to
  4. It’s arrogant to just shout at someone and do not listen to their side of the story
  5. People will list noreply more as spam because you cannot interact otherwise
  6. No-reply will not end up in the Gmail priority inbox
  7. Some people have e-mail rules to filter out no-reply and ignore them

So reasons enough to use a good ticketing system right? So that you can keep the conversations going. Please keep in mind that the user/customer gave his/her mail address but is not allowed to have yours?

Having a link in your mail is not an option to “reply a mail” and enforce users to fill in long web forms is also not user-friendly.

There are blogs from back in 2008 telling companies not to kill the conversation and use no-reply and there are still in 2014 companies who use it. They should learn a thing or two about being customer friendly and ticketing systems.

Here is a Dutch mail I received which is so general and vague that I wanted to reply, but you can only send a “mail” by clicking an URL Confused smile and it is impossible to send an invoice by email in 2014.

noreply-vgz

Hope that this post convinces people not to use no-reply anymore and keep the dialogue going with their customers/users. It can give you valid feedback which can be of great value for your company.


How to start mining bitcoins the easy way

$
0
0

There are a lot of guides online on how to start mining bitcoins, and a lot of them require your pc running mining software and eating all resources or buying expensive dedicated hardware. This guide is for the option in between. A dedicated USB miner. It’s inexpensive and can get up to 2GH/s. I have bought an overclockable Bitmain Antminer U2 which can get up to 2.2GH/s if you overclock it.

http://ecx.images-amazon.com/images/I/51YQ00d3lrL._SY300_.jpgYou won’t get rich with this usb miner by the way. In six hours I mined about 0,5 eurocent. But it is fun to explore and try out. I paid 25 dollar for the usb miner, which is about 18 euro. So it will take me about three years to it earn back. Not to mention power consumption.

So once you have bought your usb miner. Download BGFMiner for your operating system. I needed the x64 version for my Windows 8.1. Unzip it and remember the location. (mine was C:\bfgminer-4.0.0-win64) The next step is to download the driver for the usb miner and install it. Plug in your usb stick and launch a command prompt (or create a .cmd file in notepad)

c:\bfgminer-4.0.0-win64\bfgminer.exe -o PROTOCOL://POOL_URL:PORT -u MY_WORKER_NAME -p WORKER_PASSWORD -S antminer:all --set-device antminer:clock=x0781

I have setup an account at bitcoin.cz this will give you an address like stratum+tcp://stratum.bitcoin.cz:3333 and the worker name and password.

BitcoinThe ‘clock’ hexadecimal variable is to overclock. Please keep in mind that this usb miner gets really hot by default. So add extra cooling if you want to go up to 2.0Gh/s or 2.2Gh/s

x0781 = 1.6 GH/s

x0881 = 1.8 GH/s

x0981 = 2.0 GH/s

x0A81 = 2.2 GH/s

Some tips:

Good luck mining!

Coding music

$
0
0

http://resources2.news.com.au/images/2010/09/24/1225928/839170-the-social-network.jpgAs a software developer, you need a headphone and music to get into the zone. If I have to explain what “the zone” is, you might consider skipping this blog. Mark Zuckerberg was in the zone in the movie the social network.

My current headphone is a on-ear Sony MDR-NC7 with active noise-cancelling. It was the cheapest noise-cancelling headphone and I wanted to check out if noise cancelling would work. So if you have a nice affordable suggestion for a new headphone (preferably with noise cancelling) please let me know in the comments below.

As a developer, you know how hard it can be. If you have an off day:

So here is a list of Spotify playlists for coders. Please feel free to share your spotify coding playlist in the comments!

  1. A soundtrack for coding, 9911 followers
  2. Coding programming hacking slashing – tracks I listen to while writing code, 2672 followers
  3. Chill coding musix, 2625 followers
  4. Music for programming, 1500 followers
  5. A soundtrack for coding: the 2am session, 1042 followers
  6. Coding tracks, 808 followers
  7. Coding music, 463 followers
  8. Coding for hackers, 386 followers
  9. Development on the beat, 348 followers

The “followers” data is from 21th of july 2014. I will try to keep this list up-to-date after each comment. Ow and please post a comment if you have a good affordable noise cancelling over-ear headphone tip!

Good luck coding/hacking/developing/programming!

Move from WP to new Windows Phone

$
0
0

No one blogged about migrating from a Windows Phone to a new Windows Phone! There is no source online about this. I have used the amazing Nokia Lumia 920 for almost a year, but I have a Nokia Lumia 930 now. I have won this amazing device from the June competition of Adduplex.

The 930 has a better screen (full HD) better CPU and a better camera. My 920 had the windows phone 8.1 developer preview 8.10.12400.899 and my 930 has 8.1 (no developer preview) and runs 8.10.12397.895 so the old phone seems to run newer software, but it has no Nokia Cyan (yet).

Back to the migration of the new phone. There are several guides online about moving from Android to Windows Phone or Apple (iOs) to Windows Phone, but no guides from Windows Phone to Windows Phone.WP_20140723_08_53_19_Pro

When you fire up the new Nokia Lumia 930 you get the installation wizard. During that wizard you have to sign in at your Windows id/account (former live id, former .net passport) The wizard will notice that you had a Windows Phone before and will give you the option to restore a backup. The backup contains all your mail accounts, apps, OS- preferences (home screen, tile positions) etc. It is amazing!

In the picture to the right, you can see (in Dutch) that the wizard found a backup of my other Windows Phone (Lumia 920)

There is just one thing that I forgot. I just restored the backup and it started downloading all the apps that I had on my old phone. So I was ready to actually use the new Nokia Lumia 930 and wanted to insert my sim card. But… the 920 has a micro sim and the 930 has a nano sim.

copyright wikipedia justin ormont


So to summarize, migrating from WP to WP is, turn on your device. Sign in onto Microsoft ID. Restore backup. Insert sim card. Done!

p.s. looking forward to the Windows Phone 8.1 GDR1 update!

p.p.s. Did you know that SIM stands for Subscriber Identity Module?

Lenovo Miix 2 tablet won’t power on

$
0
0

The Lenovo Miix 2 tablet is great if you look at the value you get for your money. I purchased one for work for just 196 euro at paradigit.nl

http://www.techspot.com/images/products/tablets/org/1766429079_943123002_o.jpg

It took me a day to install all updates on the windows 8.1 machine. When I returned at work the next day the tablet did not boot. It was still on the usb charger so it was not a battery drain or empty battery or whatsoever. I tried to contact Lenovo through twitter, but no response (yet).

So I had to figure it out myself and found this blog with tips. One of them is to plugin the USB cable, wait for the white light and power on. That did not work. Power on before removing USB cable also did not work. Maybe this works for you, please let me know in the comments.

The real solution (for me) was this trick of @marauderz:

Hold the power button for 20 seconds and then release and press again. That does show the lenovo logo and makes the tablet boot again. It does not matter if you have the 8 inch or 10 inch device. According to @marauderz it has to do with "ConnStandby" mode which is the "connected standby" feature of windows. More about it is available on MSDN. This superuser answer explains how you can disable this feature. Since I am developing a universal app on this tablet and have it on an USB powercable 24/7 I do not need this connected standby feature. So launch regedit, go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\

and change ‘CsEnabled’ from 1 to 0. Confirm, close regedit and reboot.

Store settings in your universal Windows (Phone) app

$
0
0

This post covers storing and retrieving settings with a WPF combobox for the UI. If you are looking for a solution to store settings across devices, for instance a Windows Surface tablet and a Windows Phone powered device, you should check out the blog of Mike Taulty. That is called roaming data storage. And if you are not working on an app for Windows RT/metro or Windows Phone but are just coding some WPF application, you should read this post from Scott Hanselman.

Let’s start with some code now that it’s clear what this post covers and what it doesn’t cover.

Here is my XAML from my userinterface:

<ComboBox x:Name="cbCountry" 
    SelectionChanged="ComboBox_SelectionChanged" 
    PlaceholderText="Select country" SelectedValuePath="Tag"><ComboBoxItem Content="Australia" Tag="au"/><ComboBoxItem Content="New Zealand" Tag="nz"/></ComboBox>

Please note the ‘SelectedValuePath’ is being set to ‘Tag’, otherwise it would grab the ‘comboboxitem’ or ‘content’ like this:

var comboboxContent = ((ComboBoxItem)cbCountry.SelectedValue).Content;

With the value path set to tag, it will grab ‘au’ or ‘nz’ as selected value.

This is the constructor of the xaml page containing my settings.

var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

this.InitializeComponent();

if (localSettings.Values.ContainsKey("country"))
{
    cbCountry.SelectedValue = localSettings.Values["country"];
}

and this is the code for the selectionchanged event of the combobox.

private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
    var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
    localSettings.Values["country"] = cbCountry.SelectedValue;
}

Good luck with this small code sample. If this is not what you are looking for, please check the links mentioned at the start. I strongly believe that they take you to the code that you are looking for (if the code above is insufficient)

iPhone 6 versus Lumia 830 or S5

$
0
0

Apple’s keynote was yesterday and revealed the iPhone 6, iPhone 6 plus, Apple watch and Apple pay. (Note: no iPay and iWatch) But I was a bit disappointed about the iPhone 6. It is not that high end as you would expect for the price that they charge. I know that in the USA about 30% of the people have an iPhone, but in the rest of the world it is about 10% market share. iOs is at this moment the number two mobile operating system and in Italy is it nr 3. Please do not get me wrong, I really like apple products and the fact that they make a lot of not technical people think about options. Before Apple was popular in the Netherlands everybody just went with Windows and did not consider other options (mac, bsd, linux etc.) So let’s just compare the iPhone 6 with the Lumia 830:

iPhone 6Lumia 830
iOs 8Windows Phone 8.1 with Denim update
4.7 inch5 inch
4g lte4g lte
1334 x 7501280 x 720
8mp10mp
f2.2f2.2
no ois
Optical image stabilization
1.2mp front cam0.9 mp front cam
no wireless chargingwireless charging
fingerprint readerno fingerprint reader
nfcnfc
16 gb16 gb
no expansionmicro sd
799 usd426 usd

A few questions you have to ask yourself

There are a few questions you have to ask yourself when you are spending at least 800 dollar.

A 64gb micro sd is available for about 26 euro and 128gb is 88 euro. Retail price that is. How much would Apple pay for the extra storage? Is it worth 100 dollar to double the storage?

The camera of the iPhone 6 or iPhone 6 plus is only 8mp. The plus has optical image stabilization, but the regular iPhone 6 has not.



If you do not want Windows Phone, you can Also consider Android (of course) 4.4 with the Samsung Galaxy S5. It has a fingerprint reader, can have wireless charging with an extra cover. has a 16mp camera and you can expend the storage with micro SD. It is (in the Netherlands) available from 450 euro. Which is almost half the price of an iPhone 6 (800 dollar minimum).

As I said before, I really like Apple products, but I believe that Apple has out priced themselves. I would have expected more hardware or lower prices or a combination of both. What do you think dear reader? Don’t compare the CPU and RAM, because that is tied to how a mobile operating system manages it and can only be “measured” by a lagging interface, which is not the case at either iPhone6, Nokia and Samsung models mentioned above. The iPhone 6 was just announced yesterday, so I do not have hands on experience and if I have missed a thing or two, let me know!

Remote debugging Visual Studio 2013

$
0
0

The first step is of course install the remote debugging tools on the debug host http://msdn.microsoft.com/en-us/library/bt727f1t.aspx#BKMK_Installing_the_Remote_Tools 

When I fire up the Visual Studio Remote Debugging Monitor (latest version 12.0.30501.0), it says that it is already running on port 4018 so I have selected a different port. I selected 4019 and went to the “Tools” menu and then “Options (Ctrl + o) I have selected 'No authentication' and check 'allow any user to debug'. 

All there is left to do, is press play on the Visual studio side and make sure that you have the same port and no-auth set.

The other option is not to go to options but go to permissions (Ctrl + p) and add my Live ID/ Microsoft account from my developing machine, but that takes more clicks and my debugging device also forgets these settings. So you have to set it at every launch. Since I am also the admin of this tiny LAN, there is no security risk here and I can go with option 1.

screenshot taken from the interwebz

I am able to remotely debug, it's just that I have to setup the debugging every time on the client side (Lenovo Miix 2 8" tablet running win8.1) The development side does not need to be reconfigured every time.

After spending some time on google/bing/duckduckgo I have found http://msdn.microsoft.com/en-us/library/bt727f1t%28v=vs.71%29.aspx which gives me details about launching the remote debugging monitor from the command line and give it some parameters.

I ended up with a small .bat file having these command line options:

`msvcmon -anyuser -noauth -port=4019`

Here is a good read with more info about remote debugger settings:
http://social.msdn.microsoft.com/Forums/vstudio/en-US/174c2039-b316-455a-800e-18c0d93b74bc/visual-studio-2010-remote-debugger-settings-dont-persist?forum=vsdebug

Good luck debugging!


SQL to JSON fast and clean C#

$
0
0

Microsoft SQL Server has the ability to format the query output to xml, which is great. I used version “Microsoft SQL Server 2008 (SP3) - 10.0.5500.0 (X64)” to output XML to have a nested data structure, but there is unfortunately no first citizen support for JSON which is big on the web these days. Perhaps it is left out on purpose to make sure that people are unable to direct output their data as JSON and are forced to build a layer in between so that it can also authenticate and add security to a request. Web API is great for this. But back to the subject: I wanted to output my nested data as JSON really quickly with the minimum amount of code.

In a nutshell, I got the data as xml and converted that to JSON and send it to the output of a generic handler (*.ashx)

Here is my source code for my easy SQL2JSON solution:

private XDocument GetProducts(string q)
{
    SqlCommand comProd = new SqlCommand(@"SELECT ProductCode, ProductEan13, CategoryName FROM PRODUCTS 
        inner join CATEGORIES on products.CategoryID = CATEGORIES.CategoryID
        WHERE ((FactoryCode LIKE @name) OR (ProductCode LIKE @name)) AND (ProductDeleted = 0) for xml raw ('Product'), ROOT ('Products');");
    comProd.Parameters.AddWithValue("name", q + "%");
    string xml = SsDb.GetScalar(comProd).ToString();
    return XDocument.Parse(xml);
}

This gave me an `XDocument` object which I still have to convert to JSON

Since I was using an generic handler I retrieved the search parameter from the query string and used it as input parameter for the `GetProducts` method.

public void ProcessRequest(HttpContext context)
{
    context.Response.ContentType = "application/json";
    context.Response.Cache.SetCacheability(HttpCacheability.Public);
    context.Response.Cache.SetExpires(DateTime.Now.AddDays(1));
    context.Response.Cache.SetMaxAge(new TimeSpan(24, 0, 0));

    string q = context.Request.QueryString.Get("q");
    context.Response.Write(JsonConvert.SerializeXNode(GetProducts(q)));
}

So the most important line is the last one:

context.Response.Write(JsonConvert.SerializeXNode(GetProducts(q)));

Do not forget to use the one-nuget-package-that-rules-them-all (Install-Package Newtonsoft.Json )

using Newtonsoft.Json;

 

Now you can access your JSON data source with the C# generic handler from your JavaScript

yourHandler.ashx?q=yourproductcode

I hope this has been of any help. good luck!

Nuget DocX tabledesign enum

$
0
0

There are various options to build a word document in your C# code, I choose the lightweight docx nuget package. There are some really good examples on the Codeplex website of docx http://docx.codeplex.com/ if you look at the “Advanced Examples”

The thing is that Office products tend to localize variables such as table designs:

image

I am dutch, but I cannot translate it to a value of the enum `TableDesign`

If I would translate it, it would be something like listtable 7 colorful accent 6. It is still (even after this test file) not a valid entry of the table design enumeration.

using (DocX document = DocX.Create("C:/Temp/tables.docx"))
{
    foreach (TableDesign td in (TableDesign[])Enum.GetValues(typeof(TableDesign)))
    {
        Table aTable = document.InsertTable(5, 5); // because office preview is also 5 x 5
        aTable.Design = td;
        aTable.Rows[0].Cells[0].Paragraphs.First().Append(td.ToString());
    }
    document.Save();
}

 

The “source” (all 6 lines of code, lol) is available on github https://github.com/jphellemons/DocxTables but perhaps more important is the output file. This might save you some time. https://github.com/jphellemons/DocxTables/raw/master/tables.docx

 

Good luck with this small, but awesome nuget package!

Compare ad-networks for Windows Phone

$
0
0

I have developed several small apps for Windows Phone. Most of the time it is just to test how publishing an app works. I have developed an app for wp7, wp8.0, wp8.1 and universal apps and they are all free in the windows (phone) store. I try to earn back my developer fee of 19 euro by adding some small ads to it. I have used the adrotator version 1 and version 2 plugin and Microsoft's  own admediator.

You can download that visual studio extension of the visualstudio gallery website.

and you can read how to use admediator on msdn.

my three ad networks are:

  • mobfox
  • smaato
  • pubcenter

My conclusion: pubcenter has the best revenue and smaato serves the most ads. Please let me know if you disagree or have some advice. You can download my excel report here.

 

p.s. here is a 27 minute video of the admediator control on channel 9.

p.p.s. more info on the windows blog http://blogs.windows.com/buildingapps/2014/11/07/how-to-maximize-the-impact-of-windows-ad-mediation-for-windows-phone/

Skip dualboot menu Windows 8

$
0
0

Hyper-V disables the fastboot option. One of the main advantages of the surface pro is having the fastboot option, which disappears after having hyper-v enabled. Hyper-V is enabled if you install the windows phone dev tools and if you want to run vhd files. Hanselman made a blogpost about adding an extra bootoption to switch between with and without hyper-v

 

But after installing the january firmware update, it gave me the blue screen with both boot entries, each time I boot.

This can be disabled in Windows. Press the windows key + pause/break and go to the ‘advanced system settings’. in tab ‘advanced’ click the button ‘settings’ next to “boot- and recoverysettings”

image

remove the checkbox to disable the list of operating systems and hit ok and that’s it. Enjoy the speed of the fastboot with the surface pro 3.

SqlCommands in a transaction

$
0
0

Lazy productive I as a developer am, I did not want to write a stored procedure. So I ended up with a lot of SQL statements which needed to be combined and executed only if the previous one succeeds.

However there was a timeout during the execution. It was strange because when I copy pasted the SQL statement in SMSS it worked perfectly and fast too. My mistake was to use a new SqlCommand object which was not part of the transaction. I needed to re-use the same sqlcommand. Here is some working code:

using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["myConString"].ToString()))
{
    con.Open();

    SqlCommand cmd = con.CreateCommand();
    SqlTransaction transaction = con.BeginTransaction();

    cmd.Connection = con;
    cmd.Transaction = transaction;

    try{
    
        cmd.CommandText = "SELECT productcode FROM products WHERE productid = " + productid;
        string code = cmd.ExecuteScalar().ToString();
    
        cmd.CommandText = "SELECT ProductID, ProductWeight, ProductEuroPrice, OrderID FROM ORDERPICKINGPRODUCTS WHERE orderid = " + orderid + " AND productid = " + productid;
        SqlDataReader sdr = cmd.ExecuteReader();
        DataTable dt = new DataTable();
        dt.Load(sdr);
    
        cmd.CommandText = "DELETE FROM ORDERPICKINGPRODUCTS WHERE orderid = " + orderid + " AND productid = " + productid;
        cmd.ExecuteNonQuery();
        transaction.Commit();
    }
    catch(Exception e)
    {
        transaction.Rollback();
    }
}
I know that it is better to use parameters https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.parameters%28v=vs.110%29.aspx

And the AddWithValue method… But this is just pseudo code and not in production. So don’t worry!

This is just a small sample to help people with a strange timeout which you can encounter if you use an sqlcommand outside the transaction.

 

Good luck!

Surface 3 vs. Surface pro 3 vs iPad air 2 costs (in the Netherlands)

$
0
0

Surface 3 vs Surface Pro 3 costs

As a proud Surface Pro 3 user, I would like to point out why the Surface 3 (not pro) won’t make it in the Netherlands. There has been a dutch review on tweakers.net http://tweakers.net/reviews/4001/microsoft-surface-3-review-degelijke-tablet-met-een-hoge-prijs.html and they gave the device a 6 (on a scale from 1 to 10) and after over 300 comments, they changed it to a 7.

The Surface 3 is 499 in the USA. In the Netherlands, that is 599 euros inc VAT (btw) a typecover is 149 and a pen is also 49. That makes a total of 797 euro. It is 609 euro at the microsoft store (without pen and cover)

So 797 for 64gb entry level surface 3 and 729 + 149 + 49 = 927 for the 128gb variant.

The 64 gb variant has 2gb while the surface pro has an i3 and 4gb ram for 738 euro ex cover (867 inc cover and pen) that is a 70 euro difference.

When you compare the 128gb model: the pro has an i5 for 949 + 129 (cover) = 1078 euro vs the non-pro: 927 makes a 151 euro difference for an i5 cpu and both having 4gb ram.

 

iPad Air 2 costs

the 64gb version is 539 euro

the 128gb version is 664 euro

The keyboards from Logitech are around 90 euro and there is no real pen/stylus option. so the 64gb will be 629 inc cover and the 128gb will be 754 euro. compared to the surface 3, people will buy Apple products even though they cannot really multitask or use a pen/stylus.

 

Conclusion

I think that the Dutch consumer won’t buy the awesome device just because of the price difference and the current Apple hype. If the price drops, I would really recommend this device to people. Definitely because the upcoming release of Windows 10 and the free upgrade. I will stay a happy and proud Surface Pro 3 user and would not switch for a million. I hope this helps people make a decision purely based on prices. Would be great to see a surface 3 price drop in the Netherlands. That would change everything.


When you forget to set a column to auto increment in SQL Server

$
0
0

If you add a new table and mark the ID column as primary key, but you forgot to set the int or bigint to auto increment, you can not fix this in the SQL Management Studio.

image

There are several ways to do this, I ended up removing the primary key, dropping the column and re-creating it.

Dropping the column also gave me the error about dropping the whole table and re-creating it. So I had to do this with some SQL, so no GUI today but just these two small SQL statements. I hope it helps, otherwise it is just an online backup for when I forget how I fixed this.

alter table YOURTABLENAME add YOURCOLUMNNAME bigint IDENTITY(1,1) primary key
alter table YOURTABLENAME drop column YOURCOLUMNNAME 

Good luck!

 

ps. when you use select @@version you get to see what version of SQL server you are using. I had

Microsoft SQL Server 2008 (SP3) - 10.0.5520.0 (X64)
    Jul 11 2014 16:11:50
    Copyright (c) 1988-2008 Microsoft Corporation
    Standard Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (VM)
This blogpost http://sqlserverbuilds.blogspot.nl/ has a nice list of different versions.


iPad pro thoughts

$
0
0

Yesterday 9 September 2015 a three year old comic became reality:

Jun 19, 2012 source http://hijinksensue.com/comic/surface-tension/ 

Hey, did you hear Microsoft made an iPad? Yeah, you can Google stuff on it with Bing.

Apple released the Ipad Pro. It is a larger screen similar to the surface dimensions and a keyboard in the cover like the surface and has pen input like the surface.

26 oktober 2012 Microsoft released the Surface RT. A tablet with pen input, keyboard cover etc. The OS is not the full Windows version (just like the iPad pro now)

The pro edition of the surface did have a full version.

This is not the first time that apple claims to have a new product. Back in 2000 Bill Gates had a Lenovo tablet with monochrome screen:

Bill Gates tablet 2000

two years later he had a Fujitsu tablet with a color screen and Windows XP (2002)

Bill Gates tablet 2002

Besides tablets, there were mobile devices. PDA’s running Windows Mobile The predecessor of Windows Phone as we know it today.

Pocket pc started around 2000 and became Windows Mobile in 2002. I have had devices with applications to send mail and browse the web. run games etc. before the launch of the first generation of iPhones.

Steve Jobs said back in 2007 when they released the very first iPhone:

“Who wants a stylus? You have to get em', put em' away. You lose them. Yuck.”

&ldquo;Who wants a stylus?&rdquo;

But back on topic: the iPad pro is less than I expected. I expected it to run full mac OS X el captain. But the OS is not optimized for touch input. So it seems that Apple will run iOs and OS X side by side for a few more years. Microsoft made the step when moved from Windows Phone 7 to 8 to run everything on the same kernel. It is a hard step. A lot of people fell over it. But it was necessary and really inevitable. But today all (or almost all) Windows Phone 8.x devices will have the Windows 10 update and will run the same apps on their phone as on their laptop/desktop as on their Xbox. This whole concept will be copied by Apple in a year or two maybe three and will be sold like they invented it.

Please do not get me wrong, I like Apple and like their design, usability and the way that the hardware is sold together with the software. The way they update their mobile devices. I like that more then Androids by the way. But the thing that I dislike is that their marketing is so good that less tech aware people believe that Apple invented the wheel and those people share their view with even more tech aware people who assume they are right. But when the Apple fans encounter someone with more technical knowledge they often avoid a discussion.

Let me know your point of view in the comments below.

Calculate km distance between two latitude longitude points from two floats

$
0
0

latlngHaving a store locator on my to do list, I started months back with storing the latitude and longitude for the stores in a database. I forked this repository in 2012 https://github.com/bjorn2404/jQuery-Store-Locator-Plugin in order to have something like a store locator on our website. The downside to that store locator is that it is all client side and puts a copy of all your customer data on the internet. It is great data for your competition. So to disclose as little as possible and still serve your valued customers, I decided to do the calculation on the backend. Closest to the data. So that would be on the SQL server.

SQL Server has datatypes like points and geometry since 2008. With this SQL statement you can get the distance between my location

lat 51.69917 lng 5.30417 and the locations in the stores table.
SELECT top 10 StoreID
      ,StoreName
      ,StoreLatitude
      ,StoreLongitude
      ,StoreCity
      ,round((geography::Point(StoreLatitude, StoreLongitude, 4326).STDistance(geography::Point(51.69917, 5.30417, 4326))) / 1000, 1) as km
FROM STORES
  where StoreLongitude < 150 and StoreLongitude > -150 and StoreLatitude < 90 and StoreLatitude > -90
order by (geography::Point(StoreLatitude, StoreLongitude, 4326).STDistance(geography::Point(51.69917, 5.30417, 4326)))

The third parameter for the point data type is 4326 which is an enumeration:

And about 4326 SRID. It also called WSG84(http://en.wikipedia.org/wiki/World_Geodetic_System) system. It's the most common system to represent point on spherical(not flat) earth. It uses degree,minute,second notation and it's x and y coordinates are usually called latitude and longitude.

source http://stackoverflow.com/a/405256/169714

SRID (Spatial Reference System Identifier) : https://en.wikipedia.org/wiki/SRID

This post is more of a reference for me to lookup how to calculate distances on the Microsoft SQL server in SQL. But maybe it helps others too.

Good luck!

Manage users for webform auth missing option in Visual Studio

$
0
0

I have blogged about this in November 2013 which is almost 2 years ago.

run as admin (windows key + X) command prompt as admin

C:\Program Files (x86)\IIS Express\iisexpress.exe" /path:C:\Windows\Microsoft.NET\Framework\v4.0.30319\ASP.NETWebAdminFiles /vpath:"/webadmin" /port:12345 /clr:4.0 /ntlm

http://localhost:12345/webadmin/default.aspx?applicationPhysicalPath=C:\Path\to\your\webformcode\&applicationUrl=/

and then there was this stacktrace and error… I have not had this issue before. It was since the 4.6 framework was installed.

Thankfully I found this stackoverflow answer which resolves it:

open "C:\Windows\Microsoft.NET\Framework\v4.0.30319\ASP.NETWebAdminFiles\App_Code\WebAdminPage.cs"

in notepad++ and ctrl+g (go to) line 989 and give the string appId the value of “1” instead of the stringutil.blabla

save and reload the page.

No more error on:

StringUtil.GetNonRandomizedHashCode(String.Concat(appPath, appPhysPath)).ToString("x", CultureInfo.InvariantCulture);

Good luck!

Macbook air 13” 4mot/4/40000002: exhaust-0

$
0
0

Well the title is clear right? I ran the Apple Hardware Test (AHT) because our model was from 2012.

  • Switched off the macbook
  • power on macbook
  • press and hold ‘D’

I ran the extended and more advance test which takes a bit longer. But it gave me the message:

4mot/4/40000002: exhaust-0

it said that the fan was broken. It was exactly what I expected due to the noise of the fan.

Our model was an A1466 and the fan replacement would cost me 145 euro at an Apple care center, so I bought the part online for 26 euro.

Here is the step by step ifixit guide. Please note that you need a P5 pentalobe screwdriver which is Apple specific. I bought it online for 5 euro.

I have spend 38 euro inc shippingcosts. You can get the screwdriver really cheap from aliexpress, but the shipping takes a long time and I cannot live that long without my macbook. Same for the fan it seems. You can get both for 9 dollar without shipping costs but it will take a while to arrive.

 

WP_20151231_17_23_03_Pro_LI

On the left is the new one, right side is the old one.

The hardest part was opening the zif connector to reattach the data kabel for the new fan.

 

WP_20151231_17_35_05_Pro_LI

WP_20151231_17_35_05_Pro_LI

The zif connector is so small that it is hard to open.

Running the hardware diagnostics tool can confirm that replacing the fan is a succes. You will not get the 4mot/4/40000002 exhaust error again.

Good luck with the fan replacement!

Nuget DocX tabledesign enum

$
0
0

There are various options to build a word document in your C# code, I choose the lightweight docx nuget package. There are some really good examples on the Codeplex website of docx http://docx.codeplex.com/ if you look at the “Advanced Examples”

The thing is that Office products tend to localize variables such as table designs:

image

I am dutch, but I cannot translate it to a value of the enum `TableDesign`

If I would translate it, it would be something like listtable 7 colorful accent 6. It is still (even after this test file) not a valid entry of the table design enumeration.

using (DocX document = DocX.Create("C:/Temp/tables.docx"))
{
    foreach (TableDesign td in (TableDesign[])Enum.GetValues(typeof(TableDesign)))
    {
        Table aTable = document.InsertTable(5, 5); // because office preview is also 5 x 5
        aTable.Design = td;
        aTable.Rows[0].Cells[0].Paragraphs.First().Append(td.ToString());
    }
    document.Save();
}

 

The “source” (all 6 lines of code, lol) is available on github https://github.com/jphellemons/DocxTables but perhaps more important is the output file. This might save you some time. https://github.com/jphellemons/DocxTables/raw/master/tables.docx

 

Good luck with this small, but awesome nuget package!

Viewing all 132 articles
Browse latest View live