exception – Why does my Program not register that a socket could not have been created?

I made a little Chess application and there is an offline mode in case you can’t connect to the server. The client should try to connect, catch the UnknownHostException and then continue on. But ever since i forwarded my port in the router, the Exception isn’t being registered anymore and the client just necks itself. It doesn’t crash, it doesn’t catch an Exception, even when sorrounding with try/catch, and it doesn’t do anything anymore.

Here’s the method:

public void startConnection(String adress, int port) throws UnknownHostException, IOException {
        System.out.println("try taking connection");
        clientSocket = new Socket(adress, port+1);
        System.out.println("uhh1");
        out = new PrintWriter(clientSocket.getOutputStream(), true);
        System.out.println("uhh2");
        in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
        System.out.println("uhh3");
    }

the sysout stops at “try taking connection”, no errors, no server online. It does work when the server is online.

Is there a way for me to set a time-out, or any better solution? Thanks in advance!

algorithms – Calculate the area of the shape created by multiple paths

I’m trying to write an algorithm to calculate the area created by multiple paths that can be overlapping or not. Here is an example:

Example Paths

Basics

  • 4 separate paths (A,B,C,D) which are a collection of vertices (A1,A2,…)
  • Area desired is represented by green

Edge Cases

  • As shown with B, a path might have segments that don’t contribute to a filled shape
  • As shown with C, a path might be completely enclosed by other paths and therefore should basically be ignored.
  • As shown with D, paths may create independent shapes
  • As shown with A and B, it should be a union of all the shapes

My first question is if an algorithm for this already exists. If it does, it would save me a lot of effort :). I tried searching around but I don’t even know how to describe this problem concisely.

Assuming one doesn’t exist for this exact purpose I have to move on to figuring it out myself. I’m assuming the right data structure for the job is a graph. I’m thinking I will add points for each intersection (highlighted in red) as I insert paths into the graph.

Then “all I need” is an algorithm for tracing around the outside of each shape because calculating the area of those irregular polygons will be simple. Does something like that already exist? My primary hangups when I think about how to do this are:

  • What vertex do I “start” at?
  • How do I account for multiple shapes (D as well as A,B,C)?
  • How do I account for the parts of shapes like formed by A1,A5,A5 where I’ll be visiting that intersection point multiple times?

I’m not necessarily looking for a complete solution, I’d love thoughts on if you think I’m approaching this the best way so far and if you have any ideas/suggestions on how to achieve this.

Thanks in advance!

8 – How do I detect whether any contact forms have been created?

Context: On my Drupal 8 site I’m trying to add in a new section containing a view that lists out all forms. The user can then click on one of the form and it launches a download of all the messages sent through that form. However that section should only be visible if the user has created at least 1 form.

What I’ve tried: So far what I’ve discovered is that the contact forms are stored in the config table in the database, so I could theoretically run a query like “SELECT 1 FROM config WHERE name LIKE ‘%contact.form%'” or whatever the equivalent in D8 is. However, it seems like there has to be a quicker way to return either the presence of contact forms or the contact forms themselves programmatically.

Final question: How can I return either the contact forms themselves or at least a boolean representing the presence of contact forms programmatically?

theming – Hi, I am created the custom form module and twig template.. but form doesnt render on page.. I am paste my code here.. please help me

Form

<?php

namespace DrupalproposerdetailsForm;

use DrupalCoreFormFormBase;
use DrupalCoreFormFormStateInterface;
/**
*

/
class ProposerDetailsForm extends FormBase {
/
*
*

/
public function getFormBaseUrl(){
$api_base_url = Drupal::config(‘api_config.settings’)->get(‘api_link’);
return $api_base_url;
}
/
*
*

/
public function getFormId() {
return ‘proposerdetails’;
}
/
*
*

*/
public function buildForm(array $form, FormStateInterface $form_state) {

$form(‘nationality’) = array(
‘#type’ => ‘radios’,
‘#title’ => t(‘Nationality’),
‘#options’ => array(
t(‘Indian’),
t(‘Foriegn’),
),
);

$form('html1') = array(
    '#type' => 'markup',
    '#markup' => "<h3>At the time of claim, you will be requested to share the Work Permitt# or OCI Card#,<br/>in the event of non-submission, your claim will be rejected. </h3>",
   );

$form('name') = (
    '#type' => 'textfield',
    '#title' => 'Name (First & Last)',
    '#required' => true,
);

$form('pan') = (
    '#type' => 'textfield',
    '#title' => 'Pancard no',
    '#required' => true,
);

$form('address1') = (
    '#type' => 'textarea',
    '#title' => 'Address1',
    '#required' => true,
);

$form('address2') = (
    '#type' => 'textarea',
    '#title' => 'Address2',
    '#requied' => true,
);

$form('pincode') = (
    '#type' => 'textfield',
    '#title' => 'Pincode',
    '#required' => true,
);

$form ('city') = (
    '#type' => 'textfield',
    '#title' => 'City',
    '#required' => true,
);

$form ('state') = (
    '#type' => 'textfield',
    '#title' => 'State',
    '#required' => true,
);

$form('email') = (
    '#type' => 'textfield',
    '#title' => t("Email Address"),
    '#attributes' => array('class' => array('emailOnly')),  
    '#maxlength' => 50,
    '#required' => true,
  );
  $form('html2') = array(
    '#type' => 'markup',
    '#markup' => "<h2>Nominee Details: </h2>",
   );

   $form('relation') = (
       '#type' => 'select',
       '#title' => 'Relationship with proposer',
       '#required' => True,
       '#options' => (
           t('Daughter'),
           t('Father'),
           t('Husband'),
           t('Mother'),
           t('Son'),
           t('Grand Son'),
           t('Mother In Law'),
           t('Nephew'),
           t('Niece'),
           t('Sister'),
           t('Aunt'),
           t('Brother'),
           t('Brother In Law'),
           t('Daughter in Law'),
           t('Father in Law'),
           t('Grand in Law'),
           t('Grand Father'),
           t('Grand Mother'),
           t('Sister in Law'),
           t('Cousin'),
       ),
    );
$form('name2') = (
    '#type' => 'textfield',
    '#title' => 'Name (first & last)',
    '#required' => true,

);

$form('dob') = (
    '#type' => 'date',
    '#title' => 'Date of Birth',
    '#required' => True,
    '#dateformat' => 'd-m-Y',

);

$form('html3') = array(
    '#type' => 'markup',
    '#markup' => "<h3>Please select a Third Party Administrator (TPA) to service your cashless claims* </h3>",
   );

   $form('agent') = array(
    '#type' => 'radios',
    '#options' => array( t('Paramount Heath Services (TPA) Pvt Ltd.'),
                  t('Medi Assist Insurance (TPA) Pvt Ltd.'),
                  t('Raksha Health Insurance (TPA) Pvt Ltd.'),
   ),
  );


$form('declare') = (
    '#type' => 'checkboxes',
    '#options' => array('yes'=>'I declare that all the above is true and agree to the Terms and Conditions'),
    '#prefix' => '<div class="checkbox_area custom-check-box declaration">',
    '#suffix' => '</div>',
    '#required' => true,
  );
  $form('#attached')('library')() = 'proposerdetails/proposerdetails';

  return $form;fff

}
/**
*

*/

public function submitForm(array &$form, FormStateInterface $form_state) {

}

public function validateForm(array &$form, FormStateInterface $form_state) {

parent::validateForm($form, $form_state);
$values = $form_state->getValues();
 if ( $values('name')  == '' ) {
      $form_state->setErrorByName('name', t('Error 1'));
  }
  if ( $values('email')  == '' ) {
      $form_state->setErrorByName('email', t('Error 1'));
  }
  
}
public function submitForm(array &$form, FormStateInterface $form_state) {
}

}

controller

<?php

namespace DrupalproposerdetailsController;

use SymfonyComponentDependencyInjectionContainerInterface;
use DrupalCoreAjaxAjaxResponse;
use DrupalCoreAjaxOpenModalDialogCommand;
use DrupalCoreControllerControllerBase;
use DrupalCoreFormFormBuilder;

/** * ModalFormExampleController class. */
class ProposeerDetailsController extends ControllerBase {

/** * The form builder. *
*

  • @var DrupalCoreFormFormBuilder

  • */
    public function content() {

    return (
    ‘#theme’ => ‘proposerdetails’,
    ‘#form’ => $this->t(‘ProposerDetailsForm’),
    );

}

}

Template file

<div class="proposal-bg">
<h2 class="border-top">Proposer Details:</h2>
    <div class="proposal-bg-secondary">
        <div class="row">
            <div class="col-md-12">
            <div class="form-group">
              {{form.nationality}}
            </div>
            </div>
        </div>
    </div>

{{form.html1}}

{{form.name}}

{{form.pan}}

{{form.address1}}

{{form.address2}}

{{form.pincode}}

{{form.city}}

{{form.state}}

{{form.email}}

    <div class="row">
        <div class="col-md-12">
            <div class="form-group">
            {{form.html2}}
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-md-6">
            <div class="form-group">
                {{form.relation}}
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
            {{form.name2}}
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-6">
            <div class="form-group">
                {{form.dob}}
            </div>
        </div>
    </div>
    <div class="form-group">
    {{form.html3}}
    <div class="row radiobutton-wrapper tpa-rdo">
        <div class="col-md-4">
        {{form.agents}} 
    <div class="form-group checkbox-wrapper mb-5 pb-5">
    {{form.declare}}
    </div>


       

dnd 5e – I created a magic item for one character and another character took it

Assuming the standard party of good-aligned murderhobos, that is. If you have a bunch of evil backstabbers, everyone should pretty much be expecting this behavior from everyone else. But if the party is more or less good-aligned or lawful-aligned, then rogues steal FOR the party, not FROM the party. Even a neutral or neutral-evil character should know who his allies are and be able to conclude that a party of accomplices is quite a bit better for him than a party of executioners.

But what often happens – and it’s almost always rogues – is that they see it as their purpose in life to screw over the rest of the party. Because hey, rogue, right? Players of chaotic neutral characters also often like to behave this way. But they’re really counting on the out of game social contract – the other players probably don’t want to kill them – to protect their in game behavior. This is really griefing behavior although in D&D it is known as my guy syndrome. Being a goblin certainly isn’t a pass on that. (Also, IMO, monster races for PCs are usually trouble).

Take the Mafia, the closest real-life example to the typical thieves’ guild found in a typical D&D campaign. They are strict about treating each other with the proper honor and respect, especially when working together. Rival factions might fight each other, but conflict within a group is always handled by civilized, if not necessarily non-violent, rules. In alignment terms, they might be evil, but it’s very much lawful evil. So a typical rogue should be expected to understand and be familiar with concepts of trust and loyalty and know when to apply those concepts. In fact these concepts are more important because there is no legal system to fall back on. A rogue who betrays indiscriminately is soon to be a dead rogue.

So what can you do about it? As the DM, it’s not your job to force the issue. You shouldn’t be an accomplice to the rogue, but neither should you be the dictator of behavior standards. But you can arrange for the players to know what is going on, so they can correct – or accept – the misbehaving player in their own way. This might range anywhere from an embarrassed rogue handing over the item and promising to mend his ways, to a heated but (hopefully) temporary out of character exchange, to a violent in-character conflict resulting in a character death but which the players find quite entertaining. The players should decide which of these options they pursue. Not all outcomes here are good, of course. You could be facing a player exile or even game breakup, but again that would be the choice of the players (the rogue player’s choice, if he won’t play nice; the group will almost certainly forgive a repentant player here).

If the players already know

If the other players do know about the situation but just haven’t acted on it, then you should consider whether you need to do anything at all. Is the warlock player actually unhappy?

If your warlock player is unhappy but just not standing up for himself, you could probably have an out of character chat about the situation at the start of your next session. Mention that you created a specific magic item intended for a particular character, and that the party has decided not to give it to that character, and that it’s up to them but you aren’t going to tiptoe around the players’ poor allocation of resources, and that the hitpoint situation carries an increased risk of death for the warlock. The players will either decide to give the amulet to the warlock, or the warlock player will tell you that he’s actually ready to die and create a new character anyway, or they’ll spend the whole session bickering, but one way or another it’ll get solved. There aren’t really any other options.

If the players don’t know

One option you have is to give the players ways to expose the treachery. Not simply telling everyone, but arranging that the players find out. For instance, you could give the players a situation in which detect magic is useful (perhaps they must identify which item in a cluttered room is enchanted); the spell then “coincidentally” reveals the amulet secretly being carried by the rogue. A clumsy rogue player will just get caught – a more skillful one will try to prevent the spell from being cast, be out of the area when it happens, or otherwise do something that should indirectly clue in the other players if they are paying attention. Hopefully someone other than the rogue is the one who casts the spell. If the rogue is a real dummkopf, he’ll completely forget that detect magic will expose him, and now the spellcasting player knows a secret!

You could also present an NPC who will make a trade of value to the rogue, but requires a suitable magic item in exchange. Make sure the NPC is only available one time, when the rest of the party is also present. The rogue then must choose whether to expose his own treachery or pass up the reward. It doesn’t have to be (in fact probably should not be) cursed, the thing the rogue trades for can be totally above-board because the real penalty will be the party not trusting him any more. Especially when playing as a paladin or cleric, I have found more than one opportunity and excuse to search the belongings of a party member, usually a rogue, that I had come to distrust, which has occasionally been productive (and sometimes I have been surprised to find nothing more than a couple of dozen extra gold pieces!) Or the players may all have an out-of-character conversation right then. Either way, they’ll sort it out.

One particularly deft DM I once played with provided the thieving rogue with an “opportunity” in which he was caught by NPCs, and the party was forced to decide whether to rescue him even knowing what he had done. (The deftness was in giving him more than one chance to back out, so he was never railroaded – he chose to get caught!)

I don’t really like creating a second, similar item for the player who was intended to receive it. This is too heavy-handed for my taste. Suspension of disbelief can absorb one magic item which is coincidentally perfectly suited to a particular character who needs it – two is just not believable unless you are trading with a band of gnomes that makes this particular item or something. It also doesn’t resolve the essential problem, which is the behavior of the rogue player, not the warlock’s constitution. You will just run into a similar situation again down the road.

The Alternative Approach

You can also just tell the rogue player that his playstyle is wrong (or at least, wrong for this game) and he needs to do things differently. Sometimes the direct approach is better with new players, especially ones that may not have thought through the implications of their (mis)behavior. “Jerk that griefs the other players” is not a viable character concept, so it’s a case of better late than never on telling him that.

If four players are playing by one set of rules and the fifth one is playing by different rules, you really just need to stop and agree on the rules, never mind high-minded concepts of impartiality and agency. It can, at times, be worth saying “I normally wouldn’t break character like this, but everyone should know what Player X has done, and I don’t think it’s OK” – saving you the complexity and time of revealing things through in-game means, especially if you aren’t able to come up with a scenario that is going to get the job done. Sometimes the DM has to strike a fine balance between being out of the way as the game’s laws of physics, and preserving the out-of-game social situation. Whatever you do, don’t let it fester.

One Final Tip

If you roll for stats, let the players assign their die roll results to the stats they want. Nobody is going to take a 6 constitution score voluntarily – if they do it’s their own fault!

Stuff Based On Comments, Etc

I think you’ve just got That Guy in your game.

Sometimes a player has made a character in good faith but that character just doesn’t fit with the rest of the party / story. This is not a case of anyone intentionally ruining the game, it’s just an unfortunate emergent property of certain character combinations. A good player will adjust the character to fit the game, or retire the character and make a new one. Maybe the impulsive barbarian is tired of being held back by the cautious cleric and thoughtful wizard and goes off on his own, then the player creates a disciplined former soldier fighter who fills the same role in combat but has a more compatible personality. Or they could just adjust the character’s personality a bit. Actual character development! In a D&D game!

But often, a player hides behind the rules or character sheet so he can mess with the other players or GM. And I think this is what you have. There are lots of variations on this guy but basically they’re all power trippers. You’ve got rules lawyers, munchkins, spotlight hogs, and toxic My Guys; a bunch of different ways to make themselves the most important player in the game at the expense of everyone else. This player is elevating himself over the other players and he’s trying to push you around too (demanding extra XP for himself).

Warning signs for this include CN alignment, monster race, and any kind of character trait that says “can’t help but do X” when X is some obnoxious thing. “Can’t help but donate gold to the temple of my god whenever I visit” isn’t a problem, “can’t help but rob the other players” is. You would be amazed how much they can actually help it when doing so would get them killed. You never see these players try to steal the king’s crown as his heavily armed procession marches past. You should feel free to ban or heavily restrict all of these things in your game, it won’t fix the player but it will put them on notice and give you some warning. They usually play rogues too, but rogues are an archetype class and you can’t just not have rogues.

One problem is that TSR/WotC has always basically given these players permission via the CN alignment. I wish they would write a better definition for it, because as written CN is basically indistinguishable from CE. Suppose you were back in the real world and someone stole their friend’s lifesaving medicine to resell it on the black market. Suppose it’s an experimental treatment that can’t even easily be replaced. This person is obviously a sociopath or under some severe compulsion (addiction, maybe, or a severe threat was made against them). If not compelled, though, we would put them in jail; they are evil. And this is exactly what this character has done. But problem players will just say “I was following my whims, just like it says in the book!” But fixing alignment is out of scope here.

Anyway, if the player is new, he might just not understand how the game is supposed to work. It could be a teachable moment. But if he’s played a few times, he knows what he’s doing, and you just have to deal with him in the best way that your social environment permits.

If your player is repentant, you could even give him the compulsion excuse as a way out. “I didn’t want to steal this amulet, there was a geas/dominate person/whatever” and tracking down the cause of the compulsion could be a good quest hook.

history – Where can I find data for abandoned blocks (74,638 to 74,690) for the Value Overflow Incident when ₿184 billion BTC were accidentally created?

I already have data for all the Mainchain Blocks. Where can I find data for the orphaned/abandoned blocks (74,638 to 74,690) before the re-organisation occurred?

I can only seem to find information for block 74,638 and the timestamp for block 74,639. I cannot seem to find anymore. I have been digging through waybackmachine without much luck.

Any help appreciated!

Corona Virus make people poor but now Rich virus created to make people Rich





Rich Virus


01.png




https://richvirus.com/


Corona Virus make people poor but now Rich virus created to make people Rich



Corona virus make everyone lost their job, colapse and bankrut. its make a crisis and resesion. now rich virus created for recover your asset and make money from home


mockup-01.jpg

screencapture-richvirus-2020-08-05-17-21

magento2.3 – Magento 2.3 – Paypal error 500 (order not created)

“What’s happening?”
When someone places an order, goes to Paypal website, login to Paypal account, and pay with no issues at all, but when coming back to website it gives an error 500. The order is not created, but all the order info are in the quote tables. It don’t show any error in the logs at all, just after a little while start showing the error ‘The “xxxxx” order ID is incorrect…’.

“What you tried?”
So I thought about creating a clone to disable every module to see if was an error in any module, but funny thing, it all works fine in an exact copy of the live website. The only differences that I can remember are Cloudflare (the clone don’t have it) and the traffic in the website (same thing, in the clone it’s just me), I tried to test in the live website with only like 2 customer and error still persist so I’m not sure that traffic is the problem.

Now I ask, what can cause this? What can I do to debug this?

postgresql – Calling a function that creates records and referencing the created records in a join

I have a function that creates records for different tables that are referenced with each other. The function returns the record from the “parent” table. So I am using that function in the FROM of my query so that I can then perform JOIN on the associated records so that I can piece the tables together. My problem is that the associated records aren’t getting returned and I know for certain that they are getting created.

From what I understand, FROM and JOIN are pretty much executed at the same time so it makes sense that the FROM‘s creation of the records that are used in the JOIN would not exist.

So how can I ensure that the call to the function is executed first before the JOIN is executed? I tried doing this with CTE but no avail.

SELECT
  i.invoice_id,
  i.invoice_date,
  i.invoice_due_date,
  i.created_by_id,
  i.currency_id,
  i.created_at,
  si.supplier_info,
  bi.billing_info
FROM invoices.create_shift_invoice(
  CAST(NULLIF($invoice_date, NULL) AS TIMESTAMP),
  CAST(NULLIF($invoice_due_date, NULL) AS TIMESTAMP),
  CAST(NULLIF($currency_id, '') AS INT8),
  CAST(NULLIF($created_by_id, '') AS INT8),
  CAST(NULLIF($supplier_info, NULL) AS JSONB),
  CAST(NULLIF($billing_info, NULL) AS JSONB),
  CAST(NULLIF($invoice_items_shifts, NULL) AS JSONB)
) i
JOIN (
  SELECT
    _si.invoice_id,
    json_build_object(
      'supplier_info_id', CAST(_si.supplier_info_id AS VARCHAR),
      'invoice_id', CAST(_si.invoice_id AS VARCHAR),
      'suppler_name', _si.supplier_name
    ) AS supplier_info
  FROM invoices.supplier_infos _si
) si USING (invoice_id)
JOIN (
  SELECT
    _bi.invoice_id,
    json_build_object(
      'billing_info_id', CAST(_bi.billing_info_id AS VARCHAR),
      'invoice_id', CAST(_bi.invoice_id AS VARCHAR),
      'customer_id', CAST(_bi.customer_id AS VARCHAR)
    ) AS billing_info
  FROM invoices.billing_infos _bi
) bi USING (invoice_id)

And here’s my attempt at a CTE:

WITH create_shift_invoice AS (
  SELECT *
  FROM invoices.create_shift_invoice(
    CAST(NULLIF($invoice_date, NULL) AS TIMESTAMP),
    CAST(NULLIF($invoice_due_date, NULL) AS TIMESTAMP),
    CAST(NULLIF($currency_id, '') AS INT8),
    CAST(NULLIF($created_by_id, '') AS INT8),
    CAST(NULLIF($supplier_info, NULL) AS JSONB),
    CAST(NULLIF($billing_info, NULL) AS JSONB),
    CAST(NULLIF($invoice_items_shifts, NULL) AS JSONB)
  )
)

SELECT
  i.invoice_id,
  i.invoice_date,
  i.invoice_due_date,
  i.created_by_id,
  i.currency_id,
  i.created_at,
  si.supplier_info,
  bi.billing_info
FROM create_shift_invoice i
LEFT JOIN (
  SELECT
    _si.invoice_id,
    json_build_object(
      'supplier_info_id', CAST(_si.supplier_info_id AS VARCHAR),
      'invoice_id', CAST(_si.invoice_id AS VARCHAR),
      'suppler_name', _si.supplier_name
    ) AS supplier_info
  FROM invoices.supplier_infos _si
) si USING (invoice_id)
LEFT JOIN (
  SELECT
    _bi.invoice_id,
    json_build_object(
      'billing_info_id', CAST(_bi.billing_info_id AS VARCHAR),
      'invoice_id', CAST(_bi.invoice_id AS VARCHAR),
      'customer_id', CAST(_bi.customer_id AS VARCHAR)
    ) AS billing_info
  FROM invoices.billing_infos _bi
) bi USING (invoice_id)

website design – Is it a good practice to include created and last modified for technical articles?

As a software developer, I often read technical documentation. I might be biased due to the high usage of Stack Overflow and internal tools like Confluence which are full of timestamps (almost any piece of information has a creation date).

However, every now and then I stumble across technical articles (example) which do not provide any timestamp information. I typically view source and search for a hidden (technical) tag that might contain some timestamp, but this is not someone using a Web site normally would normally do.

I am curious if from a UX perspective technical content creation/modification timestamps are a must or at least a good practice.

Question: