Saturday, 8 June 2013

Edit all lines at once

Edit all lines at once

I have a .txt file with almost all the airports of the world. Each line is a different airport, and the lines are in this format: City, Country - Airport Name (Airport Code)
ie:
Le Mans, France - Arnage (LME)
Detroit, USA - Willow Run (YIP)
San Francisco, USA - San Francisco International (SFO)
(the complete .txt is here: http://snipt.org/AnT8)
But I want in this format: "City, Country - Airport Name (Airport code)" => "Airport Code"
(yes, with quotes, it's for PHP codding)
ie:
"Le Mans, France - Arnage (LME)" => "LME"
"Detroit, USA - Willow Run (YIP)" => "YIP"
"San Francisco, USA - San Francisco International (SFO)" => "SFO"
How can I do this at once?
Thank you.

Password not working in Graphical Applications (gksu)? Works with sudo

Password not working in Graphical Applications (gksu)? Works with sudo

I am having a problem where when I try to run say GParted, when I am prompted for a password, it says "Incorrect Password"
But when I enter the same password using terminal sudo gparted for example, it works. Why is that?
UPDATE
I noticed that theres a difference between using sudo and gksu. The later will fail with incorrect password ...

D-Link Modem: DSL and Internet lights are off, browser-based administration page cannot be reached

D-Link Modem: DSL and Internet lights are off, browser-based administration page cannot be reached

I've used my D-Link DSL-526B for more than three years, but recently it cannot connect to the internet. So far I've been able to isolate these symptoms:
DSL and Internet lights is off
I've tried numerous time restarting it, nothing happens
I've tried hard-resetting it, still nothing happens
I've flushed my OSX DNS Cache just in case
I tried accessing its web-UI dashboard at 192.168.1.1, it cannot be accessed. I pinged it, it shows RTO responses
My questions would be: 1. What is possibly happening? 2. How to fix it I need it to back online as soon as possible?
Thanks. I really appreciate your responses

Deep concepts in database

Deep concepts in database

I am a student. And preparing myself for an interview. Following are some questions regarding databases, which are confusing me and i am unable to get an appropriate answer of these. please answer following questions.
1) Differentiate between database schema, meta-data and data dictionary?
2) DML(Data Manipulation Language) and DDL(Data Definition Language) are common, but what is DCL?
3) Difference between Stored Procedure and UDF?
4) Physical memory is allocated to Views or not?
5) Difference between clustered and non-clustered index? When to use which one?
6) How many possible indexes can be created for a table?
7) Can indexes be for composite keys rather than single key?
8) If I have two Tables: Employees(Emp_Id,Emp_Name) and Contact(Emp_Id,Cell_No), then find
all those employees who don't have contact numbers.

How do I install Ubuntu Studio 13.04 from a DVD?

How do I install Ubuntu Studio 13.04 from a DVD?

So, I burned the 32-bit ISO image to a blank DVD. Check. I'm not very Linux-savvy, I just know things are more complicated on this OS. So next, I put the DVD (with all its contents) into the drive and when I open it, there are a bunch of different folders. If I try to open any file in a folder, it says "Could not display "/media/Ubuntu-Studio 13.04 i386/install/mt86plus"." and "the file is of an unknown type." What do I do? Is there a specific software I need JUST to install it? Sort of like a catalyst? Any help is appreciated.

Process uploads with phpThumb before generating thumbnails

Process uploads with phpThumb before generating thumbnails

I was wondering if anyone knew a way (via function, plugin, or another method) of using phpThumb to process an image on upload, and then for Wordpress to generate it's usual image sizes from both the original and the processed image?
Basically I'm using phpThumb to generate an alpha channeled version of the image, to use in some specific areas, using this (where the h & w are the measurements or the original image, which could be variable)
<img src="phpThumb/phpThumb.php?src=black.jpg&h=487&w=320&iar=1&fltr[]=mask|originalimage.jpg&f=png&hash=xxxxxx">
If I then set a bunch of custom image-sizes, for example:
add_image_size( 'normal-large', 800, 400, false );
add_image_size( 'normal-medium', 600, 300, false );
add_image_size( 'normal-small', 40, 200, false );
add_image_size( 'mask-large', 800, 400, false );
add_image_size( 'mask-medium', 600, 300, false );
add_image_size( 'mask-small', 40, 200, false );
I'd like for the three normal-x sizes to generate from the original image, as per normal, and then the three mask-x sizes to be generated, using the processed version of the image.
Cheers

Sunday, 2 June 2013

What does a good coax grounding scheme look like?

What does a good coax grounding scheme look like?

Say I have some coax between a receiver and an antenna. That coax will have three currents in it:

the desired signal
an exactly equal an opposite current on the inside of the shield (really, also the desired signal)
noise on the outside of the shield
Now if there were a twisted pair inside the shield, I'd connect that pair to a differential amplifier, and the shield to the chassis. I'd be sure the currents in the chassis, which are all noise, can't flow through my amplifier.
But this is just ordinary coax, with only one center conductor. Although the signal is trapped inside the coax by the shield, and the noise is trapped outside by skin effect, what keeps the noise and signal separate once this coax terminates at the receiver? In other words, how do I provide a reference for my receiving circuitry that isn't affected by the noise currents (3)? Or, is that not possible?

Does Will Smith & Jaden Smith looking foreword for Axtelera-Ray after their movie After Earth?

Does Will Smith & Jaden Smith looking foreword for Axtelera-Ray after their movie After Earth?

Does Will Smith & Jaden Smith going to do Axtelera-Ray after their movie 'After Earth' which was not successful on the box-office as expected.
Critics are excoriating "After Earth," the Will Smith science-fiction adventure that appears to have been made for the sole purpose of convincing the world that son Jaden Smith is dad's A-list equivalent.
Not all the reviews are in, so the consensus could tilt in a more favorable direction, but as of Thursday morning, "After Earth" had scored a doleful 13 percent "rotten" rating on the critics aggregator Rotten Tomatoes.
Are they still looking foreword for the famous 'Axtelera-Ray' series?

Meaning of Capitalization in Y/N Prompts [migrated]

Meaning of Capitalization in Y/N Prompts [migrated]

When running a script that requires a yes or no response before proceeding, does the capitalization of the y and n usually matter?
In this example...
$copy_package some_package
File X is missing...
Do you want to continue ? (y/N) 
I, as a user, expect that N is the recommended answer since it's capitalized (and because a file is missing), and y is not recommended since it's lower-case.

Update user meta on custom wordpress form and redirect

Update user meta on custom wordpress form and redirect

I have a fully functioning custom wordpress form that updates the user meta when they are logged in, however when I submit it just reloads the same page I am on, I am trying to get it to redirect to a thank you page. How would I go about this? Current working code I am using below. Thanks.
    <?php 
        global $current_user;
        get_currentuserinfo();
    if($_POST['gender'] != '') {
    $gender_update = $_POST['gender'];
    update_user_meta($current_user->ID,'gender', $gender_update);
    }
        ?>

<?php
function curURL() {
$pageURL = 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
return $pageURL;
}
?>

<form name="userform" method="post" id="adduser" class="user-forms" action="<?php echo curURL(); ?>"  >

Debian permissions not sticking for new content

Debian permissions not sticking for new content

I've set up a VM with Debian7 for PHP development.
Since PHP needs to write to log files and the like, the www-data group needs write permissions on /var/www/...
I found a good answer here on superuser that makes it go real quick: http://superuser.com/a/19333
However, when I update a project with composer and new cache/log files are created, www-data does not have permission to write to them and I have to execute the last 2 commands again.
I was under the impression that setting permissions to 2775 meant that all future files would have the 775 permission? Or am I wrong about that? Is there a way to prevent having to reset the permissions every time or am I stuck having to do this?
Granted, it's not something that happens often, I'm just curious if there's a way to avoid it, other than setting up a cron job for it.

Vashikaran and black magic specialist +91-9914703222

Vashikaran and black magic specialist +91-9914703222

Like jadu-tona.
Business related problems.
Husband and wife relationship.
Be free from enemy / 2nd wife
Settle in foreign.
Desired love.
Disputes between husband / wife.
Problems in study.
Childless Women.
Intoxication.
Physical problems.
Domestic controversy.
Problems in family relations.
Promotions or willful marriage.
Lottary & lucky nomber 16To Get your love back 17To make your or your partner’s parents to Love Marriage 18get your love back by black magic 19:vashikaran mantra for love 20how to get my ex-back 21To Control the mind of husband/wife or a desired person. 22To Wealth and Peace in Home 23To Kundli and Match Making 24get your love back by islamic vashikaran 25To solve the problems between any Relationship 26VASHIKARAN, LOVE LOST, HUSBAND/WIFE DISTRIBUTE, 27:vashikaran mantra for husband 28To attract any Girl/Boy towards you with heart. 29To make your or your partner’s parents to Love Marriage 30:To improve professional and personal relationships with others. 31:To win favors from others, exert pressure and control over them, and get what you want from them. 32To create a good impression on others and create love and affection in their hearts and minds. 33Dispute with Husband or Wife, HAR SAMSEYA KA SMADHAN PAYE
Contact: +91-9914703222
E-mail:-deendayal854@gmail.com
Website :- www panditdeendayal.com

How to import data to Amazon S3 from URL

How to import data to Amazon S3 from URL

I have an S3 bucket and the URL of a large file. I would like to store the content located at the URL in the S3 bucket.
I could download the file to my local machine and then upload it to S3 with Cloudberry or Jungledisk or whatever. However, if the file is large, this may take a long time because the file must be transferred twice, and my network connection is much slower than Amazon's.
If I have a lot of data to store in S3, I can start an EC2 instance, retrieve the files to the instance with curl or wget, and then push the data from the EC2 instance to S3. This works, but it's a lot of steps if I just want to archive one file.
Any suggestions?

Can I estimate remaining battery life by measuring its voltage with the same MCU that powers it?

Can I estimate remaining battery life by measuring its voltage with the same MCU that powers it?

I'd like to estimate the remaining battery life of a battery that powers a microcontroller. Could I accomplish this by simply leading the battery into the MCU's built-in ADC?
My idea is that I could plot the voltage over time to figure out how much battery life remains. But would the change in voltage be noticeable? And would it be a problem that the same battery powers the MCU (and ADC)?
Where's the redirect happening?

I've inherited a Wordpress site. Have a ton of PHP experience but only moderate Wordpress experience.
Currently the URL: http://iridescentlearning.org/technovation
Redirects to another page. My client wants that redirection changed. But I can't figure out where that redirection is happening.
The .htaccess file has this...
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
RewriteEngine on
<IfModule mod_suphp.c>
    suPHP_ConfigPath /home/ab6700/public_html/php.ini
    <Files php.ini>
        order allow,deny
        deny from all
    </Files>
</IfModule>
...which doesn't look to me like it does anything.
I've looked through all the Settings and can't see anything that has to do with redirection.
And the page it's redirecting to, I can't find anything there that suggests that the page should go to it.
I do see one plugin called "Better Anchor Links" but it's been deactivated.
So where is this redirection happening from?

Internet Speed Sub-Optimal on PC but fine on laptop

Internet Speed Sub-Optimal on PC but fine on laptop

I built a new PC and have been using a USB wireless adapter for internet access since my router/modem is in a different room. I have 12Mbps service. speedtest.net shows 6-12Mbps for the laptop but the PC never gets above 4.6Mbps. I've tried two USB wireless adapters. Both work fine in the laptop but I always get the slower speeds on the PC.
PC is spyware free and less than a month old.
PC stats: Windows 7 Ultimate 6 core CPU 8GB RAM USB Wireless adapter: TP-Link TL-WN321G (54Mbps). At first I was only getting about 1.5Mbps and then I installed the Win7 drivers from the TP-Link website and that's when I started getting 2-4.6Mbps.
Any ideas?

Tuesday, 28 May 2013

LISP or C++ for 3D game? [closed]

LISP or C++ for 3D game? [closed]

I want to make a epic FPV MMORPG and want it to be realistic as possible. Plan was to make a game with c++, but i found a much more powerful language called LISP by Richard Stallman.
It isn't very much used for game programming because it isn't as popular as c++ but i don't care about which one is popular, i just wanna make the best game possible.
Which dialect for LISP is the most useful for 3d game programming, opengl has an extension to common lisp but no other language then that, so should i learn CL? I heard naughty dog has programmed in lisp and it seems to be a much more cooler language.

Dynamically insert full-page image at nearest page break

Dynamically insert full-page image at nearest page break

The situation: I have a document that essentially consists of many pages of plain text. I would like to include a full-page image at the page break nearest to a given line. It is important that the image be inserted at a pre-existing page break (i.e. that there not be excess trailing whitespace on the page preceding the inserted image).
In other words, I want to start with a document looking like this:

I would then like to be able to insert some sort of command in the text at the red mark that causes the image to be inserted at the nearest page break, thus giving me a result that looks like this:

The page containing the image should contain no other content (i.e. no header/footer/etc), and the image should be resized so that it fills the entire page (the images will already be of the correct aspect ratio).



Here's what I've tried so far. In all of these cases, my_image.* is an image that has been sized to the same aspect ratio as my document (in this case, ebook, which is 2:3, so my images are mostly 800x1200 pixels).
First, the naive approach:
\documentclass[ebook]{memoir}
\usepackage{pdfpages} % to include the image-pdf
\usepackage{blindtext}

\begin{document}
    \blindtext[10] % some plain text
    \includepdf{my_image.pdf} % the image I want to be positioned somewhere around here
    \blindtext[10] % some more plain text
\end{document}
This obviously fails, because it inserts the image exactly at the position I requested, which may not be at a page break. I can of course manually futz with the positioning of the \includepdf so that it falls immediately after the end of the last paragraph that is immediately before a page break, but this is unpleasant and also not a practical solution since I have a somewhat large number of these images (at various positions throughout my document) to deal with.
Second, an approach that attempts to use floats:
\documentclass[ebook]{memoir}
\usepackage{pdfpages} % to include the image-pdf
\usepackage{blindtext}

\begin{document}
    \blindtext[10] % some plain text
    \begin{figure}
        \includepdf{my_image.pdf} % the image I want to be positioned somewhere around here
    \end{figure}
    \blindtext[10] % some more plain text
\end{document}
What this ends up doing is it makes my_image.pdf the "background" of one of the pages rather than placing my_image.pdf on a separate page.
I then tried adding \pagebreak before \begin{figure}, before \includepdf{my_image.pdf}, before \end{figure}, and after \end{figure}; none of these did anything useful either.
Third, I tried using some code from this tex.SE answer, and futzing with vertical margins (based on looking at the output of the layout package):
\documentclass[ebook,oneside]{memoir}
\usepackage{blindtext}
\usepackage{graphicx}
% \adjustimg and \centerimg from http://tex.stackexchange.com/a/39148/31395
\newcommand{\adjustimg}{% Horizontal adjustment of image
  \ifodd\value{page}\hspace*{\dimexpr\evensidemargin-\oddsidemargin}\else\hspace*{-\dimexpr\evensidemargin-\oddsidemargin}\fi%
}
\newcommand{\centerimg}[2][width=\textwidth]{% Center an image
  \makebox[\textwidth]{\adjustimg\includegraphics[#1]{#2}}%
}

\begin{document}
    \blindtext[10]
    \begin{figure}
     

How do I add API keys to recon-ng?

How do I add API keys to recon-ng?

Does anyone know how to add API-Keys to Recon-ng? https://bitbucket.org/LaNMaSteR53/recon-ng
im getting errors that say it wont work.

How can I 'compile' LaTeX snippets to (unicode) plain text?

How can I 'compile' LaTeX snippets to (unicode) plain text?

I have a bunch of LaTeX snippets which I'd like to convert, as faithfully as possible, to Unicode strings.
(In fact, these are title of papers from a bibliographic database, which I'd like to use as filenames.)
Can anyone suggest how to 'compile' a snippet of LaTeX into plain text?
Here are some examples:
{\it {A}rithm\^etik\^e stoichei\^osis}꞉ on {D}iophantus and {H}ero of {A}lexandria
On a geometry of {I}vanov and {S}hpectorov for the {O}'{N}an sporadic simple group
On a theorem of {P}l\"unnecke concerning the sum of a basis and a set of positive density
On some series containing {$\psi(x)-\psi(y)$} and {$(\psi(x)-\psi(y))^2$} for certain values of {$x$} and {$y$}
My primary concerns are essentially just converting accented characters to unicode correctly and removing superfluous braces. I don't care about preserving formatting (e.g. \it above), and I'm happy leaving $ delimited math as is.
I'm interested in solutions that use TeX itself to do the conversion, as well as informed suggestions about doing the translation 'by hand' in some other language. Even removing braces, without destroying $ delimited math, seems tricky.