Thursday, 3 October 2013

Find Value in colum - if found get value from row

Find Value in colum - if found get value from row

I have a spread sheet where i would like to find a value
This tells me how many i have in the colum if cems. Now what i need to do
is if that row has done in called cems - return the value in cell D. and
work my way down to get them all.
How would i do this?

Wednesday, 2 October 2013

Alternating Group

Alternating Group

Suppose that $H$ is a subgroup of $S_n$ of odd order. Prove that H is a
subgroup of $A_n$.
How can I solve this problem without using Cayley's Theorem? So far, I
understand that H contains both even and odd permutations but how would
this make a difference? Thanks.

Selecting results from 2 tables based on the variables in 3th table

Selecting results from 2 tables based on the variables in 3th table

I have 2 tabes in my database:
users - userID(primary key), username, password
courses - id(primary key), name, text
subscriptions - id(primary key), curso_id, user_id
right in the subscription table I am writing the users UserID inside ->
user_id with the id of the course for which he is subscribed curso_id so
the results in the subscrption database are like
id user_id curso_id
1 12 1
2 5 1
3 12 2
4 6 7
My question is how to make a sql Query which first select the course by
$row['id'] which indicates the id variable from the courses database, and
after that based on the 3th table subscription to list all the users which
are subscribed to this course number. ?
and second question is how to list number of the subscribed users for a
course selected by
$row['id']

What does operator mean, sql?

What does operator mean, sql?

I came accross the sql query where the <=> operator is put. What does <=>
operator mean?
SELECT STR_ID, TEX_TEXT AS STR_DES_TEXT, IF( EXISTS( SELECT * FROM
SEARCH_TREE AS SEARCH_TREE2 WHERE SEARCH_TREE2.STR_ID_PARENT <=>
SEARCH_TREE.STR_ID LIMIT 1 ), 1, 0) AS DESCENDANTS FROM SEARCH_TREE
This sql is of MySQL type.

fputcsv() error with array

fputcsv() error with array

i tried to make a simple csv export with an easy array, but the server
tells me on every loop "fputcsv() expects parameter 2 to be array, string
given in"
Here is my Array:
"array(12) {
["gender"]=>
string(1) "1"
["first_name"]=>
string(6) "Daniel"
["last_name"]=>
string(5) "Weiß"
["street"]=>
string(12) "Langestrasse 1"
["plz"]=>
string(5) "45265"
["city"]=>
string(8) "Munich"
["country"]=>
string(3) "ger"
["tel"]=>
string(10) "0123456789"
["mobile"]=>
string(0) "0987654321"
["fax"]=>
string(0) ""
["email"]=>
string(8) "yo@lo.de"
["invest"]=>
string(1) "3"
}
Here is the very very simple code
// EXPORT
$fp = fopen('export.csv', 'w');
foreach( $form as $fields ) {
echo $fields;
fputcsv($fp, $fields, ';');
}
fclose($fp);

Tuesday, 1 October 2013

Ubuntu starts in terminal mode not GUI after installed zone minder

Ubuntu starts in terminal mode not GUI after installed zone minder

I was trying to install zoneminder on my Ubuntu 12.04 on my laptop
following this link: http://janhellevik.com/?p=1045
After I reboot my computer, I can not start up ubuntu desktop anymore.
Only a maximized terminal can be seen.
I tried startx, lightdm and also checked the default run level, it's set
as 2.
Can anyone help me to fix this? Or at least let me what's the problem of
this. I have no clue at all..
Thank you very much!

Show Base64 file as PNG

Show Base64 file as PNG

Images are captured by one part of our system as PNG files and then base64
encoded and stored on Amazon S3. We'd like to display these images in HTML
emails that are sent and the obvious issue is that they are base64
encoded.
Linking directly to the object doesn't work, and it seems that using an
image tag such as the following does not display the image in any email
client I've tried (Gmail, Live/outlook.com, Outlook, Apple Mail):
<img src="data:image/png;charset=utf-8;base64,http://url/filename" />
Any ideas? I don't have control over the fact that the objects are written
as Base64. I could read/download the objects ahead of time but cannot
write to the file system, so any real-time conversion would need to be
done in memory. Hoping for a solution that leverages HTML. This is not a
background image - it will be in the body itself.
Edit: I've also tried just putting the base64 string in place of the URL -
which works in some cases, but some email clients (like Gmail) won't
display it - which is why I'm preferring a URL-based solution.