The Official Programming Thread

asad3man

Omniscient
Jul 21, 2011
822
0
22
Karachi
that entirely depends on your approach towards programming. for a very basic solution i would
  1. take a piece of paper and a pencil
  2. sketch a pacman map on it
  3. brain storm what possible way i can represent it in my code
  4. i may use a 2D array of 1s and 0s where 1s will represent a wall and 0s represent an open space
  5. navigation methods can use the 0/1s to allow or block movement


11111
10011
11001
10001
11111


color up the 1s only in the above table and you will get how i represented a map
Okay I got this thing. But what about the approach, after making this map. Can you make a class or two to explain me. Any two class?
 

EternalBlizzard

Lazy guy :s
Moderator
Oct 29, 2011
2,732
1,195
129
Attractor Field Beta
Ok next up is my Image Processing project i did in my 2nd semester. Noise removal through Vector Median filter and Edge detection through Sobel-Feldmen Operator....

@puppet
Kesa :D ?
Images aren't working for some reason, here is the link to the album
http://imgur.com/a/paB2a ( watch it in full size and you'll notice how noise is reduces)
Spoiler: show




This is the image with the noise in it, view it in full size... \/


This is the image after i applied Vector Median Filter x1 time.


And this is the image after x2

 

Attachments

Last edited:

thugslife

-PG-THuG-
Jan 18, 2012
919
0
21
Karachi
Hey guys i really need some help regarding a debug I am creating a POS application but I am stuck at some point the checkout class is making some problem and I am unable to figure out the problem

the error is

Exception in thread "main" java.lang.NullPointerException
at controller.ShoppingCart.checkOut(ShoppingCart.java:75)
at pos1.POSApp.main(POSApp.java:31)

following link contains the rar file for the project file
https://drive.google.com/file/d/0B3aPDdCOdAHARDZxMktSV0IxYms/view?usp=sharing

@
Newton @asad3man @Eternal Blizzard@staticPointer
 
Last edited:

Newton

Well-known member
May 17, 2009
2,223
0
41
Lahore, Faisalabad
Hey guys i really need some help regarding a debug I am creating a POS application but I am stuck at some point the checkout class is making some problem and I am unable to figure out the problem

the error is

Exception in thread "main" java.lang.NullPointerException
at controller.ShoppingCart.checkOut(ShoppingCart.java:75)
at pos1.POSApp.main(POSApp.java:31)

following link contains the rar file for the project file
https://drive.google.com/open?id=0B3aPDdCOdAHARDZxMktSV0IxYms

@
Newton @asad3man @Eternal Blizzard@staticPointer
Please explain what your project is trying to do in a few simple lines. I'll look at your code sometime after lunch today

Sent from my LG-H818 using Tapatalk
 

EternalBlizzard

Lazy guy :s
Moderator
Oct 29, 2011
2,732
1,195
129
Attractor Field Beta
Hey guys i really need some help regarding a debug I am creating a POS application but I am stuck at some point the checkout class is making some problem and I am unable to figure out the problem

the error is

Exception in thread "main" java.lang.NullPointerException
at controller.ShoppingCart.checkOut(ShoppingCart.java:75)
at pos1.POSApp.main(POSApp.java:31)

following link contains the rar file for the project file
https://drive.google.com/open?id=0B3aPDdCOdAHARDZxMktSV0IxYms

@
Newton @asad3man @Eternal Blizzard@staticPointer
Try debug it yourself. Read on the net why Null pointer exception is thrown and what it is. You might be trying to use an uninitialized object reference
 

thugslife

-PG-THuG-
Jan 18, 2012
919
0
21
Karachi
Please explain what your project is trying to do in a few simple lines. I'll look at your code sometime after lunch today

Sent from my LG-H818 using Tapatalk
It consist of a local file consisting of items with price currency and id the user will prompt to enter product id`s which will be added to cart then proceed to checkout .. but the problem is whenever I finish adding items to the cart and exit to the checkout the Null Point exception occurs the problem lies in the ShoppingCart Class in which there is a method CheckOut()

- - - Updated - - -

Try debug it yourself. Read on the net why Null pointer exception is thrown and what it is. You might be trying to use an uninitialized object reference
before posting i tried every expect of debugging :( after I lost faith in myself i posted here
 

Newton

Well-known member
May 17, 2009
2,223
0
41
Lahore, Faisalabad
@thugslife
i went through your code. the issue is in the below method loadItemDetails

Code:
public ArrayList<Item> loadItemDetails(ArrayList<String> itemIds) {

 ArrayList<Item> purchasedItemList = new ArrayList<Item>();


 //read all the available item map
 ItemManager itemManager = new ItemManager();
 HashMap<String,Item> allItems = itemManager.getAllItems();

 for (int i = 0; i < itemIds.size(); i++) {
  String index = (String)itemIds.get(i);
  System.out.println(allItems.keySet());
  [COLOR=#ff0000]Item temp = allItems.get("\"i1");[/COLOR]
  purchasedItemList.add(temp);
 }
 return purchasedItemList;
}
the keys which you are storing in your HashMap are not i1, i2, i3 but they are "i1, "i2 and "i3. look at the red line above and you will understand the issue. I hope this helps.

​EDIT : ignore the extra stuff i added for testing
 
Last edited:

AsadAbrar

PG's Original Coolboy \m/
Aug 27, 2009
5,456
0
41
27
Lahore
Guys, which language should i learn which would help me later when i complete my BS CS degree?
I'm a noob and i just started html from codecademy.

Sent from my HUAWEI VNS-L21 using Tapatalk
 

EternalBlizzard

Lazy guy :s
Moderator
Oct 29, 2011
2,732
1,195
129
Attractor Field Beta
Guys, which language should i learn which would help me later when i complete my BS CS degree?
I'm a noob and i just started html from codecademy.

Sent from my HUAWEI VNS-L21 using Tapatalk
Depends on what you actually want to do later on... BW shared an image here lemme reupload it...
Spoiler: show

And it greatly helps if you pick C/C++ cuz it's a general purpose language so its used in most places. My uni didn't teach me C/C++ so im learning by myself as its feels awkward to say i don't know C/C++ but know other high level languages like Java and C# ;s

That aside the main thing for beginners is to grasp the logic. Loops/functions/structures etc. When you grasp the concepts switching languages is easy as a pie.

Also HTML is completely different. It's not your typical programming language and most ppl don't even consider it one.
 
Last edited:

djkk16

Well-known member
Nov 16, 2011
1,042
1
43
30
Karachi
www.matrahshipping.com
Depends on what you actually want to do later on... BW shared an image here lemme reupload it...
Spoiler: show

And it greatly helps if you pick C/C++ cuz it's a general purpose language so its used in most places. My uni didn't teach me C/C++ so im learning by myself as its feels awkward to say i don't know C/C++ but know other high level languages like Java and C# ;s

That aside the main thing for beginners is to grasp the logic. Loops/functions/structures etc. When you grasp the concepts switching languages is easy as a pie.

Also HTML is completely different. It's not your typical programming language and most ppl don't even consider it one.
Nice share mate.

Currently learning c++ myself with the help of a good book and doing practice programs.

Where are you learning it from ?

Sent from my SM-G935F using Tapatalk
 
General chit-chat
Help Users
We have disabled traderscore and are working on a fix. There was a bug with the plugin | Click for Discord
  • No one is chatting at the moment.
    faraany3k faraany3k: Tears of Kingdom saal pehle shuru ki thee, ab tk pehle area se nai nikla. Life sucks donkey balls.