Sunday, January 26, 2025

c++ 20 features std:views, transform, filter

#include <algorithm>
#include <cctype>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
#include <ranges>


using namespace std;


struct student
{
    string name;
    string roll;
    string dob;
    string departmnt;
    
};


int main()
{
    auto show_student = [](const student& s)
                            { 
                                cout <<"Name:       "<< s.name << endl; 
                                cout <<"Roll:       "<< s.roll << endl; 
                                cout <<"DOB:        "<< s.dob << endl; 
                                cout <<"Department: "<< s.departmnt << endl; 
                            };
    
    auto show_data = [](const string& s)
                            { 
                                cout << s << endl; 
                            };
                            
    auto uppercase = [](student s) -> student {
        
        std::transform(s.name.begin(), s.name.end(), s.name.begin(), ::toupper);
        return s;
    };
    
    auto formatname = [](const string& s) -> string {
        
        std::string name = "";
        bool upper = true;
        for(int i=0;i<s.size();i++)
        {
            if(s[i] >= 'a' && s[i] <= 'z')
            {
                if(upper)
                {
                    name.push_back( (s[i] - 'a') + 'A');
                    upper = false;
                }
                else
                    name.push_back( s[i] );
            }
            else if(name.size() > 0 && (s[i]=='.' || s[i]==' '))
            {
                if(name[name.size()-1]=='.' || name[name.size()-1]==' ')
                {
                    
                }
                else
                {
                    name.push_back( s[i] );
                    if(s[i]=='.')
                    name.push_back(' ');
                }
                upper = true;
            }
            else if(s[i] >= 'A' && s[i] <= 'Z')
            {
                if(upper)
                {
                    name.push_back( s[i]);
                    upper = false;
                }
                else
                    name.push_back( (s[i]-'A' + 'a') );
            }
        }
        return name;
    };
    
    vector<student> students;
    
    students.push_back({.name="MD. NAzmul KIBRia", .roll="0304015", .dob="01-01-1985", .departmnt="CSE"});
    students.push_back({.name="Md. Shakil Ahmed",  .roll="0303013", .dob="01-01-1986", .departmnt="CIVIL"});
    students.push_back({.name="Md. Rezwan Salam",  .roll="0302025", .dob="01-01-1984", .departmnt="ELECTRICAL"});
    students.push_back({.name="md.omar faruque",   .roll="0304020", .dob="01-01-1983", .departmnt="CSE"});

    std::ranges::sort(students, [](auto&l, auto&r){return l.roll < r.roll; });
    std::ranges::for_each(students, show_student);
    
    std::cout <<std::endl<< "CSE students: " << std::endl;
    auto cse_students = students | std::views::filter([](const student&s){ return s.departmnt == "CSE";});
    std::ranges::for_each(cse_students, show_student);
    
    std::cout <<std::endl<< "CSE Student Names: " << std::endl;
    std::ranges::for_each(students | std::views::filter([](const student&s){ return s.departmnt == "CSE";})
                                   | std::views::transform([](const student&s) -> std::string {return s.name;})
                                   | std::views::transform(formatname)
                                   ,show_data);
    
    std::cout <<std::endl<< "CSE Student Rolls: " << std::endl;
    std::ranges::for_each(students | std::views::filter([](const student&s){ return s.departmnt == "CSE";})
                                   | std::views::transform([](const student&s) -> std::string {return s.roll;})
                                   ,show_data);
    std::cout << std::endl<<"============" << std::endl;
    std::ranges::for_each(students, show_student);
    
    return 0;
}


Outputs:


Name:       Md. Rezwan Salam
Roll:       0302025
DOB:        01-01-1984
Department: ELECTRICAL
Name:       Md. Shakil Ahmed
Roll:       0303013
DOB:        01-01-1986
Department: CIVIL
Name:       MD. NAzmul KIBRia
Roll:       0304015
DOB:        01-01-1985
Department: CSE
Name:       md.omar faruque
Roll:       0304020
DOB:        01-01-1983
Department: CSE

CSE students: 
Name:       MD. NAzmul KIBRia
Roll:       0304015
DOB:        01-01-1985
Department: CSE
Name:       md.omar faruque
Roll:       0304020
DOB:        01-01-1983
Department: CSE

CSE Student Names: 
Md. Nazmul Kibria
Md. Omar Faruque

CSE Student Rolls: 
0304015
0304020

============
Name:       Md. Rezwan Salam
Roll:       0302025
DOB:        01-01-1984
Department: ELECTRICAL
Name:       Md. Shakil Ahmed
Roll:       0303013
DOB:        01-01-1986
Department: CIVIL
Name:       MD. NAzmul KIBRia
Roll:       0304015
DOB:        01-01-1985
Department: CSE
Name:       md.omar faruque
Roll:       0304020
DOB:        01-01-1983

Department: CSE 

Tuesday, January 7, 2025

Designated Initializer in C vs CPP

 C supports a powerful designated initializes specially for Array & Struct in any order. Doesn't depend on declaration order. It was introduced since 1999. Here is an example: 


c example
The output of the above program is:

output

C supports nested, mixed designated initialization: 




C++ initiated this designated initialization in c++20 in year 2020 and we can say it as a limited version. It depends on declaration order of the struct variables. We can not use any order like C language. Also we can not use it for Array :(

Only we can skip some middle variables which will be initialized by zero but we must need to follow it's original declaration order.

Here is an example of c++20:
cpp example

C++ supports mixed type to designated initialization but doesn't support nested type :(




Rules for Designated Initializers (CPP):

1. Each data member can have only one designator.  
2. Designators are applicable only for aggregate initialization.  
3. Nested designators are not allowed.  
4. Regular initialization cannot be combined with designators in the same expression.  
5. It is not mandatory to specify all data members in the initialization expression.  
6. Designators can reference only non-static data members.  
7. The order of designators in the initialization expression must match the order of data members in the class declaration.  

Advantages of Designated Initialization

    Readability: By specifying the exact data member being initialized, the designator ensures clarity and eliminates the possibility of errors.
   Flexibility: It allows you to skip initializing certain data members and depend on their default values instead.
   Compatibility with C: A similar initialization syntax is widely used in C99 (with even more relaxed rules). The C++20 feature enables writing nearly identical code, facilitating code sharing between C and C++.
   Standardization: While compilers like GCC and Clang already provided extensions for this feature, its inclusion in the standard ensures uniform support across all compilers.











Monday, December 30, 2024

Modify a private const variable from outside of class in c++

 Is it possible to modify a private const variable from outside the class in cpp? No it doesn't and it should not supposed to happen.

Unfortunately we can do this with pointer. How? Let's see the example:

#include <iostream>

class Test
{

    private:
    const int cval1 = 1;
    const int cval2 = 2;

    public: 
    void print()
    { 
        std::cout << "const value1 = " << cval1 << std::endl;
        std::cout << "const value2 = " << cval2 << std::endl;

    }    

};

int main()
{

    Test t;
    t.print();

    int * p = reinterpret_cast<int*>(&t);
   *p = 10; //modifying 1st integer
   *(p+1) = 20; //modifying 2nd integer

    std::cout << "After modification: " << std::endl;
    t.print();

    return 0;
}

Tuesday, November 26, 2024

Gender and Age Detection Dataset for Training

Here are some popular datasets you can use for gender and age detection:

1. Adience Dataset

  • Description: Contains images for age and gender estimation. The dataset includes real-world face images with varied poses, occlusions, and lighting conditions.
  • Age Labels: Grouped into ranges like (0-2), (4-6), (8-13), (15-20), etc.
  • Size: ~26,000 face images.
  • Link: Adience Dataset

2. IMDB-WIKI Dataset

  • Description: The largest publicly available dataset for age and gender prediction. It includes face images labeled with age and gender, sourced from IMDb and Wikipedia.
  • Age Labels: Actual age of the individual.
  • Size: ~500,000 face images.
  • Link: IMDB-WIKI Dataset

3. UTKFace Dataset

  • Description: A large-scale dataset with over 20,000 face images labeled for age, gender, and ethnicity. Includes faces of diverse age groups and ethnic backgrounds.
  • Age Labels: Actual age of the individual.
  • Size: ~20,000 face images.
  • Link: UTKFace Dataset

4. FairFace Dataset

  • Description: A balanced dataset for race, age, and gender prediction, designed to mitigate biases in facial analysis systems.
  • Age Labels: Grouped into ranges like 0-2, 3-9, 10-19, etc.
  • Size: ~100,000 images.
  • Link: FairFace Dataset

5. AFAD Dataset

  • Description: Contains over 165,000 images of Asian faces with age and gender labels, focusing on specific demographics.
  • Age Labels: Actual age.
  • Size: ~165,000 images.
  • Link: AFAD Dataset

Best Approach for Gender and Age Detection Training

1. Preprocessing Steps

  • Face Detection: Use a robust face detection model (e.g., Haar cascades, DLIB, MTCNN, or YOLO) to extract face regions.
  • Alignment: Align faces to normalize rotations and scale for consistent inputs.
  • Normalization: Resize face images to a fixed size (e.g., 128x128) and normalize pixel values to [0, 1] or [-1, 1].

2. Model Architecture

  • CNN-Based Models: Convolutional Neural Networks (CNNs) are well-suited for image-based tasks. Popular architectures include:
    • Lightweight models: MobileNet, EfficientNet (good for edge deployment).
    • Deeper models: ResNet, VGG16, or InceptionNet for higher accuracy.
  • Multi-Task Learning (MTL): A shared backbone with separate output layers for gender and age prediction.
    • Example: One softmax layer for gender (Male, Female) and another layer for age regression or classification (age bins).

3. Loss Functions

  • Gender Detection:
    • Use Categorical Cross-Entropy for binary classification (Male, Female).
  • Age Detection:
    • Regression-based: Use Mean Squared Error (MSE) for predicting exact age.
    • Classification-based: Use Categorical Cross-Entropy for age ranges.

4. Training Process

  • Data Augmentation:
    • Random cropping, rotation, horizontal flipping, and brightness adjustments to improve model robustness.
  • Transfer Learning:
    • Start with pre-trained models (e.g., ResNet, MobileNet) on ImageNet and fine-tune for gender and age detection tasks.
  • Balanced Dataset Handling:
    • If classes (e.g., age or gender) are imbalanced, use techniques like oversampling, weighted loss functions, or SMOTE.

5. Evaluation Metrics

  • Gender Detection:
    • Accuracy, Precision, Recall, F1-Score.
  • Age Detection:
    • Mean Absolute Error (MAE) for regression tasks.
    • Accuracy for classification tasks.

6. Advanced Approaches

  • Attention Mechanisms:
    • Use attention layers to focus on key facial features.
  • Ensemble Learning:
    • Combine predictions from multiple models for improved performance.
  • Vision Transformers (ViT):
    • Explore transformers for image-based tasks, especially for large datasets.

Tools and Frameworks:

  • Deep Learning Frameworks: PyTorch, TensorFlow/Keras.
  • Face Detection Libraries: OpenCV, DLIB, MTCNN.

Example Workflow

  1. Prepare Dataset:
    • Download datasets, perform face detection and alignment.
  2. Train the Model:
    • Use transfer learning with pre-trained models like ResNet or EfficientNet.
  3. Evaluate the Model:
    • Test on unseen data and compute metrics.
  4. Deploy the Model:
    • Optimize using ONNX or TensorRT for real-time applications.

By following these steps, you can effectively train a gender and age detection model that performs well even in challenging scenarios.

Adaptive automatic Image enhancing

Adaptive automatic enhancing image for detecting objects. Following cpp opencv code:

 

void AutoEnhanceAdaptivePreprocessing(const cv::Mat& inputImage, cv::Mat& outputImage)
{

// Step 1: Convert to grayscale (if not already)

cv::Mat grayImage;

if (inputImage.channels() == 3)
           cv::cvtColor(inputImage, grayImage, cv::COLOR_BGR2GRAY);

 else
grayImage = inputImage.clone();

//adaptive histogram equalization

// Step 2: Apply CLAHE for adaptive histogram equalization

cv::Ptr<cv::CLAHE> clahe = cv::createCLAHE(2.0, cv::Size(8, 8)); // ClipLimit=2.0, TileGridSize=8x8

cv::Mat claheImage;

clahe->apply(grayImage, claheImage);


// Step 3: Denoising using GaussianBlur

cv::Mat denoisedImage;

cv::GaussianBlur(claheImage, denoisedImage, cv::Size(5, 5), 0);


// Step 4: Enhance contrast and brightness

double alpha = 1.5; // Contrast control (1.0-3.0)

int beta = 20;      // Brightness control (0-100)

cv::Mat contrastEnhancedImage = denoisedImage.clone();

denoisedImage.convertTo(contrastEnhancedImage, -1, alpha, beta);

cv::cvtColor(contrastEnhancedImage, outputImage, cv::COLOR_GRAY2RGB);

}

Wednesday, June 26, 2024

Return Type Overloading in C++

Small tricks to accomplish return type overload in c++. In cpp one can not overload return type. If you follow this trick you can overload return type using operator overloading :)


struct Car {

    string name;

    string brand;

};


struct Bus {

    string name;

    string brand;

};


struct Transport 

{

    Car get_car()

    { 

        Car oCar;

        oCar.name="Axio"; 

        oCar.brand="Toyota";

        return oCar; 

    }

    

    Bus get_bus()

    {

        Bus oBus;

        oBus.name="Greenline"; 

        oBus.brand="Hundai";

        return oBus; 

    }

    

    auto get_transport()

    {

        struct result

        {

          Transport * trans;

          operator Car() { return trans->get_car(); }

          operator Bus() { return trans->get_bus(); }

        };

        

        return (result{this});

    }

};


int main() {

    

    Transport tt;

    Car myCar = tt.get_transport();

    Bus myBus = tt.get_transport();

    

    cout << myCar.name << " == " << myCar.brand << endl;

    cout << myBus.name << " == " << myBus.brand << endl;


    return 0;

}


============

You can not use below code it will get compile error:

struct Transport 

{

    Car get_transport() { return (Car{});}

    Bus get_transport() { return (Bus{});}

};

Tuesday, June 5, 2012

.Net 3.5 OpenFileDialog issue in Windows SP3

Recently me and my co-worker found a strange issue while developing something where we used a c++ dll imported from .net project. Inside the c++ dll we have used some relative paths which is needed on each operation to load resources. If we use OpenFileDialog in c# before calling the method of the c++ dll it changes the current directory and the dll not able to find the path. Here is the source code for better understanding:

  OpenFileDialog opd = new OpenFileDialog(); 


 if (opd.ShowDialog() == DialogResult.OK) 
 {


 }


 moo(@"D:\Images\DB\fao.bmp"); // moo is a method of c++ dll imported here 

Above code unfortunately do not work on my co-workers machine. He is using windows xp sp3. The fun part is that the same code works properly in my machine which is windows 7. We both used same .net framework. In my co-worker's machine if he uses the below code it works perfectly:

  /*
 OpenFileDialog opd = new OpenFileDialog(); 


 if (opd.ShowDialog() == DialogResult.OK) 
 {
 } 
 */


 moo(@"D:\Images\DB\fao.bmp"); // moo is a method of c++ dll imported here



Wednesday, January 18, 2012

Make visual studio 2008 winform design view faster

How to make faster winform design view faster:

The setting is in Tools -> Options -> Windows Forms Designer, set "AutoToolboxPopulate" to false.

See the image below:


Design view of visual studio 2008 is too slow (control movement slow) -- How to fix [web view]

I was struggling for this issue. Lets see how we can fix it quickly:

Download Updated VS2008 Hotfix KB967253

Download and Install

Issue:

If you work in design view of visual studio 2008, you will notice it is tremendously slow. In a word it is quite impossible to design a large form :(. The whole purpose of using visual studio is defeated here. We like vs for its quick design facilities.... Actually it a known issue of that vs version. So to fix it we need to download and install the above fix from microsoft.

Saturday, October 22, 2011

Select all text using ctrl + A in a TextField (multiline) C#

This is quite simple .... just add the keyDown event like below:

this.txtField.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtField_KeyDown);

You should add this event for those textfield only where you want to add this functionality ... Now just add below simple code and enjoy select all feature :D

private void txtField_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control && (e.KeyCode == Keys.A))
{
((TextBox)sender).SelectAll();
e.SuppressKeyPress = true;
e.Handled = true;
}

}

Try and enjoy :)

Tuesday, October 4, 2011

Back again

Back again :)

After a long time I am back again and decided to post and write whatever I do. I will post basically technical terms in posts.....

Cheers 

Monday, April 12, 2010

Fixing Wireless Toolkit 2.5.2_01's bug for Obfuscation

Hi I have spent lots of effort for obfuscating midlet application using WTK obfuscation_package option :D

 I found the solution, I am pasting it:

   There's a file ktoolbar.vm in the wtk\bin directory. Rename it to ktoolbar.bat and edit it as follows:

Insert these two lines at the beginning:

SET USER_HOME=g:\temp
SET KVEM_HOME=g:\emulators\WTK2.5.2

Instead of g:\temp specify the path where you want your workspace to be (the path must not contain spaces).

Instead of g:\emulators\WTK2.5.2 specify the path where your wtk is located.

Insert -Duser.home=%USER_HOME% into the next line, like this:

G:\java\JDK16~1.0_0\bin\java -Dkvem.home="%KVEM_HOME%" -Duser.home=%USER_HOME% -Djava.library.path="%KVEM_HOME%/bin" -Dsun.java2d.ddlock=true -Dsun.java2d.gdiblit=false -cp "%KVEM_HOME%/wtklib/kenv.zip";"%KVEM_HOME%/wtklib/ktools.zip";"%KVEM_HOME%/bin/JadTool.jar";"%KVEM_HOME%/bin/MEKeyTool.jar";"%KVEM_HOME%/wtklib/customjmf.jar";"%KVEM_HOME%/lib/j2me-ws.jar";"%KVEM_HOME%/lib/j2me-xmlrpc.jar";"%KVEM_HOME%/bin/schema2beansdev.jar";"%KVEM_HOME%/bin/j2me_sg_ri.jar";"%KVEM_HOME%/bin/jaxrpc-impl.jar";"%KVEM_HOME%/bin/jaxrpc-api.jar";"%KVEM_HOME%/bin/jaxrpc-spi.jar";"%KVEM_HOME%/bin/activation.jar";"%KVEM_HOME%/bin/mail.jar";"%KVEM_HOME%/bin/saaj-api.jar";"%KVEM_HOME%/bin/saaj-impl.jar";"%KVEM_HOME%/bin/xsdlib.jar";"%KVEM_HOME%/wtklib/nist-sip-1.2.jar";"%KVEM_HOME%/wtklib/JainSipApi1.1.jar";"%KVEM_HOME%/wtklib/jain-sip-presence-proxy.jar" com.sun.kvem.toolbar.Main

Now you have to run this edited file to run wtk. Now double click the .bat file .....and enjoy......

The original link where I found the solution is :


 Actually it is a bug of WTK and it shows the following error message while obfuscating:

Error: C:\Documents (The system cannot find the file specified)
Obfuscation failed.
Build failed

 so lets have the solution for it.....




Thursday, January 14, 2010

Video Playing in Brew Emulator

I have waste lot of time on searching for how to play video in BREW emulator. At last I have found the solution from forum:


  If Brew video support environment is not installed video will not play but work in real devices. We can play video using the sample code given by BREW sdk...

Wednesday, January 6, 2010

BREW addins/plugin for VC 6.0

Here is the link install addin to install addin for vc++ 6.0
From this link where I installed addin only using IE 7.0, I am unable to install it from chrome or firefox :(

Tuesday, November 3, 2009

How to clear Blackberry Simulator's Record Store / Flash Memory / Application Data

I have faced lot's of problem on clearing application data used by blackberry storm simulator. Usually for wtk simulator netbeans provide graphical interface (also wtk has options in utilities) to clean record store / application data / flash memory.

Finally I got a solution for it. Blackberry simulator's keep the data in its working directory in three files named (for BB 9530 simulator):

9530-as.dmp
9530-fs.dmp
9530-nv.dmp

Usually file names are [model name]-*.dmp.

For my pc for model 9530 verizon keeps the file in its working directory:

C:\Program Files\Research In Motion\BlackBerry Smartphone Simulators 4.7.0\4.7.0.75 (9530-Verizon)\

If we need to clear this data just simply delete among three files.

Wednesday, October 28, 2009

Sun Wireless Toolkit RMS not working....

I have faced the similar problem, RMS not working....actually wtk keep a default space in hard drive for saving files and data in RMS. When its got full it will not work. Now how to resolve it:

For windows: In documents and settings folder

Enter in C:\Documents and Settings\USER NAME\j2mewtk\
Delete ALL files.

Now it will work properly.

Friday, June 12, 2009

Adding new black berry simulator in JDE

 If we install blackberry simulator after installing jde, sometimes it does not get the simulator. So we need to add manully. The steps are: 

       1. Go to jde intalled directory and go inside simulator folder like (C:\Program Files\Research In Motion\BlackBerry JDE 4.5.0\simulator)
       2. Now we need to add the batch file inside this folder.
       3. Copy the simulator batch file from the simulator installed location like ( "C:\Program Files\Research In Motion\BlackBerry Smartphone Simulators 4.7.0\4.7.0.75 (9530-Verizon)\9530-Verizon.bat") and paste it to the simulator folder.
       4. Now we need to edit the batch file that have pasted in simulator folder:

        For example if we want to add 9530-Verizon.bat simulator we will find following text if we open the .bat file in edit mode.

       @echo off 
fledge.exe /title="Blackberry 9530 Simulator -Verizon" /app=Jvm.dll /handheld=9530 /session=9530 /app-param=DisableRegistration /app-param=JvmAlxConfigFile:9530-Verizon.xml /data-port=0x4d44 /data-port=0x4d4e /pin=0x2100000A 


we need to edit the path of fledge.exe, Jvm.dll and 9530-Verizon.xml file like following:

@echo off 
"C:\Program Files\Research In Motion\BlackBerry Smartphone Simulators 4.7.0\4.7.0.75 (9530-Verizon)\fledge.exe" /app="C:\Program Files\Research In Motion\BlackBerry Smartphone Simulators 4.7.0\4.7.0.75 (9530-Verizon)\Jvm.dll" /title="Blackberry 9530 Simulator -Verizon" /handheld=9530 /session=9530 /app-param=DisableRegistration /app-param=JvmAlxConfigFile:9530-Verizon.xml /data-port=0x4d44 /data-port=0x4d4e /pin=0x2100000A 


Here we need to put the actual path of these above mentioned file where the simulator is actually installed.

                       5. Now double click the the batch file. If it runs the simulator then its ok. 

      Now you can easily got it added in your jde.



       
      
 

Sunday, January 11, 2009

Beginning Lamda Expression in C#


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Lamda_expresion_test
{
class Program
{
public delegate int ChangeInt(int x);
public delegate int SummingInt(int x, int y);

static void Main(string[] args)
{
int[] numbers = new[] { 3, 8, 4, 6, 1, 7, 9, 2, 4, 8 };
int[] negetiveNumbers = new[] { -1,-2,-3,-4,-5,-6};

int count = numbers.Count(x => x % 2 == 0);//x % 2==1 for odd

Console.WriteLine("Total even numbers: {0}\n",count);


Console.Write("Numbers greater than 6: ");
foreach (int a in numbers.Where(p => p > 6))
Console.Write(" {0}",a);


Console.WriteLine();

//// using delegate...reducing code

ChangeInt doubleInt = delegate(int x) { return x * 2; };
Console.WriteLine(doubleInt(12));

//using Lamda Expression code more reduced
ChangeInt delgate = x => x * 2;
Console.WriteLine(delgate(12));

//Lamda expression on two parameters....
SummingInt summing = (x, y) => x + y;
Console.WriteLine(summing(12,100));

// More complex operations......
Console.WriteLine("Numbers between 3 and 8: ");
foreach (int i in numbers.Where(x => x>=3 && x<=8))
 Console.Write(" {0}",i); 

Console.WriteLine(); 
//same as previous expression...... 
// we can make some codition like following.... 

foreach (int i in numbers.Where( 
x =>
{
if (x >= 3 && x <= 8) 
return true; 
else return false; 
} )) 
Console.Write(" {0}", i);
 Console.WriteLine(); 
}
 
}
}

Sunday, December 14, 2008

Graphical problem in IE 8 Beta version

There is some graphical problem i have faced in Internet Explorer 8 Beta version. I do not why this problem is occuring. Bu i have noticed that when i scroll or making some quick page up/down this problem occurs. I am giving a snapshot of its version and the problem:



Version:





Problem:


Saturday, November 29, 2008

No xaml designer in vs2008 Team System

I have faced the problem after installing vs2008 team system, there was no xaml design view & no graphical toolbox. I have repaired & reinstalled but problem was still occurring.....

Finally i got the solution from a forum. I m gonna make it clear

1. Close vs2008 team system if it is open.
2. Go to: start menu>all programs>Microsoft Visual Studio 2008> Visual Studio Tools> Visual Studio 2008 Command Prompt.
3. Write on the command prompt: devenv/resetskippkgs
4. Then open a wpf solution & right click a .xaml file and select open with, u will appear a dialog. U should set windows presentation foundation designer as default designer.

Now everything is right.

PC Magazine Tips and Solutions

PC World: Latest Technology News

PCWorld.com - Most Popular Downloads of the Week