In Windows 8 theres 3 categories of processes in the taskmanager, Apps, Background Processes and Windows-Processes. I'm wondering, how are apps created in such a way that its listed as an backgroundprocess instead of an app? My program only runs in the background and doesn't need any userinteraction at all.
I've tried using HttpWebRequest but I can't seem to get it working. The thing returns a JSON string and I have never used it before. No idea how to do this
I have a decent understanding of Java but I really don't know how to apply this stuff to anything. Would making a crappy android app be a good place to start?
[QUOTE=Donkie;42688147]In Windows 8 theres 3 categories of processes in the taskmanager, Apps, Background Processes and Windows-Processes. I'm wondering, how are apps created in such a way that its listed as an backgroundprocess instead of an app? My program only runs in the background and doesn't need any userinteraction at all.[/QUOTE]
Those may be services, but I haven't looked it up.
I have puush installed for example, which lists there under. However, in the windows services list, there's no puush. :(
[QUOTE=Over-Run;42688206]I've tried using HttpWebRequest but I can't seem to get it working. The thing returns a JSON string and I have never used it before. No idea how to do this[/QUOTE]
Well, if the information is in the JSON string you'll just have to parse that for the specific data you want to extract.
There's for example [url=https://json.codeplex.com/]Json.NET[/url]. MSDN mentions [url=http://jayrock.berlios.de/]Jayrock[/url]. I can't really tell you which is better for what use case and there are probably more implementations available. Look at some example snippets in the library documentation and choose what you think works best for you.
[QUOTE=LaughingStock;42688284]I have a decent understanding of Java but I really don't know how to apply this stuff to anything. Would making a crappy android app be a good place to start?[/QUOTE]
I'm somewhat unsure of what you're problem, it sounds mutually exclusive to me.
Are you just looking for some simple-ish tasks to gain experience?
Android Java is somewhat different to Desktop Java. Unless your goal is to create and deploy Android apps, I'd suggest you try doing stuff for the Desktop. For example a Sudoku solver, or a 8-queens puzzle solver.
Well I have a simple app I plan on making but I don't know how difficult it will be to make. It's a flashcard app where the user can input values and stuff. Would it be more helpful if I started learning how to make desktop stuff?
Hey so I've been making a miniature math quiz program. The purpose is to practice methods, but I'd like to know if I've covered almost everything. I have two more methods to create, but this one encompasses the storage of the correct random number problem(which requires another method).
[CODE] /**
* generates problem to solve UNFINISHED. getCorrectAnswer "returns the
* correct answer to the problem."
*/
public static int getCorrectAnswer(String symbol, int numberOfDigits, int numberOfProblems) {
int randomNumberX = getRandomNumber(numberOfDigits);
int randomNumberY = getRandomNumber(numberOfDigits);
int displayProblem;
for (int i = 1; i <= numberOfProblems; i++) {
if (symbol.equals("+")) {
System.out.println(randomNumberX + " " + "+" + " " + randomNumberY);
displayProblem = randomNumberX + randomNumberY;
} else if (symbol.equals("-")) {
System.out.println(randomNumberX + " " + "-" + " " + randomNumberY);
displayProblem = randomNumberX + randomNumberY;
} else {
System.out.println(randomNumberX + " " + "*" + " " + randomNumberY);
displayProblem = randomNumberX + randomNumberY;
}
}
return displayProblem;
}
}[/CODE]
[url]http://pastebin.com/NddKjZnq[/url] <= the entire code
I know I'm running into a run time error, but how do I fix that? Does my for loop not work? I still have to make two more methods (getUserAnswer – displays the problem and returns the user’s answer. checkAndDisplayResult – checks if the user’s answer is correct and displays an appropriate message.)
What is the easiest way to create a histogram with a bump in the middle,
Im trying to do a quick for loop that given an array with 256 values creates a mountain like shape (as in ascending and then descending) in between the 2 numbers of the array
something like:
[IMG]http://i.imgur.com/JfYU9ns.png[/IMG]
[QUOTE=Richy19;42691664]What is the easiest way to create a histogram with a bump in the middle,
Im trying to do a quick for loop that given an array with 256 values creates a mountain like shape (as in ascending and then descending) in between the 2 numbers of the array
something like:
[IMG]http://i.imgur.com/JfYU9ns.png[/IMG][/QUOTE]
One possible starting point: [url]http://en.wikipedia.org/wiki/Normal_distribution[/url]
In C++11, would there be an advantage of doing this:
[cpp]void doSomething(std::vector<T> & outValues){
}[/cpp]
over this?
[cpp]std::vector<T> doSomething(){
}[/cpp]
Considering the outValues vector is empty?
This should be a simple question for most of you here to answer. I'm working on a small C# program to teach myself the basics of C#, and I have a local IDisposable (HttpWebResponse) located in a method for a class.
When the method ends and goes out of scope, will the IDisposable automatically be garbage collected, or will I need to use a using block?
[QUOTE=WTF Nuke;42693683]In C++11, would there be an advantage of doing this:
[cpp]void doSomething(std::vector<T> & outValues){
}[/cpp]
over this?
[cpp]std::vector<T> doSomething(){
}[/cpp]
Considering the outValues vector is empty?[/QUOTE]
I would consider clarity as a big plus for the second one. As for what is actually going on: in older C++ standards you might take a performance hit in the second because the object is not returned by reference and so would have to be copied; in C++11 however you only need to define a move ctor and the standard will take care of std:move()'ing your local object to the caller as an rvalue (or you can be explicit about it to be sure).
I'm not familiar enough with how a vector compares to a reference in memory to know for sure, but I would assume the bookkeeping members of a vector probably consumes at least as much memory as a reference to it, as a reference is just a pointer (8 bytes on 64-bit, i.e. 8 chars, probably 2 ints, etc.) which the compiler enforces stricter semantics on.
Someone [i]please[/i] correct me, because I'm certain I've made mistakes here, but this is how I understand it.
I need help, I'm doing my final project for a uni course and I haven't done anything with GUIs in Java before and I'm having trouble
this is what I have: (indenting got messed up from copy paste) It doesn't do anything, it opens up a window with nothing on it.
[code]
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
public class Frame extends JFrame implements ActionListener {
private JFrame frame = new JFrame("BMS Window");
private JButton logButton = new JButton("Press Me");
private JTextField gridField = new JTextField(2);
private JTextField regField = new JTextField(6);
private String[] teamStrings = { "MMT 1", "MMT 2", "MMT 3"};
private JComboBox teams = new JComboBox(teamStrings);
private JTextArea logArea = new JTextArea(10, 30);
Frame() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container con = this.getContentPane();
logButton.addActionListener(this);
layoutComponents();
frame.pack();
setVisible(true);
}
private void layoutComponents() {
JPanel contain = new JPanel(),
fields = new JPanel(),
logs = new JPanel();
contain.setLayout(new BoxLayout(contain, BoxLayout.X_AXIS));
fields.setLayout(new BoxLayout(fields, BoxLayout.Y_AXIS));
logs.setLayout(new BoxLayout(logs, BoxLayout.Y_AXIS));
frame.add(contain);
contain.add(fields);
contain.add(logs);
// Fields
fields.setBorder(new EmptyBorder(5, 5, 5, 5));
fields.add(new JLabel("Registration:"));
fields.add(regField);
fields.add(new JLabel("Grid:"));
fields.add(gridField);
fields.add(new JLabel("Team:"));
fields.add(teams);
// Log area
logs.setBorder(new EmptyBorder(5, 5, 5, 5));
logArea.setEditable(false);
JScrollPane scroller = new JScrollPane(logArea);
logs.add(logArea);
logs.add(scroller);
}
public void actionPerformed(ActionEvent event) {
Object source = event.getSource();
if (source == logButton) {
}
}
}[/code]
You never add contain to con.
[QUOTE=elevate;42697783]This should be a simple question for most of you here to answer. I'm working on a small C# program to teach myself the basics of C#, and I have a local IDisposable (HttpWebResponse) located in a method for a class.
When the method ends and goes out of scope, will the IDisposable automatically be garbage collected, or will I need to use a using block?[/QUOTE]
I haven't used c# in ages but I'm fairly certain it won't be disposed automatically if an exception is thrown, unless you use try or using
This probably sounds dumb, but I'm taking an Assembly Language class, and we have to make a program that divides two numbers without using a DIV command. Anyone here pretty knowledgeable at ASM? This is the only thing I really needed some help with. I know it involved shifting and rotating and shit.
[QUOTE=Rayjingstorm;42697865]I'm not familiar enough with how a vector compares to a reference in memory to know for sure, but I would assume the bookkeeping members of a vector probably consumes at least as much memory as a reference to it, as a reference is just a pointer (8 bytes on 64-bit, i.e. 8 chars, probably 2 ints, etc.) which the compiler enforces stricter semantics on.[/QUOTE]
I didn't understand that paragraph.
If you also use RVO, both are essentially the same. Otherwise the second version gets a small hit for copying some of the vectors data, namely sizeof(std::vector) bytes, which is not the same as sizeof(T) * vector.capacity() or sizeof(T) * vector.size(). On my system it's 24 bytes, so yeah, small hit, which can be avoided with RVO though.
[QUOTE=LaughingStock;42691104]Well I have a simple app I plan on making but I don't know how difficult it will be to make. It's a flashcard app where the user can input values and stuff. Would it be more helpful if I started learning how to make desktop stuff?[/QUOTE]
I have no experience with Android development, but I imagine that if you grasp Java somewhat well you can probably delve into it.
Look for the official Android development documentation or some tutorials and if you seem to be way over your head do some more Desktop Java devving, otherwise what works works :)
[QUOTE=elevate;42697783]This should be a simple question for most of you here to answer. I'm working on a small C# program to teach myself the basics of C#, and I have a local IDisposable (HttpWebResponse) located in a method for a class.
When the method ends and goes out of scope, will the IDisposable automatically be garbage collected, or will I need to use a using block?[/QUOTE]
Yes, it will eventually be garbage collected, regardless of a using-statement, if it becomes unreachable.
However, neither IDisposable nor a using-block ensure that the object will be garbage collected directly when going out of scope.
Also note that IDisposable.Dispose is not the same as a finalizer.
The using-statement will call Dispose on the object when the block ends (or an exception is thrown), but you do not need it. You can also call Dispose manually or not call it at all. Whether this is smart is probably questionable.
A side note, the [url=http://msdn.microsoft.com/en-us/library/b1yfkh5e.aspx]Basic Dispose Pattern[/url] is probably a good idea.
[editline]30th October 2013[/editline]
[QUOTE=AJisAwesome15;42698907]This probably sounds dumb, but I'm taking an Assembly Language class, and we have to make a program that divides two numbers without using a DIV command. Anyone here pretty knowledgeable at ASM? This is the only thing I really needed some help with. I know it involved shifting and rotating and shit.[/QUOTE]
[url]https://en.wikipedia.org/wiki/Division_algorithm#Integer_division_.28unsigned.29_with_remainder[/url]
This is probably the [del]droid[/del] algrithm you're looking for.
[QUOTE=Tamschi;42698764]You never add contain to con.[/QUOTE]
The window still comes up blank regardless.
[img]http://i.imgur.com/Q3miyy8.png[/img]
What causes these kinds of shadows?
You mean flat shading or z-fighting?
Definitely not flat shading, but how can shadows cause z-fighting like that. I don't know enough about it but it seems weird that a shadow z-fights with the original color.
[editline]30th October 2013[/editline]
I modified the near clipping plane of the camera and this seems to solve it.
[editline]30th October 2013[/editline]
A technical explanation would still be appreciated.
[QUOTE=Asgard;42699529]Definitely not flat shading, but how can shadows cause z-fighting like that. I don't know enough about it but it seems weird that a shadow z-fights with the original color.
[editline]30th October 2013[/editline]
I modified the near clipping plane of the camera and this seems to solve it.
[editline]30th October 2013[/editline]
A technical explanation would still be appreciated.[/QUOTE]
I think what you're looking for is called shadow acne - [url]http://msdn.microsoft.com/en-us/library/windows/desktop/ee416324(v=vs.85).aspx[/url]
[editline]30th October 2013[/editline]
In short, since the light's depth buffer is at a different angle than the surface being checked for shadows and because it has a limited precision, some pixels appear to be slightly behind the surface described in the depth buffer.
[editline]30th October 2013[/editline]
An image that explains it really well:
[img]http://www.opengl-tutorial.org/wp-content/uploads/2011/08/shadow-acne.png[/img]
From: [url]http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-16-shadow-mapping/[/url]
[QUOTE=Pat.Lithium;42699021]The window still comes up blank regardless.[/QUOTE]
You're creating a JFrame inside your JFrame, you're adding your elements to the JFrame inside your JFrame throughout the class, but at the creation of the class, it's the class you're setting visible, instead of the JFrame inside your JFrame class.
[cpp]
private JFrame frame = new JFrame("BMS Window");
...
frame.add(contain);
frame.pack();
//You're setting your class visible, but not the JFrame you've created.
setVisible(true);
[/cpp]
Either do frame.setVisible(true) and don't extend your class from JFrame, or add your JPanel contain to your class and not the JFrame inside your class.
Also you're doing this
[cpp]
Container con = this.getContentPane();
[/cpp]
This code isn't used, and isn't necessary as JFrame directs all add() calls to it's container automatically.
I think :v:
Hey guys,
Me again...(surprise!)
So, i'm working on a small assignment, to try and clear things up for a big assignment due tomorrow night that i'm about to start on.
i need to have #include <fostream> for input and output, right?
For the example problem, we're taking two .dat files, one with our first name, and one with our last, that input the data, then output them to a file i'm naming myName.dat.
So, i've got fostream, and then in my actual code part i have something like this
[code]
ifstream infirstName;
ifstream inlastName;
ofstream outmyName;
//theeeennnn
infirstName("C:\firstName.dat");
inlastName("C:\lastName.dat");
outmyName("C:\myName.dat");
//Then for the "equation"
myName = << lastName << "," << firstName <<endl;
//then i have a cout to display the same thing on the screen, so you can see it.
[/code]
Is there something i'm missing?
I got some error codes, so i cleaned everything, and i'm resetting my computer, since it's been on for a few days, just to make sure.
Thanks in advance, guys. I'm sure i'll be back in a few hours once i start in on this beastly project...
:edit:
I think i figured it out. I got rid of
the in and outs from the declarations...
I am not a smart man.
:double edit:
Nope, i'm still a retard.
[editline]30th October 2013[/editline]
So, sorry to bombard this with posting, but here's what I've got:
[code]
//Aaron White
//namegame
//A program to input first and last name, and output a whole name.
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
using namespace std;
void Pause ()
{//freezes screen
char junk;
cout <<endl; << endl; << "Press some keys followed by the Enter key to continue...";
cin.ignore();
cin.get(junk);
//end pause
}
int main()
{ //MAIN BODY
//identify constants
//identify variables
ifstream infirstName("C:\firstName.dat");
ifstream inlastName("C:\lastName.dat");
ofstream outmyName("C:\myName.dat");
//input from keyboard
//calculate
myName = << lastName << "," << firstName <<endl;
cout << lastName << "," << firstName <<endl;
//display results
Pause();
return(0);
}
[/code]
I know it's messed up (obviously, since it won't run.) but i'm having trouble figure out what all i've got screwed up.
I'm trying to read my Textbook, but their website is acting up, so i can't go back to the chapter.
Anyhow, if someone knows how to fix my mess, i'd appreciate any pointers.
The program is supposed to take firstName.dat, and lastName.dat and save the info from within to myName.dat.
I'm royally fucking something up, i just haven't figure out what.
I'll head back to Google.
Thanks to whichever of you code magicians can help me pull my head out of my ass.
Zeeky how would I go about getting the info off a website?
I tried using the HttpWebRequest stuff but it doesn't work. Every example I see is uses a .GetResponse, but when I try the only method I have is a .GetResponseAsync(), so I think it has been updated. I don't know how to do it like this and can't find a good example
[QUOTE=JohnStamosFan;42704630]Hey guys,
Me again...(surprise!)
So, i'm working on a small assignment, to try and clear things up for a big assignment due tomorrow night that i'm about to start on.
i need to have #include <fostream> for input and output, right?
For the example problem, we're taking two .dat files, one with our first name, and one with our last, that input the data, then output them to a file i'm naming myName.dat.
So, i've got fostream, and then in my actual code part i have something like this
I know it's messed up (obviously, since it won't run.) but i'm having trouble figure out what all i've got screwed up.
I'm trying to read my Textbook, but their website is acting up, so i can't go back to the chapter.
Anyhow, if someone knows how to fix my mess, i'd appreciate any pointers.
The program is supposed to take firstName.dat, and lastName.dat and save the info from within to myName.dat.
I'm royally fucking something up, i just haven't figure out what.
I'll head back to Google.
Thanks to whichever of you code magicians can help me pull my head out of my ass.[/QUOTE]
[code]
#include <iostream>
#include <fstream>
#include <string>
#include <conio.h>
int main()
{
std::ofstream Output("D:/output.dat", std::ios::binary);
std::ifstream Input1("D:/input1.dat", std::ios::binary);
std::ifstream Input2("D:/input2.dat", std::ios::binary);
std::string outp;
{
std::string inp1, inp2;
std::getline(Input1, inp1);
std::getline(Input2, inp2);
outp = inp1 + outp += ", " + inp2;
}
std::cout << outp << std::endl;
Output << outp;
_getch();
return 0;
}
[/code]
Make of it what you wish.
Also just a tip, don't write comments like "declare variables", "calculate", "display results" as they are completely useless. Write comments about stuff that needs it, future documentation, an explanation why.
[QUOTE=CRASHFORT;42706159]Also just a tip, don't write comments like "declare variables", "calculate", "display results" as they are completely useless. Write comments about stuff that needs it, future documentation, an explanation why.[/QUOTE]
I think it's good if he does so in the beginning so that the teacher knows that he knows what he talks about, then later on the things you should comment become quite apparent.
[QUOTE=CRASHFORT;42706159]
Also just a tip, don't write comments like "declare variables", "calculate", "display results" as they are completely useless. Write comments about stuff that needs it, future documentation, an explanation why.[/QUOTE]
Yeah, it's just something our teacher wants, like Johan said.
He likes us to state what we're doing, i guess as a way to reinforce it to us, and make it easier to go through it in class.
[QUOTE=Over-Run;42705880]Zeeky how would I go about getting the info off a website?
I tried using the HttpWebRequest stuff but it doesn't work. Every example I see is uses a .GetResponse, but when I try the only method I have is a .GetResponseAsync(), so I think it has been updated. I don't know how to do it like this and can't find a good example[/QUOTE]
.NET 4.5 still has [url=http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.getresponse.aspx]GetResponse[/url] and I can't find anything about HttpWebRequest being changed in .NET 4.5.1.
What's the exact error message you get when attempting to use GetResponse?
Sorry, you need to Log In to post a reply to this thread.