The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,861 other subscribers

Archive for the ‘Web Development’ Category

Sample: Cast Media Player for Streaming with DRM (via: Shawn Shen – Google+)

Posted by jpluimers on 2014/04/01

Sample: Cast Media Player for Streaming with DRM

https://github.com/googlecast/CastMediaPlayerStreamingDRM

Flow Diagrams for Senders and Receivers

To help you decide which Google Cast options are right for your app, we have updated the Google Cast SDK documentation with two flow diagrams:

 

via Leon Nicholls – Google+ – Flow Diagrams for Senders and Receivers To help you decide….

via Shawn Shen – Google+ – * Sample: Cast Media Player for Streaming with DRM* ….

Posted in Chromecast, Development, Google, HTML, HTML5, JavaScript/ECMAScript, Power User, Scripting, Software Development, Web Development | Leave a Comment »

EU Cookie Regulations vs. Google+ plugins (via: Gerwin Sturem; Google Drive)

Posted by jpluimers on 2014/03/31

Interesting article by Gerwin Sturm on EU Cookie Regulations vs. Google+ plugins.

It’s not just that the directive causes this nagging because “of course we can’t remember that users haven’t given us consent for storing cookies, because that would require storing a cookie, so the consent banner will always appear until the user has actually given consent.”

Some other valuable tips are in this article as well. Now go read it (:

–jeroen

Posted in Development, HTML, HTML5, Software Development, Web Development | Leave a Comment »

HTML Best Practice: Get your HEAD in order (via: Eric Law; IEInternals on MSDN Blogs)

Posted by jpluimers on 2014/03/08

Even though 3 years old, this is still relevant. Thanks Ilya Grigorik for pointing me at it.

Make sure your HTML HEAD tag has the elements in the below order:

  • any charset must come first (UTF-8 works best) though even better is to specify this in your http header,
  • any any x-ua-compatible comes second.

Why? Read Best Practice: Get your HEAD in order – IEInternals – Site Home – MSDN Blogs.

So the document element starts like this: Read the rest of this entry »

Posted in Development, HTML, HTML5, Software Development, Web Development | Tagged: | Leave a Comment »

Choose your chart type & Amount of profanity in git commit messages per programming language (via: andrewvos.com)

Posted by jpluimers on 2014/03/07

Funny charts at andrewvos.com – Amount of profanity in git commit messages per programming language.

The source is online too: AndrewVos/github-statistics.

And it led me to this really nice way of choosing your chart type.

Click to enlargeRead the rest of this entry »

Posted in .NET, C#, C++, Development, Java, JavaScript/ECMAScript, Perl, PHP, Ruby, Scripting, Software Development, Web Development | 2 Comments »

HTTP protocol requires you to escape spaces (usually with %20 or with +), but web-browsers will do that for you

Posted by jpluimers on 2014/02/20

Since the time that spaces are allowed in path and file names, it has caused confusion.

I personally like the readability of  spaces, but still tend to avoid them as they usually cause more harm than the readability gains.

An interesting thread about spaces in file names is operating systems – What technical reasons exist for not using space characters in file names? – Super User.

In URLs, you there are various kinds of places where spaces can be used. You have to escape as Xah Lee wonders in does HTTP protocol require space be encoded in file path?.

The escaping is part of the URL Encoding, but the escapes depends on the position of the space. In the query part (after the first ?), you can have it escaped by both %20 and plus sign, but in the path part (before the first ? sign), it can only have a %20.

This is explained by bobince in urlencode – when to encode space to plus (+) and when to %20? – Stack Overflow.

That escaping basically makes path and file names a lot less readable when passed as a URL. It causes posts like these:

But why can you still use spaces when you type a URL in your web browser, or use it in a href, src or other HTML URL attribute?

Xah Lee rightfully earlier wondered about that in webserver – space in url; did browser got smarter or server? – Stack Overflow.

Technically, both are not allowed. But web browser manufacturers understand we humans are lazy, and accommodate for that by encoding these when putting them into the HTTP request.

You can type “https://www.google.com/search?q=foo bar” in your web browser, and depending on the browser, it gets translated into either one of these:

Recap:

  • encode spaces in URLs as %20
  • try to avoid spaces in path and filenames

–jeroen

via:

Posted in Development, Encoding, HTML, Software Development, URL Encoding, Web Development | Leave a Comment »

Generate HTML Tables Clean and Fast

Posted by jpluimers on 2014/01/23

I wish I had found about Generate HTML Tables Clean and Fast years ago.

Every once in a while I want to generate the source code for an HTML table with some content easily.

I’ve found no tool doing this in an easy manner and starts in a split second.

But the web page Generate HTML Tables Clean and Fast does.

Correction: did. It is now off-line, but the Blended Technologies » Blog Archive  blog posts about it are still online: Introducing TableGen – The HTML Table Generator and Tablegen Goes Open Source, as is the WayBack machine archive for it.

So I installed Python on my openSUSE server according to Embedding Python In Apache2 With mod_python (… OpenSUSE) | HowtoForge, (could as well have configured in httpd.conf in stead of python.conf: no difference between installing mod_python via httpd.conf and conf.d in apache) then installed the TableGen source there.

(Note: more python.conf examples)

That would still have Python generate a 404 error (uncool: a python generated 404 error does not leave a log of the cause anywhere), not because the index.py was absent, but because it was written in old style “print” statements, not using the new style def index(req); way (thanks Senthil Kumaran, and AJ. for your answer).

So I did some research (this was my first encounter with Python) at for instance Paul Osman : Introduction to mod_python, then rewrote the print parts of the script into string concatenations, then return the full HTML.

(Note: if there is a print "Content-Type: text/html" (for instance demonstrated in Hello World | Web Python), you can omit it, or set the req.content_type like req.content_type = 'text/html' which usually is determined automatically by Python).

That caused quite a few IndentationError: expected an indented block quote errors: python is indentation sensitive (I hadn’t used a language depending on that for ages), and gives a confusing error when you have a colon (:) followed by an unindented docstringPython: I’m getting an ‘indented block’ error on the last 3 quotes (“””).

Then it still didn’t completely work: the form parameters would not be obtained correctly, so I read further, found 3.1 A Quick Start with the Publisher Handler and started to fix that too. That took way too long, so I found out that “mod_python” is not very much maintained any more and “mod_wsgi” is the way to go.

So I disabled the “python” module in YaST2, removed “/etc/apache2/conf.d/python.conf”, then installed the “apache2-mod_wsgi” software package in YaST2, then added the “wsgi” module to HTTP Server Configuration list of Server Modules (it automatically gets enabled) and saved the configuration.

These steps modified the APACHE_MODULES in /etc/sysconfig/apache2, restarted apache with “rcapache2 restart”. You can verify with “httpd2 -M” which modules are loaded. The list should exclude “python_module (shared)” and includes “wsgi_module (shared)”.

Most of this is described in has anyone gotten mod_wsgi working.

Python is whitespace sensitive, but you can have multiple statements on one line. That’s why Python allows semicolons after each statement.

Read Setting up Python with WSGI on Apache for a directory – Stack Overflow.

Read PyCon Conference Slides – Sydney 2010 – Python WSGI adapter module for Apache.

Read Graham Dumpleton: Why are you using embedded mode of mod_wsgi?.

Read Serving Python scripts with Apache mod_wsgi, part I | Leave No Bit Unturned.

Read Parsing the Request – Get | Web Python.

Watch WSGI Tutorial. It explains a lot, including Accessing POST Data from WSGI.

Error “Attempt to invoke directory as WSGI application” -> you cannot do that, there is no way to map a directory to an “index.py” in that directory.

For importing .py files from the same directory as your main .py file:

    import os
    import sys

    directory = os.path.dirname(__file__)
    sys.path.insert(0, directory)

    from webutils import *

Start using The Web framework for perfectionists with deadlines | Django.

A few really cool things about this page:

  • It is a web page, so easy to reach
  • It starts fast
  • You can increase the column/row count without loosing the entered data
    (as it stores the contents as a URL)
  • It can generate a thead for you
    (but not a tfoot)

Generating something like this was a breeze: Read the rest of this entry »

Posted in *nix, Apache2, Development, HTML, Linux, openSuSE, Power User, Software Development, SuSE Linux, Tumbleweed, Web Development | Leave a Comment »

.net – xcopy ASP.NET / WinForms deployment: find common location to access relative files to it (via: Stack Overflow)

Posted by jpluimers on 2013/12/25

StackOverflow user Joe (sorry, no last name) helped me big time by answering my question on Business logic shared by ASP.NET / WinForms: find the location of the assembly to access relative files to it.

Before showing the code at the bottom of this blog post, let me explain the question in more detail:

Basically I was in the midst of refactoring some ‘inherited’ business logic code that – before refactoring – for the ASP.NET side needs to be initialized with an absolute path, but on the WinForms / WPF side only with a relative path to a GetExecutingAssembly directory.

To ease xcopy deployment, I wanted all configuration settings to be relative. But I hadn’t found a common means for these platforms to obtain a directory usable as a root for accessing relative files.

That way I could put identical settings in both the Web.config and App.config, heck even generate them based on a common fragment, whithout having to hard-code absolute path names.

I knew about Assembly.GetExecutingAssembly, but in ASP.NET that location is not where the web site is (both IIS and the WebDevelopment server make use of temporary locations to store the assemblies).

ASP.NET does have Server.MapPath and HostingEnvironment.MapPath, but I didn’t want to make the business logic depend on ASP.NET.

Joe came up with this solution, which works dandy: Read the rest of this entry »

Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, ASP.NET, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Development, F#, Prism, Software Development, VB.NET, VB.NET 10.0, VB.NET 11.0, VB.NET 7.0, VB.NET 7.1, VB.NET 8.0, VB.NET 9.0, Web Development | Leave a Comment »

Generating complex math visualizations in SVG using C# and ILNumerics – Scott Hanselman

Posted by jpluimers on 2013/12/15

Funny how Generating complex math visualizations in SVG using C# and ILNumerics and MathViz (no, not this MathViz!) look so similar.

I hope the MathViz code becomes public one day.

–jeroen

via: Generating complex math visualizations in SVG using C# and ILNumerics – Scott Hanselman.

Posted in .NET, Delphi, Development, HTML, HTML5, iOS Development, Mobile Development, Software Development, Web Development | Leave a Comment »

Remote Android screen monitoring and viewing

Posted by jpluimers on 2013/11/25

Another one in the “WordPress Missed schedule” series.

Below are the Android remote screen monitoring/viewer/mirror tools I know about:

  • For a long time, I have used Droid@Screen: an Open Source,  Java based mature cross platform tool that uses ADB (it can even restart it for you in case it hangs) with lots of features (zooming, no temporary files, device recognition, disabling emulator devices, etc). There are some Screen Shots | Droid@Screen.
  • A while ago, I saw android-screen-monitor – Android Screen Monitor – Google Project Hosting. It is a mixed Java/C++ solution that only works on Windows.
  • Recently, Jim McKeeth open sources his Android Screen View: Android Screen View | The Podcast at Delphi.org. It is written as a quick hack in Delphi XE5, so right now it has less features and works in a more crude way than the two Java based tools, but it shows the potential of doing similar things with Delphi.

I primarily use Droid@Screen as so far it works best for me.

But I keep a close eye on the other two just to make sure I don’t miss improvements.

–jeroen

Posted in Android Devices, Delphi, Delphi XE5, Development, Java, Missed Schedule, Mobile Development, Power User, SocialMedia, Software Development, WordPress | 1 Comment »

When the Delphi XE5 commandline compiler fails with `error F1026: File not found: ‘False.dpr’`

Posted by jpluimers on 2013/11/20

If you an error like below when compiling Delphi XE5 .dproj files using msbuild … then note the documentation for Debug information (Delphi) – RAD Studio. has not been updated yet as it still lists the values {$D+} or {$D-} {$DEBUGINFO ON} or {$DEBUGINFO OFF}.

(_PasCoreCompile target) -> C:\Program Files (x86)\Embarcadero\RAD Studio\12.0\Bin\CodeGear.Delphi.Targets(187,5): error F1026: File not found: 'False.dpr'

With Delphi XE5, you can specify 3 additional values: {$D1}{$D2} and {$D0}, or {$DEBUGINFO 1}{$DEBUGINFO 2} or {$DEBUGINFO 0}

In the msbuild .dproj files , the values are stored as DCC_DebugInformation elements. Read the rest of this entry »

Posted in Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development, Missed Schedule, SocialMedia, Software Development, WordPress | 13 Comments »