http://inskywithwater.blogspot.com/2013/06/here-i-plan-make-journal-about-my-water.html
Tuesday, June 4, 2013
Tuesday, May 21, 2013
Yahoo has redesigned its Flickr photo-sharing service, offering users up to 1TB of storage without a fee.
- 1 Terabyte of photo and video storage
- Upload photos of up to 200MB per photo
- Upload 1080p HD videos of up to 1GB each
- Video playback of up to 3 minutes each
- Upload and download in full original quality
http://www.flickr.com/help/limits/
http://www.flickr.com/
Tuesday, December 6, 2011
Tuesday, May 3, 2011
Saturday, January 23, 2010
How Silverlight update got my day OR BitmapCache stopping work with EnableGPUAcceleration when ToolTip shown
After upgrade to SL 3.0.50106 two days ago we got a problem with MultiScaleImage:
when _hover_ mouse on element that has tooltip image in MultiScaleImage control twitches up about 100 –200 pixels, depending on controls layout.
Here is screencast of problem.
MultiScaleImage restore his original view on :
- resize window
- programmatic do something with it( for example _msi.ViewPortOrigin = _msi.ViewPortOrigin; )
after day of research we found first that problem can be fixed by removing attribute from MultiScaleImage definition:
CacheMode="BitmapCache"
And build minimalistic layout that reproduce problem:
<Grid ><Grid.RowDefinitions><RowDefinition Height="80"></RowDefinition><RowDefinition Height="*"></RowDefinition></Grid.RowDefinitions><StackPanel Orientation="Horizontal" Height="25" ><Button Content="Hover me and get OK(NO TOOLTIP)"/><Button Content="Hover me and get BUG(TOOLTIP)" ToolTipService.Placement="Mouse" ToolTipService.ToolTip="TEST TOOLTIP" /></StackPanel><MultiScaleImage Grid.Row="1"x:Name="_msi"Width="750" Height="450"Source="dz.xml" CacheMode="BitmapCache"ViewportOrigin="0, -0.07"/></Grid>
but in a clear project it was not reproduced – it was worked fine with CacheMode. And for that time we was not have any clue why this shit happens. But There were few options where problem can be:
- How we host Silverlight app on page.
- Custom script on same page that detects that Silverlight installed.
At first sight on a piece upon me has dawned. We have a GPU Acceleration enabled. Disabling of this option has eliminated a problem.
<param name="EnableGPUAcceleration" value="true"/>
More precisely problem reproduced when follow combination of options used:
- CacheMode="BitmapCache"
- GPU Acceleration used
- ViewPortOrigin is negative on X or Y. More one, size of ViewPortOrigin influences how much image twitches
So if you use options above, you are in risk group.
By description of update 3.0.50106
it have changes both in GpuAcceleration and in DeepZoom optimization. So seems that was cause a problem
Tuesday, January 12, 2010
Using Generic CRUD Controllers in ASP.NET MVC. part 1
Since making some projects on ASP.NET MVC, i got a question – why generic repositories is widespread, but generic controllers is not.
What is controller? In DDD Architecture it just dispatcher between other subsystems. And in similar scenarios ( like is CRUD ), way of dispatching will be identical. For example: typical Edit Action:
public ActionResult Edit(int id){Entity entity = _repository.Get(id);if (entity == null) return RedirectToAction("ObjectNotFound");if (!_security.CanView(entity, LoggedUser)) return RedirectToAction("ObjectNotFound");return View("Edit", "Personal", mapper.to<ViewModel>( entity ) );}[AcceptVerbs(HttpVerbs.Post)]public ActionResult Edit(ViewModel model){Entity entity = model.EntityId.HasValue ? _repository.Get(model.EntityId.Value) : null;if (entity == null) return RedirectToAction("ObjectNotFound");if (!_security.CanUpdate(entity, LoggedUser)) return RedirectToAction("NotEnoughPermissions");if ( !entity.IsValid )return View("Edit", "Personal", mapper.to<ViewModel>( entity ) );elseusing (ITransaction tr = NHibernateSession.Current.BeginTransaction()){entity = _service.Update(entity, model, LoggedUser);_repository.SaveOrUpdate(entity);tr.Commit();return RedirectToAction("View", new { id = entity.Id, username = LoggedUser.Login });}}
All lines is Generic for most controllers. All that is necessary - extract generic types in base class and specify it in concrete realization. Also we need some constrains:
public abstract class CrudController<TEntity, TRepository, TService, TViewModel> :PersonalPostController<TEntity, TRepository, TService, TViewModel>where TEntity : Entitywhere TRepository : IRepository<TEntity>where TService : IBaseEntityService<TEntity,TViewModel>where TViewModel: EntityViewModel<TEnity> - optional{protected CrudController(TRepository repository, TService service ){_repository = repository;_service = service;}..........public ActionResult Edit(int id){TEntity entity = _repository.Get(id);if (entity == null) return RedirectToAction("ObjectNotFound");if (!_security.CanView(entity, LoggedUser)) return RedirectToAction("ObjectNotFound");return View("Edit", "Personal", mapper.to<TViewModel>( entity ) );}[AcceptVerbs(HttpVerbs.Post)]public ActionResult Edit(TViewModel model){TEntity entity = model.EntityId.HasValue ? _repository.Get(model.EntityId.Value) : null;if (entity == null) return RedirectToAction("ObjectNotFound");if (!_security.CanUpdate(entity, LoggedUser)) return RedirectToAction("NotEnoughPermissions");if ( !entity.IsValid )return View("Edit", "Personal", mapper.to<TViewModel>( entity ) );elseusing (ITransaction tr = NHibernateSession.Current.BeginTransaction()){entity = _service.Update(entity, model, LoggedUser);_repository.SaveOrUpdate(entity);tr.Commit();return RedirectToAction("View", new { id = entity.Id, username = LoggedUser.Login });}}}
For each entity we have just follow:
public class UsersControlles:CrudConrtoller<User, IUserRepository, IUserService, UserViewModel>{public UsersControlles( IUserRepository repository, IUserService service ): base(repository, service){}}
in Next part i plan show how can do some strategies with different types of entities and go deep into TService implementation
Sunday, September 27, 2009
Step by step Migrating and mixing ASP.NET Web Forms to ASP.NET MVC
We wish to write a new code on ASP.NET MVC, step-by-step copying old as far as possible. But application is very separated into small components. And from one side we cannot create new ASP.NET MVC page without possibility to use old components from MVC views. And cannot create new MVC parts/components without possibility to render it on old Web Forms pages.
I’m not sure that it is a good idea to use Web Forms components from MVC views, because many concepts form Web Forms simply not works in MVC, and many code should be rewritten ( such as event handlers, something stored in ViewState etc. ). In this case seems that more reasonable rewrite Web Forms Components at all.
But what about backward Interop? Seems that it can be reasonable if you want to write new parts on MVC. we simple need somehow create Html and Url helpers similar to MVC helper and call methods such as Html.RenderAction and Url.Action
Here is snippet that create such helpers, that can be used from classic ASP.NET Web Forms:
public static class ControllerExtensions{public static HtmlHelper CreateHtmlHelper( this HttpContext context ){
var request_context = new RequestContext( new HttpContextWrapper( context), new RouteData() );var controller_context = new ControllerContext( request_context, new StubController );var dictionary = new ViewDataDictionary();var wrapper = new ViewWrapper( dictionary );var viewContext = new ViewContext( controller_context, wrapper, dictionary, new TempDataDictionary() );return new HtmlHelper( viewContext, wrapper );}
public static UrlHelper CreateUrlHelper( this HttpContext context ){return new UrlHelper( new RequestContext( new HttpContextWrapper( context ), new RouteData() ) );}}internal class StubController : Controller{}internal class ViewWrapper : IView, IViewDataContainer{public ViewWrapper( ViewDataDictionary dictionary )
{ViewData = dictionary;}#region IView Memberspublic void Render( ViewContext viewContext, TextWriter writer ){}#endregion#region IViewDataContainer Memberspublic ViewDataDictionary ViewData { get; set; }#endregion}
Usage:
//This can be placed in BasePage class to possible to use on all your pages.protected HtmlHelper Html;
public void OnLoad(...){Html =HttpContext.Current.CreateHtmlHelper();}
<% Html.RenderAction<SomeController>( c =>c.some_action( some, params ) ); %>
So this way you can Mixing ASP.NET Webforms and ASP.NET MVC Views in your project.