Thursday, March 11, 2021

Executing Git Commnads from PHP

 This a continuation of my previous post about the new project I have in mind. I am currently using Git as my version control software and commands are usually entered at the cmd environment or the git-bash software.

I already know that PHP has the command shell_exec to run batch files or external executable files so it should be easy to accomplish this task. I am going to show how I did it:

  • shell_exec can not work directly to execute the git commands,  but it has already proven that it can run .exe and .bat file. 
  • I opted to create a .bat file but the problem with this file is that I could not capture its output. It has no control over the process being created which means it does not have to wait for a line to finish before going to the next, fortunately, vb6 has this feature that's why vb6 is an indispensable tool  for me.
  • So I created a .exe file from vb6. What this program does is to run the .bat file and capture its output and save it to a text file
  • And after creating this, the php scritpt will run the .exe file and then display the content of the text file.    
It should be noted that this is for offline applications. I encountered a lot of  difficulties but finally I was able to make it work. 

More details of the programs I created.

1. VB6 .Exe File
The vb6 program consists of a module with a few api declarations and a function. The api declarations are necessary to activate the detection of the ending of the process created when the program executes the .bat file. The vb6 startup is the subroutine main().

Here's api declaration:

The subroutine main() calls the function Shellsync with 2 parameters, the batch file name and vbHide(a vb6 system variable that instructs the shell command to hide the window that the process being created when it executes the batch file. And the function Shellsync the one responsible for executing the batch file and catch the output to a text file. The actual command to save the output to a text file is a common dos command:


 2. The batch file.

I created a .bat file to handle 2 git commands and its very very simple:


 

 3. And lastly the php script is also very simple:

 


 4. Before I forget, all three files are located on the same folder:


 

 

 


Tuesday, March 9, 2021

New project In Mind

 For very large software development projects, code versioning is an indispensable tool to avoid  any losses should there be data corruption in the codes. It is like in this scenario:

"Hey, this is working before but now it isn't because of the revisions team A has done, I need to make it work because its holiday, for sure a lot of online shoppers will access their account to do more shopping, we do not want to miss this opportunity."

It's a huge disaster if the team could not restore the previous version known to work. Having a nice file version control software is not enough, I think it is also important to get statistics like how many commits has been done for the day, what's the status of the current revisions, do I need to commit the changes to my code without securing approval? So I thought maybe a separate web application must be done for this. 

This can be a very complicated  web based application but this system is very valuable for software development companies. That's why, I am also very excited to develop web app like this.

The web app shall composed of 5 modules which are as follows:

  1. User Management system
  2. Programming IDE
  3. Dashboard
  4. Project Management System
  5. Collaboration System
  6. Social Media


Dropdown Login Form using pure CSS

 I know that adding a dropdown login form can be done with sophistication using bootstrap. This was on top of my list when it comes to this particular task but given the circumstances, I opted to use CSS/Javascript because I encountered several errors with Bootstrap and it such a very inconvenience to modify my existing codes just to make it work.

The errors I encountered when I used bootstrap were as follows:

  • The left sidebar was deformed after I declared bootstrap 
  • The float chat button window user avatar disappeared
  •  The padding of all elements changed

 

I mean all display elements got affected just by declaring bootstrap. So I used pure CSS/Javascript instead so that I dont have to modify my existing code.



Saturday, February 20, 2021

Having Free Lunch Today

 I wanted to add a floating chat button. Chat buttons are found in modern websites like facebook and those sleek looking real estate websites. Sometimes they act as avatar and had some animated designs. But I have no idea how to do it so I googled it and I was successful for being able to get a free downloadable code for this little project of mine. I got it from this url. This explains why the title of this post is because I got the code for free.

But the code is still not working 100%, I will still need to make it work and since I am still in the conceptualization stage, obtaining this code for free saved me a lot of time. I plan to make it database driven chat and to refresh it every 2 secs to get the latest message and I need to animate the button to tell the user there is a new message.



The Mobile Friendly Layout

 I have created a mobile friendly layout for my project, but this is just an initial design, and basically the left and right sidebars disappear and the header and description changes alignment from left to center. But that was just the beginning. 

It evolved several times like, after I am done with the initial design, I realized that there should be a way to make the left sidebar reappear and make it disappear so I added the menu button at the left most side of the control bar and a close button at the sidebar itself. I should make this menu button active only when the  sidebar is invisible while the close button should disappear when the screen width is greater than 800px.

Then tested it on an actual mobile phone and it seems that as the screen width reaches 700px, the sidebar becomes too over crowded because the the texts have become a lot bigger and the left sidebar width should adjust according to the screen width. Doubling its width should do the trick.

Then I tested it again using a 7" android phone and realized that what if the device changes orientation and the screen width changed while the left sidebar is visible, so it should also respond to that change as well because as the screen size change the text size changes automatically so if the sidebar width stay the same, it will be overcrowded again. 


Here is the finished layout I have made so far:


Pls note that the video shows only the windows chrome browser, it looks very different when viewed on android browser. 

Monday, February 15, 2021

My Project's Layout

 I have chosen the 3 column format for my project because for me this layout displays the much needed functionalities without giving the view overcrowded effect. 

The design is capable of adjusting based on the screen size and should be mobile friendly because majority of internet users are on mobile phone.

Here's what I have done so far:




Thursday, February 11, 2021

My Project's Navigation Menu

 My project's navigation system is what I consider its center piece because although it is an enterprise class application which is a combination of text contents and user interaction screen, I would consider it overall as a content management system because it allows content changes to happen most of time and allows creation of new contents not only articles but data entry screens as well and there should be a way for users to specify path location of the new content in the main navigation menu or re-arrange the current over all organization of the navigation menu.

What I have in mind is a highly customizable navigation menu or rather an enterprise class application.

This my concept: 


It should be a tree view and initially, I used w3schools.com sample tree view program (pls note that I am not promoting w3schools) but the css formatting is proudly mine. It should database driven view which has the following table structure:



Article ID
A unique code assigned to the page or post. This is the primary key of the table.

CAT ID
The category id is the unique code assigned to the Category on which the current page or post belongs. This is a secondary key of the table and should check the entry in the Category table.

SYST ID
The system id is the unique code assigned to the application system on which the current page or post belongs. This is a secondary key of the table and should check the entry in the Systems Application table. The Systems Application could be Blog, Social Media, Accounting, HR system, Logistics, etc.

Title
The title is a text field which is obviously the title of the current page or post.
 
 
 
 

Executing Git Commnads from PHP

 This a continuation of my previous post about the new project I have in mind. I am currently using Git as my version control software and c...