w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
In Umbraco 6, what is the best way to save and publish a list of nodes with ContentService?
You are correct there is no Publish or SaveAndPublish option that takes in an IEnumerable like the Save method. It could be handy as it could save some lines of code. The most valid option currently to achieve what you want is to do the following. var cs = ApplicationContext.Current.Services.ContentService; foreach(var content in yourListOfContentItems) { cs.SaveAndPublish(content); } Saving your list before publishing by calling Save method isn't really going to make any differences to you as if Umbraco detects there is new content in your list it processes each individually. And from what I can tell doing that and then calling Publish after is not going to save you any cycles either because the Publish method calls the same SaveAndPublishDo method that SaveAndPublish calls. So mi

Categories : C#

WPF Combo and Rx FromEvent Pattern
I think that the operator you are looking for is Switch(). I couldn't find an msdn page for it, but this is the signature you're after: public static IObservable<TSource> Switch<TSource>(this IObservable<Task<TSource>> sources) That will take an IObservable<Task<T>> and turn it into an IObservable<T> which produces the results of the most recent Task<T> received. Here is an example implementation that doesn't use any MVVM, but I'm sure you can see how it would apply: MainWindow.xaml <Window x:Class="LastFromCombo.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid>

Categories : Wpf

In Umbraco 6.1.1 MVC 4, how can I do a form post back to a surface controller using a model that inherits from Umbraco's RenderModel?
Ok, I've had no responses to this question but am now in a position to answer it myself. Maybe it was a fundamental oversight, but not that obvious imho, and information on the Umbraco forum etc about inheriting from RenderModel is fairly limited. Essentially the answer, as was my first instinct, is to solve the original exception "No parameterless constructor defined for this object" by providing a paramaterless constructor. The difficulty is working out what to put inside the parameterless constructor for my model, since it inherits from the Umbraco RenderModel which requires an IPublishedContent instance passed to it's constructor. Luckily while browsing around I happened across this post on the Umbraco forum: http://our.umbraco.org/forum/developers/api-questions/40754-Getting-Curre

Categories : Asp Net Mvc

Authenticate user to ContentService
I have asked about the same thing here and the answer is NO. You must expose the currently logged in user directly with the authorization requests from the script.

Categories : Google Apps Script

Get Title and Published Date of All posts published in Blogger Site using PowerShell
You are looking at a wrong URL. Look at the RSS feed URL. Invoke-RestMethod -Uri http://www.vinithmenon.com/feeds/posts/default Now, explore the properties like title, etc

Categories : Arrays

Umbraco MVC Implementation - View does not depend on Umbraco implementations
No you can't. Simply because all requests pass through a single action. In order to retrieve a path to a CMS-managed page, you need to use the node/content traversal the @Model provides. See here for more details on this. Edit To clarify, the author of the article is suggesting that the Umbraco implementation should be more in line with a traditional MVC implementation with little or no logic in the views. Therefore, any querying of node data should happen prior to the view (e.g. in the Mappers). So this is where you would have to retrieve the links. Umbraco's default MVC implementation forces all requests to go via a single action on a single controller. The author's implementation allows the requests to be shared across one controller per document type - which is better IMO. But it st

Categories : Asp Net Mvc

URL rewriting not Working in Umbraco
Try this: <add name="redirect_brands" redirect="Application" redirectMode="Permanent" virtualUrl="^~/brand/(.*)" rewriteUrlParameter="IncludeQueryStringForRewrite" destinationUrl="/$1" ignoreCase="true" /> I think you're missing the ~ in the virtualUrl

Categories : Asp Net

Umbraco MediaService / Umbraco MediaItem not saving
To Save media, I found this method with MediaService. However, I think it's possible another method more refined [HttpPost] public JsonResult Upload(HttpPostedFileBase file) { IMedia mimage; // Create the media item mimage = _mediaService.CreateMedia(file.FileName, <parentId>, Constants.Conventions.MediaTypes.Image); mimage.SetValue(Constants.Conventions.Media.File, file); _mediaService.Save(mimage); return Json(new { success = true}); }

Categories : C#

Umbraco - error when using umbraco.library:NiceUrl(...)
Ok I found a solution: I added an extra check to this part: <!-- Return the url --> <xsl:if test="$i = $max"> <xsl:if test="$id != '' "> <xsl:value-of select="umbraco.library:NiceUrl($id)" /> </xsl:if> </xsl:if> this fixed my problem.

Categories : Xslt

Colorbox code working outside of Umbraco, but not within
This looks like a problem with how you have implemented your script in Umbraco. Just looking through Chrome's browser inspector, I can see that your script is failing to find the colorbox objects which means that something is prevent the library from being available. This is usually because a dependent javascript library has failed. Looking at your source code, you are loading all your jQuery libraries at the bottom of your page. This is good practice, but you have placed your a second jQuery file reference, your colorbox file references and the custom colorbox code in the head of the page. There are several things you will need to do: Remove the jQuery reference from the head of the page; Move the colorbox file references to the bottom of the page, after all the other javascript file

Categories : Javascript

Umbraco Rest Extension Not working after moving code from 4.7.1 into 4.11.10
Most probably your code is throwing an exception and this gets converted to a 500 error that masks it. So the problem could be anything. I had the same issue and the best thing I did was wrap all my code inside a try/catch and return the exception as a string. Remember that in order to get all the info from the exception you need to compile in Debug mode and copy the .pdb file along with your .dll. ... [RestExtensionMethodAttribute] public static string GetCountries() { try { return Core.RazorRenderer.RenderScriptFile("LandingPage/GetCountries", 0, GetLandingParameters(false)); } catch (Exception e) { return e.ToString(); } } ... Hope this helps you find the problem ! It worked for me.

Categories : C#

Could not locate Razor Host Factory type: umbraco.MacroEngines.RazorUmbracoFactory, umbraco.MacroEngines
If you are trying to host the blogengine site within a virtual directory of the Umbraco site, then you will have to amend the blogengine web.config to "remove" all the Umbraco-specific handlers and modules, as these will be inherited by the blogengine application, causing this exception because the application can't find the relevant DLLs in its bin folder. I recently had a similar problem and I have posted the web.config I used in the virtual directory below. Mine was a very simple web application, so obviously this will not work by itself in your blogengine app. You will need to add the relevant parts into your web.config file. Also, this was for a v6 Umbraco install in IIS7.5, so you may have to experiment a little. <?xml version="1.0"?> <configuration> <configSecti

Categories : Iis

Observable.Create doesn't work and Observable.ToEnumerable blocks indefinitely
This is incorrect: var observable = Observable.Create<int>(o => new Action(() => { o.OnNext(0); o.OnCompleted(); })); You meant to provide a function that calls OnNext upon subscription. However, you've inadvertently called the wrong overload of Observable.Create and provided it with a function which does nothing but create an action (which will be called upon disposal of the subscription). So (by mistake), you're trying to call OnNext only when the subscription is disposed. This is what you meant to do: var observable = Observable.Create<int>(o => { o.OnNext(0); o.OnCompleted(); return () => Console.WriteLine("Disposed!"); // this will be called when // subscription is disposed }); Or t

Categories : C#

Make observable arrays created via ko.mapping.fromJS not have observable elements
You can use the mapping plugin create option. From the ko docs (http://knockoutjs.com/documentation/plugins-mapping.html): // The data to be mapped var data = { name: 'Graham', children: [ { id : 1, name : 'Lisa' } ] }; // Your custom data model var myChildModel = function (data) { this.id = data.id; this.name = data.name; }; var mapping = { 'children': { create: function(options) { return new myChildModel(options.data); } } }; var viewModel = ko.mapping.fromJS(data, mapping); From this example the 'children' array will be mapped like an observable array, where the properties are not observables.

Categories : Javascript

knockout updating observable not working for with
Sounds like you've confused a few things with KO the value: on your select element will automatically set the SelectedOffer observable on your ViewModel. There is no need to manually set it which is what I understand you think you are doing with event.SelectedOffer(myOffer); . If you only wanted to update SelectedOffer when the user checked something, you would need to bind value on your select box to a different observable and then manually update your 'real' value I've set up http://jsfiddle.net/HLGKf/ to demonstrate how to set up a simplistic ViewModel and select box, as well as using the with: binding

Categories : Knockout Js

check box observable not working in Knockout.js
http://jsfiddle.net/qxyEG/5/ You are trying to push values into the observable array, but the checked binding is a true / false value unless you specify it's value. Try setting the value to a property in the array and generating the options dynamically like in the fiddle I posted. <input type="checkbox" name="NotifyMembers" data-bind="checked: $parent.selectedChoices, attr: { value: $data }" />

Categories : Javascript

Knockout subscribe to observable in js object within an observable array
Your CoffeeScript syntax in wrong because subscribe is a function on the ko.observable where you need to pass in a callback function as the argument. So the correct syntax is: wol.work_item_id.subscribe (val) -> console.log val So no need for the = which by the way overrides the orginal subscribe with a new function.

Categories : Knockout Js

Why is Observable.Finally not called when Observable.Generate finishes?
Look at the return type of the Finally method; should give you a hint. Just like the Concat method returns a new IObservable with the new sequence concatenated to it, but doesn't change the original, the Finally method returns a new IObservable that has that final action, but you're subscribing to the original IObservable. Put the following line in front of your Subscribe call and it'll work. o = o.Finally(() => "finallY".Dump()); I agree it's an odd API choice though; I'd think of Finally as being more akin to Subscribe than to Concat. You're subscribing to the finally "event"; it's odd that the API forces you to create a completely new IObservable and then subscribe to that just to get the Finally thing to happen. Plus it allows a potential error (made evident if we use the func

Categories : C#

How to do Knockout observable objects inside observable array
If you set up your users in a viewModel and map it with knockout mapping you should get the desired result. Something like: myObservableArray.push(new UserViewModel( {"name":"john","age":21,"address":"No 25"} )); var UserViewModel = function(data){ var self = this; ko.mapping.fromJS(data, {}, self); } This way each of the mapped properties will be an observable and when they change, this will be reflected in your markup.

Categories : Javascript

JsViews/JsRender - updating observable not working
You can't do data-binding with just a render() call. JsRender does string-based template rendering, but does not do data binding in the DOM. There are a lot of examples, such as here http://www.jsviews.com/#jsvplaying and here http://www.jsviews.com/#samples, which you should take a look at... Updated fiddle: http://jsfiddle.net/MNcyg/1/ //$("#div1").html( // $("#template").render(structure) //); $.templates("#template").link("#div1", structure); You need to call the link() method, not the render() method.

Categories : Javascript

Setting observable property of an observable in Knockout.js
try invoking the editedEvent observable first: timelineViewModel.editedEvent().timelineId(0); I got the same error initially in my test case, but that change did the trick for me!

Categories : Javascript

SOLVED: Published swf file not working as intended, but exe file does
SOLUTION: I found the solution here. Basically, I had to specifically allow the debugger version of the standalone flash player to access the C: drive on my system as well as the network. I did this by specifying "access network only" in the local playback security settings (under publish settings > Flash (.swf)), and I created a .cfg file under my "C:WindowsSystem32MacromedFlashFlashPlayerTrust" directory, and wrote "C:" in the first line of the file. This tells the debugger flash player that it can access anything on the C: drive. I also permitted debugging from the publish settings for the .swf file. I hope this helps anyone else who runs up against this problem in the future.

Categories : Actionscript

Adding observable value to another observable
Actually, just removing the = $root.selectedUnit seems to do what you want: value: $data.unit = $root.selectedUnit http://jsfiddle.net/bman654/Y9Caw/2/

Categories : Jquery

URL rewriting in ASP.Net Umbraco
Try: <add name="301_bname" redirectMode="Permanent" ignoreCase="true" rewriteUrlParameter="IncludeQueryStringForRewrite" virtualUrl="^~/brands/(.*)" destinationUrl="~/$1" /> The virtualUrl parameter uses a regular expression to match the incoming URL. You can then use the $1 notation to pass the pattern to the destinationUrl parameter. Since both urls are on the same domain, and (I assume) within your web application, you don't need the redirect="Domain" part, and you can use relative URL paths.

Categories : Asp Net

FileSystemProvider for Umbraco v6.1
Why is it that I spend hours trying to find the answer and then find it soon after I post? The issue was two fold: 1) I should've been implementing IFileSystem (took inspiration from AmazonS3Provider source) 2) the parameter name being passed from FileSystemProviders.config file was not included in the constructor

Categories : C#

Upgrading umbraco from 4 to 6
Yes, according to the bug report you can install a Umbraco v4.11.x and then upgrade this to v6.1.x and this should work fine. The downloads are all available here: http://our.umbraco.org/download However, the easiest way to get Umbraco set up is to use NuGet in Visual Studio. So you could run the following line from the NuGet console: Install-Package UmbracoCms -Version 4.11.10 You'll have to use the console for this because if you use the Package manager, it will just install the latest Umbraco package version. Next, load your site in a browser and configure the database settings. Then upgrade using NuGet again. I find the easiest way to do this is to open the NuGet package manager in Visual Studio, select "Updates", find the Umbraco package and click "Update". This will automatical

Categories : Mysql

How to use RazorPDF in Umbraco 4.11
The best place to start for what you need is here: http://our.umbraco.org/documentation/Reference/Mvc/ But no, strictly speaking you don't need a SurfaceController. You would only need one if you wanted to access the Umbraco context for the requests you are making via the controller. So if you just want to have a controller serve up your PDF, you can have a standard controller implementation. You will have to adjust your routes for this though, and this is all covered in the Umbraco documentation above. Edit: You'll need a route like this: RouteTable.Routes.MapRoute( name: "PdfRazor", url: "PdfCreator/{action}" ); You will also need to add the path to the Web.config for Umbraco to ignore, e.g: <add key="umbracoReservedPaths" value="~/umbraco,~/install,~/pdfcreator" />

Categories : Asp Net Mvc

Bootstrap 3 in Umbraco
As far as I know there is no starter kit, or package for it. But it shouldn't be too tough Create your new Umbraco site first, just a bare bones site, no themes, no kits, no packages(yet) Download the new bootstrap files and add the bootstrap img folder and css files to your StyleSheets folder, add the bootstrap.min.js to your Scripts folder. Make a new master/global template that references all of your bootstrap dependencies Make all other templates use this new template as their master. Hope this helps get you going.

Categories : Twitter

Umbraco throwing 404
Unfortunately both your links are going to the IIS error page as well as all the other errors on the site so we cant tell what you sitemap should be, see this link for tips on how to set up the 404 page http://www.simonantony.net/knowledge-base/articles/how-to-setup-a-404-error-page-on-your-umbraco-site/ . Make sure that's working across the whole site then with you Google site map is it an XML sitemap or HTML sitemap and how have you implemented it did you use a package or made it you self.

Categories : Iis

Umbraco 6.05 on Windows Azure
There are no different in term of how they store the file whether you use Web Sites or Cloud Services as long as you didn't modify the Umbraco. Both Web Sites and Cloud Services keep the file, in this case, the Media folder in their local storage unless you modify Umbraco to save into Blob Storage to have a better scaling. You can write and modify your own custom Media location or try to look at this URL http://our.umbraco.org/projects/backoffice-extensions/universal-media-picker

Categories : Azure

Umbraco not rendering IE box shadows
I'm guessing the link to your css is relative or something, it's got absolutely nothing to do with umbraco - you have full control over the html. Perhaps paste a link to your website or your html code. also for cross browser drop shadows you need something like this -moz-box-shadow: 3px 3px 4px #444; -webkit-box-shadow: 3px 3px 4px #444; box-shadow: 3px 3px 4px #444; -ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#444444')"; filter: progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#444444');

Categories : HTML

Umbraco error "Looks like there's still work to do"
I assume you are seeing the error in the database's [umbracoLog] error table? Have you just migrated your site to a new server? If so, your umbraco.config file may be missing. This is usually why you see the "Looks like ..." message, because nothing has previously been published. Also, check the permissions on the site to ensure that modify permissions have been given to the correct folders. If none of these help, one of your doc types or pages may be corrupt, meaning that when a page or pages of a particular doc type are being saved, Umbraco thinks there should be a particular property on the doc type when there isn't. Check the Umbraco logs in the database [umbracoLogs] table, and see if there is a reference to a particular doc type or page being saved. The solution here would be to

Categories : Asp Net

Umbraco's useage of Tempdata
It depends on how you set up your instances of Umbraco. I have just set a load-balanced website using Umbraco, and although the published website is load-balanced, the Umbraco back office isn't. This is mainly because it doesn't need to be. You would load-balance an application if the traffic was going to be high enough to warrant it, but with the Umbraco back-office, it's possibly unlikely that it is going to have that load of traffic. Check this article out, it explains some of the options available. I set up the published site to be loadbalanced across two servers. Both instances of the published site resolve against a primary domain (www.site.com), but each instance has a unique, non-loadbalanced sub domain (u1.site.com and u2.site.com). The back office has it's own subdomain (admin

Categories : Asp Net Mvc

Umbraco css vs images path
Items stored in the media section will have a path like: /media/<row_id>/filename.ext Where <row_id> is literally the id of the row in the database where the media item's information is stored. One way you can determine the path of the media item is to click on the thumbnail (if it's an image) and copy what is in the address bar. You can also access the file by id via a macro using xslt or razor. Here's a razor example: @{ int imageId = 1069; var media = Library.MediaById(imageId); <img src="@media.umbracoFile" alt="" /> } However, this is a content management system, and you will no doubt have end-users managing the content and, therefore, it wouldn't make sense to place design specific images in the media section. A more full-proof approach would b

Categories : CSS

Where is DefaultRenderMvcControllerResolver located in Umbraco Api
The namespace is Umbraco.Web.Mvc but only available from v6.1 onwards I think. All the code is open source and available at https://github.com/umbraco/Umbraco-CMS

Categories : C#

Image rendering in umbraco
So when it doesn't display the images does it not display the whole <li> element? From the piece of code you've given there's nothing there about different logic for the different languages. What if in your XSL template you remove this whole chunk of code and just take it back to basics. <li>test</li> I suspect that the language choice is messing something else up somewhere else in the page. Just try simplifying the page one step at a time by removing the Macros.

Categories : Asp Net

Running Umbraco / Mono on OS X
I fairly sure you can't run Umbraco on OSX. However, there are members of the community working on Mono-specific ports of Umbraco. Check out Strawberry Fin's blog for details: http://www.strawberryfin.co.uk/blog/2013/02/02/umbraco-6-is-out-mono-roadmap/

Categories : Osx

Umbraco add CC while sending mails
Umbraco's SendMail() helper method is (purposefully) very basic. It is actually only a few lines that creates a MailMessage instance with the from and to values and sends it via the SmtpClient.Send() method. The ToMail parameter can actually accept multiple email addresses, presumably comma or semi-colon delimited. But these would not be CC recipients. You would actually be be better off just creating your own method.

Categories : Api

Umbraco quotation marks
Actually I don't think it is putting quotes round it, that's just how your browser is showing the rendered value in its code view. What is happening is that the XSLT is outputting the value as an encoded string instead of unencoded HTML. You need to add the attribute disable-output-escaping="yes" and the outer p tag: <div><xsl:value-of select="./broed" disable-output-escaping="yes" /></div>

Categories : HTML

Get umbraco property with inline C#
If you know the node ID, you could just use new Node(id).GetProperty("protectContent").Value.ToString() == "1" However, if you are on the page you wish to query, you can just use: Node.GetCurrent().GetProperty("protectContent").Value.ToString() == "1" If I'm using masterpages, I like to have a CurrentNode accessor in my codebehind .cs file that returns Node.GetCurrent() but has a backing field so it is not requested each time I call it, e.g. public partial class BaseMaster : System.Web.UI.MasterPage { public Node CurrentNode { get; set; } protected void Page_Load(object sender, EventArgs e) { CurrentNode = Node.GetCurrent(); } }

Categories : C#



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.