2018-10-22         Elma

Measuring performance with parcelable

Currently, I am having around 100 Pojo's which implements serializable and passed throughout the app, Since I am expecting more to come as the app grows & it will be better to make use of parcelable.Will there be any significant performance gain and how can I measure it?I know about android studio profiler etc. but not really aware which area I will see the performance gain i.e overall app speed, memory consumption etc.Also, any thing to take care of while making this change? According to Philippe Breault's benchmark, Parcelable is way faster than Serializable. He te...

 android                     1 answers                     23 view
 2018-10-22         Elma

Can't pickle recursive nested defaultdict

I have a recursive nested defaultdict class defined asfrom collections import defaultdictclass NestedDict(defaultdict): def __init__(self): super().__init__(self.__class__)sitting in a nested_dict.py file.When I try to pickle it, e.g.import picklefrom nested_dict import NestedDictd = NestedDict()pickle.loads(pickle.dumps(d))I get TypeError: __init__() takes 1 positional argument but 2 were given.What's exactly happening here? The defaultdict class implements a object.__reduce__() method where the second element of the returned tuple (the arguments for the cons...

 python                     1 answers                     94 view
 2018-10-22         Elma

Django: Query works fine with Sqlite3, don't with others Database Management System

I have quite long query with 'Q()', with Sqlite3 works very well, but with postgresql or mysql I have strange error e.g. for postgresql: invalid input syntax for integer: "(" and for mySQL: Truncated incorrect DOUBLE value: '('How could I run that query with mysql? Where is my mistake?Here is that query: watchersTuple = self.getWatchers() tagsTuple = self.getTags() blockedUserTuple = self.getBlockedUser() blockedTagTuple = self.getBlockedTag() statuses = Status.objects.filter( (Q(author__in = str(watchersTuple)) | Q(tags__in = str(tagsTuple)) | Q(author = sel...

 django                     2 answers                     62 view
 2018-10-22         Elma

get first related object in template

I'm having difficulty accessing the first related object within a template.I'm using{{ course.student_set.all[0].get() }}but its throwing loads of errors. How do i get the first related object? {{ course.student_set.all.0 }} Will do the trick for you, but I wonder why you want to only get the first student from your course in your template. [XXX]Try {{ course.student_set.all.0 }}. Template engine does not allow arbitrary code and method access syntax is different from normal Python code. I recommend reading this overview to understand how templates work [XXX]

 django                     2 answers                     99 view
 2018-10-22         Elma

Notifications are not working in Android Oreo

I am using pushwoosh plugin for pushnotification in my cordova phonegap application.Actually the issue is that notifications are not coming in the Android O devices.Cordova Android Platform is :: 4.1.1Pushwoosh Plugin version :: 6.3.0can you please help me out to solve this issue.Android 8 is using Notification channel, so how to implement channel code in pushwoosh. Use Cordova Firebase Plugin. Its very simple to use. If you want to use this plugin visit https://github.com/arnesson/cordova-plugin-firebaseAnd check this video for tutorialhttps://www.youtube.com/watch?v=Dv...

 cordova                     1 answers                     35 view
 2018-10-22         Elma

How to debug the browser compatibility issues with JQuery tabs?

Jquery tabs are being displayed as vertical list in an accordion inIE6.But it works fine in Firefox and IE 7. Any solution?I am using Jquery tabs within a jquery accordion. It works and displays fine IE7 and firefox but not in IE6. The tabs are appearing as vertical lists. The tabs do work. jQuery UI 1.9 release should NOT have this issue, try to use the latest version.As jQuery UI 1.10 Upgrade Guide suggests: Removed support for IE6 IE6 usage has dropped to a low enough point that jQuery UI no longer finds it necessary to support. As of 1.10.0, some portions of jQ...

 javascript                     1 answers                     61 view
 2018-10-22         Elma

Class Inheritance, redefining __init__ on with taking a new argument

I'm new to Python, I still have issues with the semantics of class inheritance. The following is the relevant class from the module games.py module that I am importing: class Text(Sprite): """ Alphanumeric values displayed on the screen. """ def __init__(self, value, size, color, angle=0, x=0, y=0, top=None, bottom=None, left=None, right=None, dx=0, dy=0, interval=1, is_collideable=True): self._size = size self._color = color self._value = value self._font = py...

 python                     3 answers                     99 view
 2018-10-22         Elma

Finding the second last occurrence of a string (date) in Regex

I got the following strings:(1640.31; 08/19/2016; 09/13/2016;); (250000.0; 09/30/2016; 02/17/2018;); (100000.0; 03/12/2018; 12/31/2025;);Or(1000000.0; 05/30/2018; 06/03/2028;); I need to return this second to last date, so in these cases for example 1: 03/12/2018 and example 2: 05/30/2018.Because there are a lot of string-parts ending with ; I can't figure quite out how I can get the second to last date. Below example for BigQuery Standard SQL #standardSQLWITH `project.dataset.table` AS ( SELECT '(1640.31; 08/19/2016; 09/13/2016;); (250000.0; 09/30/2016; 02/17/2018...

 sql                     2 answers                     78 view
 2018-10-22         Elma

VBA update query

Below query is resulting zero rows updated but i am sure that there is a record to update DoCmd.RunSQL (" Update tbltesting set IsDiff ='Yes' " & _ "where empid= " & Me.txtEmpId.Value & _ " and testid= " & Me.txtAutoNumber.Value & ";")Please help!! Run this as a check to make sure your fields have the data that you think they have: DoCmd.RunSQL (" SELECT * FROM tbltesting " & _ "WHERE empid= " & Me.txtEmpId.Value & _ " and testid= " & Me.txtAutoNumber.Value & ";")Incidenta...

 sql                     4 answers                     24 view
 2018-10-22         Elma

Hacky Sql Compact Workaround

So, I'm trying to use ADO.NET to stream a file data stored in an image column in a SQL Compact database.To do this, I wrote a DataReaderStream class that takes a data reader, opened for sequential access, and represents it as a stream, redirecting calls to Read(...) on the stream to IDataReader.GetBytes(...).One "weird" aspect of IDataReader.GetBytes(...), when compared to the Stream class, is that GetBytes requires the client to increment an offset and pass that in each time it's called. It does this even though access is sequential, and it's not possible to read "backward...

 sql                     2 answers                     41 view
 2018-10-22         Elma

Use DbModelBuilder in .NET Core to use specify naming conventions

In .NET I would normally be able to specify naming conventions on all columns and tables in the following wayprotected override void OnModelCreating(DbModelBuilder modelBuilder){ modelBuilder .Properties() .Where(p => p.Name == p.DeclaringType.Name + "_ID") .Configure(p => p.IsKey()); base.OnModelCreating(modelBuilder);}But in .NET Core I can't find a way of doing this. When I override OnModelCreating() in the XYZContext that inherits from DbContext in .NET core, I only have a ModelBuilder Is there a way of doing the above in .NET core or do...

 c#                     2 answers                     41 view
 2018-10-22         Elma

Symfony - entity - one field with two setter / getter?

I want to have string type column (for bit manipulations) with two or more getter / setter, f. ex:const STATUS_NEW = 0b00001000;const STATUS_NEW2 = 0b00000010;/** * @var String * * @ORM\Column(name="modelStatus", type="string", length=1, nullable=true) */private $status;public function getNew(){ return ($this->status and $this::NEW);}public function setNew(bool $set){ if ($set) { $this->status = ($this->status | $this::STATUS_NEW); } else { $this->status = ($this->status & ~$this::STATUS_NEW); } return $this;}pu...

 php                     1 answers                     37 view
 2018-10-22         Elma

how to Get access to shared mailbox using Microsoft Graphs

Is it possible to access shared mailbox using graphs?I would like access shared mailbox mail folders using graphs. Simply treat it as any other user:https://graph.microsoft.com/v1.0/users/sharedaddress@microsoft.com/messagesMake sure you have the right permissions set (Mail.Read.Shared) [XXX]

 api                     1 answers                     66 view
 2018-10-22         Elma

Xamarin Forms -> Activity Indicator not working if Commands of statements to be executed

Using Visual Studio 2017 Community 15.8.1This is after going through all options of stackoverflow regarding ActivityIndicator. So though it may be a duplication but nothing is helping me out.So finally decided to post my workouts and get best help from here.What I have tried till now:-1. {Binding IsLoading} + INotifyPropertyChanged + public void RaisePropertyChanged(string propName) + IsLoading = true; concept.2. ActivityIndicator_Busy.IsVisible = false; (Direct control accessed)These two approaches were mostly recommended and I went into depth of each since lot of hours in...

 xamarin.forms                     1 answers                     62 view
 2018-10-22         Elma

Is kafka 2.0.0 a stable version that can be used for production?

I have to upgrade Kafka from 0.10.0 to 2.0.0 for a production system. Is it a stable release? Also, is there a concept of GA, RC, and M2 for Kafka releases? Yes Kafka 2.0.0 is a stable release and it can be used in production.Apache Kafka also uses Release Candidates before releasing new stable versions. For example 2.0.0 went through 3 RCs before reaching GA. (RC0, RC1, RC2).Apache Kafka however does not use Milestone Releases. A Timed-based release plan was voted by the community and is used to produce regular GA (production ready) releases. [XXX]

 apache-kafka                     1 answers                     44 view
 2018-10-22         Elma

Realm model contains property but not found it at runtime

I am getting error as below Invalid property name , reason: 'Property 'IsRecordDeleted' not found in object of type 'MyCustomModel'Where as my Model is as Under @objcMembers public class MyCustomModel : Object {dynamic var Id : String = ""dynamic var ProductId : String? = ""dynamic var IsRecordDeleted : Bool? = falsedynamic var ProductBarcode : String? = ""override public class func primaryKey() -> String? { return "Id"}}and I am making query like this :let mSavedItems = mDbHelper.realmObj.objects(MyCustomModel.self).filter("IsRecordDeleted = false")What cou...

 ios                     2 answers                     84 view

Page 1 of 145  |  Show More Pages:  Top Prev Next Last