Thursday, 3 October 2013

Combining last-of-type and hover

Combining last-of-type and hover

I have the following html structure:
<ul>
<li>
<a href="#"> Superlevel 1 </a>
<span class="actions">Somes actions</span>
<ul>
<li>
<a href="#">Level 1 </a>
<span class="actions">Other actions</span>
<ul>
<li>
<a href="#">Sub-Level1</a>
<span class="actions">Sub Level actions</span>
</li>
<li>
<a href="#">Sub-Level1</a>
<span class="actions">Sub Level actions</span>
</li>
</ul>
</li>
</ul>
<li>
</ul>
The css is this:
.treeview li .actions {
float: left;
padding: 0 15px;
visibility: hidden;
}
.treeview li:hover > .actions {
visibility: visible;
}
The problem is that when I pass the mouse over the last li (sub-level 1)
the .actions of its parents Level1 and Superlevel1 are displayed. I would
like only sub-level1 .actions to be displayed.
So I have tried to replace last css block by:
.treeview li:hover:last-of-type > .actions {
visibility: visible;
}
but the last-of-type pseudo-selector is applied to li not to li:hover.
Any idea of how to combine these two pseudo-selectors ?

Wednesday, 2 October 2013

java weird increment syntax

java weird increment syntax

So I have always been taught that in Java, using the increment operator
after a variable name in an expression will do the expression, and then
increment the value and using the operator before a variable name in an
expression will do the increment before the evaluation. Like this:
int x = 0;
int y = x++;
after this executes y should be 0 and x should be 1. and in this example
int x = 0;
int y = ++x;
should be x = 1 and y = 1.
Following that same logic, the following...
int x = 0;
int y = 0;
x = y++ - y++;
should output 0 as x and 2 as y because 0 - 0 = 0. However the output is
x = -1
y = 2
Why is this?
Edit: the value of y does not matter. x will always equal -1 and y will
(in the end) equal y + 2.

Error when uploading a big image with CodeIgnitor

Error when uploading a big image with CodeIgnitor

I try to upload big images (>~1.5MB) to my website using PHP but the file
dont appear on the server. Sometimes I get Error 1 (Max size exceeded).
Is there anything I can do?
public function do_upload($field) {
$config['upload_path'] = './uploads/';
$config['max_size'] = '100000';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
if (!$this->upload->do_upload($field)) {
$error = array('error' => $this->upload->display_errors());
return $error;
} else {
/*$data = array('upload_data' => $this->upload->data());
return $data;*/
$updata =$this->upload->data();
$data = $updata['raw_name'].$updata['file_ext'];
return $data;
}
}
Here can I call the function:
$pic = $this->do_upload('inputUpProfile');
Here I save the picture to the database:
if ($this->input->post('post') == ''){
$type="image";
} else {
$type="image-with-text";
}
} else {
$pic = "";
$type = "text";
}
$result = $this->blog->addPost($_SESSION['user_id'], $type ,
$this->input->post('post'),$pic);
}
Models:
function addPost($user_id, $post_type, $post , $pic ) {
$today = date("Y-m-d H:i:s");
$vales = array('ev_user_id' => $user_id, 'ev_type' => $post_type,
'ev_text' => $post,'ev_pic' => $pic, 'ev_date' => $today);
$this->db->insert($this->table_name, $vales);
}
The error:
Error Number: 1054
Unknown column 'Array' in 'field list'
INSERT INTO events (ev_user_id, ev_type, ev_text, ev_pic, ev_date) VALUES
(1, 'image', '', Array, '2013-10-02 23:32:50')

VMWare WSX over internet

VMWare WSX over internet

I have VMWare Workstation 10 on my computer. I have also installed VMWare
WSX and shared a Virtual Machine. I can access this VM by going to
http://localhost:8888 (default port for test purposes). However, I would
like to be able to access this web portal pretty much anywhere from the
internet.
I've read that using dynamic DNS services would achieve this goal but I'm
not sure on how to properly configure this. Is what I'm trying to do
possible?

Can historical management be simulated with a SVN?

Can historical management be simulated with a SVN?

Introduction:
Hello, basically what i need to do is to simulate historical management
(in the terms of DB historical management) for a set of files, containing
compilable and executable pieces of code.
Explanations:
In DB historical management an object consists of its states, which are
determined by the dates of the actual modification. Then the object can be
fetched at given date along with the information that is current for that
given date. This is the behavior that I am trying to implement for the
files that I am going to execute. Since the most natural way of persisting
the project files is via a SVN product, It crossed my mind that it may be
possible that such feature is already implemented in Subversion or other
Version Control System. What i need is - by a given date and may be a
request to the svn server, to receive the "right" version (according to
the date) of the document that I am keeping track to.
The question:
Currently I am using Subversion and TortoiseSVN, but I am not familiar
with the advanced featured and seek some help here. Can I retrieve a file
version stored within my SVN from my java code?
Any help will be appreciated, Regards,
Milen

Tuesday, 1 October 2013

How do I find INSERT_PATH_TO_JSON_CONFIG_PATH

How do I find INSERT_PATH_TO_JSON_CONFIG_PATH

I am trying to set up a dropbox API on my php website.
It requires that I specify "INSERT_PATH_TO_JSON_CONFIG_PATH"
I have absolutely no idea how to find it.
Any tips would be appreciated.

How to use variable inside parameter $_GET? example: ($_GET[$my_var])

How to use variable inside parameter $_GET? example: ($_GET[$my_var])

I'm developing a plugin for wordpress, the parameter of the $ _GET is
recorded in the database according to the preference of the User via the
Wordpress Admin Panel. The following validation has to be via the $ _GET,
this is the function:
$db_url = get_option('my_get_url');
// returns the value of the database entered by User
// on this case return --> page=nosupport
$url_explode = explode("=", $db_url);
$url_before = $url_explode[0]; // --> page
$url_after = $url_explode[1]; // --> nosupport
echo "Before: ".$url_before; // here are ok, return --> page
echo "After: ".$url_after; // here are ok, return --> nosupport
My problem is here:
// here $_GET no have any value, dont work on validate...
if($_GET[$url_before] != ""){
if($_GET['$url_before']=="nosupport"){
// my function goes here...
}
}
I using for test the parameter:
echo $_GET[$url_before];
But dont return any value...

Downloading contents of the web page

Downloading contents of the web page

I want to write a python program to download the contents of a web page,
and then download the contents of the web pages that the first page links
to.
For example, this is main web page http://www.adobe.com/support/security/,
and the pages I want to download:
http://www.adobe.com/support/security/bulletins/apsb13-23.html and
http://www.adobe.com/support/security/bulletins/apsb13-22.html
There is a certain condition I want to meet: it should download only web
pages under bulletins not under
advisories(http://www.adobe.com/support/security/advisories/apsa13-02.html)
#!/usr/bin/env python
import urllib
import re
import sys
page = urllib.urlopen("http://www.adobe.com/support/security/")
page = page.read()
fileHandle = open('content', 'w')
links = re.findall(r"<a.*?\s*href=\"(.*?)\".*?>(.*?)</a>", page)
for link in links:
sys.stdout = fileHandle
print ('%s' % (link[0]))
sys.stdout = sys.__stdout__
fileHandle.close()
os.system("grep -i '\/support\/security\/bulletins\/' content >> content1")
I've already extracted the link of bulletins into a content1, but don't
know how to download the content of those web pages, by providing content1
as input.
The content1 file is as shown below:-
/support/security/bulletins/apsb13-23.html
/support/security/bulletins/apsb13-23.html
/support/security/bulletins/apsb13-22.html
/support/security/bulletins/apsb13-22.html
/support/security/bulletins/apsb13-21.html
/support/security/bulletins/apsb13-21.html
/support/security/bulletins/apsb13-22.html
/support/security/bulletins/apsb13-22.html
/support/security/bulletins/apsb13-15.html
/support/security/bulletins/apsb13-15.html
/support/security/bulletins/apsb13-07.html

How can I tell if a TCP port is open or not=?iso-8859-1?Q?=3F_=96_unix.stackexchange.com?=

How can I tell if a TCP port is open or not? – unix.stackexchange.com

I am trying to implement socket programming in C. When I try to connect
from a client to a server (Ubuntu), it shows an error like "connection
failed". So I think the problem is with the port. I am …