[Windows] Reset group policy to default through command line

These are the three magic lines that will reset the windows group policy from your windows machine. This does not delete any user data but there are chances that some windows settings may be reset to default (That’s what we are trying to do right?) for e.g. windows update.

This may help you for cases like

  • Missing Network adapters from Network connection
  • When you screw up your group policies while experimenting windows settings on it.
  • Some installations of windows 8 won’t let you change windows update settings and report that “Some settings are managed by your system administrator”

Below are the magical lines:

1. Start cmd and run it as administrator
2. And then execute below lines one by one

RD /S /Q "%WinDir%\System32\GroupPolicyUsers"
RD /S /Q "%WinDir%\System32\GroupPolicy"
gpupdate /force

3. After executing above commands, in some instances you might have to restart your computer. It’s better to restart your machine.

Hope this helps.

[Solved] How to deploy php app to heroku from windows

I am fulltime linux user and parttime windows user. Lately I have started working with windows for some project stuffs. I found windows quite frustating and limited to what linux provided me. Well it’s all personal feelings. I always hated unnecessary installations of extra applications for the same tools which most of the linux distributions provides us out of the box. For e.g. ssh-keygen. To emulate the most of the linux command we need to install cygwin.

I was working on a facebook application and had to deploy it to heroku. I could do this with few commands in ubuntu which already come with those commands preinstalled. I had to do nothing, just push and push as I had already added my SSH keys in heroku settings.

Basic walkthrough on how one can deploy the heroku app using git Bash shell.

To carry out this process you must have git bash shell installed. Download git for windows and install it.
Git Download Link

Download Heroku toolbelt for windows, Download Link for Heorku

Once downloaded install the heroku toolbelt. After installation is complete, you can set heroku path to the environment variable.

c:\set path=%path%;C:\Program Files (x86)\Heroku\bin;

Now start the Git bash shell.
Git bash shell

Note:We installed git bash shell because it already comes with ssh-keygen which is required to generate pair of our keys.

1. Generate SSH Keys for windows

$ ssh-keygen -t rsa

When asked for

Enter file to which to save the key(/c/Users/user/.ssh/id_rsa):
just hit enter then enter your password, re-enter your password.

See the screenshot below:
Generate SSH Keys for windows

You have successfully generated ssh keys and has been saved in location supplied above.

Now, you have to use those SSH keys with heroku. To do this first copy the contents of id_rsa.pub file exactly as it is. You will find this file in C:\Users\user\.ssh\, if you haven’t changed the default folder location while creating ssh keys shown above.

Now, Go to your heroku dashboard, scroll down under section SSH Keys, Click in Add new SSH Key, paste contents of id_rsa.pub here. Then click in Add key. You have successfully added your public key to heroku. Now is the time to test our key.

Also see the screenshot below:
Heroku SSH keys

Upload ssh keys to heroku

$ heroku keys:add

Try to login to heroku use the command shown below, Since we have already added heroku to path. This should work.

$ heroku login

See the screenshot below:
heroku login

If we are using heroku login for the first time, it looks for ssh keys and since we have already created SSH keys and have also added it to heroku, this should work as expected and give us authentication successfull message. That’s it.

2. Add heroku remote repository to the project

$ heroku git:remote -a survey2email-sam

See screenshot below:
Add git repository to heroku

3. After adding heroku remote confirm it. To confirm it use the following command.

$ git remote -v

git remote -v

4. Now push code commits

$ git push heroku master

Enter password that you used to create SSH Key pairs. Wait for a while, heroku is working on your requesting.
After few seconds/minutes depending on your sources you will be shown feedback what is going on. Now you can feel relaxed and have cup of tea.

Push git repository to heroku

Congratulations. You have successfully deployed your PHP app to heroku.

I have skipped some steps assuming that you have basic familiarity with git. The above command assumes that you have already added, commited your codes to repository and want to deploy them to heroku.

If you find any difficulty in following the walkthrough drop your questions in comment box below.

[Solved] Codeigniter session expires frequently

I was working in a Codeigniter project and when I hit refresh button (F5) continuously, My application session was expiring frequently. I googled for a while and found the simple solution.

A solution is to increase the amount of time for the session_time_to_update in codeigniter config.

Since I won’t be updating session frequently. I am setting it to much higher values such as 86400 (24 hours).

Here is my settings

$config['sess_cookie_name']	= 'app_session';
$config['sess_expiration']	= 0;
$config['sess_expire_on_close']	= FALSE;
$config['sess_encrypt_cookie']	= FALSE;
$config['sess_use_database']	= TRUE;
$config['sess_table_name']	= 'app_sessions';
$config['sess_match_ip']	= FALSE;
$config['sess_match_useragent']	= TRUE;
$config['sess_time_to_update']	= 86400; // 24 hours

Since then I haven’t got this problem.

Reference : http://ellislab.com/forums/viewthread/182755/#864970

[Solved] Netbeans- Long running project scan

I use Netbeans for my daily web development. Sometimes I have very huge projects working with SVN, Git Version Controls. And sometimes I use the symlinks in my document root and other project folders. So, you might be wondering why I am mentioning all these things here, So lets get to the point.

Cause for Netbeans Long running projects task scanning ?
Direct from Netbeans bugzilla:: https://netbeans.org/bugzilla/show_bug.cgi?id=207214

Thanks for the snapshot. According the attached snapshot, it looks like org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj.addRecursiveListener() doesn’t work correctly. It tries recursively add the listeners but never ends.

Guys do you have recursive links in your sources? I’m asking, just to be sure that it can be the reason for this behavior.

How to solve ?

Disable the recursive listener.

Add the below line to netbeans.conf file which is found in /etc/netbeans.conf in netbeans root folder.

-J-Dnetbeans.indexing.recursiveListeners=false

Here is my netbeans.conf, I have added those lines in netbeans_default_options.

# ${HOME} will be replaced by JVM user.home system property
netbeans_default_userdir="${HOME}/.netbeans/7.1.2"

# Options used by NetBeans launcher by default, can be overridden by explicit
# command line switches:
netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.zip.disableMemoryMapping=true --laf Nimbus -J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=on -J-Dnetbeans.keyring.no.master=true -J-Dnetbeans.indexing.recursiveListeners=false"
#netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.zip.disableMemoryMapping=true --laf Metal -J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=lcd"
# Note that default -Xmx and -XX:MaxPermSize are selected for you automatically.
# You can find these values in var/log/messages.log file in your userdir.
# The automatically selected value can be overridden by specifying -J-Xmx or
# -J-XX:MaxPermSize= here or on the command line.

# If you specify the heap size (-Xmx) explicitly, you may also want to enable
# Concurrent Mark & Sweep garbage collector. In such case add the following
# options to the netbeans_default_options:
# -J-XX:+UseConcMarkSweepGC -J-XX:+CMSClassUnloadingEnabled -J-XX:+CMSPermGenSweepingEnabled
# (see http://wiki.netbeans.org/FaqGCPauses)

# Default location of JDK, can be overridden by using --jdkhome

netbeans_jdkhome="/usr/lib/jvm/jdk1.7.0_05/"# Additional module clusters, using ${path.separator} (';' on Windows or ':' on Unix):
#netbeans_extraclusters="/absolute/path/to/cluster1:/absolute/path/to/cluster2"

# If you have some problems with detect of proxy settings, you may want to enable
# detect the proxy settings provided by JDK5 or higher.
# In such case add -J-Djava.net.useSystemProxies=true to the netbeans_default_options.

In case if you wish to send your netbeans snapshot to developers then guide how to do it is https://blogs.oracle.com/netbeansphp/entry/is_the_ide_slow_send

References

1. https://netbeans.org/bugzilla/show_bug.cgi?id=207214
2. https://netbeans.org/bugzilla/show_bug.cgi?id=206461
3. http://wiki.netbeans.org/FaqScanningAndIndexingIssues