Monday, July 31, 2017

UIButton Click Not working when its triggered from static library

Leave a Comment
We are trying to trigger display button from static library project using webview. while integrating static library with single view application we have got the output design. but when we tried to attempt action by clicking on Button its not working. Below is the code,which we have used inside cocoa touch static library UIButton *imageButton = [UIButton buttonWithType:UIButtonTypeCustom]; imageButton.frame = CGRectMake(self.view.frame.size.width-50,...
Read More

Android push notification banner not showing up in some devices

Leave a Comment
I tried to push notify with NotificationCompat : NotificationCompat.Builder b = new NotificationCompat.Builder(this); b.setAutoCancel(true) .setDefaults(NotificationCompat.DEFAULT_ALL) .setWhen(System.currentTimeMillis()) .setSmallIcon(this.getResources(). getIdentifier("ic_launcher", "mipmap", this.getPackageName())) .setLargeIcon(BitmapFactory.decodeResource(this.getResources(), ...
Read More

How to set X-Frame Options to ALLOW-FROM https://example.com and SAMEORIGIN on server

Leave a Comment
I have a requirement to set the X-Frame options on the server level to either: X-Frame-Options: SAMEORIGIN X-Frame-Options: ALLOW-FROM https://example.com/ Understand that X-Frame Options are mutually exclusive. See here. However, my application requires framing in https://example.com and also from its SAMEORIGIN. Please advise if there is a way around this while retainining my application's requirement to having allow framing on the same origin and be framed on 1 external site. Or is this impossible?...
Read More

Do I need to stop a method that's running in a UI thread?

Leave a Comment
My application looks like this: App class: protected override void OnStart() { MainPage = new Japanese.MainPage(); } MainPage class: var phrasesPage = new NavigationPage(new PhrasesPage()) { Title = "Play", Icon = "play.png" }; Children.Add(phrasesPage); PhrasesPage class: protected override void OnAppearing() { base.OnAppearing(); phrasesFrame = new PhrasesFrame(this); phrasesStackLayout.Children.Add(phrasesFrame); } protected override void OnDisappearing() { base.OnDisappearing(); phrasesStackLayout.Children.Remove(phrasesFrame);...
Read More

Support multiple iOS SDK versions when nullability of a protocol changes

Leave a Comment
The MCSessionDelegate protocol has changed in iOS 11 from - (void) session:(MCSession *)session didFinishReceivingResourceWithName:(NSString *)resourceName fromPeer:(MCPeerID *)peerID atURL:(NSURL *)localURL withError:(nullable NSError *)error; to - (void) session:(MCSession *)session didFinishReceivingResourceWithName:(NSString *)resourceName fromPeer:(MCPeerID *)peerID...
Read More

intellij: how to deploy to two folders?

Leave a Comment
The general question is: how to work with many different git repos at the same time in one intellij project. Where the git repos need to be inside the main application (that is one git repo too). I cannot use symlinks because I cannot commit those I have 2 git repos one is for the main app, the other one is for a library I am using in several projects. Here is how it goes: I have the main app. Via composer I add my library / package...
Read More

Swift error when running pod lib lint

Leave a Comment
Swift is very new for me so please excuse me if this is a very basic question. I have a swift project that builds fine in xcode and all the unit tests pass. However when I run pod lib lint i get a no such module MyModule error. Testing with xcodebuild. -> my-swift-project (0.4.2) - WARN | source: Git SSH URLs will NOT work for people behind firewalls configured to only allow HTTP, therefore HTTPS is preferred. - ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code. - ERROR | [iOS] xcodebuild: my-swift-project/Echo/Delegates/MyModule/MyModule.swift:7:8:...
Read More

No Code Completion or Syntax Highlighting in Xcode Unit Test Target with “Defined Module” enabled

Leave a Comment
We have a project with a Unit Test target that has "Defines Module" enabled, due to a mix of Objective C and Swift. With that setting enabled, syntax highlighting and code completion stops for all non-language items. IE code completion will list language level stuff like NS_ENUM and for loop, but not NSString and not any of our classes. The same thing happens if I create a new project, set "Defines Module" to YES. Syntax Highlighting and Code Completion fails in the Unit Test Code, set it to NO it starts working again....
Read More

MyModel.objects.update_or_create() --> Boolean wether data was updated or not?

Leave a Comment
AFAIK Django does not provide a generic way to see if data was changed by update_or_create() The boolean created tells me that a row was created. But how can I know if data was changed (SQL UPDATE which changed data) Example: obj, created = MyModel.update_or_create(pk=12345, defaults=dict(name='Doctor Zhivago')) There are three cases: obj was created. No problem, I have the boolean variable created obj was not created, it was updated. For example the previous name was "Machuca". obj was not...
Read More

node.js compressing ZIP to memory

Leave a Comment
I want to zip some data into a writableStream. the purpose is to do all in memory and not to create an actual zip file on disk. For testing only, i'm creating a ZIP file on disk. But when I try to open output.zip i get the following error: "the archive is either in unknown format or damaged". (WinZip at Windows 7 and also a similar error on MAC) What am I doing wrong? const fs = require('fs'), archiver = require('archiver'), streamBuffers = require('stream-buffers'); let outputStreamBuffer = new streamBuffers.WritableStreamBuffer({...
Read More

SSIS Script Component Cannot Load Assembly Until Manually Opened

Leave a Comment
I am creating a SSIS project via Biml (Using the current version of BimlExpress per the Varigence BimlExpress page) that uses a script component within a Data Flow Task. The project is created without issue however errors when it gets to the Script Component: Could not load file or assembly 'Microsoft.SqlServer.DTSPipelineWrap, Version=14.100.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified. at ScriptMain.PreExecute() at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PreExecute()...
Read More

Sunday, July 30, 2017

How do we track the user flow in a website that doesn't have an authentication system?

Leave a Comment
Let's say the customer filled a form on the 3rd page he visited, how do we find out his flow.(Where did he come from, which links on the website he clicked, basically the entire flow till he filled in the form). There is no login or any kind of authentication system on the website. Is there a way to monitor the user flow? I don't have much experience with google analytics. Can anyone help me with this? 3 AnswersAnswers 1 There...
Read More

No qualifying bean of type 'org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder' available

Leave a Comment
In Java project, I am using Sprig Boot 1.5.3.RELEASE. It is connecting with two databases i.e. MongoDB and Microsoft SQLServer. When I run it with spring-boot:run goal, it works fine. However, when I try to run it with package goal then below error is reported by test cases despite the fact that those test cases are not connecting to SQL Server database: Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder' available:...
Read More

List all gif files in photo library

Leave a Comment
I have a requirement in which the user needs to fetch a gif from a list of gif files in library. I tried to fetch both images & Videos without any issue. But when I used kUTTypeGIF as media, it crashes with error : Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'No available types for source 0' Here is my code: #import "ViewController.h" #import <MobileCoreServices/MobileCoreServices.h> @interface ViewController ()<UIImagePickerControllerDelegate, UINavigationControllerDelegate>...
Read More

Spring boot test does not respect web security configuration

Leave a Comment
I'm writing test for a Rest API controller. This endpoint is accessible without any authorization: @EnableWebSecurity @Configuration @Import(AppConfig.class) class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private UserDetailsRepository accountRepository; @Autowired private CustomUserDetailsService customUserDetailsService; @Autowired private JWTAuthenticationFilter jwtAuthenticationFilter; @Override protected void configure(HttpSecurity http) throws Exception { http .csrf().disable()...
Read More

Hibernate not getting correct records using query.list();

Leave a Comment
I'm building an application that uses Hibernate and Mysql, My entire databse has 15 tables. Here is the problem: I start inserting records into the database and viewing them using query.list(); to get the added records, howerver after a while of getting "correct" results, I start not having the last record I added, I add again and it's the same(the one that was showing before shows but not the last one I added), I refresh and I get the right records, I refresh again and I get 32 records instead of 43, I'm not using any...
Read More

Default UICollectionView layout not respecting iPad split screen

Leave a Comment
My layout when on split screen is not respecting the width of the split screen. My custom view is respecting it(the black bar at the top) but anything using autolayout is not respecting the width. I am handling rotation using override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { Is there a helper method for handling split view? Do I handle it in layoutSubview? I would have...
Read More

Why is a .crash log showing crash in UIPresentationController but my app doesn't use UIPresentationController?

Leave a Comment
I've got an app in the app store and there's a crash report showing there's a very occasional crash with details below: Incident Identifier: C25BD8DF-FAA9-4A5F-B3D2-6E1CE81F1D17 CrashReporter Key: 798f7dee81117ed0f05b3f19dc4bbc2874eefaf6 Hardware Model: iPhone9,2 Process: My app [1936] Path: /private/var/containers/Bundle/Application/757D7BE6-4F91-4B74-BA64-09FA53AE3E16/My app.app/My app Identifier: com.app.Myapp Version: 12 (1.1) Code Type: ARM-64 (Native)...
Read More

Error when trying to open my asp.net 4.5 MVC web application using VS 2012. Asp.net has not been registered on the server

Leave a Comment
I have a Windows Server 2012 R2 & Visual Studio Professional 2012. now i use to develop an asp.net 4.5 mvc 4 web application without any problem. but now when i try to open the project i will get this error:- if i click OK then this error:- if i click OK the visual studio will stop working so can anyone adivce what is going on ?? and here is how the Turn windows features on/off looks like:- Now i did this modification,...
Read More

coded ui test project, obtain value of asp label

Leave a Comment
Created a simple calculator app in webforms. User enters a number in a text field MainContent_numberTb and clicks on results button. Added a new 'coded UI Test Project' to my solution. Have tested the UI by adding '5', This all works fine. Would now like to compare the actual result against the expected result. BrowserWindow Browser = BrowserWindow.Launch("http://url"); UITestControl UiInputField = new UITestControl(Browser); UiInputField.TechnologyName = "Web"; UiInputField.SearchProperties.Add("ControlType", "Edit");...
Read More

Saturday, July 29, 2017

How can I run a method in the background on my Xamarin app?

Leave a Comment
Once the app is open and running I would like a background process to check a database and to make an update depending on the data in the database. I would like to make this check every one minute. I only want this to happen when the app is in the foreground and in view of the user. Can someone give me some suggestions as to how I do this? I assume I can call a method from here but I'm not sure how to do this. Also I do not know how to stop or even if I need to manually cancel / stop the process. Would it cancel itself...
Read More

Why can't I display prediction column of Spark MultilayerPerceptronClassifier?

Leave a Comment
I am using Spark's MultilayerPerceptronClassifier. This generates a column 'predicted' in 'predictions'. When I try to show it I get the error: SparkException: Failed to execute user defined function($anonfun$1: (vector) => double) ... Caused by: java.lang.IllegalArgumentException: requirement failed: A & B Dimension mismatch! Other columns, for example, vector display OK. Part of predictions schema: |-- vector: vector (nullable = true) |-- prediction: double (nullable = true) My code is: //racist is boolean,...
Read More