Planet FoxPro

January 29, 2015

www.atoutfox.org - Contributions

Export un curseur / table au format docx

Il ne faut pas MSOffice, OpenOffice ou LibreOffice
1 Un procédure (copytodocx.prg) de l'exportation d'un curseur /table au format docx (comme COPY TO XLS)
Le forfait comprend un démo testdocx.prg

2 Une classe exportdocx de l'exportation d'un curseur / table au format docx
Seulement une propriété doit définir, la propriété «grid» (référence à la grille / nom de la table)

Facultatif on peut définir d'autres propriétés (voir exportdocx_fr.txt)
Cette propriétés, comme la police, gras, italique, des en-têtes et des lignes, sont accessible par clic droit

L'archive contient:
- Exportdocx.txt (explications en anglais)
- Exportdocx_fr.txt (explications en français)
- Export.pjx (le projet de démonstration)
- Exportdocx.vcx (la bibliothèque de classes)
- Exportdocx.scx (démo form)

by Vilhelm-Ion Praisach at January 29, 2015 06:07 AM

Alex Feldstein

Sandstorm's Blog (Home of ssClasses)

TitleBarX Class

Note:  Sorry about the earlier link. It appears the rar is broken (I did not check).  Here now is the latest link:

https://dl.dropboxusercontent.com/u/15025358/titlebarx_free.rar

Here is the latest among my toys which is part of ssUltimate class.  This new TitleBar class is very unique against what is already around the web




What makes this unique?

Well for one, I can say this is unique in the sense that this allows users to change color of the titlebar class on-the-ply, and retain it.

It allows two captions, One Main and one sub

It has a built-in unique dropdown color picker

The control box is a series of shapes so it is cleaner

Embedded a cool looking mouse pointer inside


This is my first release of this class.  I will add some more features in the future

Especial thanks to Cesar Chalom for the function to convert colors he posted on Weblogs which allows me to calculate the shades I want for lower shape, border and controlbox:  http://weblogs.foxite.com/vfpimaging/2006/11/27/function-to-convert-colors/

Especial thanks to Cesar Chalom and Cetin Basoz for the color picking sample:  http://weblogs.foxite.com/vfpimaging/2008/01/17/a-great-color-picker/


How to use this class


  • Drop into your form
  • Change MainCaption property.  If you leave it blank, it will pick-up the caption of the form
  • Add a sub-caption (optional)
  • You can toggle showing Clock ON and OFF via NoClock property (default is .F.)
  • You can toggle The glow effect on Captions into ON and OFF via NoGlow property (default is .F.)
  • You can make it look flat via the FlatLook property (default is .F.)
  • When Dropdown Picker is open, these are the actions you can do:
    • Move around the mouse pointer on the palette to pick a color.  Those will be reflected back on the class itself (titlebar, controlbox, border, shade)
    • Click on a color to stop picking.  Click again to resume picking
    • Change shade of selected color via the spinner object
    • Click outside to finalize and hide the palette form
  • Allowed developer to use the class BackColor to change color of other objects on the form on the ply as well.  Later I will add the capability to control shades of those.

I did enjoyed working on this these last few days causing me to temporarily abandon enhancements on xBox class and I hope you will find this not only useful but enjoyable as well.  Cheers!

by Jun Tangunan (noreply@blogger.com) at January 29, 2015 01:58 AM

January 28, 2015

Alex Feldstein

January 27, 2015

Alex Feldstein

January 26, 2015

Alex Feldstein

January 25, 2015

Alex Feldstein

January 24, 2015

Alex Feldstein

January 23, 2015

Alex Feldstein

January 22, 2015

Alex Feldstein

FoxCentral News

Using Cordova and Visual Studio to build iOS Mobile Apps

 Apache Cordova provides the ability to create hybrid mobile applications using HTML, CSS and JavaScript and Microsoft recently released a preview of Cordova tools integrated into Visual Studio that allow building, running and debugging of Cordova apps right from within Visaual Studio including remote debugging support for iOS (which is fantastic). In this article Rick takes a look how to use these tools to specifically convert an AlbumViewer Web application to run natively on an iOS device as a local, self-contained app.

by West Wind Technologies at January 22, 2015 12:06 AM

January 21, 2015

Rahul Desai's Blog

Windows 10: An Exciting New Chapter

Today we shared new Windows 10 experiences and talked about how Windows 10 will inspire new scenarios across the broadest range of devices – from big screens to small screens to no screens at all. And made additions to the Windows 10 device family that, while exciting for all users, enable some amazing scenarios for businesses. We also outlined a clear vision, for a new era of more personal computing, for everyone – from consumers to IT professionals and business users – to know and love Windows 10.

Windows 10: An Exciting New Chapter

by Rahul Desai at January 21, 2015 09:07 PM

Alex Feldstein

January 20, 2015

The Problem Solver

Data Storage Maturity Model

There are many ways of storing data when developing applications, some more mature and capable than others. Storing data of some sort or another in an application is common. Extremely common to be exact as almost every application out there needs to store data is some way or another. After all even a game usually stores the users achievements.

But it’s not games I am interested in. Sure they are interesting to develop and play but most developers I know are busy developing line of business (LOB) applications of some sort or another. One thing line of business application have in common is they work with and usually store data of some sort.

Data Storage Maturity Model

When looking at data oriented applications we can categorize data storage architectures based on different characteristics and capabilities.

 

Level 0: Data Dumps

The most basic way of working with data is just dumping whatever the users works with in the UI to some proprietary data file. This typically means we are working with really simple Create Read Update Delete (CRUD) type of data entry forms and not even storing the data in a structured way. This is extremely limited in capabilities and should generally be avoided at all costs. Any time you have to work with a slightly larger data set or update the structure you are in for a world of hurt.

 

Level 1: Structured Storage

At level 1 we are still working with CRUD style data entry forms but at least we have started using a formal database of some sorts. The database can be a relational database like SQL Server or MySQL but a NoSQL database like MongoDB is equally valid. While data database used allows us to do much more the user interface is not much better. We are still loading complete objects and storing them in a CRUD fashion. This might work reasonably well in a low usage scenario with a low change of conflicts but is really not suitable for anything more complex than a basic business application. We are only storing the current state of the data and as the database stores whatever is send from the UI, or business processing code, there is no sense of meaning to any change made.

 

Level 2: Command Query Responsibility Segregation

When we need to develop better and more complex business applications we really should use Command Query Responsibility Segregation (CQRS) as minimum. In this case we separate the read actions from the write actions. We no longer just send an object to be stored from the user interface to the back end but we are sending commands to update the data. These commands should be related to business actions the application works with. So in other words if a business analyst sees the command names he should be able to make sense of what they do without looking at the code implementations.

While this is a lot better we are still only storing the current state of the data. And that is the problem as it can be very hard to figure out how something got to be in a given state. So if a users detects that something is wrong with the data and suspects a bug in the program we might just have a hard time figuring out how it got to be that way. And once we do fixing the issue might be extremely hard as well.

There are other limitations with just storing the current state like not being able to produce reports, or only at great difficulty, the ask for. Or possibly alter business rules after the fact. And if you think that doesn’t happen just try working on a large government project where the slowness of the decision process means that rules are only definitely updated after the fact.

 

Level 3: Event Sourcing

The most advanced level to be working at is using Event Sourcing (ES). An events sourced application resembles a CQRS style application in a lot of ways except for one vital part. With an Event Sourced application we are no longer storing the current state of the data but we are storing all events that lead up to this. All these events are stored as one big steam of changes and are used to deduce the current state of the data in the application. These events typically never change once written, after all we don’t change history (although our view of it might change over time). This has some large benefits as we can now track exactly how the state came to be as it is making it easier to find bugs. And if the bug is in how we used those business events that we can fix the bug and often that is enough to deduce the correct state.

The usual queries done in an application are much harder on an event stream. In order to fix that issue the events are usually projected out to a read model making querying much easier. This read model it normally stored in some appropriate database like SQL Server or a NoSQL database but could also just be kept in memory. However the event stream is the true source of the truth and not the projections as these are just a derived result. This means we can delete all projections and completely rebuild them from the existing events resulting in much more flexibility. Need to do an expensive query in version two of an application? Well just create a projection designed for that purpose and rebuild it from all previously stored events. This is similar to our view of history changing.

There are some more benefits from storing events instead of just the current state. We can now do temporal queries, or queries over time, on how the data got to be how it is. These kind of queries have lot of goals like for example fraud detection. Another possibility is displaying the state at any previous point in time and running reports or analysis on the data as it was then.

 

Conclusion

It’s kind of hard to say at what level you should be working. Level 0, limited as it is might be appropriate for your application. Lots of applications are at level 1 and just basic forms over data CRUD applications. In some that might be appropriate but in a lot of cases that is actually sub optimal. Level 2 with CQRS is a pretty sweet place to be. You can capture the business intent with command and have a reasonable flexibility. At level 3 with event sourcing you gain a lot of flexibility and strength. If you are doing a more complex business application you should be working on this level. But as always there is no free lunch so don’t go there is the application is really not that complex :-)

 

Enjoy!

by Maurice de Beijer at January 20, 2015 08:28 PM

CULLY Technologies, LLC

Visual Foxpro at #29 on Tiobe Index

Tiobe must have updated their algorithm somehow. Visual Foxpro launches itself back up to the 29th most popular language. I’m not sure I can explain it. And yet, there it is in the January 2015 list.

tiobe_visual_foxpro

Previously, I had posted that Visual Foxpro was #50 back in November of 2014.

by kcully at January 20, 2015 01:42 PM

Alex Feldstein

Photo of the Day


Fontainebleau Hotel - Miami Beach
shot from a Super Cub at 500 ft altitude over the water.

by Alex Feldstein (noreply@blogger.com) at January 20, 2015 10:36 AM

January 19, 2015

Alex Feldstein

January 18, 2015

Alex Feldstein

January 17, 2015

Alex Feldstein

January 16, 2015

Alex Feldstein

Sandstorm's Blog (Home of ssClasses)

Tick/Untick a checkbox on Grid with AllowCellSelection = .F.

Normally, when we want to put a checkbox on grid for the purpose of ticking and unticking it, then most probably most of you do it this way:



  • Set AllowCellSelection = .T.
  • Drill to every textbox object inside each columns and put under When method Return(.f.).  That is to prohibit the cell in getting focus


An alternative way is to set AllowCellSelection = .F. and use grid's double-click on toggling the value of the logical field bound to that checkbox, then perform a grid refresh



While any of the two will work, I will be showing here an alternative to that where the Grid's AllowCellSelection will still be set to .F. disallowing individual objects inside to receive a focus yet will allow you to click on the checkbox as if the checkbox can really be selected.

The trick is really simple.  Here are the codes:

Local oForm
oForm=Newobject("Form1")
oForm.Show
Read Events
Return

Define Class Form1 As Form
      Height = 460
      Width = 500
      AutoCenter = .T.
      Caption = 'Ticking Checkbox on Grid with AllowSelection = .F.'
      ShowTips = .T.

      Add Object grid1 As Grid With ;
            GridLines = 0, ;
            Height = 400, ;
            Left = 10, ;
            Top = 50, ;
            Width = 490,;
            GridLines = 3,;
            DeleteMark = .F.,;
            ScrollBars = 2,;
            ColumnCount = 3,;
            AllowCellSelection = .F.


      Add Object label2 As Label With ;
            top = 10,;
            left = 15,;
            Height = 36,;
            caption = 'This is a simple trick on allowing the checkbox object to be ticked even though '+;
            "the grid's AllowCellSelection is set to .F.  The trick is on MouseDown",;
            WordWrap = .T.,;
            Width = 570

      Procedure Load
            Close Databases All
            Select .F. As xSelect, cust_id, company From (Home(2)+"data\customer") Into Cursor junk Readwrite
      Endproc

      Procedure grid1.Init
      With This
            .RecordSourceType = 1
            .RecordSource = 'junk'
            .Column3.Width = 360
            With .Column1
                  .AddObject("check1","checkbox")
                  .CurrentControl = "check1"
                  .Sparse = .F.
                  .check1.Caption = ''
                  .check1.Visible = .T.
                  .check1.BackStyle=0
                  .Width = 20
            Endwith
            .SetAll('DynamicBackColor','IIF(xSelect,RGB(128,255,0),RGB(220,228,211))','Column')

      Endwith
      Endproc

      Procedure grid1.MouseDown
      Lparameters nButton, nShift, nXCoord, nYCoord
      Local lnWhere, lnRelRow, lnRelCol
      This.GridHitTest(m.nXCoord,m.nYCoord,@lnWhere,@lnRelRow,@lnRelCol)
      If m.lnRelCol = 1
            Replace xSelect With !xSelect In junk
            This.Refresh
      Endif
      Endproc

      Procedure Destroy
            Clear Events
      Endproc

Enddefine


Said trick will give the grid an illusion that there are two groups, i.e., 1st is the checkbox and the 2nd is the rest of the columns.  And for those new with Grid Dynamic Properties as well, just to highlight the selected (ticked) records, I use DynamicBackColor here.

Hope you'll find this useful! Cheers!

by Jun Tangunan (noreply@blogger.com) at January 16, 2015 04:18 AM

January 15, 2015

Rick Strahl's Web Log

Blend Path interfering with C# Project Builds

Yesterday I ran into a nasty bug in Visual Studio that caused a compiler error in a Web project. It appears that Visual Studio looks in a completely unrelated path and pulls in an assembly that overrides the project assembly reference. Specifically it’s related to accessing a Type from JSON.NET directly in code, but this might manifest with other types that exist in the external path as well.

Here’s what the error looks like in my project at build time:

JsonNetError

Notice here I’m referencing an explicit type from JSON.NET – the Formatting Enum – and the compiler is complaining:

The type 'Newtonsoft.Json.Formatting' exists in both 'c:\projects2010\MyDailyDosha\packages\Newtonsoft.Json.6.0.7\lib\net45\Newtonsoft.Json.dll' and 'c:\Program Files (x86)\Microsoft Visual Studio 12.0\Blend\Newtonsoft.Json.dll'    C:\projects2010\MyDailyDosha\MyDailyDosha\Code\Controllers\QuizController.cs

So what the hell is the compiler doing pulling in references from the Blend directory when there’s an explicit reference in the project to the DLL?

Apparently this has been a problem for a while – there’s a connect issue for this problem:

Looks like a bug in Visual Studio 2013 that has been ongoing for a long time without a real resolution.

Rename the Path or DLL!

My guess is the problem is a bad path somewhere in the CSharp compiler’s command line. So a quick solution to this problem is to simply rename the directory or the offending DLL (Newtonsoft.Json.dll).

Since I don’t use Blend or WPF  this isn’t a problem but if you do, make sure you write a note somewhere so that you can remember to rename the folder back when you do need it.

Renaming the folder works for me and I can also still open Visual Studio. Not sure what happens when I open a WPF project that requires Blend, but not likely to happen for me anyway…

It remains a mystery how a Web project would be referencing the Blend folder. I checked the Visual Studio Command Line and it doesn’t have a path reference to this folder.

It’s a bit surprising that this issue has been around for so long and not been fixed. This is kind of a show stopper IF you happen to reference a library that’s in that particular folder.

© Rick Strahl, West Wind Technologies, 2005-2015
Posted in C#  .NET  

by Rick Strahl at January 15, 2015 11:57 AM

Alex Feldstein

FoxCentral News

January at Chicago FUDG - Doug Hennig

 January's presenter is Doug Hennig; he will speak on "The Latest Techniques in Deploying VFP Applications". "Deployment of your application is easily as important as the rest of the development cycle since it's the first encounter your users have with the application. This session looks at some new ideas for application deployment, including creating a workstation-only installer, installing your application on a server without requiring a workstation installation (zero footprint deployment), and how to update your applications over the Internet." Join us on Monday January 19 at 5:30 pm; please RSVP using the Eventbrite link on our home page: http://www.ChicagoFUDG.com.

by Chicago FoxPro Users and Developers Group at January 15, 2015 02:46 AM

VisualFoxProWiki

ChicagoFUDG

Editor comments: January 2015 meeting details
FUDG stands for FoxPro User / Developer Group. This one is based in Chicago, IL. Visit our web site at www.ChicagoFUDG.com !

Leaders:
Michael Hogan
Randy Bosma Speaker Agitator
Jeff Simon Treasurer jeff@datamarkcorp.com
Tom Corrigan Secretary (his FUDG e-mail: tom@corrigan.com)
Greg Gershuny gel4it [at} hotmail {dot] com

Bill Drew Past President bill.drew@sbcglobal.net

Monthly Meetings:
When: Chicago FUDG normally meets on the third Monday of each month, unless it collides with a major event. The meeting room is normally accessible at about 5:15 PM; presentation starts at shortly after our 'business chatter' and introductions at 5:30.
Where: 1871 at the Merchandise Mart suite 1212 (enter from Orleans on the west side of the building and take the west elevators to the 12th floor). When you arrive at the 1871 front desk (adjacent to the west elevator bank) ask to be directed to the FoxPro meeting in the IMSA classroom. Reasonable ($10) parking is available 1 block north of the Orleans Street (west) entrance of the Merchandise Mart.

January 15, 2015 02:19 AM

Craig Bailey

Taking a compliment

An interesting social experiment where a women decided she’d agree with compliments men gave her. The results are pretty interesting – summary:  she mostly got criticised, called vain, and even abused.

The issue is probably not a gender one (eg if the roles had been reversed and men had agreed when getting complimented, they’d likely have gotten similar pushback) but it does raise the question: what’s the appropriate response to give when someone compliments you.

It’s something most of us have probably struggled with: since it can be uncomfortable, and likely depends on the company you are with at the time, and perhaps even the culture you are in (eg Australian culture can be quite different to American culture).

Many people are uncomfortable and try to shrug it off (I’m probably in this category), whilst others will accept it gracefully  (I wish I could be comfortable in this category).

It’s worth having a read of some suggestions from etiquette experts including Dianne Gottsman, Margaret Page and  The Art of Manliness. Summary: just say ‘Thank you’

 

 

The post Taking a compliment appeared first on Craig Bailey.

by Craig Bailey at January 15, 2015 01:35 AM

FoxProWiki

UpcomingEvents

A place to list upcoming Visual FoxPro events like conferences, meetings, user groups, open training sessions...
Closest at the top please, and please remove past events.

January 15, 2015 01:15 AM

January 14, 2015

Craig Bailey

Exciting New Banking Experience

I’m pretty sure the words ‘exciting’ and ‘banking’ don’t belong together.

exciting-experience

The post Exciting New Banking Experience appeared first on Craig Bailey.

by Craig Bailey at January 14, 2015 06:50 AM

www.atoutfox.org - Contributions

Export un curseur / table au format xlsx

Il ne faut pas MSOffice, OpenOffice ou LibreOffice

1 Un procédure (copytoxlsx.prg) de l'exportation d'un curseur /table au format xlsx (comme COPY TO XLS)
Le forfait comprend un démo testxlsx.prg

2 Une classe exportxlsx de l'exportation d'un curseur /table au format xlsx
Seulement une propriété doit définir, la propriété «grid» (référence à la grille / nom de la table)

Facultatif on peut définir d'autres propriétés (voir exportpdf_fr.txt)
Cette propriétés, comme la police, gras, italique, des en-têtes et des lignes, sont accessible par clic droit

L'archive contient:
- Exportxlsx.txt (explications en anglais)
- Exportxlsx_fr.txt (explications en français)
- Export.pjx (le projet de démonstration)
- Exportxlsx.vcx (la bibliothèque de classes)
- Exportxlsx.scx (démo form)

by Vilhelm-Ion Praisach at January 14, 2015 06:07 AM

Alex Feldstein

January 13, 2015

CULLY Technologies, LLC

Comparing Ping Times: Vultr vs DigitalOcean

I’ve been testing deployment of a Xojo Web Application to two inexpensive (I won’t use the word ‘cheap’ because that might give the wrong impression. They both work very well.) hosted server options: Vultr.com and DigitalOcean.com.

I’ve been using DigitalOcean for a while to run some tests but I was curious to test Vultr as they have a server host in Atlanta, GA, USA which is close to where I live and work. The closest DigitalOcean location is in New York.

So, without further ado, here is the results of ping times:

Host: min avg max mdev
Vultr: 10.8 12.0 14.7 1.2 ms
DigitalOcean: 39.8 41.8 46.3 2.4 ms

That’s it for now. I may publish more extensive tests if I feel it necessary to perform them.

by kcully at January 13, 2015 08:03 PM

Alex Feldstein

Craig Bailey

Google Project Zero = Zero fucks given

Via BBC News:

Google’s Project Zero seeks to find bugs in popular software and then give the manufacturers responsible 90 days to fix the problem.

This bug, which affects Windows 8.1, was revealed by Google to Microsoft on 13 October 2014.

On 11 January, Google publicised the flaw. Microsoft said it had requested that Google wait until it released a patch on 13 January.

Read Chris Betz’ full post on Microsoft’s approach to vulnerability disclosure:

Microsoft has long believed coordinated disclosure is the right approach and minimizes risk to customers. We believe those who fully disclose a vulnerability before a fix is broadly available are doing a disservice to millions of people and the systems they depend upon.

Kinda hard not to agree with Microsoft on this one, and difficult to understand why Google stuck so rigorously to their 90 day mandate. But people are definitely divided on it.

UPDATE: And Google has done it again. And yet they refuse to fix their own bugs. Crazy.

The post Google Project Zero = Zero fucks given appeared first on Craig Bailey.

by Craig Bailey at January 13, 2015 06:06 AM

Terrorpolitical football

Oh the lols, as reported by the New York Times on a comment by UK Prime Minister David Cameron:

Mr. Cameron, who has started to campaign ahead of a national election in Britain in May, said his government, if elected, would ban encrypted online communication tools that could potentially be used by terrorists if the country’s intelligence agencies were not given increased access.

and

“Are we going to allow a means of communications which it simply isn’t possible to read?” Mr. Cameron said at an event on Monday, in reference to services like WhatsApp, Snapchat and other encrypted online applications. “My answer to that question is: ‘No, we must not.’ ”

Putting aside the technical absurdity of this (eg banning Snapchat and Apple iMessage, etc), my interest is why he’d even make a statement like this.

Since politicians are hard to like (barely above car salesmen), they do a lot of polling to understand what their constituents will vote for.
And given that his comments are part of his election campaigning I’m assuming they have been made strategically (ie polling is telling him this is something people want).

Which makes me wonder, who the hell is he talking to?

The post Terrorpolitical football appeared first on Craig Bailey.

by Craig Bailey at January 13, 2015 05:49 AM

January 12, 2015

Rick Strahl's Web Log

<main> HTML5 Tag not working in Internet Explorer 9/10/11

I was working on an my old Weblog code to tweak some of the markup a couple of days ago and ran into yet another issue with Internet Explorer: The HTML5 <main> element tag doesn’t appear to be working in any version of Internet Explorer. Now, this makes sense for versions prior to IE 9 since those versions had no support for HTML5 or ‘custom’ tags at all. But IE 9 and later do understand HTML5 elements like article, header, aside, nav etc. just fine, but for some reason the main tag is not working like the others. In fact it appears IE simply ignores the tag and treats it as if it wasn’t there.

For the most part IE 10 and 11 do a pretty good job with HTML5 that it’s rare that something doesn’t work, so a few days ago I posted my site without checking IE support (since this was such a minor change) and within 5 minutes I got a boat load of emails complaining that the site wasn’t working.

The <main> Tag in Internet Explorer

So when I recently updated my code on my blog recently to something like this:

<main class="post-content">
    <header>
        <h2>@Model.PostTitle</h2>
    </header>
    <article>
        @Html.Raw(Model.Content)
    </article>
</main>

everything worked fine in Chrome, FireFox and on my iPhone and Android phones. However, Internet Explorer – both on desktop and a Windows Phone – was completely mangled. In Internet Explorer – even IE 11 which supposedly is fully HTML5 compliant – I rudely found myself looking at the following mess:

IETrainwreck

The HTML was working fine with a <div> tag instead of the <main> tag previously. So the same page works perfectly fine with:

<div class="post-content">
    <header>
        <h2>@Model.PostTitle</h2>
    </header>
    <article>
        @Html.Raw(Model.Content)
    </article>
</div>

in Internet Explorer. What’s so odd about that is that IE has no problem with the header and article tags, but can’t handle the main tag.

Initially I wasn’t sure what caused this pile up to occur – it sure looks like what happens if you have an unclosed tag somewhere. But after some quick experimentation and switching the <main> tag back to a <div> tag I found that everything started working in IE. It was definitely the <main> tag that’s causing the problem.

The Quick Fix

I threw this IE shortcoming out on Twitter and promptly got a response from @aggeek:

TwitterHelp

So sure enough I added the following to my site wide CSS file:

main {
    display: block
}

and voila we’re back to a more sane site layout:

IeCorrect

It looks like IE treats the element as if it isn’t there or maybe treating it as an inline element. Looking in the IE dev tools I couldn’t find a computed value for the display style property which should mean that it defaults to display: block but that’s clearly not happening. Adding the display: block style explicitly fixed it. Honestly that would not have occurred to me on my own – as my inclination was to think the tag was essentially ignored.

The behavior is the same for any other ‘unknown’ tag in IE. If you replace main with foo you get the same behavior.

It’s probably a good idea to add the main { display: block; } to your Browser Reset stylesheet. In fact, it may be part of more modern Browser Resets, but in this case the reset I use is a a bit dated (as is the rest of the code on this site).

Ah yes, it’s quirks and inconsistencies like this that make most of us curse Internet Explorer. Why this one freaking inconsistency in HTML5 support?

Internet Explorer 8 and older

FWIW, HTML5 is not supported at all in IE 8 (which hopefully will start disappearing for good soon), but if you do plan on having IE 8 browser of which there are a still quite a few, accessing your site, you’ll need a shim to force IE8 to recognize the new HTML5 tags.

To make this work you can basically create a few fake elements in the DOM which effectively makes IE recognize HTML5 tags.

<script>
  document.createElement('header');
  document.createElement('section');
  document.createElement('main');
  document.createElement('article');
  document.createElement('aside');
  document.createElement('nav');
  document.createElement('footer');
</script>

A more common way to do this in a document is with a conditional script include in the HTML header of the document and referencing a script from CDN so that this script (and a few other polyfills) load only when the browser is actually IE 8 and lower:

<head runat="server"> <title></title> <!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]—>
</head>

Nothing new any of this, but it’s one of those quirks you can run into longer after you thought you had all the HTML5 stuff figured out in terms of browser support. But even now IE continues to throw a wrench into things here and there.

© Rick Strahl, West Wind Technologies, 2005-2015

by Rick Strahl at January 12, 2015 11:09 PM

Alex Feldstein

Sandstorm's Blog (Home of ssClasses)

ShellExecute, Force open file to non-default application

As most of us know, ShellExecute() is a very useful tool to open a file on its external associated application.  When you issue this command:

Local lcFile
lcFile = Getfile('doc,docx')
If !Empty(m.lcFile)
      ShellExecute(0,'open',m.lcFile,'','',1)
Endif

Then that document file will be opened by MsWord or its counterpart like say on LibreOffice

Or if you do:

Local lcFile
lcFile = Getfile('xls,xlsx')
If !Empty(m.lcFile)
      ShellExecute(0,'open',m.lcFile,'','',1)
Endif

Or even:

Local lcFile
lcFile = Getfile('csv')
If !Empty(m.lcFile)
      ShellExecute(0,'open',m.lcFile,'','',1)
Endif

Most probably, it will be opened using Excel or its counterpart; whatever is set in the registry to be the default application associated to a file.

It also allows us to execute commands on the OS Shell such as open a folder to a specific location, prints directly a file to printer, etc.

See this:  http://www.ml-consult.co.uk/foxst-26.htm

In this blog though, we will focus on opening a file on an external application, but opening it not on its default associated external program, but based on our own choice.   What we will do is somewhat similar to right-clicking a file, choosing OPEN WITH, and forcefully using another program to open such file.

Going back to the last example above, we can say open a .csv file using a notepad instead of its default Excel program.  Or a .prg that is associated with VFP, to be opened using notepad as well.

The trick, you'll be surprised is very easy.  Okay, here we go:


* Declare it
Declare Integer ShellExecute In shell32.dll ;
      INTEGER hndWin, ;
      STRING cAction, ;
      STRING cFileName, ;
      STRING cParams, ;
      STRING cDir, ;
      INTEGER nShowWin

* Open an csv forcefully using Notepad
Local lcFile
lcFile = Getfile('csv')
If !Empty(m.lcFile)
      ShellExecute(0,'open','notepad.exe',["]+m.lcFile+["],'',1)
Endif


* Open an html forcefully using Word (normally it defaults to a browser)
Local lcFile
lcFile = Getfile('htm')
If !Empty(m.lcFile)
      ShellExecute(0,'open','winword.exe',["]+m.lcFile+["],'',1)
Endif

I think those two examples are enough.

Comparing the two approach side by side:

Standard approach
ShellExecute(0,'open',m.lcFile,'','',1)

Alternative approach
ShellExecute(0,'open','notepad.exe',["]+m.lcFile+["],'',1)

Notice that in the standard approach, the file to be opened is passed as the 3rd parameter and 4th parameter being empty?  On the Alternative approach, the 3rd parameter is the application we want to open and on the 4th parameter the file we wish to open.  Also, additional double quotes are added on both ends as enclosure to ensure that it will get the full path and file name correctly even if the path and filename will include spaces inbetween.


Cheers!

by Jun Tangunan (noreply@blogger.com) at January 12, 2015 02:38 AM

January 11, 2015

Alex Feldstein

22 maps and charts that will surprise you



"A good visualization helps you see what the data is telling you. The best visualizations help you you see things you never thought the data would tell you. These 22 charts and maps were, at least for me, in that category: all of them told me something I found surprising. Some of them genuinely changed the way I think about the world."

22 maps and charts that will surprise you by Ezra Klein at Vox

by Alex Feldstein (noreply@blogger.com) at January 11, 2015 12:35 PM

January 10, 2015

Alex Feldstein

January 09, 2015

Rick Strahl's Web Log

Tip: Create a Visual Studio Menu option to Open a Command Window

I'm finding myself using the command line more and more, especially with ASP.NET vNext for running Web apps from the command line, accessing git and JavaScript build tools. Here's a real easy way to pop open a Command Window in the active project directory from Visual Studio.

by Rick Strahl at January 09, 2015 10:35 AM

Alex Feldstein

January 08, 2015

Craig Bailey

How to survive the robot age

Just spout bullshit:

Be a multi-disciplinary, insatiably curious person who knows how to use the tools to model ideas and create prototypes.

Possessed of an open mind and few fixed ideas about how things should be done, you nonetheless have a strong conscience and can operate outside of your comfort zone to achieve win-win outcomes. You are known for your integrity and resilience.

(via: The Conversation)

 

The post How to survive the robot age appeared first on Craig Bailey.

by Craig Bailey at January 08, 2015 10:38 PM

Facebook and teenagers

While the usual caveats about a post with the opinions of one person (a teenager), that aims to provide insight into a group (US teenagers) apply of course, it’s still really interesting.

These points jumped out at me:

Facebook: In short, many have nailed this on the head. It’s dead to us.

then this:

Messaging on Facebook is also extremely popular among our age group, mainly because they provide the means to talk to those people who you weren’t really comfortable with asking for their number but comfortable enough to send them a friend request.

and later this:

WhatsApp: You download it when you go abroad, you use it there for a bit before going back to iMessage and Facebook Messenger, then you delete it. I know tons of people who use it to communicate with friends they made abroad, but I feel like Messenger is beginning to overshadow it.

Makes me realise how smart Mark Zuckerberg was to split out Messenger, even though he got so much pushback about it.

As a few have said, and many are now realising, messaging is mobile’s killer app.

I love it when people say Facebook is doomed, and is the next MySpace, primed to be replaced by the next big thing that comes along. Little do they realise that Facebook itself is already well advanced on providing that next big thing that will replace it.

The post Facebook and teenagers appeared first on Craig Bailey.

by Craig Bailey at January 08, 2015 06:26 AM

Alex Feldstein

January 07, 2015

Rahul Desai's Blog

Microsoft evolves its customer-centric solutions with new Parature release

“More and more, people are choosing the brands that give them unique, tailored and fulfilling customer service experiences,” said Bob Stutz, corporate vice president of Microsoft Dynamics CRM. “Parature’s customer-centric capabilities enable organizations to deliver personalized customer care and, when combined with the clear business processes and intelligence of Microsoft Dynamics CRM, give our customers the high-quality solutions their businesses demand.”

Microsoft evolves its customer-centric solutions with new Parature release | News Center

by Rahul Desai at January 07, 2015 09:44 PM

Alex Feldstein

January 06, 2015

Craig Bailey

Jeff Bezos will never win

An illuminating article about Jeff Bezos and the Amazon Fire Phone fiasco. Well worth a read.

Will be interesting to see how this pans out over the next 5 years.

If Amazon do get a future version of the phone right (and all indications are that they are continuing to invest heavily in R&D for it), then this period will be looked back on as being valuable learning, and a tribute to Jeff’s persistence against the naysayers.

And if future phone versions continue to be duds, then of course the signs were ‘obviously’ there all along… at which point the number of ‘I told you so’ posts from tech writers will be overwhelming.

It’s always safer to expect failure.

The post Jeff Bezos will never win appeared first on Craig Bailey.

by Craig Bailey at January 06, 2015 11:59 PM

FoxProWiki

UpcomingEvents

Editor comments: Philly Jan & Feb
A place to list upcoming Visual FoxPro events like conferences, meetings, user groups, open training sessions...
Closest at the top please, and please remove past events.

January 06, 2015 07:35 PM

VFP Philly

January 13 and February 10: Tips and Tricks


For the next two months, we’ll cover Tips and Tricks. On January 13, Tamar E. Granor will present her Southwest Fox 2014 session “VFP Tips and Tricks.” On February 10, we’ll open the floor for all attendees to share their favorite tips, tricks and traps.

Here’s the abstract for Tamar’s talk:

I love to watch other people work at their computers. Every user makes a unique set of choices about when to use the mouse and when to use the keyboard, whether to use the menu or a keyboard shortcut, and so forth. But people often get set in their ways, and continue to do something one way when there's a much more efficient way to do it.

The same thing applies to Visual FoxPro. It's been said that if you can do something at all, you can do it three ways. But most of us learn how to do something and move on, even if a different way is more efficient or more effective. When new ways of doing things come along, we don't always pay attention to them.

In this session, we'll look at a variety of ways to work smarter in VFP. Some apply to the IDE, while others address the language. In the tradition of Drew Speedie, we'll cover as many of these tips and tricks as time permits.

by Tamar E. Granor (noreply@blogger.com) at January 06, 2015 07:26 PM

CULLY Technologies, LLC

3 Paradyms for Data Access in Xojo – Article

xDevMag-2015JanFebI’m proud to announce that our article on “3 Paradyms for Data Access in Xojo” has been published in xDev Magazine for the Jan/Feb 2015 issue! It was great working with Scott Boss of Nocturnal Coding Monkeys on the article.

I can’t post the content here, but you can pick up your copy for less than $10 for a single issue, or less if you subscribe for a full year or more. Check it out.

We’re happy to present the information. It’s great to have options and we hope to present the strengths and weaknesses of three approaches to data access using Xojo. I hope this helps get the word out about Xojo and what a great, flexible development tool it is.

by kcully at January 06, 2015 04:58 PM

Rick Strahl's Web Log

Using Cordova and Visual Studio to build iOS Mobile Apps

Last week I took a look at the Visual Studio Tools for Apache Cordova, which is currently available as a CTP preview. To be honest I didn’t have high hopes, given some disastrous presentations I’d recently seen on this toolset. However, I was pleasantly surprised when I actually took this toolset for a spin – it solves a real problem by providing a unified installer for the necessary SDKs and tools to support Android, Windows Phone and iOS, and provides a very well thought out development platform that builds on top of the already awesome Web tooling that Visual Studio provides. The highlight of these tools is the ability to easily debug Cordova applications using Web developer tools that are integrated directly in Visual Studio, allowing you to debug either the provided emulators and simulators, or debug actual attached live devices including iOS devices.

Cordova

For those of you that don’t know, Apache Cordova – also known as Adobe PhoneGap – provides hybrid mobile Web development technology that lets you use standard Web technologies to build mobile apps. Cordova works by providing a native device application that hosts a full screen Web browser control as well as tooling for building the app and getting it ready for deployment to a mobile device. As a developer you implement the Web interface using the same Web technologies you use for Web development: HTML5, CSS and JavaScript as well as any support libraries and frameworks you might be using. Cordova – or in this case the Visual Studio Cordova Tools – then can build the application for you into a mobile device specific package that can be deployed to an app store and run on a mobile device. Because HTML5 mobile APIs are severely lacking in consistency and browser support, Cordova also provides a JavaScript based plug-in API that allows it to interact with native hardware and device APIs so you get access to native features of most mobile devices using a common multi-platform compatible interface. There are over 600 plug-ins that interfaces that provide access to most mobile device features and you can build your own plug-ins against native APIs if necessary.

Why do you need Visual Studio Integration?

Cordova on its own does a pretty good job of letting you create projects and build them using command line tools. However, it’s your responsibility to collect all the SDKs and tools you need for each platform and set them up. On Windows you also can’t build an iOS app, which is supported only on Macs. Cordova on its own also doesn’t do anything for debugging your applications – it lets you build and run them on a device but there’s no debugging support.

The Visual Studio Tools for Apache Cordova provide a consolidated installation for all the necessary SDKs and emulators, as well as an integrated development experience from coding to running and debugging of a Cordova applications, all within the boundaries of Visual Studio. Additionally Cordova natively doesn’t allow for building iOS applications on Windows, but using the Visual Studio tools you can actually develop and debug iOS apps on Windows.

Here are some of the highlights of Visual Studio Tools for Apache Cordova:

  • Installation of all necessary SDKs for Windows Phone and Android on Windows
  • A remote iOS build and debugging agent that interfaces with XCode’s command line build tools
    (a Mac and Apple Developer Account is required to build and debug)
  • A startup template that sets up a multi-platform project (iOS/Android/Windows Phone)
  • Customized platform configuration integration
  • A host of Emulators you can run on Windows
  • Full DOM and CSS Viewer for live applications both in emulators and on devices
  • Full JavaScript Console and Debugger using the Visual Studio debugger UI

iOS support is Excellent

I’ve been particularly impressed by the iOS support, which allows you build, run and debug Cordova apps using Visual Studio and run on a live device attached to a Mac. While you still need to have a Mac somewhere on the network and an Apple Developer account to make this work, it’s still pretty impressive to click Attach in Visual Studio and have your app fire up on an actual live iPhone, and then provide you rich browser developer tools to let you interactively access a DOM and Style inspector, a JavaScript Console and use Visual Studio as a debugger.

Ironically the iOS support currently is better than either the Windows Phone or Android experience. Windows Phone/Windows Universal debugging is not yet supported and Android debugging requires devices running Android 4.4 or later.

I’ve toyed with Cordova in the past off and on, and I’ve always turned away from it because it was just too much of a pain trying to debug on device applications especially for iOS devices. Using these tools for Visual Studio however, it feels very natural to develop, test and debug your application either in a browser, an emulator or on an actual device.

Creating a Cordova Application for iOS

To take these tools for a spin I took a small AlbumViewer sample application and moved it to Cordova. I’m going to use iOS as the example here because iOS has traditionally been the most difficult platform for Windows developers to build mobile apps for and to me this is one of the highlights of the Visual Studio Tools for Apache Cordova. Other platforms are actually easier to set up, but currently there are limitations: Android 4.4 has to be used for live device debugging, and Windows Phone/Universal currently don’t support debugging at all, but the range of support is supposed to be better by the time these tools release.

Let’s get started. I’m using Visual Studio 2013 and the add-in package for the Cordova tools (CTP 3). You can also use the Visual Studio 2015 Preview which includes these tools as part of its installation although the template is available only with TypeScript there.

First step is to create a new project:

NewCordovaProject

This creates a new project that includes the various platform specific subfolders for various resources, plug-ins and merged components that Cordova internally uses to build a native application.

 VsProject

This project contains a bunch of stuff that’s mostly related to the 3 platforms that Visual Studio defaults to: Android, iOS and Windows Phone/Universal.

The key component in this project is the index.html page which is the application’s start page that Cordova launches when the mobile app starts. From there you can essentially launch your Web based application and go to town. The main difference is that the index.html references cordova.js and platformoverrides.js, which are platform specific, generated files that Cordova produces when it packages your app.

cordova.js is the gateway to Cordova’s platform specific integration features. Most importantly it’s the interface that provides the plug-in system which is used to extend raw browser behavior and allows third parties to expose native APIs as JavaScript APIs in your application. Plug-ins are meant to get around the shitty HTML5 mobile API support and provide a consistent platform for accessing hardware like the camera, microphone, haptic feedback, battery status, or access software APIs for things like access to the Camera Roll, the contacts, call list and SMS systems on devices. There are over 600 Cordova plug-ins available to date to allow you to integrate more closely with a device and the API is open so you can build your own extenders into any of the mobile device platforms supported.

The index.html file is the application’s entry point and essentially you are building a Web application. So anything you’d normally do with a Web application – display a start page and have logic in JavaScript files or hooking up a framework like Angular works as you’d expect.

The default index.html looks like this:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>AlbumViewerCordova</title>

    <!-- AlbumViewerCordova references -->
    <link href="css/index.css" rel="stylesheet" />
</head>
<body>
    <p>Hello, your application is ready!</p>

    <!-- Cordova reference, this is added to your app when it's built. -->
    <script src="cordova.js"></script>
    <script src="scripts/platformOverrides.js"></script>

    <script src="scripts/index.js"></script>
</body>
</html>

Notice the three script links which load the Cordova dependencies.

index.js serves as an entry point that exposes a few key lifetime events for a mobile app:

(function () {
    "use strict";

    document.addEventListener( 'deviceready', onDeviceReady.bind( this ), false );

    function onDeviceReady() {
        // Handle the Cordova pause and resume events
        document.addEventListener( 'pause', onPause.bind( this ), false );
        document.addEventListener( 'resume', onResume.bind( this ), false );
        
        // TODO: Cordova has been loaded. Perform any initialization that requires Cordova here.
    };

    function onPause() {
        // TODO: This application has been suspended. Save application state here.
    };

    function onResume() {
        // TODO: This application has been reactivated. Restore application state here.
    };
} )();

These are useful *if* you want to take special action when these events occur, but this matters only if you are depending on Cordova specific features in your app.

In the end what you are working with is just an HTML5 application, which means you should be able to use any application and just make it work.

Importing an existing Web App

To test this theory of how well an already running mobile aware Web app would translate to run with Cordova, I took a recent sample application – an AlbumViewer I created for another article – and ported it into Cordova. I’m going to spoil the suspense by telling you up front – it worked, and it worked with only a few modifications.

You can check out this sample app from this GitHub repository:

https://github.com/RickStrahl/CordovaAlbumViewer

Here’s a screen shot of the app running on an live iPhone.

AlbumViewer

And here’s the same app running on an iPad:

AlbumViewerIPad

 

So let’s take a look at the process involved in making this happen.

Remove external Dependencies – Using local Data

At this point I’ve created a new project and am starting from ground zero. This existing app originally worked against a local Web service (which was the main point of the previous article), so the first thing I wanted to do is remove the dependency on the service and switch to local data. The application is an Angular application and it uses services for the data access to the service to retrieve data.

Originally there was an AlbumsService and ArtistService to retrieve data. I ended up creating corresponding AlbumsServiceLocal and ArtistServiceLocal implementations that pulled the same data from local files and then stored them in local storage after that. The idea is that a mobile application should as much as possible use local data and access the Web mainly to sync. In this case I didn’t want to have the sample rely on having to set up a service locally so I kept the data all local.

I made these changes BEFORE I moved the code over to Cordova, because I figured it’d be easier to do in a pure Web environment. Turns out that’s not exactly true – I can actually set up Cordova to run my app the same way, but I didn’t figure that out until later :-) I’ll come back to that later when I talk about process a little.

Importing into the Project

Once I had the app running with local data and without other dependencies I decided to move it into the Cordova project. This is as easy as copying the files into the project wholesale. After I’ve imported the project now looks more like a typical Web project:

ImportedProject

The only file overwritten in this process is index.html which is the main startup page for my application that hosts the Angular ng-app layout and that is responsible for loading up all related script and style resources.

index.html is also the only file I had to initially change after copying – I had to add the three Cordova dependencies:

<script src="cordova.js"></script>
<script src="scripts/platformOverrides.js"></script>
<script src="scripts/index.js"></script>

And that’s all I changed initially.

Testing the App under Cordova

So far this isn’t impressive. All I’ve done is moved a Web project to a new folder. But now lets see how you can actually test out this application. Cordova comes with a host of different emulators and simulators. There are Web based emulators that provide basic functionality and there are the full fledged emulators that the various SDKs provide and of course you can run on an actual device.

For the initial test I’m going to use the Ripple Browser emulator for iOS that allows you to see your app running using Cordova and also gives you a first taste of the debugging experience.

To select an emulator select your target platform in the drop down next to the build target (Debug) list. Since I’m targeting iOS eventually I’ll use that. Then click on the drop down next to the Attach button to pick your emulator. I’ll pick the Ripple iPhone 5 emulator since that’s as close as I can get to my iPhone 6 I want to test with later.

Here’s what those options look like:

EmulatorSelection

Note that there are options for Remote Device which allows me later to run on my live phone, and various Simulators which are the Mac based iOS simulators from the Apple iOS SDK. You can use either of these only if you have an attached Mac and an Apple developer account. I’ll come back to that shortly. For now I’ll use Ripple.

To start up the app, click Attach… and go.

RippleDebug

When you run your application, Visual Studio launches the emulator and puts itself into Web DevTools mode. These Dev Tools look like the same Dev Tools that are in the latest versions of Internet Explorer, but note that I’m actually running the Ripple browser which actually runs in Chrome. So in effect I’m using the IE Dev Tools to debug Chrome. That’s… new and it works very well.

You have a live DOM Explorer (you can change things and reflect in the app!) and CSS Style Viewer as well as a full JavaScript console. Any console.log commands from your JavaScript code will show up in the Console as will errors and networks navigations etc. IOW, it behaves as you would expect browser Dev Tools to behave. The Ripple emulator is browser based and because it runs in Chrome you can also use the Chrome’s Dev Tools to debug the application, so you have a choice which browser tools you want to use.

The exciting thing here is that these Visual Studio based Dev Tools also work when you debug a native device as I’ll show in a minute.

So now we can get the app to run in a browser – ho hum. We know how to do that without Cordova. So let’s take a look to run this on a live iOS device.

Setting up for iOS Deployment

To build apps for iOS you’ll need a Mac and an Apple Developer account.

To be clear, I’m pretty green when it comes to using a Mac. Although I have a Mac Mini at home that I use for music recording and the occasional browser testing for Web applications, I generally don’t use the Mac much. When I do it feels like I’m going into a foreign country vacation… in general I’m mostly fumbling around when working on the Mac especially trying to figure out where things go when dealing with terminal related tasks.

However, given the tooling and instructions Microsoft provides, the installation of the remote build agent was straight forward. Although I ran into one snag I was able to get everything running on the Mac in the course of 15 minutes which is better than I’d expected.

Install Mac Applications

The first thing you have to do is install the tooling on the Mac, which involves manual installation of a few applications and some command line tools via Node Package Manager (NPM). The base documentation and links for this can be found here:

To summarize here’s what you need to install to get started. Install the following Mac applications:

You’ll also need:

  • An active iOS Developer Program Account

Install the Remote Build Agent

Next you need to install the actual Visual Studio Remote Build Agent. The install instructions are pretty simple. Open a command prompt on the Mac and run:

cd /usr/local
sudo npm install -g vs-mda-remote --user=Username

where Username is your Mac username.

The NPM installer installs HomeBrew (a package manager for the Mac if it isn’t installed already), and the XCode 6 Command Line tools as well as the actual Visual Studio Remote Tools for Cordova Build Agent. Unfortunately, for me these simple instructions did not work – I saw failures trying to install HomeBrew and I had to manually install it (http://brew.sh). Once HomeBrew was installed I re-ran the NPM install for the build agent and was able to get the remainder of the tools installed.

Set up a Linked Developer Account

You also need to make sure that XCode has a linked developer account which you can do by starting XCode and then going the XCode menu | Preferences | Accounts and linking a developer account. Follow the prompts to add your Apple developer account to the list of identities.

Firing up the Remote Build Agent

Once the tools are installed and you have a developer account set up, you can run the the VS Remote Build Agent from the Mac Terminal:

vs-mda-remote --secure false

This starts the build tools and listens for connections on port 3000.

Set up Visual Studio to use the Remote Build Agent

Next you have to configure Visual Studio so it can find the remote build agent on the Mac. You can do this via Tools | Options | Tools for Apache Cordova:

Figure 6 - iOS Remote Configuration

You specify the IP or host name for the Mac remote host, the port which defaults to 3000 and an optional security pin. I prefer to not use a pin and run the remote agent on the Mac with the –secure false flag. Unless network security is an issue for you I would recommend you don’t use a PIN as I found I had to frequently reset the PIN which turned into a real pain. If you do want to use PIN you can run vs-mda-remote generateClientCert to generate a new PIN, which is then displayed in the terminal window.

When done with the config  form in Visual Studio click OK. If you don’t get an error the remote agent was found and you’re ready for remote processing on the Mac.

Ready, Set… Run!

Make sure that the build agent is running on the Mac and an iOS device is attached and the screen unlocked anytime you plan on building or running your application on iOS. To run the application, open your Cordova project  in Visual Studio and make sure you select iOS as the platform, and Remote Device from the Attach drop down. Then click the actual Attach button to run the app and watch the magic.

When you hit the Attach button, Visual Studio communicates with the remote build agent on the Mac to push over the files to process.

VS Build Agent

The remote agent basically handles setting up a Cordova project on the Mac and then uses Cordova to compile and run the project on the device (or emulator). Cordova in turn uses the XCode command line tools to build the XCode project that it creates and get it deployed on the device to test.

For the first run this can take a couple of minutes as the project is set up for the first time in a temp folder on the Mac, but subsequent runs take about 15 seconds from hitting Attach to having the app active on my phone. Not bad at all. The app should now be running and behave just like a browser based app on the phone.

When the app comes up on my iPhone, Visual Studio also switches back into the DOM debugger, as shown earlier with the Ripple emulator. Same deal – I can see the DOM, active styles and the JavaScript console. The active document is live so I can make changes in the DOM Explorer and see them immediately reflected back on my iPhone! Likewise I can use the Console to echo back info from my app or actually change any global state.

Debugging an iOS App

If you want to debug, you can easily do that as well. Simply set a breakpoint in any of the source files and run the application. Here’s a breakpoint being hit when loading the list of artists:

VsDebugIOs

You can see that you get both the inline inspection (notice the dummy user agent code I put in to show it’s coming from the remote iPhone), as well as the Locals and Watch Windows and the Console Window view on the right where you can use use for example console.log(albums) to log out any values that are in scope to inspect – and edit – values in real time.

I don’t know about you, but I find this pretty impressive. Remotely debugging on the actual device is pretty sweet and to me at least has been one of the missing pieces in Cordova development before. Although you could always debug applications using plain browser tools or even the Ripple debugger, debugging actual behavior, styling/layout and the actual Cordova plug-ins in a live debug view is awesome. Big props to Microsoft for making this work and integrating the debugging experience so nicely into Visual Studio.

Debugging Gotcha: Startup Code debugging doesn’t work

Note: there’s a bit of a gotcha when it comes to debugging startup code. The Visual Studio debugger takes some time to get attached and so you can’t debug startup code and even some initial code like the first page loading. In the above example I’m stopping on event code, so that works but had I put code in the initial rendering of artists it wouldn’t have worked. If you do need to debug startup code you have let the page load and then somehow reload the index.html page after the debugger has been attached. You can add a button or link anywhere in the app (I have mine on the Settings page when I’m running in ‘developer mode’) that does: window.location.href='index.html'. This reloads the index.html page when the debugger is already attached and you can then debug any startup code.

Other Platforms

Android

You can get this same debugging experience I just described for iOS from Android (4.4 KitKat and later) devices attached to the local machine and if the devices are switched into developer mode and have USB debugging enabled. Note that older devices are not directly supported although I think if you install the appropriate SDKs and change a few environment variables you can make it work. I didn’t try. According to the docs v4.4 and later works. I tried running my app on a v4.4 Galaxy Tab 4 7” and the app ran without much of a problem – once I had the SDKs set up properly.

The Cordova Tools for Visual Studio install the Android SDK, but I had major issues getting the project to build initially. I found that several components that are required weren’t actually installed.  The following link has detailed information that worked once I double checked and installed all the required components that somehow the installer didn’t install:

Once the SDK was properly installed however I was able to step right in and run and debug my application on the Android Device.

Another oddity is that the Web site mentions a new, optimized Android emulator that’s supposed to install with these tools, but on my machine this emulator is nowhere to be found even though I have both Visual Studio 2015 (which also includes the Cordova tools) and the add-in package for VS2013. This seems like it would be a useful thing to have although I think having a live device ultimately is the better choice as it seems and much less resource intensive than actually loading into an emulator. In fact I picked up the Galaxy Pad for just this reason a while back. It’s not a great device (very slow and choppy especially when compared to the iPad), but it’s a good way to test on an ‘average’ Android device.

Windows Phone

Ironically Windows Phone and Windows Universal is the platform that currently has the least integration with these Visual Studio Cordova Tools. In this preview, you can’t debug on a live Windows Phone device or even the emulator. The docs mention that this is just for the current preview. I have a Nokia Lumia 920 and the app

Windows Phone and Angular Routing

Windows Phone required some special configuration to deal with IE mobile’s link fixups. Apparently Windows Phone browser considers hash-bang URLs with multiple segments suspect and marks them as unsecure:ms-appx:#/artist/2. This causes problems for Angular’s navigation and a pop up dialog that tries to download an application to handle this URL moniker.

The workaround for this is to let Angular know how to handle the ms-appx moniker, and essentially ignore the funky prefix and navigate it. You can use the following config override in app.js:

app.config([ '$routeProvider', '$compileProvider', function($routeProvider,$compileProvider) { // … Route Configuration

// Fix bug for Windows Phone wanting to download files on urls with routed parameters $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|file|ms-appx|x-wmapp0):/); }]);

As usual with anything Microsoft and browser related there are a lots of problems with getting the application to run on Windows Phone.  Here are a few of the problems I ran into:

  • The ms-appx prefix issue above
  • Bootstrap Modal is just MIA – not popping up just blank (not fixed)
  • FontAwesome fonts wouldn’t load until I explicitly remove cache busting query string
  • A number of buttons (not all though) just take multiple clicks before they navigate
  • I ended up turning off CSS transitions but when they were on they were ridiculously slow

Running as a pure Web App in your Browser

As a side note – you can also still run the app as a ‘pure’ browser app because a Cordova app is essentially a Web app plus some Cordova plug-in juju. If your app can run without the Cordova specific features you can debug it in the browser.  Since we’re essentially talking about Web applications here that typically have only very minor or no mobile integration that relies on plug-ins I find that I can actually be most productive developing and debugging using simply Chrome and the Chrome DevTools and then only occasionally test on the actual device.

To do this you can start a Web Server in the Cordova root folder and just open the index.html page. I like to use the the NPM installed http-server:

npm install http-server -g

then simply change to the folder of the app and run it:

cd c:\projects\CordovaAlbumViewer
http-server

which starts the server locally on port 8080 (which you can override with a command line switch). You could also use IIS Express started from the command line if you prefer.

When you run this way loading of the cordova.js file will fail (it’s not actually there) so any dependencies on plug-ins won’t work. However, anything else will work just fine inside of the browser.

Summary

These Visual Studio Tools for Apache Cordova are a very nice bit of tooling that’s going to make it much easier to build mobile Web applications and get them deployed into App stores.

Personally I believe that Web technology ultimately will win out over the crazy multi-platform development craze that we’re seeing now. It’s only a matter of time – but it’s just such a shame that W3C and HTML5 standards have let us down so much over the last few years to provide so little native mobile support in terms of mobile API access from Web browsers.

Cordova provides a bridge by combining a plug-in API that makes it possible to build the interfaces to native devices and expose that functionality. Looking at it with a cynical eye I would say that Cordova’s approach is much more useful than the stuck-in-the-mud mobile standards for HTML5. If only the mobile browsers would provide a similar model natively we could actually expect HTML5 evolve into a better mobile platform. But alas in the meantime Cordova provides that bridge to make it at least possible to build single code base mobile applications.

Microsoft’s tooling offers a very useful productivity boost on top of Cordova making the development process and more importantly the debugging process much more natural.

The Visual Studio Tools for Apache Cordova are currently in CTP state with an expected release timed to the release of Visual Studio 2015 later this year. You can install these tools either as a Visual Studio add-in package for Visual Studio 2013 or by downloading the Visual Studio 2015 Preview. Go to http://tinyurl.com/ptgkz6k to download the tools and start building mobile apps.

To find out a bit more about the Visual Studio Tools for Apache Cordova and this sample check out my forthcoming article in CODE Magazine that provides a bit more detail along with some additional discussion of gotchas and tweaks of the application discussed here. It’ll be in the March/April issue.

Resources

© Rick Strahl, West Wind Technologies, 2005-2015
Posted in Cordova  Visual Studio  Mobile  

by Rick Strahl at January 06, 2015 11:20 AM

Alex Feldstein

Photo of the Day


1986 McDonnell Douglas DC-9-82 (MD-82)
Ft. Lauderdale

by Alex Feldstein (noreply@blogger.com) at January 06, 2015 06:00 AM

FoxCentral News

A First Look at ASP.NET vNext Article

 ASP.NET vNext reimagines the core ASP.NET framework from the ground up with a more modern stack that provides better performance, lower resource consumption, and an async model for improved performance, scalability, and economy in cloud-based hosting scenarios. In this article Rick describes some of the motivations behind this radical change, why it?s needed, and how it?s going to affect planning going forward with ASP.NET.

by West Wind Technologies at January 06, 2015 12:21 AM

January 05, 2015

Craig Bailey

Apple Software Quality

Marco’s post is getting a lot of attention at the moment, and for good reason – it eloquently summarises the frustration a lot of Apple users are currently experiencing:

We now need to treat Apple’s OS and application releases with the same extreme skepticism and trepidation that conservative Windows IT departments employ.

He’s not mentioning anything new of course – the software quality issues have been well discussed for a while, but he does nicely highlight what we want:

We don’t need major OS releases every year. We don’t need each OS release to have a huge list of new features. We need our computers, phones, and tablets to work well first so we can enjoy new features released at a healthy, gradual, sustainable pace.

The iOS8 debacle update has been a highly publicised issue (which thankfully I avoided), but it’s the Yosemite bugs that I have been adversely affected by. For example two annoying issues I currently have are:

  • my Bluetooth Magic Mouse just stops working and won’t reconnect unless I reboot
  • Open and Save dialogs grow huge until they are off the screen

Six months ago OSX was rock solid for me, and I’d only reboot my Mac every few weeks (perhaps monthly). But with Yosemite I’m rebooting every day or two. And this to me is the only real indication you need to note. If you’re forced to reboot your computer every day due to software glitches then something is very wrong.

Back when I was using Windows I used to reboot most days, but I put this down to having cheaper hardware (I was on more of a budget in those days) as many of my colleagues claimed to hardly every need to reboot (they’d be using better gear). After all, cheaper hardware probably meant cheaper software development and as we know things like graphics drivers are a common issue, so Microsoft could be forgiven for having to manage such a huge spectrum of 3rd party updates.

But Apple doesn’t have any of those issues (or excuses). If they can’t get their own drivers to work reliably with their own hardware anymore, then something’s changed for the worse.

UPDATE: Further recommended reading: Daniel Jalkut, Seth Godin (from October)

The post Apple Software Quality appeared first on Craig Bailey.

by Craig Bailey at January 05, 2015 11:31 PM

Alex Feldstein

Craig Bailey

Thinking of the customer

When running a business there’s always tension between what’s best for your business versus what’s best for your customer.

Dan Counsell’s post on providing access to Mac Apps outside the App Store is a good example of that tension (emphasis mine):

Lets take a look at three of the reasons why not limiting the availability of your software to just the Mac App Store is a sound business decision.

To be fair Dan is not arguing against using the AppStore, he’s simply recommending it be one of multiple channels. However it’s interesting to think through his reasoning.

His three main points are:

  1. Pay less in fees
  2. Earn extra revenue from bundles
  3. Know who your customers are

I think there’s a few problems with the first point, namely that it’s hard to tell how much first-touch revenue you’d make from selling outside the exposure the AppStore provides. But let’s leave that to the side.

In terms of earning extra revenue from bundles, can’t really argue there. Although the iOS AppStore supports bundles, it’s not yet available on the Mac AppStore (although that will likely change in time).

Knowing who your customers are is always useful, and in this case Dan highlights the advantages of up-selling, as well as some customer service benefits.

However the main issue (and the comments on the post highlight this well) is that overall the user experience of the Mac AppStore is so much better than buying directly. As a customer I love using the Mac AppStore because:

  • The search and purchase process is so simple
  • I can check reviews
  • There’s no payment hassles
  • I get notified of updates immediately and can apply them easily
  • When I use a different machine I have instant access to download the apps again
  • I can easily recommend an App to a friend and tell them the name (or send a link) and they can easily purchase it too

As a user the AppStore is so much better for me. And the times I have to purchase directly are a hassle (currently this only applies to my Adobe Creative Cloud subscription, and Microsoft Office which I still use).

So there’s the tension. If the benefits for his business are really as good as he notes, then I’d imagine that in time they will stop selling via the AppStore – since having the multiple channels will require too much work, plus still have the issues that he highlights. And yes, it will likely be better for his business.

But will it be better for the customer? My point in this post, is simply to ask: if you are a business owner, does this matter to you?

The post Thinking of the customer appeared first on Craig Bailey.

by Craig Bailey at January 05, 2015 01:40 AM

January 04, 2015

Shedding Some Light

Need Visual FoxPro licenses?

I see this question pop up on the forums from time-to-time and get personal emails asking: where can I get a license to Visual FoxPro 9??

Most answers point developers to look on Ebay or check CDW, but the fact is Microsoft is not selling them anymore. If you have an MSDN license you also might have a license to Visual FoxPro. Short of that, legal copies are harder to uncover these days.

Good news and bad news. First the good news, the German FoxPro User Group still has a license to sell copies of Visual FoxPro 9 with their Visual Extend framework. The bad news is that license expires on January 12, 2015 (8 days from now!). So, if you still need licenses for Visual FoxPro, it may be a good idea to grab as many as you think you might need in case you need them in the future.

See Rainer’s post for all the details.

by Rick Schummer at January 04, 2015 07:20 PM