AngularJS orderBy for multi-column sorting in different sort directions…

This is a fun issue to approach. I had a table of items which needed specific sorting on two fields (both descending) but the main sort needed to be dynamic based on one of five other fields with order (asc vs desc) toggling.

I’m using angularjs in this project. I had no trouble sorting by a single field and toggling the order understanding paystubs. I could also use orderBy to sort by multiple fields, but they all require the same ordering, learn about Lake Zurich Web Designers. There may be a trick to this that I couldn’t figure out, but the problem I was seeing is this:

I was using a $scope variable to designate the order direction called “reverse”. The column headings in my table had an ng-click event added to change another $scope variable called “orderByField” and would reverse the boolean of “reverse”.

 

This made the sorting dynamic for the column clicked, and if the column was clicked again, the order direction would switch as well. I’m not including the controller code because it’s just setting default values for the $scope.reverse and $scope.orderByField values.

This was fine until a change request was made to add additional sorting rules which aren’t easily accomplished with angular’s orderBy filter. The stipulation is that one field should always be ordered a certain way inside each set of orderByField groups.

Let me explain it with an example to better illustrate the issue. This is a simplified version of what I was dealing with:

items = [
  { start_time: '10', guaranteed: 1, name: 'test 1' },
  { start_time: '10', guaranteed: 0, name: 'test 2' },
  { start_time: '11', guaranteed: 1, name: 'test 3' },
  { start_time: '11', guaranteed: 0, name: 'test 4' }
];

The idea was if the column heading representing the start_time field is clicked that the items in the array would be sorted by start_time (either desc or asc). So start_time = 10 would be grouped together and start_time = 11 would be grouped together. Then within each of those groups, the ‘guaranteed’ field always needs to be sorted descending. So all guaranteed = 1 should be at the top of the start_time groups. There was actually a third field ordering stipulation within those groups but for simplification we’ll leave that one out.

My first thought was to use something like this:

 

It’s not recommended to use orderBy this way for good reason. It doesn’t work correctly. It worked fine in Firefox actually, but failed miserably in Chrome. The recommend method of sorting by multiple columns is to use something like the following:

 

The reason this wouldn’t work for me is because the “reverse” order direction switches not just the order direction of orderByField but also ‘guaranteed’. This wasn’t the desired result.

My next step was to create a custom orderBy filter which would do what I wanted. This example is more verbose in the if statements than it needs to be, but it’s easy to read this way:

app.filter("myOrderBy", function() {
    return function(items, field, reverse) {
        // sort by selected field first
        if(!reverse) {
            items.sort(function(a, b) {
                if(a[field]  >  b[field]) { return  1; }
                if(a[field] == b[field]) {
                    if(a['guaranteed']  <  b['guaranteed']) { return 1;  }
                    if(a['guaranteed'] == b['guaranteed']) { return 0;  }
                    if(a['guaranteed']  >  b['guaranteed']) { return -1; }
                }
                if(a[field]  <  b[field]) { return -1; }
            });
        } else {
            items.sort(function(a, b) {
                if(a[field]  <  b[field]) { return  1; }
                if(a[field] == b[field]) {
                    if(a['guaranteed']  <  b['guaranteed']) { return 1;  }
                    if(a['guaranteed'] == b['guaranteed']) { return 0;  }
                    if(a['guaranteed']  >  b['guaranteed']) { return -1; }
                }
                if(a[field]  >  b[field]) { return -1; }
            });
        }
        return items;
    }
});

No Comments

Intermittent Fasting – My 8 Month Update

Last year, after a couple of bad years in my life, I started focusing more on my health. It actually started in August 2018 when I quit smoking. Quitting smoking caused me to gain about twenty pounds. I was already overweight. The extra weight was a necessary evil to quit smoking and improve my health.

I went from 224 pounds to 256 pounds within about 6 months. I would probably be over 270 right now if I hadn’t taken steps to curve this and correct it. I was walking daily to try to curve it, but that wasn’t doing the trick. I continued to gain weight because I couldn’t control my eating. I made a huge change to my diet in May of 2019.

Leading up to that time, I had developed many problems with my hemorrhoids treatment that I attributed to getting older and being a smoker. My body had food intolerances. I had dark spots on my skin around my neck, shoulders, chest, and underarms. My joints hurt. I just didn’t feel mobile.

All of these things made it difficult to be active. I walked to try to curve some of this, but it didn’t help much. I was still achy. My body just felt bad. I would get headaches if I had sugar before going to bed. I got hangry, and I mean HANGRY. My hunger affected my mood in extreme ways. I couldn’t eat bananas, avocados, or mushrooms without severe stomach pains for hours afterward.

So in May of 2019, I cut my carbs completely out. I did this for three weeks. I may have had 10 grams of carbs during that entire 21 days. The first three days were rough. I felt terrible. My body was going through sugar withdrawals. Suddenly after three days, I got a burst of energy and it stayed level. It wasn’t up and down. I just had a sustained boost to my energy level. There were supplements that I was taking at the time that could have had an effect on me, but for the most part, I feel like it was the change in my diet that was the biggest factor.

Keto vs Low-carb

It’s important at this point to understand the difference in “Keto” and “Low-carb”. Sometimes people claim they are on a Keto diet when they are actually just reducing their carbs. The distinction must be made because reducing your carbs does not guarantee that you are going to be in ketosis. For the first three weeks of my diet change, I was low-carb. I wasn’t concentrating on what I was eating. I was concentrating on what I wasn’t eating.

When most people do “low-carb” they replace their carb intake with protein. They eliminate sugar because it’s a carb, but by replacing their carbs with protein, they are only forcing their body to produce glucose in a different way, by converting the protein. So glucose levels can still be high with a high protein diet. If your glucose levels are high, your body won’t create ketones. Thus, you won’t go into ketosis.

I wasn’t on a “keto” diet. Keto involves a huge increase in fat intake. Your primary source of calories becomes fat. When I went low-carb, I simply removed carbs from my diet. Most of my calories came from meat and fats during that time. There were probably times that I went into ketosis, but the high protein diet I was doing probably prevented me from hitting a good level of ketosis. Looking back, I should have concentrated on consuming more fat.

During that first three weeks, I lost around 16 pounds. I went from 256 down to 240. I felt like I could do anything at that point. I celebrated by having bread for the first time in three weeks. Let me say, Sister Shuberts yeast rolls with butter after three weeks of nearly 0 carbs is about as close to heaven as I’ve been in a long time.

Low Carb Side-effects

After reading through everything I did on NatuRoids – I’ve been watching my carbs pretty closely for the last 8 months, and I’ve learned that there are a few side effects, at least for me. The only important one I’ll mention is digestion. I had to supplement my diet with laxatives quite a bit. There are gentle all-natural laxatives that worked well.

The best alternative is to choose your carbs more wisely. I tend to shoot for carbs which come along with a lot of fiber. Pinto beans, for instance, are loaded with carbs, but are also high in protein and fiber. Brown whole grain rice has a lot of carbs, but it is also high in fiber. Vegetables in general are good choices when sacrificing some carbs, because they tend to also help digestion quite a bit. Kale is especially good for my digestion and since it has quite a bit of potassium, it is something I try to get a lot of these days.

The Start of IF

Intermittent fasting was my go to lifestyle change strategy after the three weeks of low-carb. Based on all the propaganda I was reading at the time, I decided that IF was the right way to go. I’m still convinced that it’s the best way to maintain my weight, but I’ve found that some of the promises of IF are misleading or wrong when it comes to my body.

Fasting Increases Metabolism

This is something you’ll hear a lot from many experts. Dr. Jason Fung, who is famous for writing books about obesity and fasting, has stated that fasting increases metabolism. I’ve also seen other doctors and nutrionists report this. However, I am 95% sure that since I started IF, my metabolism has slowed way down. I have numbers and pseudo-science to back it up. Primarily my Fitbit gives me an estimate of my daily calorie burn, and that number decreased significantly when I started fasting daily.

I think that extended fasting probably increases one’s metabolism, if it’s done on rare occasions. However, I think that daily IF has been a significant factor in my metabolism slowing.

Perhaps a Slow Metabolism Isn’t Bad

I’m on the fence about whether a slow metabolism is a completely negative thing. Sure it’s much harder to lose weight when your metabolic rate is slower, but perhaps there’s other benefits that we are overlooking. Specifically, I wonder if a slower metabolism may be better for longevity.

I’ve tried to normalize/equalize my metabolism by increasing my activity level. I think the increase in activity/exercise is a positive change. My metabolism was actually extremely high last year. I could eat a lot of food in a given day, and my body was burning most of the calories during the day with no problems. It was doing it all at rest, sitting in my chair. My heart rate was around 93 bpm at rest.

Improvements Since Low-carb/Keto/IF

So I’ve been mixing it up for the last eight months, but I’ve pretty much consistently done low-carb and IF. I’ve also attempted pure Keto during that time, but I find Keto to be much harder to keep up, especially while increasing my daily activity level. I find straight IF to be the easiest to do along with lots of exercise.

I’ve seen some major changes in my body since I started all of this nearly a year ago.

Firstly, exercise is much easier. I can get around much better. I have way less joint pain and I feel way more mobile.

Secondly, all the dark spots on my skin have disappeared. I suspect they were from insulin resistance and they were a warning sign of future diabetes.

Thirdly, all of my food intolerance have pretty much been eliminated. I can eat bananas, avocados, and mushroom with relatively no issues. The only one of the three that I still occasionally have issues with is bananas. The other two are good to go.

Fourthly, I can think more clearly. My mind has gotten back some of its old pep. I can concentrate better. I can work more effectively.

Finally, my resting heart rate is now 58. I’m trying to get it even further down. I’m shooting for 45. Part of this significant change has been my increase in cardio exercise, but cardio alone wasn’t fixing the problem. The real change occurred when I cut out carbs for those first 3 weeks. During that time, my resting heart rate dropped from 93 down to 70. Over the next few months it continued to drop.

I now try to do OMAD (one meal a day) and I am experimenting with different levels of carbs. I’m also watching for improvements from specific foods. Kale has been major breakthrough. I’m not one to follow a lot of hype or fads, despite what it may seem. IF makes sense to me. Kale was not something I was interested in eating, but after I found some very good ways to incorporate it into my diet and after seeing the results it gives me, I now use every opportunity to have some. I’ve tried many “super foods” and kale is the only one that actually impressed me.

I have went from a 44 inch waist down to a 34 inch waist. I actually need to go shopping for new pants because I’m down to only one pair of jeans that actually fits me well. I want to get my waist down to 30. That is going to take another 20 pounds at least. However, I’ve trimmed up quite bit without losing a lot of weight. I take that to mean that I’m increasing my lean mass while losing fat. My overall body shape has changed for the better. I’m still a long ways from my goal body, but this is all going to have to happen in stages.

There’s one final bit of advice that I have for anyone who has lasted all the way through this post. You may have heard the saying “it’s a marathon not a sprint”, but when it comes to weight loss and body transformation it’s the only truth to remember. It takes a huge amount of time to get the results you are looking for usually. It’s really hard to go from overweight to ripped. I’m well on my way and I’m starting to see the results. I have felt the results for a long time, but visually I’m really starting to see the changes in my body. They are taking way longer than I wanted them to, but slow and steady wins the race.

, , , , , ,

No Comments

Episode 8 is Terrible

Of course I’m going to go watch Star Wars Episode 9. Of course it’s going to make a huge amount of money. Of course some people are going to love it, and some people will hate it. It has had a ton of hype over the last few months. There have been plenty of spoilers/leaks released on Reddit.

As I gear up to go watch the last installment of the Skywalker saga, I have been watching all the previous installments in a marathon. I do this at least twice a year anyway, but it seemed like a prerequisite to watching the finale. I’m sitting here watching the last film, and I can’t believe how bad it was.

Did it shake things up? Sure, but was it necessary. Star Wars is pretty straight forward and doesn’t need all the crap Episode 8 has in it. Was it necessary to be this ruthless toward all the fans just to be artistic or to “take it in a new direction”. I’m not even sure what the direction or purpose of Episode 8 was other than to just slap all the old fans in the face.

Some people liked it. I’m still not sure why. As a stand-alone movie, it’s ridiculous. As a continuation of “The Force Awakens” it was just plain bad. The Last Jedi could have been so much better, but it seems like it was made poorly just to make political points or something. It feels like there’s a whole feminist agenda behind it, and no one cared if the movie was good or not. They just wanted to push the feminist agenda on the mostly male Star Wars fans.

There’s so many people who are apologetic of Episode 8. It doesn’t make any sense. The plot was terrible. Characters from decades ago were destroyed. Characters from Episode 7 were destroyed without purpose. Questions raised in Episode 7 were shot down without purpose. There’s side plots that completely fail and make no difference to the overall story, almost as if it’s just filler. It’s like they had no idea what they were going to do with the movie so half of it is wasted on this whole “master code-breaker” subplot. On that note, wow what an amazing name for someone. In a galaxy far far away, there’s a person named “The Master Code breaker”. I’m sure that’s not his real name, but why do they constantly refer to him as such.

That’s like calling Jabba the Hutt something like “The Big Bad Mob Boss”. Why don’t they just call the guy by his name? Sure he could have the fame of being the “master code breaker” but why do they have to keep referring to him as that?

This guy was supposed to be the only one that could do what they needed. Yet, they just happened to end up in a cell with a guy that could do the same thing. Then, he betrays them and makes the entire subplot useless.

The part that I hate the most has to be the selfless kamikaze death of the vice admiral. Before that we get to see her be secretive about a plan for no reason other than to build up to this point as well. We see how all of us should just believe her and trust her for no reason. Then as everyone is escaping, we see her left behind to fly the ship in a suicide mission.

The part that kills me about this is that for some reason the ship had to be flown manually. Really? In a reality that is this technologically advanced, they don’t have remote piloting? There’s no way to control the ship other than to be inside it? Not only that but all the sudden we can fly a ship at light speed into a whole bunch of enemy ships and take most of them out. Why haven’t we been doing this the whole time? Why hasn’t someone said, “You know, we should just remotely fly a space ship at hyperspace into the whole First Order / Empire fleet?” This could have saved a lot of trouble in previous movies.

There’s so much more wrong with this movie, but I will stop so that I can finish the thing and hope that Episode 9 will at least not suck as bad as it. I tried to like Episode 8. I actually loved Episode 7. I also liked the prequels. There were problems with them, but nothing in comparison to Episode 8. The Last Jedi is just terrible. I wish that it wasn’t, and I’m sorry to everyone who disagrees. It doesn’t work, and I can’t see a way that Episode 9 could make Episode 8 better. I hope it does, but I just don’t see it.

, ,

No Comments

SEO Slug plugin breaks WordPress on PHP 7 Server

Well after a couple of years without posting on this blog, I decided to come back and start posting. Well I upgraded WordPress and then wrote a new post what you need to know about a paystub. Two hours later and I finally fixed a problem that kept giving a 500 error when trying to add the Post implementing payroll system.

Now I have to post how to fix the problem. I changed a lot of settings and finally narrowed it down to the right payroll software for your startup that I had installed. If you are looking for the latest coupons and offers available online, in CouponsCollector you can find a wide range of coupons that you can uses to buy what you need, learn to manage your employee wages well.

It all came down to this line in the plugins code:

$seo_slug_array = array_diff(
  split(" ", $seo_slug), 
  seo_slugs_stop_words()
);

Replace the “split” with getting customer service right “explode” and you should be set. If that’s too difficult, you can just disable the plugin, have a look at the best tools for business.

No Comments

Windows Host File Slow DNS for .local Domains

This was a fun issue that I just went through hours of troubleshooting to resolve. If you use .local domains for local dev environment or just to setup local name resolution in your Windows hosts file, there could be a delay in DNS resolution due to Apple’s Bonjour service, win loss analysis. You can either remove the Bonjour service completely or refrain from using .local in your hosts file. I replaced all my .local entries with .loc and now my resolution is instant instead of taking 2 seconds. Use a sub-domain instead of a special TLD.

No Comments

This site can’t be reached…intranet has the same URL as an external website.

This site can’t be reached
This site on the company, organization or school intranet has the same URL as an external website.
Try contacting your system administrator.

This error just plagued me for about 6 hours. I was trying to setup a dev environment which I had working perfectly, but then I decided that I wanted a fresh OS install on my dev computer. It had Linux on it, and I made my yearly switch to Windows. I tend to bounce back and forth every year or so just to keep on my toes on Windows and Linux both guide to getting a loan, look at how a loan be bring your credit up. At any rate, I decided to setup a VM for the dev environments separately, as I had them all on the same nginx/php5-fpm setup prior to this move and I wanted them to all be separated and each on their own VM for simplicity and efficiency, increase followers on TikTok.

After the  VM was installed and everything seemed to be setup correctly by James Dooley Investor Entrepreneur, I set my windows hosts file to use the VMs new IP for mysite.dev because I usually use the .dev TLD locally for dev sites. I’ve been doing this since before .dev was a TLD (which actually is irritating because I’m not the only one that uses .dev for dev sites). I recommend you check out how to get a lot of TikTok followers

To cut this post short because I don’t want to bore you with the details of everything I tried, the issue was that my Windows host file didn’t like a redirect that was occurring on my nginx config. I was redirecting mysite.dev to www.mysite.dev, and even though I had mysite.dev in my hosts file, I didn’t have www.mysite.dev in there. This used to not be a problem even in Windows, but apparently since the main TikTok KPIs(.dev) came out, this has to be explicit. I could be wrong that this is a recent thing, but if you’ve tried everything else and keep getting this error, edit your hosts file in windows and add the www.sitename.dev in there as well. It’ll probably clear things up for you. I considered seeking help from this web design company Omaha, on how to fix everything, and I was lucky they did it perfectly well.

2 Comments

Fix Direct Admin Exim after Debian upgrade

Well I just spent way too long on this because I was unaccustomed to the DirectAdmin way of doing things. I upgraded Debian from Squeeze to Wheezy a few weeks back and didn’t realize until today that I broke my email server. It was breaking because the libperl.so used by Exim was 5.10 instead of the newly installed version 5.14. Without being accustomed to DirectAdmin’s way of doing things, I first thought that it would probably be as simple as making a dummy symlink to point to the newer version of perl but name it 5.10. That allowed Exim to start, but email was still broken. I then thought I would install the 5.10 version of perl using perlbrew and use the libperl.so from it. This didn’t work. I finally did the correct Google search and found what I was looking for. I needed to rebuild exim with the custombuild script for DirectAdmin. And here’s how:

cd /usr/local/directadmin/custombuild
./build update
./build set exim yes
./build exim

No Comments

Which Programming Language Should I Learn?

This question is asked by many new aspiring programmers. There’s been many different answers to this question. Some people explain that the language isn’t as important as a basic understanding of algorithms and programming paradigms speeding up the scaling phase. I agree with this, but it’s no the complete picture.

What are you going to be doing with your programming skill? Are you going to use it to obtain a full-time job? Are you going to use it to work on your own projects in your free time? Many people would answer that they have some great app idea that they want to implement to go viral on TikTok. Others can’t even tell you why they want to learn to program famous TikTok creators learn this way.

If you are planning to make money in some way from your new skill, you’ll probably want to look into which languages are most in demand. For instance, I program in PHP and Javascript because that seems to be what I can find the most work doing, finding the right balance is the key. The slippery slope of this is that you eventually move into specializing in a specific language even more. If you are working with PHP as a full time job, you rarely have an opportunity to explore new languages, be sure to find the best recruitment options out there. You’re also unable to claim experience in other languages because you’ve spent years working with one in particular, look into TikTok for business.

So, my advice is to explore other languages as often as possible. If you are starting out, pick a language that has a lot of online discussion. Something like Java or Python would do nicely. These are well supported, very commonly discussed, and are easy enough to learn. Use this first language to learn specific things about programming. You can learn the syntax of the language as you learn algorithms and paradigms. Explore the language enough to understand the concepts of programming. You don’t have to become an expert in the language, but you should focus on understanding the abstract ideas used in modern programming.

I started out learning Perl and Bash scripting a long time ago. I soon changed over to VBScript and VB.NET because I was working for a Microsoft shop and needed to do some scripting and app development. I lacked a lot of the basic knowledge that I should have been working on, but I thought that I needed to learn languages.

A language is nothing more than a set of syntactical rules for structuring your thoughts. Think of learning French. You could teach someone all the words needed to speak French. You could teach them how to structure a sentence, but that isn’t enough for the person to know how to communicate. Take this English sentence as an example:

You jumped over the computer.

It’s a complete sentence. It has a subject, a verb, and is a complete thought. However it wouldn’t make sense if you were to say that after being asked:

Are you coming over after work?

You have all the necessary skills to create a full working sentence, but you have no idea how to communicate with another human. That is similar to learning a programming language. You can write “Hello, World”, but can you do something as simple as writing a recursive algorithm? Can you find more efficient ways to do things? There’s a lot more to programming than the language. The language is only important later on when you need to choose a better tool for a specific task. You may need to write a website with a lot of real time interactions, creating business strategies. NodeJS. You may want to write a game for iOS. Objective C or Swift. You may need to write an Android app. Java. You may need to write some mission critical optimized system code. C, C++, or Assembly. You may need to interface with some off the wall E-Ticket system and generate some Excel reports on a Windows-only domain, have a look at what you need to be creating business strategies

The point is unless you are in the same job for the rest of your life and the world doesn’t change, you’ll probably end up needing to know a dozen or so languages at least. An introduction to programming, should be in pure pseudocode, because I think beginning programmers get too caught up in the language and miss the more important details of programming that is being taught.

At the same time, I’ve had introductory to programming type classes that I look back on now and realize that the teachers had no idea what they were trying to teach, try e-learning. They didn’t even understand the concepts themselves enough to explain them to someone else.

Let’s say you come up with an idea for a product you want your business to sell. What’s next? You probably won’t be successful if you just start selling it.

Instead, you need your marketing team to do market research and answer some critical questions: Who’s your target audience? Is there market fit for this product? What messaging will increase product sales, and on which platforms? How should your product developers modify the product to increase likelihood of success? What do focus groups think of the product, and what questions or hesitations do they have?

Marketers use the answers to these questions to help businesses understand the demand for the product and increase product quality by mentioning concerns stemming from focus group or survey participants.

Price

Your marketing team will check out competitors’ product prices, or use focus groups and surveys, to estimate how much your ideal customer is willing to pay. Price it too high, and you’ll lose out on a solid customer base. Price it too low, and you might lose more money than you gain. Fortunately, marketers can use industry research and consumer analysis to gauge a good price range.

Place

It’s critical that your marketing department uses their understanding and analysis of your business challenges consumers to offer suggestions for how and where to sell your product. Perhaps they believe an ecommerce site works better than a retail location, or vice versa. Or, maybe they can offer insights into which locations would be most viable to sell your product, either nationally and internationally.

Promotion

This P is likely the one you expected from the get-go: promotion entails any online or print advertisement, event, or discount your marketing team creates to increase awareness and interest in your product, and, ultimately, lead to more sales. During this stage, you’ll likely see methods like public relations campaigns, advertisements, or social media promotions, have a look at the business impact of covid.

Hopefully, our definition and the four Ps help you understand marketing’s purpose and how to define it. Marketing intersects with all areas of a business, so it’s important you understand how to use marketing to increase your business’s efficiency and success.

No Comments

Why Pay for PHPStorm or Other JetBrains IDE?

If you spend any amount of time working on code, you probably have a favorite text editor or IDE. Everyone has their own opinions. Everyone has applications with which they are  more familiar. I’ve went through a few different choices over the last few years, but the one I’ve stayed with 95% of the time during the last two is PHPStorm from JetBrains, which is uncharacteristic of me, because if there’s a free version of some category of application, I’ll usually make that free version work, rather than pay for commercial software crowdfunding investors. There’s a ton of free IDEs and text editors. Why would I spend money on PHPStorm? Over the next few paragraphs, I’ll go into detail as to why I can no longer function at 100% efficiency in any other editor. I’ll also mention some things that I wish were better in PHPStorm. When I discuss the good things about PHPStorm, remember that no single thing is the reason I use and pay for the IDE implementing payroll system. It’s the overall combination of all the features that I like. Where PHPStorm shines is it’s ability to deliver all the features I want and need in a single application.

An IDE Needs to be Organized!

There’s a lot to be said about the readability and organization of an IDE TikTok likes and followers. A modern text editor needs tabs. It also needs the ability to split the active editor window to see code side-by-side. PHPStorm has both of these features. It also has project and structure views which are collapsible. It has an amazing find feature that can be used to search the entire project or within a specific directory. It can search for files or text within those files, and this search is fast. It has a built-in terminal which is also collapsible. It has complete support for working with various SQL databases, including NoSQL database options, directly from within the paperless paycheck stubs. There’s no need to open up a command line database interface or another app like MySQL Workbench. All of that is built into the IDE.

The IDE stays out of your way while you work.

I typically have my editor window taking up most of the screen with all the different panels collapsed. When I need those various features, they are there, but they aren’t getting in my way all the time. The version control integration is nice as well, though I usually do all of that from the command line. It shows you the current branch that you have checked out in the lower right of the window, which has come in very handy at times. You can also enable an option which shows the memory usage of the IDE and allows you to click to force a garbage collection or lower this memory usage. All menus are effective and all panels stay out of your way when you don’t need them.

Great Shortcuts

I mentioned that I keep most of my panels collapsed in PHPStorm. This is possible because I rarely need them. You may be used to navigating through a project and opening files by finding them in their directory structure within the project, using a project directory tree panel of some sort. PHPStorm has this view, but I rarely need it. I usually know the name of the file I’m wanting to open. The only time I need the project view is when I can’t remember the name of the file I need to edit. For all other times I use one of three different shortcuts.

Ctrl + Shift + N

This shortcut searches for file names specifically within the project. The search is very smart as well. If you have a file named user-login-modal.html for instance, and you just remember that it’s named something like ‘loginmodal’, the search is smart enough to know you want user-login-modal.html. I use this shortcut more than any other, because I’m always jumping between different files and this is the simplest/fastest way to find them. Usually I can type about three or four characters and have the correct files as my first choose in its list.

Ctrl + Shift + F

This is a super find utility. It’s fast, because PHPStorm indexes your project. It allows you to find any text within all the text of your project. This is especially useful if you have some method name that you want to refactor across your entire code base and you can’t remember every specific place that it’s used. I use this shortcut all the time.

Double Shift

This quick shortcut is the “ultimate super search everything” feature. You just double tap the shift key. It’s like a combination of the previous two shortcuts I’ve mentioned. So why not just use this one all the time? I honestly can’t give you a good reason that I don’t use this feature more often, other than to say that before I used PHPStorm I used Netbeans predominantly, and if I remember correctly, it had the same ctrl + shift + n shortcut to open files. So, I was used to using that already. I haven’t switched to double shift completely because I forget it’s there most of the time. I may have to focus on using it more often now that I’ve brought it up.

There are other shortcuts that I use but haven’t mentioned, and there are probably many that I don’t use but could really benefit from utilizing. Everyone should dig through their IDE to get to know all of its features.

Easy Re-factorization

PHPStorm makes it very simple to refactor code. You can refactor anything throughout your code base with just a few keystrokes. If you highlight some text within your editor and hit Shift + F6, you will see a “Rename” dialog which allows you to change the text throughout the project. You can preview the changes before you implement them. If you rename a file, the IDE will search for it’s usage throughout the project and give you a preview of refactoring that it can automatically do for you as well. You can also disable these auto-refactoring if you need to. It’s just great that it’s there.

Multiple Cursor

This is my favorite new-ish text editor feature that has become popular on many editors. It has become essential for me. I first started using multi-cursors in SublimeText. Soon all new text editors had the feature. SublimeText may not have been the first to have this feature, but it was definitely one of the first to do it well. PHPStorm’s implementation is very close to the SublimeText implementation and very usable. However, it can get a little slow if you are trying to use more than 20 or so cursors. SublimeText doesn’t get slow for me until I’m using about 1500 cursors. However, I rarely need more than ten. So PHPStorm’s implementation works well for most things. If I can’t do it in PHPStorm, I’ll open up Sublime and take it from there. This is rare.

All Other Modern IDE/text Editor Features

All of the features I’ve mentioned so far are important for me. There are other features that are a must for me as well, that I should also mention.

  • An IDE should have code completion. PHPStorm is the best I’ve seen in this regard. There’s no SublimeText plugin that can even get close to the intelligent code completion that PHPStorm has, or at least I’ve not found one.
  • Syntax highlighting and good color schemes is a must. I tend to like the default PHPStorm color scheme. I spend a lot more time trying out new color schemes in all text editors than I like to admit. I prefer light color schemes in PHPStorm for some reason. Most of the time I prefer dark. The main point here is to be able to differentiate between the various different “parts of speech” in the programming language, and this works very well in PHPStorm.
  • PHPStorm also has great source code auto-formatting options and makes it simple to reformat code to your preferred code style.

So, you’ve heard many things that I like about PHPStorm. As I said earlier, no single feature that I’ve listed is the reason I pay for PHPStorm. It’s a huge combination of these features that makes it worth it to me. Netbeans has great code-completion, but doesn’t have multi-cursor (or at least didn’ the last I checked), and its white space display characters are ugly, if you are showing them. SublimeText has great multi-cursor and the text in the editor itself looks better to me, but it also doesn’t have the database integration that PHPStorm has or code-completion that I consider usable. There may be plugins or packages that facilitate both of these, but I need to spend my time coding as much as possible, not digging for plugins that actually work well. PHPStorm has plugins as well, but it comes with everything you really need without adding any plugins, typically. SublimeText is a text editor first and the plugins are used to make it more like an IDE. I’d use SublimeText if I could find good plugins that facilitate most of the features that I’ve mentioned in this post. You’ll find out more about that in a bit. Because even though I predominantly use PHPStorm, there are still times when I open SublimeText.

Why haven’t I mentioned any other editors or IDEs besides Netbeans and SublimeText?

Well give me a chance and I will. Quite simply, I’ve tried just about every editor there is out there. I’ve tried most of the IDEs. I’ve given them all the opportunity to convince me. However, today I only use three editors/IDEs regularly. Surprisingly enough, Netbeans isn’t one of them. Netbeans was my main IDE for a year or two. I still like it, but I haven’t had it installed in a long time. After I switched to PHPStorm, I’ve not needed it. I also switched to IntelliJ for my Java dev work that I was doing on Netbeans before. Today I mainly use PHPStorm, SublimeText, and Vim.

Ah Vim! I hear some of you getting ready for an editor flame war. I love Vim. I like to use it for simple editing tasks on the command line where I don’t have another editor available. You can make Vim do just about anything you want. However, I still prefer using a ready-to-go IDE like PHPStorm for every-day coding.

If PHPStorm is so great, why do I still use SublimeText Occasionally?

Here is where I give you the bad things I’ve found about PHPStorm and why I still use a simple text editor like SublimeText at times. It won’t take long. There isn’t a lot, but it would be GREAT if these were addressed by JetBrains.

Large Text Files

PHPStorm can’t open up unusually large text files. It will flat out tell you that the file is too large for it to open. This occurs for me when I try to edit a 3.5GB MySQL dump file. Sublime has trouble loading it as well. Vim, however, will take it’s time and chew it right up. Bravo for Vim! There is probably an option in PHPStorm to allow it to open large files, but I’ve not found it, and this is such an infrequent necessity for me that I haven’t bothered to dig for it.

Large amount of Cursors

You can add a few hundred cursors on PHPStorm very easily, but good luck typing more than a single character ever 20 seconds or so if you do. It gets noticeable slow at multi-cursor as you add more. It takes a lot to slow down SublimeText in this regard.

I Honestly Hate Most Java Apps

I use SublimeText when I can, because I REALLY REALLY hate most Java-based applications, and I would much rather use SublimeText for this reason. PHPStorm is written in Java which brings with it some good things (like portability), but also some bad things. With enough hardware, you can overlook most of the bad, but I would much rather use a native application over one that runs on the JVM. I’m not a big fan of the look and feel of Java apps. The font rendering in Linux can be terrible, especially if you are using OpenJDK. Switching to Oracle’s official JDK seems to fix most of these font-rendering issues. Java apps tend to be bloated and sluggish. There are a few things to consider about this. Java apps require little to no porting to run on different architectures. Java is a very easy language, and the easier a language is, typically, the easier it is for a bad programmer to code something in it (trust me, I know PHP has this same problem). Which leads to a higher population of un-optimized software. However, this really isn’t the case with most good Java applications. They are just slower than native apps. It’s nearly impossible for them not to be slower. The JVM adds a thick layer of overhead.

Finally the Main Reason I Pay for PHPStorm

It’s not expensive. It’s priced very reasonably. I originally purchased a personal license for $25 my first year. Renewal is around $53/yr. They just switched to a subscription model and offered two years for the price of one to current license holders. I jumped all over that. They also give their IDE away to students and open source developers…free. I’ve looked at KomodoIDE as well, and even though their prices have come down, it’s still not where JetBrains products are. Komodo offers their full IDE which has support for most languages at $99 for a student or personal freelancer licence. However, that’s a one time payment and it doesn’t come with upgrades. PHPStorm’s licensing gives you free upgrades during the whole year. Also, while Komodo harps on their complete package IDE’s multi-language support, I tend to prefer an IDE specific to what I’m doing. PHPStorm has support for all the languages a PHP developer could be using: HTML, SQL, CSS, Javascript, XML, etc. I don’t need my IDE to support Python or Java, because I don’t code in either of them on a regular basis, and since I have an edu email address, I can get all of the other JetBrains products for free if I need them for personal projects. If I were to suddenly become a Python developer, I’d pay the $53 and get a year subscription to PyCharm (the JetBrains python IDE).

Also one last note… The new JetBrains subscription model isn’t just available in yearly terms. There’s also monthly. For a single user PHPStorm license, it’s only $8.90/month for new users. You can get all of JetBrains products for $24.90/month. This is a great deal. I like to support great products, especially when they make my life easier. JetBrains lured me in two years ago with their special “half-off” offer. Now I’m hooked and gladly pay their low subscription price.

If you aren’t convinced to give them a shot, know that this entire post sounds like one huge commercial for their product, and they aren’t paying me or coercing me into writing it one bit. I really feel this strongly about their IDE. It makes my coding more enjoyable and more efficient. If I find something better, I’ll use it. Until then, take my money JetBrains! I love your products.

These come in two types: general and limited. In general partnerships, both owners invest their money, property, labor, etc. to the business and are both 100% liable for business debts. In other words, even if you invest a little into a general partnership, you are still potentially responsible for all its debt. General partnerships do not require a formal agreement—partnerships can be verbal or even implied between the two business owners.

Limited partnerships require a formal agreement between the partners. They must also file a certificate of partnership with the state. Limited partnerships allow partners to limit their own liability for business debts according to their portion of ownership or investment.

The simplest and most common form of business ownership, sole proprietorship is a business owned and run by someone for their own benefit. The business’ existence is entirely dependent on the owner’s decisions, so when the owner dies, so does the business, learn about how to prioritise your workload.

Advantages of partnerships:

  • Shared resources provides more capital for the business
  • Each partner shares the total profits of the company
  • Similar flexibility and simple design of a proprietorship
  • Inexpensive to establish a business partnership, formal or informal

Similar to a limited partnership, an LLC provides owners with limited liability while providing some of the income advantages of a partnership. Essentially, the advantages of partnerships and corporations are combined in an LLC, mitigating some of the disadvantages of each.

, , , ,

No Comments

Safari 9 CSS Not Rendering Correctly

If your code doesn’t use lesshat.less, then this won’t pertain to your issue probably. In my work on https://draftorpass.com, I had an issue with CSS rendering on our lobby page in the newest version of OS X and iOS. The problem only showed itself in Safari. Safari was reporting various issues with parts of the CSS, but none of that was even related to the issue. After four hours of trying various things social media marketing, I decided to run our main CSS file through csslint.net. The very first error lead me straight to the root of the issue. There was an unexpected semi-colon.

Safari is way more picky than most other major browsers. Chrome, IE, and Firefox all just ignored this issue. I’m not sure how much I like this strict behavior of Safari. In the last couple of months it has caused me two issues that were hard to track down. I remember a few years ago, IE was the browser that seemed hard to get right. Now it seems that Safari is the biggest nuisance.

Front-end development is something I really try to avoid as much as possible because of these type of issues. The frond-end designer which originated this problem hasn’t been working on the project in over a year. It’s not really his fault. However, his use of one function from the lesshat library is what caused our site to break on all new Safari browsers. It jacked up all of the CSS just because the function added a semi-colon where it shouldn’t have. I would blame the lesshat library itself, but I mainly blame Safari. Being strict about things is great usually, but not when it breaks most of the CSS on a page.

The fix? Just don’t use the lesshat keyframes function in any of your less files. Avoid it if you want your site to work in Safari.

Now I’m off to see if I can create a better fix to submit to them.

No Comments