Forgot your password?
Sign in with
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View PHP questions
View Python questions
All Message Boards...
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Design and Architecture
Internet of Things
C / C++ / MFC
ATL / WTL / STL
Objective-C and Swift
Hardware & Devices
Hosting and Servers
.NET (Core and Framework)
Site Bugs / Suggestions
Spam and Abuse Watch
The Insider Newsletter
The Daily Build Newsletter
Most Valuable Professionals
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
What is 'CodeProject'?
Ask a Question
Bugs and Suggestions
Article Help Forum
Comments by Nick_3141592654 (Top 34 by date)
Since you already have logger support in your code (the catch block), I would suggest adding more logging within the try block, e.g. you could check whether AudioPlayer has actually started.
Better still, run your code in a debugger.
Also, are you sure that your code isn't exiting the thread before the audio has had a chance to play. You may need to do something to explicitly wait until AudioPlayer has finished playing. Without knowing more about your application environment it's impossible to say whether this may be the case - but it's something for you to think about.
You don't need jquery for this, see window.navigator: https://www.w3schools.com/js/js_window_navigator.asp
Hi Mahi, just to clarify MVC is a design "pattern" - it defines a structural model for software structure - that is applicable to very many languages. Wherever you are using OO principles you could be using MVC. The whole point of MVC is that it provides a de-coupling between classes that may otherwise get entangled. It's up to you but I do think it is very relevant to your question.
My first choice would have been XSLT. I'd be amazed if it's not already been done.
Once you have XML you can load it into a DOM and easily grab the tags that you want.
BTW with XLST you wouldn't have to go via the XML phase. You can just as easily write XSLT to directly extract the raw text that you want. Unfortunately XSLT is hard (I think so anyway) and not the most intuitive of languages, so you've a bit of a learning curve if going that way. Best option is to find a "nearly does it" solution on s/overflow and adapt it.
I would not, as a rule, recommend separating your properties and methods. Classes typically encapsulate all such related items and maintenance/code-sharing may become harder if you need to dive into separate classes to see how the whole thing works together.
It sounds as though you may be gravitating towards a Model-View-Controller (MVC) design pattern, which certainly does have value.
I use a such a pattern (MVC-inspired) in Android to achieve a clean separation of UI from business logic, and this uses a class to hold all configurable settings (as properties) along with some helper methods to deal with things like shared-preferences. (One such 'settings' class for each category of business logic, not one global class, which would be horrible.)
I would advise you to do some reading about MVC before launching into some new paradigm of your own.
You need to re-work your database. Change the schema so that to set the character encoding for all strings.
Next time you post such a question please identify the specific line number in your source where the error occurs. Expecting people to count lines to find where #62 is, is asking rather a lot!
Anyway, I did count lines and the answer is in your question:
mysqli_query() expects parameter 1 to be mysqli, null given
The null variable in question is $con. This means that your DB connection was not established.
I would advise you to get a debugger (Netbeans works well) and set a breakpoint in your db() function. For server-side PHP development a debugger is an essential tool so I strongly encourage you to make the investment to learn how to use one, if you don't already know. Even if you can find an easy answer to this issue you need to be able to debug effectively yourself.
Yes it's entirely possible. You'd need to set up some form of web service and decide how you want to interface to this.
However, have you considered the performance of your solution, bearing in mind the need to upload & download image data (a video stream?) to your server? If not, I suggest that you do some basic sums using relevant image sizes & frame rates. I'm thinking that an Android tablet or phone is in itself a powerful processing platform and I wonder whether you could implement your algorithm within the Android app and do all of the processing in-situ? If you have some machine-learning going on then potentially you could have a much lower bandwidth connection to the server uploading/downloading the results of your training algorithm (but not the raw image/video data). Such an approach may need native code for the CPU-intensive parts. Maybe what I'm saying is irrelevant - it's just to prompt you to think about the alternatives before you dive into a pretty big server-side development.
You're overwriting lblDestroyedMachines.Text as you whiz through that loop. If you want to view all results obtained you need to show them in separate labels (or a table perhaps), or concatenate them. As a quick check you can replace:
lblDestroyedMachines.Text = destroyed;
lblDestroyedMachines.Text += destroyed;
Which won't look great because there's no separator (and you need to ensure that .Text is initialised to an empty string), but maybe this will prove that you are indeed getting the results that you want.
If not, the debugger is the obvious next step.
I'm not sure exactly what problem you're running into but you could use AsyncTask.publishProgress within your implementation of AsyncTask, which will cause onProgressUpdate (which you can override) to be invoked. That would be the standard way to do progressive UI updates from a long-running AysncTask.
You could alternatively use a Handler but the point about AsyncTask is that it does the hard work for you.
If everything can be done in your onPostExecute (as your code comment seems to imply) then I'm not sure why this isn't working. Some more detail about the problem you're running into is needed.
Furthermore, you might want to lookup the definition of "refactor" and consider re-phrasing your question. In brief: refactoring means to take some software - generally assumed to be working - and modify it to achieve some objective, such as an improved structure, improved code-reuse etc. We have no idea in what way your code may need "refactoring". Perhaps you mean that it's not doing what you want, in which case you could explain the aim..
Interesting problem, is that a student assignment or a real-world problem that you're trying to solve?
I haven't found a great book specifically covering JNI, having several books but it's a topic that seems to be glossed over. I find that most android books trawl over the same topics that are covered very well already by the Google tutorials. There are however some quite good online resources, for example this one: https://www.ibm.com/developerworks/java/tutorials/j-jni/j-jni.html.
I think the easiest way "in" now would be to take one of the Google sample projects for JNI and learn by example.
Once you can build a JNI library and do some kind of "Hello world!" in JNI you'll soon be flying.
Regarding pros and cons, of course the big pro is performance. I wrote real-time video processing app in pure Java, not really expecting it to run fast enough and indeed it was horribly slow. JNI gave me at least a x10 speed improvement. If, however, you don't really need such speed, then as the standard Google tutorials say don't bother with JNI. You really need to determine that there's a need for it, rather than doing this just because it seems "professional" or otherwise a generally good thing to do.
You need to fill in the "What I have tried" section with some information (not a re-statement of your question) after you have actually tried something.
I think you've closed your eyes and wished really hard, which, sadly, is not how software is created.
It would help if you remove the blank lines and commented-out code from your posting.
Much better to post only the code that's relevant to the issue, and the minimum code that can reproduce the issue.
I wonder if you're expecting to see the column IDs in your results, as you do when viewing the table in your favourite MySQL GUI tool? If so, you won't: you will see only the DATA that you've inserted to the table.
I made a simple table example for you at http://sqlfiddle.com/#!9/0a1a4a/1 with three columns ColA, ColB, ColC and three inserted rows of data. Your query is shown in tabular form. In this case the results do show "ColA", .., "ColC" in the first row of HTML but note that the query response is indicating that THREE results have been obtained, i.e. one for each row of DATA in the table. This is of course correct.
Have you thought about the lifecycle for your fragments? It's because the other fragments haven't yet been created (inflated). Check the docs for ViewPager and you'll find that you can configure it to inflate and hold all tabs in memory at once - but this is wasteful of resources (memory). Another approach would be to save the data you're passing in shared prefs and each fragment can then load from shared-prefs on their onResume().
Regarding the try-catch that you asked about. This is apparently a college assignment, the purpose of which is presumably for you to: (a) learn something and (b) demonstrate that you've learnt it.
Given those aims, why don't you invest 15 minutes READING about try-catch to understand what it is for, then you will know where it's appropriate to use it.
If somebody just says "oh you can put one here.." you'll be none the wiser.
RecyclerView has an onScrolled event that was added at 22.1.0. It's worth checking out.
As a last resort the docs are always worth reading :) https://developer.android.com/reference/android/support/v7/widget/RecyclerView.html
Do you want the files to appear like app icons on your tablet screen? If so then no this won't happen.
However your tablet must have a File Manager app that you can use to explore the file system (although the default app is unlikely to show system areas). On Marshmallow there's a basic file-explorer view available within the Settings menu (access here: http://www.greenbot.com/article/2996030/android/how-to-get-to-android-marshmallows-hidden-file-manager.html). On Android N the simple file-explorer is similarly accessed but in this case you need Settings->Storage->Explore (and very nice it is too, giving access to, I think, the entire file system).
Do you ONLY need to cope with a sentence of the form "Is There a holiday on<date>" ?
If so, then you have a chance of achieving this. If not then you've no chance. For example, the sentence "I asked April if she May be able to take a holiday on July 14th, but she said no because that's her sister June's birthday".
Start the MS Project app and open a project before you run your C#. Hopefully it's telling you what the problem is in the error message.
Maybe worth inserting the word "animated" into your qn title (if possible). There are no other answers/comments yet that will invalidated and you may grab attention of somedody with that specific experience.
Given the question you're asking, I'd read Chapter 1 of any Android book before you go further.
I take it this is an MEng project or a job for a major customer? You surely aren't diving into using a neural network in this way unless there's a good reason. (Wanting to play with a Neural net would be a good reason if you had a few months to spare).
Seriously, did you consider a much simpler approach? The data you're capturing could easily be put through a set of simple recursive first-order filters (Yn+1 = Yn * Alpha + Xn * Beta, where Xn is one of your raw measurements and Yn is the filtered value; Alpha + Beta = 1 and as Alpha gets closer to 1.0 you filter does more smoothing).
Given smoothed data with all those random jerks suppressed, just do some simple thresholding:
e.g. If Avg-Speed > <something> we're driving.
Hardest to handle will be the accelerometer readings, but assuming that your GPS device is rigidly attached to the vehicle you can cope with this. Such an attachment is crucial because this ensures that X, Y and Z have consistent meanings: If you were using a hand-held GPS device then of course X, Y, Z are going to change arbitrarily as the device's orientation in 3-D space changes. You can integrate acceleration measurements to obtain speed in X, Y, Z directions.
All of this is a little tricky and subject to short-term noise and long-term drift effects (especially when you start integrating your measurements). However this wheel has been made lots of times before. Look around and you will find standard solutions detailed, which don't need a neural net.
May I ask why you want to put 4.3 on that device? It's a retrograde step. I ask in case there's an easier way to side-step what you're trying to achieve.
I think that it isn't saying "'gradle' my application failed". What you are seeing is the word "gradle" and somewhere nearby your seeing a build error for your app.
You need to look more carefully at exactly what is being reported as an error. Start AS afresh (quit it then re-start), open your project, then do a Clean rebuild and record all build errors reported. You need to focus on the FIRST thing that goes wrong because that may cause secondary errors that will go away when you fix the basic problem.
If you are seeing notification that other updates or plug-ins are available or needing update, don't ignore these.
Sometimes you have to metal-bash Android Studio for a couple of hours after an update to get it back into shape.
Also to add, if you're really trying to access External storage on Android Marshmallow or later, you will need to handle an explicit permission request at run-time: in these later Android versions you cannot simply declare all wanted permissions in the Manifest and expect them to be granted to your app (some permissions are OK, depending on their security implications).
Please spell-out your technical problem clearly.
Is it that:
1. You were expecting SDCARD in your emulator to correspond to a physical SDCARD on your device rather than internal storage?
or related to what you mention about:
2. Reading specific books, e.g. are you looking for a file filter of some kind?
One other thing, do you actually know what Internal and External storage mean in Android? These terms are not well named and can cause a lot of confusion. Internal storage is part of the memory system that is "local" to an app, i.e. is it accessed only within that app and is in that sense internal. External storage is *ALL* other parts of the memory system (excluding the internal storage associated with other apps). Do not assume that Internal & External corresponds to Flash & SD physical memory respectively, because this is not the case.
Are you specifically needing to support animated GIFs, or are these plain (non-animated) GIFs?
If non-animated I don't understand why you can't use standard .NET functionality that goes back a long time, as described here: https://msdn.microsoft.com/en-us/library/4sahykhd(v=vs.100).aspx.
I think that you need to share more about your current approach first because you've not spelt-out exactly how you're doing the Ajax. I've gone back to the basics which is a raw XMLHttpRequest - this is the fundamental way that Ajax is done, however there are lots of implementations that wrap such a request inside some library, or bundled with a control.
Try looking again at the API for the WebBrowserControl that you mention (and please tell us exactly what it is), I'd be surprised if it doesn't make the onReadyStateChange event available to you.
You're going to have to provide a lot more information than you have. E.g. Are you pushing to an app that you have developed, if so your manifest is worth sharing along with some detail about how you've implemented the push receiver. What's doing the push - another app of yours or something else, running on what? You imply that it does work with some specific hardware, if so, you should think hard about what may be different about that - e.g. Android versions? Permissions have tightened progressively over time and especially since Android-21 (Lollipop).
You should always always check your manifest first when code appears to behave but expected results don't happen.
Also, get a log (adb logcat) and filter it for some obvious keywords ("push" springs to mind) and more specifically for the push intent that should be present.
Image format? Target compression? Image quality constraint(s)? Do you have magical skills to bring to bear?
Don't tell us things you don't know please, if we all did that this website would be full of non-information!
Please explain more clearly the nature of your data and what you want to achieve. For example, are you dealing with a sequence of coordinates that form part of a route (a polyline) and you're wanting to smooth this somehow? Or perhaps these are just scatter-plot points? This is important because if there is an underlying *TIME* series then the averaging method should account for the time-ordering of the data, if not time-ordered then a different approach is needed.
Last Updated 1 Jan 1900
All Rights Reserved.