Normal view

There are new articles available, click to refresh the page.
Today — 2 May 2024Main stream

How to Personalize Your Blog Like These 10 Top Bloggers

The post How to Personalize Your Blog Like These 10 Top Bloggers appeared first on ProBlogger.

How to Personalize Your Blog Like These 10 Top Bloggers

Lots of bloggers seem to do everything right, yet they don’t see much success.

They write well-structured posts, they pay attention to SEO, they know the ins and outs of their blogging software … but something’s lacking.

That missing “something” can often be personality. It’s the difference between a blog that readers come across and instantly forget … and a blog that makes a connection and an impact.

Does your blog need a bit of extra personalisation? Here’s how ten top bloggers make their blogs stand out:

#1: Include Great Photos, like Caz and Craig from YTravel

Blog: YTravel

Some blogging topics pretty much demand great photos. Travel is one of those (and others include food, craft and fashion blogging).

How to Personalize Your Blog Like These 10 Top Bloggers

Caz and Craig post gorgeous, smiley photos of their family. Some of these are simple candid snapshots, like in 17 Tips for Flying With Kids to Keep You Calm and Happy, and others are a little more posed, like the photos in Getting Settled in the USA + Where to Next.

Lessons learned:

#2: Add Some Flair, like Pat Flynn from Smart Passive Income

Blog: Pat Flynn

As soon as you visit Pat’s blog, you see huge text of his name and photos of him with what he’s about – “father, husband, serial entrepreneur” – as well as his quirky humour: “protector of baby yoda”.

How to Personalize Your Blog Like These 10 Top Bloggers

Lessons learned:

  • Don’t be afraid to go big! That might mean a huge photo of yourself, a bold statement, or an About page that’s filled with images.
  • Talk about who you are beyond blogging: Pat lists his favourite book, movie and game, and writes about his family on his About page.

#3: Develop a Strong, Identifiable Tone, like Shannon Kelly White [language warning]

Blog: Shannon Kelly White

Salty language tends to polarise readers: some love it and find it a big part of a blog’s appeal; others will be put off and won’t return. Shannon swears – frequently and enthusiastically – on her blog (even in her tagline and navigation menu):

How to Personalize Your Blog Like These 10 Top Bloggers

Lessons learned:

#4: Get Custom Illustrations, like Ramsey from Blog Tyrant

Blog: Blog Tyrant

As soon as you visit Blog Tyrant, you’ll see the red-shirted blogging super-hero avatar: this illustration features in the banner image on the home page, and in the feature images for several of his posts:

How to Personalize Your Blog Like These 10 Top Bloggers

It’s also on the front cover of his free report.

Lessons learned:

  • Custom illustrations can create a sense of consistency across your blog. Blog Tyrant’s not the only blogger who uses them in this way: Social Media Examiner have their little jungle explorer in their header and at the start of each post.
  • If you’re not comfortable including personal photos, a cartoon version of you can be a great alternative.

#5: Focus on your ‘About Page’, like Elsie and Emma from A Beautiful Mess

Blog: A Beautiful Mess

New readers may land on any post on your blog … and you can bet if they like it they’ll be checking out who the blogger is behind the post, by clicking on your “About” page next.

It can help to give them a quick glimpse into who you are and what you’re all about. Sisters Elsie and Emma do this stylishly with a bright, bold photo and short but cacthy introduction.

How to Personalize Your Blog Like These 10 Top Bloggers

Lessons learned:

  • An “About me” widget in your sidebar is a great place to create an instant connection with your reader. Include a link to your full About page too.
  • Happy, smiley photos of you are always a great draw. Some bloggers include these in the header, but the sidebar is a great alternative.

#6: Be Consistent With Your Branding Across Platforms, like Chris Ducker

Blog: Chris Ducker

Chris Ducker uses the same (smiling) headshots on each of his blog post images, his About page, Twitter, Facebook and LinkedIn, creating a consistent brand across multiple platforms:

How to Personalize Your Blog Like These 10 Top Bloggers

Lessons learned:

  • If you’ve gone to the time and expense of getting professional headshots done, use them – not just in your banner image, but on social media too.
  • You may want to have variations on your headshot, from the same shoot (compare Chris’s front page image with his About page headshot, for instance).

#7: Use Color to Boost Your Brand, like Jadah Sellner

Blog: Jadah Sellner

When you visit Jadah’s site, your eyes are instantly drawn to her beautiful color scheme:

How to Personalize Your Blog Like These 10 Top Bloggers

The colours of her clothes tie in with the color theme of the site: it feels like everything fits together seamlessly. (The whole combination feels like a warm, earthy makeup palette)

Lessons learned:

  • Color matters! Perhaps bright colours aren’t quite right for your blog, but you can still create a similar banner image that takes colours from a photo of you and uses them for text and other elements.
  • Use color consistently across your site: check out Jadah’s contact page for some examples.

#8: Use a Brand Statement in Your Content, like James Schramko from SuperFastBusiness

Blog: SuperFastBusiness

The first thing you see on James Schramko’s site is a brand statement calling out his business coaching services and who they’re for. Instantly, it’s clear what he’s all about and – crucially –what kind of audience/customer he’s making content for.

How to Personalize Your Blog Like These 10 Top Bloggers

Lessons learned:

  • Don’t be afraid to be direct and let people know exactly what you’re about and who you’re blogging for.
  • Make sure, though, your focus isn’t just on yourself and your own story but on how you can have an impact on readers’ lives.

#9: Have a Tagline and “Call to Action” that Cuts Straight to the Chase, like Kelly Exeter

Blog: Kelly Exeter

If you can tell your ideal readers, in just a few words, that your blog is exactly the right place for them:

(Your name) is a (what you do) who helps (your ideal reader)… (do what you offer).

And if you have something to offer, get your readers to take action straight away… There’s no use putting them through some complicated email subscription auto-responder series, just get them to click a button and “FIND OUT HERE” what you can do for them.

Like Kelly:

How to Personalize Your Blog Like These 10 Top Bloggers

Lessons learned:

  • Think about your tagline as who you serve (“smart people”) and what your blog will help those people do (“amplify their ideas”).
  • Add a compelling call to action that gives your audience immediate access to what they came to your blog for in the first place

#10: Personalise Your Reader by Defining Them (or Helping them Define Themselves)

Blog: Puttylike

Emily has a TedTalk that identifies her personality type as a “Multipotentialite” and she creates an audience of people who identify with her definition.

The genius move by Emily is that on her home page she uses a quiz as a lead-magnet (“Are You a Multipotentialite?”) to convert random visitors to her site into repeat readers.

 

How to Personalize Your Blog Like These 10 Top Bloggers

Lessons learned:

  • Define your audience. Help your audience define themselves. Use a quiz or questionnaire.
  • Develop a lead magnet that converts web traffic into an audience for your blog and put that front and centre.

How are you currently showing your personality on your blog? Did anything resonate with you as you looked at the above examples … and what will you try next?

The post How to Personalize Your Blog Like These 10 Top Bloggers appeared first on ProBlogger.

Gradle Version Mismatch with Java Build

  1. My Gradle Wrapper settings are the following:
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
  1. From the Compatibility Matrix in Gradle - it seems I can install Java Version 17? I used Eclipse Temurin 17.0.5 to work with it. I also have the following in my build.gradle file
java {
    toolchain {
        languageVersion.set(JavaLanguageVersion.of(17))
    }
}
  1. I am getting error "Unsupported Class File Major Version 61"

I am running everything from command line (MacOS terminal). What do I have to do to get the ./gradlew build working successfully?

Regards,

Is watchOS Application Context a two-way thing?

Our iPhone app has a Watch Extension, and it needs to send some data to the Watch as well as receive some data.

I'm confused on how this is supposed to work. If the iPhone sends an updateApplicationContext with data A, the Watch receives it, and then the Watch sends another updateApplicationContext with data B, does the call from the Watch override the previous call? Is A now replaced by B? The alternative would be that these are two channels, one channel for iPhone-to-Watch, and one for Watch-to-iPhone.

My tests seem to indicate that it's one channel. When calling updateApplicationContext on the Watch, it changes the Application Context on both devices, and it seems that the Watch receives a didReceiveApplicationContext event (even though it was the Watch that updated the data).

If this is true, then how are we supposed to avoid race conditions while updating the data? If the iPhone sends some data A, and the Watch wants to transfer some data B, how can we avoid data loss because the Watch overrides A by B? Can we separate the data by having two subnodes on the data, like:

context = {
  phone2Watch = {...},
  watch2Phone = {...},
}

I know I can use other means of data transfer, like UserInfo or sendMessage, but I'm specifically interested in the App Context mechanism.

What are all the special characters listed in any language?

sequential token language?

``! @ # $ % ^ & * ( !)
!! !@ !# !$ !% !^ !& !* !( @)
@! @@ @# @$ @% @^ @& @* @( #)
#! #@ ## #$ #% #^ #& #* #( $)
$! $@ $# $$ $% $^ $& $* $( %)
%! %@ %# %$ %% %^ %& %* %( ^)
^! ^@ ^# ^$ ^% ^^ ^& ^* ^( &)
&! &@ &# &$ &% &^ && &* &( *)
*! *@ *# *$ *% *^ *& ** *( ()
(! (@ (# ($ (% (^ (& (* (( !))``

The problem was understanding this index(cubic)?

This is the language for compiler. bash python Perl?

I wanted to know what you thought.

If there is any language out there that has all listed like Perl-Ish if not to create a new one ?

I am expecting to develop an answer about the language if there is one out there?

How to change the size of a Shadcn dialog component?

I have a dialog component from shadcn which contains something that is wider than the actual dialog. I have been trying to apply tailwind styles such as w-[full] to the but that seemed to not do anything. Is there a way to change the size of the actual dialog that pops up? I will paste my code. Thanks!

Shadcn - https://ui.shadcn.com/docs/components/dialog

Here is a photo of my design. Design

'use client';

import React, { useState } from 'react';
import CollapseCardFeatures from './_components/Cards';
import Quizmodal from './_components/QuizModal';

import {
  Dialog,
  DialogContent,
  DialogDescription,
  DialogFooter,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from "@/components/ui/dialog"

const Page: React.FC = () => {

  return (
    <div className='w-full h-full relative'>
      <CollapseCardFeatures />
      <section className='w-full h-full flex justify-center py-5'>
        <Dialog>
            <DialogTrigger asChild>
                <div className="group relative w-fit transition-transform duration-300 active:scale-95">
                <button className="relative z-10 rounded-lg bg-gradient-to-br from-indigo-500 to-fuchsia-500 p-0.5 duration-300 group-hover:scale-110">
                    <span className="block rounded-md bg-slate-950 px-4 py-2 font-semibold text-slate-100 duration-300 group-hover:bg-slate-950/50 group-hover:text-slate-50 group-active:bg-slate-950/80">
                    Take Quiz
                    </span>
                </button>
                <span className="pointer-events-none absolute -inset-4 z-0 transform-gpu rounded-2xl bg-gradient-to-br from-indigo-500 to-fuchsia-500 opacity-30 blur-xl transition-all duration-300 group-hover:opacity-90 group-active:opacity-50" />
                </div>
            </DialogTrigger>
            <DialogContent className="w-full">
                <Quizmodal />
            </DialogContent>
        </Dialog>
        </section>
    </div>
  );
}

export default Page;


Machine Learning - Neural Network

I am a beginner. I am trying to create a neural network with one hidden layer that will classify images into 12 different classes. When I try to run the code using my gradient descent function to start training the model, the code does not output anything at all and moves to the next cell.

def initialize_parameters(hidden_units):
    w1 = np.random.randn(hidden_units, 640 * 480 * 3) * 0.01
    b1 = np.zeros((hidden_units, 1))
    w2 = np.random.randn(12, hidden_units) * 0.01
    b2 = np.zeros((12, 1))
    return w1, b1, w2, b2

def ReLU(Z):
    return np.maximum(0, Z)

def softmax(Z):
    expZ = np.exp(Z)
    return expZ / np.sum(expZ, axis=0, keepdims=True)

def forward_propagation(w1, b1, w2, b2, X):
    z1 = np.dot(w1, X) + b1
    a1 = ReLU(z1)
    z2 = np.dot(w2, a1) + b2 
    a2 = softmax(z2)
    return z1, a1, z2, a2  

def onehotencoding(Y): 
    one_hot_Y = np.zeros((Y.size, Y.max() + 1))
    one_hot_Y[np.arange(Y.size), Y] = 1
    one_hot_Y = one_hot_Y.T
    return one_hot_Y

def derivativeReLU(Z): 
    return Z > 0

def back_propagation(w2, a1, z1, a2, X, Y):
    m = Y.size 
    one_hot_Y = onehotencoding(Y)
    dz2 = a2 - one_hot_Y
    dw2 = 1 / m * np.dot(dz2, a1.T)
    db2 = 1 / m * np.sum(dz2, axis=1, keepdims=True)
    dz1 = np.dot(w2.T, dz2) * derivativeReLU(z1)
    dw1 = 1 / m * np.dot(dz1, X.T)
    db1 = 1 / m * np.sum(dz1, axis=1, keepdims=True)
    return dw1, db1, dw2, db2 

def update_parameters(w1, b1, w2, b2, dw1, db1, dw2, db2, alpha): 
    w1 = w1 - alpha * dw1 
    b1 = b1 - alpha * db1 
    w2 = w2 - alpha * dw2 
    b2 = b2 - alpha * db2 
    return w1, b1, w2, b2

This cell of code ends here and is followed by this block of code.

def get_predictions(a2): 
    return np.argmax(a2, axis=0)

def get_accuracy(predictions, Y): 
    return np.sum(predictions == Y) / Y.size

def gradient_descent(X, Y, hidden_units, iterations, alpha): 
    w1, b1, w2, b2 = initialize_parameters(hidden_units)
    for i in range(iterations): 
        z1, a1, z2, a2 = forward_propagation(w1, b1, w2, b2, X)
        dw1, db1, dw2, db2 = back_propagation(w2, a1, z1, a2, X, Y)
        w1, b1, w2, b2 = update_parameters(w1, b1, w2, b2, dw1, db1, dw2, db2, alpha)
        if i % 10 == 0: 
            predictions = get_predictions(a2)
            accuracy = get_accuracy(predictions, Y)
            print("Iteration: ", i)
            print("Accuracy: ", accuracy)
    return w1, b1, w2, b2

This is the gradient descent function to start the training.

w1, b1, w2, b2 = gradient_descent(X_train, Y_train, 500, iterations=1000, alpha=0.1)

Probleme with if elif that always return the same value in python

i'm new in coding and I got in touble. I tried to create a code that asks question about the Child-Pugh score. But answer_child always return [] and total return always 1. here is the code :

from random import *

child = []
x =["Absente", "Stade 1", "Stade 2", "Stade 3", "Stade 4"]
y = ["Absente", "Discrète", "Abondante"]
encephalopathie = choice(x)
ascite = choice(y)
bilirubine = randint(15,70)
albumine = randint(15, 45)
TP = randint(5, 80)
total = 0
if TP > 50 :
    total =+1
elif 40 <= TP <= 50 :
    total =+2
elif TP < 40 :
    total =+3


if albumine > 35 :
    total =+1
elif 28 <= albumine <= 35 :
    total =+2
elif albumine < 28 :
    total =+3

if bilirubine < 35 :
    total =+1
elif 35 <= bilirubine <= 50 :
    total =+2
elif bilirubine > 50 :
    total =+3

if encephalopathie == ["Absente"] :
    total =+1
elif encephalopathie == ["Stade 1", "Stade 2"] :
    total =+2
elif encephalopathie == ["Stade 3", "Stade 4"]:
    total =+3

if ascite == ["Absente"] :
    total =+1
elif ascite == ["Discrète"] :
    total =+2
elif ascite == ["Abondante"]:
    total =+3

if 5<= total <= 6 :
    child = ["A"]
elif 7 <= total <= 9 :
    child = ["B"]
elif total >= 10 :
    child = ["c"]

print('Tp =', TP, "Bilirubine =", bilirubine, "Albumine =", albumine, "Ascite =", ascite, "Encephalopathie =", encephalopathie)
answer_int = input("Quel est la cotation du score en chiffre ?")
int(answer_int)
answer_child = input("Quel est le score de Child-Pugh ? A, B ou C ?")


if answer_child == child and answer_int == total :
    print("Vrai")
else :
    print("Faux, la bonne réponse est Child",child, total)

I tried to change the last elif with else, but didn't work out.

thanks for your help

SQLite database locking even with threading.Lock

I use sqlite3 database on my flask website, and on each database access I use a threading.Lock in order to avoid memory races:

# one sync, one connection, one cursor for the entirety of the website
sync = threading.Lock()
connection = sqlite3.connect('db', check_same_thread = false)
cursor = connection.cursor()
#...
with sync:
    cursor.execute(...) # just .execute(), i do not use .commit()

It works fine, when I use it on a localhost as a bare flask server. Even when I spam it with lots of requests, where each request has to access a database (and not once), it doesn't break. However, when I submit this code to a website hosting service, which uses Phusion Passenger, it generally works fine, but when I do too much requests, it results in sqlite3.OperationalError: database is locked over and over again.

What do I do wrong? I used a mutex, why does the database get locked? Does it have something to do with the fact I use just one cursor?

Encrypting process makes flutter app frozen until its done

I am making a flutter app and inside it the user can watch or download videos After downloading a video I want to encrypt it and then store it because I don't want the user to be able to share it. The encrypting process is being performed correctly however when it starts the app freezes for like 10 seconds before its finished and the app unfreezes I tried multiple encrypting methods but had the same result I read somewhere here that using "compute" methode and changing the function type to "FutureOr" can solve the problem. However, I cant seem to use it correctly. Any help would be appreciated.

  Future<void> downloadVideo(String url) async {
    var appDocDir = await getExternalStorageDirectory();
    String appDocPath = appDocDir!.path;
    String filePath = '$appDocPath/Videos/${url.split('/').last}';

    try {
      var request = await HttpClient().getUrl(Uri.parse(url));
      var response = await request.close();
      List<int> bytes = [];
      int downloaded = 0;
      int total = response.contentLength!;
      response.listen(
        (List<int> newBytes) {
          bytes.addAll(newBytes);
          downloaded += newBytes.length;
          downloadProgress.value = downloaded / total;
          print("Download progress: ${downloadProgress.value}");
        },
        onDone: () async {
          // Generate encryption key and IV
          final key = encrypt.Key.fromSecureRandom(32);
          final iv = encrypt.IV.fromSecureRandom(16);

          // Encrypt the video bytes
          final encrypter =
              encrypt.Encrypter(encrypt.AES(key, mode: encrypt.AESMode.cbc));
          final encryptedBytes = encrypter.encryptBytes(bytes, iv: iv).bytes;

          // Store the key and IV securely
          final storage = FlutterSecureStorage();
          await storage.write(key: 'key_$filePath', value: key.base64);
          await storage.write(key: 'iv_$filePath', value: iv.base64);

          // Save the encrypted video
          File file = File(filePath);
          await file.writeAsBytes(encryptedBytes);
          print("Download completed: $filePath");
        },
        onError: (e) {
          print("Error downloading video: $e");
        },
        cancelOnError: true,
      );
    } catch (e) {
      print("Error downloading video: $e");
    }
  }

How does S3 handle deletions with AWS SDK delete_objects compared to individual delete_object calls?

I'm currently optimizing a data purging task in my application, which involves deleting multiple files stored in AWS S3. I understand that delete_objects can handle up to 1000 keys per request, which suggests that it might use batch processing to enhance performance.

However, I haven't found explicit documentation or proofs confirming whether delete_objects actually performs faster than individual delete_object calls for the same number of files. Specifically, I'm interested in understanding:

  1. Whether delete_objects uses parallel processing or other efficiencies that significantly reduce the operation time compared to multiple single delete_object calls.
  2. How the operation time might scale when deleting different numbers of keys (e.g., 100 vs. 1000 keys).

Does anyone have benchmarks, insights from AWS documentation, or personal experiences that could clarify how delete_objects optimizes these deletions?

Ngx-stripe or stripe.js looking for @sentry modules, but latest @sentry version doesn't have needed files, do I need @sentry?

I'm using ngx-stripe and when I mount an element I get a bunch of node errors.

It seems that the latest version of ngx-stripe or @stripe/stripe.js is looking for @sentry node modules and I don't have them installed. I might have recently removed it by accident when I upgraded node and all modules to 17. I kinda performed a brut upgrade by deleting node_modules and then installing all latest, while removing some along the way (ones I thought weren't needed!)

After looking in the @sentry repo the latest version doesn't contain any of the files throwing errors (see below). I have to go back to version 6.16.1 to get the files.

Question - Generally speaking, do I need @sentry, what is it for and why is ngx-stripe and/or @stripe/stripe.js using it? I can run the ngx-stripe component, do what I need to do and there's no issues/errors to use the component. Can I suppress these errors or will that come back to bite me in the ass later on?

Files missing:

Could not read source map for file:///Users/charles/yogabandy/client/node_modules/%40sentry/core/esm/integration.js: ENOENT: no such file or directory, open '/Users/charles/yogabandy/client/node_modules/@sentry/core/esm/integration.js.map'

Could not read source map for file:///Users/charles/yogabandy/client/node_modules/%40sentry/browser/esm/transports/base.js: ENOENT: no such file or directory, open '/Users/charles/yogabandy/client/node_modules/@sentry/browser/esm/transports/base.js.map'

How do I show the max value of a column and show all rows using Oracle SQL

I have a table POLICIES that has data like this:

POLICY NAME  VERSION NUMBER
Policy ABC   1.0
Policy ABC   1.1
Policy ABC   2.0
Policy DEF   1.0
Policy DEF   1.5
Policy GHI   1.0
Policy GHI   2.0
Policy GHI   3.2

What I'm wanting to see is the latest (highest) version number in a separate column, so I know what is current. The assumption being that the highest version number is the current version.

POLICY NAME  VERSION NUMBER  CURRENT VERSION
Policy ABC              1.0              2.0
Policy ABC              1.1              2.0
Policy ABC              2.0              2.0
Policy DEF              1.0              1.5
Policy DEF              1.5              1.5
Policy GHI              1.0              3.2
Policy GHI              2.0              3.2
Policy GHI              3.2              3.2

My SQL skills are basic to say the least, and so far the closest I've come is this:

select Policy_Name, Version_Number, max(Version_Number) AS Current_Version
from POLICIES
group by Policy_Name, Version_Number;

which gives me this:

POLICY NAME  VERSION NUMBER  CURRENT VERSION
Policy ABC              1.0              1.0
Policy ABC              1.1              1.1
Policy ABC              2.0              2.0
Policy DEF              1.0              1.0
Policy DEF              1.5              1.5
Policy GHI              1.0              1.0
Policy GHI              2.0              2.0
Policy GHI              3.2              3.2

I'm thinking I want a subquery to find the max value for each policy_name, but I can't quite figure it out.

Where have I gone wrong in my Python code to solve the Travelling Salesperson problem?

The question I'm looking to answer on Python (on Jupyter notebooks) is:

Write a general-purpose function travelling_salesperson that takes as input a matrix M of coordinates and returns a tour of the places that has minimal distance using the ad hoc approach described in Subsection 3.1 of Unit 10IP. (Hint: your find_route function from part (b)(iii) should be useful.)

I was asked to create the functions create_places and find_route in a previous question and use them for the travelling_salesperson function.

I have used the code below but I am getting an error code. I believe the error is coming from adding the ad hoc constraints. Where have I gone wrong?

def create_places(N):
    #create random number generator
    rng = np.random.default_rng()
    
    #random x and y coordinates for N places
    x_coordinates = rng.uniform(size = N)
    y_coordinates = rng.uniform(size = N)
    
    #matrix for x and y coordinates
    places = pd.DataFrame({'x': x_coordinates, 'y': y_coordinates})
    
    return places

def find_route(places, df):
    route = [places.index[0]]  # Starting point as first place
    current_place = places.index[0]
    while len(route) < len(places):
        for j in range(len(places)):
            # using solution from ad hoc approach
            if current_place != places.index[j] and df.loc['result', f'y{places.index.get_loc(current_place)}{j}'] > 0.5:
                route.append(places.index[j])
                current_place = places.index[j]
                break
    route.append(route[0])  # Return to starting point
    return route  # route list

def travelling_salesperson(places):
    N = len(places)
    M = cdist(places[['x', 'y']], places[['x', 'y']], 'euclidean')
    
    # create columns with variable names
    columns = []
    for i in range(N):
        for j in range(N):
            if i == j:
                continue
            columns.append(f'y{i}{j}')

    columns.append('b')

    df = pd.DataFrame(columns=columns)

    for i in range(N):
        for j in range(N):
            if i == j:
                continue
            df.loc['c', f'y{i}{j}'] = M[i, j]
            df.loc[f'start {i}', f'y{i}{j}'] = 1
            df.loc[f'end {i}', f'y{j}{i}'] = 1
        df.loc[f'start {i}', 'b'] = 1
        df.loc[f'end {i}', 'b'] = 1

    df = df.fillna(0)

    A = df.drop(index='c').drop(columns='b').to_numpy()
    b = df.drop(index='c')['b'].to_numpy()
    c = df.drop(columns='b').loc['c'].to_numpy()

    bds = [(0, 1)] * len(c)
    variable_types = [1] * len(c)
    result = linprog(c, A_eq=A, b_eq=b, bounds=bds,
                     integrality=variable_types)
    print(result.message)
    print(f'Optimal tour has distance {result.fun}')

    # add result to data frame (add nan for b column)
    df.loc['result'] = np.append([round(n) for n in result.x], np.nan)
    
    

    
    ad_hoc_count = 0
    while True:
        # Identify subtours
        subtours = []
        visited = set()
        for i in range(N):
            for j in range(N):
                if i == j:
                    continue
                if df.loc['result', f'y{i}{j}'] > 0.5 and i not in visited:
                    subtour = [i]
                    visited.add(i)
                    current = j
                    while current != i:
                        subtour.append(current)
                        visited.add(current)
                        for k in range(N):
                            if f'y{current}{k}' in df.columns and df.loc['result', f'y{current}{k}'] > 0.5:
                                current = k
                                break
                    subtours.append(subtour)

        print("Subtours:", subtours)
        
        if len(subtours) == 1 and len(subtours[0]) == N:
            # No subtours found, optimal solution reached
            break
    
        # Add ad hoc constraint to connect one subtour to others
        if len(subtours) > 1:
            # Select one subtour
            selected_subtour = subtours[0]

            # Create a new constraint row
            constraint_row = pd.Series(0, index=df.columns)

            # Add constraint to connect selected subtour to other subtours
            for i in selected_subtour:
                for j in range(N):
                    if j not in selected_subtour:
                        constraint_row[f'y{i}{j}'] = -1
                        constraint_row[f'y{j}{i}'] = -1

            constraint_row['b'] = -1

            # Add the new ad-hoc constraint to the DataFrame
            df.loc[f'ad hoc {ad_hoc_count}'] = constraint_row
            ad_hoc_count += 1
                
            df = df.fillna(0)
        
        # Solve the updated problem with ad hoc constraints
        A = df.drop(index='c').drop(columns='b').to_numpy()
        b = df.drop(index='c')['b'].to_numpy()
        c = df.drop(columns='b').loc['c'].to_numpy()
        result = linprog(c, A_eq=A, b_eq=b, bounds=bds, integrality=variable_types)
        
        df = df.fillna(0)
        
        print("A matrix:")
        print(A)
        print("b vector:")
        print(b)
        print("c vector:")
        print(c)
        print("DataFrame:")
        print(df)
        
        print(result.message)
        print(f'Optimal tour has distance {result.fun}')

        # Update the result in the data frame
        df.loc['result'] = np.append([round(n) for n in result.x], np.nan)
        
        
    route = find_route(places, df)
    
    return route

N = 5  # Number of places
places = create_places(N)
route = travelling_salesperson(places)
print('Route:', route)

The error code I got is:

TypeError                                 Traceback (most recent call last)
Cell In[11], line 142
    140 N = 5  # Number of places
    141 places = create_places(N)
--> 142 route = travelling_salesperson(places)
    143 print('Route:', route)

Cell In[11], line 133, in travelling_salesperson(places)
    130     print(f'Optimal tour has distance {result.fun}')
    132     # Update the result in the data frame
--> 133     df.loc['result'] = np.append([round(n) for n in result.x], np.nan)
    136 route = find_route(places, df)
    138 return route

TypeError: 'NoneType' object is not iterable

Sort List in Alphanumeric Order

Editing for more context:

I'm trying to sort a list after zip.

list_sort= zip(l1, l2)

l1 = ['F2', 'G2', 'A10', 'H2', 'A3', 'E3', 'B10', 'C1', 'D1', 'E1', 'D2', 'C11', 'A1']
l2 = [40, 40, 90, 90, 90, 90, 90, 120, 120, 120, 120, 120, 90]

I'm looking to sort l1 in this order:

l1 = ['A1', 'C1', 'D1', 'E1', 'D2', 'F2', 'G2', 'H2', 'A3', 'E3', 'A10', 'B10', 'C11']

l2 will sort with l1

l2 = [90, 120, 120, 120, 120, 40, 40, 90, 90, 90, 90, 90, 120]

What I have tried:

list(sorted(list_sort, key=lambda item: (item[0][1], item[0][1:0])))

Excel Ribbon comboBox: always show highlighting (Win) / checkmark (Mac)

The following code allows you to select from three paper sizes using a comboBox in a custom Ribbon.

There's only one issue regarding the highlighting of the selected item (Excel Mac uses a checkmark). Right now, upon closing and reopening the workbook, the highlighting disappears. You have to select an item for it to reappear.

Is it possible to always show the highlighting (checkmark)? So that it behaves like for example the font size box?

Thanks!

' -- XML

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="LoadRibbon">
    <ribbon>
        <tabs>
            <tab id="Tabv3.1" label="TOOLS" insertAfterMso="TabHome">                                             
                <group id="GroupDemo2" 
                label="SelectPapersize"
                imageMso="AddInManager">
                    <comboBox id="ComboBox001"
                    label="comboBox001"
                    getText="ComboBox001_GetText"
                    onChange="ComboBox001_OnChange">
                        <item id="Item_A3"
                        label="A3"/>
                        <item id="Item_A4"
                        label="A4"/>
                        <item id="Item_A5"
                        label="A5"/>
                    </comboBox>
                </group>   
            </tab>
        </tabs>
    </ribbon>
</customUI>


' -- Callback VBA in Module "RibbonCallbacks"

Option Explicit
Public RibUI As IRibbonUI
Public Const myApp As String = "RibbApp", mySett As String = "Settings", myVal As String = "Value"

Sub LoadRibbon(Ribbon As IRibbonUI)
    Set RibUI = Ribbon
    RibUI.InvalidateControl "ComboBox001"
End Sub

'Callback for ComboBox001 onChange
Sub ComboBox001_OnChange(control As IRibbonControl, id As String)
    Select Case id
        Case "A3"
             ActiveSheet.PageSetup.PaperSize = xlPaperA3
        Case "A4"
            ActiveSheet.PageSetup.PaperSize = xlPaperA4
        Case "A5"
            ActiveSheet.PageSetup.PaperSize = xlPaperA5
    End Select
    RibUI.InvalidateControl "ComboBox001"
    SaveSetting myApp, mySett, myVal, id
End Sub

'Callback for ComboBox001 getText
Sub ComboBox001_getText(control As IRibbonControl, ByRef returnedVal)
  Dim comboVal As String
    comboVal = GetSetting(myApp, mySett, myVal, "No Value") 
    If comboVal <> "No Value" Then
      returnedVal = comboVal
    End If
End Sub


' -- VBA in "ThisWorkbook"

Private Sub Workbook_Open()

End Sub

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
    Dim idx As String
    Select Case PaperSize
    Case "xlPaperA3"
        idx = "A3"
    Case "xlPaperA4"
        idx = "A4"
    Case "xlPaperA5"
        idx = "A5"
    End Select
    SaveSetting myApp, mySett, myVal, idx
    RibUI.InvalidateControl "ComboBox001"
End Sub

Rob Marciano Divorce: What Led to the GMA Meteorologist’s Firing?

As you may have heard, Rob Marciano is no longer an ABC employee.

The long-time meteorologist was let go by the network on Tuesday, although neither Marciano nor anyone affiliated with the network has spoken in public about the reason why just yet.

Marciano had been with ABC News since 2014, although was banned from the network studio in New York City last year for a period of one month… reportedly due to inappropriate behavior.

Rob Marciano picture
Rob Marciano is out and about here in his role as a weatherman. (ABC)

“He was found to have done something … that was improper, but he was punished for it, and they still haven’t let him return,” an insider told Page Six in March 2023.

Even during this punishment, Marciano continued to report on the weather from other locations.

It was an unusual situation.

And many observers believe it was related to the journalist’s divorce.

Rob Marciano on Good Morning America
Rob Marciano has been let go from ABC and Good Morning America. (WALT DISNEY TELEVISION/LORENZO BEVILAQUA)

The news of his firing, you see, comes two years after his ex-wife Eryn Marciano filed for divorce after 11 years of marriage.

Eryn, an Atlanta native, is a successful real estate agent who started her career as a mortgage loan originator.

The couple sold its $2.7 million house the same month they announced their split, a decision Marciano admitted back then was made by his former spouse.

“The last couple of years have been very difficult. I didn’t want this and tried to save the marriage, but we are sadly divorcing,” the then-ABC employee said at the time, adding:

“My focus now is on my kids.”

Rob Marciano on air
Rob Marciano out and about while on the air. (ABC)

Indeed, the exes share a daughter named Madelynn, 12; and a son named Mason, six.

The family took a vacation to Disney World together, even as Rob and Eryn were going through their divorce.

“Spring Break @waltdisneyworld — thru the chaos was much needed kiddos quality time — their joy is as we say #magical,” Marciano wrote as a caption to a group photo in April 2022.

You can check it out here:

Still, despite the pair seemingly being on good terms… Marciano took the divorce hard.

Last year, Page Six reported that Rob was going through “anger” issues as a result of his split, with an insider stating in cryptic fashion:

“He made people feel uncomfortable. There was a period where there were some issues, a number of alarming events.”

We cannot verify the nature of this discomfort; we don’t know exactly what Marciano was accused of doing or if it played any role in his firing this week.

Rob Marciano at his desk
Rob Marciano at his desk on Good Morning America. (ABC)

In September 2023, though, Marciano celebrated the start of his 10th year with the network, writing via Instagram:

“I couldn’t be more pumped to continue this journey with all of you.”

“My thanks to the bosses who listened and made this work-life balance possible. I’m also grateful for an exciting new project with NatGeo that has me exploring some very very cool stuff… more to come!”

This may prove to be true.

But it won’t be at ABC.

Rob Marciano Divorce: What Led to the GMA Meteorologist’s Firing? was originally published on The Hollywood Gossip.

❌
❌