Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!

Adam Wentz

Ranch Hand
+ Follow
since Jul 29, 2016
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
5
Received in last 30 days
0
Total given
4
Given in last 30 days
2
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Adam Wentz

Tim Holloway wrote:The interminable wait when Windows boots and a product like Norton beats the hard drive to death for 20 minutes before the machine becomes usable is in my view dangerous. It incentivizes the user to switch it off.



You hit a very important nail on the head here, Tim. And when I speak of sloppy resources hogs, Norton is the very first name that comes to mind. It always perplexes me how one can unmistakably note the performance decrease realized by simply installing Norton on their system. Norton is to computer security what AT&T is to telecommunications! (and that isn't a good thing)  
1 week ago
I realize I am waayyy late to the party, but I came across this thread and wanted to chime in.

I've got over 23 years in the IT industry, which includes a ton of client support work. One thing is for certain, there is no such thing as a virus-proof OS. The old cliche that claims "Macs don't get viruses" has always been a false narrative that was derived, by fanboys, from a true narrative. Since the OS on a Mac is built up from Unix, there is an inherent level of security that comes with that. However, back when that cliche started surfacing, one of the other factors in Macs seeing fewer infections from viruses was that they weren't being targeted. Hackers usually hack for a purpose, and most of those purposes don't place them face-to-face with Mac systems. Ergo, fewer viruses that target Macs.

However, that isn't the case anymore, as there are quite a number of viruses nowadays that do target Macs. As I point out to the fanboys, why would a software publisher waste time and money to make anti-virus applications available for the Mac OS if it wasn't actually needed? That would equate out to poor resource management on their part. Furthermore, the OS isn't the only factor when looking at viruses, hardware also plays a role, which is why it is absolute truth that there is no virus-proof OS. (And for the record, because I just couldn't get through to a particular Apple fanboy, I intentionally infected my own Macbook Pro with a few different viruses).

That said, if you want the best in AV protection, I always recommend Sophos. One typical issue I find with many of the AV products available, especially the freeware/freemium titles, is that they are sloppy resource hogs (and tend to be rather annoying with their obnoxious notifications). Sophos not only provides incredible protection, it also gets an A+ in both of the aforementioned areas. I've rolled out various levels of their software on numerous corporate/enterprise infrastructures, and I use the [free] home version on my own Macbook Pro. The company behind Sophos is based out of the UK, and in the 13+ years I've been using/recommending their products, I've experienced nothing but excellent protection and performance.

That's my two cents. I hope someone finds it helpful.
1 week ago
I was tinkering with the syntax, and I finally managed to get the heredoc solution to work as follows:

1 week ago
PHP
Thanks for responding!

I've never actually heard of "heredoc" in PHP, but I briefly looked in to it at your mentioning it, and then tried your proposed solution. However, it throws a parse error:

Parse error: syntax error, unexpected '<<' (T_SL) in...




Now, for the record, everything about this concatenation works, except for the integrated variable, which is not displaying its value. So, the rendered output is "Copy entries to Address."
When trying to use heredoc, the whole page breaks and the referenced parse error is thrown.
1 week ago
PHP
I am trying to echo a string variable in an HTML label. I cannot, for the life of me, figure out why it isn't working. I have tried numerous things to resolve this, but none of them have worked. That said, I know it is suppose to work the way I have it coded, so there's something else I am missing here.



I've also tried using curly braces instead, like this...
1 week ago
PHP
I guess it might be helpful to share what I already know about this script.


Let's start with this function, the first one in the script:



This function, which I modified a bit from the original code, echos a div (that I've applied custom styling to). Within that div it places a headline, some paragraph text (the "content"), and then adds a checkbox field with a label. The checkbox field is added from an array that contains all the necessary information about it. Oh yeah, and the tells WordPress where the function should be hooked in at. In this case, it uses a Woocommerce hook to place the div and all its related content on the checkout form in the hook area BEFORE the area where the order notes field appears (if it's enabled).
1 month ago
PHP
I am using the attached script, which is PHP and jQuery (with some AJAX mixed in for good measure), and is used in connection with WordPress/Woocommerce to add a checkout field to the checkout form that, when checked, will add the associated product to the customer's current order, using the product's ID.

I would like to understand better how this script works. That is, I would like each function explained in layman's terms, because I would like to modify to the script to work with multiple checkboxes and multiple products. (For the record: I made the mistake of heading over to Stack Overflow, forgetting how ego-maniacal and rude most of them are over there. Yikes! I've always had much more pleasant experiences here on the ranch. So, thanks y'all!)  



1 month ago
PHP

Pete Letkeman wrote:Here you go https://medium.com/wiselteach/android-sqlite-database-androidmonk-6b92d1bdf33b
Take a look at DBHandler.java which I've copied and pasted the part that may interest you



Yes! This seems to be what I was looking for. I have been scouring the web all the day and never came across this.

Thanks a bunch, Pete!  
2 years ago
I am creating a binded service to use for catching duplicates before they are written to my database.

In the service, I want to query everything from the database onStartCommand and write the results to an ArrayList that I can use in multiple methods with conditionals, etc.

Is there a viable way to achieve adding all of the database's records to an ArrayList?
2 years ago
Also, share as much of your code as you can, especially your manifest and layout.
2 years ago

Adam Wentz wrote:Which version of Android are you targeting in your project?

The "Landroid" portion of the failed resolution suggests you might be targeting a beta version. Is that so?





As you were, L Android was the codename used for Android Lollipop. Apart from that correction, which version of Android are you targeting?
2 years ago
Which version of Android are you targeting in your project?

The "Landroid" portion of the failed resolution suggests you might be targeting a beta version. Is that so?
2 years ago
It seems like I finally nailed this thing down.

I eliminated the pkgStrings ArrayList altogether and just did a comparison between the currentPkgSelections and the packageName field of the packageList (which is a String).

I declare a new ArrayList<String> at the top of my class:


Then, in my onCreateViewHolder() method (I'm working in my custom RecyclerView Adapter class), I first clear switchTheseOn and then run a loop with a nested conditional:


I am still getting a weird output in my log, but the new array contains only those packages that are similar between currentPkgSelections and packageList. That fixes my problem at hand!

Apart from that, I did mention that I needed the common values to be able to set the initial state of the switches in my RecyclerView's row layout. If you're interested in knowing how I handled that part of the equation,
In my adapter's onBindViewHolder() method, after I set the package TextView, but before I create the onClickListener for the Switch view, I defined a loop and nested two conditionals inside of it, one to check the value of the appPackage TextView against the values in my switchTheseOn ArrayList<String> and the other to check the current state of the Switch view:


I still have no idea why the output in my log is all messed up but the actual functionality of my ArrayList<String> is fine, so I'm moving on.

Thanks to everyone who took the time to offer valuable insight!!  

2 years ago
I tried different code to get a clean ArrayList, but I still get the 10 x 10 output:



Output:

2 years ago

Adam Wentz wrote:Yes, there is a loop involved.



I forgot to say that before I can do a comparison, I must get the package names from packageList as Strings. I use a loop to do that:



That's what's producing 10 lines of 10 packages, and throwing off the later comparison.
2 years ago