Desktop software development (possibly using web technology) and cryptographic checks - php

OK, go easy on me as it's my first question here. ;)
I am experienced in Web Application development, but I need to design 2 different desktop applications at work. I need advice on what languages to use (I use PHP for Web Applications, I have little other experience), any frameworks that may help me accomplish this easier and any IDEs to use to make my life easier too.
My first application will essentially be an interface to an embedded or remote DB and essentially it needs to do not much more than CRUD. A fulltext search function will be necessary as will sorting of the CRUD table too. I'd like to include the possibility of hiding columns of data too, but this isn't a priority. I currently use MySQL, but am happy to use any other DB, as long as they support importing from Excel. Of course, if it supports an excel spreadsheet as the database, fantastic, but wishful thinking...
I only need to support Windows XP upwards, this won't change. Let me know if I can add anything to help answer this.
My second application is going to be more complicated, I guess. It needs to output the SHA, MD5, CRC-32, CRC-16 signatures for an entire external drive on-screen and/or into a text document of the users choice (new and append). The external drive could be Compact Flash, EEPROM, CD-ROM, DVD-ROM, SD, etc. Whereas I have an idea where to start on the first application, this one is where I need major help as I have no idea which programming language has built-in support for all the algorithms above, or the best way to go about coding it. So any and all advice will be more than welcome.
Edit: OK, so I have come across Titanium and am wondering if this is the best option out there for my 2 projects. The first one I am certain I can achieve, but the second project is going to be pretty difficult I believe, as unlike most hash calculators out there, I do not only need to check individual files for SHA/MD5/CRC-32/CRC-16, but I also need to check Compact Flash through a USB-connected Sandisk CF reader and EEPROMs through a COM or USB connection as well. I essentially need to produce the signature/hash for the entire drive, not the files on it. Any advice on this in particular would be helpful, please let me know if I am going too far off-topic by stackoverflow standards, as I can create a new question with this in.

I'm going to have to say Perl might be a good (though not necessarily the best) option for you, if you aren't one of the PHP developers who are Perl-allergic:
Perl is probably easier for a PHP developer to pick up than some statically typed compiled language that typical desktop apps are written in
Perl has libraries to interface to pretty much ANY database back-end you want, though I'm not 100% sure about using Excel as DB directly (I'm fairly confident something exists in CPAN but can't recommend anything from personal experience).
Perl has Windows GUI development - from an easier (for you) web GUI using local/embedded web server to Tk to Win32 GUI modules (StackOverflow has a couple of questions with very good references on the topic of Perl Windows GUI options).
Perl has a fairly complete set of support for MD5/SHA etc... Again CPAN is your friend.

If the only development experience you have is PHP for web, your options for quick desktop development are seriously limited.
since i don't know of any (sane) way to use PHP for desktop apps, my first thought was to reach for a framework that would let you use JavaScript and a mostly declarative UI. That would save you from most of the pain.
The best one for that would be Qt, which is supposed to let you do almost everything on QML and JavaScript. the unfortunate part is the 'almost'; since anything that escapes that would mean C++ development. The best C++ environment, for sure; but still widely different from Web work (specially PHP web work).
The other option, which I think would be best for you is Adobe AIR. I haven't really checked it; but it lets you write a 'desktop-like' app using only Flash (with or without the Flex framework) or HTML+JavaScript. When i first saw it seemed pretty much complete. For DB work i think it can use an embedded SQLite library; or access any HTTP service (which could be a local DB+PHP app exposing the CRUD methods)

You could try PHP-GTK.
It may not be the fastest, but it does work.

Related

What are the relative advantages of various Python/PHP web frameworks (particularly for my project)?

I'm deciding on a web framework for an upcoming project, and I'd appreciate any advice. We've decided to use jQuery for the JavaScript, and are heavily leaning toward Python or PHP (more Python) for our server-side logic. I'm especially interested in web2py because of its jQuery integration.
About our project
Our project is to develop a security console for a complex
cybersecurity system operating within an organization's internal
network.
This console will be largely server-driven, as messages come in from the network and must be pushed by the server to the user.
The user will also be able to initiate security actions, the implementation for which will likely be in C++.
The interface we've planned will be relatively rich, and I want to leverage jQuery's power as much as possible.
We have some control over the browser environment we'll be running in (e.g., we don't have to worry about clients with JavaScript disabled).
Our site is likely to have only a few, long-lived client connections.
We are looking for software components with permissive licenses, though we're using some copyleft components (I see that web2py is LGPL while Django is BSD, so +1 to Django)
We have about a month to create a functional demo of our system, of which this interface is a small (but visible) part.
About us
We are two developers with about 5 years of programming experience, but little web development experience. I have several years of Python experience and a summers' worth of experience messing around with PHP. My coworker has some Python experience and has never touched PHP.
I used Django once back in 2008, and was frustrated by the file and code structure, which I found highly unintuitive. Perhaps this structure is inherent to the MVC model (I've had similar experiences with Django and CakePHP since), and I just need to bite the bullet and memorize it.
My Question
Given the information above, what are the relative advantages of the various Python/PHP web frameworks for our project? As mentioned above, I'm especially interested in web2py because of its jQuery integration, though Django's dominance is (once again) hard to ignore.
Thank you very much for your time!
Before deciding on a framework, you should first decide if you want to commit to a language you are unfamiliar with.
You said you've both got minimal PHP experience, so you have to weigh up the advantages here; Will the pros for going PHP (if any) out weigh the amount of time the developers will need to spend to retrain?
(Although depending on your background experience, PHP should be very easy to pick up.)
If you frame it like that, PHP would have to have a pretty convincing offering to give you. From what I'm seeing, specifically Django vs web2py, they both seem very close in functionality - which is good, but doesn't provide the "you must use x!" scenario you may be after.
However, If you will be bringing more people in later and feel finding people to work with web2py will be difficult, it may tip it to PHP. You said your self, Django's popularity (and BSD license) is hard to ignore, and it should make it easier to find people for later expansion.
If it were me, in your shoes, I would go with web2py. Assuming the development team will continue to be Python focused for the foreseeable future.
Python vs PHP: Python
With python, you can always write wrappers for C code so you won't have to mess with starting other processes and passing args to them. That might be useful for your security functions.
Web2py will allow you to easily write a webservice for this too, to more easily integrate the C portions with the web-site infrastructure.
If you already prefer python, I would go with that. If you need to bring on web-developers later that are trained in PHP, teach them Python. It won't take long, and I'm sure they'll appreciate it in the long run. Plus, moving from a PHP MVC framework to web2py or even django would make things easier. I've used CodeIgniter for PHP and find that web2py was so much simpler and easy to understand.
Also as for the directory structure, django is not actually true MVC -- it's MTV (model, template, view).
I find web2py's organization a little more straight-forward. But yes, either way it can seem strange at first. I would say YES, you should bite the bullet and use MVC.
In web2py, the "view" is html markup with the ability to write raw python code. The controller extracts data from the model (database), attaches any needed files (css/js etc) and the model of course simply defines the structure of the data and allows you to access it in an OO way.
Lastly, I wouldn't tip my hat in favor of web2py just because of jQuery integration. It does use it, and a some of the built-in framework stuff (like response.flash/session.flash, the LOAD function that loads a page or data from another controller) rely on jQuery, but using it in another framework only means you have to write an include statement (e.g. ).
But, the way it allows/forces you to focus on development is what takes the cake for me.
I've been using Django as part of my work for a couple years now and truly enjoy it when I can make it work. Unfortunately, and maybe it's just me, but I end up spending hours working on configuration every time I start a new server, or try to make it work in a development IDE.
It's relatively simple to start a new project and start coding. But there are all sorts of little catches that keep things from working if you deviate from the norm. Things like if you want your django project to serve from a subdirectory like example.com/django. The information is out there to make it work. But it's hard to find.
I can't tell you if web2py has those same problems or not. I only just learned about it from your question. It does look slick and simple though. I can tell you that after the hassles of getting the applications to serve properly from whatever server configuration I'm using, django is way more fun to program with than plain php. PHP frameworks may differ.
From my understanding the project not usual web application, you must need event driven program, web server in python.
Django won't help you here.You should look into Flask, Flask has inbuilt console too.http://werkzeug.pocoo.org/, you might need to use twisted, gevent,Flask jquery.
I would recommend asking about web2py on its mailing list -- you'll get lots of help and advice there. Regarding the LGPL license, note that it only applies to the framework, not your application -- you can license your application however you like, including closed source/commercial.
It sounds like you'll need some server push functionality, but if you'll really only need a few long-lived connections at a time, you might not need to bother with solutions like Twisted or gevent. If necessary, though, web2py does include this (requires Tornado, and works using WebSockets, though can be adapted to use other methods).

What non-OO language can a web dev use to create a one-off desktop app?

I'm looking to develop a Win32 desktop app - a one off, for a personal need. A GUI is not scrictly needed, though would be a bonus.
What is needed:
The ability to monitor the window title of a specific window.
The ability to run DOS commands when this window title changes.
I hope my programming ability is up to this - I feel I'm pretty good with PHP, but I'm not ready to spend time learning OO for this one-off project.
What non OO (or at least not mandatorily OO) languages are there for desktop apps that might be suitable for a beginner on a task like?
Any other, more hacky approaches are welcome too - batch scripts etc.
Many thanks for any advice,
Jack
Whether or not the language supports OO doesn't really matter for your purposes. After all, PHP supports objects and you seem to do just fine with it.
Personally, i'd recommend Java or C# to get started with. The communities for these two languages are huge and there are plenty of tutorials online to help you get started.
It's extremely easy to get starting writing C# with Visual Studio Express. And a good hello world tutorial.
Also, if you stick with C# you can take advantage of WMI which will allow you to do everything you need for this project (and much much more).
Lastly, most windows machines will be able to run your application without having to install anything extra and Visual Studio builds the .exe for you as part of the build process.
You can use PHP for desktop apps if you really want to. Just install the php CLI.
You can even do a gui for your desktop app in php: http://gtk.php.net/
EDIT: I'm not sure how easily you can call win32 api functions from PHP, however. There look to be a few articles about this online and a SO question: How to call winapi functions from PHP?
I would vote for Python using the included TkInter module for GUI. Dead simple to use.
Widgets aren't the prettiest looking, but development is rapid.
EDIT: I mistook "non-OO" in the question for "OO". Python is most definitely not "non-OO", but but is very well suited to doing what you asked.
You could write this in pretty much any mainstream language supported by Windows. C or C++ are obvious choices. C# and Visual Basic .NET are going to require the .NET Framework ... not a bad thing, but perhaps more than you want to tackle for a simple project. Come to think of it, you might be able to do this with JScript or VBScript, although I'm not clear on what API functions you have easy access to. And I have to believe that it's possible to do with PowerShell with just a little work.
Your options are wide open.
F#
It's an awesome piece of work, has access to the Framework class libraries, supports GUI development, really easy parallel programming, compiles to IL (same as C#) but has a really concise functional syntax.

Using PHP for medium to high-load public websites

I am planing to build a website using PHP to be hosted on the public internet with decent user load (between 1000 to 5000). I am using FreeBSD as a server and I configured Apache, PHP and MySQL from scratch.
With proper configuration, is it safe to use such a server, or should I go with some web framework? I am asking as I've heard few horrible things about PHP.
If it is safe, does PHP get too complex when the size of the site increases beyond a certain point?
I know Facebook uses PHP; are there any other big websites that use PHP?
Last, is it recommended to use some PHP framework or should I stick to plain old PHP?
PHP works fine for just about any size server. The question isn't really the programming language but the infrastructure you set up. 1000-5000 users is not very many unless they are all banging on the site at the same time. Are they doing a lot of DB queries or consuming a lot of CPU resources? If so, then you may want to look at a dedicated MySQL server for the DB queries.
I have nothing against frameworks. However, you are usually shoehorning your problem into their solution. Careful design on your part with common routines, etc., are usually just as good as a framework in my opinion. However, some people are more comfortable working within a framework because it removes some of the plumbing issues.
A lot of large sites use PHP. It may not be obvious because they hide the extension of the scripts in the URLs.
With proper configuration PHP is fine. However if youre new to php and server administration you might want to read up on configuring php as well as Apache for security. Youll also need to read specifics on configuration for performance as well but you need to have an app to test before its really worth doing that beyond some basics.
As far as using a framework or just basic PHP that depends totally on you. a framework is othing more really than a set of useful code and structure to accomplish alot of tasks. If you dont use a framework youre going to have to write code that meets similar requirements, so you might save time using a framework. Generally you are going to sacrifice performance in trade for having to design/write less code. You need to decide yourself if a framework (and which one) is right for the project.
In terms of sites that use php... There are a ton... Facebook, Yahoo Bookmarks, Daily Motion, parts of MySpace (at one time, not sure if its still the case), anything running Drupal or Wordpress... PHP is more than capable.
PHP is just a tool and choice of framework does not really makes your application secure or fast, unless you understand the principles of web security and how things works.
Facebook is good example of what php is capable of in hands of processionals. And there are plenty of websites that capable to handle 10K visitors a day on a single low end server.

How much languages is "recommended" for a dynamic website?

When constructing a website, say a Q&A site or a just a forum site for a community, is just knowing HTML,CSS,PHP, MySQL, and javascript enough to make the site dynamic?
I am saying this because when I talked with my teacher, he said that major sites use many languages combined. And he said that a site shouldn't be designed only in PHP.
So is it possible to create a good website, not e-commerce, with only html,css, and php?
yes. there is no reason you should use more than one language internally. it makes making it all work together much easier in a server environment, where the extra load of IPC over function calls can slow things down considerably.
Ofc! :)
Lots of large/enterprise portals use only HTML, CSS, Javascript, PHP & MySQL.
But don't forget that there's always a right tool for the right job... A simple site (even an e-commerce) will run very well on PHP & MySQL.
Short answer: yes, it is possible.
Longer answer...
HTML, CSS, PHP and MySQL are already many languages, but I guess he means that most major sites have a heterogeneous back-end. This is probably not out of choice though -- more often it is historical. As people change and new technologies emerge, new pieces are built with different languages and frameworks.
I have built a forum and Q&A sites with HTML+CSS+PHP+MySQL and many other people have done the same, so this set of tools is without a doubt adequate for building something like this. In fact, I would argue that you could build almost anything on the web with that combination.
A more interesting question (that will generate more heated response) is what framework you use on top of that. A CMS like Wordpress of Drupal, or an MVC framework like Zend, CakePHP or CodeIgniter.
Or whether you should be dropping PHP entirely and using something like Django or Ruby on Rails. Knowing more than PHP will definitely help you to be ready for newer approaches.
The dynamism of a website comes from a server side language that can create a HTML output on the fly, that's it. You can add a DB, simple JS or AJAX, but those are merely optionals.
Now, as for your teacher, languages like PHP, Python and ASP are, in the end, the same. It's ridiculous to have the includes files in ASP, the main files in PHP and the configuration files in Python, that makes absolutely no sense. Maybe, hopefully, he was talking about using JS in conjunction with PHP and SQL which is a natural recommendation.
The fact that your teacher is obsessed with another technology doesn't mean that you can't work with PHP only.
As the others said, it is perfectly reasonable and possible.
(I'm personally obsessed with ASP.NET, but still, I won't say that it is the only way to go for everyone. And PHP is just geat for beginners.)
Is he referring to the front-end or back-end?
The front-end of a website - the part that the user sees and interacts with - must be written in HTML.
(It may optionally include CSS and Javascript to enhance it.)
The back-end is what generates the front-end, and also determines the structure and control-flow of the application.
There's absolutely no need to use more than one language for the back-end, and it's often simpler to stick to one language.
However, for the front-end, you have no choice but to use HTML; otherwise it isn't a web application.
The front end must output HTML. These days it should use CSS for formatting. It will likely use Javascript to provide client side capability. Requiring javascript will likely create accessability issues for some users.
PHP is one of several languages used to handle requests. It is in interpreted language requiring the source be placed on the server. This opens up significant security risk if the someone gets access to the server. Several hosting sites have had major problems with PHP based sites over the last few weeks.
Java is run in a compiled form and code is not required to be on the server. This provides a layer of security as it is not simple to modify the code. Java runs in a container, and usually a framework. Developing using the Spring framework in a Tomcat container is an option. The learning curve is higher than with PHP. It also has strong support for accessing remote resources which allows it to integrate with legacy applications.
With any of the languages, there is a risk that developers will use available functionality when they shouldn't. The Java J2EE model is appropropriate for some sites, but was often implemented because it was the fashion, and there are a lot of tutorials on using it.

Php/Javascript to make a browser game?

I've been on and off intrested in making a text based browser game.
I have been turned off by the idea because of the daunting amount of things to learn.
PHP (or another sever side scripting language)
Javascript
HTML
MySql
And the fact of severs and apache..
Can I just pay for web hosting and by-pass having to set-up apache?
Also how long will it take me to learn all thoose things well enough to start work on my game?
Should I just stick with Flash and then C# for XNA?
Just install XAMPP, which is basically the lazy man's Apache/PHP/MySQL setup in 1 click. You just install it and it does all the work, nothing for you to setup nor config.
Don't let the complexity of PHP/HTML/Javascript set you off, we all hard to start somewhere. Just start with the parts you know how to make, then look around for each individual problem. Being motivated is key to learning anything, and if you have something you enjoy working on, you won't have a problem learning what you need to pull this off.
Do you have a specific game in mind?
Does it need to be multiplayer?
In the initial stages, does it require server interaction at all?
Conversely,
Are you interested in the possibility of building a working game first, and adding in features like saving high scores, multiplayer, or other server-interactions later?
Is a self-contained game like nethack or Hitchhikers a good starting place for you?
If your initial game does not require server interaction, you can build quite complex games using only HTML and JavaScript. This will reduce the number of concepts and languages you need to learn up front.
Once you have had some practice building non-trivial games in HTML and JavaScript, you can then add in features like server-integration, and learn a server-side language like PHP, Python, Perl, ASP.NET, or Ruby...
You can definitely pay for hosting, and eliminate the effort of setting up and maintaining a server yourself. A quick search will find you a number of web hosting sites to choose from.
I believe sticking with flash would make things easier, as syncing multiplayer with javascript and PHP isnt going to be easy.
It depends how complex the game you want to make is. You can easily learn some basic PHP and javascript inside of a month (like pretty much any other language), but it'll take a lifetime to master (like any other language).
I would recommend you start out small - plan to implement just a subset of your features, and take them on one at a time.
I would plan to use libraries / frameworks. For Javascript I would currently recommend JQuery because I find it easy to use, it has a large community and it's well documented. Using a library like JQuery allows you to easily ignore a lot of the browser specific details, since they deal with all that nonsense for you.
For PHP I personally use Zend Framework - this is a massive beast that isn't always the best documented, but if you start with the "Quick Start" tutorial and then only look at features as you need them, you shouldn't get overwhelmed too easily. One of the great things about Zend is that you can pick and choose what features you want to use without hassle.
With regards to servers, yes you can use a web host and bypass setting up a full server yourself very easily and cheaply. You can find local installations (eg. XAMPP) that will allow you to quickly set up a local install of Apache, PHP and MySQL to get started with.
First of all, if you're developing an MMO or want to offer multiplayer support, you're going to need to learn PHP and mySQL. In theory, you could go ASP.NET instead, but I would strongly advise against it, since Microsoft servers cost more to rent, and since PHP/mySQL is much better documented and easier for beginners to learn. If you're building a single-player game, Javascript and HTML could technically be adequate, but knowing PHP will still make your life easier, in the long run.
Although you should probably set up a LAMP stack (Linux Apache mySQL PHP) on a local network so you understand how it works, hosting your own server almost never makes sense for a production environment. You could, however, save yourself some money by developing the game on your own LAMP stack. Alternately, most shared hosts (around $80 / year) provide support for PHP and mySQL, and this would be perfectly adequate for building your game. Eventually, once you're ready to launch -- and assuming it becomes even marginally popular -- you're going to need at least a VPS, and possibly a dedicated server.
Finally, a note on Flash:
In the last few years, the popularity of mobile devices has skyrocketed, and this presents a risk for Flash games, since Apple refuses to support the plugin. If you need advanced graphics support, a more timely alternative would be HTML5. Unfortunately, this carries its own set of drawbacks: namely, since it's a long way off from official release, it's not yet universally supported, and features that are supported will vary from one browser to another. So basically, HTML5 is the future, and Flash is the past. The best option for right now? Probably Javascript; you might be surprised what JS can achieve, when properly combined with CSS, and you'll need it for AJAX functions anyway. Best of all, it's supported by virtually every device and browser.
So, in conclusion, I'm recommending that you learn HTML, CSS, PHP, mySQL and Javascript, and don't be intimidated by that variety of languages; the more you learn, the more easily you learn the rest.

Categories