Wednesday, December 28, 2011

Transaction Management with JBoss Seam + JPA (Hibernate) like Spring Framework

I'm a fan of using Spring framework for all my projects, but unfortunately on my current project, I have to add a module to an existing app already developed using JBoss Seam EJB3 and Hibernate, so this is what I did to work with the same model of ServiceImpl that Spring uses

This is the DAO (Existing) - I just added the save method
And this will be My Service (I will not include the Interfaces)

By doing this we have the same model of Tx Management - Just by adding the 1 annotation to the method!!! Cool Isn't it?
Also, in case that you want to make your Tx ReadOnly, just add this annotation to your method (also)
org.jboss.seam.annotations.ReadOnly


Unfortunately the documentation for JBoss Seam is really poor on this aspect, so If anybody finds anything that could be improved, please let me know)

Saturday, December 24, 2011

OneToMany Mapping

I faced this issue on August, let me explain you the situation, I had a Table called PURCHASE, with a 1:N Relationship with PURCHASE_MODULE and TRANSACTION tables
TRANSACTION >-----PURCHASE-----< PURCHASE_MODULE

First thing, How do I represent that using annotations (Hibernate):
Now what I want is each time I populate Purchase and set both List's (transactions and purchaseModules) and Invoke a SAVE for Purchase, the 3 tables will be impacted( there will be at least 3 INSERTs): purchaseDAO.save(purchase)
But this wasn't working as I expected, because no matter if I populated both ArrayList's (List) I never saw more than 1 Insert on my console.

Then the spark I was looking for! Inspiration came to me :P
On the Annotation @OneToMany there is an additional attribute I didn't include: cascade (The operations that must be cascaded to the target of the association)

On my case I don't care, so I just include ALL operations :P

Saturday, December 3, 2011

ClassCastException with Hibernate: org.hibernate.type.DateType cannot be cast to org.hibernate.type.VersionType

I ran into a weird error when starting a Seam App with JPA (Hibernate) on JBoss

2011-08-03 14:30:17,938 [main] ERROR [org.jboss.deployment.scanner.URLDeploymentScanner] Incomplete Deployment listing:

--- MBeans waiting for other MBeans ---
ObjectName: persistence.units:ear=mainsite.ear,jar=kaptest_domain.jar,unitName=commonDatabase
  State: FAILED
  Reason: java.lang.ClassCastException: org.hibernate.type.DateType cannot be cast to org.hibernate.type.VersionType
  I Depend On:
    jboss.jca:service=DataSourceBinding,name=jdbc.CommonTransactionDS
  Depends On Me:
    jboss.j2ee:ear=mainsite.ear,jar=kaptest_domain.jar,name=AdobeMeetingDAO_Seam_Impl,service=EJB3
    jboss.j2ee:ear=mainsite.ear,jar=kaptest_domain.jar,name=AdobeProductDAO_Seam_Impl,service=EJB3
    jboss.j2ee:ear=mainsite.ear,jar=kaptest_domain.jar,name=AdobeUserDAO_Seam_Impl,service=EJB3
    jboss.j2ee:ear=mainsite.ear,jar=kaptest_domain.jar,name=AverageRatingServiceImpl,service=EJB3
    jboss.j2ee:ear=mainsite.ear,jar=kaptest_domain.jar,name=BookstoreProductServiceImpl,service=EJB3
    jboss.j2ee:ear=mainsite.ear,jar=kaptest_domain.jar,name=BookstoreSearchServiceImpl,service=EJB3
...
...
WHAT??? java.lang.ClassCastException: org.hibernate.type.DateType cannot be cast to org.hibernate.type.VersionType

Anyway, for some reason, hibernate reverse engineer puts the @Version annotation to fields called timestamp as it expects it to be of type java.sql.Timestamp
Unfortunatly, my property was of type java.util.Date which is incomaptible with the @Version annotation.
I removed the @Version and it worked!

Sunday, November 20, 2011

Primary key @OneToOne mapping in Hibernate (JPA)

My main objective is to save/insert as many POJO's as possible with the minimum # of calls to save method. That's why I'm relate them.

But there is a special relationship which it's not clearly documented on the official documentation, and that's why you'll see this entry here :)

.The problem is that I have 2 tables COURSE_ACCESS and COURSE_ACCESS_STATUS:
---------------
COURSE_ACCESS
---------------
*id
...
---------------

---------------------
COURSE_ACCESS_STATUS
---------------------
*course_access_id
...
---------------------

The relationship is 1:1. COURSE_ACCESS is the "parent" table, because that one has the SEQUENCE which generates the PK on "id" column.

Now what I want is when I save COURSE_ACCESS, COURSE_ACCESS_DATA should be saved too. Just like this
How I did it?



And that's it!!! Easy isn't it?

Wednesday, November 9, 2011

Building from source BPM Console (for JBPM4)

For some personal reasons I wanted to customize the JBPM Console, so the only way to do it is by building from source code.
The first thing I had to do is get the sources and compile them using Maven :)

If by any chance you're having a hard time with this error (like me)
[ERROR] Failed to execute goal on project gwt-console: Could not resolve dependencies for project org.jboss.bpm:gwt-console:war:2.2.3-Final: The following artifacts could not be resolved: org.timepedia.chronoscope:chronoscope:jar:2.0_jboss-SNAPSHOT, org.timepedia.chronoscope:chronoscope-api:jar:2.0_jboss-SNAPSHOT: Failure to find org.timepedia.chronoscope:chronoscope:jar:2.0_jboss-SNAPSHOT in https://repository.jboss.org/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of jboss-public-repository-group has elapsed or updates are forced -> [Help 1]

Just do as I did. Go to Maven Hub and search for your missing jar, on my case I found it on Thirdparty-uploads repository (from JBoss);

Unfortunately, the version I was looking for (according to the previous error) was chronoscope:jar:2.0_jboss-SNAPSHOT and I found 2.0_jboss, I guess you know what to do now, don't you?

Just cheat Maven by installing on your local repository version "2.0_jboss" as "2.0_jboss-SNAPSHOT"

Voila!!!

As result you should get these 4 artifacts:
  • Console UI: gwt-console.war
  • Console Server: gwt-console-server.war
  • Domain model: gwt-console-rpc.jar
  • Integration Layer: gwt-console-server-integration.jar

Also, don't forget to include the bpaf-explorer jars. To avoid this:
14:52:32,728 [main] ERROR [ContainerBase] StandardWrapper.Throwable
com.google.inject.ProvisionException: Guice provision errors:

1) Error injecting constructor, java.lang.NoClassDefFoundError: org/jboss/bpm/monitor/model/metric/Timespan
  at org.jboss.errai.bus.server.service.ErraiServiceImpl.(ErraiServiceImpl.java:50)
  while locating org.jboss.errai.bus.server.service.ErraiServiceImpl
  while locating org.jboss.errai.bus.server.service.ErraiService

1 error
 at com.google.inject.InjectorImpl$4.get(InjectorImpl.java:767)
 at com.google.inject.InjectorImpl.getInstance(InjectorImpl.java:793)
 at org.jboss.errai.bus.server.servlet.AbstractErraiServlet.buildService(AbstractErraiServlet.java:117)
 at org.jboss.errai.bus.server.servlet.AbstractErraiServlet.init(AbstractErraiServlet.java:88)
 at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)


Monday, October 24, 2011

Avoiding “Could not enlist in transaction” Errors in JBoss

Problem
Process stalls and throws the following error (LiveCycle hosted on JBoss):
Explanation
Within the same process, 2 calls were being made to different non-XA data sources. This is not supported by default on JBoss. Hence the error is thrown.

Solution
To enable calling more than 1 non-XA data source within the same transaction (process), additional configuration is required
  1. Locate the jbossjta-properties.xml file in the [appserver root]/server/all/conf/ directory and open the file in an editor.
  2. Locate and modify the ‘properties’ element as follows. Add the property (shown in bold) if it doesn’t already exist in the jbossjta-properties.xml file.
  3. Save and close the file.

Wednesday, October 19, 2011

Tracking URLs: DHL, USPS, FEDEX and UPS

These are the URL's for direct shipment tracking:

DHL
http://www.dhl.com/content/g0/en/express/tracking.shtml?brand=DHL&AWB={tracking_number}


Fedex
http://www.fedex.com/Tracking?action=track&tracknumbers={tracking_number}


UPS
http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums={tracking_number}

If any value is provided for the “track” parameter then the confirmation page is skipped and the user goes directly to the tracking page. If you’d rather send the user to the confirmation page then just omit that parameter.


USPS
http://trkcnfrm1.smi.usps.com/PTSInternetWeb/InterLabelInquiry.do?origTrackNum={tracking_number}

Saturday, October 15, 2011

My first encounter with jBPM


Long story, short story. When I was working in one of my projects in Mexico, somebody mentioned something about BPM or BPEL and how practical de idea/concept was, because now we can mix the knowledge of the Business People with the Developers, by using some kind of cool diagrams to do Process Modeling.

And now I had to create a project which essentially it's a WorkFlow but we need some features like keeping the state of each execution (so we can trace it easily and resume the process if by any chance is stopped) "et all" and then, when I saw that One of the requirements was to integrate this miniworkflow with an existing App deployed on jBoss 4 with Seam 2.1 (I'd talk later about this framework, for all those like me who love Spring Framework), then I have to use jBPM 3 instead of 4 or 5 OUCH :'(
"But then, I realize that JBPM4 can work flawlessly on JBoss 4"
What do we need???
No much, Eclipse Helios (3.6)
Install these features:

  • JBoss Tools - http://download.jboss.org/jbosstools/updates/development/helios (don't forget to install jBPM support!)
  • Graphiti - http://download.eclipse.org/graphiti/updates/0.7.1
  • BPMN2 - http://codehoop.com/bpmn2


The concept is really simple, we just need to model the flow (I'll use the Designer to do this)


But it needs some logic inside its guts, so I'll add something called Handlers and some personalized tags (which is a really cool feture)
This is our model translated into XML
On my implementation, the process will run by itself, it's going to be a "FIRE AND FORGET";

On my case the process will wait for a certain amount of time and the it will start, it'll make one decision and it will execute something and then the End :)

The logic will be implemented by Implementing some Interfaces:



And Voila!!!

Soon I'll talk a little bit about jBoss SEAM! (How I implemented a REST Service FACILITO!)

Thursday, October 6, 2011

Debugging App Server Remotely

When I was working with an external/existing jBoss App Server Instance, I had an issue and I needed to debug something, so I had 2 options in my head:

  1. Create an internal instance (managed by my IDE: Eclipse) and do all the work there, for example like in Spring Source Tool Suite aka STS (which has its own App Server Integrated) or IBM RAD (which has its own version embedded of WebSphere)
  2. Put a bunch of DEBUG's on my Log4'j config and trace them through my Console

And then playing around with my IDE, I found something really cool on the Debugging perspective of my Eclipse:

Click on Debug Configurations and you'll see a window like this one (Bind this configuration to your project)




Then, go to Remote Java Application, create a new Configuration
On the Connect tab, give a name select the Standard Connction type and in the Connection Properties give the location of your server and the "debugging" port (on my case is 5005)

Why port 5005? Well, on my jBoss setup I found this option on its configuration:
JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"
By doing this, you'll enable debugging port on your JVM :D (Cool isn't it?)


On "source tab", select Add your project (the one which is running on your App Server)
And in "common tab" check the Debug option, finally, Apply and you're ready to rock!


Now, after you'd started your App Server you can debug your current (running) App in your Eclipse by clicking on Debug Icon and selecting the configuration we just created!

Good luck and have fun!

Thursday, September 29, 2011

Tip: How to type Ʊ in a Mac

If you’re composing an invitation to a piƱata party and you’re wondering how to type that Ʊ, here’s how:


Press and hold Option
option.png
…while pressing n
n.png
…then release and press n again, alone…
n-alone.png
…to type this:
tilde.png
Also:
Option + E, then E again → Ć©
Option + U, then E → Ć«
Option + C → Ć§

Thursday, September 15, 2011

No application context active with JBoss Seam

When I was implementing an ASYNC call to a JBPM process using my RESTEasy (seam) component, I was having a really hard time, because each time I made a SYNC request, I got a successful response from my JBPM process (where I use some Seam Components) but when I switched to an ASYNC call by using Threads

I always got

Then I found a really dirty workaround, before making any call like this one
Make sure that the Context is Active (On my case I did it on a method that I wrote to retrieve Seam Components on an abstract parent class for all my Handlers: ActivityBehaviour or DecisionHandler)
By doing this you'll bypass that issue, I still need to verify if it doesn't impact the performance of my process or if there is any other way.


FYI: This is my RESTEasy Component :)

Tuesday, September 13, 2011

Show non-printable characters in VI

You just KNOW there's a stray tab or other character in this file, right? So how can you display these characters in vi?

[ESC] to get into command mode
:set list

Look through the file. Tabs will be ^I, DOS-style end-of-lines will be ^M, etc.

To go back:
[ESC] to get into command mode
:set nolist

Sunday, September 4, 2011

How to do print screen in Mac OS X

Yesterday, I wanted to do a print screen in Mac OS X but there is not print screen button in Mac keyboard o_O
There are few ways to do screen capture in Mac OS X.
Follow the steps below and you will be able to do a screen capture in Mac OS X.
  • Hold down Apple key ⌘ + Shift + 3 and release all keys
  • Hold down Apple key ⌘ + Shift + 4 and release all keys

My favorite is the second option, the result will be on your desktop a new Image File :D

Wednesday, August 24, 2011

How to reset your Mac OS X password without an installer disc


Let’s say you totally forgot the password to log on to your Mac. Or maybe you purchased a used Mac from someone else and they’ve got it locked down. There are numerous ways to reset a password with no OS X discs.

This tutorial may ruffle some feathers, but it addresses a topic that a ton of people ask about all the time. Yes, it’s startling to think that anyone could theoretically walk up to your computer and gain access within minutes. Before you go thinking that Mac OS X has a severe vulnerability that makes it less secure than other operating systems, think again. Anyone with physical access to your machine (whether it is Windows, Linux, or Mac) can eventually find a way in if they know what they’re doing. There are ways of bypassing nearly any security measure when a hacker is literally sitting right in front of your system.

The information here has previously been made available from many different sources online and is presented with the intention of helping people with legitimate reasons for resetting their Mac OS X password. A few of the methods floating around the Mac community have been compiled here in one easy-to-reference place. System admins responsible for supporting entire organizations and users who bought used Macs are the folks most likely to benefit from this.


Reset 10.5 Leopard & 10.6 Snow Leopard password

  1. Power on or restart your Mac.
  2. At the chime (or grey screen if your chime is turned off), hold down Command+S on your keyboard to enter single-user mode.
  3. This step is optional, but it’s a good idea because it checks the consistency of the hard disk before moving on. At the prompt, type fsck -fy and press Enter/Return. Wait for the checks to complete before going to the next step.
  4. Type mount -uw / and press Enter.
  5. Type launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist and press Enter.
  6. Type ls /Users and press Enter. This lists all of the usernames on the computer – helpful if you don’t know or remember what these are.
  7. Type dscl . -passwd /Users/username password and replace “username” with one of the users displayed in the previous step. Replace “password” with a new password of your choice. Press Enter.
  8. Type reboot and press Enter.



Reset 10.5 Leopard & 10.6 Snow Leopard password

  1. Power on or restart your Mac.
  2. At the chime (or grey screen if your chime is turned off), hold down Command+S on your keyboard to enter single-user mode.
  3. This step is optional, but it’s a good idea because it checks the consistency of the hard disk before moving on. At the prompt, type fsck -fy and press Enter/Return. Wait for the checks to complete before going to the next step.
  4. Type mount -uw / and press Enter.
  5. Type launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist and press Enter.
  6. Type ls /Users and press Enter. This lists all of the usernames on the computer – helpful if you don’t know or remember what these are.
  7. Type dscl . -passwd /Users/username password and replace “username” with one of the users displayed in the previous step. Replace “password” with a new password of your choice. Press Enter.
  8. Type reboot and press Enter.

Reset 10.4 Tiger password

  1. Power on or restart your Mac.
  2. At the chime (or grey screen if your chime is turned off), hold down Command+S on your keyboard to enter single-user mode.
  3. Type sh /etc/rc and press Enter/Return.
  4. Type passwd username and replace “username” with the short name of the user account for which you’d like to reset the password.
  5. Type your desired password and press Enter. It won’t show itself on the screen, so be careful what you type. You will most likely have to enter it again to confirm.
  6. Type reboot and press Enter.

This is my favorite :D

Tricking your Mac into creating a new user account

  1. Power on or restart your Mac (should work for any Mac OS X system).
  2. At the chime (or grey screen if your chime is turned off), hold down Command+S on your keyboard to enter single-user mode.
  3. This step is optional, but it’s a good idea because it checks the consistency of the hard disk before moving on. At the prompt, type fsck -fy and press Enter/Return. Wait for the checks to complete before going to the next step.
  4. Type mount -uw / and press Enter.
  5. Type rm /var/db/.AppleSetupDone and press Enter.
  6. Type shutdown -h now and press Enter.

The third method of resetting your Mac’s password requires some additional explanation. Rather than simply changing the password like the previous two methods do, this one fools the operating system into believing it has never been started before. This means when you restart the machine, it will take you through the entire setup & registration process all over again. Do not worry, all of your pre-existing data is still available. Just continue with this process and do not choose the option to transfer or migrate information to the Mac.

Once you’re done, log in with your new admin account and go to System Preferences > Accounts. You may have to click on the lock icon in the lower-left corner before making changes here. You should see your original user account(s) in the left column. Try clicking on one of them to convert it to a standard user account (uncheck “Allow user to administer this computer”) and change the password. You should be able to successfully log in to that account now and access all of your files and programs. If you want, you can log back in with your new admin account and re-check the “Allow user to administer this computer” option in System Preferences to grant admin privileges to the original user again.
That should cover it! As always, remember messing with single-user mode and Terminal is risky and may lead to trouble if you make mistakes. Considering you’re already locked out of the computer, though, you’ll probably be willing to take your chances at this point.

One last thing… if you have a Keychain Access password, you will probably need to reset that as well. You can do this by selecting “login” under Keychains on the left and choosing Delete from the Edit menu. You’ll lose everything in the Keychain, but you’ll now be able to start fresh and add new ones.



Source: http://www.macyourself.com/2009/08/03/how-to-reset-your-mac-os-x-password-without-an-installer-disc/

Monday, August 22, 2011

jboss.bind.address and JBoss no accepting connections

When I was trying to do some connectivity testing with one of my colleagues I faced this issue.
What I was trying to do was really simple, on my local Server I have deployed a Web Service and my colleague has the client, the happy path is just share my IP, port and URI, right?

But there is 1 little difference compared with my previous projects: I'm using Mac OS X and my colleague Windows XP. Not a big deal, actually, this is an advantage, because I have a faster machine :P

What's the problem? I think None, BUT...

How can I get my IP address on Mac?
jcruz@Quetzalcoatl[~]$ ifconfig

That was easy!

What about JBoss? Because when I start my server, I can't access it through the IP listed on the previous command!

The solution is really simple:
jboss.bind.address is configured using the "-b" option to the JBoss startup script (run.sh or run.bat in the bin directory).
For example, (on my case sh ./run/bin/run.sh -c myServer -b 0.0.0.0) run -b 0.0.0.0 enables jboss to listen for connections on all IP addresses of the machine (if multi-homed).

Thursday, August 18, 2011

Switch from PC to Mac


I found this great article about someone like me who just switched from PC (Windows) to Mac, I hope you enjoy it as much as I did

The Story

Have you ever tried to resist brainwashing?
Before I get into why I switched, there’s some background you need to know. A year or three ago, you’d be hard pressed to find a more dedicated self-ordained Windows evangelist. I even wrote a lengthly piece about Mac vs. Windows and how I thought Windows had a stronger position (thankfully, that was only published on Google Docs, so no one can ever find it, as it was obviously biased). Over time, a few things happened. First, a couple of my cousins—shoutout to Britt and Matt—came in possession of a couple of MacBooks. Since I see them rather regularly, there was no shortage of opportunities for them to tout their new tools.
Have you ever tried to resist brainwashing?
The next big shift was dabbling in several dynamic programming languages, like Python and Ruby. It seems that it’s always easier to start up with these languages if you’re using a Unix-based OS. While it’s definitely not impossible on Windows, they don’t seem to integrate with the OS in the same way they do with Unix flavours.
Of course, there were better reasons than peer pressure (more on that in a minute). However, when my Windows 7 Release Candidate ran out, I gave myself an ultimatum: either buy Window 7 and secondary monitor, or get a used Mac. After a week or so of deliberation, I found myself in a miniature Starbucks in downtown Toronto, buying a 20-inch iMac off a third-year psychology student.

The Reasons Why I Switched

So what came out of those few weeks of deliberation? Here’s why I switched:

Unix

Probably the biggest motivation to switch was the fact that Mac OS X is built on Unix. Being a real geek, I’m reasonably comfortable with the terminal; if you’re the same, you probably know that a Unix shell offers a lot more power than the Windows command line. Yes, I’ve tried Cygwin, but it’s not quite the same (and I never actually got it to work on Window 7 RC). Then there are Ruby and Python, so much more at home on Unix. And of course, there are so many other low-level benefits to running Unix.
So why didn’t I just switch to Ubuntu? Well, Ubuntu is really nice, especially the latest release, but it really just didn’t work for me, not for a full time gig.

Hardware

Hardware
This one’s a no-brainer: Apple just makes their hardware better than most of the competition. I know that beauty is in the eye of the beholder, and that all that’s beautiful is not aluminium. However, I like Apple’s minimalistic stance. And of course, it’s what insides that matters most, and Apple does an excellent job there, too. There’s a catch to Apple hardware, though, and we’ll talk about that later.

Software

Software
The final reason was simply this: there’s a lot of great software for Macs that doesn’t have a good Windows counterpart. There are two cases I ran into. First, there’s nothing on Windows that does as well, or at all, what I’ve found in a Mac app. Example: I use Simplenote a lot on my iPod Touch; there are four or five Mac apps that sync with Simplenote; before I switched, I had to use a perl script to do this on Windows. (Now,Uri Fridman has made Notes, which is based on Notational Velocity, and will soon support Simplenote sycing! Check out his site for other great nuggets; Codex is another of my favourites). Then, there are programs that do the right things, but aren’t as aesthetically pleasing and user-friendly as the Mac apps. For example, I use Evernote a lot; their Windows client does as much (and a bit more, I think) as their Mac client, but it’s just not as pretty.
However, there’s a catch on the software, too.

The Good What I’m Liking

So now that I’ve switched, here are my favourite things about the Mac; some may seem rather insignificant, but when your working full-speed and don’t want to break that flow, little things matter a lot.

The Terminal

The Terminal
I’ve already pointed out that the Terminal was part of my first reason for switching; it’s every bit as glorious as I expected it to be, and has motivated me to use it more that I have on Windows. Anyone who has used the Command Line on Windows and Terminal on Mac will know exactly how much better a Unix shell is.

Languages Preinstalled

I was surprised and delighted to find that my Mac came with Ruby, Python, Perl, and even Java (which I need for university) already installed.

Mounted Drives on the Desktop

Drives
This is a feature of Unix that I’ve always loved and could never find a way to duplicate on Windows. Not huge, I know; but, huge.

Quicklook

Quicklook
Another tiny feature that saves me a second-and-a-half, dozens and dozens of times a day. I’m working mainly with text files, but for everything from code to Word docs, I’m just a tap on the spacebar away from inspecting the contents of that file. Only gripe: I can’t copy from the quicklook panel.

Time Machine

Time Machine
It’s kind of a hassle to do backup and restore on Windows. With Time Machine, it’s easy and fun. I do wish I had a bit more control over what it backs up and how often (without the numerous hacks), but for daily backup and revisions, it works flawlessly and easily.

Installing Apps

Installing Apps
Installing apps on Mac is much different from installing them on Windows. They both use extremely different methods; and overall, I think the Mac does it much more smoothly.

The Bad What I’m not Liking

But all’s not perfect in any OS; here’s what’s bothering me about the Mac:

The Trash

The Trash
I really don’t get the philosophy of the trash on the Mac; I know you’re not supposed to use the Trash as a holding place for the files you’re not sure about, but why can’t I delete individual files? Why? Here’s a scenario I’ve had: I wanted to get rid of several gigabytes of files, in multiple folders that I’d just zipped into an archive; so, I moved them all to the trash, and then opened the trash to get rid of them permanently. First, I wanted to sort the files by the date/time they were moved to the trash, but that’s not a feature Jobs would ever need, and so I can’t do it. That’s when I found I couldn’t delete individual items; just all or nothing. Mighty inconvenient, if you ask me. I should have used the Terminal to terminate them.

Too Few USB ports

My 20-inch iMac has fewer USB ports than my Dell Laptop did; it only has 3; my Inspiron 1520 had 4; how do you explain that? Then, the old USB extender I was using on Windows doesn’t appear to work on the Mac; not Mac’s fault necessarily, but certainly less than ideal.

“Enter” doesn’t open the file/folder

This one is just a matter of muscle memory, but it’s rather annoying. On Windows, hitting enter opens a file or folder; on Mac, the enter key renames the item in question. To open it, I’ve got to use two keys: cmd + o. On the same note, it now takes two keystokes to send files to that crooked Trash: cmd + delete instead of just delete.

Home and End Keys

This has to be the most frustrating part about the Mac. On Windows, the home key places your cursor at the front of the current line; the end key places it at the end. However, on a Mac the respective commands are cmd + left-arrow and cmd + right-arrow. This has been pretty hard to get used to; and, since I’m in text editors a lot of the time, hitting home and end (which, by the way, bring you to the top or bottom of the linebut does not move your cursor) has been a dizzying experience.

Keyboard shortcuts

Keyboard
I know I’ve already talked about two specific keyboard shortcuts that bother me, but keyboard shortcuts in general have been hard. It’s mainly because the cmd key takes the place of the ctrl key in the shortcuts, but it takes the place of the alt key on the keyboard. So if you’ve used Windows for a long time, caveat emptor.

The Other What I’d also like to mention

I’ve shown you what’s good and what’s bad, but there are a few things I have to mention that don’t really fit into either of those categories. Welcome to miscellaneous.

Closing Windows / Programs

One of the biggest differences between Windows is Mac what happens when you close a window; on Windows (and with a name like that, they should know how to deal with it) the program closes; on Mac, the window closes but the program continues to run. I think the idea here is that it will be quicker to open just a window instead of the whole app next time you need to open it. This is nice for the most part, but I think some apps of a certain nature should really and truly exit when you close their windows. And some do, like System Preferences. I really wish Preview did this. This is one of those fundamental feature of Mac OS X that really takes a paradigm shift to properly grok.

Knowing what’s going on

I’m familiar with Windows, to say the least. I had my A+ certification, which deals mainly with Windows, so I have a pretty good idea of what’s going on under the covers when working on Windows PC. I really miss this intimate knowledge of the system when working with a Mac. I know it’s not an unsolvable problem, but it’s been pretty different to not have that background knowledge. For example, I was recently surprised to find that Time Machine has maxed out my external hard drive; it turned out that iTunes copies all the imported media into the iTunes folder, so I had a two copies of the entire library being backed up. Like Sir Francis Bacon said, “Knowledge [about how the system works] is power.”

The software catch

There’s a ton of great software for Mac; however, it seems that the moving from Windows to Mac also requires a move from free software to quality software. Now, I know there’s quality, paid-for software for Windows, and free software for Macs. However, for every quality, paid-for app on Windows, there are five or six free ones that will do the same job decently. On Mac, the same isn’t quite so true. It seems that Mac developers just put a lot of thought and sweat into their products.

The hardware catch

Like I’ve said, Apple makes great hardware. However, one thing I know I’m going to miss is the ability to upgrade it. Apple does make it easy enough to add RAM. But when I’m ready to upgrade my hard drive, well, it will be scary at best. But I’d gladly sacrifice the single-piece back-side of my iMac for an easy-to-access hard drive slot.

Switching?

Throughout this article, I’ve talked about switching to a Mac. And yes, I’ve switched to a Mac as my main workhorse. But my trusty old Dell hasn’t gone anywhere. It’s still in good use, and syncing services likeEvenote and Dropbox (referral link) more than ever.

The Resources What I’ve found Helpful

Switching operating systems is a pretty big change; here are the resources that have been the biggest help to me while doing so; don’t forget to let me know about other great sources in the comments!

A Very Important Conclusion

Switching to Mac has in no way made me an Apple fanboy or a Microsoft hater. I couldn’t say it better than this:
“Mac vs PC debates make me want to throw up. Does your OS of choice work for you? Great, problem solved!”
Drew Douglass


Source: http://net.tutsplus.com/