|
When posting your question please:- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode HTML tags when pasting" checkbox before pasting anything inside the PRE block, and make sure "Ignore HTML tags in this message" check box is unchecked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question in one forum from another, unrelated forum (such as the lounge). It will be deleted.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.
cheers,
Chris Maunder
The Code Project Co-fou
|
|
|
|
|
I am currently working on setting up the backend for a project template I obtained from GitHub. The frontend setup is complete, however, I've hit a roadblock while integrating the backend, which has brought my progress to a standstill. The issue arises when attempting to connect the frontend with the data from a GraphQL query using Firebase's Realtime Database. Despite numerous attempts to resolve this problem, I have been unable to make any headway, and it's becoming increasingly frustrating.
The tech stack involved in this project includes React Native, GraphQL, and Firebase, as detailed in the repository: [https://github.com/Ninjas-Code-official/olx-app-clone-backend](https://github.com/Ninjas-Code-official/olx-app-clone-backend).
At this point, I am seeking someone with expertise in these technologies to provide assistance, and if possible, code along with me to resolve this issue. The importance of getting past this hurdle cannot be overstated as it is critical to the progress and eventual success of the project. The complexity and specificity of the problem require a level of understanding and experience that I currently lack, hence the need for external help.
I am more than willing to collaborate and learn in the process. This challenge has become a significant impediment, and any assistance to overcome it would be immensely valued. The goal is to not only resolve the current issue but to also foster a learning environment that will prevent similar challenges in the future.
I am highly motivated to get this project back on track and would greatly appreciate any help that can be provided. Your expertise and willingness to assist would mean a great deal and would significantly contribute towards moving the project forward.
|
|
|
|
|
What is the importance of incorporating AI into the development of mobile apps?
|
|
|
|
|
There are a lot of mobile ai in the market
|
|
|
|
|
|
Which is the best model for developing a Food Delivery App?. Cloned app or a custom app, or an MVP?
|
|
|
|
|
The best model for developing a Food Delivery App depends on the goals and objectives of the app. A cloned app may be the fastest way to market, as it is created from pre-existing code that can be easily adapted to individual requirements. However, it will not include any unique features or branding, so this option should only be chosen if the quick turnaround time is a priority. Custom apps are tailored specifically to suit your needs and business objectives; however, they tend to require more development time and budget. An MVP (Minimum Viable Product) provides an initial version of the app without all the desired features, which can then be further developed over time based on customer feedback or revenue generated. Ultimately, choosing the best model will depend heavily on what your end goal is with regard to user satisfaction and monetization capabilities.
|
|
|
|
|
import 'package:flutter/material.dart';
import './practice2.dart';
import './practice3.dart';
void main()
{
runApp(MaterialApp(home:Akanksha()));
}
class Akanksha extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return AkankshaState();
}
}
class AkankshaState extends State<Akanksha>{
final questions=const[
{'questionText':'what is your favourite colour?','answers':['black','green','blue'],
},
{'questionText':'what is your fav drama?','answers':['black','green','blue'],
},
{'questionText':'what is your favourite animal?','answers':['black','green','blue'],
},
];
var _questionIndex=0;
void answerQuestion(){
setState((){
_questionIndex= _questionIndex+1;
});
print(_questionIndex);
if (_questionIndex<questions.length){print('We have more question!');}
else{print('no more questions!');}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar:AppBar(backgroundColor: Colors.deepOrange,
title:Text('my app')),
body:_questionIndex<questions.length ?
Column(
children: [
Question( questions[_questionIndex]['questionText'], ), ...
(
questions[_questionIndex]['answers'] as List).map((answer){
return Answer(answerQuestion , answer);
}).toList(),
],
): Center(child:Text('you did it!')),
);
}
}
import 'package:flutter/material.dart';
import './practice2.dart';
import './practice3.dart';
void main()
{
runApp(MaterialApp(home:Akanksha()));
}
class Akanksha extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return AkankshaState();
}
}
class AkankshaState extends State<Akanksha>{
final questions=const[
{'questionText':'what is your favourite colour?','answers':['black','green','blue'],
},
{'questionText':'what is your fav drama?','answers':['black','green','blue'],
},
{'questionText':'what is your favourite animal?','answers':['black','green','blue'],
},
];
var _questionIndex=0;
void answerQuestion(){
setState((){
_questionIndex= _questionIndex+1;
});
print(_questionIndex);
if (_questionIndex<questions.length){print('We have more question!');}
else{print('no more questions!');}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar:AppBar(backgroundColor: Colors.deepOrange,
title:Text('my app')),
body:_questionIndex<questions.length ?
Column(
children: [
Question( questions[_questionIndex]['questionText'], ), ...
(
questions[_questionIndex]['answers'] as List).map((answer){
return Answer(answerQuestion , answer);
}).toList(),
],
): Center(child:Text('you did it!')),
);
}
}
:wtf:
-----------------------------------------------
import 'package:flutter/material.dart';
class Question extends StatelessWidget {
String questionText;
Question(this.questionText);
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.all(20),
width: double.infinity,
child:Text(questionText,style:TextStyle(fontSize: 25),textAlign: TextAlign.center,)
);
}
}
------------------------------------------------------------------
import 'package:flutter/material.dart';
class Answer extends StatelessWidget {
final Function selectHandler;
final String answerText;
Answer(this.selectHandler, String this.answerText);
@override
Widget build(BuildContext context) {
return Container(
width:double.infinity,
child:ElevatedButton(
style: TextButton.styleFrom(backgroundColor: Colors.blueGrey,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10))),
onPressed: ()=> selectHandler(),
child:Text(answerText,style:TextStyle(color:Colors.white,fontSize:20))),
);
}
}
|
|
|
|
|
What error? Just dumping a load of code does not help us to discover what your problem is. Please edit your question and add full details of the problem.
|
|
|
|
|
In addition to what Richard said, when editing your post, please remove any unnecessary code. Just post what is relevant to the actual problem. All else is just noise.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Hello, I am new in XAMARIN, i have a simple APP in VS2022.
Here is part of the code:
public interface IRepository
{
[Get("/package/")]
Task<Resultado> GetAllData();
}
public class PaqueteServicio
{
public const string API_BASE_URL = "http://www.mi.traelopaq.net/listarpaqjson.php?text1=2264&text2=pOADSIQMASD.O398AJas&KEYAPI=ODUTRAS.9di23821@ldpli2skjs43&KEYPASo=OASmsjdu38IO1p29AA93JA0OD9K1221";
private IRepository repo;
public PaqueteServicio()
{
repo = RestService.For<IRepository>(API_BASE_URL);
}
public Task<Resultado> Get()
{
return repo.GetAllData();
}
}
Package.cs
public class Package
{
[JsonProperty("peso")]
public string Peso { get; set; }
[JsonProperty("tracking_number")]
public string TrackingNumber { get; set; }
[JsonProperty("contenido")]
public string Contenido { get; set; }
public class Resultado
{
[JsonProperty("results")]
public Package[] Results { get; set; }
}
Main:
class MainViewModel : BaseViewModel
{
private readonly PaqueteServicio paqueteServicio;
private List<Package> paqueteList;
public List<Package> PaqueteList
{
get => paqueteList;
set
{
paqueteList = value;
RaisePropertyChanged();
}
}
public ICommand ClickCommand => new Command(ClickCommandExecute);
private async void ClickCommandExecute()
{
var response= await paqueteServicio.Get();
PaqueteList = response.Results.ToList();
}
public MainViewModel()
{
paqueteServicio = new PaqueteServicio();
}
}
|
|
|
|
|
Very interesting but you forgot to ask a question. The message you see is telling you that you are trying to use a reference variable that does not have a value. This could be because you forgot to initialise it, or because some method call has not returned the reference that you expected. But either way the only way to find the offending code (and fix it) is to use the debugger and trace what your code is doing.
|
|
|
|
|
Thanks at lot,
Well, after debuggin i got this message, maybe this is really the PROBLEM:
I had read the possible solutions: But i do not get it. Sorry. Here is the code
As soon the App starts this method is executed:
public PaqueteServicio()
{
repo = RestService.For<IRepository>(API_BASE_URL);
}
and var repo get the URL value
When clicked the button: This is executed
public Task<Resultado> Get()
{
return repo.GetAllData();
}
Which it was defined here:
public interface IRepository
{
[Get("/")]
Task<Resultado> GetAllData();
}
Where Resultado is this (a class)
public class Resultado
{
[JsonProperty("results")]
public Package[] Results { get; set; }
}
And Package is my json file:
public class Package
{
[JsonProperty("peso")]
public string Peso { get; set; }
[JsonProperty("tracking_number")]
public string TrackingNumber { get; set; }
[JsonProperty("contenido")]
public string Contenido { get; set; }
}
|
|
|
|
|
Sorry, I do not know what that is supposed to mean. You need to trap the actual instruction that throws the exception.
|
|
|
|
|
Well, I just changed the code complete:
async void Button_Clicked(System.Object sender, System.EventArgs e)
{
var httpClient = new HttpClient();
var resultJson = await httpClient.GetStringAsync("http://www.mi.traelopaq.net/listarpaqjson.php?text1=2264&text2=pOADSIQMASD.O398AJas&KEYAPI=ODUTRAS.9di23821@ldpli2skjs43&KEYPASo=OASmsjdu38IO1p29AA93JA0OD9K1221");
var resultList = JsonConvert.DeserializeObject<Package[]>(resultJson);
PaqueteList.ItemsSource = resultList;
}
And Package is my json file:
public class Package
{
[JsonProperty("peso")]
public string Peso { get; set; }
[JsonProperty("tracking_number")]
public string TrackingNumber { get; set; }
[JsonProperty("contenido")]
public string Contenido { get; set; }
}
If you use postman and type the URL:
"http://www.mi.traelopaq.net/listarpaqjson.php?text1=2264&text2=pOADSIQMASD.O398AJas&KEYAPI=ODUTRAS.9di23821@ldpli2skjs43&KEYPASo=OASmsjdu38IO1p29AA93JA0OD9K1221"
You got an answer, but not in the programa, if it the same Error: Object Set without... and it is correct because there is not answer, But WHY? because it is works on postman.
|
|
|
|
|
I have explained why, and how to find the problem. I am afraid I cannot offer any more suggestions.
|
|
|
|
|
Solution:
I just changed the code to:
HttpWebRequest wReq = WebRequest.Create("http://www.mi.traelopaq.net/listarpaqjson.php?text1=2264&text2=pOADSIQMASD.O398AJas&KEYAPI=ODUTRAS.9di23821@ldpli2skjs43&KEYPASo=OASmsjdu38IO1p29AA93JA0OD9K1221") as HttpWebRequest;
string json = null;
using (HttpWebResponse wResp =(HttpWebResponse) wReq.GetResponse())
{
using (Stream s = wResp.GetResponseStream())
{
using (TextReader tr = new StreamReader(s))
{
json = tr.ReadToEnd();
MessageBox.Show(json);
}
}
}
and i can read the URL without problem
|
|
|
|
|
NB: The as operator can and will return null if the object you're trying to cast cannot be converted to the target type.
Type-testing operators and cast expression - C# reference | Microsoft Docs[^]
You use as when you're not sure whether the object can be converted to the specified type; in which case, you should always check for null before using the variable. Using T y = x as T; without then checking for y == null is always a mistake.
When you're certain that the object will be of the desired type, you use a cast expression instead: T y = (T)x; In this case, there is no need to check for null , since the runtime would throw an exception if the conversion cannot be performed.
However, in this case, it would be far better to simply use the WebRequest.CreateHttp method, which has been available since .NET 4.5, and already returns the correct type:
WebRequest.CreateHttp Method (System.Net) | Microsoft Docs[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
Is is realistic to make money from a small mobile/tablet app? That's a ridiculously vague question, I know, so I'll add a bit of background.
I'm coming to the end of a long project that has increased my experience of mobile application programming (using Xamarin and C#). I don't yet have another contract lined up. What I do have are ideas for two or three small applications, the smallest of which may take only about a month-or-so to get to a first version. Judging by other applications I have seen in the app store, I'd say that my application is something someone might pay £0-99 or £1-99 to get the Pro version (which I'd advertise in the Standard version). And I am wondering if I can make a few quid?
I don't expect to make much but even £10-£50 per month is still money in the bank. I don't seem to be able to get any kind of answer anywhere whether this is remotely likely. I guess I am hoping that one of you out there has personal experience of this and could at least sketch me an outline of whether this is even worth a go.
Absolutely any advice would be extremely welcome.
- Patrick
Thank you to anyone taking the time to read my posts.
|
|
|
|
|
I don't have the answer, but it is probably worth spending time at the app store(s). Are there any other apps that are similar, and what sort of comments are people making about them? What sort of comments do you see on any apps that are only vaguely similar? One of the main take homes from the comments is finding out what the public want to see from their apps.
|
|
|
|
|
Good advice, Richard, and something I haven't done enough of.
Thank you to anyone taking the time to read my posts.
|
|
|
|
|
You can sell a few; depends on the app. If it's another "pdf reader", probably not.
If it's an app you wouldn't use yourself; probably not.
My current app will be a first of a kind; I'll see what it does. My other apps are similar to some others; I just made mine better (or tried).
In the Microsoft store, you pay higher fees to MS (30%) for games you sell than for others (10%). Although my apps have a "gaming" aspect to them, I have them in the "reference" section because they have a historical aspect. (Which gave me material for more ideas)
Anyway, there are "thousands" of apps; so you get to dabble in "box art" and "marketing" to get your app noticed (and "moved" in the listings). The Store gives you a page for your app; so you get some analytics to work with.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
Thank you, Gerry. Some things in there I had thought about but maybe not thought enough about.
(I didn't even know Microsoft had an app store, at least one that you maybe can make money out of.)
Thank you to anyone taking the time to read my posts.
|
|
|
|
|
I agree with the Microsoft store part.
|
|
|
|
|