Differential Serving

There is "futuristic" JavaScript that we can write. "Stage 0" refers to ideas for the JavaScript language that are still proposals. Still, someone might turn that idea into a Babel plugin and it could compile into code that can ship to any browser. For some of these lucky proposals, Stage 0 becomes 1, 2, 3, and, eventually, an official part of the language.

There used to be a point where even the basic features of ES6 were rather experimental. You'd never ship an arrow function to production ‐ you'd compile it to ES5 and ship that instead. But ES6 (aka ES2015, four years ago!) isn't experimental anymore. Its features aren't proposals, drafts, or candidates. They are finished parts of the language, with widespread support.

The main sticking points with browser support are IE <= 11 and Safari <= 9. It's entirely possible you don't support those browsers. In that case, you're free to ship ES6 features to production, and you probably should, as your code will be smaller and more efficient than if you compiled it to ES5. Philip ran some tests and his results suggest both file sizes and parse/eval times can cut in half or better by adopting the new features. However, if you do need to support browsers that lack support, you'll need to compile to ES5, but it doesn't mean you need to ship ES5 to all browsers. That's what "differential serving" is all about.

How do you pull it off? One way, which is enticingly clever, is this pattern I first saw Philip Walton write about:

<!-- Browsers with ES module support load this file. -->
<script type="module" src="main.mjs"></script>

<!-- Older browsers load this file (and module-supporting -->
<!-- browsers know *not* to load this file). -->
<script nomodule src="main.es5.js"></script>

Don't let that .mjs stuff confuse you; it's just a made-up file extension that means, "This is a JavaScript file that supports importing ES6 modules" and it is entirely optional. I probably wouldn't even use it.

The concept is great though. We don't have to write fancy JavaScript feature tests and then kick off a network request for the proper bundle ourselves. We can have that split right at the HTML level. I've even seen little libraries use this to scope themselves specifically to modern browsers.

John Stewart recently did some testing on this to see if it did the job we think it's doing and, if so, whether it's doing it well. First, he covers how you can actually make the two bundles, which takes some webpack configuration. Then he tested to see if it actually worked.

The good news is that most browsers — particularly newer ones — behave perfectly well with differential serving. But there are some that don't. Safari 10 (2016) is a particularly bad offender in that it downloads and executes both versions. Firefox 59 (2018) and IE 11 download both (but execute the correct one) and Edge 18 somehow downloads both versions, then downloads the modules version again. All browsers that are going away rather quickly, but not to be ignored. Still worth doing? Probably. I'd be interested in looking at alternate techniques that fight against these pitfalls.

The post Differential Serving appeared first on CSS-Tricks.

Jupiter X Review – Messy Code, Cheap Infrastructure but sold for over 100k times

Jupiter X is a premium WordPress theme that can create websites with the help of Elementor page builder. Then, what is in it for you? If you are going to use a third party page builder then why to use Jupiter X theme? This is the first question, you should ask for yourself. Why a Read More →

The post Jupiter X Review – Messy Code, Cheap Infrastructure but sold for over 100k times appeared first on WPArena.

Show error! Cannot open MSSQLSSQLEXPRESS service on computer’.’.

**

Cannot open MSSQLSSQLEXPRESS service on computer'.'.

**

What I have tried:

Dim myController As New System.ServiceProcess.ServiceController("SQL Server (SQLEXPRESS)")
Private Sub Service_status()
        If myController.Status = ServiceProcess.ServiceControllerStatus.Running Then
            TextBox1.Text = "Started"
        ElseIf myController.Status = ServiceProcess.ServiceControllerStatus.Stopped Then
            TextBox1.Text = "Stopped"
        End If
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            Service_status()
        End Sub
Private Sub BtnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnStop.Click
        ProgressBar1.Value = 0
        Try
            myController.Stop()
        Catch ex As Exception
            MsgBox(ex.Message)
        Finally
            ProgressBar1.Value = 100
            myController.WaitForStatus(ServiceProcess.ServiceControllerStatus.Stopped) '//Add
            Service_status()
        End Try

End Sub
Private Sub BtnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnStart.Click
        ProgressBar1.Value = 0
        Try
            myController.Start()
        Catch ex As Exception
            MsgBox(ex.Message)
        Finally
            ProgressBar1.Value = 100
            myController.WaitForStatus(ServiceProcess.ServiceControllerStatus.Running) '//Add
            Service_status()
        End Try

End Sub

Blooming Colors And April Adventures (2019 Wallpapers Edition)

Blooming Colors And April Adventures (2019 Wallpapers Edition)

Blooming Colors And April Adventures (2019 Wallpapers Edition)

Cosima Mielke

Starting off the new month with an inspiration boost, that’s the idea behind our monthly wallpapers series which has been going on for more than nine years already. What makes it special: the wallpapers are created by the community for the community, and everyone who has an idea for a wallpaper design is welcome to submit it — no matter if they are experienced designers or aspiring artists.

For this April edition, people from across the globe once again took on the creative challenge to cater for some variety on your screens. The result: a colorful collection of unique and inspiring wallpapers dedicated to the big and small joys of April. All wallpapers come in versions with and without a calendar and can be downloaded for free. Thank you to everyone who participated!

As a bonus goodie, you’ll also find a little April best-of at the end of this post. Please note that these wallpapers come from our archives, and, thus, are only available without a calendar. Enjoy!

Please note that:

  • All images can be clicked on and lead to the preview of the wallpaper,
  • You can feature your work in our magazine by taking part in our Desktop Wallpaper Calendar series. We are regularly looking for creative designers and artists to be featured on Smashing Magazine. Are you one of them?

Further Reading on SmashingMag:

Dreaming

“The moment when you just walk and your imagination fills up your mind with thoughts.” — Designed by Gal Shir from Israel.

Dreaming

Inspiring Blossom

“‘Sweet spring is your time is my time is our time for springtime is lovetime and viva sweet love’, wrote E. E. Cummings. And we have a question for you. Is there anything more refreshing, reviving, and recharging than nature in blossom? Don’t wait. Go outside and enjoy this lovely flourishing season. Let it inspire us all to rise up, hold our heads high, and show the world what we are made of. It’s time to bloom!” — Designed by PopArt Studio from Serbia.

Inspiring Blossom

April Showers

Designed by Ricardo Gimenes from Sweden.

April Showers

Gentle Blooming

“After so many months of grey winter weather, I can’t wait to feel the warmth of sun rays on my skin, to see and smell the flavor of blooming flowers and trees… Thinking about all this inspired me to create these blooming flowers in gentle warm colors.” — Designed by Yuliia Bahniuk from Ukraine.

Gentle Blooming

Spring Serenity

“My inspiration was the arrival of spring that transmits a sense of calmness and happiness through its beautiful colors.” — Designed by Margarida Granchinho from Portugal.

Spring Serenity

Egg Hunt In Wonderland

“April is Easter time and I wanted to remind us that there’s a child inside all of us. My illustration is based on the story that fills our imagination since childhood, Alice in Wonderland, and joined to one of the most traditional customs in America at this time of year, the egg hunt. That’s how we get an ‘egg hunt in wonderland’.” — Designed by Patrícia Garcia from Portugal.

Egg Hunt In Wonderland

Wonderful Things

“If you need to find anything beautiful, there is no better place than nature. Everything in nature is unique and beautiful in its own way!” — Designed by Dental Expression from Lee’s Summit, Missouri.

Wonderful Things

In The River

“Spring is here! Crocodiles search the hot and stay in the river.” — Designed by Veronica Valenzuela from Spain.

In The River

Freedom

“My choice to represent the month of April was the 25th of April in 1974 in Portugal, also known as the great revolution for freedom (‘Revolução dos Cravos’). It started with a political and social movement, which deposed the dictatorial regime of the New State. This date will always inspire us and remind us that freedom is worth fighting for and that people united are stronger than any kind of tyranny. For this reason, my project is called Freedom.” — Designed by Mirella Damasceno from Portugal.

Freedom

Signs

Designed by Tatiana Campos from Portugal.

Signs

Happy Easter!

“Celebrated all around the world in Christian tradition, April is the month of Easter. For kids Easter is about bunnies and painted eggs. Because April is also the month of early spring I chose joyful colours to give life to this lovely Easter illustration.” — Designed by Joana Duarte from Portugal.

Happy Easter!

Hanami

“Every year around April, the cherry blossom marks the beginning of spring in Japan. There is a tradition of watching this phenomenon which the locals refer to as ‘Hanami’ — flower viewing. This event occurs for a short time because of the cherry blossom’s short lifespan. The concept of Hanami reminds us that we should appreciate and even celebrate life in all its beauty and fragility while we can.” — Designed by Tetyana Malakhova from Portugal.

Hanami

Aphrodite

“Every month of our calendar is named after a god or goddess. The month of April is named after Aphrodite, the Greek goddess of love.” — Designed by Rita Falé from Portugal.

Aphrodite

From The Archives

A lot of things have inspired the community to create their April wallpapers in the past few years — be it a tasty bowl of soup on a rainy day or grabbing their bike and exploring new places. Below you’ll find some of these almost forgotten favorites. Please note that they don’t come with a calendar.

April Is The Nicest Month

“T.S. Eliot wrote in 1922 that ‘April is the cruelest month,’ but we quite disagree. April is the month when spring has finally come so nature starts blooming, providing us with more time to go out into nature and enjoy nice weather, long walks, and riding a bike. This is our message to you: go out and play. We surely will.” — Designed by PopArt Studio from Serbia.

April Is The Nicest Month

Wildest Dreams

“We love the art direction, story and overall cinematography of the ‘Wildest Dreams’ music video by Taylor Swift. It inspired us to create this illustration. Hope it will look good on your desktops.” — Designed by Kasra Design from Malaysia.

Wildest Dreams

No Winter Lasts Forever

“Here comes spring, breathing new life into the world around us.” — Designed by Norjimm Pvt Ltd from India.

No Winter Lasts Forever

April Insignia

“April — its first day reminds us that laughter makes life better. Nature also laughs, but it does so in daisies!” — Designed by Ana Masnikosa from Belgrade, Serbia.

April Insignia

Once Upon A Time

“April is the month of spring but also the month of books. ‘A book is a proof that humans are capable of doing magic.’ (Carl Sagan)” — Designed by Verónica Valenzuela from Spain

Once Upon A Time

Nikes On My Feet

“We got inspired by the song ‘Nikes on My Feet’ by Mac Miller, which was perfect for the upcoming month of April and the warm weather that spring brings. As Mac Miller said, ‘All I really need is some shoes on my feet…” — Designed by PopArt Web Design from Serbia.

Nikes On My Feet

Colors Of April

“My daughter was born in April so this month reminds me of that colorful, bright and precious moment.” — Designed by Izabela Grzegorczyk from Poland.

Colors Of April

Bad Bunny

“This bad bunny is just waiting for Easter.” — Designed by Izabela from Poland.

Bad Bunny

Springing

“It’s spring already, my favourite season! You can smell it, you can see it, you can feel it in the air. Trees blossom, the grass is smiling at the sun, everything is so eager to show itself.” — Designed by Vane Kosturanov from Macedonia.

Springing

Rainy Day

Designed by Xenia Latii from Berlin, Germany.

Rainy Day

Spring Fever

“I created that mouse character for a series of illustrations about a poem my mom often told me when I was a child. In that poem the mouse goes on an adventure. Here it is after the adventure, ready for new ones.” — Designed by Anja Sturm from Germany.

Spring Fever

Citrus Passion

Designed by Nathalie Ouederni from France.

Citrus Passion

Sweet April Showers Do Bring May Flowers

“Discover the seasonal fruits and vegetables in April: artichoke and beans walking in the rain!” — Designed by Vitaminas Design from Spain.

Sweet April showers Do bring May flowers

Ipoh Hor Fun

“Missing my hometown’s delicious ‘Kai See Hor Fun’ (in Cantonese), that literally translates to ‘Shredded Chicken Flat Rice Noodles’. It is served in a clear chicken and prawn soup with chicken shreds, prawns, spring onions and noodles.” — Designed by Lew Su Ann from Brunei.

Ipoh Hor Fun

Noisy Neighbors

Designed by Katerina Bobkova from Ukraine.

Smashing Wallpaper - April 2012

Jean-Cloud Van Damme

“Hope that this little cloud will make you laugh. Happy Fools’ Day everybody.” Designed by Marika Smirnova from Russia.

Smashing Wallpaper - April 2012

Umbrella Season

“In my neck of the woods, April means a lot of rain, and therefore a lot of umbrellas. I’ve noticed a lot of pretty unique umbrellas out there, especially when I walked to class in college. Happy Umbrella Season!” — Designed by Angelia DiAntonio from Ohio, USA.

Umbrella Season

Join In Next Month!

Please note that we respect and carefully consider the ideas and motivation behind each and every artist’s work. This is why we give all artists the full freedom to explore their creativity and express emotions and experience throughout their works. This is also why the themes of the wallpapers weren’t anyhow influenced by us but rather designed from scratch by the artists themselves.

Thank you to all designers for their participation. Join in next month!

Error returning a boolean from method

Hi guys,
I seem to have an issue with a boolean method returining a value. Here is the code excerpt - irrelevant code omitted:

public class StreamsTest {

    public static void main(String[] args) {
        String[] arr = new String[]{"a", "b", "c"};         
        //convert array to string with streams
        List<String> list = Arrays.stream(arr).collect(Collectors.toList());        
        isElementInIt(list);   
    }

    static boolean isElementInIt(List<String> list) {
        if(list.isEmpty()) {
            return false;
        }
        else {
            for (String string : list) {
                if (string.contains("a")) {
                    return true;
                }
                else {
                    return false;
                }
            }
        }       
    }
}

STS says that the isElementInIt method should return a boolean value, but it's already doing that whatever happens, so I'm not too sure why the error. Any idea?
thanks

UPS tracking – make a field be a link to the ups tracking website

I have to take over a php project and I am totally new to php. I have this webpage that displays all packages sent to a customer and I want them to be able to click on the tracking number to do UPS website tracking.

The code:

<?php

$result = mysqli_query($conn, $sql);

if (!$result) {

    exit();
} else {

    if (mysqli_num_rows($result) > 0) {
        while ($row = mysqli_fetch_assoc($result)) {

            echo "<tr>";

            echo "<td><strong>";
            echo $row['trackingno'];
            echo "</td>";
            echo "<td>";
            echo $row['date_shipped'];
            echo "</td>";
            echo "<td>";
            echo $row['desc_reference2'];
            echo "</td>";
            echo "<td>";
            echo $row['status'];
            echo "</td>";
            echo "<td>";
            echo $row['date_delivered'];
            echo "</td>";

            echo "</tr>";
        }
    } else {
        echo "There are no Returns matching search!";
    }
}
?>

I need the "trackingno" to display the number but be able to clik on it and be a link to
http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=trackingno

Any suggestions will be highly apprecited.

Sort according to frequency

    //With this method, I input a string and return an array that contains a sorted list of characters as per the frequency. Eg: If i input "apple", the out put should be p,a,l,e, How do I do this?

   public static ArrayList<Character> characterFreqDist(String statement)
{
  char[] Array = statement.toCharArray();
  int length = Array.length;
  int most_frequent_count = 0;
  char most_freq_character = '\0';
  char[] Final_Array = new char[length];

  ArrayList<Character> Sorted_Array = new ArrayList<Character>();

  for(int loop = 0 ; loop<length ; loop++)
  {
      most_freq_character = '\0';
      most_frequent_count = 0;
  for(int i = 0; i<length ; i++)
        { 
            char single_character = Array[i] ;

            int counter = 0;

            for(int j = 0; j<length ; j++)
            {
                if (single_character == Array[j])
                {
                    counter++;
                } 
            }
                if (counter > most_frequent_count)
                {
                    most_frequent_count = counter;
                    most_freq_character = single_character;
                }                   

      }

      Sorted_Array.add(most_freq_character);

                int index = 0;
                for (int k = 0; k < length; k++)
                {
                    if(Array[k] != most_freq_character)
                    Final_Array[index++] = Array[k];
                }

      Array =  Final_Array.clone();

      length = Array.length;

    }
    return Sorted_Array;
}

Akka Stream: Map And MapAsync

In this post, we will discuss what are “map” and “mapAsync” when used in the Akka stream and how to use them.

The difference is highlighted in their signatures:-

Pure Components in React

Pure components were introduced in React 15.3. React.Component and React.PureComponent differ in implementing the shouldComponentUpdate() lifecycle method. The shouldComponentUpdate() method decides the re-rendering of the component by returning a boolean. In React.Component, it returns true by default. But in pure components, shouldComponentUpdate() compares if there are any changes in state or props to re-render the component.

Here I am sharing my observations about how unnecessary renders are reduced by the pure component.

Client-Side vs. Cloud-Side Execution for Mobile Test Automation

One of the requirements of using Appium for mobile test automation is to start the Appium server in the background so that it can listen to the requests from the mobile app under test. And there are multiple ways that we can install and start the Appium server in the background.

While running Appium tests from a local machine, we have to launch the Appium server on a specific port and update the desired capabilities to point to the server running locally. But there should be a better way to handle these and avoid extra work on desired capabilities. Fortunately, cloud-based app testing platforms like Bitbar provide the ways to run Appium client-side as well as cloud-side. In this post, we will compare the client-side and cloud-side Appium and see both sides of the coin.

Scroll-Linked Animations

You scroll down to a certain point, now you want to style things in a certain way. A header becomes fixed. An animation triggers. A table of contents appears. To do anything based on scroll position, JavaScript is required right now. You watch the scroll position via a DOM event and alter an element's styling based on that position. Or, probably better if you can, use IntersectionObserver. We just blogged about all this.

Now there is a new (unofficial) spec trying to bring these possibilities to CSS. I love it when web standards get involved because it sees authors like us trying to pull off certain design effects and wants to (presumably) help make it easier and more performant. I also like how this spec lists editors from Mozilla and Google and Apple.

I wonder how they'll handle the infinite-loop stuff here. Like you scroll to a point, it triggers some animation, which moves some element such that it changes the scroll position, which stops the animation, which moves the scroll position again... etc. I also wonder why it's all specific to animation. "Scroll-position styling" seems like it would have the widest appeal and use level of usefulness.

Direct Link to ArticlePermalink

The post Scroll-Linked Animations appeared first on CSS-Tricks.