Search

Binary Jam

Simon's blog, SharePoint, Arduino type things.

Adding a Post Feature Activation notification

Recently I’ve been doing some 2010 work on a site which needed a bunch of javascript and some CSS files. Now most of these were deployed to the style library but as you know you often have to check them in etc once deployed.

Rather than figure that out I thought I’d just give a message to the user on activation of the feature

Continue reading “Adding a Post Feature Activation notification”

Pseudo Synchronous Call Queuing in Angular with promises

Here is example code that batches aync ajax calls into blocks of 5 and waits before calling the next set, without blocking the UI thread.

Continue reading “Pseudo Synchronous Call Queuing in Angular with promises”

Posting to Pushbullet via ThingSpeak

A Step by step guide on configuring ThingSpeak to auto post to PushBullet, I use ESP8266’s but the you can use this for anything posting to ThingSpeak.

Continue reading “Posting to Pushbullet via ThingSpeak”

SharePoint 2013 App – AngularJs, BootStrap and ngGrid example

I’ve created a SP2013 App including all the code and published it on Codeplex so anyone can take a look and steal the code get ideas.

It has an example of two data fetch techniques (see my earlier blog post for the third external data using the proxy)

using $http to get REST data or $.ajax to get legacy WebService Data.  With the appropriate angular code to handle either, no antipatterns here.

Perhaps I should have used SPServices instead of $.ajax it would have made it easier and I would not have blatantly nicked Marcs getZrows function (thanks Marc ;-)  )

https://spappnggrid.codeplex.com/

Capture

Last Update:14/10/2014
Organised into folders and separate files for controllers and services. Changed Service to Factory.
(Service code left in project for example purposes)

 

 

Detecting the Language in a DVWP

I have been hunting all morning on how to do this.  I can do it in a CQWP with parameterbinding set correctly but no-one, no-one has put any example code on how to do this in a DVWP.  I’ve read many an article talking about ddwrt functions lists of variables which are not accessible even if you include the xslt namespace.

Eventually I figured something out.  It’s not pretty but then again, what SharePoint is doing isn’t exactly too far removed.

In order for SharePoint to know what browser is being used and what language the browser has to send this information via http headers so we have all the info we need.

 

In you DVWP start by adding a Parameter (I called mine Param1)

image

Set it to a Server Variable

Type in HTTP_ACCEPT_LANGUAGE

and give a a default value, mine says none, but set it to your default language e.g. “en-GB”

That will get you the language codes you need into your XSLT.

 

However those strings can be quite large, e.g.

    en-GB,de-DE, {lots of other stuff}

The bit your interested in, well that’s up to you in my case I care about language, and being British there are no such things as regions just ours and everyone else that’s doing it wrong.

So I have in my XSLT


This grabs the “en” from the string.  If I switch to German then I get “de”

So now I have my language code I can do conditional XSLT based on a language code.

 

This has allowed me to create multi lingual Content web parts in WSS 3. Which is handy.

It’s simple, if someone can point me at a better way please do, I haven’t tested this thoroughly with lots of different browsers and languages so I may need to get a bit cleverer that this simple example.  But for the many of you searching for how to do it, this might be an option for you.

 

Technorati Tags:

List of JS Libraries I’m using / looking into

This is more of a note to myself so that I can remember the JavaScript libraries I’m interested in and what they do and maybe a related article.  These are mainly in dealing with SharePoint but could be anything really.  Not everything is compatible with everything else remember🙂

 

KnockoutJs – Data binding library, works with jQuery, great for a true single page app, IE no routing just data binding.  Yes I know SPA’s pages are called views.

AngularJS – Proper SPA framework, there’s Durandal but I’?m not going there even though I love knockout.

BreezeJs

    – Linq Like queries, does need server side integration, not for local objects

Bootstrap – For that nice CSS layout grids and things.

Bootstrap UI – Directives for Angular using bootstrap

Angular Maps – Google maps directives for angular, something I’ve used already.

 

LinqJs – Linq for JavaScript, will work on JS objects, doesn’t do fetch for you

Js Loaders – http://requirejs.org/  and  http://labjs.com/

jQuery – Well how could I not mention it.

jQuery form validators

Sliders – http://slippry.com/ , http://bxslider.com/, http://workshop.rs/projects/coin-slider/

fontawesome – No idea, well something to do with a shed load of CSS icons, vectors (no IE7)

Charts – jqPlot, http://www.flotcharts.org/, hicharts

Spinner – svg/vml Spinner, easier than a gif ?

 

Stuff to investigate

 

Not a library but a list of handy SP2013 dev tools

Zimmergrens SP2013 Tools Page

SharePoint Designer 2013 – Working round some problems

UPDATE: Really Big Hint, if you are in SPDesigner messing with forms then you’re likely doing it wrong. Seriously, Im not kidding, DON’T crack open SPD and mess with DVWP’s look at Display Templates / JS Link every single time. If you have too then this is still a handy article.

Designer is Buggy. So here are some hints when doing DVWP or DFWP including filtering lookups, where to put the cursor + others.

Continue reading “SharePoint Designer 2013 – Working round some problems”

How to get the SiteCollection Url in XSLT

I found this way to get the root site collection url into a DVWP

There are Global parameters available but you have to mess about with the bindings to use them.

 

So for this one you need

<ParameterBinding Name="RootSiteUrl" Location="WPProperty[RootSiteUrl]"/>

 

Then at the top of the XSL (make it global to all templates)

<xsl:param name="RootSiteUrl"></xsl:param>

 

Then in your XSL you can use it

<xsl:value-of select="$RootSiteUrl" />

 

That’s it. Well it worked for me, but SP2013 and designers is so damn flakey it might not work for you, this was done on a WPPage not a wiki page that causes all manner of hell using webpatrs in those things.

Set Fiddlers Icon based on Connected or Not

Thanks to @ericlaw for the info on this, since version 2.4.7.2 of fiddler you can set the Tray Icon to whatever you want.

I like to know at a glance whether fiddler is connected or not, I leave mine running al the time, I have various issues with proxy servers and virtuals, sometimes it’s just easier to manage the hosts file in fiddler perhaps cos I?’m too lazy to go into admin mode and edit the real one.

fiddlerOff fiddlerOn

I used a simple red / green system you can guess which is which🙂

To do this copy the images to your system somewhere.

Then in Fiddler open the Rules Editor (CTRL-R) and make these changes, just point at your path not mine.

static function OnAttach() {
// MessageBox.Show("Fiddler is now the system proxy");
FiddlerApplication.UI.SetTrayIcon("D:\dev\fiddlerOn.png")
}

static function OnDetach() {
// MessageBox.Show("Fiddler is no longer the system proxy");
FiddlerApplication.UI.SetTrayIcon("D:\dev\fiddlerOff.png")
}

Save it and that’s it.

If they would just give me the option now so a left click on the tray toggles between connected or not and a dbl click open fiddler. Because for me its more than just a debugger now.

Whilst I’m talking changes some more tray options (right mouse menu) that I would love, hope your listening🙂

  •     Toggle Https decryption
  • Select Gateway option (something I have to do all the time, stupid pac file wont work in fiddler)
  • Autoresponder toggle

Blog at WordPress.com.

Up ↑