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,451
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,047
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.
  • M murtaza12:
    XPremiuM said:
    Why? Was the site hacked or something?
    Yes
    Link
  • XPremiuM XPremiuM:
    GloriousChicken said:
    Everyone, please change your passwords.
    Why? Was the site hacked or something?
    Link
  • GloriousChicken GloriousChicken:
    Everyone, please change your passwords.
    Link
  • Necrokiller Necrokiller:
    The only valid thing from his pov he said in the video is AC dead since Black Flag. According to woke police that game was woke too. Welsh man in West Indies. So atleast he's consistent I guess lol
    Link
  • Link
  • XPremiuM XPremiuM:
    Necrokiller said:
    It's based on an actual real life person so I don't think the woke police have a valid case here.
    Nope. They have a very valid case. The above video explains it all.
    Link
  • Necrokiller Necrokiller:
    It's based on an actual real life person so I don't think the woke police have a valid case here.
    • Like
    Reactions: SolitarySoldier
    Link
  • XPremiuM XPremiuM:
    Meanwhile Ghost of Tsushima PC version is out now. Looks 100 times better than ASS Creed already.
    Link
  • XPremiuM XPremiuM:
    Did y'all see the new Assassin's Creed trailer? They finally made a AC set in Japan & then they put a negro as the male protagonist. Ubisoft is taking cues from Disney, and it isn't gonna end well for them, just like Disney. Go woke, go broke!
    Link
  • Necrokiller Necrokiller:
    First Fallout 4 update and now this 🤡
    Link
  • Necrokiller Necrokiller:
    MS and Bethesda continuing their streak of massive Ls 😬
    Link
  • Link
  • funky funky:
    Hello
    Link
  • NaNoW NaNoW:
    by closing down good studios
    Link
  • NaNoW NaNoW:
    well he is breaking barriers
    • Like
    Reactions: KetchupBiryani
    Link
  • iampasha iampasha:
    SolitarySoldier said:
    Phil keeps talking about breaking barriers to gaming, making it accessible on all platforms yada yada, while killing competition and creativity at the same time. the fact that i actually believed him for a second lol
    guys the biggest yapper in the Industry right now. All he do is yap
    Link
  • Necrokiller Necrokiller:
    Phil should be held responsible for this shitfest too, just like Sarah, but it's highly likely that these decisions are coming from Satya. And this isn't even the end of it. More closures are coming.
    Link
  • SolitarySoldier SolitarySoldier:
    if we are moving towards more and more popular trash across platforms that make billions for companies, I'm happy with all the barriers and exclusivity because at least that brings some pressure to create good stuff.
    Link
  • SolitarySoldier SolitarySoldier:
    Phil keeps talking about breaking barriers to gaming, making it accessible on all platforms yada yada, while killing competition and creativity at the same time. the fact that i actually believed him for a second lol
    Link
  • SolitarySoldier SolitarySoldier:
    "These changes are not a reflection of the creativity and skill of the talented individuals at these teams or the risks they took to try new things" ... seems to me that's exactly what it is
    Link
  • SolitarySoldier SolitarySoldier:
    why make good games when u can just buy everyone and shut them down lol
    Link
  • XPremiuM XPremiuM:
    I'm gonna say one last time, F*** Microsoft to infinity!
    Link
  • XPremiuM XPremiuM:
    Microsoft deserves all the hate they can get. Seriously i can't explain how much i want to curse them out.
    Link
  • XPremiuM XPremiuM:
    They could've sold the studios instead of closing them, but the nazi bastards just didn't want competition down the road.
    Link
  • Link
    M murtaza12: Why? Was the site hacked or something?Yes