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.
  • L LegacyGamerGuy:
    About the Microsoft (and Sony) debate, I feel both have become too greedy and losing their minds over corporate greed. Personally, I will never buy any console next gen and switch to PC gaming where democracy reins.
    Link
  • L LegacyGamerGuy:
    No news about Google Play Store hacking. What is the source?
    Link
  • Link
  • Aciel Aciel:
    This is the error.
    Link
  • Aciel Aciel:
    Online session is enabled for UBL. I have an active subscription with my NayaPay card (it is already added to Google Payment Methods).
    Link
  • B Baghi:
    did you try setting up Google Payments? For UBL you may have to get it enabled for internet transactions, Naya should work without it!
    Link
  • Aciel Aciel:
    I tried both NayaPay, and UBL, but I keep getting "correct country selected..." error. I already have PK set there 🤦‍♂️
    Link
  • Aciel Aciel:
    Baghi said:
    Link
  • B Baghi:
    Yes
    Link
  • Aciel Aciel:
    Does your VISA Cards work on Google Play Store?
    Link
  • 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
    L LegacyGamerGuy: About the Microsoft (and Sony) debate, I feel both have become too greedy and losing their minds...