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 2013

Parameters for use in a Google Maps URL (zoom level, position, map-type, etc; via StackOverflow)

Posted by jpluimers on 2013/09/11

Thanks for StackOverflow user xordon for this answer:

This is current accepted way to link to a specific lat lon (rather than search for the nearest object).

http://maps.google.com/maps?z=12&t=m&q=loc:38.9419+-78.3020

  • z is the zoom level (1-20)
  • t is the map type (“m” map, “k” satellite, “h” hybrid, “p” terrain, “e” GoogleEarth)
  • q is the search query, if it is prefixed by loc: then google assumes it is a lat lon separated by a +

–jeroen

via: What parameters should I use in a Google Maps URL to go to a lat-lon? – Stack Overflow.

Posted in Development, Google, GoogleMaps, HTML, Power User, Software Development, Web Development | Leave a Comment »

.NET/C#: Small class for double-quote escaping/unescaping (via StackOverflow)

Posted by jpluimers on 2013/09/10

Just came across this nice answer by harpo containing a small class that can Escape/Unescape double-quotes in strings.

–jeroen

via: Good CSV Writer for C#? – Stack Overflow.

Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, CSV, Development, Software Development | Leave a Comment »

Linux: mounting of a FAT16/FAT32 USB flash drive

Posted by jpluimers on 2013/09/09

A while ago, I had to transfer a couple of files from a Linux machine where I did have console access, but no proper network access.

This was the sequence to get it connected and copy a directory to the USB flash drive:

  1. Stick the USB flash drive in a USB port (duh <g>) on the Linux system
  2. Run the fdisk  command to see on which device it got loaded:
    # fdisk -l
    It will give you something like this:
    Disk /dev/sdd: 8019 MB, 8019509248 bytes
    20 heads, 16 sectors/track, 48947 cylinders
    Units = cylinders of 320 * 512 = 163840 bytes
    Device Boot Start End Blocks Id System
    /dev/sdd1 * 1 48948 7831512 b Win95 FAT32
  3. Create a /mnt/USB directory to mount the device to using the mkdir command:
    # mkdir /mnt/USB
  4. Use the modprobe command to make sure the vfat file system support is loaded:
    # modprobe vfat
  5. Use the mount command to mount the device from the first step (/dev/sdd1) to the directory you created (/mnt/USB)
    # mount /dev/sdd1 /mnt/USB
  6. Use the rsync command to recursively (-p) copy a directory maintaining timestamps (-t) and showing progress (-v)
    # rsync -rtv /home/user/directory/ /mnt/USB/directory/
  7. Use the umount command to unmount the directory (and therefore the device)
    # umount /mnt/USB

–jeroen

via: Simple mounting of FAT32 USB Flash Drive.

Posted in *nix, Linux, Power User, SuSE Linux | Leave a Comment »

openSUSE 12.x: disabling smbd CUPS warnings when you have Samba but not printing installed

Posted by jpluimers on 2013/09/06

As Dave mentioned a couple of years ago in an article smbd_unable_to_connect_to_cups_server, even if you have printing disabled in Samba, you can get errors in /var/log/messages like these±

   May  5 09:45:02 www smbd[<pid>]: [2008/05/05 09:45:02, 0] printing/print_cups.c:cups_connect(69)
    May  5 09:45:02 www smbd[<pid>]: Unable to connect to CUPS server localhost:631 - Connection refused

This happens even if you disable the printers and print$ shares from within YaST2.

He proposed a 5-line change in the /etc/samba/smb.conf, but testing this on openSUSE 12.x, shows the actual diff is a lot smaller: just change the entry for printcap name, then add an entry for disable spoolss.

This is the diff of /etc/samba/smb.conf.printing versus /etc/samba/smb.conf: Read the rest of this entry »

Posted in *nix, Linux, openSuSE, Power User, SuSE Linux | Leave a Comment »

Android Device Manager: Find your lost phone with Android Device Manager | Official Android Blog

Posted by jpluimers on 2013/09/05

Reminder 2: has this been release yet?

Yes it was released on august 7th, and even earlier than announced. It is called Android Device Manager and you can find it at https://www.google.com/android/devicemanager.

More details at Official Blog: Dude, where’s my phone? Simple steps to protect your Android device this summer..

–jeroen

via:

Posted in Android Devices, Power User | Leave a Comment »

Delphi Mobile (NEXTGEN) compiler: the risk of a changed TSymbolName; unsupported data types means unsupported RTTI as well

Posted by jpluimers on 2013/09/05

The NEXTGEN family of Delphi compilers for the Mobile platforms changed quite a bit of things.

Most of it has been covered by various blogs posts. A non exhaustive list of ones I liked:

Those articles do not contain two things I had’t found about yet though that are important when you do RTTI using NEXTGEN in Delphi XE4: Read the rest of this entry »

Posted in Delphi, Delphi XE3, Delphi XE4, Development, Encoding, Software Development, Unicode, UTF-8 | 2 Comments »

SQL query to get the deadlocks in SQL SERVER 2005 and up

Posted by jpluimers on 2013/09/05

Darren Davies answered via SQL query to get the deadlocks in SQL SERVER 2008 – Stack Overflow a while ago listing a great SQL statement by Mladen Prajdić that shows how to do without the deprecated SP_LOCKS and SP_WHO2 (which is undocumented, and slightly different from SP_WHO) or the good old SP_LOCK2.

It is the textual equivalent of the Deadlock Graph, which is part of the SQL Server Profiler.
I like that profiler a lot (read this step-by-step intro if you haven’t used it), but some environments consider it too much power for a developer to use.

The SP_LOCKS documentation directs you to the sys.dm_tran_locks documentation, which is the base of the SQL below. It requires the mostly harmless VIEW SERVER STATE permission.

Finding out what to join in order to get some readable results suited for quick troubleshooting is quite an undertaking.
Mladen did all that, and this is his SQL: Read the rest of this entry »

Posted in Database Development, Development, SQL Server, SQL Server 2000, SQL Server 2005, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012 | Leave a Comment »

Prepping for Delphi XE5 beta blogging; PasCon / RAD Studio In Action discount

Posted by jpluimers on 2013/09/04

You will see a few Delphi XE5 pre-release related updates here soon. That is part of the Delphi XE5 beta blogging permission I have been given so I can show new Delphi XE5 features. Those updates are from a pre-release version of Delphi XE5 and will be replaced with a final update when Delphi XE5 is being released.

For more information about Delphi XE5 and the Android support, please visit http://embt.co/RADAndroid.

Though not as fast as I hoped (I’ve slept most of the past days), I’m already preparing my Mercurial repositories at https://bitbucket.org/jeroenp, and preparing for the PasCon / RAD Studio In Action in Leiden, The Netherlands next saturday so stay tuned.

About this event: there are a few seats left, and a last-minute discount recently launched. Book your tickets through the on-line links for EUR 35 excluding VAT (normallu EUR 49 excluding VAT): Read the rest of this entry »

Posted in Delphi, Delphi XE5, Development, Software Development | Tagged: , , | Leave a Comment »

.net – What is the difference between SqlCommand.CommandTimeout and SqlConnection.ConnectionTimeout? – Stack Overflow

Posted by jpluimers on 2013/09/04

Lots of people are confused about the different time out options you can set in ADO.NET.

Thanks NinethSense for explaining this well for the SqlClient DAL. Other DALs work in a similar way.

  • SqlCommand.CommandTimeout = timeout limit for your SQL query. Means, how much time a (eg: SELECT, UPDATE) query can take for its execution. If it exceeds SqlCommand.CommandTimeout, then it stops execution. A command timeout error will occur.
  • SqlConnection.ConnectionTimeout = timeout limit for your connection. Means, how much time your connection object can try to connect. If it exceeds the specified time, it stops connecting. A connection timeout error will occur.

–jeroen

via: .net – What is the difference between SqlCommand.CommandTimeout and SqlConnection.ConnectionTimeout? – Stack Overflow.

Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, Development, Software Development | 1 Comment »

Exceptions handling in the EnterpriseLibrary and the “SecurityException: The source was not found, …”

Posted by jpluimers on 2013/09/03

A while ago, I inherited a .NET project that used the EnterpriseLibrary, the original developers (it got developed around 2003) were gone, and every exception would end up in this:

SecurityException: The source was not found, but some or all event logs could not be searched.  To create the source, you need permission to read all event logs to make sure that the new source name is unique.  Inaccessible logs: Security.

Searching for the combination “EnterpriseLibrary” “The source was not found, but some or all event logs could not be searched. To create the source, you need permission to read all event logs to make sure that the new source name is unique. Inaccessible logs: Security.” revealed only 1 result:

patterns & practices – Enterprise Library – View Discussion: Logging Error of FormattedEventLogTraceListener in Win7.

Even though I didn’t want anything to be logged in the EventLog, I wanted text logs, and looking at the .config files in the main project, the Enterprise Library logging setup was correct (right sinks, etc).

Somehow, the EnterpriseLibrary still insisted on writing to the eventlog, and this particular exception was the only one tricking to the unhandled exception layer…

For logging in the Eventlog, that particular event log must exist. In order to create an eventlog, you need to have administrator access. And here is the crux: apparantly, the original developers were (while working on Windows NT 4) all Administrators. So they never noticed this problem (and maybe never even looked for that log). After having the Visual Studio debugger break on all CLR exceptions, not only the unhandled ones, I could see this one shown below fired deep inside the EnterpriseLibrary. Which means that the original developers:

  1. did add the EnterpriseLibrary V2 (yes, this project still had V2 and part of the config files were V1.1!) configuration files to the main project:
  2. Had forgotten to mark these files as “Copy to Output Directory” to have the value “Copy if Newer” or “Copy Always”

Marking the files as such solved the below exception, and now on my todo list is to make the old V1.1 stuff go away, and migrate to the most current Enterprise Library. 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, Development, EnterpriseLibrary, Software Development | Leave a Comment »