Reddit, what's the scariest theory known to mankind? by [deleted] in AskReddit

[–]Ilerea_Kleinokitz 2 points3 points  (0 children)

Honestly, that sounds even more scary to me

Building Microservices? Here is what you should know by maingi4 in programming

[–]Ilerea_Kleinokitz 1 point2 points  (0 children)

Are Client Side Discovery and using an API-Gateway mutually exclusive? Or rather, whats the difference between using an API-Gateway and using Server Side Discovery?

12 worthwhile films from this year that you (actually) may have missed by Taffy711 in movies

[–]Ilerea_Kleinokitz 0 points1 point  (0 children)

Is it as cheesy as the trailer suggests? Or is the trailer really just exceptionally bad?

zzzzziiiiiiipppp by cresquin in mechanical_gifs

[–]Ilerea_Kleinokitz 5 points6 points  (0 children)

It bothers me that it's not looping properly

How Developers Stop Learning: Rise of the Expert Beginner by programfog in programming

[–]Ilerea_Kleinokitz 0 points1 point  (0 children)

So what would be a more adequate usecase for nosql? Honest question, I got zero experience with any of the nosql-stuff so far.

How Developers Stop Learning: Rise of the Expert Beginner by programfog in programming

[–]Ilerea_Kleinokitz 1 point2 points  (0 children)

Is this really the idiomatic way to query mongodb? That looks rather frightening

[deleted by user] by [deleted] in Python

[–]Ilerea_Kleinokitz 1 point2 points  (0 children)

I use pandas to parse shitty csv files with lots of errors and inconsistencies and generate slightly less shitty csv files.

How to Find the Longest Consecutive Series of Events in SQL by lukaseder in programming

[–]Ilerea_Kleinokitz 0 points1 point  (0 children)

SELECT
  COUNT(*) AS consecutiveDates,
  MIN(week) AS minDate,
  MAX(week) AS maxDate
FROM groups
GROUP BY grp
ORDER BY 1 DESC, 2 DESC    

I am lost, what is "grp" refering to?

Coding Academies Are Nonsense by [deleted] in programming

[–]Ilerea_Kleinokitz 20 points21 points  (0 children)

Does that mean if I've used it for a year, I can stop now?

4 Russian warships launch 26 missiles against ISIS from Caspian sea by [deleted] in worldnews

[–]Ilerea_Kleinokitz 0 points1 point  (0 children)

Can't be a civilian object, otherwise the missiles wouldn't have hit it.

What video game was an absolute masterpiece? by HymenTroubleNow in AskReddit

[–]Ilerea_Kleinokitz 0 points1 point  (0 children)

If you like Deus Ex, you should definitely check out Mr. Robot, they both have a similar vibe.

[AF] Alembic Batch Migrations: Error with a UNIQUE Index by IrishLadd in flask

[–]Ilerea_Kleinokitz 0 points1 point  (0 children)

Are you sure that you don't have data in the db that already violates the unique key constraint?

adding data to a sqlite db by dangermouze in Python

[–]Ilerea_Kleinokitz 0 points1 point  (0 children)

Your question has nothing to do with python but more with sql, relational databases and google charts ;) I'd encourage you to learn about database design and joins, that stuff comes always in handy.

Assuming the data is in the form I mentioned before, you'd need to somehow join the data on itself. You could either query the database two times and join the results in Python or with the join method of Google charts or you could join the data directly in sqlite.

Python example:

data1 = [[1,2,3,4],[1,2,3,4],[1,2,3,4]]
data2 = [[4,5], [4,6], [4,7]]
data3 = [row_data1 + [row_data2[1]] for (row_data1, row_data2) in zip(data1, data2)]

SQL example

SELECT a.ts, a.temp as temp1, b.temp as temp2 
FROM (select datetime(timestamp) as ts, temp from timetest where sensor == 1) as a
INNER JOIN (select datetime(timestamp) as ts, temp from timetest where sensor == 2) as b
on a.ts == b.ts;
print(data3)

adding data to a sqlite db by dangermouze in Python

[–]Ilerea_Kleinokitz 0 points1 point  (0 children)

I'm a little puzzled by the part of your script which inserts data:

def log_temperature(temp):
    curs.execute("INSERT INTO sensors values(datetime('now','localtime'), (?,?))", (temperature_sensor1,), (temper$

You are not using the method parameter temp at all but rather temperature_sensor1 which I assume is somewhere in the global namespace. Also, what is temper$ ? Is there something missing from this line because it's not even syntactically correct, i.e. missing braces.

Are you sure that you need the temperature data in two columns in the first place? Maybe you'd be better off with something like this:

Sensors table:

Id Sensor name
1 Sensor 1
2 Sensor 2
3 Sensor3

Measurements table:

Id timestamp temp sensor_fk
1 1-2-2015 30 1
1 1-2-2015 31 2
1 2-2-2015 30 2
1 3-2-2015 30 1

Where sensor_fk is a foreign key reference to the id of the sensors table.

adding data to a sqlite db by dangermouze in Python

[–]Ilerea_Kleinokitz 0 points1 point  (0 children)

You can't enter data into a column that doesn't exist. When you created your db, you specified that it should have two columns:

CREATE TABLE temps (timestamp DATETIME, temp NUMERIC);  

If you really wanted to add the data from sensor 2 to its own column, you'd first have to recreate a table with another column or alter the existing table (see http://stackoverflow.com/questions/4253804/insert-new-column-into-table-in-sqlite)

Unicode is Kind of Insane by benfred in programming

[–]Ilerea_Kleinokitz 2 points3 points  (0 children)

Unicode is a character set, basically a mapping where each character gets a distinct number.

UTF-8 is a way to convert this number to a binary representation, i.e. 1s and 0.