Rectangle 27 286

git is like UNIX. User friendly but picky about its friends. It's about as powerful and as user friendly as a shell pipeline.

That being said, once you understand its paradigms and concepts, it has the same zenlike clarity that I've come to expect from UNIX command line tools. You should consider taking some time off to read one of the many good git tutorials available online. The Pro Git book is a good place to start.

git remote add ...

As you probably know, git is a distributed version control system. Most operations are done locally. To communicate with the outside world, git uses what are called remotes. These are repositories other than the one on your local disk which you can push your changes into (so that other people can see them) or pull from (so that you can get others changes). The command git remote add origin git@github.com:peter/first_app.gitcreates a new remote called origin located at git@github.com:peter/first_app.git. Once you do this, in your push commands, you can push to origin instead of typing out the whole URL.

git push origin master

This is a command that says "push the commits in the local branch named master to the remote named origin". Once this is executed, all the stuff that you last synchronised with origin will be sent to the remote repository and other people will be able to see them there.

Now about transports (i.e. what git://) means. Remote repository URLs can be of many types (file://, https:// etc.). Git simply relies on the authentication mechanism provided by the transport to take care of permissions and stuff. This means that for file:// URLs, it will be UNIX file permissions, etc. The git:// scheme is asking git to use its own internal transport protocol, which is optimised for sending git changesets around. As for the exact URL, it's the way it is because of the way github has set up its git server.

Now the verbosity. The command you've typed is the general one. It's possible to tell git something like "the branch called master over here is local mirror of the branch called foo on the remote called bar". In git speak, this means that master tracks bar/foo. When you clone for the first time, you will get a branch called master and a remote called origin (where you cloned from) with the local master set to track the master on origin. Once this is set up, you can simply say git push and it'll do it. The longer command is available in case you need it (e.g. git push might push to the official public repo and git push review master can be used to push to a separate remote which your team uses to review code). You can set your branch to be a tracking branch using the --set-upstream option of the git branch command.

I've felt that git (unlike most other apps I've used) is better understood from the inside out. Once you understand how data is stored and maintained inside the repository, the commands and what they do become crystal clear. I do agree with you that there's some elitism amongst many git users but I also found that with UNIX users once upon a time, and it was worth ploughing past them to learn the system. Good luck!

You might want to add a note in your paragraph about transports explaining that git@github.com:peter/first_app.git is the scp-style syntax for ssh URLs in git. One other point is that, by default, the upstream configuration of master doesn't affect the behaviour of git push unless you have push.default set to tracking (or upstream in later versions) - I did a blog post about this source of confusion: longair.net/blog/2011/02/27/

A small correction to that comment - without push.default the upstream configuration would be used to find the default remote when you use git push, but wouldn't affect the mapping of the refs.

I wonder why the "inside out", as usually, the "black box" is very easy to learn... it is like a top down approach, with the top -- the interface -- what you input and what you get, very well defined and hopefully simple as well. All a user needs to care is the "Interface", and really doesn't need to know what is inside. If the user wants to know more, the special way of implementation, it is good to know, but it is usually optional.

Apropos black boxen vs. inside out. Git is the first thing I've encountered that was actually easier to learn inside out rather than from the "interface". Whether it's the right way or not is debatable. I'm just saying that inside out is more effective when it comes to git.

"git is like UNIX. User friendly but picky about it's friends." This is so awesome I want it printed on a t-shirt.

github - What is "git remote add ..." and "git push origin master"? - ...

git github
Rectangle 27 286

git is like UNIX. User friendly but picky about its friends. It's about as powerful and as user friendly as a shell pipeline.

That being said, once you understand its paradigms and concepts, it has the same zenlike clarity that I've come to expect from UNIX command line tools. You should consider taking some time off to read one of the many good git tutorials available online. The Pro Git book is a good place to start.

git remote add ...

As you probably know, git is a distributed version control system. Most operations are done locally. To communicate with the outside world, git uses what are called remotes. These are repositories other than the one on your local disk which you can push your changes into (so that other people can see them) or pull from (so that you can get others changes). The command git remote add origin git@github.com:peter/first_app.gitcreates a new remote called origin located at git@github.com:peter/first_app.git. Once you do this, in your push commands, you can push to origin instead of typing out the whole URL.

git push origin master

This is a command that says "push the commits in the local branch named master to the remote named origin". Once this is executed, all the stuff that you last synchronised with origin will be sent to the remote repository and other people will be able to see them there.

Now about transports (i.e. what git://) means. Remote repository URLs can be of many types (file://, https:// etc.). Git simply relies on the authentication mechanism provided by the transport to take care of permissions and stuff. This means that for file:// URLs, it will be UNIX file permissions, etc. The git:// scheme is asking git to use its own internal transport protocol, which is optimised for sending git changesets around. As for the exact URL, it's the way it is because of the way github has set up its git server.

Now the verbosity. The command you've typed is the general one. It's possible to tell git something like "the branch called master over here is local mirror of the branch called foo on the remote called bar". In git speak, this means that master tracks bar/foo. When you clone for the first time, you will get a branch called master and a remote called origin (where you cloned from) with the local master set to track the master on origin. Once this is set up, you can simply say git push and it'll do it. The longer command is available in case you need it (e.g. git push might push to the official public repo and git push review master can be used to push to a separate remote which your team uses to review code). You can set your branch to be a tracking branch using the --set-upstream option of the git branch command.

I've felt that git (unlike most other apps I've used) is better understood from the inside out. Once you understand how data is stored and maintained inside the repository, the commands and what they do become crystal clear. I do agree with you that there's some elitism amongst many git users but I also found that with UNIX users once upon a time, and it was worth ploughing past them to learn the system. Good luck!

You might want to add a note in your paragraph about transports explaining that git@github.com:peter/first_app.git is the scp-style syntax for ssh URLs in git. One other point is that, by default, the upstream configuration of master doesn't affect the behaviour of git push unless you have push.default set to tracking (or upstream in later versions) - I did a blog post about this source of confusion: longair.net/blog/2011/02/27/

A small correction to that comment - without push.default the upstream configuration would be used to find the default remote when you use git push, but wouldn't affect the mapping of the refs.

I wonder why the "inside out", as usually, the "black box" is very easy to learn... it is like a top down approach, with the top -- the interface -- what you input and what you get, very well defined and hopefully simple as well. All a user needs to care is the "Interface", and really doesn't need to know what is inside. If the user wants to know more, the special way of implementation, it is good to know, but it is usually optional.

Apropos black boxen vs. inside out. Git is the first thing I've encountered that was actually easier to learn inside out rather than from the "interface". Whether it's the right way or not is debatable. I'm just saying that inside out is more effective when it comes to git.

"git is like UNIX. User friendly but picky about it's friends." This is so awesome I want it printed on a t-shirt.

github - What is "git remote add ..." and "git push origin master"? - ...

git github
Rectangle 27 43

Maybe I'm missing something, but what's wrong with Enum.GetName?

public string GetName(PublishStatusses value)
{
  return Enum.GetName(typeof(PublishStatusses), value)
}

edit: for user-friendly strings, you need to go through a .resource to get internationalisation/localisation done, and it would arguably be better to use a fixed key based on the enum key than a decorator attribute on the same.

I returns the literal value of the enum, not some user friendly one.

oic - well there's a pretty big case that you have to go through a string resource library based on this value then, because the alternative (decorator attribs) won't support I18N

In case of I18N I would make the GetDescription() method search in the resource lib for a translated string and fall back to the description and then fall back to the literal.

+1 for MyEnum.ToString() as the resource key for localization. i've been doing that for years

@annakata we've actually extended the attribute mechanism to include support for l18N, it's a simple change in fact.

c# - Enum ToString with user friendly strings - Stack Overflow

c# enums tostring
Rectangle 27 31

I use Pixlr - an online photo editor, it has great filters and user friendly interface.

perfect - needed to rotate and crop a transparent .png, was able to do it in under 3 minutes; no software to install, and no dealing with GIMP.

@AlexFairchild +1 for "no dealing with GIMP"; I was trying to install GIMP for more than an hour ... no good

Free tool to Create/Edit PNG Images? - Stack Overflow

image png
Rectangle 27 257

I'm no fan of sophisticated UML diagrams and endless code documentation. In a high level language, your code should be readable and understandable as is. Complex documentation and diagrams aren't really any more user friendly.

Here's an article on the topic of Code as Design.

language agnostic - What's your most controversial programming opinion...

language-agnostic
Rectangle 27 257

I'm no fan of sophisticated UML diagrams and endless code documentation. In a high level language, your code should be readable and understandable as is. Complex documentation and diagrams aren't really any more user friendly.

Here's an article on the topic of Code as Design.

language agnostic - What's your most controversial programming opinion...

language-agnostic
Rectangle 27 257

I'm no fan of sophisticated UML diagrams and endless code documentation. In a high level language, your code should be readable and understandable as is. Complex documentation and diagrams aren't really any more user friendly.

Here's an article on the topic of Code as Design.

language agnostic - What's your most controversial programming opinion...

language-agnostic
Rectangle 27 41

I'd like to counter the "not user friendly" argument with an example that I have just been involved with.

In our application we have a main window where the users run various 'programs' as separate tabs. As much as possible we have tried to keep our application to this single window.

One of the 'programs' they run presents a list of reports that have been generated by the system, and the user can click on an icon on each line to pop open a report viewer dialog. This viewer is showing the equivalent of the portrait/landscape A4 page(s) of the report, so the users like this window to be quite big, almost filling their screens.

For some time I resisted this request as I did not think this was a good solution. However, my mind was changed when I found out how the users were getting around this 'deficiency' of our system.

They were opening a viewer, using the 'Save As' facility to save the report as a PDF to a specific directory, using Acrobat Reader to open the PDF file, and then they would do the same with the next report. They would have multiple Acrobat Readers running with the various report outputs that they wanted to look at.

So I relented and made the viewer modeless. This means that each viewer has a task-bar icon.

When the latest version was released to them last week, the overwhelming response from them is that they LOVE it. It's been one of our most popular recent enhancements to the system.

So you go ahead and tell your users that what they want is bad, but ultimately it won't do you any favours.

  • Use the constructors that use the new ModalityType rather than the boolean modal argument. This is what gives these dialogs the task-bar icon.
  • For modeless dialogs, pass a null parent to the constructor, but locate them relative to their 'parent' window.
  • Version 6 of Java on Windows has a bug which means that your main window can become 'always on top' without you telling it. Upgrade to version 7 to fix this

This is exactly my experience as well. If there's one thing I'm certain of, it's that you are doing something wrong when people try and circumvent your user-friendlyness to do whatever it is they really want to do. Functionality is king.

One way to get around this, is to allow to have multiple JFrame's opened, all offering the same functionality, but by default everything is done within a single window. This actually allows the user to choose between SDI or MDI.

Sorry? Can you explain your solution a bit better, please? How can it be a single window AND multiple windows? We have one main window where the main application runs, but sometimes we need to open dialogs, and sometimes those dialogs (based on user requirements) need to be modeless. Making rules that the interface should be this way or that is just going to dig a big hole for yourself.

@GuillaumePolet I agree with Duncan, can you explain what you mean a bit more? I share his confusion

I think what he means is that the user could start multiple copies of the application (the 'JFrame') but inside each of those it is SDI. However, our client application is a very thick client, so this would be a resource hungry approach.

java - The Use of Multiple JFrames: Good or Bad Practice? - Stack Over...

java swing user-interface jframe
Rectangle 27 41

I'd like to counter the "not user friendly" argument with an example that I have just been involved with.

In our application we have a main window where the users run various 'programs' as separate tabs. As much as possible we have tried to keep our application to this single window.

One of the 'programs' they run presents a list of reports that have been generated by the system, and the user can click on an icon on each line to pop open a report viewer dialog. This viewer is showing the equivalent of the portrait/landscape A4 page(s) of the report, so the users like this window to be quite big, almost filling their screens.

For some time I resisted this request as I did not think this was a good solution. However, my mind was changed when I found out how the users were getting around this 'deficiency' of our system.

They were opening a viewer, using the 'Save As' facility to save the report as a PDF to a specific directory, using Acrobat Reader to open the PDF file, and then they would do the same with the next report. They would have multiple Acrobat Readers running with the various report outputs that they wanted to look at.

So I relented and made the viewer modeless. This means that each viewer has a task-bar icon.

When the latest version was released to them last week, the overwhelming response from them is that they LOVE it. It's been one of our most popular recent enhancements to the system.

So you go ahead and tell your users that what they want is bad, but ultimately it won't do you any favours.

  • Use the constructors that use the new ModalityType rather than the boolean modal argument. This is what gives these dialogs the task-bar icon.
  • For modeless dialogs, pass a null parent to the constructor, but locate them relative to their 'parent' window.
  • Version 6 of Java on Windows has a bug which means that your main window can become 'always on top' without you telling it. Upgrade to version 7 to fix this

This is exactly my experience as well. If there's one thing I'm certain of, it's that you are doing something wrong when people try and circumvent your user-friendlyness to do whatever it is they really want to do. Functionality is king.

One way to get around this, is to allow to have multiple JFrame's opened, all offering the same functionality, but by default everything is done within a single window. This actually allows the user to choose between SDI or MDI.

Sorry? Can you explain your solution a bit better, please? How can it be a single window AND multiple windows? We have one main window where the main application runs, but sometimes we need to open dialogs, and sometimes those dialogs (based on user requirements) need to be modeless. Making rules that the interface should be this way or that is just going to dig a big hole for yourself.

@GuillaumePolet I agree with Duncan, can you explain what you mean a bit more? I share his confusion

I think what he means is that the user could start multiple copies of the application (the 'JFrame') but inside each of those it is SDI. However, our client application is a very thick client, so this would be a resource hungry approach.

java - The Use of Multiple JFrames: Good or Bad Practice? - Stack Over...

java swing user-interface jframe
Rectangle 27 41

I'd like to counter the "not user friendly" argument with an example that I have just been involved with.

In our application we have a main window where the users run various 'programs' as separate tabs. As much as possible we have tried to keep our application to this single window.

One of the 'programs' they run presents a list of reports that have been generated by the system, and the user can click on an icon on each line to pop open a report viewer dialog. This viewer is showing the equivalent of the portrait/landscape A4 page(s) of the report, so the users like this window to be quite big, almost filling their screens.

For some time I resisted this request as I did not think this was a good solution. However, my mind was changed when I found out how the users were getting around this 'deficiency' of our system.

They were opening a viewer, using the 'Save As' facility to save the report as a PDF to a specific directory, using Acrobat Reader to open the PDF file, and then they would do the same with the next report. They would have multiple Acrobat Readers running with the various report outputs that they wanted to look at.

So I relented and made the viewer modeless. This means that each viewer has a task-bar icon.

When the latest version was released to them last week, the overwhelming response from them is that they LOVE it. It's been one of our most popular recent enhancements to the system.

So you go ahead and tell your users that what they want is bad, but ultimately it won't do you any favours.

  • Use the constructors that use the new ModalityType rather than the boolean modal argument. This is what gives these dialogs the task-bar icon.
  • For modeless dialogs, pass a null parent to the constructor, but locate them relative to their 'parent' window.
  • Version 6 of Java on Windows has a bug which means that your main window can become 'always on top' without you telling it. Upgrade to version 7 to fix this

This is exactly my experience as well. If there's one thing I'm certain of, it's that you are doing something wrong when people try and circumvent your user-friendlyness to do whatever it is they really want to do. Functionality is king.

One way to get around this, is to allow to have multiple JFrame's opened, all offering the same functionality, but by default everything is done within a single window. This actually allows the user to choose between SDI or MDI.

Sorry? Can you explain your solution a bit better, please? How can it be a single window AND multiple windows? We have one main window where the main application runs, but sometimes we need to open dialogs, and sometimes those dialogs (based on user requirements) need to be modeless. Making rules that the interface should be this way or that is just going to dig a big hole for yourself.

@GuillaumePolet I agree with Duncan, can you explain what you mean a bit more? I share his confusion

I think what he means is that the user could start multiple copies of the application (the 'JFrame') but inside each of those it is SDI. However, our client application is a very thick client, so this would be a resource hungry approach.

java - The Use of Multiple JFrames: Good or Bad Practice? - Stack Over...

java swing user-interface jframe
Rectangle 27 41

I'd like to counter the "not user friendly" argument with an example that I have just been involved with.

In our application we have a main window where the users run various 'programs' as separate tabs. As much as possible we have tried to keep our application to this single window.

One of the 'programs' they run presents a list of reports that have been generated by the system, and the user can click on an icon on each line to pop open a report viewer dialog. This viewer is showing the equivalent of the portrait/landscape A4 page(s) of the report, so the users like this window to be quite big, almost filling their screens.

For some time I resisted this request as I did not think this was a good solution. However, my mind was changed when I found out how the users were getting around this 'deficiency' of our system.

They were opening a viewer, using the 'Save As' facility to save the report as a PDF to a specific directory, using Acrobat Reader to open the PDF file, and then they would do the same with the next report. They would have multiple Acrobat Readers running with the various report outputs that they wanted to look at.

So I relented and made the viewer modeless. This means that each viewer has a task-bar icon.

When the latest version was released to them last week, the overwhelming response from them is that they LOVE it. It's been one of our most popular recent enhancements to the system.

So you go ahead and tell your users that what they want is bad, but ultimately it won't do you any favours.

  • Use the constructors that use the new ModalityType rather than the boolean modal argument. This is what gives these dialogs the task-bar icon.
  • For modeless dialogs, pass a null parent to the constructor, but locate them relative to their 'parent' window.
  • Version 6 of Java on Windows has a bug which means that your main window can become 'always on top' without you telling it. Upgrade to version 7 to fix this

This is exactly my experience as well. If there's one thing I'm certain of, it's that you are doing something wrong when people try and circumvent your user-friendlyness to do whatever it is they really want to do. Functionality is king.

One way to get around this, is to allow to have multiple JFrame's opened, all offering the same functionality, but by default everything is done within a single window. This actually allows the user to choose between SDI or MDI.

Sorry? Can you explain your solution a bit better, please? How can it be a single window AND multiple windows? We have one main window where the main application runs, but sometimes we need to open dialogs, and sometimes those dialogs (based on user requirements) need to be modeless. Making rules that the interface should be this way or that is just going to dig a big hole for yourself.

@GuillaumePolet I agree with Duncan, can you explain what you mean a bit more? I share his confusion

I think what he means is that the user could start multiple copies of the application (the 'JFrame') but inside each of those it is SDI. However, our client application is a very thick client, so this would be a resource hungry approach.

java - The Use of Multiple JFrames: Good or Bad Practice? - Stack Over...

java swing user-interface jframe
Rectangle 27 41

I'd like to counter the "not user friendly" argument with an example that I have just been involved with.

In our application we have a main window where the users run various 'programs' as separate tabs. As much as possible we have tried to keep our application to this single window.

One of the 'programs' they run presents a list of reports that have been generated by the system, and the user can click on an icon on each line to pop open a report viewer dialog. This viewer is showing the equivalent of the portrait/landscape A4 page(s) of the report, so the users like this window to be quite big, almost filling their screens.

For some time I resisted this request as I did not think this was a good solution. However, my mind was changed when I found out how the users were getting around this 'deficiency' of our system.

They were opening a viewer, using the 'Save As' facility to save the report as a PDF to a specific directory, using Acrobat Reader to open the PDF file, and then they would do the same with the next report. They would have multiple Acrobat Readers running with the various report outputs that they wanted to look at.

So I relented and made the viewer modeless. This means that each viewer has a task-bar icon.

When the latest version was released to them last week, the overwhelming response from them is that they LOVE it. It's been one of our most popular recent enhancements to the system.

So you go ahead and tell your users that what they want is bad, but ultimately it won't do you any favours.

  • Use the constructors that use the new ModalityType rather than the boolean modal argument. This is what gives these dialogs the task-bar icon.
  • For modeless dialogs, pass a null parent to the constructor, but locate them relative to their 'parent' window.
  • Version 6 of Java on Windows has a bug which means that your main window can become 'always on top' without you telling it. Upgrade to version 7 to fix this

This is exactly my experience as well. If there's one thing I'm certain of, it's that you are doing something wrong when people try and circumvent your user-friendlyness to do whatever it is they really want to do. Functionality is king.

One way to get around this, is to allow to have multiple JFrame's opened, all offering the same functionality, but by default everything is done within a single window. This actually allows the user to choose between SDI or MDI.

Sorry? Can you explain your solution a bit better, please? How can it be a single window AND multiple windows? We have one main window where the main application runs, but sometimes we need to open dialogs, and sometimes those dialogs (based on user requirements) need to be modeless. Making rules that the interface should be this way or that is just going to dig a big hole for yourself.

@GuillaumePolet I agree with Duncan, can you explain what you mean a bit more? I share his confusion

I think what he means is that the user could start multiple copies of the application (the 'JFrame') but inside each of those it is SDI. However, our client application is a very thick client, so this would be a resource hungry approach.

java - The Use of Multiple JFrames: Good or Bad Practice? - Stack Over...

java swing user-interface jframe
Rectangle 27 41

I'd like to counter the "not user friendly" argument with an example that I have just been involved with.

In our application we have a main window where the users run various 'programs' as separate tabs. As much as possible we have tried to keep our application to this single window.

One of the 'programs' they run presents a list of reports that have been generated by the system, and the user can click on an icon on each line to pop open a report viewer dialog. This viewer is showing the equivalent of the portrait/landscape A4 page(s) of the report, so the users like this window to be quite big, almost filling their screens.

For some time I resisted this request as I did not think this was a good solution. However, my mind was changed when I found out how the users were getting around this 'deficiency' of our system.

They were opening a viewer, using the 'Save As' facility to save the report as a PDF to a specific directory, using Acrobat Reader to open the PDF file, and then they would do the same with the next report. They would have multiple Acrobat Readers running with the various report outputs that they wanted to look at.

So I relented and made the viewer modeless. This means that each viewer has a task-bar icon.

When the latest version was released to them last week, the overwhelming response from them is that they LOVE it. It's been one of our most popular recent enhancements to the system.

So you go ahead and tell your users that what they want is bad, but ultimately it won't do you any favours.

  • Use the constructors that use the new ModalityType rather than the boolean modal argument. This is what gives these dialogs the task-bar icon.
  • For modeless dialogs, pass a null parent to the constructor, but locate them relative to their 'parent' window.
  • Version 6 of Java on Windows has a bug which means that your main window can become 'always on top' without you telling it. Upgrade to version 7 to fix this

This is exactly my experience as well. If there's one thing I'm certain of, it's that you are doing something wrong when people try and circumvent your user-friendlyness to do whatever it is they really want to do. Functionality is king.

One way to get around this, is to allow to have multiple JFrame's opened, all offering the same functionality, but by default everything is done within a single window. This actually allows the user to choose between SDI or MDI.

Sorry? Can you explain your solution a bit better, please? How can it be a single window AND multiple windows? We have one main window where the main application runs, but sometimes we need to open dialogs, and sometimes those dialogs (based on user requirements) need to be modeless. Making rules that the interface should be this way or that is just going to dig a big hole for yourself.

@GuillaumePolet I agree with Duncan, can you explain what you mean a bit more? I share his confusion

I think what he means is that the user could start multiple copies of the application (the 'JFrame') but inside each of those it is SDI. However, our client application is a very thick client, so this would be a resource hungry approach.

java - The Use of Multiple JFrames: Good or Bad Practice? - Stack Over...

java swing user-interface jframe
Rectangle 27 41

I'd like to counter the "not user friendly" argument with an example that I have just been involved with.

In our application we have a main window where the users run various 'programs' as separate tabs. As much as possible we have tried to keep our application to this single window.

One of the 'programs' they run presents a list of reports that have been generated by the system, and the user can click on an icon on each line to pop open a report viewer dialog. This viewer is showing the equivalent of the portrait/landscape A4 page(s) of the report, so the users like this window to be quite big, almost filling their screens.

For some time I resisted this request as I did not think this was a good solution. However, my mind was changed when I found out how the users were getting around this 'deficiency' of our system.

They were opening a viewer, using the 'Save As' facility to save the report as a PDF to a specific directory, using Acrobat Reader to open the PDF file, and then they would do the same with the next report. They would have multiple Acrobat Readers running with the various report outputs that they wanted to look at.

So I relented and made the viewer modeless. This means that each viewer has a task-bar icon.

When the latest version was released to them last week, the overwhelming response from them is that they LOVE it. It's been one of our most popular recent enhancements to the system.

So you go ahead and tell your users that what they want is bad, but ultimately it won't do you any favours.

  • Use the constructors that use the new ModalityType rather than the boolean modal argument. This is what gives these dialogs the task-bar icon.
  • For modeless dialogs, pass a null parent to the constructor, but locate them relative to their 'parent' window.
  • Version 6 of Java on Windows has a bug which means that your main window can become 'always on top' without you telling it. Upgrade to version 7 to fix this

This is exactly my experience as well. If there's one thing I'm certain of, it's that you are doing something wrong when people try and circumvent your user-friendlyness to do whatever it is they really want to do. Functionality is king.

One way to get around this, is to allow to have multiple JFrame's opened, all offering the same functionality, but by default everything is done within a single window. This actually allows the user to choose between SDI or MDI.

Sorry? Can you explain your solution a bit better, please? How can it be a single window AND multiple windows? We have one main window where the main application runs, but sometimes we need to open dialogs, and sometimes those dialogs (based on user requirements) need to be modeless. Making rules that the interface should be this way or that is just going to dig a big hole for yourself.

@GuillaumePolet I agree with Duncan, can you explain what you mean a bit more? I share his confusion

I think what he means is that the user could start multiple copies of the application (the 'JFrame') but inside each of those it is SDI. However, our client application is a very thick client, so this would be a resource hungry approach.

java - The Use of Multiple JFrames: Good or Bad Practice? - Stack Over...

java swing user-interface jframe
Rectangle 27 41

I'd like to counter the "not user friendly" argument with an example that I have just been involved with.

In our application we have a main window where the users run various 'programs' as separate tabs. As much as possible we have tried to keep our application to this single window.

One of the 'programs' they run presents a list of reports that have been generated by the system, and the user can click on an icon on each line to pop open a report viewer dialog. This viewer is showing the equivalent of the portrait/landscape A4 page(s) of the report, so the users like this window to be quite big, almost filling their screens.

For some time I resisted this request as I did not think this was a good solution. However, my mind was changed when I found out how the users were getting around this 'deficiency' of our system.

They were opening a viewer, using the 'Save As' facility to save the report as a PDF to a specific directory, using Acrobat Reader to open the PDF file, and then they would do the same with the next report. They would have multiple Acrobat Readers running with the various report outputs that they wanted to look at.

So I relented and made the viewer modeless. This means that each viewer has a task-bar icon.

When the latest version was released to them last week, the overwhelming response from them is that they LOVE it. It's been one of our most popular recent enhancements to the system.

So you go ahead and tell your users that what they want is bad, but ultimately it won't do you any favours.

  • Use the constructors that use the new ModalityType rather than the boolean modal argument. This is what gives these dialogs the task-bar icon.
  • For modeless dialogs, pass a null parent to the constructor, but locate them relative to their 'parent' window.
  • Version 6 of Java on Windows has a bug which means that your main window can become 'always on top' without you telling it. Upgrade to version 7 to fix this

This is exactly my experience as well. If there's one thing I'm certain of, it's that you are doing something wrong when people try and circumvent your user-friendlyness to do whatever it is they really want to do. Functionality is king.

One way to get around this, is to allow to have multiple JFrame's opened, all offering the same functionality, but by default everything is done within a single window. This actually allows the user to choose between SDI or MDI.

Sorry? Can you explain your solution a bit better, please? How can it be a single window AND multiple windows? We have one main window where the main application runs, but sometimes we need to open dialogs, and sometimes those dialogs (based on user requirements) need to be modeless. Making rules that the interface should be this way or that is just going to dig a big hole for yourself.

@GuillaumePolet I agree with Duncan, can you explain what you mean a bit more? I share his confusion

I think what he means is that the user could start multiple copies of the application (the 'JFrame') but inside each of those it is SDI. However, our client application is a very thick client, so this would be a resource hungry approach.

java - The Use of Multiple JFrames: Good or Bad Practice? - Stack Over...

java swing user-interface jframe
Rectangle 27 41

I'd like to counter the "not user friendly" argument with an example that I have just been involved with.

In our application we have a main window where the users run various 'programs' as separate tabs. As much as possible we have tried to keep our application to this single window.

One of the 'programs' they run presents a list of reports that have been generated by the system, and the user can click on an icon on each line to pop open a report viewer dialog. This viewer is showing the equivalent of the portrait/landscape A4 page(s) of the report, so the users like this window to be quite big, almost filling their screens.

For some time I resisted this request as I did not think this was a good solution. However, my mind was changed when I found out how the users were getting around this 'deficiency' of our system.

They were opening a viewer, using the 'Save As' facility to save the report as a PDF to a specific directory, using Acrobat Reader to open the PDF file, and then they would do the same with the next report. They would have multiple Acrobat Readers running with the various report outputs that they wanted to look at.

So I relented and made the viewer modeless. This means that each viewer has a task-bar icon.

When the latest version was released to them last week, the overwhelming response from them is that they LOVE it. It's been one of our most popular recent enhancements to the system.

So you go ahead and tell your users that what they want is bad, but ultimately it won't do you any favours.

  • Use the constructors that use the new ModalityType rather than the boolean modal argument. This is what gives these dialogs the task-bar icon.
  • For modeless dialogs, pass a null parent to the constructor, but locate them relative to their 'parent' window.
  • Version 6 of Java on Windows has a bug which means that your main window can become 'always on top' without you telling it. Upgrade to version 7 to fix this

This is exactly my experience as well. If there's one thing I'm certain of, it's that you are doing something wrong when people try and circumvent your user-friendlyness to do whatever it is they really want to do. Functionality is king.

One way to get around this, is to allow to have multiple JFrame's opened, all offering the same functionality, but by default everything is done within a single window. This actually allows the user to choose between SDI or MDI.

Sorry? Can you explain your solution a bit better, please? How can it be a single window AND multiple windows? We have one main window where the main application runs, but sometimes we need to open dialogs, and sometimes those dialogs (based on user requirements) need to be modeless. Making rules that the interface should be this way or that is just going to dig a big hole for yourself.

@GuillaumePolet I agree with Duncan, can you explain what you mean a bit more? I share his confusion

I think what he means is that the user could start multiple copies of the application (the 'JFrame') but inside each of those it is SDI. However, our client application is a very thick client, so this would be a resource hungry approach.

java - The Use of Multiple JFrames: Good or Bad Practice? - Stack Over...

java swing user-interface jframe
Rectangle 27 42

To get a more precise (and user friendly) information about connection type. You can use this code (derived from a @hide method in TelephonyManager.java).

This method returns a String describing the current connection type. i.e. one of : "WIFI" , "2G" , "3G" , "4G" , "-" (not connected) or "?" (unknown)

Remark: This code requires API 15+, but you can easily support older versions by using int instead of const. (See comments in code).

public static String getNetworkClass(Context context) {
    ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);      
    NetworkInfo info = cm.getActiveNetworkInfo();
    if(info==null || !info.isConnected())
        return "-"; //not connected
    if(info.getType() == ConnectivityManager.TYPE_WIFI)
        return "WIFI";
    if(info.getType() == ConnectivityManager.TYPE_MOBILE){
        int networkType = info.getSubtype();
        switch (networkType) {
            case TelephonyManager.NETWORK_TYPE_GPRS:
            case TelephonyManager.NETWORK_TYPE_EDGE:
            case TelephonyManager.NETWORK_TYPE_CDMA:
            case TelephonyManager.NETWORK_TYPE_1xRTT:
            case TelephonyManager.NETWORK_TYPE_IDEN: //api<8 : replace by 11
                return "2G";
            case TelephonyManager.NETWORK_TYPE_UMTS:
            case TelephonyManager.NETWORK_TYPE_EVDO_0:
            case TelephonyManager.NETWORK_TYPE_EVDO_A:
            case TelephonyManager.NETWORK_TYPE_HSDPA:
            case TelephonyManager.NETWORK_TYPE_HSUPA:
            case TelephonyManager.NETWORK_TYPE_HSPA:
            case TelephonyManager.NETWORK_TYPE_EVDO_B: //api<9 : replace by 14
            case TelephonyManager.NETWORK_TYPE_EHRPD:  //api<11 : replace by 12
            case TelephonyManager.NETWORK_TYPE_HSPAP:  //api<13 : replace by 15
                return "3G";
            case TelephonyManager.NETWORK_TYPE_LTE:    //api<11 : replace by 13
                return "4G";
            default:
                return "?";
         }
    }
    return "?";
}

how to implement this in activity?

networking - Detect network connection type on Android - Stack Overflo...

android networking wifi connectivity
Rectangle 27 7

Gprof if you use gcc. It may not be user friendly but still useful.

windows - C++ Code Profiler - Stack Overflow

c++ windows visual-studio profiler
Rectangle 27 88

Saw this on a twitter post and think it's an awesome function by Dirk! Following on from JD Long's answer, I would do this for user friendly reading:

# improved list of objects
.ls.objects <- function (pos = 1, pattern, order.by,
                        decreasing=FALSE, head=FALSE, n=5) {
    napply <- function(names, fn) sapply(names, function(x)
                                         fn(get(x, pos = pos)))
    names <- ls(pos = pos, pattern = pattern)
    obj.class <- napply(names, function(x) as.character(class(x))[1])
    obj.mode <- napply(names, mode)
    obj.type <- ifelse(is.na(obj.class), obj.mode, obj.class)
    obj.prettysize <- napply(names, function(x) {
                           capture.output(format(utils::object.size(x), units = "auto")) })
    obj.size <- napply(names, object.size)
    obj.dim <- t(napply(names, function(x)
                        as.numeric(dim(x))[1:2]))
    vec <- is.na(obj.dim)[, 1] & (obj.type != "function")
    obj.dim[vec, 1] <- napply(names, length)[vec]
    out <- data.frame(obj.type, obj.size, obj.prettysize, obj.dim)
    names(out) <- c("Type", "Size", "PrettySize", "Rows", "Columns")
    if (!missing(order.by))
        out <- out[order(out[[order.by]], decreasing=decreasing), ]
    if (head)
        out <- head(out, n)
    out
}

# shorthand
lsos <- function(..., n=10) {
    .ls.objects(..., order.by="Size", decreasing=TRUE, head=TRUE, n=n)
}

lsos()

Which results in something like the following:

Type   Size PrettySize Rows Columns
pca.res                 PCA 790128   771.6 Kb    7      NA
DF               data.frame 271040   264.7 Kb  669      50
factor.AgeGender   factanal  12888    12.6 Kb   12      NA
dates            data.frame   9016     8.8 Kb  669       2
sd.                 numeric   3808     3.7 Kb   51      NA
napply             function   2256     2.2 Kb   NA      NA
lsos               function   1944     1.9 Kb   NA      NA
load               loadings   1768     1.7 Kb   12       2
ind.sup             integer    448  448 bytes  102      NA
x                 character     96   96 bytes    1      NA

NOTE: The main part I added was (again, adapted from JD's answer) :

I couldn't think of any other way to get the output from print(...) and so used capture.output(), which I'm sure is very inefficient :)

can this function be added to dplyr or some other key package.

capture.output
obj.prettysize <- napply(names, function(x) {format(utils::object.size(x), units = "auto") })
[1] "792.5 Mb"
792.5 Mb

Tricks to manage the available memory in an R session - Stack Overflow

memory-management r
Rectangle 27 17

You can do Server side validation and send back a JSON object with the validation results for each field, keeping client Javascript to a minimum (just displaying results) and still having a user friendly experience without having to repeat yourself on both client and server.

User friendly? Maybe. Almost instantaneous and buttery smooth? Probably not.

security - JavaScript: client-side vs. server-side validation - Stack ...

javascript security validation