Wednesday, January 31, 2018

Android - protecting in app purchases with server side verification

Leave a Comment
I'm new to android development but created an app and I implemented in-app purchase to remove ads from the app. I just did a very basic implementation and I basically check if the user has purchased the "no_ads" item and if it's true, then no ads are shown. The problem is that I see a lot of "purchases" bein logged on firebase and nothing on play console, which means of course that my users are using those hacking apps. So my question is, how to protect/verify those purchases agains a server so these haking apps are useless?...
Read More

Projects dependencies for custom configuration

Leave a Comment
We are using cocoapods to link different projects together. We have a main project with a target (project1) that has 3 configurations release, debug and a custom duplicate of release, qa. We have 3 external libraries that project1 depends on that are not cocoapod compatible, let's call those external1, external2 and external3. Those external projects only have 2 configurations, the default release and debug. Our Podfile looks like this: platform :ios, '8.0' workspace 'project1.xcworkspace' pod ... pod ... target 'project1'...
Read More

How do I include a Jquery UI slider in my view?

Leave a Comment
I'm trying to incorporate a slider (http://simeydotme.github.io/jQuery-ui-Slider-Pips/#installation) into my view, which is supposedly part of jquery-ui. I have these in my Gemfile gem 'jquery-rails' gem 'jquery-ui-rails' And when i open Gemfile.lock I see jquery-rails (4.3.1) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) jquery-ui-rails (6.0.1) railties (>= 3.2.16) But although I have this HTML on my page <div class="slider"></div> and I include...
Read More

Add Bundle Items for specific Scheme?

Leave a Comment
I would like to add some bundle items just for a specific scheme. I could create a run-script, but there i am unable to read out the current scheme. Is there another chance to add some bundle files only for a specific scheme in xCode 9.x? 3 AnswersAnswers 1 In script you can get your current build configuration. You can duplicate your current build configuration, this will save all your settings for that config. After that rename your new config and refer to it in your scheme you would like to add bundle items...
Read More

Control statement for removing attributes and classes having opposite effect

Leave a Comment
I'm building a registration page and I want the button to be disabled until all of the inputs pass validation. Well I have all of the native validation logic done (missing values, pattern mismatch, etc...), but I wanted to implement a "username taken/available" piece of validation where the button still wouldn't be enabled until the username had valid inputs for all of their inputs AND supplied a desired username that was not already in use. I have the server call and all of that all done, my only issue is the actual enabling/disabling...
Read More

Performant 2D OpenGL graphics in R for fast display of raster image using qtpaint (qt) or rdyncall (SDL/OpenGL) packages?

Leave a Comment
For a real-time interactive Mandelbrot viewer I was making in R & Rcpp+OpenMP & Shiny I am on the lookout for a performant way to display 1920x1080 matrices as raster images in the hope of being able to achieve ca. 5-10 fps (calculating the Mandelbrot images themselves now achieves ca. 20-30 fps at moderate zooms, and certainly scrolling around should go fast). Using image() with option useRaster=TRUE, plot.raster or even grid.raster() still doesn't quite cut it, so I am on the lookout for a more performant option,...
Read More

Extending custom router to default router across apps in Django Rest Framework

Leave a Comment
I have come across a problem regarding having the API apps seperate, while still being able to use the browsable API for navigation. I have previously used a seperate routers.py file in my main application containing the following extension of the DefaultRouter. class DefaultRouter(routers.DefaultRouter): def extend(self, router): self.registry.extend(router.registry) Followed by adding the other application routers like this: from . routers import DefaultRouter from app1.urls import router as app1_router...
Read More

How to reuse ArrayDescriptor?

Leave a Comment
I tried the code below: public class Abc { private ArrayDescriptor arrayDesc; void init() { connection = //create connection arrayDesc = ArrayDescriptor.createDescriptor("DBTYPE",connection); } void m1() { conn1 = //create connection ARRAY array_to_pass1 = new ARRAY( arrayDesc , conn1, idsArray1 ); } void m2() { conn2 = //create connection ARRAY array_to_pass2 = new ARRAY( arrayDesc , conn2, idsArray2 ); } } This code is giving the error...
Read More

PDF as blank page in HTML

Leave a Comment
My problem is, everything is fine opening PDFs using my browsers, until I uploaded a pdf with a form inside. Then, if I embed it, it returns a blank page. But the other pdfs with forms open normally. Please see my code below: <object data="{{ asset($test->file_path) }}" type="application/pdf" width="100%" height="100%"> <embed src="{{ asset($test->file_path) }}" type='application/pdf'> <center> <a href="{{ route('download.test', ['id' => $test->id]) }}" class="btn btn-primary">Please...
Read More

Tuesday, January 30, 2018

How to add a fragment to an Activity without a container

Leave a Comment
Is that possible I can add a fragment view on the activity view without specifying "fragment" view component in activity's layout xml file? Which function should I look for? 9 AnswersAnswers 1 Well, the UI of the fragment has to go somewhere. If you want the entire "content view" to be the fragment, add the fragment to android.R.id.content: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getSupportFragmentManager().findFragmentById(android.R.id.content)==null)...
Read More

How to debug function which is getting called throuh validate_and_run() in R?

Leave a Comment
I want to debug functions in ShadowCAT package. https://github.com/Karel-Kroeze/ShadowCAT/tree/master/R Take any internal functions from this package, they are getting called via validate_and_run() function. If I go though it I am directly presented an output and I am not able to run through each line of the code I am interested in. What I think validate_and_run() creating an environment to call the functions. For e.g. I am trying to debug shadowcat function from the package using following code: library(devtools) install_github("Karel-Kroeze/ShadowCAT")...
Read More

Emiting websocket message from routes

Leave a Comment
I'm trying to setup my server with websockets so that when I update something via my routes I can also emit a websocket message when something on that route is updated. The idea is to save something to my Mongo db when someone hits the route /add-team-member for example then emit a message to everyone who is connected via websocket and is a part of whatever websocket room that corresponds with that team. I've followed the documentation for socket.io to setup my app in the following way: App.js // there's a lot of...
Read More

Dynamically update PHP generated elements after Ajax login

Leave a Comment
I load content on the page (comments) via Ajax infinite scroll, and i use Ajax to login/out as well. Now on success login i want to update reply or like buttons depending on what that user has liked or disliked. The simple method is not to use Ajax for login/out or to refresh the page anyway because i check what the user has liked/disliked with PHP and if the page dose not get refreshed those scripts do not fire again. But if i refresh the page all the comments loaded are gone and the user needs to scroll again. One...
Read More

How to change json encoding behaviour for serializable python object?

Leave a Comment
It is easy to change the format of an object which is not JSON serializable eg datetime.datetime. My requirement, for debugging purposes, is to alter the way some custom objects extended from base ones like dict and list , get serialized in json format . Code : import datetime import json def json_debug_handler(obj): print("object received:") print type(obj) print("\n\n") if isinstance(obj, datetime.datetime): return obj.isoformat() elif isinstance(obj,mDict): return {'orig':obj...
Read More