Forum Replies Created

Adelaid Member

Hello, I’m almost done with learning the basics of c++ and can do some programming with it, but I am as you also intrested in web development, so couple of days ago I found this book on net, Learning PHP, MySQL, JavaScript, and CSS, 2nd Edition
Link:

http://shop.oreilly.com/product/0636920023487.do

I’m planing to go through this book, so that I can get the insight on web development, and then later in case I need some more knoweldge then I will find some books separately only for PHP, Javascript, and others.

Adelaid Member

So all file locations which require server-side manipulation can be written in the script using functions like dirname(__FILE__)./includes/config.php but any links in the html should avoid these kind of absolute paths embedded into them via PHP tags and should just refer to the file link relatively e.g. /includes/config.php.

Adelaid Member

you really have made this as difficult to answer as you possibly could. When asking questions like this, you need to provide your code. Anyway, see if this explains some of your problems:

#include 
#include 

typedef struct {
   int DayNumber;
   int WorkHours;
} WorkDay;

typedef struct {
   char name[30];
   long ID;
   int workdays;
   WorkDay * wd;
   double salary;
} Worker;

Worker *newWorker() {
   Worker *w = malloc(sizeof(Worker));
   w->wd = malloc(sizeof(WorkDay));
   return w;
}

int main()
{
   Worker *temp = newWorker();
   printf("What day?");
   scanf("%d",&(temp->wd->DayNumber));
   printf("Day supplied = %d\n", temp->wd->DayNumber);
   free(temp->wd);
   free(temp);
   return 0;
}
Adelaid Member
while (t/2 && heap[t]>heap[t/2])
this line is equals to:
while( t/2 != 0 && heap[t]>heap[t/2])

while loop is false if argument is 0.

while(1) is true
while(!0) is true
while(27) is true
while(0) is false
Adelaid Member

The code looks reasonable, assuming that the motor commands are correct. This would indicate that something else is wrong. Possible problems are:

    myLight points to the wrong sensor
    SensorValue[myLight] returns a value other than what you expect
    colour[2] contains the wrong value

One other possibility is that the preceding code has an error that causes this code to be skipped.

Adelaid Member

Use the ADO.NET EntityFramework to make your life a lot easier.

Anyway, if you’re going to make something that involves multiple users and multiple queries being executed on the database at any given time, don’t use Access or you’ll run into concurrency issues sooner or later. Obviously MSSQL works best with .NET, as they’re both Microsoft technologies and they tend to give that little bit of extra compatibility with their own products. However, MySQL or any other ODBC database should work just fine.

Adelaid Member

Here is my code in the format you’re looking for

import java.util.Scanner;

public class lab13zad3{
    public static void main(String[] args) {
       Scanner sc= new Scanner(System.in);
       
       String word;
       String words[]=new String[100];
       int i=0;
       
       String k="end";
       System.out.println("Write some words: ");
       word=sc.next();
       
       //Add words to the array
       while(word.compareToIgnoreCase(k)!=0)
       {
         words[i] = word;
         i=i+1;
         word=sc.next();
       }
       
       //Add "end" after receiving all the words
      words[i] = k;
      System.out.println("The received words are:");
      for(int j=0;j 0)
           System.out.println(words[j]);
      }
     
      System.out.println("Word with a space between each character");
      for(String w:words)
      {
        if(w != null && w.length() > 0)
        {
          char temp[] = w.toCharArray();
          for(int c=0;c
    
in reply to: SQL login check help
Adelaid Member

Judging by what you said and the code you can literally just do

if ($myusername == "Joe") { do something }

If you wanted to do it based on usergroup or something then you’d need to execute a separate query, check then redirect accordingly.

Adelaid Member

Make a P1.cpp file as shown in SoundTestForm; also make a main.cpp file.Write the codes shown. Call the .cpp file as P1.cpp(see it is included in the main.cpp codes)
Make wav file of any music file and store it in a drive.Put the correct path in the
form that shows on running this code. Press play.Bingo,there goes your sound track.
The only disadvantage here is wav file is ten times larger that mp3 file.

This is ok for experimentation.For practicality you should find a way to convert mp3 to wav
in this program itself,so that conversion is done as it plays.
regards and blessings

/////////////////////////////////////////////////////////////////////////////
#using 
#include "stdio.h"
#include "stdio.h"
#using 
#include "stdio.h"
#include 
#include 
#include 
#include 
#include 
#include 
#using 
#using 
#using 
using namespace std;
using namespace System::Net;
using namespace System;
using namespace System::IO;
using namespace System::Collections;
using namespace System::ComponentModel;
using namespace System::Diagnostics;
using namespace System::Drawing;
using namespace System::Media;
using namespace System::Windows::Forms;

public ref class SoundTestForm: public System::Windows::Forms::Form
{
private:
   System::Windows::Forms::Label ^ label1;
   System::Windows::Forms::TextBox^ filepathTextbox;
   System::Windows::Forms::Button^ playOnceSyncButton;
   System::Windows::Forms::Button^ playOnceAsyncButton;
   System::Windows::Forms::Button^ playLoopAsyncButton;
   System::Windows::Forms::Button^ selectFileButton;
   System::Windows::Forms::Button^ stopButton;
   System::Windows::Forms::StatusBar^ statusBar;
   System::Windows::Forms::Button^ loadSyncButton;
   System::Windows::Forms::Button^ loadAsyncButton;
   SoundPlayer^ player;
public:
   SoundTestForm()
   {
      // Initialize Forms Designer generated code.
      InitializeComponent();
      // Disable playback controls until a valid .wav file
      // is selected.
      EnablePlaybackControls( false );
      // Set up the status bar and other controls.
      InitializeControls();
      // Set up the SoundPlayer object.
      InitializeSound();
   }
private:
   // Sets up the status bar and other controls.
   void InitializeControls()
   {
      // Set up the status bar.
      StatusBarPanel^ panel = gcnew StatusBarPanel;
      panel->BorderStyle = StatusBarPanelBorderStyle::Sunken;
      panel->Text = "Ready.";
      panel->AutoSize = StatusBarPanelAutoSize::Spring;
      this->statusBar->ShowPanels = true;
      this->statusBar->Panels->Add( panel );
   }
   // Sets up the SoundPlayer object.
   void InitializeSound()
   {
      // Create an instance of the SoundPlayer class.
      player = gcnew SoundPlayer;
      // Listen for the LoadCompleted event.
      player->LoadCompleted += gcnew AsyncCompletedEventHandler( this, &SoundTestForm::player_LoadCompleted );
      // Listen for the SoundLocationChanged event.
      player->SoundLocationChanged += gcnew EventHandler( this, &SoundTestForm::player_LocationChanged );
   }
 void selectFileButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
    {
      // Create a new OpenFileDialog.
      OpenFileDialog^ dlg = gcnew OpenFileDialog;
      // Make sure the dialog checks for existence of the
      // selected file.
      dlg->CheckFileExists = true;
      // Allow selection of .wav files only.
      dlg->Filter = "WAV files (*.wav)|*.wav";
      dlg->DefaultExt = ".wav";
      // Activate the file selection dialog.
      if ( dlg->ShowDialog() == ::DialogResult::OK )
      {
         // Get the selected file's path from the dialog.
         this->filepathTextbox->Text = dlg->FileName;
         // Assign the selected file's path to
         // the SoundPlayer object. 
         player->SoundLocation = filepathTextbox->Text;
      }
   }
   // Convenience method for setting message text in
   // the status bar.
   void ReportStatus( String^ statusMessage )
   {
      // If the caller passed in a message...
      if ( (statusMessage != nullptr) && (statusMessage != String::Empty) )
      {
         // ...post the caller's message to the status bar.
         this->statusBar->Panels[ 0 ]->Text = statusMessage;
      }
   }
   // Enables and disables play controls.
   void EnablePlaybackControls( bool enabled )
   {
      this->playOnceSyncButton->Enabled = enabled;
      this->playOnceAsyncButton->Enabled = enabled;
      this->playLoopAsyncButton->Enabled = enabled;
      this->stopButton->Enabled = enabled;
   }
   void filepathTextbox_TextChanged( Object^ /*sender*/, EventArgs^ /*e*/ )
    {
      // Disable playback controls until the new .wav is loaded.
      EnablePlaybackControls( false );
    }
   void loadSyncButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      // Disable playback controls until the .wav is
      // successfully loaded. The LoadCompleted event
      // handler will enable them.
      EnablePlaybackControls( false );
      try
      {
         // Assign the selected file's path to
         // the SoundPlayer object. 
         player->SoundLocation = filepathTextbox->Text;
         // Load the .wav file.
         player->Load();
      }
      catch ( Exception^ ex )
      {
         ReportStatus( ex->Message );
      }
   }
   void loadAsyncButton_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
    {
      // Disable playback controls until the .wav is
      // successfully loaded. The LoadCompleted event
      // handler will enable them.
      EnablePlaybackControls( false );
      try
      {
         // Assign the selected file's path to
         // the SoundPlayer object. 
         player->SoundLocation = this->filepathTextbox->Text;
         // Load the .wav file.
         player->LoadAsync();
      }
      catch ( Exception^ ex )
      {
         ReportStatus( ex->Message );
      }
   }
   // Synchronously plays the selected .wav file once.
   // If the file is large, UI response will be visibly
   // affected.
   void playOnceSyncButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      ReportStatus( "Playing .wav file synchronously." );
      player->PlaySync();
      ReportStatus( "Finished playing .wav file synchronously." );
   }
   // Asynchronously plays the selected .wav file once.
   void playOnceAsyncButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
    {
      ReportStatus( "Playing .wav file asynchronously." );
      player->Play();
   }
   // Asynchronously plays the selected .wav file until the user
   // clicks the Stop button.
   void playLoopAsyncButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
    {
      ReportStatus( "Looping .wav file asynchronously." );
      player->PlayLooping();
   }
   // Stops the currently playing .wav file, if any.
   void stopButton_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
    {
      player->Stop();
      ReportStatus( "Stopped by user." );
    }
   // Handler for the LoadCompleted event.
   void player_LoadCompleted( Object^ /*sender*/, AsyncCompletedEventArgs^ /*e*/ )
   {
      String^ message = String::Format( "LoadCompleted: {0}", this->filepathTextbox->Text );
      ReportStatus( message );
      EnablePlaybackControls( true );
   }
   // Handler for the SoundLocationChanged event.
   void player_LocationChanged( Object^ /*sender*/, EventArgs^ /*e*/ )
    {
      String^ message = String::Format( "SoundLocationChanged: {0}", player->SoundLocation );
      ReportStatus( message );
    }
   void InitializeComponent()
   {
      this->filepathTextbox = gcnew System::Windows::Forms::TextBox;
      this->selectFileButton = gcnew System::Windows::Forms::Button;
      this->label1 = gcnew System::Windows::Forms::Label;
      this->loadSyncButton = gcnew System::Windows::Forms::Button;
      this->playOnceSyncButton = gcnew System::Windows::Forms::Button;
      this->playOnceAsyncButton = gcnew System::Windows::Forms::Button;
      this->stopButton = gcnew System::Windows::Forms::Button;
      this->playLoopAsyncButton = gcnew System::Windows::Forms::Button;
      this->statusBar = gcnew System::Windows::Forms::StatusBar;
      this->loadAsyncButton = gcnew System::Windows::Forms::Button;
      this->SuspendLayout();
      //
      // filepathTextbox
      //
      this->filepathTextbox->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right);
      this->filepathTextbox->Location = System::Drawing::Point( 7, 25 );
      this->filepathTextbox->Name = "filepathTextbox";
      this->filepathTextbox->Size = System::Drawing::Size( 263, 20 );
      this->filepathTextbox->TabIndex = 1;
      this->filepathTextbox->Text = "";
      this->filepathTextbox->TextChanged += gcnew System::EventHandler( this, &SoundTestForm::filepathTextbox_TextChanged );
      //
      // selectFileButton
      //
      this->selectFileButton->Anchor = static_cast(AnchorStyles::Top | AnchorStyles::Right);
      this->selectFileButton->Location = System::Drawing::Point( 276, 25 );
      this->selectFileButton->Name = "selectFileButton";
      this->selectFileButton->Size = System::Drawing::Size( 23, 21 );
      this->selectFileButton->TabIndex = 2;
      this->selectFileButton->Text = "...";
      this->selectFileButton->Click += gcnew System::EventHandler( this, &SoundTestForm::selectFileButton_Click );
      //
      // label1
      //
      this->label1->Location = System::Drawing::Point( 7, 7 );
      this->label1->Name = "label1";
      this->label1->Size = System::Drawing::Size( 145, 17 );
      this->label1->TabIndex = 3;
      this->label1->Text = ".wav path or URL:";
      //
      // loadSyncButton
      //
      this->loadSyncButton->Location = System::Drawing::Point( 7, 53 );
      this->loadSyncButton->Name = "loadSyncButton";
      this->loadSyncButton->Size = System::Drawing::Size( 142, 23 );
      this->loadSyncButton->TabIndex = 4;
      this->loadSyncButton->Text = "Load Synchronously";
      this->loadSyncButton->Click += gcnew System::EventHandler( this, &SoundTestForm::loadSyncButton_Click );
      //
      // playOnceSyncButton
      //
      this->playOnceSyncButton->Location = System::Drawing::Point( 7, 86 );
      this->playOnceSyncButton->Name = "playOnceSyncButton";
      this->playOnceSyncButton->Size = System::Drawing::Size( 142, 23 );
      this->playOnceSyncButton->TabIndex = 5;
      this->playOnceSyncButton->Text = "Play Once Synchronously";
      this->playOnceSyncButton->Click += gcnew System::EventHandler( this, &SoundTestForm::playOnceSyncButton_Click );
      //
      // playOnceAsyncButton
      //
      this->playOnceAsyncButton->Location = System::Drawing::Point( 149, 86 );
      this->playOnceAsyncButton->Name = "playOnceAsyncButton";
      this->playOnceAsyncButton->Size = System::Drawing::Size( 147, 23 );
      this->playOnceAsyncButton->TabIndex = 6;
      this->playOnceAsyncButton->Text = "Play Once Asynchronously";
      this->playOnceAsyncButton->Click += gcnew System::EventHandler( this, &SoundTestForm::playOnceAsyncButton_Click );
      //
      // stopButton
      //
      this->stopButton->Location = System::Drawing::Point( 149, 109 );
      this->stopButton->Name = "stopButton";
      this->stopButton->Size = System::Drawing::Size( 147, 23 );
      this->stopButton->TabIndex = 7;
      this->stopButton->Text = "Stop";
      this->stopButton->Click += gcnew System::EventHandler( this, &SoundTestForm::stopButton_Click );
      //
      // playLoopAsyncButton
      //
      this->playLoopAsyncButton->Location = System::Drawing::Point( 7, 109 );
      this->playLoopAsyncButton->Name = "playLoopAsyncButton";
      this->playLoopAsyncButton->Size = System::Drawing::Size( 142, 23 );
      this->playLoopAsyncButton->TabIndex = 8;
      this->playLoopAsyncButton->Text = "Loop Asynchronously";
      this->playLoopAsyncButton->Click += gcnew System::EventHandler( this, &SoundTestForm::playLoopAsyncButton_Click );
      //
      // statusBar
      //
      this->statusBar->Location = System::Drawing::Point( 0, 146 );
      this->statusBar->Name = "statusBar";
      this->statusBar->Size = System::Drawing::Size( 306, 22 );
      this->statusBar->SizingGrip = false;
      this->statusBar->TabIndex = 9;
      this->statusBar->Text = "(no status)";
      //
      // loadAsyncButton
      //
      this->loadAsyncButton->Location = System::Drawing::Point( 149, 53 );
      this->loadAsyncButton->Name = "loadAsyncButton";
      this->loadAsyncButton->Size = System::Drawing::Size( 147, 23 );
      this->loadAsyncButton->TabIndex = 10;
      this->loadAsyncButton->Text = "Load Asynchronously";
      this->loadAsyncButton->Click += gcnew System::EventHandler( this, &SoundTestForm::loadAsyncButton_Click );
      //
      // SoundTestForm
      //
      this->ClientSize = System::Drawing::Size( 306, 168 );
     this->BackColor = System::Drawing::Color::White;
      this->Controls->Add( this->loadAsyncButton );
      this->Controls->Add( this->statusBar );
      this->Controls->Add( this->playLoopAsyncButton );
      this->Controls->Add( this->stopButton );
      this->Controls->Add( this->playOnceAsyncButton );
      this->Controls->Add( this->playOnceSyncButton );
      this->Controls->Add( this->loadSyncButton );
      this->Controls->Add( this->label1 );
      this->Controls->Add( this->selectFileButton );
      this->Controls->Add( this->filepathTextbox );
      this->MinimumSize = System::Drawing::Size( 310, 165 );
      this->Name = "SoundTestForm";
      this->SizeGripStyle = System::Windows::Forms::SizeGripStyle::Show;
      this->Text = "Sound API Test Form";
      this->ResumeLayout( false );
   }
};

////////////////////////////////////////////////////////////////////////////////////////////

//#include "stdafx.h"
#include "P1.cpp"

int main()
{
Application::Run( gcnew SoundTestForm);

}
Adelaid Member

Are you looking to write a windows app from scratch or are you looking for an app to convert your web code into an exe?

If you want a convertor then what language?

eg. There are quite a few PHP to EXE…

http://wiki.swiftlytilting.com/Phc-win
http://sourceforge.net/projects/wapache/
http://www.bambalam.se/bamcompile/
http://www.zzee.com/phpexe/
http://www.exeoutput.com/
Adelaid Member

you need to set it up to email the info to you

does your web host support “CGI”

http://www.html-form-guide.com/form-mail/cgi-form-mail.html

in reply to: Database Confusions
Adelaid Member

The information isn’t strictly correct, but the idea is basically right. The simple answer to your question is that the increase in size of the company implies an increase in size of the data requirements. The usual split is:

One- or two-person companies use Excel
The solution is simple and cheap and very low-maintenance. One person with knowledge of Excel can handle everything.
Very small companies use Access
This allows some data to be shared, although it’s not a very scalable solution. Again, it’s simple and it’s usually maintained by someone in the office who has a good grasp of MS Office.
Small-medium companies use Microsoft SQL server
Large companies use Oracle or DB2
This is a “real” database, but it lacks the enormous power of Oracle or DB2. The reality is that there is little to choose between these three in terms of functionality, but the MS solution only runs on Windows and doesn’t scale to the sizes needed by large companies.
Companies with extraordinary requirements for data use NoSQL solutions like Hadoop
This is Google and Facebook, etc.

SAP is not a database, but an enterprise software solution. It usually runs on Oracle or DB2 as its database. I have no idea why this was added to the list – it just doesn’t make sense.

Interestingly, DB2 is often forgotten by people when talking about databases, but it’s the second-biggest seller after Oracle – see Computer Weekly:

http://www.computerweekly.com/feature/Choosing-the-right-database-management-system

Adelaid Member

Visio can create ER diagrams from ‘reverse engineering’ tables in an Oracle database. I think TOAD can do it too.

Adelaid Member

Actually there are 2 routes to take:

1. c -> c++ -> c# .NET
2. java SE -> java EE

Both have it’s advantages and disadvantages, but if you are new to the programming world java should be your choice not c++

Adelaid Member

Remember all matrix use a double for, so use it for the input and output

   for (int i = 0; i < n; i++) {
      for (int j = 0; i < n; j++) {
         //the multiplication process here
      }
   }
Viewing 15 posts - 1 through 15 (of 69 total)
en_USEnglish