I’m attempting to pull input from a html form into an array on a results form on a separate html file using js


<!-- begin snippet: js hide: false console: true babel: false -->
          <td height="25" bgcolor="#D3FFA8"><strong><font face="Arial">First Name</font></strong></td>
          <td height="25"><p><textarea name="T2" rows="3" cols="24" wrap="virtual"></textarea></td>
          <td height="25" bgcolor="#D3FFA8"><strong><font face="Arial">Last Name</font></strong></td>
          <td height="25"><p><textarea name="T2" rows="3" cols="24" wrap="virtual"></textarea></td>

read more

How would I define ‘Ace’ in a blackjack deck as 11 or 1?

I am attempting to create a blackjack game. The only issue I have is how to change Ace to be 1 if 11 will bust the hand.

I have tried to use scores.append(Ace = 1) when the player hand was busted. The only issue with this is that every ace after that is now 1. So if the dealer has an ace, the ace is 1. If I attempt to change it back to 11 when I recalculate score at the end, the player score now has 10 extra score (adding the 10 to the ace value 1 to get 11). In addition to the append, I tried to add another dictionary, but I don’t know how I would implement another dictionary. I have also tried to completely rewrite my program to have fewer classes.

def get_score(self):
    accumulate = 0
    for c in self._cards:
        accumulate += c.get_score()

    return accumulate
def get_score(self):
    score_encoding = {'2':2, '3':3, '4':4, '5':5, '6':6, '7':7, '8':8, 
                          '9':9, '10':10, 'Jack':11, 'Queen':12, 'King':13, 
    return self._score_encoding[self.getrank()]
def main():
    suits = {'Spades':4, 'Hearts':3, 'Clubs':2, 'Diamonds':1}
    ranks = {'2':2, '3':3, '4':4, '5':5, '6':6, '7':7, '8':8, '9':9, 
                 '10':10, 'Jack':11, 'Queen':12, 'King':13, 'Ace':14}
    scores = {'2':2, '3':3, '4':4, '5':5, '6':6, '7':7, '8':8, '9':9, 
                  '10':10, 'Jack':10, 'Queen':10, 'King':10, 'Ace':11}

    player = ScoredHand()
    dealer = ScoredHand()
        # The creation of the deck requires three dictionaries
    thedeck = frenchdeck(ranks, suits, scores)

read more

ListView app frustratingly slow, unable to figure out why

Hi guys I am a beginner at android studio and currently following the video tutorial on youtube by channel Slidenerd. I am currently at episodes 84 – 89 of their Android tutorial for Beginners series and facing some problems with my app.

I am trying to create a ListView with a custom adapter. Every thing seems to be okay until I ran the emulator. The app is extremely laggy to the point where it seems unsuable.

I thought it was because of the emulator but when I tried it on my phone ( Samsung Galaxy S7, android 8.0.0), the app is still extremely laggy and I am unable to scroll all the way to the bottom of the Listview.I am only able to see R.drawable.number.number9. I have tried to see if any exception is thrown in the logcat but I couldnt find any.

Code from MainActivity.java

public class MainActivity extends AppCompatActivity {

    String[] titles;
    String[] descriptions;
    int[] drawables = {R.drawable.number0, R.drawable.number2, R.drawable.number3, R.drawable.number4, R.drawable.number5, R.drawable.number6, R.drawable.number7, R.drawable.number8, R.drawable.number9, R.drawable.number10};

    protected void onCreate(Bundle savedInstanceState) {

        Resources res = getResources();
        titles = res.getStringArray(R.array.title);
        descriptions = res.getStringArray(R.array.description);

        ListView l = (ListView) findViewById(R.id.listview);
        myadapter myadapter = new myadapter(this, titles, drawables, descriptions);

class myadapter extends ArrayAdapter<String>{
        Context c;
        int[] drawables;
        String[] titles;
        String[] descriptions;

    public myadapter(Context context, String[] titles, int[] drawables, String[] descriptions ) {
        super(context,R.layout.single_row, R.id.title,titles);
        this.drawables = drawables;
        this.titles = titles;
        this.descriptions = descriptions;

    public View getView(int position,  View convertView,  ViewGroup parent) {
        View v = convertView;
        if (v == null) {
            LayoutInflater i = (LayoutInflater) c.getSystemService(c.LAYOUT_INFLATER_SERVICE);
            v = i.inflate(R.layout.single_row, parent, false);
        ImageView image = (ImageView) v.findViewById(R.id.image);
        TextView title = (TextView) v.findViewById(R.id.title);
        TextView description = (TextView) v.findViewById(R.id.description);


        return v;

read more

How to simulate drag for rectangle with text

i wanted to simulate drag for text (Simulate Above rect Drag) which should work as similar to rectangle symbol drag.

The below image illustrate it:

enter image description here

I’m tweaking opensource source project. so don’t know much code. hence i’m giving project link.

project link: https://www.dropbox.com/s/mfrvzdum9aur0wl/webapp.tar.gz?dl=0

How to run:

  1. open with vscode.

  2. find index.html run with liveserver. you will get above interface(shown in pic).

read more

How to perform Fox’s algorithm for matrix multiplication with OpenMP?

We are supposed to write Fox’s algorithm in C, and parallelize it using OpenMP. From my understanding of Fox’s algorithm there must be communication between processors to broadcast different parts of the matrices, but OpenMP uses threads that do not send information back and forth to each other. Is there a way to do this in C with OpenMP that I am not realizing?

How to perform Fox’s algorithm for matrix multiplication with OpenMP?