tag:blogger.com,1999:blog-42260585649592234002024-02-20T09:33:28.616-08:00Explore OnAnonymoushttp://www.blogger.com/profile/01958217622077644723noreply@blogger.comBlogger16125tag:blogger.com,1999:blog-4226058564959223400.post-11648373271268800772014-11-28T02:49:00.002-08:002014-11-28T02:50:45.619-08:00Change Brightness of Screen in Ubuntu<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="color: red;">xrandr --output LVDS1 --brightness 0.9</span></div>
Anonymoushttp://www.blogger.com/profile/01958217622077644723noreply@blogger.com0tag:blogger.com,1999:blog-4226058564959223400.post-72300284519297095802014-09-14T12:40:00.001-07:002014-09-14T12:41:22.151-07:00Find Last Message FROM All Users<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<h2 style="text-align: left;">
<span style="color: #cc0000;">Query to find out the last message from all users in conversation </span></h2>
<span style="color: yellow;">select messages.message_text, messages.sender_uuid, messages.receiver_uuid, messages.add_date FROM messages </span><br />
<span style="color: yellow;">INNER JOIN (</span><br />
<span style="color: yellow;">SELECT MAX(add_date) AS time, IF(`receiver_uuid` = '1', `sender_uuid`, `receiver_uuid`) AS user FROM dp_messages GROUP BY user) m2 </span><br />
<span style="color: yellow;">ON messages .add_date = m2.time </span><br />
<span style="color: yellow;">AND (messages .`sender_uuid` = m2.user OR dp_messages .`receiver_uuid` = m2.user)<br />WHERE </span><br />
<span style="color: yellow;">`sender_uuid` = '1' OR `receiver_uuid` = '1' </span><br />
<span style="color: yellow;">ORDER BY messages .add_date DESC LIMIT 0, 20</span></div>
Anonymoushttp://www.blogger.com/profile/01958217622077644723noreply@blogger.com1tag:blogger.com,1999:blog-4226058564959223400.post-37569067250732072062014-09-09T00:05:00.002-07:002014-09-09T00:24:36.087-07:00Mysql, Query to find out table comments?<div dir="ltr" style="text-align: left;" trbidi="on">
<h2>
<span style="color: #cc0000;">To List all tables from database use: </span></h2>
<div style="text-align: left;">
<span style="color: #cc0000;"><span style="color: yellow;">show tables from DatabaseName;</span></span></div>
<h3 style="text-align: left;">
<br />
<span style="color: #cc0000;">To List Table Structure you can use: </span></h3>
<span style="color: yellow;">DESC tablename;</span><br />
<span style="color: #cc0000;">Or You can use </span><br />
<span style="color: #cc0000;"><span style="color: yellow;">SHOW COLUMNS FROM file FROM </span></span><span style="color: #cc0000;"><span style="color: yellow;"><span style="color: #cc0000;"><span style="color: yellow;">DatabaseName</span></span>;</span></span><br />
<br />
<h3 style="text-align: left;">
<span style="color: #cc0000;">Query to find out Comments on Table</span></h3>
<div style="color: yellow;">
SELECT a.COLUMN_NAME, a.COLUMN_COMMENT
FROM information_schema.COLUMNS a
WHERE a.TABLE_NAME = 'YOUR_TABLE_NAME'
</div>
<br />
Just Change the name of YOUR_TABLE_NAME and run it. </div>
Anonymoushttp://www.blogger.com/profile/01958217622077644723noreply@blogger.com0tag:blogger.com,1999:blog-4226058564959223400.post-79249365335118606042014-07-21T05:43:00.002-07:002014-11-28T02:51:44.263-08:00Export Data From Server Using Terminal<div dir="ltr" style="text-align: left;" trbidi="on">
To Export Data from Terminal Use Following Command :<br />
<br />
<br />
<span style="background-color: #444444;"><b>mysql -p -u databasename > databasename.sql </b></span><br />
<b>OR </b><br />
<span style="background-color: #444444;"><b>mysqldump -p -u databasename > databasename.sql </b></span><br />
<b><br /></b><br />
<b></b><br />
<b><br /></b>
To Import Data from Terminal Use Following Command :<br />
<br />
<b><span style="background-color: #444444;">mysql -p -u databasename < databasename.sql</span> </b><br />
<b><br /></b>
OR <br />
<span style="background-color: #444444;"><b>mysqldump -p -u databasename > databasename.sql </b></span><br />
<b><br /></b></div>
Anonymoushttp://www.blogger.com/profile/01958217622077644723noreply@blogger.com0tag:blogger.com,1999:blog-4226058564959223400.post-40934768398607721172014-07-21T05:29:00.002-07:002014-07-21T06:04:11.820-07:00Copy Data from server to localhost using ssh<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<br />
First Of all compress the file using following command<br />
<br />
<span style="background-color: #444444;"><b>tar -cf name.tar name_of_folder</b></span><br />
<b><br /></b>
To copy a compressed folder from the server use following command<br />
<span style="background-color: #444444;"><br /></span>
<span style="background-color: #444444;"><b>scp user@remotehost.com:/filepath/file.txt /some/localhost/folder</b></span><br />
<br />
<span style="background-color: #444444;"><b>scp user@remotehost.com:/var/html/project.tar /var/www/</b></span><br />
<br />
<br />
<br />
<b><span style="color: yellow;">Keep Exploring</span></b></div>
Anonymoushttp://www.blogger.com/profile/01958217622077644723noreply@blogger.com0tag:blogger.com,1999:blog-4226058564959223400.post-84821744136789210872014-06-27T00:56:00.002-07:002014-06-27T00:56:10.443-07:00Get Mysql Query Count <div dir="ltr" style="text-align: left;" trbidi="on">
<span style="-webkit-text-stroke-width: 0px; background-color: #eeeeee; color: black; display: inline !important; float: none; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 17.804800033569336px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: auto; word-spacing: 0px;">This Query will return the count of queries fired in database</span><br />
<br />
<span style="-webkit-text-stroke-width: 0px; background-color: #eeeeee; color: black; display: inline !important; float: none; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 17.804800033569336px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: auto; word-spacing: 0px;"> </span><br />
<span style="-webkit-text-stroke-width: 0px; background-color: #eeeeee; color: black; display: inline !important; float: none; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 17.804800033569336px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: auto; word-spacing: 0px;">mysqladmin ext | grep -e 'Com_\(update\|select\|insert\)'</span></div>
Anonymoushttp://www.blogger.com/profile/01958217622077644723noreply@blogger.com0tag:blogger.com,1999:blog-4226058564959223400.post-59007568680677180112014-05-14T05:46:00.002-07:002014-05-14T05:47:59.197-07:00Php: Generate Captcha Secure Image<div dir="ltr" style="text-align: left;" trbidi="on">
global $image;<br />
$_SESSION['count'] = time();<br />
<br />
$image = imagecreatetruecolor(200, 50) or die("Cannot Initialize new GD image stream");<br />
$background_color = imagecolorallocate($image, 255, 255, 255);<br />
$text_color = imagecolorallocate($image, 0, 255, 255);<br />
$line_color = imagecolorallocate($image, 64, 64, 64);<br />
$pixel_color = imagecolorallocate($image, 0, 0, 255);<br />
<br />
imagefilledrectangle($image, 0, 0, 200, 50, $background_color);<br />
<br />
for ($i = 0; $i < 3; $i++) {<br />
imageline($image, 0, rand() % 50, 200, rand() % 50, $line_color);<br />
}<br />
<br />
for ($i = 0; $i < 1000; $i++) {<br />
imagesetpixel($image, rand() % 200, rand() % 50, $pixel_color);<br />
}<br />
<br />
<br />
$letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';<br />
$len = strlen($letters);<br />
$letter = $letters[rand(0, $len - 1)];<br />
<br />
$text_color = imagecolorallocate($image, 0, 0, 0);<br />
$word = "";<br />
for ($i = 0; $i < 6; $i++) {<br />
$letter = $letters[rand(0, $len - 1)];<br />
imagestring($image, 7, 5 + ($i * 30), 20, $letter, $text_color);<br />
$word .= $letter;<br />
}<br />
$_SESSION['captcha_string'] = $word;<br />
<br />
$images = glob("*.png");<br />
foreach ($images as $image_to_delete) {<br />
@unlink($image_to_delete);<br />
}<br />
<br />
imagepng($image, "image" . $_SESSION['count'] . ".png");<br />
<br />
<br />
To display The captcha<br />
<br />
<img src="../image<?php echo $_SESSION['count'] ?>.png"><br />
<br />
<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/01958217622077644723noreply@blogger.com0tag:blogger.com,1999:blog-4226058564959223400.post-87956808468618595372014-05-06T22:53:00.001-07:002014-05-06T22:53:24.253-07:00Cakephp: Insert Query In Loop<div dir="ltr" style="text-align: left;" trbidi="on">
If You are Using $this->Model->save() in LOOP then this will not work.<br />
TO overcome this issue simply add<br />
<br />
Add this before save this will move the cursor to a new Line and then insert again.<br />
<br />
$this->Model->create()<br />
$this->Model->save()</div>
Anonymoushttp://www.blogger.com/profile/01958217622077644723noreply@blogger.com0tag:blogger.com,1999:blog-4226058564959223400.post-66035808451074693052014-05-05T00:09:00.003-07:002014-05-05T11:50:32.671-07:00Cakephp: Debugging Query in Cakephp<div dir="ltr" style="text-align: left;" trbidi="on">
$log = $this->Model->getDataSource()->getLog(false, false);<br />
debug($log);</div>
Anonymoushttp://www.blogger.com/profile/01958217622077644723noreply@blogger.com0tag:blogger.com,1999:blog-4226058564959223400.post-81006404566060665542014-04-29T05:31:00.003-07:002014-05-05T11:50:43.013-07:00CakePhp Get Complete path<div dir="ltr" style="text-align: left;" trbidi="on">
You can Have a Complete Path in cakephp using<br />
<br />
<b><?php echo Router::url( $this->here, true ); ?></b><br />
<br />
If you want a relative path to be shown Use this :<br />
<br />
<b><?php echo $this->here; ?></b></div>
Anonymoushttp://www.blogger.com/profile/01958217622077644723noreply@blogger.com0tag:blogger.com,1999:blog-4226058564959223400.post-22388178892914214482014-04-16T23:57:00.000-07:002014-05-05T11:52:11.127-07:00Technology Next Generation<div dir="ltr" style="text-align: left;" trbidi="on">
<h1 class="yt" id="watch-headline-title" style="-webkit-text-stroke-width: 0px; background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; color: #222222; font-family: arial, sans-serif; font-size: 24px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 0px 5px; orphans: auto; overflow: hidden; padding: 0px; text-align: start; text-indent: 0px; text-overflow: ellipsis; text-transform: none; white-space: nowrap; widows: auto; word-spacing: 0px; word-wrap: normal;">
<span style="color: #eeeeee;"><b><span class="watch-title yt-uix-expander-head" dir="ltr" id="eow-title" style="-webkit-user-select: auto; background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; cursor: auto; font-size: 24px; margin: 0px; padding: 0px;" title="Amazing New Technology">Amazing New Technology that are beyond what </span></b></span></h1>
<h1 class="yt" id="watch-headline-title" style="background-color: transparent; border: 0px none; font-family: arial,sans-serif; font-size: 24px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 0px 5px; overflow: hidden; padding: 0px; text-align: start; text-indent: 0px; text-overflow: ellipsis; text-transform: none; white-space: nowrap; word-spacing: 0px; word-wrap: normal;">
<span style="color: #eeeeee;"><b><span class="watch-title yt-uix-expander-head" dir="ltr" id="eow-title" style="-webkit-user-select: auto; background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; cursor: auto; font-size: 24px; margin: 0px; padding: 0px;" title="Amazing New Technology">we think</span></b></span></h1>
<div class="separator" style="clear: both; text-align: center;">
<object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="https://ytimg.googleusercontent.com/vi/LPlZ_AqCvGw/0.jpg" height="266" width="320"><param name="movie" value="https://youtube.googleapis.com/v/LPlZ_AqCvGw&source=uds" /><param name="bgcolor" value="#FFFFFF" /><param name="allowFullScreen" value="true" /><embed width="320" height="266" src="https://youtube.googleapis.com/v/LPlZ_AqCvGw&source=uds" type="application/x-shockwave-flash" allowfullscreen="true"></embed></object></div>
<h1 class="yt" id="watch-headline-title" style="-webkit-text-stroke-width: 0px; background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; color: #222222; font-family: arial, sans-serif; font-size: 24px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 0px 5px; orphans: auto; overflow: hidden; padding: 0px; text-align: start; text-indent: 0px; text-overflow: ellipsis; text-transform: none; white-space: nowrap; widows: auto; word-spacing: 0px; word-wrap: normal;">
<span class="watch-title yt-uix-expander-head" dir="ltr" id="eow-title" style="-webkit-user-select: auto; background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; cursor: auto; font-size: 24px; margin: 0px; padding: 0px;" title="Amazing New Technology"><br /></span></h1>
<h1 class="yt" id="watch-headline-title" style="-webkit-text-stroke-width: 0px; background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; color: #222222; font-family: arial, sans-serif; font-size: 24px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px 0px 5px; orphans: auto; overflow: hidden; padding: 0px; text-align: start; text-indent: 0px; text-overflow: ellipsis; text-transform: none; white-space: nowrap; widows: auto; word-spacing: 0px; word-wrap: normal;">
<span style="color: white;"><b><span class="watch-title yt-uix-expander-head" dir="ltr" id="eow-title" style="-webkit-user-select: auto; background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; cursor: auto; font-size: 24px; margin: 0px; padding: 0px;" title="Amazing New Technology">Keep Exploring !!</span></b></span></h1>
</div>
Anonymoushttp://www.blogger.com/profile/01958217622077644723noreply@blogger.com0tag:blogger.com,1999:blog-4226058564959223400.post-19414252192133200202014-04-10T01:24:00.001-07:002014-05-05T11:50:55.762-07:00Drupal: How to show and Hide form fields on form option select <div dir="ltr" style="text-align: left;" trbidi="on">
Drupal Offer a great platform. You do not need to include any javascript or ajax to do so. What all you need to add in your form fields is<br />
<br />
'#states' => array('visible' => array(':input[name="report_for"]' => array('value' => '3'),),),<br />
<br />
and all set <br />
<br />
<br />
Create your select option attribute<br />
<br />
$options = array('1' => 'Option1', '2' => 'Option2', '3' => 'Option3');<br />
<br />
$form['field_name'] = array(<br /> '#title' => t('Field Title'),<br /> '#type' => 'select',<br /> '#options' => $options,<br /> '#empty_option' => NULL,<br /> '#empty_value' => NULL,<br /> '#default_value' => 1,<br /> '#required' => TRUE,<br />
);<br />
<br />
And field that you want to he shown on selection any option in that fields simply right like this<br />
<br />
$form['field_name'] = array(<br />
'#title' => 'Field Title',<br />
'#required' => TRUE,<br />
'#states' => array('visible' => array(':input[name="report_for"]' => array('value' => '3'),),),<br /> );<br />
<br />
Now this field is visible only when a user select option3.<br />
<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/01958217622077644723noreply@blogger.com0tag:blogger.com,1999:blog-4226058564959223400.post-58433599419870601952014-04-05T00:43:00.003-07:002014-04-05T13:40:20.819-07:00Bloggers: How to redirect bloggers to your own domian <div dir="ltr" style="text-align: left;" trbidi="on">
When You Think That you have enough traffic on your blog now you want to go on with more ideas and for better future o blog, IF you want to go live with the custom domain name, you can redirect bloggers account to your custom domain without loosing your Traffic. What all you need to do is copy and paste following given script.<br />
<br />
<b>Steps to be Followed </b><br />
<br />
<ul style="text-align: left;">
<li>Login to your bloggers account.</li>
<li>Click on Template Menu .</li>
<li>Paste the below given script on your template file.</li>
</ul>
<br />
To Redirect all pages from of bloggers to your custom domain Home Page Paste the Following script in your <span style="color: blue;"><b><head></b></span> section of a Template.<br />
<br />
<b><span style="color: #0b5394;"><script type='text/javascript'></span></b><br />
<b> var d='<data:blog.url/>';</b><br />
<b> d=d.replace(/.*\/\/[^\/]*/, '');</b><br />
<b> location.href = 'http://domain.com/';</b><br />
<b><span style="color: #0b5394;"></script></span></b><br />
<span style="color: #660000;"><b><br /></b></span>
<br />
<h4 style="text-align: left;">
<b><i><span style="color: yellow;">Keep Exploring!!</span></i></b></h4>
</div>
Anonymoushttp://www.blogger.com/profile/01958217622077644723noreply@blogger.com0tag:blogger.com,1999:blog-4226058564959223400.post-9530683263637680622014-04-04T03:19:00.001-07:002014-05-05T11:51:14.200-07:00Wordpress : Best way to show Twitter Feeds<div dir="ltr" style="text-align: left;" trbidi="on">
To show Twittwer Feeds without using Plugin<br />
<br />
What all you need to do<br />
<br />
Go to Appearence -> widget<br />
<br />
Drag and drop Text Widget<br />
<br />
Paste the following code in a Text Area<br />
<br />
<a class="twitter-timeline" href="https://twitter.com/screenname" data-widget-id="309736537778683904" data-screen-name="screenname" data-list-owner-screen-name="screenname_app" data-chrome="noheader nofooter noborders transparent noscrollbar">Tweets by @screenname</a><br />
<br />
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></div>
Anonymoushttp://www.blogger.com/profile/01958217622077644723noreply@blogger.com0tag:blogger.com,1999:blog-4226058564959223400.post-61968768757078818662014-04-03T23:14:00.000-07:002014-05-05T11:51:25.392-07:00Php: Remove Admin Bar In Wodpress<div dir="ltr" style="text-align: left;" trbidi="on">
add_action('after_setup_theme', 'remove_admin_bar');<br />
function remove_admin_bar() {<br />
if (!current_user_can('administrator') && !is_admin()) {<br />
show_admin_bar(false);<br />
}<br />
}</div>
Anonymoushttp://www.blogger.com/profile/01958217622077644723noreply@blogger.com0tag:blogger.com,1999:blog-4226058564959223400.post-23284471079478089352014-04-02T23:42:00.004-07:002014-05-05T11:51:31.545-07:00Php : Get Time in a milisec<div dir="ltr" style="text-align: left;" trbidi="on">
This will result the time in a milisec :<br />
<br />
$mileSec = round(microtime(true) * 1000);</div>
Anonymoushttp://www.blogger.com/profile/01958217622077644723noreply@blogger.com0