w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Is it possible to use Umbraco's admin login to secure an external MVC application
The latest versions of Umbraco works right along side managing members with membership, with the standard System.Web.Security. I use Umbraco 6 but it was added after 4.1 I think. A brief summary of setting it up. Create some login forms in Umbraco using the Windows membership code in your controller, (there are many tutorials on the internet). Add a member type in the Umbraco admin members section. Set the defaultMemberTypeAlias to your member type in your web.config. Set up public access by clicking right on your pages in the Umbraco admin content panel. Login and you should see your member in the members section. Add some code to your menu to show and hide member pages. There is a very nice NuGet package with the code to get you started: PM> Install-Package CWS.Umbraco.Standar

Categories : Asp Net Mvc

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

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

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

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#

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

Disable device admin programatically in android
This is not possible AFIK. This is right of user. API will always show a dialog for confirmation about DE-activation of Device Admin Although EDM APIs gives a way where you can do silent DE-activation of Device administrator. So user can not see the UI of deactivation of particular Device admin. But EDM APIs are not easily available, they are for commercial uses.

Categories : Android

disable action in sonata admin bundle CRUD
In your admin class : protected function configureRoutes(RouteCollection $collection) { // to remove a single route $collection->remove('delete'); // OR remove all route except named ones $collection->clearExcept(array('list', 'show')); } Also use routeCollection at top of admin class use SonataAdminBundleRouteRouteCollection; Docs : http://sonata-project.org/bundles/admin/master/doc/reference/routing.html#removing-a-single-route

Categories : Symfony2

Pre-populate and disable select option based on choice in another select box in Admin centre
This is called chained selections, and you will need Ajax and jQuery to make it work. With jQuery, you will "listen" to changes in Photo Event dropdown. Each change dispatches an Ajax call that executes the PHP get_categories command for the Photo Venue and the response is processed by jQuery rendering a new dropdown for the Venue. I'd suggest making a new plugin just to make this part work, and merge it with the main plugin once it's ok. Use this Answer as starting point. You'll find other resources in this search query at WordPress Answers.

Categories : PHP

Flask-Admin & Authentication: "/admin" is protected but "/admin/anything-else" is not
If you go to flask_superadmin/base.py, at line 193 there is the following code snippet: def _handle_view(self, name, *args, **kwargs): if not self.is_accessible(): return abort(403) So maybe this method has to be overriden by AdminIndex to avoid returning abort(403) but to redirect to /login

Categories : Python

How Statamic caches content?
I'm Statamic's founder, so hopefully this answer will be helpful :) Statamic 1.6.x keeps a cache file of all the YAML data for all your pages and entries (markdown files with front-loaded YAML). It's stored as a single big php array and updated when files inside your _content/ folder are changed. This lets you have a really high performance site under most conditions. Statamic 1.7 (not yet released) will break the single cache file into one file per folder (e.g. /blog/, /news/, etc), which will keep any one cache file from getting too large -- an issue present in about .1% of the users. Does that help? Anything else I could answer?

Categories : PHP

PHP caches RAND() variable values
Not sure if you're not doing something wrong, but reseting the random seed generator will do the trick : http://php.net/manual/en/function.srand.php

Categories : PHP

Performance Optimizations - Object Caches
The main question that you should ask is: Is there a performance problem with the way that you are doing it now? If not, then why complicate things. If there is a problem, then profile the app to see if this is where the problem is. If this is it then yes, this sounds like reasonable approach.

Categories : Objective C

How can I create a class that caches objects?
Check out the memory cache class available as part of the .NET framework http://msdn.microsoft.com/en-us/library/system.runtime.caching.memorycache.aspx You'll need to add the System.RunTime.Caching assembly as a reference to your application. The following is a helper class to add items and remove them from cache. using System; using System.Runtime.Caching; public static class CacheHelper { public static void SaveTocache(string cacheKey, object savedItem, DateTime absoluteExpiration) { MemoryCache.Default.Add(cacheKey, savedItem, absoluteExpiration); } public static T GetFromCache<T>(string cacheKey) where T : class { return MemoryCache.Default[cacheKey] as T; } public static void RemoveFromCache(string cacheKey) { Memor

Categories : C#

Does EF caches entities between different instances of DbContext?
Entity Framework doesn't have a data cache per AppDomain, only a cache per context instance. If you create a new context per request or query you start with an empty cache and EF will fetch the data from the database. Moreover, the term "cache per context instance" can be misleading as it doesn't mean that EF won't run queries to the database if the entities are already loaded in the context cache. The way how this cache works and how you can leverage it (or not) is the following: Every LINQ-to-Entities query on a DbSet<T> or generally on an IQueryable<T> will run a database query, no matter if the entities already exist in the context or not. But if an entity with the same key as a queried entity already exists in the context EF will throw the result of that query away an

Categories : Asp Net

Browser caches everything. Even when caching is disabled
This isn't really an issue with angularjs. Just remember though, if you put a meta http-equiv in your index.html that doesn't necessarily mean that those header-overrides will be taken in to account for any files other than the file they reside in. Sounds like it might be a server headers issue. In chrome there is a feature under the development console called 'Network'. I'd take a look at that and see what the headers are on css/js files coming from your app. Having said that, even if the server is sending cache-control headers, disabling cache in chrome should solve the problem so I'm not really sure why that isn't working.

Categories : Caching

AppFabric Syncing Local Caches
I ran some tests and am happy to say that you do NOT need to write any code to ensure that all clients are kept in sync. If you set the following as a child element of the cluster config: In the client config you need to set sync="NotificationBased" on the element. The element in the client config will tell the client how often it should check for new notifications on the server. In this case, every 15 seconds the client will check for notifications and pull down any items that have changed. I'm guessing the callback logic that you can add to your app is just in case you want to add your own special logic (like emailing the president every time an item changes in the cache).

Categories : Misc

Picasso never caches to disk on emulator
Have you provided a custom Downloader into Picasso? There are a few things you should make sure of: Do you have permission to write to the specified cache folder? Is your cache size restriction large enough for the images Picasso is downloading? Here is an example implementation for writing the images to the cache directory on the SD card: // Obtain the external cache directory File cacheDir = context.getExternalCacheDir(); if (cacheDir == null) { // Fall back to using the internal cache directory cacheDir = context().getCacheDir(); } // Create a response cache using the cache directory and size restriction HttpResponseCache responseCache = new HttpResponseCache( cacheDir, 10 * 1024 * 1024); // Prepare OkHttp httpClient = new OkHttpClient(); httpClient.setRespo

Categories : Android

Web-caches modifying my CSS, JS and HTML files
I have found the cause: At least one mobile phone company deploys a page-speed compressor in their mobile network. T-Mobile Austria and probably also in Germany modifies downloaded files by removing newline characters and other whitespace. The error reproduced on their network reliably but not on WiFi at the same time. The carrier ignores also our no-cache headers, the only fix would be to use https! However there were other times when this did not involve a mobile carrier, but mobile carriers account for most of our problems.

Categories : Google App Engine

Oracle caches CLOB to Temporary Table
Since you're piping the output, you'll need to cleanup the temporary clobs on the user end. Meaning you create the pointer inside the function, and pass it on (pipe it) out the end user, who will need to cleanup. For example: CREATE OR REPLACE type MY_CLOB as object ( some_char varchar2(4000), some_clob clob ); CREATE OR REPLACE type MY_CLOB_TAB as table of my_clob; Function is: CREATE OR REPLACE function pipe_clobs return my_clob_tab pipelined IS l_clob_obj my_clob; l_clob CLOB; BEGIN for i in 1 .. 10 loop l_clob := 'This is temp clob ' || i; l_clob_obj := my_clob('My varchar2 value', l_clob); pipe row(l_clob_obj); end loop; END; And the user would be (for example): begin for rec in (select some_char, some_clob from table(pipe_clobs)) loop

Categories : Oracle

How to assure multiple guava caches do not lock each other?
Guava does not seem to lock on a key when executing the Callable for a Cache. Otherwise the code you provided would always deadlock, e.g.: getOrganization(1337): (contains employee X) getEmployee(x): getOrganization(1337) // deadlock by recursion!!! The documentation for Cache.get states: This method provides a simple substitute for the conventional "if cached, return; otherwise create, cache and return" pattern. Note that I have not tried this out, but just from the documentation Guava seems to err on the side of running your Callable multiple times. In short, it's not a problem!

Categories : Java

Estimating how much memory is available in PostgreSQL buffer caches?
One typical suggestion for a dedicated Postgres server is to set effective_cache_size to about 3/4 of your available RAM. A good tool to use for setting sane defaults is pgtune, which can be found here: https://github.com/gregs1104/pgtune

Categories : SQL

Sitecore "HtmlCacheClearer clearing HTML caches for all sites"
Sitecore.Publishing.HtmlCacheClearer.ClearCode() method (which logs this information) is executed every time the Publish execution is done (on local server or remotely). It looks like your application executes Publish quite often. If you think this might be a bug, try to investigate which items are being published (e.g. by adding a hander to publish:itemProcessing event) and check what calls Publish for them.

Categories : Asp Net

How is re-population of replicated caches handled after system restarts
I will try to present here possible solution from Infinispan point of view. In your use case I would suggest to use cluster of Infinispan standalone nodes (client-server access, for example via HotRod) with configured underlying cache store. https://docs.jboss.org/author/display/ISPN/Infinispan+Server & https://docs.jboss.org/author/display/ISPN/Using+Hot+Rod+Server Now more specifically to your questions: What I need to know is how this cache will be repopulated when the individual nodes or the entire application restarts. That's why I suggest you to use let's say "independent" cluster with remote client-server access. Your caching layer does not depend directly on your application. When application restarts, crash, redeploying... you still have cached data in Infinispan clus

Categories : Java

Enable/disable a admin configuration of a module based on other configuration of other module
No, but you can make your own source model to achieve this. Anyway, why don't you just check if module B is enabled when testing the same thing for module A ? So your condition would be induced by your code, and not by some system config fields that would not be really safe regarding what you want to do (you could enable module A when module B is also enabled, but then what would happen if module B gets disabled later ?)

Categories : Magento

Is active Admin a good fit for a complex admin interface for a daily deal rails 3.2 app?
any answer for this question will be subjective.. formally, you can override anything (views, models, controllers) in activeadmin very easily. all this cases have minimal but enough instructions in documentation there are some difficulties to override look&feel for example with bootstrap to receive more responsive layouts but in general case AA is administration framework designed for generic backends so this feature is not critical according to your question to manage forms it supports formtastic so you can use any power of this gem you can override form with generic _form.html.erb in one line with form :partial => "form" you can use html-editors like this or this or other (like this) out of the box BUT this moment always insensibly comes when you begin to understand that so

Categories : Ruby On Rails

How to redirect user to 404 page not found error when non admin try to access wp-admin or wp-login.php
I assume that you're trying to protect yourself from brute-force attacks? Why not just limit the frequency of allowed login attempts? There is a pretty solid plugin called "Limit Login Attempts" which will track per IP and the use of cookies. Check it out here: http://wordpress.org/plugins/limit-login-attempts/ Trying to mask the login page is an interesting idea, though. You could just create your own login page somewhere and have it interact with a custom login script that you write. This would allow you 301 redirect the login pages to a 404 page without messing with any core functionality. You could have a form at something like https://yourwpsite.com/supersecretlogin and then have it POST to a custom handler that uses the wp_signon method. Here's an example of how to log someone in

Categories : Wordpress

How to start a program requiring admin rights as an admin user from a nonadmin account
I guess you're referring to is to trigger an UAC prompt on the newly created process. If so, just a few lines will do the trick, specifically removing the user/pass properties (since they'll be asked by Windows) and setting UseShellExecute to true: ProcessStartInfo myProcess = new ProcessStartInfo(path); myProcess.WorkingDirectory = @"C:WindowsSystem32"; myProcess.UseShellExecute = true; myProcess.Verb = "runas"; Process.Start(myProcess); Two caveats I've noticed with this approach is that, if the user cancels the prompt, an exception will be thrown saying that the user has cancelled (which you must be ready to cancel your processing). Also, if UAC is disabled/not present on the system, the process will NOT be elevated. To counter that, the launched program must be ready to check if it

Categories : C#

We would like to hide Admin link if user that logged in is not an admin. Any ideas why my code isn't working?
The variable may have to be cast to an int as the comparison could be of an object or string to the integer 1 which isn't likely the intended comparison. IOW: "1" = 1 Is likely going to be false.

Categories : Asp Net

Show admin panel button only if user is logged in and is in admin role
But how should I implement such a helper? By writing an extension method to the HtmlHelper class: public static class HtmlExtensions { public static IHtmlString MyCustomHelperWhichShowButton(this HtmlHelper html, string text) { var isAuthnticated = html.ViewContext.HttpContext.User.Identity.IsAuthenticated; if (isAuthnticated) { return html.ActionLink(text, "MyListings", "List"); } return new HtmlString(string.Empty); } } and by adding the namespace in which you defined this class to the <namespaces> section of your ~/Views/web.config file which will bring this helper into scope in all your views.

Categories : C#

How to create two admin view and seperating the model between 2 admin views by using rails_admin gem
You cant achieve that using rails_admin. I've tried couple of months ago and found its not made for that. Currently I am using rails_admin for SuperAdmin as its required less customization. And I am using active_admin for normal administration.

Categories : Ruby On Rails

Phonegap/SQLite no such table errors for CacheGroups, Caches, Origins, and DeletedCacheResources
Some people have been able to solve the problem using the steps mentioned http://www.anddev.org/networking-database-problems-f29/missing-table-in-sqlite-with-specific-version-of-desire-hd-t50364.html. It seems to me that this problem exists on certain versions of Android 2.2. I have incorporated this change in my code, though I'm still looking for Beta testers with to see if it actually works.

Categories : Sqlite

Function which computes once, caches the result, and returns from cache infinitely (Python)
g() is a generator function. Calling it returns the generator. You then need to use that generator to get your values. By looping, for example, or by calling next() on it: gen = g() value = next(gen) Note that calling g() again will calculate the same value again and produce a new generator. You may just want to use a global to cache the value. Storing it as an attribute on the function could work: def g(): if not hasattr(g, '_cache'): g._cache = 'foo' return g._cache

Categories : Python

Handling admin rights in mixed user/admin windows app
I don't know if it's the best way (no-one answered) but I did that now :) The bootstrapper has just requireAdministrator in the Manifest and does a ShellExecute to the main executeable with switch "/Activate" ...

Categories : Windows

How to set flash message in sonata admin Admin Controller
You are talking about an admin class, not a controller. And this is not possible by default. Best way to do this is to write a custom CRUDController (extend from default one) and handle it there.

Categories : PHP

Cannot Modify Registry (or run admin level commands) in C# as Admin
I found the solution to this after a lot of research. I used the example provided from this post on codeproject: http://www.codeproject.com/Articles/7665/Extend-ServiceController-class-to-change-the-Start After setting it up and changing it to how I needed, everything worked fine for all Windows Operating Systems (XP and newer at least).

Categories : C#

Active Admin uninitialized constant Admin::DashboardController
I found several issues: assets generator must best execute after an update; controllers/admin clashes with ActiveAdmin route; root directive should be define before ActiveAdmin route. To fix number one: $> rails generate active_admin:assets To fix number two: config.default_namespace = :your_desired_namespace To fix number three just move root up (in config/routes.rb)

Categories : Misc

How to find which admin logged in django admin site?
Using formfield for choice field One can do this def formfield_for_choice_field(self, db_field, request, **kwargs): if db_field.name == "user_type": kwargs['choices'] = ( (1, 'ADMIN'), (0, 'USER'), ) if request.user.is_superuser: kwargs['choices'] += ((2, 'SUPER ADMIN'),) return super(UserProfileAdmin, self).formfield_for_choice_field(db_field, request, **kwargs)

Categories : Django

Admin redirect to domine.com/admin from domine.com/app/admin after login
when you are using url always put / at begining and end. for eg:- <a href="/<url>/">testing</a> or in Httpresponse as HttpResponseRedirect('/<url>/')

Categories : Python

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



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