2014/10/16

Cannot save changes to hosts file on Win7

a/ Run your editor as administartor -> Right click on Editor executable file (.exe) and choose option “Run as administartor”.
b/ Edit your file and save changes.

2014/10/04

How to install OpenCard on PHP host

1/ Downolad archive OpenCard from http://myopencart.com/downlaod -> http://sourceforge.net/projects/ocstore/files/latest/download
2/ Unzip and copy all its content to public_html folder (or any subfolder of that folder)
3/ Run page http://host/install/index.php
If it is not seen then you sholud change names of 3 php.ini files
/php.ini -> php.ini.txt
/admin/php.ini -> /admin/php.ini.txt
/install/php.ini -> /install/php.ini.txt
4/ On 1st screen
Confirm agreement terms
5/ On 2nd screen
change names of config files:
/config-dest.php -> config.php
/admin/config-dest.php ->  /admin/config.php
6/ on 3rd screen give
database host: (sholudn't be localhost but external url)
database name:
database user:
user password:
if you don't yet created database then do it now
give credentials for admin account of the OpenCard
login: admin
password: .. (set this)
email: (set this)
7/ remove install directory
8/ If needed add:
DirectoryIndex index.html index.php
to .htaccess in main directory
to point that this is your default page.
9/ Download this file:
and copy to /system/database/
Give it this name: mmysqli.php
and change 2 lines in
/config.php
/admin/config.php
from define('DB_DRIVER', 'mysql');to define('DB_DRIVER', 'mmysqli');

2014/09/03

2014/08/26

How to create an element with attributes and a value but no sub-element using XmlSerializer ?

http://stackoverflow.com/questions/3524224/using-xmlserializer-to-create-an-element-with-attributes-and-a-value-but-no-sub

2014/08/22

Visual Studio 2013 - 'Operation Could Not Be Completed' when trying to open any View ?

I had two <appSeettings> nodes in config file.
Make only one node.
Maybe you will need restart of VS or system.

How to backup SqlServer database ?

1/ Backup file: Right click on Database -> Task -> Backup ...
2/ Script with structure and data: Right click on Database-> Task -> Generate scripts -> On 3rd step of wizard choose 'Advanced' button and select 'Types of data to script':'Schema and data'.


How to bind MVC model to different table ?

Fatal error: Class 'SoapClient' not found in ..

1/ Open php.ini.
2/ Uncoment line:
from: ;extension=php_soap.dll
to: extension=php_soap.dll
3/ Restart php.

How to read config section from configuration file in C# ?

App.config Class that reads config file.
Remember to add System.Configuration to Project references !

2014/08/15

2014/08/13

Sql server connection strings

http://www.connectionstrings.com/sql-server-2012/

Spf record example


Record SPF (Sender Policy Framework) allows you to check the host SMTP mail servers, the server sends e-mails from a given domain is authorized to do. It is in fact plain text record. To ensure compatibility with older implementations of servers / clients DNS domain should be 2 SPF records that contain exactly the same value, one type of SPF, and the second TXT.
 
Suppose, for example, that your domain example.com uses Gmail. You create an SPF record that identifies the mail servers as authorized Google Apps mail servers for that domain. When the recipient's mail server receives a message sent from the account user @ example.com, you may check the SPF record for the domain example.com, to determine if the message comes from an authorized mail server. If the message comes from a server other than the Google Apps mail servers listed in the SPF record, the recipient's mail server can reject it as spam.
If your domain has no SPF record, messages from users from that domain can be rejected by some of the recipients domain because it is not possible to check whether the message came from an authorized mail server.

Qualifiers


The qualifier is a single sign placed before the definition of the mechanism:

Qualifier Description
"+" - PASS indicates that the data source is authorized to send mail from the domain. If prior to the determination of the mechanism does not have a qualifier, it is assumed that it is "+".
"?" - NEUTRAL This source will be treated as if it was not him at all ...
"~" - SOFTFAIL Maile from this source will be rejected or accepted, but marked as SPAM.
"-" - FAIL Messages from this source will always be rejected.

Mechanisms

Immediately after the qualifier is the "mechanism" that is, to identify the source:

Mechanizm Description
ip4: 192,168,137,101 IPv4 Address - 192,168,137,101
ip6: 2001: db8 :: 1428: 57ab Ipv6 Address - an Ipv6: 2001: db8 :: 1428: 57ab
a Each record for a domain
mx Each SMTP server accepting mail for this domain
all Each host on the Internet

Examples

a/
example.com. IN TXT "v = spf1 mx -all"
Each SMTP server is accepting mail for the domain przykladowa.local. may also be sent. Mail coming from other hosts across the Internet will be rejected.

b/
example.com. IN TXT "v = spf1 a -all"
Mail originating from any host in the domain will be accepted. On the other rejected.

c/
example.com. IN TXT "v = spf1 ip4:192,168,137,101 -all"
Incoming IP 192,168,168,137,101 will be accepted. Other messages rejected.
d/
example.com. IN TXT "v = spf1 a mx ip4:192,168,137,202 -all"
Incoming mail from any host in the domain, the SMTP server receiving the mail and IP 192,168,137,102 will be accepted. The remainder will be rejected.
e/
example.com. IN TXT "v = spf1 mx -ip4:192,168,137,101 -all"
Incoming mail from any SMTP server receiving the mail, bypassing the host IP 192,168,137,101 will be accepted. The remainder will be rejected.

Notes


Full syntax: http://www.openspf.org/SPF_Record_Syntax
Validator: http://www.kitterman.com/spf/validate.html
Generator: http://www.spfwizard.net/
How to add SPF in your domain: http://kb.mediatemple.net/questions/658/How+can+I+create+an+SPF+record+for+my+domain%3F#gs

2014/08/11

Simple url construction example

http(s)://www.domain.net/site.php?arg1=val1&arg2=val2#label1

http(s) - protocol
www.domain.net - server address
site.php - document name (optional)
arg1,arg2 - url arguments passed to site (optional)
label1 - anchor, it points where to jump on site (optional)

How to check your google search history ?


If you have google account and are logged in, google stores your search results in history.
Archive stores results even from some years ago.
To check your history visit:
https://history.google.com/history/
or where you were:
https://maps.google.com/locationhistory                  



2014/08/09

How to add and remove programs from startup windows 8 ?

Disable / enable program on startup Wndows 8

(right click) Windows Toolbar -> (select) Task Manager -> (select) Startup -> (right click) application -> (select) disable / enable




Add programs to startup Windows 8

From Run box run: 
%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup

or type in Windows explorer:
C:\Users\(your domain name)\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

or look here.

2014/08/04

How to force file update in TFS ?



1. Find file on drive and replace it with a new version


 2. Open Team Explorer -> Source Control and find it in archive
 3. Click right on file and select "Check out for edit"

4. Confirm changes as shown..

5. Now TFS knowsthat file needs to be updated in repository

6. Check In pending changes




2014/07/29

How to convert JSON object to Dictionary in C# ?

How to generate bitmap from url in C# ?

How to convert byte array to string and string to byte array in C# ?

How to get HTML page content programatically in C# ?

Polish NIP validation

Email address validation in C#

Not exacly compatible with iso:

Convert datetime to timestamp and timestamp to datetime in C#

How to convert encoding from one to another in C# ?

How to remove directory with all its files and subdirs recursively ?

How to check if url is valid in C# ?

How to compute MD5 in C# ?

How to add column to table in TSQL ?

Syntax from msdn

2014/07/20

Generate random number in C#

2014/07/15

Insert Google Analitics code to Prestashop

Be carefull. You should not have any strings in your smarty template like this:
"{x.."
, because it's reserved for smarty variable and Prestashop uses smarty templates Instead use this:
"{ x...".
F.g:
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-....', 'auto');
  ga('send', 'pageview');
</script>
->
<script>
  (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-....', 'auto');
  ga('send', 'pageview');
</script>

2014/07/14

How to read value returned by stored procedure - TSQL ?

http://msdn.microsoft.com/en-us/library/ms188332.aspx

2014/07/07

How to disconnect Skype from Microsoft or Facebook account?

Solution in polish is here

Adding two integers without temporary variable - C#

Read collection from configuration file app.config in C#

App.config:
Service classes:
Usage: