The Official Programming Thread

Hassan

lethargic procrastinator
Jun 20, 2009
6,273
0
41
3 miles from the nearest bus stop
so there are alot of software engineers or students who are enrolled in this field who perform programming on daily basis. Nowadays, programming is related to almost all the fields so people other than BSSE students also have to study programming. I am studying electrical engineering and they want me to study programming. I already know the basics, now i will be studying it in detail so if i or anyone else will be needing help regarding programming they may use this thread. However i will be learning and discussing programming with you guys. Looking forward to some cooperative guys.
 

StrikerX

Moderator
Moderator
Apr 6, 2009
6,636
52
54
Islamabad
Damn... totally forgot about making this sort of thread...
[MENTION=4177]NaNoW[/MENTION] forgive me sensei :p Anyways, I'll write up something tonight or tomorrow. Also, should the thread stay here or better would be Software/Game Development and Programming ?



@others I'll make a draft for the first post and you guys can pitch in on what more to add and remove.
 

Salvation

L'obscurité vous entoure
Dec 5, 2010
741
1
22
Osama-Land!
let this thread stay here in my opinion since it will be used for learning purposes only, and not to forget that Education section is visited more often than the Software development section. Let that one serve its purpose for professional development purpose only i guess?
 

Shary Bhallu TC

Bhallu is dead, legacy remains
Jun 2, 2009
16,372
692
129
30
Karachi.
Am also studying C Language and CAO in Electrical Engg. It's a good idea to make this thread, and will help many people including me (I hope).
 

StrikerX

Moderator
Moderator
Apr 6, 2009
6,636
52
54
Islamabad
let this thread stay here in my opinion since it will be used for learning purposes only, and not to forget that Education section is visited more often than the Software development section. Let that one serve its purpose for professional development purpose only i guess?
Yeah sure, that section is in the bottom so most people miss it as well ...
 

NaNoW

Administrator
ADMIN
Feb 5, 2008
11,350
433
89
Karachi, Pakistan
so there are alot of software engineers or students who are enrolled in this field who perform programming on daily basis. Nowadays, programming is related to almost all the fields so people other than BSSE students also have to study programming. I am studying electrical engineering and they want me to study programming. I already know the basics, now i will be studying it in detail so if i or anyone else will be needing help regarding programming they may use this thread. However i will be learning and discussing programming with you guys. Looking forward to some cooperative guys.
I think in any programming website..Codecademy.com should be mentioned ..its a pretty great site..
 

EternalBlizzard

Lazy guy :s
Moderator
Oct 29, 2011
2,732
1,195
129
Attractor Field Beta
[MENTION=5946]hotgamerft[/MENTION]

do you know Ruby? Im currently learning it from codeacademy... if i'll run into any problem i'll be sure to ask here....

Yeah sure, that section is in the bottom so most people miss it as well ...
I wanted a thread like this for a long time... and i'll say put it in the software development section as many people who know programming or are making games/softwares should remember that section very well... and personally i think i've seen many people there who know a lot and i don't see them in this section... just my opinion..
I already had a thread there where i asked about C# queries and i remember many people were helping me there so that'd be a good place...
 

babarali124

Dota 2 Freak
Jan 24, 2014
466
2
23
hyderabad
A PHP Program on current political situation of Pakistan :D
Code:
<?php

$nawaz = "Corrupt leader";
$imran = "Mujahid-True Democatic Leader";
$raheelshreef = "Martial Law";
$resign = "resign";
if($nawaz = $resign || $raheelshareef = "Martial Law"){

echo "Nawaz Shareef in Jail";
echo "Imran Khan : President Of Pakistan";
}
else {

echo " We are f..kd up ";
echo " Corruption";
echo "Terrorism";
echo "Law and order disruption";
}

?>
 
Last edited:
  • Like
Reactions: khan ayaz

staticPointer

PG LEGENDARY
Dec 7, 2012
3,266
0
41
افغانستان
www.pakgamers.com
A PHP Program on current political situation of Pakistan :D
<?php

$nawaz = "Corrupt leader";
$imran = "Mujahid-True Democatic Leader";
$raheelshreef = "Martial Law";
$resign = "resign";
if($nawaz = $resign || $raheelshareef = "Martial Law"){

echo "Nawaz Shareef in Jail";
echo "Imran Khan : President Of Pakistan";
}
else {

echo " We are f..kd up ";
echo " Corruption";
echo "Terrorism";
echo "Law and order disruption";
}

?>
 

hotgamerft

lolz
Sep 10, 2008
4,564
16
44
Peshawar
[MENTION=5946]hotgamerft[/MENTION]

do you know Ruby? Im currently learning it from codeacademy... if i'll run into any problem i'll be sure to ask here....
Nope haven't used Ruby, but have heard about it.

I know C. C++, C#, Java, PHP, ASP .Net, VB .Net and have worked a little in WCF & WF
 

umair23

Muhmmed Umair (PG Xtremist)
Dec 9, 2010
800
2
23
Gulzar Hijri Scheme 33, Karachi
If anybody needs Raspberry pi (a modern sexy controller with hdmi output) then contact me. I bought it last year for my Final Year Project and programmed it in python. It still has the programming of my FYP that is Heads Up Display. Ill post a picture of the controller and video of my project.


 

Salvation

L'obscurité vous entoure
Dec 5, 2010
741
1
22
Osama-Land!
Ok so here is some really stupid problem i am stuck at. If someone could help it would be really appreciated.
I am working on a test android app just for learning purposes. The first two activities work fine, the translation animations work fine, opacity animations work fine, database works fine. But when I jump to the third activity, it pops up and is blank.
here is the XML code for UI
Code:
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/layout_base"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
     android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin" >
    
    <LinearLayout 
        android:id="@+id/layout_optionToInsert"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="visible">
        
        <Button
            android:id="@+id/btnInsertShirt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/btnTextInsertShirt"
            />
        <Button 
            android:id="@+id/btnInsertTrousers"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/btnTextInsertTrouser"/>
        
        <Button
            android:id="@+id/btnInsertSuit"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/btnTextInsertSuit"
            />
        
        <Button android:id="@+id/btnInsertTie"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/btnTextInsertTie"
            />


        <Button
            android:id="@+id/btnBack3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/btnTextBack3" />
  
    </LinearLayout>
    
    <LinearLayout
        android:id="@+id/layout_InsertShirt"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone"
        >
        
        <EditText
            android:id="@+id/InsertShirtColor"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:hint="@string/insertshirthere" />
        <Spinner
            android:id="@+id/spinner_color"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            />
        
         <EditText
            android:id="@+id/InsertShirtTexture"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:hint="@string/insertshirttexture" />
         <Spinner
            android:id="@+id/spinner_texture"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            />
         
          <EditText
            android:id="@+id/InsertTextureColor"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:hint="@string/inserttexturecolor" />
          <Spinner
            android:id="@+id/spinner_texture_color"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            />
        
    </LinearLayout>
I am using Layouts within Layout. Overlapping Layout would be appropriate? Anyway the purpose is to slide the above layout so that the layout underneath appears.

Here is the code in my java class.
Code:
public class UpdateInventory extends Activity {

	Button insertShirt, insertTrouser,insertSuit, insertTie,back;
	EditText shirtColor,shirtTexture,TextureColor;
	Spinner color,texture,textureColor;
	LinearLayout optionToInsert,InsertShirt,InsertTrouser,InsertSuit,InsertTie,layout_base;
	
	private String[] shirtColors={"Beige","Tan","Khaki","Gray","Charcoal","Navy Blue","Medium Blue","Azure","Cyan","Forest Green","Olive","Light Green",
			"Lime","Coral","Pink","Light Purple","Purple","Indigo","Maroon","Crimson","Red","White","Brown","Black"};
	
	protected void OnCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.update_inventory);
		
		insertShirt=(Button) findViewById(R.id.btnInsertShirt);
		insertTrouser=(Button) findViewById(R.id.btnInsertTrousers);
		insertSuit=(Button) findViewById(R.id.btnInsertSuit);
		insertTie=(Button) findViewById(R.id.btnInsertTie);
		back=(Button) findViewById(R.id.btnBack3);
		
		color=(Spinner) findViewById(R.id.spinner_color);
		texture=(Spinner) findViewById(R.id.spinner_texture);
		textureColor=(Spinner) findViewById(R.id.spinner_texture_color);
		
		shirtColor=(EditText) findViewById(R.id.InsertShirtColor);
		shirtTexture=(EditText) findViewById(R.id.InsertShirtTexture);
		TextureColor=(EditText) findViewById(R.id.InsertTextureColor);
		
		optionToInsert=(LinearLayout) findViewById(R.id.layout_optionToInsert);
		InsertShirt=(LinearLayout) findViewById(R.id.layout_InsertShirt);
		InsertTrouser=(LinearLayout) findViewById(R.id.layout_InsertTrouser);
		InsertSuit=(LinearLayout) findViewById(R.id.layout_InsertSuit);
		InsertTie=(LinearLayout) findViewById(R.id.layout_InsertTie);
		layout_base=(LinearLayout) findViewById(R.id.layout_base);
		layout_base.setBackgroundColor(Color.RED);
		
		insertShirt.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				TranslateAnimation animate= new TranslateAnimation(0,optionToInsert.getWidth(),0,0);
				animate.setDuration(500);
				//animate.setFillAfter(true);
				optionToInsert.startAnimation(animate);
				optionToInsert.setVisibility(View.GONE);
				fadein(InsertShirt);
				InsertShirt.setVisibility(View.VISIBLE);
			}
		});
	}
	
	public void fadein(View v)
	{
		Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fadein);
		v.startAnimation(animation);
	}
}
here is the android Manifest Code, which of course works fine for previous two activities and this one loads fine as well

Code:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"    package="com.example.suitup"
    android:versionCode="1"
    android:versionName="1.0" >


    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="19" />


    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />


                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        
        <activity
            android:name="com.example.suitup.MainMenu"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MainMenu" />


                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        
        <activity
            android:name="com.example.suitup.UpdateInventory"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.UpdateInventory" />


                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        
    </application>


</manifest>
I don't understand where the problem is? I have spent almost two hours but I cannot understand why the contents in the third activity won't appear?
It would be great if someone would help!
 

Gizmo

Expert
May 6, 2009
12,636
2
42
Lahore
I have a C++ problem. I'm learning about pointers atm and I did this:


Code:
int Table(int a, int b){

int **p_p_table;

 p_p_table = new int*[a];

 for(int i=0; i<a; i++){

    p_p_table[a] = new int[b];


 }

 for(int i=0; i<a; i++){

    for(int j=0; j<b; j++){


        p_p_table[i][j] = i*j;
    }
    }

    for(int i=0; i<1; i++){

        for(int j=0; j<b; j++){

            cout << p_p_table[i][j] << "  ";
        }
        cout << " " << endl;
    }




}

int main ()
{
 int height;
 int width;

 cout << "Enter the Dimensions of the table: ";
 cin >> height;
 cin >> width;

  Table(height,width);


}

Basically, It's suppossed to be a function that let's the user create a multiplication table of their desired dimensions but whenever I run it and entert he dimension the program crashes because I'm not allocatting the memory correctly, How exactly do I do that?
@StrikerX ........ Batao mujhe :crazy:
 
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.
  • 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
  • XPremiuM XPremiuM:
    F*** Microsoft, and F*** their fanboys.
    Link
  • XPremiuM XPremiuM:
    What's the f*** is wrong with them? I mean really? Have they completely lost it? F***ing retards.
    Link
  • XPremiuM XPremiuM:
    So i just found out that f***ing s***bag Microsoft shut down Arkane Studio (makers of the brilliant Dishonored series) and Tango Gameworks (makers of the iconic The Evil Within series), among some other studios. I just want to say a giant F*** Y**! to Microsoft. THEY'VE F***ED UP BIG TIME this time.
    Link
  • Necrokiller Necrokiller:
    MS: Hold my trillion dollars
    Link
  • Necrokiller Necrokiller:
    Sony: We can f**k up a totally good situation.
    Link
  • Link
  • XPremiuM XPremiuM:
    Started Dead Island 2, and i find it pretty lame. The story is shit. The characters are either cringe or bland (all 6 of them), The gameplay isn't fun. Even the goddamn zombies don't behave like proper zombies. They're all fast & intelligent unlike how zombies are supposed to be like. Any fan of "zombie" genre cannot possibly like this shitfest of a game. Dying Light 2 was million times better than this shit.
    Link
  • NaNoW NaNoW:
    so Baldurs Gate 3 is pretty great!"
    Link
  • faraany3k faraany3k:
    So who here is waiting for Senua Hellblade 2. Prequel was a true mind fuck experience.
    Link
  • GloriousChicken GloriousChicken:
    Sad indeed
    Link
  • NaNoW NaNoW:
    what a sad day
    Link
  • faraany3k faraany3k:
    Necrokiller said:
    MS one upping Sony in catching the biggest L in gaming
    tbh gaming industry as a whole is failing much like tech industry. They have buckled down too much to Corporate suites then relying on passionate and innovative people. A corporate only believes in financial growth and shareholders.
    Link
  • Necrokiller Necrokiller:
    MS one upping Sony in catching the biggest L in gaming
    Link
  • Link
  • NaNoW NaNoW:
    oh
    Link
    iampasha iampasha: Phil keeps talking about breaking barriers to gaming, making it accessible on all platforms yada...