Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "ddnils"

I would like to know how I may go on to measure/count WebApi calls from my clients.

My plan is to get some data on how often my different WebApi-Endpoints are visited and possibly by whom.

Say I have a people WebApi - /person/id and beyond that /person/address and /person/pets I would like to know how frequent these APIs are visited by those who use my WebApi. One of my "clients" is a mobile App, and possibly I will be getting more clients. I even consider giving them keys (like google is doing). So I would count Api-Calls per client-key.

Any ideas on the matter would be most appreciated.

Answer

In the end I would like to have a "stretch goal" where I can get images through a web-api call like this:

<abpApp>/api/images/<imageIdOrName>?width=200&height=300

this could prove to be very useful if I have to load images in different resolutions for different media types (mobile to desktop). Of course caching should be implemented here... maybe even save different (default) sizes of an image inside db for specially indicated images like background images, logos, etc. (we could specify these images with a selector-attribute).

Answer

This is what I would suggest as FileEntity:

namespace Abp.Application.Services.Dto
{
    /// <summary>
    /// saves files in database
    /// </summary>
    /// <typeparam name="TPrimaryKey"></typeparam>
    [Serializable]
    public class FileEntityDtoOfTPrimaryKey<TPrimaryKey>: IEntityDto<TPrimaryKey>
    {
        /// <summary>
        /// Id of the entity.
        /// </summary>
        public TPrimaryKey Id { get; set; }
        /// <summary>
        /// This holds the bytearray contents of the file
        /// </summary>
        public Byte[] FileContent { get; set; }
        /// <summary>
        /// holds the size of the file in bytes
        /// </summary>
        public int FileSize { get; set; }
        /// <summary>
        /// holds the filename (without extension) 
        /// </summary>
        public string FileName { get; set; }
        /// <summary>
        /// holds the extension or filetype
        /// </summary>
        public string FileExtension { get; set; }

        /// <summary>
        /// 
        /// </summary>
        protected FileEntityDtoOfTPrimaryKey()
        {
            if (this.FileContent != null)
            {
                this.FileSize = FileContent.Length;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        protected FileEntityDtoOfTPrimaryKey(TPrimaryKey id)
        {
            this.Id = id;
            if (this.FileContent != null)
            {
                this.FileSize = FileContent.Length;
            }
        }
    }
}
Question

Hi there, I would like to post a feature request. What do you think about a File-Storage in database? I would like to propose file storage (pdf, jpeg, jpg, etc.) in database with a new Entity class (FileEntity). It should save files in database as bytearrays. For additional properties I propose fileSize and fileType or fileExtension. The FileEntity should be served by a webapi and have overloads for images (possibly for different resolutions).

I will try to implement a demo of this in the coming weeks and come back, but what do you think?

have you tried changing

<html lang="en">

to

<html lang="fa-ir">

(in _Layout.cshtml)

  • This should set your primary language.

+1

There are still some un-translated ui-exceptions in CreateExceptionForFailedLoginAttempt (AccountController), did you check that?

You might want to move this question to stackoverflow - there are already a lot of answers there: <a class="postlink" href="http://stackoverflow.com/questions/18571001/file-upload-using-angularjs">http://stackoverflow.com/questions/1857 ... -angularjs</a>

I have been trying to wrap my mind around the localization features of angular.

Since the razor-views do a lot of the heavy lifting, I am able to localize pretty much every string. My main concern is the localization of dates. When using angular to display dates, I usually do it with a filter like this:

<div>{{scopeValueDate | date: 'shortDate'}}</div>

This works pretty well as expected, but when i activated additional languages I noticed the dates were not localized.

It seems the angular resources for internationalization are not loaded. (/Scripts/i18n/angular-locale_XX.js) They do not appear in Developer Tools / Sources.

Also I am not able to insert them into the page... If I do add a script reference, the script is still not visible in Developer Tools.

Have you experienced anything similar? How do you solve internationalization of dates?

Question

Hi there, i would like to allow anonymous access to my home site. But it seems navigation is dependent on a valid User since it throws me an error saying: No User is logged in.

I have provided HomeController with [AllowAnonymous] Attribute. Any ideas on this matter?

Showing 1 to 10 of 28 entries