Need to Convert numpy ArrayS to a single DatasetV1Adapter

As of now, I have generated numpy arrays for X and y(data and labels) and am trying to feed them to thisisRon’s cGAN code

https://github.com/thisisiron/TF2-GAN/tree/master/cgan

Part of his code(designed for MNIST) is

 for images, labels in train_dataset:             gen_loss, disc_loss = train_step(images, labels)              total_gen_loss += gen_loss             total_disc_loss += disc_loss 

From what I saw from his code, train_dataset is a datasetV1adapter(for MNIST). Running this code with train_dataset gave me the error as shown below

too many values to unpack (expected 2) 

It looks to stem from my input being a nmpy Array X rather than a datasetV1Adapter

To work around this, I tried to design my own training loop instead

length=len(train_dataset)  for i in range(0,length):           images=X_tiny[i]           labels=y_labels_one_hot[i]           gen_loss, disc_loss=train_step(images,labels)           total_gen_loss +=gen_loss           total_disc_loss +=disc_loss 

This gives me an error of

Input 0 of layer dense_49 is incompatible with the layer: : expected min_ndim=2, found ndim=1. Full shape received: [10] 

Which stems from the same point, although I don’t truly know what it means. Or why it is showing up

I strongly believe that I need to use a datasetV1Adapter instead, but unsure how to do it. Thanks in advance

Edit, I assumed the error was purely from a non dataset V1 adapter issue.

I did:

train_dataset = tf.data.Dataset.from_tensor_slices((X, y_one_hot)) train_dataset = train_dataset.shuffle(SHUFFLE_BUFFER_SIZE).batch(BATCH_SIZE) 

Giving me:

<BatchDataset shapes: ((None, 10, 10, 3), (None, 10)), types: (tf.uint8, tf.float32)>  
Dimension 0 in both shapes must be equal, but are 100 and 32. Shapes are [100] and [32]. for 'generator_24/concat' (op: 'ConcatV2') with input shapes: [100,256], [32,256], [] and with computed input tensors: input[2] = <-1>. 

I cannot find any place where I have given 32 as an input. So I am very confused

Converting a function with single parameter to a function with multiple parameters

I have been solving some algorithm questions recently and a pattern I have observed in some problems is as follows:

Given a string or a list, do an aggregation operation on each of its elements. Here in each of these elements we apply some recurrence to solve it.

An example of one such problem is below.


Problem: Given n integers return the total number of binary search trees that can be formed using the n integers

To solve this problem, I define a recurrence relation as follows:

f(n) = 1 // if n = 0 f(n) = ∑ f(i) * f(n-i-1) where 0 <= i <= n-1 

This works and I get the correct answer however I want to modify the function a bit.

Instead of expressing the function in terms of f(n) I want to express it in terms of f(n, i) so I can remove the summation. However I am unable to do it correctly.


Code

My code to solve the problem by defining the recurrence in terms of f(n) is as follows: (I am aware it can be optimized by DP but that is not what I am trying to do here)

public int f(int n) {     if(n == 0)         return 1;      int result = 0;     for(int i = 0; i< n; i++)         result += f(i) * f(n-i-1);     return result; } 

I want to remove that for loop and instead express the function in terms of f(n,i) instead of f(n).


Question

  1. How to convert the recurrence shown above from f(n) to f(n,i) and remove the summation?
    • Here ‘n’ is the size of the list of element and ‘i’ is the ith element in the list that we choose to be the root of the tree.

Output of Two Functions as a Single Function

I have two functions: One of which outputs a number and the other outputs a picture. What I would like to do is create a single function that would output both the number and the picture.

As a MWE take the following:

Tri = Triangle[{{0, 0}, {0, 1}, {1, 0}}] PictureTest[x_, y_, z_] :=  RegionPlot[x >= z*y && {x, y} \[Element] Tri, {x, 0, 1}, {y, 0, 1}] MinTest[x_, y_, z_] := Minimize[{x, x >= y + z && {x, y} \[Element] Tri}, {x, y}] 

I would like to create a new function NewFunc[x_,y_] that gives as an output both PictureTest[x,y,z] and MinTest[x,y,z]. (Or even better if it added some words and gave PictureTest[x,y,z] and “the minimum is MinTest[x,y,z].”)

(This might seem silly given the specific functions above. But I’m working with more complicated functions and z is in fact many variables. So, in practice, I’d like to input “z” once and get the answer to both PictureTest and MinText. I imagine the answer is in the Mathematica documentation, but I don’t quite know what I am looking for. I’m not even sure if I’m using the correct tags.)

What happens when multiple polymorph effects on a single target end at different times?

I was inspired to ask this question from a post about using a tankard to fight people.

Here’s the scenario: A tiny object, in this case a Tankard, has been turned into a tiny construct thanks to the Tiny Servant spell, and will remain as such for 8 hours (the spells duration). It is subsequently targeted by a True Polymorph turning it into a different creature, lets say a bat. True Polymorph states that if the caster maintains concentration for the full duration (1 hour), the effect becomes permanent. If such a circumstance occurred

What happens to the bat when Tiny Servant ends?

If it remains a bat, and is subsequently brought to 0 HP (not difficult, considering it only has 1 HP) does it return to being a tankard then, or is it just a dead bat?

What is the most damage that can be done in one round to a single target….with spells

I’m new here, but I scrolled through and did not see this question answered.

I would love to see your theory-craft at work!

What is the most damage you can do to a single opponent in one round, with spells of any class.

Rules:

I play RAW, so if you are going to use any UA please have a separate category for it. No 3rd party stuff please.

  • No set up round

  • Damaged from anything summoned counts, as long as it attacks on your initiative

  • No outside help, this is about you.

  • Target is not restrained, or vulnerable, or resistant, unless you find a way to make him that way.

  • No crits unless you have a way to guarantee them.

  • Assume that you automatically hit, and that creatures fail saving throws.. but bonus points if you can give reasons why you have a better chance at it.

  • The opponent is generic, so you can’t tailor the spell to a specific monster for more damage.

  • Use any feat, including dragonmarks to get an epic boon…

  • Level max is 20 using any race, class, or combination of classes

  • Use any magic item (as many as you like)

  • Spells that include a weapon attack are allowed (like booming blade)

  • Flame blade or spiritual weapon are also allowed

  • This calculation is about what you can inflict on someone intentionally. So no reaction spells. However damage that is done on the opponents turn in the same round can be added like that from booming blade.

I can’t wait to see what you guys come up with, I’ll add my own as well!

*WordPress Unlimited Hosting plan @ only $ 6/yr – FREE SSL – SINGLE CLICK INSTALLER!!

Hurry up!
Hostpoco.com providing the best quality WordPress hosting service to our clients at the most affordable price.we are offering special hosting plans starting from half dollar per month along with a single click script installer where you can install WordPress in single click also can take backups and can finish upgrading part from there. All WordPress/Application hosting plans come no limit for resources and will be the perfect choice for high traffic blogs or sites…So let’s drive on!

WordPress Hosting Features:
~RAID 10 HDD Storage
~Cheap Shared Hosting
~Unlimited Web Space
~Unlimited Bandwidth
~SINGLE CLICK INSTALLER
~OWN EMAIL ADDRESS
~FREE AUTO SSL
~Unlimited MYSQL DATABASES
~FREE PHP MyAdmin
~FREE AwStats
~FREE Virus Scanner
~DDOS Protection
~99.99% uptime
~Softacolous Supported

The fact that WordPress is 100% free of cost is very beneficial and hence WordPress has become one of the most popular website building platforms. Almost 25% of all online websites are run on this platform. For such useful CMS script we are offering below WordPress hosting plans:

*WP Startup plan starts from @$0.5 /Monthly:
-Single Domain Hosting
-5 Email Accounts
-2 Parked Domains
-0 Addon Domains
-2 MySQL Databases
-5 Sub Domains
-Tier 1 Technical Support

*WP Pro plan starts from @$1 /Monthly:
-Double Domain Hosting
-Unlimited Email Accounts
-Unlimited Parked Domains
-1 Addon Domains
-10 MySQL Databases
-Unlimited Sub Domains
-Tier 3 Technical Support

*WP Premium plan starts from @$3 /Monthly:
-Free Domain
-15 Domain Hosting
-Unlimited Email Accounts
-Unlimited Parked Domains
-14 Addon Domains
-Unlimited MySQL Databases
-Unlimited Sub Domains
-Tier 4 Technical Support

*WP Elite plan starts from @$5 /Monthly:
-Free Domain
-Unlimited Domain Hosting
-Unlimited Email Accounts
-Unlimited Parked Domains
-Unlimited Addon Domains
-Unlimited MySQL Databases
-Unlimited Sub Domains
-Tier 4 Technical Support

For more detailed information about us and the types of services we provide, please visit: https://hostpoco.com/half-dollar-wordpress-hosting.php

Thank You.

SQLMAP with single URL application

I have a local application which will be accessible only after login. Its single URL application, URL of application won’t change, just it use ‘XMLHttpRequest’ to refresh the content of screen based on action and other parameters.

Database used as below

[root@localhost ~]# mysql -q Welcome to the MariaDB monitor.  Commands end with ; or \g. Server version: 5.5.64-MariaDB MariaDB Server  Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.  

One of the ‘XMLHttpRequest’ having SQL injection issue and ‘sorters‘ field is having this issue, for example if we add (‘) in ‘ASC’ field then page is showing 500 error. To reproduce it, I am using burp suite community edition to intercept the request and feed this to SQLMAP using file.

SQLMAP is not able to inject the SQL in this api call, what I am doing wrong here?

Request details

Name    Protocol    Method  Result  Content type    Received    Time    Initiator http://10.20.100.200/test/api/?aid=E5xr3iOOg8sI1o4Zl1URZ4ytFlAdVTy9AMEiVjC6HhMBVwCkQgee160WtRYidV8Q&action=management&which=overview&_dc=1580104578032&sort=account_name&dir=ASC&sorters=%5B%7B%22field%22%3A%22account_name%22%2C%22direction%22%3A%22ASC%22%7D%5D&start=0&limit=18    HTTP    GET 200 application/json    1.29 KB 677.42 ms   XMLHttpRequest  Accept: */* Accept-Encoding: gzip, deflate Accept-Language: en-US Connection: Keep-Alive Cookie: client_time=1580129655.074; check=1; aid=E5xr3iOOg8sI1o4Zl1URZ4ytFlAdVTy9AMEiVjC6HhMBVwCkQgee160WtRYidV8Q; bid=4memnc2vdi7pj7i56q5sopu5gbspba99; cid=daSGjWTD0bQ8ZLCNRG4tA1090ddBYYPatzexNHrf4qy4FwB4CcvymjISadYw9Quh Host: 10.20.100.200 Referer: http://10.20.100.200/test/ User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko X-Requested-With: XMLHttpRequest Connection: close 

request.txt to feed SQLMAP (placed astrick (*) at ASC of sorters field )

GET /api/?aid=E5xr3iOOg8sI1o4Zl1URZ4ytFlAdVTy9AMEiVjC6HhMBVwCkQgee160WtRYidV8Q&action=management&which=overview&_dc=1580104578032&sort=account_name&dir=ASC&sorters=%5B%7B%22field%22%3A%22account_name%22%2C%22direction%22%3A%22ASC*%22%7D%5D&start=0&limit=18 HTTP/1.1 Accept: */* X-Requested-With: XMLHttpRequest Referer: http://10.20.100.200/test/ Accept-Language: en-US Accept-Encoding: gzip, deflate User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko Host: 10.20.100.200 Cookie: client_time=1580129655.074; check=1; uid=E5xr3iOOg8sI1o4Zl1URZ4ytFlAdVTy9AMEiVjC6HhMBVwCkQgee160WtRYidV8Q; sid=4memnc2vdi7pj7i56q5sopu5gbspba99; vid=daSGjWTD0bQ8ZLCNRG4tA1090ddBYYPatzexNHrf4qy4FwB4CcvymjISadYw9Quh 

SQLMAP command for SQL injection

sqlmap.py -r C:\Users\Documents\request.txt --dbs --tamper=apostrophemask,apostrophenullencode,base64encode,between,chardoubleencode,charencode,charunicodeencode,equaltolike,greatest,ifnull2ifisnull,multiplespaces,percentage,randomcase,space2comment,space2plus,space2randomblank,unionalltounion,unmagicquotes 

SQLMAP output

[00:34:56] [WARNING] URI parameter '#1*' does not appear to be dynamic [00:34:57] [WARNING] heuristic (basic) test shows that URI parameter '#1*' might not be injectable [00:34:58] [INFO] testing for SQL injection on URI parameter '#1*' [00:34:58] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause' [00:35:06] [INFO] testing 'Boolean-based blind - Parameter replace (original value)' [00:35:06] [INFO] testing 'MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)' [00:35:08] [INFO] testing 'PostgreSQL AND error-based - WHERE or HAVING clause' [00:35:11] [INFO] testing 'Microsoft SQL Server/Sybase AND error-based - WHERE or HAVING clause (IN)' [00:35:13] [INFO] testing 'Oracle AND error-based - WHERE or HAVING clause (XMLType)' [00:35:16] [INFO] testing 'MySQL >= 5.0 error-based - Parameter replace (FLOOR)' [00:35:16] [INFO] testing 'MySQL inline queries' [00:35:17] [INFO] testing 'PostgreSQL inline queries' [00:35:18] [INFO] testing 'Microsoft SQL Server/Sybase inline queries' [00:35:18] [INFO] testing 'PostgreSQL > 8.1 stacked queries (comment)' [00:35:23] [INFO] testing 'Microsoft SQL Server/Sybase stacked queries (comment)' [00:35:28] [INFO] testing 'Oracle stacked queries (DBMS_PIPE.RECEIVE_MESSAGE - comment)' [00:35:33] [INFO] testing 'MySQL >= 5.0.12 AND time-based blind (query SLEEP)' [00:35:39] [INFO] testing 'PostgreSQL > 8.1 AND time-based blind' [00:35:46] [INFO] testing 'Microsoft SQL Server/Sybase time-based blind (IF)' [00:35:52] [INFO] testing 'Oracle AND time-based blind' it is recommended to perform only basic UNION tests if there is not at least one other (potential) technique found. Do you want to reduce the number of requests? [Y/n] Y [00:37:07] [INFO] testing 'Generic UNION query (NULL) - 1 to 10 columns' [00:37:20] [WARNING] URI parameter '#1*' does not seem to be injectable [00:37:20] [CRITICAL] all tested parameters do not appear to be injectable. Try to increase values for '--level'/'--risk' options if you wish to perform more tests [00:37:20] [WARNING]  HTTP error codes detected during run: 403 (Forbidden) - 1 times, 400 (Bad Request) - 578 times, 414 (Request-URI Too Long) - 235 times 

Am I doing anything wrong here and why SQLMAP is not able to inject the SQL vulnerabilities ? I have tried with –level 3 –risk 3 options as well but no use.

My DM insists on rolling a single save for groups affected by AoE save spells. How does this affect my odds of successfully affecting the enemy?

As the title question, my DM rolls a single d20 save for groups affected by my area of effect spells that require a save, in order to save time. I can’t help but feel like I’m being ripped off by this as a wizard with primarily AoE save-or-suck spells. I don’t know if this is just a feeling or if the probabilities actually back this up. I know this can also work in my favor but it still feels off.

How are the probabilities affected when a (homogenous) group gets a single save vs. each individual in the group having their own save? I want to know specifically if this works more in my favor or more in the favor of my enemies, or if it is statistically speaking a 50/50 split. I am looking for evidence that this is a bad idea (whether it benefits me or harms me) and that the DM should roll separately for each affected target in the area of effect.

I realize this probably puts the odds in my favor when targeting weak saves in the group (i.e., WIS save on a group of ogres or orcs), but this will not always be the case and especially when there are mixed enemies in the AoE. So far we have only faced groups that contained single enemy types so I don’t know what happens when there are two different enemies with two different saves.

Ideally answers will address a sliding group size (2..N group members, 5 is probably a good stopping point) and a range of save DCs — DC 14-19 should address most levels of play.

How to completely restrict a postgres role to a single schema

I’d like to create a readonly role for a third party to access a handful of tables from the public schema without being able to view the rest of the tables in public.

My initial idea was to create a new schema ‘readonly’ and then create views in that schema:

create view readonly.table1 as select * from public.table1 

Then alter the search path for the readonly user to limit it only to the ‘readonly’ schema. However, it looks like I can still view the public schema as that role (though I can’t select anything from any tables in schema public).

Is there a way to remove all visibility into the public schema from a role? Unfortunately, moving everything to a different schema is not possible.