I know that my question is possible duplicate of What is Facades used in Laravel?.
But please consider this as a different question.
I need a simpler explanation to this.In my best understanding, FACADES ARE SHORTCUTS.
Am I right?.
Facades are not shortcuts.
Consider that you bought a new computer. You install various applications.
You put frequently used apps on your screen so whenever you need them you can use them. You need word: you opened word from shortcuts, you need photoshop you opened from shortcuts. However you don't open word to edit photos or Photoshop for editing documents.
These are shortcuts a.k.a aliases in Laravel
On the other hand; You installed a screenshot app to your computer. You wanna get screenshots from word files and screenshots from photoshop as well as from various other applications on your computer. So this screenshot app is something you use in various applications. This is what called facades in Laravel.
More technically; For example you can use Requests often in many different places of your application so making an alias for Requests saves you time. However you don't really need to pass requests to your models. However you might need to check user roles in controller or in models even in view files... So Requests are defined as alias and while Roles are facades. Hope it makes sense
Related
I currently have 3 very similar, but slightly different mfc applications, which would normally be opened at the same time as part of their workflow and usage in a Windows environment. I would like to keep them as 3 separate applications, but somehow group them together, under a single UI container to provide more clarity to the user.
I've so far considered using named pipes to send data from two of the applications to the third, the latter one being solely responsible for drawing the GUI (possibly having 3 different tabs at the highest GUI level, one for each application). I got this idea from SergeWautier's answer from this post. After looking into the possibility of doing this, there seems to be a lot of work involved in achieving this.
Is there any other (possibly simpler) way of achieving something similar?
Old answer
I have in the mean time come across the TaskSpace tool, which is the closest thing to what I'm looking for. It's liteware and getting the full functionality (e.g. saving a particular tabbing configuration, which I am most interested in) requires purchasing a licence. What would be really cool would be to restrict the user from adding any other windows apart from the 3 applications and have better control over the titles of the tabs & top-level window. At this point, writing a similar tool to TaskSpace would be the ideal solution.
I've also been playing around with tidytabs. It's not exactly what I want, because it doesn't provide a 'wrapper GUI', but I thought it's worth mentioning here in case it helps someone else.
Update
I've found exactly what I was looking for in Window Tabifier, which is open source and I can modify to fit my needs in accordance with the CPOL Licence provided. Very nicely written code too.
Let me first explain my situation:
I have an old application and don't have any possibility of changing it. This application works with sqlite tables, one of them being a "temporary" database, but does not create temporary tables in memory but rather uses normal tables.
I install this application in a terminal server and the problem is that the application tries to read from a static path from the temporary table.
I need to redirect the "open syscall" to another file, so I want to know if I could do that with some software or by programming it.
Several options in order of "preferableness":
Create a junction. Click the link to get a tool for doing this.
Use a shim if possible.
If the above are not possible then you could use Madshi's madCodeHook lib to intercept the(*) call. Somebody over here is having a similar question, the discussion there also applies to your situation.
Be careful though when using API hooking and always ask yourself what would happen if two programs are doing it at the same time. This would likely result in an unstable system a.k.a. a mess.
(*) You would also have to figure out which call you actually need to hook.
You should be able to do that with a junction point.
I've started tinkering with webOS and it's pretty cool. Out of all the major smartphone platforms I have to say that webOS is the easiest to work with. Currently I'm just trying to get an intuitive sense for the framework and I'm just tinkering with basic stuff like event handling, pushing and popping scenes, etc. This has gotten me far but I'm getting to the point where my applications need a little more modularity since they no longer logically fit on a single stage with multiple scenes. I would like to know how do I go about writing my own assistants and controllers and using them in my code?
Are you using Eclipse with the plug in installed?
Even if not, just copy a basic controller and change around the class names everywhere you see it.
Say HomeController to PreferencesController
Add that preferencescontroller.js to your sources.json file and add a folder in the views called preferences with a file in there preferences_scene.html (I believe).
Since the current framework is MVC, you may also want to think about creating javascript models that would house your validation and even helper files that could be global or view specific. None of this is truly enforced except through your own doing though.
Also, beyond that, in 5 days HP will have a conference that shows off their new devices and possibly even their new modular framework titled Enyo, so that may be more what you are hoping for.
I've done plenty of programming before for CLI and the web, however recently I am getting into desktop GUI programming.
Most of the tutorials for GUI programming I found just explain the different controls you can use and leave it at that. Some of the better ones also skim over a few usability issues.
However, my problem is not with the APIs, or the theory but with my code.
How are you supposed to organise different views your application might have (e.g. a IM application has a login view, a contacts list view, a conversation view etc.).
Are these supposed to be different classes or different methods on one class?
Different panels that are hidden and revealed, or different windows altogether?
I'm hoping for answers as language agnostic as possible, but in case that's not possible, the languages/frameworks I am considering are Java/Swing or C#/WPF. However, if there's another language/framework that is significantly better for learning from, I would consider using that.
Normally each view will be a seperate class in a seperate file. The class will then most likely implement some base class like Window or Control.
As far as organization, if it's a simple app, put them in the root or in a UI folder. Or perhaps a Window folder and Controls folder.
If it's a large app with several views, than break them out into functionality, i.e. an IM folder.
I would say go with what Joshua said and as far as using different panels that are hidden and revealed, i've worked on old code and it's a nightmare to re-use (8000+ lines of Delphi 6!) so stick with different windows as much as possible!
The generally recommended overall structure of the program is the model-view-controller (MVC) type of structure. So, first off, don't make the actual data part of the views, it goes into the model. From here, since the only data in each view window is now almost entirely just layout information and what to do on an action (click, data display, etc), if these are different, they should probably be different classes. If there's some general functionality that can be factored out, you can make this a base class and inherit from it, but in the end, windows with different functionalities should be different classes.
If you are going to be using one of the mainstream IDEs it will handle some of this work for you. The default will be a different class for each form. Hidden panels and tabbed interfaces are nice features but do yourself a favor and learn the ins and outs of embedding groups of controls into form. Some frameworks allow you to directly embed one form into another. Others have special containers that can be be embedded.
The point of these is to break up your functionality so you don't wind up with a bloated form class that's difficult to wade through.
I would also spend some time looking at some of the architectural patterns for keeping your business logic separate from your UI. Check out this link for a good starting point.
I have four small single-form utility applications that I have written in Delphi (Win32), that every once in awhile I want to use in a way that makes them "feel" as if they are all one application, mostly to make switching back and forth between them super-easy. It would be great, for instance, to be able to insert them as containers inside a TabSheet, or something along those lines.
AppControls makes a neat little component that does something similar with TForm descendents, allowing them to be inserted inside another container in a Delphi application (see acEmbeddedForm http://www.appcontrols.com/appcontrols/overview.html'>here ), but I don't see any way to do this with four separate applications unless I build a fifth application with this end result in mind, and compile in all the forms of the original four applications.
I could also imagine wanting to "contain" or embed some other application as well (say, for instance, Notepad).
Is this possible in Delphi? (all things are possible... <g>)... and if so, would it be super difficult, and require massive amounts of under-the-hood Windows API familiarity?
I'm thinking the respective answers to these are probably yes, and yes, but hoping the answers are yes, and no. Thought I would ask just to be sure. <g>
If I am dreaming here from a programming perspective, and this is way more work than it's worth; any recommendations for utilities that make switching back and forth between a standard set of three or four applications simpler than it normally is in Windows?
You could make your small apps into OLE servers and create a new application that hosts them in one main form. OLE is nicely supported by Delphi, so it should be both fairly easy and not require much API fiddling.
This other SO question could provide some hints. Basically it states that you use SetParent. You could also enumerate over existing windows (such as notepad.exe) using FindWindow and call SetParent on them to reparent under your own.
With regards to embedding programs you don't have control over: I suspect you'll have a lot of trouble trying to do what you're describing, and if it's even possible at all (something I doubt), it would rely on a lot of low-level API calls and general nastiness.
If you wanted to restructure your application somewhat, you could make your four programs into plugins, and create a fifth "host" application that could load any or all of them.
I suggest you take a look at the JEDI plugin system, available for free from http://delphi-jedi.org.
I went with the "make a fifth app" solution when I combined a number of internal apps into a single app with tabs to select between them.
frmShipRef := TfrmShipRef.Create(self);
frmShipRef.Parent := tabShipRef;
frmShipRef.BorderStyle := bsNone;
frmShipRef.Align := alClient;
frmShipRef.Show;
I just set up a new form with tabs, then create each other form with the code above. This has worked well, and with a little conditional compiling I was able to add a panel on the left which provides a sort of "meta-copy-and-paste" to allow them to pass data between themselves.
Since all of your other apps are single form, you could cut/paste/save all components in each app onto a separate "background" panel saved as a Component Template. Then you could load your Component Template onto its own PageControl/Tab.