Responsive Ad Area

Month: March 2019

Why is it giving me a null pointer exception at this line?

The purpose of this task is to make an array for numbers in a text file but if there are letters then we have to skip them but still obtain the numbers in between. For example: 1a3 here it should be 13 in the array. It says it gives a null pointer exception at the line result[i] = inFile.next(); int[] result = null;//Possibly wrong Scanner inFile = null; File file = null; String filePath = (JOptionPane.showInputDialog("Please enter a file path")); try { file = new File(filePath); inFile = new Scanner(file); int skippedCounter = 0; for(int i = 0; inFile.hasNext(); i++){ if(inFile.hasNextInt()) result[i] = inFile.nextInt(); else{ String strOut = ""; String data = inFile.next(); for(int j = 0; j < data.length() - 1; j++){ if(!Character.isLetter(data.charAt(j))){ strOut += data.charAt(j); }...

Carousel slide cuted in half in view port

When viewing in chrome mobile view, my carousel slide was half half in the view port. It is using flex. Unfortunately, I am no expert and most of the code was cut and paste. Currently, I am able to swipe, but I only want 1 slide in the view port. Code so far <template> <div class="product-images-popup"> <div class="product-images-popup-modal"> <div class="product-images-popup-header"> </div> <div class="product-images-popup-body"> <div class="product-images-popup-carousel_wrap"> <transition-group tag="div" class="product-images-popup-carousel"> <div v-for="(imgUrl) in testImgs" :key="imgUrl" class="product-images-popup-slide" > <div v-touch:swipe.left="onSwipeLeft"> <div v-touch:swipe.right="onSwipeRight"> <img v-bind:src...

How do I "complete registration" in OAuth 2.0?

I am attempting to follow this guide: https://gaute.app/dev-blog/gpgs-hide-player, in order to remove a hacked leaderboard entry from my game. I’ve followed every single step successfully, however, at step 9 “Enter the GET request https://www.googleapis.com/games/v1/leaderboards/leaderboardId/scores/PUBLIC?maxResults=10&timeSpan=all_time and change the leaderboardId with the id you got from Google Play Console step 5.”, under OAuth 2.0 Playground, I receive the following error { "error": { "code": 401, "message": "User has not completed registration.", "errors": [ { "domain": "global", "message": "User has not completed registration.", "reason": "UserRegistrationIncomplete" } ] } } Does anyone know which registration they are reffering to? Or how to proceed in this si...

Deleting a file created with TempFile

I have a patcher that downloads a file via ftp, streams it to a temporary file and extracts the contents to update the local files. The remove command is deferred. (Windows OS) This works unless the user exits the program while the file is downloading, then the file isn’t deleted. I tried to fix this by doing a graceful exit by catching the signal and removing the file there. But unfortunately it throws an error that the file can’t be deleted because it is being used by another program. Which makes sense because the another program is actually itself still writing to the temporary file. Now I’m stuck and don’t know what to do to make sure that the temporary file is automatically gone once the patcher is not running. How do I do that correctly? The file could also be created as a normal fil...

How to fix my list of objects being serialized improperly

I have been having an issue to serialize an object properly. I have an object SensorSession which looks like: [XmlRoot("Session")] public class SensorSession { [XmlElement("SensorDefinitionCollection")] public SensorDefinitionCollection mCollection { get; set; } [XmlElement("SensorRunner")] public SensorRunner mRunner { set; get; } } public class SensorDefinitionCollection : IEnumerable<SensorDefinition> { [XmlArray("SensorDefinitionCollection")] [XmlArrayItem("SensorDefinition")] public List<SensorDefinition> mCollection; } public class SensorDefinition : IEquatable<SensorDefinition>, IComparable<SensorDefinition> { [XmlElement("StartingWavelength")] public double startingWavelength { get; set; } [XmlElement("StoppingWavelength")] public double stoppingWavelength {...

Push Notification is receiving but background fetch not calling with pn_apns tag when sending in PubNub chat message Payload

I had setup a chat module in my app using PubNub service not PubNub Chat Engine. Every thing is working fine, until push notifications come up. This app has Android version also (not built by me). I was able to receive a fully functional Apple Push Notification using payload1 mentioned bellow. But it only works for iOS devices in term of Notifications, no Notifications for Android device which has GCM added for Notification. So i did some RND and Found this Link and used Payload2 mentioned bellow. Using this both platforms get notifications. But now in iOS Notification comes on both foreground and background app state. but all of the bellow mentioned methods does not call, the only method is now calling is willPresent in foreground. I want to know why is that. Is is some thing Wrong with P...

Can I export/dump the table schemas for a Google Cloud Sql database?

Title says it all I want to export the table schemas for a Google Cloud Sql database? I see how to export the data, but I want the schema. Can I export/dump the table schemas for a Google Cloud Sql database? Can I export/dump the table schemas for a Google Cloud Sql database? test {$excerpt:n}

How to Solve FRM 41003 :- this function cannot be performed here while opening a form?

While opening a Oracle form ,It is giving ” FRM 41003 This function cannot be performed here “. How could I resolve this error ? I followed this link :- http://www.orafaq.com/forum/t/191386 But It did not help . How to Solve FRM 41003 :- this function cannot be performed here while opening a form? How to Solve FRM 41003 :- this function cannot be performed here while opening a form? test {$excerpt:n}

ND4J runs slowly on GPU, but runs fast on CPU

Today I’ll try to use CUDA in my ND4J and Deeplearnint4j project. After that, Neural Net (imported from Keras) began work faster. But the next code began work slowly I have already tried to change ND4J backend to native (CPU) and I got fast result. promlem part is highlighted with a comment (in 2 lines) import com.rabbitmq.client.Channel; import org.nd4j.linalg.api.ndarray.INDArray; import org.nd4j.linalg.factory.Nd4j; import org.nd4j.linalg.ops.transforms.Transforms; import java.io.IOException; import java.sql.*; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ConcurrentHashMap; public class GraphUpdater implements Runnable { private Pair pubPair; private ConcurrentHashMap<Integer, INDArray> pubsList; private Connection connectionMain; private Co...

Calculation of estimated battery capacity using formula, Capacity in Ah = Current in Amperes * Time in hours .Is this right way?

I am trying to find the estimated capacity of the battery using a charge cycle and another current in amperes. I have to find the formula, Capacity in Ah = Current in Amperes * Time in hours. I can find time using charge cycle. The only current in Amperes I couldn’t find. Is there any way of finding the current used in discharge time? Calculation of estimated battery capacity using formula, Capacity in Ah = Current in Amperes * Time in hours .Is this right way? Calculation of estimated battery capacity using formula, Capacity in Ah = Current in Amperes * Time in hours .Is this right way? test {$excerpt:n}

WPF: Using interface as DataContext instead of object implementing INotifyPropertyChanged

I’ve refactored my WPF application so that the DataContexts are no longer instances of some class that implements INotifyPropertyChanged but rather some custom interfaces of mine. The object that implements each custom interface is required to also implement INotifyPropertyChanged. But I can no longer enforce this requirement at build time. I’m not sure if this is a good idea. For example, consider the following simple class hierarchy // Base view model class has stock implementation of INotifyPropertyChanged. public BaseViewModel : INotifyPropertyChanged { // Assume INotifyPropertyChanged implementation with this utility to raise the event void RaisePropertyChanged(string property) { // ...blah blah blah ... } } // Interface for nameable object public interface INameable { str...

Are the relationships and class models in this diagram correct?

So, I’m trying to get better with labeling my class diagrams and wanted to know if I have laid out the class diagrams here in the correct fashion. I’ve tried adding in an abstract class for Blood Pressure as both classes have similar methods which both can implement. https://i.imgur.com/eGV4s7H.png Are the relationships and class models in this diagram correct? Are the relationships and class models in this diagram correct? test {$excerpt:n}

  • 1
  • 2
  • 6
Skip to toolbar