How to limit number of read/write records using custom claims in Firebase realtime database?

In firebase realtime database our users have a custom claim called premium this claim can have three values LEVEL_1 , LEVEL_2 or REGULAR my database rules are: { “rules”: { “.read”: “auth.token.admin === true”, “.write”: “auth.token.admin === true”, “$uid”: { “.read”: “$uid === auth.uid”, “.write”: “$uid === auth.uid”, “Boxes”:{ “Manual”:{ “.read”: “auth.token.premium === ‘REGULAR'”, “.write”:…

Details

TypeError: object of type ‘_io.TextIOWrapper’ has no len ()

I have an error this piece of code: if question == “1”: path = input(“\nEnter the file path\n\n>>> “) name = path.split(“\\”)[-1] with open(name,mode = “r”) as self.message_plain: self.message_plain.read().encode(“utf-8”) The complete code is as follows: from Crypto.Protocol.KDF import scrypt from Crypto.Cipher import AES from Crypto.Random import get_random_bytes class transmitter(): def __init__(self): self.random_password = None self.message_plain…

Details

How to read data from XML like string

I have a response from an api which is xml but doesn’t look properly formatted, how can I format this and get each element. I have tried using simplexml_load_string() but it saves the data and remove the <xml> opening tag. Below is the response I get from the api. <?xml version=”1.0″ encoding=”utf-8″?><string xmlns=”http://hts.org/”>&lt;Info&gt;&lt;Status&gt;1&lt;/Status&gt;&lt;ChasisNo&gt;dfrtdf4543&lt;/ChasisNo&gt;&lt;Color&gt;Black&lt;/Color&gt;&lt;PolicyNo&gt;POL\CR\2014\0000&lt;/PolicyNo&gt;&lt;Model&gt;Hiace&lt;/Model&gt;&lt;Name&gt;Tawakalitu&lt;/Name&gt;&lt;NewRegistrationNo&gt;HB90IKJ&lt;/NewRegistrationNo&gt;&lt;RegistrationNo&gt;HB90IKJ&lt;/RegistrationNo&gt;&lt;Model&gt;Hiace&lt;/Model&gt;&lt;CarMake&gt;Toyota&lt;/CarMake&gt;&lt;VehicleType&gt;hatchback&lt;/VehicleType&gt;&lt;IssueDate&gt;31 DECEMBER 2015&lt;/IssueDate&gt;&lt;ExpirationDate&gt;30…

Details

Use application properties in native spring @Query

I have a repository with a method that executes a native query to get data from the database: public interface ObjRepository extends CrudRepository<Obj, Long> { @Query(value = “SELECT obj.*\n” + “FROM obj\n” + “WHERE obj.value < #{${property.name}} and obj.value2 < :arg”, nativeQuery = true) public List<Obj> getObjs(@Param(“arg”) int arg); I’m trying to use a property…

Details

NavigationView.PaneDisplayMode changes the UI only after resizing the application window

I have a simple test application with a MainPage.xaml as follows: <NavigationView x:Name=”MainPageNavigationView” Style=”{StaticResource MainPageNavigationViewStyle}” ItemInvoked=”MainPageNavigationView_ItemInvoked” Loaded=”MainPageNavigationView_Loaded”> <NavigationView.MenuItems> <NavigationViewItem Icon=”Home” Tag=”Home_Page”> <TextBlock Tag=”Home_Page”>Home</TextBlock> </NavigationViewItem> </NavigationView.MenuItems> </NavigationView> In the Resource Dictionary I have defined NavigationViews Style as follows: <Style TargetType=”NavigationView” x:Key=”MainPageNavigationViewStyle”> <Setter Property=”IsBackButtonVisible” Value=”Collapsed” /> <Setter Property=”PaneDisplayMode” Value=”LeftCompact” /> <Setter Property=”IsSettingsVisible” Value=”False” /> <Setter Property=”IsBackEnabled” Value=”False”…

Details

Any Ideas why Aspect for Custom Annotation is not called?

I try to use the following Annotation to Authenticate in Testing of my Spring Boot 2 Application. @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) @Documented public @interface MockAuthorize { String[] roles() default {Role.ROLE_ADMIN}; String username() default “testUser”; } After research how to call Code before and after custom Annotated Methods I decided to use Spring AOP for that. @Aspect public…

Details

How can a dependency (registered in nested LifetimeScope) be resolved from autofac container

Is there any way to resolve the dependency (which is actually registered in nested LifetimeScope, not in container) from container? Explanation of Actual Implementation: I have ApplicationContext class (with IServiceProvider injected in its constructor) containing current-user’s basic info. It first resolves IHttpContextAccessor from serviceProvider, then extract user’s info from httpContextAccessor.HttpContext. ApplicationContext class is injected into…

Details