RaSor's Tech Blog

July 16, 2014

C#: Snippets

Filed under: C#/Xaml — rasor @ 8:24 am

Last updated: 2014-07-17

DateTime snippets

Print as UTC

//http://stackoverflow.com/questions/1820915/how-can-i-format-datetime-to-web-utc-format
string foo = yourDateTime.ToUniversalTime().ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK");
//Without milisecs:
string foo = yourDateTime.ToUniversalTime().ToString("u");

Instanciation snippets

Reading with a static method into a class var

    public class SignicatSaml
        private static bool fileStoreEnabled = Convert.ToBoolean(WebConfigurationManager.AppSettings["Archive.FileStore.Enabled"]);

Debugging snippets

Fix for accepting Fiddler cert: The remote certificate is invalid according to the validation procedure.

#if DEBUG
    //http://stackoverflow.com/questions/9983265/the-remote-certificate-is-invalid-according-to-the-validation-procedure
    ServicePointManager.ServerCertificateValidationCallback += (o, c, ch, er) => true;
#endif

Enable webservice calls to be sent through Fiddler
Web.Debug.config transformation

  <system.net>
    <defaultProxy>
      <!-- Enable webservice calls to be sent through Fiddler  http://docs.telerik.com/fiddler/configure-fiddler/tasks/configuredotnetapp -->
      <proxy bypassonlocal="False" usesystemdefault="True" xdt:Transform="SetAttributes"/>
      <proxy xdt:Transform="RemoveAttributes(autoDetect)" />
    </defaultProxy>
  </system.net>

Convertion snippets

Converting Base64 string to byte array

byte[] bytes = Convert.FromBase64String(base64encodedstr);

Converting string to byte array and back

byte[] bytes = System.Text.Encoding.Default.GetBytes(str);
string str = System.Text.Encoding.Default.GetString(bytes);
//or
byte[] bytes = System.Text.Encoding.UTF8.GetBytes(str);
string str = System.Text.Encoding.UTF8.GetString(bytes);
//or
UTF8Encoding ecoder = new UTF8Encoding();
string str = ecoder.GetString(bytes);

Async snippets

//A synchroneus method changed to asynchroneus
public async Task<CompleteResponse> CompleteNew(string ticket)
{
    try
    {
        CompleteResponse response = new CompleteResponse();
        // Do something........
        return response;
    }
    catch (Exception ex) {}
}

//The signature of the original synchroneus method.
//In this case we keep it, so the interface is backward compatible.
public CompleteResponse Complete(string ticket)
{
    try
    {
        //Call the async func. This will keep this sync func waiting....
        CompleteResponse response = Task.Run(async () => await CompleteNew(ticket)).Result;
        return response;
    }
    catch (Exception ex) {}
}

 

Links

 

July 10, 2014

C#: XML snippets

Filed under: C#/Xaml, NET — rasor @ 11:07 am

Parsing some namespaced XML

XML:

<Response xmlns="urn:oasis:names:tc:SAML:1.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:samlp="urn:oasis:names:tc:SAML:1.0:protocol" IssueInstant="2009-07-03T04:11:19.354Z" MajorVersion="1" MinorVersion="1" ResponseID="ab05928dfbba21e829f4778f22c9ec3f">
  <Status>
    <StatusCode Value="samlp:Success"></StatusCode>
  </Status>

C#

XmlDocument saml;
XmlNamespaceManager nsmgr = new XmlNamespaceManager(saml.NameTable);
nsmgr.AddNamespace("saml", "urn:oasis:names:tc:SAML:1.0:protocol");
string status = saml.SelectSingleNode("saml:Response/saml:Status/saml:StatusCode/@Value", nsmgr).Value;
//samlp:Success

The End

July 7, 2014

.NET: HowTo enable WebService calls to be sent through Fiddler

Filed under: Debugging, NET — rasor @ 7:22 am

Assuming you in Web.config have:

  <system.net>
    <defaultProxy>
      <proxy autoDetect="True" />
    </defaultProxy>
  </system.net>

Then in your transform file you change it with
Web.Debug.config:

  <system.net>
    <defaultProxy>
      <!-- Enable webservice calls to be sent through Fiddler  http://docs.telerik.com/fiddler/configure-fiddler/tasks/configuredotnetapp -->
      <proxy bypassonlocal="False" usesystemdefault="True" xdt:Transform="SetAttributes"/>
      <proxy xdt:Transform="RemoveAttributes(autoDetect)" />
    </defaultProxy>
  </system.net>

On the page, where you have a web service call you need to accept the Fiddler certificate, but only in your Debug mode:
*.aspx.cs:

        protected async void Page_Load(object sender, EventArgs e)
        {
#if DEBUG
            //Fix for accepting Fiddler cert: The remote certificate is invalid according to the validation procedure.
            //http://stackoverflow.com/questions/9983265/the-remote-certificate-is-invalid-according-to-the-validation-procedure
            ServicePointManager.ServerCertificateValidationCallback += (o, c, ch, er) => true;
#endif

The End.

June 1, 2014

D7: Update Core minor version 7.xx

Filed under: Drupal — rasor @ 7:24 pm

These are notes I made, when upgrading Drupal Core from 1.0-beta5 (7.22) from a TB Sirate Distribution to Core 7.28.

— Udate Core from 1.0-beta5 (7.22) to 7.28 ———
Running update.php is not possible due to a proper version number is missing
http://mysite.xx/update.php
Unresolved dependency System (Version >=7.11 required). Currently using System version 1.0-beta5

So solution is to update core:
Instruction: https://drupal.org/node/1494290
Backup

  • Create folder mysite/administrator/backups
  • Web with http://backup.mysite.xx/ //An installed backup site
  • SQL with phpMyAdmin – mydb – Export: Custom – OutputCompression: gzipped – Go

Core

  • Download 7.28 from https://drupal.org/project/drupal
  • Extract
  • admin/config/development/maintenance – Select set in maint mode – save
  • Delete all files except
    • /sites
    • /profiles/themebrain_profile
  • Move extracted files to root except /sites
  • If the update release includes changes to settings.php replace old settings.php in /sites/default/ with the new one, and edit site-specific entries (eg database name, user, and password)
  • If you modified files such as .htaccess or robots.txt re-apply those changes to the new files.
  • /user/login
  • Update http://mysite.xx/update.php
  • admin/config/development/maintenance – UnSelect set in maint mode – save

The End.

May 30, 2014

D7: Creating a starter theme – notes

Filed under: Drupal, Notes — rasor @ 12:44 pm

This is notes for Drupal 7 theeming.

The notes I made while creating a starter theme named plate_intl for the Restaurant Distribution based on Plate starter theme.

The procedure can be reused for creating any starter theme

  • Copy the base them to /sites/all/themes and rename the folder
  • Rename and edit the .info file
  • Optionally create an extra .css file with your extra styling
  • Edit the page template page.tpl.php

=== Theme ==============================================

- Copied /profiles/restaurant/themes/plate to
— /sites/all/themes
– Renamed /sites/all/themes/plate to
— /sites/all/themes/plate_intl
– Renamed /sites/all/themes/plate_intl/plate.info to plate_intl.info
– Edited /sites/all/themes/plate_intl/plate_intl.info:
name = Plate_intl
description = An international starter theme for the Restaurant Distribution based on Plate starter theme
….
regions[header_right] = Header Right
….
stylesheets[all][] = assets/stylesheets/screen-plate-intl.css
….
; Information added by rasor on 2013-12-29
version = “7.x-1.0-dev”
project = “plate_intl”
——-

- Created file /sites/all/themes/plate_intl/assets/stylesheets/screen-plate-intl.css

- Edited /sites/all/themes/plate_intl/templates/page.tpl.php – Added two regions and enabled more icons in footer (not used, yet):
<div class=”inner pull-right”>
<?php if ($main_menu): ?>
<nav id=”main-menu” class=”main-menu” role=”navigation” style=”float:left”>
<?php print render($main_menu); ?>
</nav> <!– /#main-menu –>
<?php endif; ?>

<div class=”header-right” style=”float:left”>
<?php print render($page['header_right']); ?>
</div>
</div>
….
<footer id=”footer” class=”footer” role=”footer”>
<div class=”container”>
<div class=”footer-links row-fluid”>
<!–
<div class=”span3″>
<h4><?php print t(‘Rate Us’); ?></h4>
<h3>
<?php print ‘<a href=”‘ . restaurant_base_get_settings(‘twitter’) . ‘”>'; ?>
<?php print t(‘Ratings on TripAdvisor’); ?><i><img src=”#”></i></a>
</h3>
</div>
–>
<?php if (isset($footer_links)): ?>
<?php print $footer_links; ?>
<?php endif; ?>
</div>
</div>
<div class=”footer-bottom row-fluid”>
<?php print render($page['footer']); ?>
</div>
</footer>
——

- admin/appearance – Enabled&SetDefault Plate_intl 7.x-1.0-dev
! Footer links disappered!!!!
– Edited /sites/all/themes/plate_intl/template.php

Renamed from: function plate_preprocess_page
to: function plate_intl_preprocess_page

Moved html out to page.tpl.php. Changed to:
$footer_links = ”;//'<div class=”footer-links row-fluid”>';

Used twitter for TripAdvisor:
‘twitter’ => array(
‘title’ => t(‘Ratings on TripAdvisor’),
‘sub_title’ => t(‘Rate Us’),
‘href’ => restaurant_base_get_settings(‘twitter’),
‘icon’ => ‘icon-tumblr’,
),
// Icon names: http://fortawesome.github.io/Font-Awesome/3.2.1/icons/

- admin/config/development/performance – ClearCache

//Demo regions
– admin/structure/block/demo/plate_intl

- admin/structure/block – Language Switcher – Region: Header Right
— Configure – Block Title: <none>

The End.

April 24, 2014

Wet keyboard – trying to fix

Filed under: HW — rasor @ 5:41 pm

A friend spilled milk on a Lenovo Ideapad Yoga 13 laptop.

Several keys on the keyboard either did not work or displayed on or two wrong characters.

Lots of vids shows howto remove the keyboard:

If cleaning and change keyboard won’t fix then you can use an external USB or bluetooth keyboard.

The end.

March 3, 2014

Convert Nokia VCF2.1 to iCloud VCF3.0

Filed under: iPhone, Symbian/Nokia — rasor @ 8:34 pm

From an old Nokia E71 I needed to copy contacts to IOS7.

The IPhone was set to sync with iCloud, so the task would be to import the contacts to iCloud.

Problem: With iCloud I could not import the Nokia VCF2.1 format.

(more…)

February 23, 2014

Hyper-V and SystemCenter prep

Filed under: Hosting, Network, Virtual, Windows — rasor @ 11:15 am

MS is offering a free course (Server Virtualization with Windows Server Hyper-V and System Center) and
exam for Hyper-V and SystemCenter management (74-409). This blog contains my notes for the exam prep.

Course Instructors | Symon Perriman – Senior Technical Evangelist, Microsoft; Corey Hynes – Lead Architect and President, HOLSystems Related

(more…)

February 20, 2014

VS2013 – Comparing ASP.NET project types

Filed under: C#/Xaml, Js/Html, MVC, Visual Studio, Web API — rasor @ 2:06 pm

In Visual Studio 2013 ASP.NET projects you can easily mix WebForms with MVC, WebAPI (Nondiscoverable REST via MVC) SPA and Facebook content. Read more…

This post just compares the default content.

(more…)

November 23, 2013

D7: Testing TB Mollise Starter

Filed under: Drupal — rasor @ 9:49 pm

This is a Drupal7 demo of TB Mollise installation profile.

TB Mollise Starter

(more…)

November 20, 2013

Access-Control-Allow-Origin

Filed under: Js/Html — rasor @ 12:28 pm

Thought I wanted to collect a list of Access-Control-Allow-Origin fixes when doing Ajax calls

Give Chrome permission:

chrome.exe --allow-file-access-from-files

But you can’t do that on all clients in the world… – source and source

(more…)

November 16, 2013

D7 Recipe: Installing a custom Drupal installation profile / distribution / starter kit

Filed under: Drupal, Hosting — rasor @ 12:58 am

This is a Drupal7 recipe for using a Drupal Distribution. As an example is used TB Mollise installation profile.
I am here installing onto domain vejviserne.dk, but of course you should replace that and similar settings with your own preferences.

(more…)

November 8, 2013

CMS Synonyms. Drupal, SharePoint etc

Filed under: Drupal, N2CMS, Orchard, SharePoint — rasor @ 11:32 am

Updated: 2014-06-11

Did you ever notice that there is quite a lot of similarities between SharePoint and Drupal – and other CMS?

This list can be useful, when you are going from one to the other.

Drupal 7 / D8
(PHP)
SharePoint 2007/10/13
(.NET)
Orchard(.NET) Telerik Sitefinity 7
(.NET)
Kentico 8
(.NET)
MonoX
(.NET)
Ingeniux(.NET)
EPi server
(.NET)
N2 CMS
(.NET)
Node, Panel Node (Entity types) List Item Content Item (List) Item, Widget Content ContentItem
User (Entity type) User Profile User, Profile User User User (ContentItem)
Role .. Role (Content Part) Role Role Visitor Group Role
Nodes in block List WebPart Article List WebPart ContentList, Selection
Views List View, List, Document Library Projections, Queries Nope Transformations Nope Container (no customization!)
Content Type (a subtype of a Node Entity) Content Type
(Inheritable)
Content Type, Content Part Nope Document Type (Inheritable) Nope Nope Nope
Template, Listed type
Block or Pane Block or Fieldable Panel Pane WebPart Widget Content Block WebPart,
Widget
Block Part(Type), Widget, ZoneItem
Mini Panel (for nesting panels) Nope – can’t nest webparts Widget Layer CotentArea (for nesting blocks) Zones inside Parts
Region or Pane WebPart Zone Zone Zone (for webparts),
Editor Zone (for widgets)
CotentArea Zone
Main Menu TopLink bar Main Menu Top Menu
Book Navigation BlockPage w. View QuickLaunch Left Menu
Menu Menu Footer Menu
Page or Panel Page Page Page Widget, Page Page Page Content Page(Type), ContentItem
Token Token
Rules Workflow Workflow, Rules Workflow Workflow
Module (installable Plugin) WSP package (Farm or User solution),
App
ModuleLink Module (installable Plugin) Module Add-On Nope
Module (activateable) Feature Feature Module (activateable) Nope
Panels Everywhere MasterPage MasterPage MasterPage MasterPage
Theme Theme Theme Theme Nope Theme
 Panel Layout. Link – Link2 – Link3 Page Layout Layout Page Template Page Template = Layout + WebParts
Display Suite Content Template Form Layout Nope
Taxonomy, Tag Term Store Taxonomy, Tag Classification, Category, Tag Category Nope
Personalize User Profile Audience (only authenticated) Widget Layer Rules Content Personalization Content Personalization, Link Targeting
Site or one Organic Group Web (Scope) Site Site
Distribution Web Template Website template NuGet package
Multi Site (without common admin) or Organic Groups Site (Scope) = SiteCollection Multisite Sites Yes Multiple sites
Nope Site Template Nope Nope Nope
Nope WebApp (Scope) Nope Nope Nope Nope
Nope Farm (Scope) Nope Webfarm Nope Nope
Storage API, Cloud Files RBS Azure Blob Storage (Dropbox?) Azure Storage, Amazon S3 AmazonS3FileSystemContentProvider BLOB Provider Azure Blob storage
Drupal
Comments
SharePoint
Comments
Orchard
Comments
Sitefinity
Comments
Kentico
Comments
MonoX
Comments
Ingeniux
Comments
EPi server
Comments
N2 CMS
Comments
Pros

  • Very modular
  • There is a module for everything
  • Module and Theme Deployment
  • Block can be nested with Panels

Cons

  • Having common permission for multisites is difficult
  • Setting Page level Permissions is difficult
  • No inheritance in Content Types
  • Sites don’t upgrade easily between major versions

Conclusion

Good webapp builder w. ContentTypes, Views, Panels, Rules.

Page handling is not intuitive.

Pros

  • Farm features
  • Inheritable Content Types
  • Packages, Sites and Features can have different scopes

Cons

  • Resource heavy
  • No ASP.NET MVC
  • No personalization on anonymous
  • Difficult to work with MasterPages – due to SP provided HTML
  • Sites don’t upgrade easily between major versions

Conclusion

Outdated due to no ASP.NET MVC support

Pros

Cons

Conclusion

Good webapp builder w. ContentTypes, Projections, Layouts, Rules.

Looks a lot like Drupal

 

Pros

Cons

  • No customizable ContentTypes
  • Base on aspx – extended to mvc

Conclusion

Outdated due to born on WebForms.

Stands out with  having dev env in cloud and App Builder

No customizable ContentTypes => Not a complete CMS

 

 

Pros

  • Lots of rules for Personalization
  • Can Use Azure Web and Worker role making it easily PaaS scalable
  • Inheritable DocumentTypes

Cons

  • Base on aspx – extended to mvc

Conclusion

Outdated due to born on WebForms.

Possibly the cheepest .NET CMS to scale in public cloud due to PaaS deployment

Looks a lot like SharePoint

 

 

 

 

 

Pros

  • Mobile CMS using jQuery Mobile

Cons

  • No trial download or documentation

Conclusion

Seem to be a good mobile CMS

Pros

  • Blocks can be nested
  • Multisite Page handling
  • Site and Add-on Deployment
  • Responsive OOTB

Cons

  • No customizable ContentTypes
  • No customizable Pages
  • Developer centric
  • No themes

Conclusion

No customizable ContentTypes => Not a complete CMS

Pros

  • Multisite Page handling
  • Themes

Cons

  • No customizable ContentTypes
  • No customizable Pages
  • Developer centric
  • Little documentation
  • No edible workflow
  • No taxonomy

Conclusion

  • No customizable ContentTypes => Not a complete CMS
  • Use with existing webapp
  • Alpha version of Admin Web
eBooks,
My Blogs
eBooks,
My Blogs
eBook,
My Blogs
Vids Tutorial, Guide, API PDF User Manual, API PDF User Guides PDF PDF

Maybe concepts like Sharepoint Shared Service Provider can map to services in D8 exposing WebServices?

Drupal Links

Orchard Links

Sitefinity Links

Kentico Links

MonoX Links

Ingeniux Links

EPiServer Links

N2 CMS

Comparisons

Other Links

Ongoing…

The End

Visiting Drupalhagen.dk 2013

Filed under: Drupal — rasor @ 12:34 am

Drupalhagen.dk is a conference in the center of Copenhagen.

My blog from 2012.

Sessions are:

Friday 8. November:

12:30 Välkomst bavl / Welcome to DrupalHagen!
12:45 Introduction to new technologies in Drupal 8
13:45 Editing Experience
15:00 Lightning talks

- Extending Google Drive to Drupal
– Destructible Developer Environments
– More to come.
16:00 Plugins into D8
17:00 – 17.45 Content strategy and platform architecture

Saturday 9. November:

11:00 Migrating bibliotek.dk to Drupal 7
12:00 Frokost
13:00 Front-end Automated Testing
14:00 Phone is ringing, oh my god! Give your clients support they need…
15:00  The Amazing Jeffrey A. McGuire a.k.a. jam
16:00 TWIG it

(more…)

November 5, 2013

NFC and RFID notes

Filed under: Arduino, NFC/RFID — rasor @ 11:37 pm

I just read about NFCRing. It has a public and a private ID. The public part you can use for sharing your address by touching a NFC phone. The private part you can use for unlocking doors and you phone.

NFC in phones is a wireless technology like bluetooth, but with a much smaller range (< 20 cm). When the range is so low no approval is needed (unlike bluetooth) when the receiver connects.
NFC also is compatible with RFID. The phones can both work as initiators and receivers. Initiators/senders must be powered (Active), but the receiver can be unpowered (Passive) – just like RFID chips. This is also true for the phones.
Read more in Professional NFC Application Development for AndroidRFID Handbook and Getting Started with RFID.

In DK there is a ID supplier ID-Advice (in danish) who both delivers NFC/RFID knowledge and products. They used to be RFID specialisten before changing name.

I blogged about Accelerometer, RFID and SMS usage before. At that post the accelerometer was a Wii NunChuck . Nowadays the accelerometer is build into the mobile phone.

The End.

November 3, 2013

Building a retail company

Filed under: Biz, Cloud, Hosting, PHP — rasor @ 11:09 am

Updated: 2013-12-12

How do you build a company in a PHP hotel with possibly SaaS connections?

It would be nice to get an overview of what kind of SW could be relevant.

This list is divided in three levels:

(more…)

September 25, 2013

jQuery Mobile, AngularJS and PhoneGap – getting started – Part1

Filed under: Android, iPhone, Js/Html, PhoneApps, WinPhone, WinRT — rasor @ 6:16 pm

Last updated: 2013-10-18

I want to develop with jQuery Mobile (jQM), AngularJS and PhoneGap on Windows8, x64.

  • Part 1 (this blog): Install Editor, PhoneGap and Android (emulator)

You can get further info on these links:

(more…)

September 23, 2013

QuickStarts site

Filed under: Book, Study — rasor @ 8:41 pm

What a great QuickStart site: http://refcardz.dzone.com/

Curently it contains this list:

(more…)

September 4, 2013

C#: Inline code with FluentValidation

Filed under: C#/Xaml — rasor @ 8:40 am

Replacing function with inline function

With function:

public ProductXValidator(){
    RuleFor(product => product.someprop)
        .Must(CheckValueGT0)
}
public static bool CheckValueGT0(ProduktBaseModel product, int value)
{
    return (value > 0) ? true : false;
}

Advantage: You can put a breakpoint in the function.

using inline function:

public ProductXValidator(){
    RuleFor(product => product.someprop)
        .Must((p, v) => { return v > 0; }) //as above, but inline
}

The End.

Windows in Mac – Boot on the iron

Filed under: Hosting, OS, Osx, Windows — rasor @ 6:59 am

Just heard that it is now possible to boot Windows images on the iron in Mac using Boot Camp.

So why not do the opposite: Run Osx on the iron of a Fedora Linux with Xen hypervisor. Then get a Mac for ½ price ;-)

The end.

August 27, 2013

Bitmap 2 vector – Tracing scanned drawings

Filed under: GraphicDesign, Unix, Utility, WinApps — rasor @ 8:05 pm

I wanted to try to create a smooth digital image by converting a scanned drawing to vector.

(more…)

August 18, 2013

64-bit Drivers

Filed under: HW — rasor @ 5:25 pm

Some older peripheral HW devices connected to computers often don’t ship with 64-bit drivers.

This post will contain such drivers to HW I’ve been lucky to find the drivers for.

Lexmark X1170 All-In-One inkjet printer

The end.

August 12, 2013

Powershell: Scheduling a task

Filed under: Administration, Deployment, Powershell — rasor @ 7:11 am

A sample for scheduling a job (myjob.exe) in task scheduler.
Link to Gist

You need to run myjob.bat as admin to schedule myjob.exe. (more…)

August 1, 2013

BSOD with new PC and old SSD – Now better

Filed under: HW — rasor @ 6:36 pm

I bought a new PC.
Before boot I plugged in the SSD from my old PC and just wanted to boot on that.

Not so lucky! Arg!

There has been lots of issues and still is.

(more…)

April 20, 2013

Webcast: Rethinking the Possibilities of Browser-based Apps with HTML5

Filed under: Js/Html — rasor @ 12:50 am

Just watched Webcast: Rethinking the Possibilities of Browser-based Apps with HTML5

Presenters: Jeff Burtoft @boyofgreen, Jesse Cravens @jdcravens | March 27, 2013

Links

Visit O’Reilly Webcasts to see all upcoming FREE webcasts and archived events. @OReillyWebcasts

 

April 18, 2013

OpenID: HowTo implement?

Filed under: Identity Management, OpenID-SAML — rasor @ 6:25 pm

I just fell over an announcement from Fedora community:

New Fedora openid provider (fas-openid) in service

Though it could be nice to keep if I got the need to implement an OpenID Identity Provider (IP). (more…)

April 4, 2013

SP2010 Monitoring and Troubleshooting

Filed under: Administration, SharePoint, Toubleshooting — rasor @ 6:51 am

This post I will use to add a list of a few articles and tips regarding SharePoint Monitoring and Troubleshooting. (more…)

March 24, 2013

CPU: Can you live without VT-d?

Filed under: HW, Virtual — rasor @ 2:01 pm

Last updated: 2013-10-18

Three years ago I got myself my first I7 laptop – a Dell Studio 1557. (Here is an analysis from that time)

The CPU i7-720QM Processor (6M Cache, 1.60 GHz)  only supports up to 8 GB RAM, the USB bus’s are only 2.0, so now it might be time for an update. I could use some more RAM for SharePoint.

Just by scanning the weekly advertices I noticed HP Pavilion G6-2209eo.

Its CPU is i7-3632QM Processor (6M Cache, up to 3.20 GHz) rPGA. This one supports up to 32 GB RAM and of course has USB 3.0 now. But it does not support direct I/O (VT-d) for my virtual guest.

Can I live with that? I think not. It is important to me that the virtual guests are fast. With USB 3 I could let the guest live on an external SSD drive, but I think this VT-d must be just as important for speed.

(more…)

March 23, 2013

Online services

Filed under: WebApps — rasor @ 5:31 pm

I want to use this blog post as a categorized list of online services.

It is not meant to be a full list of all, but rather the ones that are currently useful.

The initial list is a Screen-scrape from teambox.com  (more…)

Blog on Feedburner

Filed under: Blog, WebApps — rasor @ 11:41 am

I just added the RSS feed from this blog to http://feeds.feedburner.com/rasortechblog

Feedburner

So what did it give that the RSS feed does not already give?

  • Easy way to add your feed to a whole lot of feed readers, which could help your subscribers.
  • A whole lot of sharing possibilities (called FeedFlare) for each blogpost – see the all the links above.

(more…)

March 13, 2013

Online diagrams

Filed under: Blog, Js/Html, WebApps — rasor @ 11:31 pm

I was looking for an online replacement Visio for creating diagrams online for blogs.

I was delighted to find Draw.Io. It has a lot of great features for integration with other products

  • When you connect with your Google account, then diagrams are automatically saved to your Google drive.
  • There is a Google App plugin that makes the diagram in Google drive open into draw.io
    OpenDiagramFromGoogleDrive (more…)

March 7, 2013

Ranking

Filed under: WebApps — rasor @ 10:21 pm

When you want something ranked on the web there are many possibilities

Sending Visitor data to a ranker:

Lets users rank some content

Ongoing…

Then End

March 4, 2013

SQL: Apply or Join?

Filed under: SQL — rasor @ 8:10 am

Nice to have article:

I was notified about an article comparing SQL Apply and Join.

Quote :

APPLY operator is required when you have to use table-valued function in the query, but it can also be used with an inline SELECT statements.

The End

March 3, 2013

FireFoxOs – First touch

Filed under: FireFoxOs, PhoneApps — rasor @ 4:20 pm

I noticed somewhere that FireFox now has made a mobile OS called FireFoxOs.

The FireFoxOs can be installed on some devices – not sure which. Of course it is free like other OpenSource.

You code in html/js, so maybe this would be a great base app for the other OS’s? Thinking:

  • Develop a Mozilla App for FFOS.
  • For the other platforms: Make use of hybrid apps where a device’s app hosts a browser, that calls out to the app in order to get device specific services, if they are not available through html 5.

(more…)

February 15, 2013

VS: PowerGui Vsx

Filed under: Powershell, Script, Visual Studio — rasor @ 8:59 am

There is a PowerGui plugin for VisualStudio.

Currently on the download page latest version is PowerGUI VSX 1.5.5 Requires PowerGUI 3.2

But the latest version PowerGui is 3.5.0.2293. That version makes the vsx fail, when trying to open a .pssproj project file.

A workaround to fake PowerGui version 3.2:

Change in registry (do that by hand since the place is user specific). Change from:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\7954EF75A505E6B43A4F29B46702BD32\InstallProperties]
"DisplayVersion"="3.5.0.2293"
"VersionMajor"=dword:00000003
"VersionMinor"=dword:00000005

Change to:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\7954EF75A505E6B43A4F29B46702BD32\InstallProperties]
"DisplayVersion"="3.2.0.1"
"VersionMajor"=dword:00000003
"VersionMinor"=dword:00000002

Now you should be able to create and edit a project of type PowerShell Script project (.pssproj)
Disclaimer: Changing in registry is on own risk.

 

If you need to run PowerGui with SharePoint2010 or older (.NET 3.5) then you need to edit the config file of PowerGui according to Avni Bhatt’s article.

In C:\Program Files (x86)\PowerGUI\ScriptEditor.exe.config comment out one line:

<!–- <supportedRuntime version=”v4.0″ sku=”.NETFramework,Version=v4.0″ /> -–>

If not changed, then you get the exception: “Microsoft SharePoint is not supported with version 4.0.30319.269 of the Microsoft .Net Runtime.”

The End

February 11, 2013

VS: ProjectTypeGuids and file-types

Filed under: Visual Studio — rasor @ 1:55 pm

Last updated 2013-09-11

I was missing a project type for my Visual Studio installation. Some are identified by file type and some by ProjectTypeGuids.  There might be other ways, too.

The project type Guids are stored in the registry key

  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\<version>\Projects\ or
  • HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\<version>\Projects\

(more…)

VS2012 developer databases

Filed under: SQL, Visual Studio — rasor @ 10:49 am

Last updated: 2014-07-10

With VS2012 a new developer database installs.

The new connection string is in web.config

Data Source=(LocalDb)\v11.0;

Data Source=(LocalDb)\v11.0;

For EF and VS2012:

 <connectionStrings>
 <add name="MyEfEntities"
 connectionString="metadata=res://*/IL.MyEf.csdl|res://*/IL.MyEf.ssdl|res://*/IL.MyEf.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=(localdb)\v11.0;Initial Catalog=MyEf;Integrated Security=True;Pooling=False&quot;"
 providerName="System.Data.EntityClient" />
 </connectionStrings>

In VS2010 the Dev DB was SqlExpress. You can still use it from VS2012, if you need.

 <connectionStrings>
 <add name="MyEfEntities"
 connectionString="metadata=res://*/IL.MyEf.csdl|res://*/IL.MyEf.ssdl|res://*/IL.MyEf.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\SQLEXPRESS;Initial Catalog=MyEf;Integrated Security=True;MultipleActiveResultSets=True&quot;"
 providerName="System.Data.EntityClient" />
 </connectionStrings>

If you still need VS2010 installed you can probably do with only selecting Visual C# and Visual Web Developer as installation options.

Info

The instance name “(localdb)\v11.0″ is a logical name mapped to a physical instance in a format like this: “MyPc\LOCALDB#6792664E”.

It will physically install the DB into the current logged in user: C:\Users\<username>\AppData\Local\Microsoft\Microsoft SQL Server Local DB.

It seems like this will enable each user using the PC to have its own sandbox of VisualStudio projects and databases. VS can then use the logical name “(localdb)\v11.0″ for all users.

Uninstalling localdb

When you uninstall either

  • by running the installation file SqlLocalDB.MSI – choose remove or
  • from ControlPanel – Programs – “Microsoft SQL Server 2012 Express LocalDB”

then not all is removed. You also need to

  • delete the folder C:\Users\<username>\AppData\Local\Microsoft\Microsoft SQL Server Local DB
  • delete keys in HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server\UserInstances
  • optionally delete keys in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Local DB\Shared Instances

 

The End.

February 10, 2013

Agile Project managent

Filed under: Agile, Scrum, TFS — rasor @ 12:29 pm

Did you ever wonder why project management (PM) have to be more than a Scrum slide?

Here is some good resources when PM becomes more than a slide: (more…)

January 28, 2013

Android Intro

Filed under: Android, PhoneApps — rasor @ 8:16 am

I should have attended an intro to Android development, but missed, unfortunately.

But I got a link to the Slides: https://confadmin.trifork.com/dl/2013/GOTONights/Android%20Goto%20Night%2024-01-2013.pdf (more…)

January 23, 2013

SP2010: A 2 Level Suckerfish Dropdown with V4 styling

Filed under: Js/Html, SharePoint — rasor @ 12:20 pm

This sample is a modified version of a 2 Level Suckerfish Dropdown styled for Sharepoint V4.

Thanks to Patrick Griffiths.

(more…)

Linq: Sorting a Splitting a 1 level list to a 2 level list

Filed under: C#/Xaml, LINQ — rasor @ 12:06 pm

Nice to have.

This sample converts the 1 Level list of ProjectLink’s to a sorted 2 Level list of BizArea’s

(more…)

January 15, 2013

SQL: Samples

Filed under: C#/Xaml, EF, SQL — rasor @ 11:28 am

Last updated: 2013-05-08

HowTo Retrieve Values in StoredProcedures from EF

Retrieve RAISERROR/PRINT/RETURN values from ‘multiple resultsets.

http://support.microsoft.com/kb/310070

http://support.microsoft.com/kb/194792

In this sample a StoredProcedure has been added manually to a EntityFramework edmx file.

The StoredProcedure returns a returnvalue (RETURN 0) and a resultset (SELECT something)

using System.Linq;
using System.Data.EntityClient; //EntityConnection
using System.Data.Common; //DbConnection
using System.Data; //CommandType
using System.Text;
using System.Data.SqlClient; //SqlParameter

        protected void Button1_Click(object sender, EventArgs e)
        {
            TextBoxOutput1.Text = EdmStoreJobs.ExecCleanUpJob().ToString();
        }
        public static string ExecCleanUpJob()
        {
            string result = "";

            using (MySvcEntities db = new (MySvcEntities())
            {
                //Execute SP
                EntityConnection entConn = (EntityConnection)db.Connection;
                using (DbConnection storeConn = entConn.StoreConnection)
                {
                    DbCommand cmd = storeConn.CreateCommand();
                    cmd.CommandText = "SP_CleanUpJob";
                    cmd.CommandType = CommandType.StoredProcedure;
                    SqlParameter retval = new SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int);
                    retval.Direction = System.Data.ParameterDirection.ReturnValue;
                    cmd.Parameters.Add(retval);

                    StringBuilder sb = new StringBuilder(4000);

                    bool openConn = cmd.Connection.State == ConnectionState.Closed;
                    if (openConn)
                    {
                        cmd.Connection.Open();
                        var reader = cmd.ExecuteReader();
                        var response = "";
                        //There is only one resultset with one row and one column, which is a string
                        if (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                response = reader.GetString(0);
                                //Console.WriteLine("{0}\t{1}", reader.GetInt32(0),reader.GetString(1));
                            }
                        }
                        else
                        {
                            sb.AppendLine("No rows in reader");
                            //Console.WriteLine("No rows found.");
                        }
                        reader.Close();

                        var ihaserrors = (int)retval.Value;
                        var haserrors = (ihaserrors != 0);
                        if (!haserrors)
                        {
                            sb.AppendLine("No errors.");
                        }
                        else
                        {
                            sb.AppendLine("Errors!");
                        }

                        //The responsestring is an array separated with ;
                        char[] splitters = { ';' };
                        var responsearr = response.Split(splitters);
                        foreach (var line in responsearr)
                        {
                            sb.AppendLine(line);
                        }

                    }
                    else {
                        sb.AppendLine("Wrong connection state");
                    }

                    result = sb.ToString();
                }
            }
            return result;
        }

Select date n-th month ago

I need a date some month ago to put in a WHERE clause:

	DECLARE @monthago int = 6
	DECLARE @monthagodate datetime
	-- Select date x month ago
	SET @monthagodate = DATEADD(month, -@monthago, GETDATE())
	-- Select midnight at x month ago
	SET @monthagodate = DATEADD(dd, 0, DATEDIFF(dd, 0, @monthagodate))
	Print @monthagodate

Output:

Jul 15 2012 12:00AM

Thanks to  Alex Bagnolini and Aku

Transaction sample – 2005+

	DECLARE @ErrMsg nvarchar(4000), @ErrSeverity int
	BEGIN TRY
		BEGIN TRAN one

		--//STP BODY
		PRINT 2 / 0 -- throw error

		COMMIT TRAN one
	END TRY
	BEGIN CATCH
		IF @@TRANCOUNT > 0
			ROLLBACK TRAN one

		SELECT @ErrMsg = ERROR_MESSAGE(),@ErrSeverity = ERROR_SEVERITY()
		PRINT @ErrMsg
		RAISERROR(@ErrMsg, @ErrSeverity, 1)
	END CATCH

Output:

Divide by zero error encountered.
Msg 50000, Level 16, State 1, Line 16
Divide by zero error encountered.

Thanks to Naor

Converting int to String

	DECLARE @counts as int
	SELECT @counts = count (*) from SomeTable; Print 'SomeRows: ' + Cast(@counts AS varchar)

Output:

SomeRows: 11

Implement list paging with SQL

Comparing performance for different SQL Server paging methods

The End

January 12, 2013

Moving Drupal site to a new webhotel

Filed under: Deployment, Drupal, Hosting — rasor @ 5:44 pm

I need to move a Drupal site to a new webhotel. This is a small StepByStep guide.

(more…)

January 7, 2013

Git for Visual Studio

Filed under: Deployment, Hosting, TFS, Visual Studio — rasor @ 10:37 pm

Last updated: 2014-06-04

I want to start using an online source code storage.

Azure has recently come out with Team Foundation Service. This is really cool. You both get an IssueTrackingSystem as a TFS Project Template e.g. Scrum and VersionControlSystem e.g. GIT – all in the cloud. You can get a free trial. See more on TFS at the links in the bottom of this post.

What do I want with the code in the future? I don’t know. So I will start with BitBucket instead. BitBucket provides GIT as a choice of VCS.

With this blog you set up your private version controlled code repository (repo).

After having learned to setup your own repo then you might want to fork an opensource repo and contribute back to the community. Doing fork right is not straight forward read here to see a great forking workflow. GitHub has a more comressed forking workflow here.

If you, like me, is new to GIT – then you might want to read this great free eBook Git Succinctly from Syncfusion (and checkout other free eBooks in their library). Or another free eBook Pro GIT.

Git Succinctly Pro GIT

 

(more…)

January 6, 2013

WinRT API learning – 70-481 Lazy dog

Filed under: Js/Html, WinRT — rasor @ 2:14 pm

Last updated: 2013-04-26

Links to some other of my posts on WinRT

This post should make it easier to navigate and remember the WinRT and WinJS API.
“‘Cause I still – haven’t paaaassed – 481″ – U2? (more…)

List of JavaScript libs and utils

Filed under: Arduino, Cloud, Deployment, Hosting, Js/Html, MVC, MVVM, SQL, Utility, Web API — rasor @ 12:08 am

Last updated: 2014-06-20

In this post I will add JavaScript libraries and utilities that I might want to reuse at some time.

HTML5 for .NET Developers
Collections of libs

December 29, 2012

New Google groups

Filed under: Notes, WebApps — rasor @ 6:24 pm

Old Google groups are soon disappearing. Will be replaced by New Google groups.
Don’t worry – the old groups are reachable from the new link.

December 16, 2012

Cross Platform Phone Apps – what choices?

Filed under: Android, iPhone, PhoneApps, WinPhone — rasor @ 1:22 pm

Last updated: 2013-11-29

With the demand of mobile friendly apps I needed to show what pros and cons there are with different choices.

On the top of the iceberg we have three categories

  1. Web apps running in a browser
    • ASP.NET MVC (C#, Js), PHP, Ruby etc.
  2. Native apps with an intermediate common language/build step
  3. Native apps
    • WP (C#, VB, C++), Android (Java), IOS (Objective-c) etc
    • IdeaBlade DevForce Windows Store (C#) – WinStore, WP8, Desktop.

(more…)

December 14, 2012

Powershell: Print SP UserProfile properties

Filed under: Powershell, SharePoint — rasor @ 12:25 pm

Here is a script that prints the SharePoint 2010 UserProfile properties

(more…)

December 12, 2012

Xen hypervisor

Filed under: Linux, OS, Virtual, Windows — rasor @ 7:14 pm

Last updated: 2013-07-06

I would like to get a thin virtual host to be host for some OS’s amongst Windows 8.

A few years ago I was playing – for a short while with Hyper-V Server 2008 without GUI. I suppose I did not find a nice Quick-start for Shell setup of the guests. Remote setup was not possible due to lack of HW.

Hyper-V Server 2012 still has no GUI. It is easiest to manage the server remotely with Hyper-V Manager.

So now I am looking around for a replacement.

(more…)

Older Posts »

The Silver is the New Black Theme. Create a free website or blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.