Posts

Eliminate null results from case query - no null values in source

I am trying to pull off a complicated aggregation and concatenation query to prep data for import to a website, aggregating multiple results rows and columns into one row per ID. I'm almost there, except that I am getting a lot of NULL results despite there being no NULL values in the source data. Source data: id value_1 value_2 value_3 type x1 sometext othertext moretext A2 x1 sometext othertext moretext B1 x1 sometext othertext moretext B2 x2 sometext othertext moretext B1 x2 sometext othertext moretext A2 x2 sometext othertext moretext B1 The following: select distinct id, case when type='A2' then string_agg (concat(cast (value_1 as nvarchar (max)),value_1,value_2,value_3)) end as type_A2, case when type='B1' then string_agg (concat(cast (value_1 as nvarchar (max)),value_1,value_2,value_3)) end as type_B1 from source group by id, type Produces: id type_a2 type_B1 x1 sometextothertextmore...

Using Scrapy to iterate through Boxscore links on footballdb

I need to iterate through all the boxscore links with scrapy and then extract the passing,rushing, and receiving tables from each of the boxscores to create a dataset. Main problem is my code returns nothing when I run it. import scrapy from scrapy.linkextractors import LinkExtractor from scrapy.spiders import CrawlSpider, Rule class Nfl20Spider(CrawlSpider): name = 'nfl20' allowed_domains = ['www.footballdb.com'] start_urls = ['http://www.footballdb.com/games'] #fixed to iterate through all box scores rules = ( Rule(LinkExtractor(restrict_xpaths='.//table/tbody/tr[1]/td[7]/a'), callback='parse_item', follow=True), ) def parse_item(self, response): item = {} #table of stats. #need to fix so that it only prints out the text and not the html elements. item['table'] = response.xpath('//table/tbody').extract_first() print(item['table']) yield item Was...

React router not matching any route, always goes to 404 route

React router can't match any route and always shows last ( NotFound ) component. Everything works fine if I use BrowserRouter from 'react-router-dom' instead of Router . But I have to use Router because I have to use custom history (for which I am using history library). Heres my code. import { Router, Route, Switch } from 'react-router-dom'; import { createBrowserHistory } from 'history'; import ExpenseDashboardPage from '../components/ExpenseDashboardPage'; import AddExpensePage from '../components/AddExpensePage'; import EditExpensePage from '../components/EditExpensePage'; import HelpPage from '../components/HelpPage'; import NotFound from '../components/NotFound'; import Header from '../components/Header'; import LoginPage from '../components/LoginPage'; export let history = createBrowserHistory(); function AppRouter() { return ( <div> <Router history={history}> ...

How can I specify a configuration file in ArangoDB docker image?

I'm trying to spin up an ArangoDB server via docker compose. It all works out fine with default configuration, but I'm struggling to make the server in the container pick up a custom configuration file with minimal setup I've tried with overriding the startup sequence with the following: command: > arangod --configuration /arango.conf I've checked and the file is present in the container, but when I check the configuration file via query through arangoshell it still references the default settings and the arangod.conf file placed in the /tmp folder. Any hints? from Recent Questions - Stack Overflow https://ift.tt/38H3DV0 https://ift.tt/eA8V8J

How to insert shapes as PushButton displayable on the GraphicView?

Image
I'm trying to integrate shapes (such as rectangles / squares / triangles) as PushButton, and when pressing on a button, want the selected shape to be selected. But I want to make it displayable on my GraphicView with the selected color I made with my ColorWheel. How can I do that? Here a screen of my actual work below: from Recent Questions - Stack Overflow https://ift.tt/3rzcqAU https://ift.tt/3pvlpkJ

Generate all permutations of n entries in a w x h matrix

I'd like to generate all the permutations of n entries in a w x h matrix: example with a 2x2 matrix and n = 1: | 1 0 | | 0 0 | | 0 1 | | 0 0 | | 0 0 | | 1 0 | | 0 0 | | 0 1 | example with a 3x3 matrix and n = 2 (partial): | 0 0 1| | 0 0 1| | 0 0 0| | 1 0 0| | 0 0 1| | 0 0 0| ... I would like to avoid the usage of numpy, so I think itertool is the way to go. I am looking at one dimensional solutions but all I got is something slightly different , like itertools.product that iterates with a fixed number of values, e.g. itertools.product([0,'n'],repeat=6) [(0, 0, 0, 0, 0, 0),....('n', 'n', 'n', 'n', 'n', 'n')] any hint would be gladly appreciated from Recent Questions - Stack Overflow https://ift.tt/2KBqXvs https://ift.tt/eA8V8J

How can i send data from javascript to php and use him in MySQL query?

i'm trying to show some data from my sql database in some outputs. But to do that, i need to send a value from javascript to php, and it works, i do a echo and he show me the right value, the problem is, when i do my query SELECT * FROM utilizador WHERE idutilizador ='$id' he return 0 rows, but if i do SELECT * FROM utilizador WHERE idutilizador ='11' he shows me what i want. This is where i translate my value from javascript to php: $id = "<script>document.write(variavel_js)</script>"; and this is my php code to execute the query: $sql = "SELECT * FROM utilizador WHERE idutilizador ='$id'"; $result = mysqli_query($conn,$sql) or die ("erro"); $row_usuario = mysqli_fetch_assoc($result); Can somebody help me? from Recent Questions - Stack Overflow https://ift.tt/2M9KJON https://ift.tt/eA8V8J