I want to understand the difference between AWS Elasticsearch service vs on-premise version. Does AWS provides a fully managed service for Elasticsearch (like DynamoDB, SQS etc) Do we have to manage at the node level and ensure that Elasticsearch has proper configuration for production kind of environment? Appreciate your feedback on this.

Thanks

I have an API that return list of Employee. This API will have an offset and limit for pagination purpose.

On the frontend, I use Single-Page Framework (Vue/Angular/React..). This SPA have a Employee List Page that can create new Employee using AJAX.

And now the question, :

  1. Should I return only OK message when server successfully created Employee object and then GET the updated list from server?
  2. Or should I return OK message and the new updated List so I didn't have to make a GET request to the server?

Which one (from the 2 options) commonly used when designing API?

When I try to read up on this subject I can only seem to find stuff that takes a Model Driven Architecture approach, which then makes the M3 level MOF. But I would think that something this broad should make it possible to have many different kinds of M3 levels.

But what else could it be? Could it be something custom?

I want to develop android delivery application using Android Studio and Firebase database

it works as follows: 1. user choose a restaurant from list of restaurants. 2. new page will open, user will write order details and location and then click order. 3. Requests page : is where orders are stored. So, when delivery user want to choose an order to deliver he/she will go to this page. 4. when delivery user click on an order to deliver, "delivery price" dialog will appear and he/she will enter the price of delivery service. 5. the price will go to the "normal user" as a dialog. User can accept delivering with the specified price ,or cancel and the order will stay in the Requests page.

How can I transfer the "price" from account to another account at the same time? what method/classes/etc in java language should I use?

I am streaming a video file but only playing the audio for it using AVPlayer. I am successfully able to play/pause, continue playing while in background, and interact with the lock screen controls to control the player. The only issue is if I pause the audio then I lock the phone, the lock screen controls do now show up. However, if I pause the audio from the lock screen, the controls remain showing.

The codebase is extensive so here is some of the relevant code.

-(void)viewDidLoad {
    ...
    [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: nil];
    [[AVAudioSession sharedInstance] setActive:YES error:nil];
    [[AVAudioSession sharedInstance] setMode:AVAudioSessionModeMoviePlayback error:nil];
    [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
    ...
}
-(void) setUpAvPlayer {
    ...
    self.player = [AVPlayer playerWithPlayerItem:[AVPlayerItem playerItemWithAsset:mixComposition]];
    self.player.automaticallyWaitsToMinimizeStalling = NO;
    [self addObservers];
    [self setUpRemoteCommandCenter];
    [self.player.currentItem seekToTime:CMTimeMakeWithSeconds(videoSeekPosition, 60000)];
    ...
}

-(void)setUpRemoteCommandCenter {
    // Provides all audio data to be displayed to user in lock screen
    self.lockScreenInfo = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
                           lecture.topicName, MPMediaItemPropertyTitle,
                           [NSNumber numberWithDouble:CMTimeGetSeconds(self.player.currentItem.duration)], MPMediaItemPropertyPlaybackDuration,
                           [NSNumber numberWithDouble:CMTimeGetSeconds(self.player.currentItem.currentTime)], MPNowPlayingInfoPropertyElapsedPlaybackTime,
                           [NSNumber numberWithDouble:playerRate], MPNowPlayingInfoPropertyPlaybackRate, nil];
    [[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:self.lockScreenInfo];

    // For lock screen & remote audio controls
    MPRemoteCommandCenter *remoteCommandCenter = [MPRemoteCommandCenter sharedCommandCenter];

    [remoteCommandCenter.playCommand setEnabled:YES];
    [remoteCommandCenter.playCommand addTarget:self action:@selector(playPauseVideo)];

    [remoteCommandCenter.pauseCommand setEnabled:YES];
    [remoteCommandCenter.pauseCommand addTarget:self action:@selector(playPauseVideo)];

    [remoteCommandCenter.skipBackwardCommand setEnabled:YES];
    [remoteCommandCenter.skipBackwardCommand addTarget:self action:@selector(skipBackward)];
    remoteCommandCenter.skipBackwardCommand.preferredIntervals = @[@(15)];

    [remoteCommandCenter.skipForwardCommand setEnabled:YES];
    [remoteCommandCenter.skipForwardCommand addTarget:self action:@selector(skipForward)];
    remoteCommandCenter.skipForwardCommand.preferredIntervals = @[@(15)];

    // Drag slider to change audio position
    // Check for iOS version here (later than iOS 9.0)
    if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_9_0) {
        [remoteCommandCenter.changePlaybackPositionCommand setEnabled:YES];
        [remoteCommandCenter.changePlaybackPositionCommand addTarget:self action:@selector(changedThumbSliderOnLockScreen:)];
    }
}

I am going to customize the Seekbar in Android and I am having one problem with it.

This is what I am going to do : image

This is now I get :

currnet

And Here is my code:

<SeekBar
        android:id="@+id/blueSlider"
        android:layout_width="0dp"
        android:layout_height="60dp"
        android:layout_marginStart="50dp"
        android:layout_marginTop="50dp"
        android:layout_marginEnd="10dp"
        android:splitTrack="false"
        android:maxHeight="40dp"
        android:shape="oval"
        android:thumbOffset="-20dp"
        android:secondaryProgress="0"
        android:progressDrawable="@drawable/styled_progress"
        android:max="@integer/slider_max_value"
        android:thumb="@drawable/oval_seekbar_thumb"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintEnd_toStartOf="@+id/blueText"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

styled_progress.xml

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@android:id/background">
        <shape android:shape="rectangle">
            <corners
                android:radius="25dp"/>
            <gradient
                android:startColor="@color/gradient_start"
                android:endColor="@color/gradient_end"
                android:angle="0" />
        </shape>
    </item>
    <item android:id="@android:id/progress">
        <clip>
            <shape android:shape="rectangle">
                <corners
                    android:radius="90dp"/>
            </shape>
        </clip>
    </item>
</layer-list>

oval_seekbar_thumb.xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="oval">
            <solid android:color="@color/white" />
            <size android:height="25dp" android:width="25dp"/>
        </shape>
    </item>
</selector>

Please help me on this problem. Thank you

I'm trying to solve the simple case on iOS, but it still looks unresolvable. I'm trying to track the battery level from my application when app is in the background. When it's in the foreground - all works fine. But in background it doesn't work (I want to popup alert and notification message as well when app in background + play the music like an alarm).

I tried to do the next things: 1. Add "Background Modes" capabilities (particular "Background fetch" and "Background processing") 2. Just check it using callback function

    @objc func batteryLevelDidChange(notification: Notification) {
    if (isEnabled) {
        if(Int((UIDevice.current.batteryLevel) * 100)) <= currPercentage {
            let request = buildNotifications()
            triggerNotificaiton(request)
            showAlert()
        }
    }
    NotificationCenter.default.addObserver(self, selector: #selector(batteryLevelDidChange), name: UIDevice.batteryLevelDidChangeNotification, object: nil)
  1. Even I tried to use timer:

    timer =  Timer.scheduledTimer(
      timeInterval: TimeInterval(5),
      target      : self,
      selector    : #selector(ViewController.runBatteryCheck),
      userInfo    : nil,
      repeats     : true)
    }
    

Did somebody faced with such cases?

I have a Fragment with two TextViews and an ImageView and I want to put the constraints to this views. How can I do it? Because I have only margins on Fragments, but I can't see the Layout Constraints on Attributes.

    <?xml version="1.0" encoding="utf-8"?>
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".saludoscongratulationsfragment">

<!-- TODO: Update blank fragment layout -->
<TextView
    android:id="@+id/titulo"
    android:layout_width="300dp"
    android:layout_height="95dp"
    android:layout_marginTop="16dp"
    android:text="Lección completada!"
    android:textColor="@android:color/holo_red_dark"
    android:textSize="30sp"
   />

<ImageView
    android:id="@+id/fuegosartificiales"
    android:layout_width="match_parent"
    android:layout_height="386dp"
    android:layout_marginTop="92dp" />

Thanks

I am using fetchAllRecordZones to get the zones in sharedCloudDatabase.

Using this, as the sharee, I can successfully query the zones to get the records in them from the sharedCloudDatabase. I can also make a subscription to the sharedCloudDatabase to get changes and fetch those changes.

However, I can't write back (create or update any records) in the sharedCloudDatabase using the Zone ID I retrieved with fetchAllRecordZones.

<CKError 0x280d24390: "Partial Failure" (2/1011); "Failed to modify some records"; uuid = E33E6EA8-824A-4BBB-9455-5DD58091C696; container ID = "iCloud.com.my-id"; partial errors: {
  9E2B5947-536F-4DBB-8473-0902428AFA0E-67855-0000882339B04A4B:(SharedZone:_947ea1c9f3aeeb7dca58149ad40080e9) = <CKError 0x280d25890: "Invalid Arguments" (12/2006); server message = "Only shared zones can be accessed in the shared DB"; uuid = E33E6EA8-824A-4BBB-9455-5DD58091C696>
}>

The zone I'm using was supplied directly from fetchAllRecordZones and I am accessing a shared zone using the shared DB. I can confirm that SharedZone:_947ea1c9f3aeeb7dca58149ad40080e9 is the zone that is in my sharedCloudDatabase that I am trying to write to via Dashboard.

Here is how I'm trying to write my changes:

let operation = CKModifyRecordsOperation(recordsToSave: updatedRecords, recordIDsToDelete: deleteRecords)
operation.database = container.sharedCloudDatabase
operation.savePolicy = .changedKeys

operation.modifyRecordsCompletionBlock = { [weak self] _, _, error in
    guard error == nil else {
        DDLogError("Error modifying records: \(error!)")
        print(error!)
        return
    }

    DDLogInfo("Finished Pushing Shared Changes to CloudKit")
}

container.sharedCloudDatabase.add(operation)

And to make my records from my entity objects:

let zoneId = //.. cached from fetchAllRecordZones
let record = CKRecord(recordType: "Item", recordID: CKRecordID(recordName: self.uri, zoneID: zoneID))

So I'm not sure what to do to get my sharee to be able to edit the shared records

I've tried several things, one of those is using the privateCloudDatabase, but I get "PrivateDB can't be used to access another user's zone" which makes sense and can at least confirm my zone is legit.

Any help is welcome!

I'm trying SwiftUI for the first time and I'm using an ObservableObject to store the information being used for my views. However when the value of the ObservedObject changes, my view just jumps to the current value, rather than animating to it.

Specifically, I have an ObservableObject that stores some completion percentage (0-1), and I am using that value to calculate the frame of my progress bar. When the completion percentage changes, I would like the progress bar to animate to the new frame (like it would if I was just using a local @State), rather than simply jumping to the new frame. I am wondering if this is possible using ObservableObjects, or if there is a better way to do this?

Here are simplified examples of my class and struct:

public class TaskList: Identifiable, ObservableObject {
    @Published public var tasks: [Task]
    @Published public var tasksCompletionPercentage: CGFloat
    .
    . 
}

struct TaskListView: View {
    @ObservedObject var taskList: TaskList

    var body: some View {
        .
        .
        ProgressBarView(progressPercentage: $taskList.tasksCompletionPercentage)
    }
}

struct ProgressBarView: View {
    @Binding var progressPercentage: CGFloat

    var body: some View {
        GeometryReader { geometry in
            ZStack(alignment: .bottom) {
                Rectangle()
                    .foregroundColor(ThemeManager.completionBarColorPrimary)

                Rectangle()
                    .foregroundColor(ThemeManager.completionBarColorSecondary)
                    .frame(height: geometry.size.height * self.completion)
                    .animation(.easeInOut(duration: 0.5))
            }
                .frame(width: 12)
            Spacer()
        }
    }
}

The reason I'm using an observable object in the first place is because I am calculating the percentage of completed tasks as I go, and tasks can be completed/uncompleted from within the TaskListView. If there is just a better way of doing this in the first place then please let me know, I'm open to any constructive criticism or suggestions.

I also tried performing the calculation within the TaskListView and explicitly animating but it gave me some weird results, seemingly related to CoreData.

Note: I realize that separating the ProgressBarView out and passing the binding through adds some complication, I have also tested this by just adding a rectangle to my TaskListView and trying to animate it's frame with the same results.

I am trying to use PDFKit for rendering pdf. But I could not find any way to highlight page number while scrolling, the way it is shown in WKWebView.

Do I need to make a custom logic for it?

I am creating a user interface and want to know how to give a neon effect as in the image. I want to know if I can do it without setting the image as the background of my layout, because in future I will try to add more icons when you swipe right / left on those same icons and if I just set it as a background, I don't know if I can have this feature.

Here's the UI that I want:

enter image description here

I already tried to implement this code that I've found here.

    // An added margin to the initial image
    int margin = 48;
    int halfMargin = margin / 2;

    // the glow radius
    int glowRadius = 8000;

    // the glow color
    int glowColor = Color.rgb(255, 0, 0);

    // The original image to use
    Bitmap src = BitmapFactory.decodeResource(getResources(),
            R.drawable.house_logo);

    // extract the alpha from the source image
    Bitmap alpha = src.extractAlpha();

    // The output bitmap (with the icon + glow)
    Bitmap bmp = Bitmap.createBitmap(src.getWidth() + margin,
            src.getHeight() + margin, Bitmap.Config.ARGB_8888);

    // The canvas to paint on the image
    Canvas canvas = new Canvas(bmp);

    Paint paint = new Paint();
    paint.setColor(glowColor);

    // outer glow
    paint.setMaskFilter(new BlurMaskFilter(glowRadius, BlurMaskFilter.Blur.NORMAL));
    canvas.drawBitmap(alpha, halfMargin, halfMargin, paint);

    // original icon
    canvas.drawBitmap(src, halfMargin, halfMargin, null);

    ((ImageView) findViewById(R.id.homeIcon)).setImageBitmap(bmp);

This code just gives a bit of glow, not even close to what I want.

I've created a fresh React Native project (v0.60.4) and I'm running it on a real iPhone 11 Pro iOS 13.1.3 in release mode. The app.js is super simple:

import React from 'react';
import {
  SafeAreaView,
  Image,
} from 'react-native';

const App: () => React$Node = () => {
  return (
      <SafeAreaView>
        <Image source={require('./test.png')} />
      </SafeAreaView>
  );
};

export default App;

I've noticed that every time my app enters the background (when I switch to another app), I see a jump in memory usage that's never freed (even with memory warnings).

enter image description here

I can see that the increase is caused by a new ImageIO_PNG_Data, created as the app moves into the background.

While this image is relatively modest in size, in my real app it's causing app crashes after the user app switches a lot.

Here's the same app, same image, written in Swift, using the same method to create a UIImage that RN is using.

enter image description here

No extra images loaded into memory. What is RN doing differently that's loading these extra images into memory and not clearing the old ones? What's happening when the app enters the background?

0

I have several instances of the same service subscribed to a Kafka topic. A producer publishes 1 message to a topic. I want this message to be consumed by all instances. When instance is started, the messages should be read from the end of topic/partitions. I don't want the instances to receive messages which were published before service is started (but these won't be a big problem if some old messages are processed by the service). I don't want the instances to loose messages if the instances are disconnected from Kafka for some time or Kafka is down which mean that I need to commit offsets periodically. Message can be processed twice, it is not a big problem.

1) Is the following the best way to archive the described behavior: generate new Kafka group id using new Guid or timestamp for each instance each time instance is started?

2) What disadvantages can have the approach described in item 1 above?

I have been researching how to best distribute software for a new project at my company. My company works on a medical product which runs on Linux where we control the hardware and also customize the OS. I have landed on three basic approaches.

  1. Install my OS base on the hardware and then have scripts which take care of all the customization and then install the software through snap or deb.

  2. Do all my customization through scripts/ manual process and just clone the hard drive after integration testing

  3. Create a custom live CD OS and use this to install everything

Does anyone have experience with these approaches that can offer a recommendation out of the 3?

I'm using ReactJS (React Hooks, specifically) to build an application. Part of that application involves account creation, sign-in, and authentication. I only recently finished the sign-in feature, and I noticed that while all my components have access to the JWS/JWT, only my SignIn component has a state for whether you're actually signed in or not (because of course, the JWT may be invalid or expired, so "has a JWT" doesn't mean "is currently signed in").

In thinking about how best to get that status out to the rest of my app, I realized I have at least two options, and I'm not sure which is best. Maybe someone here can advise me :)

Option 1: I lift the sign-in state up to the main App component, since most of the app will need to know that state at some point, and then pass it down through every component via props. I know "lift state up" is a common mantra, but it feels a little excessive to have it on the main App container and passed to every component through props.

Option 2: Since I already have an AuthHelper object that I'm exporting/importing, I could have the AuthHelper keep track of the signed in state, and allow components to subscribe to SignInStateChange events that the AuthHelper triggers. Very pub-sub. I'm not averse to this, but I know pub-sub is controversial, so I'd like some opinions before I decide to definitely do this.

I suppose there's also Option 3: Redux, but for now this is the only state variable that needs to be global, so I don't want to over-engineer a solution to it just yet.

So which is the better approach: having an App-level state passed down through props, or using a pub-sub technique with an exported/imported helper object?

I organize my Git projects based on the article A successful Git branching model. The problem is that I don't know how to handle the following case:

  • develop: working on a major app redesign (taking ~6 months)
  • master: current production version

However, because we access paid customizations (from enterprise customers), sometimes a customer requests, for example, a new report to be added.

That's technically not a hotfix, but a feature. And features should not branch off from master or a release branch. Even more, if the feature is big enough, it could be a complete difference release. So, while master has v1 and develop has v2, where do I work for features that go to v1.1, v1.2, and so on?

What I currently do is, branch a feature from master and merge back to master and develop. Is there any workflow model that's more appropriate/organized?

Imagine 2 different buttons and a picture. When you press one button, the image changes to another image. If you press the other button, it changes to different picture. And so on. It's like an interactive game. I want the button to change id also, so you don't have to make a new activity each time, just keep going thru the pictures on the single activity. I only found 1 answer to this question and it advised against changing the id... So how do I change the id or is there a better solution for this program? Thank you.

i follow this instruction https://firebase.google.com/docs/dynamic-links/android/create and i tried to create a dymanmic link, and i have two problems, first i don't have a domain so i use example.com, but when i press on the dynamic link it goes to example.com when i want to take me to my i app or either to google store to download my app

here is my code

  String link = "https://www.example.com";


            FirebaseDynamicLinks.getInstance().createDynamicLink()
                    .setLink(Uri.parse(link))
                    .setDomainUriPrefix("https://example.page.link")
                    .setAndroidParameters(
                            new DynamicLink.AndroidParameters.Builder("com.example.sample")
                                    .setMinimumVersion(125)
                                    .build())
                    .buildShortDynamicLink()
                    .addOnSuccessListener(new OnSuccessListener<ShortDynamicLink>() {
                        @Override
                        public void onSuccess(ShortDynamicLink shortDynamicLink) {
                            sendDynamicLink(shortDynamicLink.getShortLink());
                            // ...
                        }
                    }).addOnFailureListener(new OnFailureListener() {
                @Override
                public void onFailure(@NonNull Exception e) {
                    e.printStackTrace();
                }
            });
        }
    });

}

private void sendDynamicLink(Uri shortLink) {

    String referrerName = FirebaseAuth.getInstance().getCurrentUser().getDisplayName();
    String subject = String.format("%s wants you to play MyExampleGame!", referrerName);
    String invitationLink = shortLink.toString();
    String msg = "Let's play MyExampleGame together! Use my referrer link: "
            + invitationLink;
    String msgHtml = String.format("<p>Let's play MyExampleGame together! Use my "
            + "<a href=\"%s\">referrer link</a>!</p>", invitationLink);

    Intent intent = new Intent(Intent.ACTION_SENDTO);
    intent.setData(Uri.parse("mailto:" + inviteContactEmail.getText().toString())); // only email apps should handle this
    intent.putExtra(Intent.EXTRA_SUBJECT, subject);
    intent.putExtra(Intent.EXTRA_TEXT, msg);
    intent.putExtra(Intent.EXTRA_HTML_TEXT, msgHtml);
    if (intent.resolveActivity(getPackageManager()) != null) {
        startActivity(intent);
    }
}

}

and my manifest

   <activity android:name=".activities.InviteContactActivity"></activity>

    <activity android:name=".activities.InviteReciveActivity">
        <intent-filter>
            <action android:name="android.intent.action.VIEW"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <category android:name="android.intent.category.BROWSABLE"/>
            <data
                android:host="https://www.example.com"
                android:scheme="https"/>
        </intent-filter>

I wanna know if there is any way that I can use an image as the camera source to trick the in-app camera shooting of other apps, it doesn't matter if this needs root or Xposed or etc. thank you in advance