For smart Primates & ROBOTS (oh and ALIENS ).

Tuesday, June 28, 2016

How to use $_POST in better way

How to use $_POST in better way.

Suppose there are 10 fields in a PHP webpage that's data are saving into database.
In that 10 fields 2 fields are empty and when in values are empty you want store "N/A" values are saving into database. 

Use below one line of code:
$myval = isset( $_POST['myvar'] ) ? $_POST['myvar'] : 'N/A'; 


You can use this logic in any website programming language.



Share:

Tuesday, May 31, 2016

How to check if internet active in your computer

How to check if internet active in your computer

When you write code in JavaScript sometime you code does not execute due to loss of internet connectivity.  so how you check if internet connection properly ON in your computer system.
below is one line of JavaScript code that check your system internet connect On of OFF.

Code is:
var isonline = navigator.onLine;
Share:

Tuesday, April 19, 2016

how to fix Configure the viewport

How to fix Configure the viewport

Sometime when you increase score of your site in Google PageSpeed Insights for SEO purpose and optimize it's responsiveness you can face the issue Configure the viewport. It is simple to fix the Configure the viewport issue. use only this below meta tag. if you have already this similar meta tag with extra aruments then just delete that one and use below code.

Tag is:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Share:

Sunday, February 28, 2016

how to include js file in JavaScript code

How to include js file in JavaScript code

Sometime you need to include js file in javaScript code. below is the code that will solve this problem.

<script type="text/javascript">//<![CDATA[
document.write('<script src="url_path/js/js-file.js"><\/script>');
}
//]]>
</script>
Share:

delete multiple emails in Gmail basic HTML mode


How to delete multiple emails in Gmail basic HTML mode

Sometime you have slow internet connect, so at that time you will not able to open gmail in standard mode. at that time you will open it in HTML mode.
It is okay. now when you want to delete multiple emails(100 emails at a time) then you need to click checkbox one by one. this will take many times and frustration.
here is the solution for this types of situation. see below image and follow instructions.
.















Share:

Monday, February 08, 2016

XSS Exploits


XSS Exploits

It is XSS, It is Web site hacking. It is cross site scripting (XSS). 
The most usual form of Web site hacking . hackers force a site to perform certain actions like inject a client side scripting code (JavaScript) mixed with submitted content.


so that when a user visits a Web page with the submitted content, the malicious script gets downloaded automatically in his web browser and gets executed.

Using this types of hacking user's cookies and session stolen and sent to site of the attacker.
the user may get redirected to a targeted Web site for instance.
XSS may also be used for user account hacking. When the attacker is able to steal the session cookie value, he may be able to access to the user account as if it was the real user.

Prevention of XSS Exploits

XSS vulnerabilities can be avoided by properly encoding HTML using entities for <, >, " and '. Escaping of HTML characters on online forums can also be avoided by using bbcodes usually offered there.

The htmlpecialchars() function can be helpful in this regard as it converts content automatically into HTML entities. It also converts single quotes by using ENT_QUOTES as second argument. The strip_tags() function also removes PHP and HTML tags from string.
Share:

Saturday, February 06, 2016

update control value in C# Thread

How to update control value in C# Thread.



Use below sample of code:

Thread t1=new Thread();
String b="";
int all=0;
 private void button5_Click(object sender, EventArgs e)
 {
         
            t1 = new Thread(new ThreadStart(MyCodeRun));  t1.Start();
 }

void MyCodeRun()
{
           while (String.IsNullOrEmpty(b) || String.IsNullOrWhiteSpace(b))
            {
                this.BeginInvoke(new MethodInvoker(changeValue));
                all = all + 1;
                System.Threading.Thread.Sleep(1000);
            }
 }

 private void changeValue()
{
            label1.Text =all + "";
}
Share:

Friday, February 05, 2016

JSON parse in PHP

JSON parse in PHP



Suppose you want to parse listed below JSON data in PHP and you only needed to print objectId values. you can see here 3 records under merchants value "RPEZF3MRM39Z0"

-----------------------------------------------------------------------
{
"appId": "0QA16KMMVJAQR",
"merchants": {
"RPEZF3MRM39Z0": [{
"objectId": "O:S1MXC6FCY6GDW",
"type": "UPDATE",
"ts": 1453110818494
}, {
"objectId": "O:S1MXC6FCY6GDW",
"type": "UPDATE",
"ts": 1453110818913
}, {
"objectId": "P:SYD46NHH64EQG",
"type": "CREATE",
"ts": 1453110818913
}]
}
}
------------------------------------------------------------------------

php code:

suppose $st is hlding the above json data.

$json_a=json_decode($st,true);
foreach ( $json_a['merchants']['RPEZF3MRM39Z0'] as $objectId )
{
    echo $objectId['objectId']."</br>";
}




Share:

Wednesday, February 03, 2016

Video Cutter

Video Cutter

A Windows based Video cutter application. compatible with Windows 7, Windows 8,Windows 10 for 32 and 64 bit.

You do not stop or pause movie while cutting any part from video. just watch video while my application cut the part which you set.

Video Cutter

Video Cutter



Cut part/parts of large video files. This can be useful for cutting favorite or removing unwanted sections of video, such as commercials, outtakes and trailers.


The application is easy to use and has a simple, standard interface. What is really noticeable about this application is the speed.

Overall, Free Video Cutter is a relatively lightweight application that has good options to choose from and to select portion. It is rapid at standard conversions and the user interface is uncluttered and standard. If you want a basic video cutter application, then Free Video Cutter is a good choice.

Key features include:
Support for numerous formats including AVI, MP4, FLV, WMV, MOV, VOB, and 3GP.
Loss-less video cutting quality.
Rapid file processing.
Standard user interface.


Download links:

Download all the files and remove ".txt" extension. extract it.
Password is VideoCutter

http://agalaxycode.blogspot.com/2012/01/video-cutter-file-1.html
http://agalaxycode.blogspot.com/2012/01/video-cutter-file-2.html
http://agalaxycode.blogspot.com/2012/01/video-cutter-file-3.html
http://agalaxycode.blogspot.com/2012/01/video-cutter-file-4.html
http://agalaxycode.blogspot.com/2012/02/video-cutter-file-5.html
http://agalaxycode.blogspot.com/2012/02/video-cutter-file-6.html
http://agalaxycode.blogspot.com/2012/02/video-cutter-file-7.html
http://agalaxycode.blogspot.com/2012/02/video-cutter-file-8.html
http://agalaxycode.blogspot.com/2012/02/video-cutter-file-9.html
http://agalaxycode.blogspot.com/2012/02/video-cutter-file-10.html
http://agalaxycode.blogspot.com/2012/02/video-cutter-file-11.html
http://agalaxycode.blogspot.com/2012/02/video-cutter-file-12.html
http://agalaxycode.blogspot.com/2012/02/video-cutter-file-13.html
http://agalaxycode.blogspot.com/2012/02/video-cutter-file-14.html
http://agalaxycode.blogspot.com/2012/01/video-cutter-file-15.html
http://agalaxycode.blogspot.com/2012/02/video-cutter-file-16.html
http://agalaxycode.blogspot.com/2012/02/video-cutter-file-17.html


Share:

Tuesday, December 01, 2015

Remove version number from JS and CSS in WordPress

Problem:


How to Remove version number / querystring from JS and CSS in WordPress.

Solution:

goto your active theme folder and open functions.php file
and add below lines at the bottom.

function del_queryandversion_from_css_js( $style_or_js_url ) {
if ( strpos( $style_or_js_url, 'ver=' ) )
$css_js = remove_query_arg( 'ver', $style_or_js_url );
return $css_js;
}
add_filter( 'style_loader_src', 'del_queryandversion_from_css_js', 10 );
add_filter( 'script_loader_src', 'del_queryandversion_from_css_js', 10 );
Share:

Ads Inside Post

Powered by Blogger.

Archive