product photography – What causes color artifacts on the strings while shooting guitars?

To anyone reading this in the distant future 2021 and beoynd.

You can also remove the aliasing by capturing red, green and blue separately.

Assuming you are using a tripod, you can shoot with color filters or gels in front of the camera. (Or gels in front of strobes, but that requires a pretty dark room.)

Take one shot per red, green and blue color. Either shoot in black and white on the camera, or convert each shot to black and white in post.

Then, merge the three layers, with each layer representing red, green and blue. This can be done in Photoshop or with tools such as ImageMagick.

This will remove any aliasing, but requires that the setup is stable enough to not move the camera or subject between exposures.

The idea is not a new one.

enter image description here

python – Compare strings to markup commentary in main text

from itertools import cycle

# Integers represent Chinese characters
main_text = "234458674935346547521456767378878473562561423"
text_with_commentary = "2344586749215432678652353465475214561655413164653413216576737887847356152352561423"

iter_main = iter(main_text)
iter_comm = iter(text_with_commentary)

marked_up = ()
x = next(iter_main)
y = next(iter_comm)
i = 0
j = 0

def commentary_start():
    global x, y, i, j, marked_up

    while x == y and j < len(text_with_commentary):
        try:
            marked_up.append(y)
            x = next(iter_main)
            y = next(iter_comm)
            i += 1
            j += 1
        except: return

    marked_up.append("{{")
            
    return marked_up

def commentary_end():
    global x, y, i, j, marked_up
    while x != y:
        marked_up.append(y)
        y = next(iter_comm)
        j += 1
        
    if main_text(i+1) == text_with_commentary(j+1) and 
    main_text(i+2) == text_with_commentary(j+2):
        marked_up.append("}}")
        
    else: 
        marked_up.append(y)
        y = next(iter_comm)
        j += 1
        commentary_end()
    
    return marked_up, x, y, i, j

def mark_up_commentary():
    global marked_up
    
    while j < len(text_with_commentary):
        try:
            commentary_start()
            commentary_end()
        except:
            break
            
    marked_up = "".join(marked_up)
    
    return marked_up



mark_up_commentary()

# Expected result: "2344586749{{215432678652}}35346547521456{{16554131646534132165}}76737887847356{{15235}}2561423"

The above code compares two sets of strings, character by character, to markup commentary text that is interspersed between the main text.

The code makes use of the iterators iter_main and inter_comm to check if the next character in the commented text is the same as the next character of the main text, adding double braces to mark up commentary text that deviates from the main text at the relevant positions.

I would like to seek help to improve the code in these respects:

  1. See if the code can be made more concise and efficient.
  2. The current method is actually quite hard-coded and mechanical, which makes little room for minor deviations in the texts, which is actually unavoidable in the real world. I would hence like to know whether fuzzy text-comparison tools that make use of concepts such as Levenshtein distance can be implemented to make the code more robust and flexible.
  3. Are there good libraries to recommend for the task?

variáveis – Notice: Undefined variable: strings in /public/class-wc-lottery-pn-public.php on line 573

estou com um erro e gostaria de ajuda de alguem com este conhecimento, você teria como me ajudar?

Recebo o seguinte erro.
Notice: Undefined variable: strings in /public/class-wc-lottery-pn-public.php on line 573

public function change_order_ticket_number_to_alphabet( $html, $item, $args ){
    $product_id = $item->get_product_id();
    $product =  wc_get_product( $product_id );
    if( ! $product || get_post_meta( $product_id , '_lottery_pick_number_alphabet', true ) !== 'yes') {
        return $html;
    }
    foreach ( $item->get_formatted_meta_data() as $meta_id => $meta ) {
        if ( $meta->key === 'Ticket number' ){
            $value     = $args('autop') ? wp_kses_post( $meta->display_value ) : wp_kses_post( make_clickable( $this->change_ticket_numbers_to_alphabet(intval( $meta->value ), $product )) );
            $strings() = $args('label_before') . wp_kses_post( $meta->display_key ) . $args('label_after') . $value;
        }
    }

    if ( $strings ) {

//linha 573 $html = $args(‘before’) . implode( $args(‘separator’), $strings ) . $args(‘after’);
}

$this->raio * $this->raio;

Sabem me dizer como resolver?

random – Known strings to have the same md5 hash, not colliding in real life?

So I was reading this article about md5 hash collisions in which it clearly states that these two strings:

d131dd02c5e6eec4693d9a0698aff95c2fcab58712467eab4004583eb8fb7f8955ad340609f4b30283e488832571415a085125e8f7cdc99fd91dbdf280373c5bd8823e3156348f5bae6dacd436c919c6dd53e2b487da03fd02396306d248cda0e99f33420f577ee8ce54b67080a80d1ec69821bcb6a8839396f9652b6ff72a70

and

d131dd02c5e6eec4693d9a0698aff95c2fcab50712467eab4004583eb8fb7f8955ad340609f4b30283e4888325f1415a085125e8f7cdc99fd91dbd7280373c5bd8823e3156348f5bae6dacd436c919c6dd53e23487da03fd02396306d248cda0e99f33420f577ee8ce54b67080280d1ec69821bcb6a8839396f965ab6ff72a70

have the same md5 hash. Although testing this hypothesis with this md5 generator they do not have the same hash.

The first string hashes to edde4181249fea68547c2fd0edd2e22f meanwhile the second to e234dbc6aa0932d9dd5facd53ba0372a which is not the same.

Why is it being said that these two strings produce the same md5 hash value?

Concatenar strings com o operador +

Bom dia, estou a participar num desafio de forma a entrar num bootcamp de programação, mas encravei num exercício já à muito tempo:

Exercicio:

Concatenate, son, concatenate.
GATO FEDORENTO, Isso é tudo muito bonito mas, 2015

When you create a new string, you’re producing a value. A string is a JavaScript value, in the same way a number is. Almost anything you place between quotes will be a string. This distinction between numbers and strings is important.

Consider these two following values:

42; // a numeric value: a number
’42’; // a text value: a string

If you go ahead and print both values, they will look the same in the console, but they represent two different values within your program.

You can’t multiply or subtract two text values, but you can with two numbers, as you’ve been doing extensively in previous lessons. There is one operator, though, you can use both with strings and numbers. The + operator.

Of course you won’t be adding strings (in the arithmetic sense, at least), but you’ll be creating a new string which will be comprised of the left and right operands together.

console.log(‘bat’ + ‘man’); // outputs batman
var firstName = ‘spider’;
var secondName = ‘man’;
console.log(firstName + ‘-‘ + secondName); // outputs spider-man

This is called concatenation: we’re creating a new string by joining two previous ones.

Dealing with numbers and strings when using the + operator, may lead you to unexpected results if you’re not sure which one is assigned to the variable:

var aNumber = 2;
var aString = ‘2’;
console.log(aNumber + aNumber); // what do you think the output will be?
console.log(aString + aString); // what about now?

Exercicio

Use the strings available in the given variables to produce and print the famous Shakesperean quote (remember: spaces are characters too).

As Strings para concatenar são:
var sentence1 = ‘to be’
var sentence2 = ‘or not’

Sou obrigado a utilizar o operador + de concatenação mas infelizmente após utilizar aparece-me sempre erro! Alguém me pode ajudar?

java – Longest common prefix for set of strings

Question:
Write a function to find the longest common prefix string amongst an array of strings.

If there is no common prefix, return an empty string “”.

Example :

Input: strs = ("flower","flow","flight")
Output: "fl"

Source: https://leetcode.com/problems/longest-common-prefix/

My Code:

public String longestCommonPrefix(String() strs) {
        StringBuilder lcp = new StringBuilder();

        
        //compute min length 
        int minLength = Integer.MAX_VALUE;
        for(String str:strs){
            
            if (str.length() < minLength) {
                minLength = str.length();
            }
            
        }
            
        for (int i = 0; i < minLength;i++){
            char cmp = strs(0).charAt(i);
        for(String str:strs){
            
            if (str.charAt(i) != cmp) {
                return lcp.toString();
             }
            
           }
          lcp.append(cmp);
        }
        
        return lcp.toString();
    }

Questions:

  1. Current time complexity is O(mn) where n is number of strings and m is the min string length.
    Can it be faster?
  2. How to improve code style in general.

c# – Combine strings – Code Review Stack Exchange

c# – Combine strings – Code Review Stack Exchange

hash tables – The Most efficient algorithm for a program that returns true if the two strings only differ by one character

We have a list of strings with the same length. Each string only contains a, b and c.(For instance : aabcc)
The program gets a string and returns true if the two strings(input and the list of strings) only differ by one character.

A = {cacab cbabc}
cbbaa : False
cbaac : True

My first thought was to solve it with brute force which the worst-case time complexity is O(n^2). Is there any way to solve it with hash table or any other data structure?

strings – counting number of words from a text file in C and printing results in another text file

The code:

#include <iostream>
#include <stdio.h>
#include <string.h>

char filename() = "11.txt";
char filename1() = "2.txt";
FILE* ptr, * resultptr;
char string(100);
char words(100)(100);
int len = sizeof(filename) / sizeof(char);
int i = 0, j = 0, k, length, count;

int main()
{
fopen_s(&ptr, filename, "r");
fopen_s(&resultptr, filename1, "w");

if ((ptr == nullptr) || (resultptr == nullptr)) {
    printf("Files were not opened!");
    return -1;
}
fgets(string, 100, ptr); //reads a line

while (!feof(ptr)) {
    for (k = 0; string(k) != ''; k++) {
        if (string(k) != ' ' && string(k) != '') {
            words(i)(j++) = tolower(string(k));
        }
        else {
            words(i)(j) = '';
            i++;
            j = 0;
        }
    }
    length = i + 1;
    fputs("Occurrences of each word:n", resultptr); //prints this sentence into file
    for (i = 0; i < length; i++) {
        count = 1; 
        char *ch = words(i);
        for (j = i + 1; j < length; j++) {
            if (strcmp(words(i), words(j)) == 0 && (strcmp(words(j), "0") != 0)) {
                count++;
                strcpy_s(words(j), "0");
            }   
        }
        fputs("The word ", resultptr);
        if (string(i) != ' ' && string(i) != '' && string(i)!='0' ) {
            fprintf(resultptr, "%s", ch);
            
        }
                fputs(" occurred ", resultptr);
            fprintf(resultptr, "%d", count);
            fputs(" timesn", resultptr);
    }
    fclose(ptr);
    fclose(resultptr);
    return 0;
  }
  } 

The counting part is working perfectly fine, but the problem is when I try to print results,
for the sentence “let this work let what this
yes no yes pls”
it prints this:

Occurrences of each word:
The word let occurred 2 times
The word this occurred 2 times
The word work occurred 1 times
The word  occurred 1 times
The word what occurred 1 times
The word 0 occurred 1 times
The word 
 occurred 1 times

What’s messing?

Edit distance proof when last chars of 2 strings are the same

from Wagner–Fischer_algorithm:

I understand substitution cost needs to be adjusted, either 0 or 1:

 for j from 1 to n:
      for i from 1 to m:
          if s(i) = t(j):
            substitutionCost := 0
          else:
            substitutionCost := 1

          d(i, j) := minimum(d(i-1, j) + 1,                   // deletion
                             d(i, j-1) + 1,                   // insertion
                             d(i-1, j-1) + substitutionCost)  // substitution

But in later proof part, it claims when s(i) == t(j), d(i, j) = d(i-1, j-1):

If s(i) = t(j), and we can transform s(1..i-1) to t(1..j-1) in k operations, then we can do the same to s(1..i) and just leave the last character alone, giving k operations.

I don’t understand, shouldn’t it be d(i, j) = min(d(i-1, j-1), d(i-1, j) + 1, d(i, j-1)+1)?

It’s also mentioned in edit distance wiki

enter image description here

How do you prove if the last chars are matched, d(i, j) is d(i-1, j-1)?


following the lemma here,

I can think one way to prove this is to assert minimal is not from d(i-1, j-1) when s(i) = t(j). Then draw contradiction.

if minimal is not from d(i-1, j-1), the minimum must come from

  1. deleting last char from s, s(i).
  2. or inserting last char from t, t(j).

If we go with 1, we need to match s(0..i-1) with t(0..j).

A: if s(i-1) != t(j),

  1. insert t(j) to end of s, we are rewinding to the original state.
  2. modify s(i-1) to t(j), it’s equvilent to deleting s(i-1) (+1) when matching s(i-1) with t(j-1), whose minimum is d(i-1, j-1).
  3. delete s(i-1) -> only viable way

B: if s(i-1) = t(j),

  1. no insert t(j), otherwise the previous deletion is redundant.
  2. no modification: equivalent to 2nd point in discussion A.
  3. deletion -> viable

Combine A and B, only deletion is acceptable and it’s impossible to match if only deletion is performed on s.

Do you guys think this proof is correct?

DreamProxies - Cheapest USA Elite Private Proxies 100 Cheapest USA Private Proxies Buy 200 Cheap USA Private Proxies 400 Best Private Proxies Cheap 1000 USA Private Proxies 2000 USA Private Proxies 5000 Cheap USA Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive.com Proxies-free.com New Proxy Lists Every Day Proxies123.com Proxyti.com Buy Quality Private Proxies