click run or windows to run below application
fsmgmt.msc
Browse to the session, to see current session connected to your shared folder and user. Click close connection\kill.
Monday, September 7, 2015
Tuesday, February 24, 2015
MySQL INSERT INTO VALUES and SELECT multiples row of data
Found a way to insert into a table some value i've and one i get from a select from other table
I have the value of ''string" and the 10, but i've to find that [int] from a select like this:
Use an
A problem I've found with this approach is that if the
INSERT INTO table1 VALUES ("string", 10, [int]).
I have the value of ''string" and the 10, but i've to find that [int] from a select like this:
SELECT idTable2
FROM table2
WHERE ...
Solutions:Use an
insert ... select
query, and put the known values in the select
:insert into table1
select 'A string', 5, idTable2
from table2
where ...
Issue that may come out:A problem I've found with this approach is that if the
SELECT
returns zero records then the statement succeeds but no data is INSERT
. – Neil C. Obremski Feb 13 '14 at 1:52
Sunday, January 11, 2015
Android : Toast inside a fragment
Hello,
another tips. I come around an error of
while i try to toast inside a fragment. TO remove the error,simple replace the toast
Toast.makeText(getApplicationContext(), (String)data.result, Toast.LENGTH_LONG).show();
to
Toast.makeText(getActivity(), (String)data.result,
Toast.LENGTH_LONG).show();
Cheers.
another tips. I come around an error of
the method getApplicationContext() is undefined
while i try to toast inside a fragment. TO remove the error,simple replace the toast
Toast.makeText(getApplicationContext(), (String)data.result, Toast.LENGTH_LONG).show();
to
Toast.makeText(getActivity(), (String)data.result,
Toast.LENGTH_LONG).show();
Cheers.
Wednesday, May 21, 2014
Freeze multiple column in excel
On occasion where i want to freeze multiple column in excel, i just need to highlight the cell next to it as below:
For above example D1,
click view> Freeze panes.
Now all column from D on wards are freeze.
Monday, January 27, 2014
Password Protect WordPress Attachments (files)
I had a website where users can upload important file to share. i used one of the option provided by web host in the cp called, 'Secured folder'. so other people on the net cannot access the file.
Well, recently the option no longer supported, and i had to look around on the net to find a simpler solution other than subscribing to an 'additional services'.
so i found one, which is this.
basically just create a file called .htaccess (note that.htaccess is the extension, if you create .htaccess.php for examples, it wont work) with the code above and place it inside the folder that you want to protect.
Cheers.
Well, recently the option no longer supported, and i had to look around on the net to find a simpler solution other than subscribing to an 'additional services'.
so i found one, which is this.
You might have some sections of your WordPress site that are only accessible for your WordPress user. Pretty easy to protect the page or post in WordPress for only the registered user but what about the attachments of the post/page (files, images)?
They won’t be protected by default, this means if a request is made directly to the file it can be accessed without any password. There is potentially the solution where you protect the files in a directory with htaccess password, but do you really want to manage new set of username and password outside or WordPress? Not really.
Here is the solution, use htaccess to check if a user is logged in the WordPress site when accessing the files area, if not then redirect to the WordPress login page. Here is the new .htaccess:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^.*uploads/.*
RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC]
RewriteRule . /wp-login.php?redirect_to=%{REQUEST_URI} [R,L]
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^.*uploads/.*
RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC]
RewriteRule . /wp-login.php?redirect_to=%{REQUEST_URI} [R,L]
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
We simply have protected the whole uploads area and redirect to login if the user is not logged. You can protect a different directory.
basically just create a file called .htaccess (note that.htaccess is the extension, if you create .htaccess.php for examples, it wont work) with the code above and place it inside the folder that you want to protect.
Cheers.
Labels:
php,
webdevelopment,
wordpress
Location:
68000 Ampang, Selangor, Malaysia
Monday, January 20, 2014
No more connections can be made to this remote computer
Recently i come to a problem where too many people try to access a shared folder on windows XP.
i have come to this solution on the net, hope it works.
i have come to this solution on the net, hope it works.
When using Windows XP Professional as a server for more than 10 client pc, maybe you will encounter this kind of error;
No more connections can be made to this remote computer at this time because there are already as many connections as the computer can accept.
This error is caused by the limitation of Windows XP Professional to 10 connection only. To solve this problem, you have to edit your registry. Follow this steps;
1. Click START -> RUN
2. Type regedit
3. Go to \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
4. Look for cachedlogonscount
5. Replace its value to your desired number of connection, for example 15.
2. Type regedit
3. Go to \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
4. Look for cachedlogonscount
5. Replace its value to your desired number of connection, for example 15.
That’s it!
Wednesday, May 29, 2013
Initate MySQL
1. Start mysql.exe, the MySQL monitor:
C:\Program Files\mysql\mysql-5.0.77-win32\bin> mysql.exe -h localhost --user=root -p2. Create the user and set the password:
mysql> CREATE USER theusername@localhost IDENTIFIED BY 'thepassword';3. Make sure the new user appear in the user table:
mysql> SELECT * FROM mysql.user;4. Create the database:
mysql> CREATE DATABASE yourdatabase;5. Make sure your database was created:
SHOW DATABASES;6. Grant all privileges for your new database to your user:
mysql> GRANT ALL ON yourdatabase.* to theusername@localhost;7. Done. Now you got a new database and a new user with all privileges.
Subscribe to:
Posts (Atom)