Archive

Posts Tagged ‘software’

Some jQuery Mistakes

October 18, 2012 Leave a comment

Hi,
Today I came across this article http://webdesignledger.com/tips/9-jquery-mistakes-you-shouldnt-commit
I found couple of points very interesting, so just briefing few for reference:
1. You aren’t using the latest jQuery version :
Each version update means higher performance and several bug fixes. The current stable release is 1.7.2
2. You aren’t using a CDN-hosted copy of jQuery
For better performance use Google’s copy of jQuery instead of yours. If your user still has the cached file of Google’s website (or from many other sites that uses its CDN) his browser will just get the cached version, improving a lot your website’s performance. You can use it by copying & pasting this HTML:

3. You aren’t using a fallback :
Every time you rely upon external sources, make sure you have a local fallback.

window.jQuery || document.write('')

4. You aren’t chaining stuff
While doing common operations, you don’t need to call the element every time you want to manipulate it. If you’re doing several manipulations in a row, use chaining, so jQuery won’t need to get the element twice. e.g.
$(“#mydiv”).hide().css(“padding-left”, “50px”);
5. You aren’t caching stuff
This is one of the most important performance tips. If you’ll call an element at least twice, you should cache it. Caching is just saving the jQuery selector in a variable, so when you need to call it again you’ll just reference the variable and jQuery won’t need to search the whole DOM tree again to find your element.

/* you can use it this way because almost every jQuery function returns
the element, so $mydiv will be equal to $(“#mydiv”); also it’s good to
use the $mydiv so you know it’s a jQuery caching var */

var $mydiv = $(“#mydiv”).hide();
[.. lot of cool stuff going on here …]
$mydiv.show();

6. You aren’t using pure js

Specially for attributes modification, we have several built in methods to get stuff done with pure javascript. You can even “convert” jQuery objects back to DOM nodes to use them with simpler methods, like this:

$mydiv[0].setAttribute('class', 'awesome'); //you can convert jQuery objects to DOM nodes using $jqObj[0]

Advertisements
Categories: General Tags: , ,

Accessing network shared folder using PHP with XAMPP

October 18, 2012 1 comment

Hi All,
I am encountering an issue while accessing Network drive using PHP with XAMPP from last 15 days.
Basically I never used XAMPP(with Window) in network throughout my programming career, & hence the issue is pretty new & confusion for me.
My Scenario:
I have a PC & a Laptop in LAN.Both having Windows 7 OS.I have installed an application on PC as well as Laptop.All data inserted into application from PC and I want to sync with Laptop on daily/weekly basis.
I searched a lot on internet and came across different techniques,I implement them but problem is not yet solved. Just Hereby briefing you all-
When you run Apache as a service on your Windows computer, it chooses to run as the LocalSystem account by default (usually SYSTEM). The LocalSystem account has no network privileges, makes it impossible to access networked resources (such as a shared drive) in your Apache service.

1. First, you have to change the user the Apache service runs as.
Go to your Services panel (Start -> Run -> “services.msc”).(Or tou can right-click My Computer icon on desktop,and select Manage)
Find the Service labeled Apache, right-click, and hit Properties.
Choose the “Log On” tab.
You’ll see that Apache is set up to run as the Local System Account.
You’ll want to change this to the second option, “This account”, and then fill in the details of the User account you would like Apache to run under.
Some sites tell you to create a special Apache-based user account just for this occasion. It’s not a bad idea, but then you have to make sure it has all of the proper permissions that an Apache user would need, such as read/write to to htdocs and the .conf and .log files, and permissions to log on as a service, etc etc – as well as the permissions to access the network resource you’re trying to get to in the first place.(I hadn’t tried this)
In light of that process, I chose to just run it under my own account instead.

To configure how a service is started using the Windows interface:
To specify account, click This account, click Browse, and then specify a user account in the Select User dialog box. When you are finished, click OK.If you still have problem to find exact User,go to advance option & then use “Find Now” functionality provided.Configure How a Service Is Started

Hit “Apply” – it’ll pop up a box saying you need to restart Apache to take effect, but hold off on that for a moment.
This is the tricky part: you have to give the user (the one you’re running Apache as) permissions to act as part of the OS.
Go to the Local Security Policy panel (Start -> Run -> “secpol.msc”).
Under the navigation section in the left sidebar, choose Local Policies -> User Rights Assignments.
In the right-hand frame, double-click the item “Act as part of the operating system” to open up its properties.
Select “Add User or Group, Enter the appropriate user in the box provided, and hit “OK.”
At this point, you are technically complete – Apache can now do the same things to the network resource that your user can – read, write, execute, whatever.
However, in Auther’s case, he was trying to create an actual readable resource, so he edited my Apache config file to create an alias to my share.
Open up your Apache configuration file. For most people it’s httpd.conf in the conf subdirectory of your Apache install directory.
The other thing that is tricky and caught me up is that unlike Apache, the Windows UNCs config file requires backslashes slashes, not forward. Now you can restart your Apache service
ref: http://php.net/manual/en/function.opendir.php

On Oct 22,2012:
Hurry…Now I can access the network folder,I even successfully transferred the files to the shared folder.
Now my next challenges:
1. File transfer time is bit more.
2. Transfer the Db files
Will get back if I can find some success..:)

Best Antivirus for Windows in India

August 30, 2012 1 comment

Hi All,
I usually get many queries from my non-techie friends regarding which is best antivirus for Home PC(Here best means good performance & Economical 🙂 ).
In last 10 years I used many antivirus ranging from free to paid.(even pirated,so cannot tell exact which one 🙂 )
Personally I found “Kaspersky Internet Security” is the best, you need to take regular updates(so need to have Internet connection also). Its cost is also very less (around 400-500 Rs/year). Its also light weight so does not slow down your PC.
Note: Kaspersky has three version of the antivirus,so while purchasing check the name.I checked all the three versions specification, and found “Kaspersky Internet Security” is the best version.
I found Norton is also very good,but its heavy, so may slow down your PC.
In free antivirus category,I can recommend AVAST(If you don’t want to pay anything extra fro antivirus or you don’t use internet).
I did some google also before buying the antirus.Just listing them for your reference.
Latest(2012)
Blog Discussion
Old Survey(2009)