Tuesday, 1 October 2013

3G Mobile Internet setup on Raspberry Pi

3G Mobile Internet setup on Raspberry Pi

So I've been struggling to setup my 3G dongle on my raspberry pi (running
Raspbian).
I've installed network-manager and network-manager-gnome since that seems
to be the common solution, but when running the Mobile Broadband wizard to
setup a new device, my stick isn't listed. It just says "Any Device" and
it's grayed out.
I've already installed usb-modeswitch as well and my device is listed
(using lsusb) as:
Bus 001 Device 004: ID 12d1:1446 Huawei Technologies Co., Ltd.
E1552/E1800/E173 (HSPA Modem)
What can I try?

Monday, 30 September 2013

Unable to shut down: failed to execute child process "lubuntu-logout" (no such file or directory)

Unable to shut down: failed to execute child process "lubuntu-logout" (no
such file or directory)

I am unable to shut down after i uninstalled many programs in lubuntu
using software center. The error message that I get is:
Failed to execute child process "lubuntu-logout" (no such file or
directory).

properties of measure zero sets – math.stackexchange.com

properties of measure zero sets – math.stackexchange.com

Let $X \subset R$ be a Lebesgue measure zero set. Prove that there exists
a $p \in R$ such that the set $p + X = \left\{p + x | x \in X\right\}$ has
no rational points. Here is my approach : Let …

Looks like logs are crashing my Django app

Looks like logs are crashing my Django app

I have a Django app running on heroku. The app keeps crashing with the
following stacktrace:
Traceback (most recent call last):
File "/app/.heroku/python/bin/honcho", line 9, in <module>
load_entry_point('honcho==0.4.2', 'console_scripts', 'honcho')()
File "/app/.heroku/python/lib/python2.7/site-packages/honcho/command.py",
line 292, in main
app.parse()
File "/app/.heroku/python/lib/python2.7/site-packages/honcho/command.py",
line 129, in parse
options.func(self, options)
File "/app/.heroku/python/lib/python2.7/site-packages/honcho/command.py",
line 190, in start
sys.exit(process_manager.loop())
File "/app/.heroku/python/lib/python2.7/site-packages/honcho/process.py",
line 114, in loop
File "/app/.heroku/python/lib/python2.7/site-packages/honcho/printer.py",
line 22, in write
Process exited with status 1
From Honcho's printer.py source code it looks like someting is going wrong
while honcho is trying to write to the console.
My app is pulling data from web pages so I may print some text with
accented characters. Is that related ?
Currently i'm printing things like this:
logger.info('Saved article' + str(title) + '.')
I may also dump some json from time to time:
logger.debug('Article: %s' % json.dumps(article_datas, indent=4))
It is working fine on my development machine but not on Heroku. Do I need
to log things differently ? Why is this not working on Heroku ?

how do i set validation on select tag in my form

how do i set validation on select tag in my form

i want to set validation on select tag in my form so that the user cannot
proceed without choosing a location.
below is the form...
<form name="form1">
Pickup Suburb:
<select id="pick" class="pick" name="pick"/><br />
<option value="none">-- Please select a location --</option>
<option value = 1>City </option>
<option value = 2>Airport </option>
<option value = 3>Abbotsbury </option>
<option value = 4>Abbotsford </option>
<option value = 5>Acacia Gardens </option>
<option value = 6>Agnes Banks </option>
<option value = 7>Airds </option>
<option value = 8>Akuna Bay </option>
</select>
<br />Rear facing baby seat <select class="rfbs" name="rfbs"
style="width:50px">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
</select><br />
<br />Booster seat <select class="bs" name="bs" style="width:50px">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
<br /><br />Luggage Trailer <select class="lt" name="lt" style="width:50px">
<option value="0">0</option>
<option value="1">1</option>
</select>
<br />
<br /><input class="show-popup" type="submit" value="Get Quote">
</form>
i have applied a javascript popup window to show the results when user
fills the form so is it possilbe to apply validation that shows a
error,message if the user tries to submit the form without choosing a
location.
any help would be highly appreciated.
Thakns.

Sunday, 29 September 2013

PHP Function to grab the Featured Image (Wordpress) and Integrate in Pinterest Button

PHP Function to grab the Featured Image (Wordpress) and Integrate in
Pinterest Button

I have this code inserted in the Function.PHP file of my wordpress this.
What it basically do is
If the user click on the Pinterest PIN IT Button, It checks the blog post
page for the FIRST Image and return it to be Pinned in Pinterest.
Is it possible if someone can modify the code so that it will totally
ignore all the images in the blog post page and instead choose the
Featured Image?
Catch the First image funtion:
function catch_that_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i',
$post->post_content, $matches);
$first_img = $matches [1] [0];
if(empty($first_img)){ //Defines a default image
$first_img =
"http://www.bendaggers.com/wp-content/themes/Lord%20of%20Avernus%20-%20Abaddon/Images/Deafult_Img.png";
}
return $first_img;
}
Wordpress Featured Image:
<?php the_post_thumbnail(); ?>

Use WHERE in an INSERT INTO statement

Use WHERE in an INSERT INTO statement

I'm trying to let users insert a subject to an image. I know I can't use a
WHERE clause in combination with an INSERT INTO statement, and I know that
I should use SELECT. I am very new to mysql and I didn't understand the
results I tried to search on google. So I needed a more specific answer;)
$classed = mysql_query("INSERT INTO images (subject) VALUES
('$_POST[subject]') WHERE image_id='$_POST[id]'");