Content Developer II at Microsoft, working remotely in PA, TechBash conference organizer, former Microsoft MVP, Husband, Dad and Geek.
121691 stories
·
29 followers

A cheaper Tesla is back on the menu

1 Share
Two Tesla Model 3s shown driving on a mountain road, one red and one gray.
The Model 3 might get an affordable younger sibling in 2025. | Image: Tesla

Tesla says it will build more affordable electric vehicles — perhaps as soon as 2025 — refuting recent reports that Tesla CEO Elon Musk had canceled plans for a cheaper “Model 2” vehicle in favor of getting a robotaxi out the door. But Musk didn’t clarify whether the lower-cost EV would be a brand new model for Tesla or simplified versions of its current vehicles.

“In terms of a new product roadmap, there’s been a lot of talk,” Musk said during the company’s first quarter earnings call, addressing the concerns investors have expressed over the past month about the delayed plans for a low-cost EV. “We’ve updated our future vehicle lineup to accelerate the launch of new models.” Musk said we might see the vehicles in early 2025, if not...

Continue reading…

Read the whole story
alvinashcraft
4 hours ago
reply
West Grove, PA
Share this story
Delete

HashiCorp Reportedly Being Acquired By IBM

1 Share
According to the Wall Street Journal, a deal for IBM to acquire HashiCorp could materialize in the next few days. Shares of HashiCorp jumped almost 20% on the news. CNBC reports: Developers use HashiCorp's software to set up and manage infrastructure in public clouds that companies such as Amazon and Microsoft operate. Organizations also pay HashiCorp for managing security credentials. Founded in 2012, HashiCorp went public on Nasdaq in 2021. The company generated a net loss of nearly $191 million on $583 million in revenue in the fiscal year ending Jan. 31, according to its annual report. In December, Mitchell Hashimoto, co-founder of HashiCorp, whose family name is reflected in the company name, announced that he was leaving. Revenue jumped almost 23% during that period, compared with 2% for IBM in 2023. IBM executives pointed to a difficult economic climate during a conference call with analysts in January. The hardware, software and consulting provider reports earnings on Wednesday. Cisco held $9 million in HashiCorp shares at the end of March, according to a regulatory filing. Cisco held early acquisition talks with HashiCorp, according to a 2019 report.

Read more of this story at Slashdot.

Read the whole story
alvinashcraft
4 hours ago
reply
West Grove, PA
Share this story
Delete

The FTC has banned noncompete agreements

1 Share
Photo collage of Congress.
Illustration by The Verge | Photo via Getty Images

The Federal Trade Commission has voted to ban noncompete agreements nationwide, saying that they are an “unfair method of competition.”

Noncompete agreements — which attempt to prevent employees from working for or starting competing businesses — are especially prevalent in the world of tech, where we’ve seen companies like Amazon enforce and then retract a noncompete agreement for warehouse workers. Acer even sued its former CEO for allegedly breaching a noncompete policy by becoming a consultant for Lenovo.

The change will force companies to reverse existing noncompete agreements and notify employees about the change. Existing noncompete agreements for senior executives can stay in place, but companies can’t enter or enforce new...

Continue reading…

Read the whole story
alvinashcraft
4 hours ago
reply
West Grove, PA
Share this story
Delete

Framework won’t be just a laptop company anymore

1 Share
Best Cheap Laptop 2023: The Framework Laptop lid seen from behind.
Photo by Monica Chin / The Verge

Today, Framework is the modular repairable laptop company. Tomorrow, it wants to be a consumer electronics company, period. That’s one of the biggest reasons it just raised another $18 million in funding — it wants to expand beyond the laptop into “additional product categories.”

Framework CEO Nirav Patel tells me that has always been the plan and that the company originally had other viable ideas beyond laptops, too. “We chose to take on the notebook space first,” he says, partly because Framework knew it could bootstrap its ambitions by catering to the PC builders and tinkerers and Linux enthusiasts left behind by big OEMs and partly because it wanted to go big or go home.

If Framework could succeed in laptops, he thought, it would be...

Continue reading…

Read the whole story
alvinashcraft
4 hours ago
reply
West Grove, PA
Share this story
Delete

Apple reportedly cuts Vision Pro production due to low demand

1 Share
A woman makes a pinching gesture while wearing the Vision Pro.
Demand for Vision Pro is falling. | Photo by Amelia Holowaty Krales / The Verge

Apple is reportedly cutting its Vision Pro headset shipment forecast for the rest of the year due to cooling demand.

Apple analyst Ming-Chi Kuo writes that Apple cut orders for the Vision Pro even before it launched outside of the US. His sources claim that Apple now expects to sell only around 400,000 to 450,000 units in 2024, compared to what Kuo says was a “market consensus” of 700,000 to 800,000. Demand for the $3,500 Vision Pro dropped much lower than the company was expecting.

Facing the unanticipated drop in steam, Apple is now adjusting its headset roadmap, possibly pushing the future of a lower-cost entry mixed reality headset beyond 2025 (if at all). Apple’s Vision Pro has largely wowed early adopters due to its technical...

Continue reading…

Read the whole story
alvinashcraft
4 hours ago
reply
West Grove, PA
Share this story
Delete

Golang: How to Use Library Packages

1 Share

Most programming languages come with built-in libraries. With these libraries, you can use pre-built code that serves a specific purpose. By doing so, you not only have to write less code but you can be certain the code you import from those libraries always does exactly what you expect it to.

Without libraries, your code would not only be considerably longer, it would be far more complicated.

For example, you have the Go standard library, which adds a number of important packages for essential functionality. You’ll find fmt (for formatted I/O), errors (implements function for error manipulation), crypto (for collecting common cryptographic constants), and more. You can view the entire Standard Library here.

But if you were limited to the Standard Library, you wouldn’t be able to get much done. You’d be limited to either using what was available or having to write your own code for the functionality you need.

That’s why you need to know how to import library packages with Go.

A Golang Circular Problem with Importing Packages

Before we get into this, I want to address something I’ve run into on a few occasions. That something is the deprecated go get command, which you’ll find in tutorials, instructions, and even textbooks everywhere. The go get command was deprecated when modules were introduced. When that happened, the go get command was being used to both update dependencies in a go.mod file as well as install commands, which was confusing.

But, if you view certain packages on GitHub (such as the MySQL driver), you’ll still find the instructions list as go get as the procedure, such as go get -u github.com/go-sql-driver/mysql, which doesn’t work. And if you attempt to use the replacement go install, you get an error such as:

Try ‘go install github.com/go-sql-driver/mysql@latest‘ to install the latest version

Let’s try that suggestion. Run:

go install github.com/go-sql-driver/mysql@latest

Guess what? That errors out as well, with:

package github.com/go-sql-driver/mysql is not a main package


It’s a circular problem.

This started because I wanted to write a tutorial on connecting Go with a MariaDB database. What should have been simple turned into a recursive nightmare, simply because I couldn’t get the MySQL driver to install for Go. So, I created the database and then attempted to import the driver with no luck.

Then I attempted to load the driver from within the code, which looked something like this:

package main

import (
    "database/sql"
    "fmt"
    "log"
    "os"

    "github.com/go-sql-driver/mysql"
)


After completing the entire code block (which connects to my database, I then run the command:

go mod init github.com/go-sql-driver/mysql


That’s followed by:

go mod tidy

Now I have a go.mod file which includes:

module github.com/go-sql-driver/mysql

go 1.22.1


Everything should work just fine. It doesn’t. Just so you can get an idea of what the full code looks like (which was inspired by the official Golang documentation here), take a gander:

package main

import (
    "database/sql"
    "fmt"
    "log"
    "os"
)

var db *sql.DB

func main() {
    // Capture connection properties.
    cfg := mysql.Config{
        User:   os.Getenv("ubooks"),
        Passwd: os.Getenv("PASSWORD"),
        Net:    "tcp",
        Addr:   "192.168.1.166:3306",
        DBName: "books",
    }

    // Get a database handle.
    var err error
    db, err = sql.Open("mysql", cfg.FormatDSN())
    if err != nil {
        log.Fatal(err)
    }

    pingErr := db.Ping()
    if pingErr != nil {
        log.Fatal(pingErr)
    }
    fmt.Println("Connected!")
}


Now, when I run the app, I get the following error:

./main.go:17:12: undefined: mysql


Remember, this is from the official documentation. After doing considerable research, I discovered the tutorial in the documentation fails without AllowNativePasswords: true.

Guess what? It fails even with the above statement. The problem is obvious, we have to define mysql before we can call it with mysql. I then found another method, which failed on me.

Clearly, this is a complex issue.

Needless to say, I had to give up on this one for the time being. I will come back to it, once I’ve figured out the problem.

So, for the time being, we’ll avoid importing third-party packages (we’ll deal with that later, once I’ve figured out the MySQL issue – because using databases in applications is actually pretty important.

A Golang Library for Random Numbers

Let’s say you want a piece of Go code that prints out 10 random numbers between 1 and 1000. For that, you have to import the match package, which includes the rand function.

If you’ve been following along, you already know you have to add the package main at the top of your code to act as an entry point and that the package should be compiled as an executable program and not a shared library.

After that, we can then import our package and specify the function we want to use:

import "math/rand"


We’ll now create a function that will print out 10 random numbers between 0-1000, using a basic for loop. That looks like this:

func main() {
for i := 0; i < 10; i++ {
println(rand.Intn(1000))
}
}


The entire code block looks like this:

package main

import "math/rand"

func main() {
for i := 0; i < 10; i++ {
println(rand.Intn(1000))
}
}


When you run the above, the output might look something like this:

452
853
822
346
461
729
672
513
158
481

The problem with that is it’s not very random. To make the randomness even more reliable, we need to seed it with something. There’s a package for that, called time, which includes everything we need to seed a random number with time, specifically, the current time.

For this, we need to change our function, to define now like so:

now := time.Now()


There’s also a function, called UnixNano() that yields t as a Unix time which is the number of seconds passed from January 1, 1970. We implement that like so:

rand.Seed(now.UnixNano())


Our entire function now looks like this:

func main() {
now := time.Now()
rand.Seed(now.UnixNano())
println("Random numbers seeded with Unix Time: ", now.UnixNano())
for i := 0; i < 5; i++ {


Our entire app looks like this:

package main

import (
       "math/rand"
       "time"
)

func main() {
        now := time.Now()
        rand.Seed(now.UnixNano())
println("Random numbers seeded with Unix Time: ", now.UnixNano())
        for i := 0; i < 5; i++ {
                 println(rand.Intn(10))

            }
}


When we run the above, we get something like this for output:

Random numbers seeded with Unix Time:  1713204758111329492
3
5
4
5
1
9
1
7
3
1

Now those are truly random numbers.

And that, my Golang newbies, is how we use library packages in Go.

The post Golang: How to Use Library Packages appeared first on The New Stack.

Read the whole story
alvinashcraft
4 hours ago
reply
West Grove, PA
Share this story
Delete
Next Page of Stories