How to install SqlMembershipProvider Schema in your SQL Server instance

This is for the people who are used to install Membership, Roles etc. including all those tables, views, and stored procedures in the database from within the Visual Studio (earlier versions).

As it’s not supported anymore in the newer versions of your favorite IDE you need to do it in a different way.

Well you need to use a tool called aspnet_regsql.exe and can be found at %WINDIR%\Microsoft.Net\Framework\{YourNetVersion}

 

Just double-click the executable and then when the dialog appears follow the instructions … it’s a self-explanatory. Cheers

Read More

FIX – Error CS0029: Cannot implicitly convert type string to System.Web.UI.WebControls.TextBox

It’s little weird but actually it’s very simple to reproduce the issue. Just set the ID property to “Title” and voila! You’ll get this specific error e.g. if you have a TextBox
< asp:TextBox ID="Title" runat="server" /> you will get the following error:

CS0029: Cannot implicitly convert type string to System.Web.UI.WebControls.TextBox

if it’s DropDownList it would be

CS0029: Cannot implicitly convert type string to System.Web.UI.WebControls.DropDownList

etc.

Meaning just change the ID to something else e.g. TitleBox and it will work fine.

Read More

Error: not all code paths return a value C# Fix

Usually you get this error if you’re missing a return statement, but not always!!
Sometimes you may have everything in place but keep getting the same error in your code. e.g.

public static string xmlpath
{
get
{
string result = string.Empty;
 
if (HttpContext.Current.Request.Url.PathAndQuery.ToLower().Contains("blah"))
{
result = "blah.xml";
}
else
{
result = "blah-blah.xml";
}
return result;
}
}

FIX: simply rebuild your project | right-click the project in the Solution Explorer and select Rebuild.

Read More

Visual Studio 2013 MySQL doesn’t appear as a data source – FIX

If you can’t see the MySQL in your Visual Studio or you get various errors when you try to e.g.  add a new DataTableAdapter for MySQL database etc. you should do the following:

1. Uninstall everything related to MySql (except the mysql server if any) meaning, connectors and such.

2. Download the latest  .NET connector and MySql For Visual Studio
Connector/NET: http://dev.mysql.com/downloads/connector/net/
MySQL for Visual Studio: http://dev.mysql.com/downloads/windows/visualstudio/

3. Restart your Visual Studio.

Voila!

MySQL - Data Source

Read More

Twice Born “Venuto al mondo” (2012)

Twice Born 2012
I just wanted to recommend you this brilliant movie :)

I watched it last night and i can say it blew me away.

I would not review the movie in details but if you are looking to watch a good movie then this is certainly one that you should not miss. Very good story and very good acting.

I particularly liked when the very next scene clarifies something that seemed totally different. Definitely my favorite movie for this year.

Cheers

Read More

I’ve built a new PC last night

It’s been for a while since i built my last PC. In the past i was building PC’s for my kids, friends and neighbors but there is more than 5 years since i haven’t messed with these things.

Well, yesterday i build a new workstation for myself and ladies and gentlemen, i can say that i built a beast of computer.

For the truth’s sake, i cannot stop wondering how powerful the new hardware became in the last few years. In the meantime i was mainly using my old ASUS laptop. Core 2 Duo btw lol.

Wow guys, the new i7 chip-set is a monster. The SSD thing is fast as hell. The fans are super, super quiet (more quieter than my laptop yeah they are) … everything is like a dream to me.

This is the list of components i used (they all work in a perfect harmony by the way):

1. Intel i7-4770 3.40GHz
2. Cooler Master Hyper 212 Evo
3. ASUS Gaming Series MAXIMUS VI HERO
4. HDD 1TB WesternDigital 7200rpm
5. SSD 120GB Samsung 840 EVO
6. ASUS GTX650TI-PH-1GD5
7. Kingstone 16GB (2 x 8) DDR3 2133MHz HyperX XMP Beast
8. Gigabyte Sumo Alpha case
9. CoolerMaster Silent Pro M II 520W 80plus bronze
10. SAMSUNG Internal DVD-RW H/H

I also bought a headset CAVIMANUS HS-G700V and guess what, it’s also amazing – highly recommended!!!

The only Con is the price. Not sure if you knew but building a PC in this way is way more expensive than a Laptop with the same hardware (plus laptop comes with monitor and everything).

Believe it or not i paid about $2k for these components. For the same price i could have bought the latest ASUS G750JX with i7 Haswell, GTX780 and SSD 250GB.

However laptop does not suit my needs and my desk space lol

Read More

FIX: Loading panel not showing for AjaxUpdatedControl

There are certain situations when the loading panel (RadAjaxLoadingPanel) is not showing up while your control is still Ajaxified (no page refresh) so everything seems to work except that loading panel effect is kind of invisible.

To fix this you should put the updated control inside e.g. Panel control e.g.

<asp:Panel id="AjaxPanel" runat="server">
   <telerik:RadGrid ....
</asp:Panel>

then change the AjaxSettings like the following:

<telerik:AjaxSetting AjaxControlID="RadGrid1">
   <UpdatedControls>
        <telerik:AjaxUpdatedControl ControlID="AjaxPanel" LoadingPanelID="DoctorsLoadingPanel" />
   </UpdatedControls>
</telerik:AjaxSetting>

also remember that you should never Ajaxify the whole e.g. ContentPlaceHolder in the master page !!!

HTH

Read More

Why you should never use the ‘Font Awesome’ for creating glyph’s and stuff!?

The font called FontAwesome is actually a very good font … good looking and everything but for some reasons it does not work in a Firefox browser.
I tried everything including paths fixing (an absolute path), adding www. upfront etc. etc but none of them worked for me. However it works fine in IE and Chrome :(
So either use another font or simply use some graphics instead. Cheers

Read More

Windows 8.1 is actually Windows 8.0 SP1

Windows 8.1
Windows 8.1

 

I can now confidently say that Windows 8.1 is a big improvement (stable, quick and easy to use) over Windows 8.0 but, I can also say that the new version is nothing but a service pack that we used to get with the earlier versions of this OS.

 

Meaning, although Microsoft wants to present it as a brand new operating system they actually only wants to avoid the term service pack.

 

Conclusion: think of Windows 8.1 as of Windows 8.0 SP1 ;)

Read More

The University American College Skopje (UACS) – A Short Review of “SCHOOL OF COMPUTER SCIENCE AND INFORMATION TECHNOLOGY”

UACS
UACS

 

Pros:

Generally speaking, it’s a great School with beautiful amphitheaters, classrooms and other facilities required for a modern college.

The location is very convenient, just a few steps away from the local bus station. It is about a 5 minute drive to the downtown. The parking is descent. It’s not paved entirely but, there are plenty of parking lots (well sometimes they fill up quickly).

The Labs are equipped with high-end Computers and are enriched in all the software as well hardware.

The WiFi is usually slow if you’re not near the router or close to a computer lab, but there are many to choose from in the building, and they are all well stocked with the latest technology.

As for the supporting staff, I have nothing but praise. There is always someone helpful at the reception-desk who can answer questions and point you in the right direction.

Cons:

The teaching and learning, in my opinion are not the primary goals of the school considering the amount of money you must invest. The price is around $3.000,00 (for a part time studies) per year which is certainly too high for what you get. Bad school in terms of getting a quality education. They are more focused on issuing degrees (read money) than real education. I guess that’s why Macedonian Higher Education Institutions (HEIs) ranked UACS as 10th ranked university in Macedonia. Macedonian HEIs Ranking

The teachers … hmm actually there are only two teachers for the whole school, which means 30 subjects and three years in total. In addition these two are also dean and vice-dean of the school. I find it little weird but not really so much creepy.

As for the books; well unfortunately there are no books originally written by the professor responsible for a particular subject. Instead the students learn from power-point presentations converted in PDF format so no books written by the professors which is a common practice in the better ranked universities.
Of course, you may borrow some foreign book from the library but the one that your teacher recommended you usually contains nothing that will be contained in the final exam. For instance they told me to borrow “C++ How to Program – 1303 pages” which is way beyond the knowledge i needed to pass “Fundamentals of programming”.
So just use the materials attached on the portal and shut up.

 

Conclusion:

If you are still in a baby state of living, have rich parents and need to be taken care of, this school will fit your lifestyle perfectly. If you are an adult like me and expect to be treated like an adult stay far away from this university you will not get what a healthy, intelligent, and SELF-motivated individual needs. Instead you will be forced to be coddled in a paradoxical guilt driven way which is the heart of UACS.

 

Hope this helps someone

Read More

Two Dimensional Array with Unknown Dimension Sizes at Compile Time (C/C++)

Say you have the following problem to be solved:

Create a program in C++ which will enable the user to enter a two dimensional array. [mxn]
(m and n are numbers entered through a keyboard) The program should find the smallest and the
largest elements in the array and should calculate their difference.
At the end the program should print the results as shown in the example.

Ex.
Please insert value for m: 3
Please insert value for n: 3
Insert values:

A[0][0]: 1 A[0][1]: 3 A[0][2]: 5
A[1][0]: 2 A[1][1]: 9 A[1][2]: 6
A[2][0]: 2 A[2][1]: 4 A[2][2]: 7

The smallest element in the array is: 1
The largest element in the array is: 9
The difference between them is: 8

As you guess to write a code that works you have to use pointers pointing to dynamically allocated types. Meaning, you can’t just say: int A[m][n]; obviously because C++ doesn’t support the array dimensions with sizes not known at compile time!!!

(more…)

Read More

Game for your kids (find a letter position in the given word)

If you have a preschool kid(s) struggling with the letters i am sure you will find this game useful and helpful.
My son is 6 years old and he certainly struggles with the letters. That’s how i came with the idea to make it little easier for him.
This game helped him to visualize the position of the letter making it very obvious.
I’ve added points/coins and sounds to attract him and to keep his attention as longer as possible. Enjoy!!!

Letter position game

Download C# source code (Visual Studio 2012)

NOTE: As this is very basic programming i coded it procedural without bothering with classes and stuff.
Not sure if the documentation is useful but the code is as mention too basic so every next step would be an over-complication.

Read More

C++ Exam – Fundamentals of programming

C++ Programming
C++ Programming

The following was a part of my c++ exam. I thought i can share the solution, Hopefully it will help someone…

Create a program in C++ which should process a string and find all letters in it which are smaller than
a given control character. The sentence and the control character should be entered by the user. The
program should:
a. Process the whole sentence, find all characters smaller than the control character and
change them with the control character.
b. Print the new sentence.
c. Print the number of changes.

(more…)

Read More

My Tablet PC Samsung Galaxy Tab3 is Dead. How to fix it eventually.

Galaxy Tab 3
Samsung Galaxy Tab3
Today when my son told me that his recently bought tablet PC (Samsung Galaxy Tab3) can’t be charged and that it does not react on the power button i thought it’s gone. Yeah it was literally dead. However after a while i started to keep the power button longer and longer until i kept it for say 20 seconds. Suddenly something came to the screen. It was the battery image. Then i plugged-in and it started to charge. Meaning, it this ever happen to any of you just press the power button and hold it pressed for 20+ seconds until that short animation appears. Voila!
Hope this helps someone

Read More

error: 50 – Local Database Runtime error occurred.

SQL Server 2012 Express
SQL Server 2012 Express

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 – Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.
)

If you google the error you will find many articles claiming solution.
One of them is the following which is closest to final resolution of this problem.
Windows 7 SP1 causes IntelliTrace Collection to fail on IIS

The only thing that you should change is the IdentityType.
Meaning they suggest that you edit applicationHost.config file found in %windir%\system32\inetsrv\config\ specifically the ApplicationPools section.

<add name="ASP.NET v4.0" managedRuntimeVersion="v4.0">
   <processModel identityType="ApplicationPoolIdentity" loadUserProfile="true" setProfileEnvironment="true" />
</add>

It may work for someone but it didn’t for me. Then i had to play around with these settings. Finally when i changed the IdentityType to NetworkService i was able to use My newly created database (SQL Server 2012 express – localDB)

SOLUTION:

<add name="ASP.NET v4.0" managedRuntimeVersion="v4.0">
   <processModel identityType="NetworkService" loadUserProfile="true" setProfileEnvironment="true" />
</add>

Hope this helps someone

Read More

How to disable html tags entering in a TextBox (simple and neat solution)

To prevent the users entering open and close tags characters you may want to use the following javascript code:

var IsShiftDown = false;
function BlockingHtml(Sender, e) {
   var key = e.which ? e.which : e.keyCode;
   if (key == 16) {
     IsShiftDown = true;
   }
   else if ((IsShiftDown == true) && ((key == 188) || (key == 190))) {
     return false;
   }
}

USAGE:

<asp:TextBox ID="PlainText" runat="server" onkeydown="return BlockingHtml(this,event);" />

Please notice that HTML tags begin with a less-than sign: < and end with a greater-than sign: >. Always. No exceptions!
That’s why we chase the 188 and 190 chars … 188 is the < and 190 is > when the Shift key is pressed!

Hope this helps someone

Read More

SQL Server – Ambiguous column name error

If you execute the following query you will certainly get an Ambiguous column name error:

SELECT
   CustomerID
FROM
   Customers AS Cus
INNER JOIN
   Payments AS Pay
ON
   Cus.CustomerID = Pay.CustomerID
WHERE
   DATEDIFF(DAY, AddedDate, GETDATE()) < 30

Msg 209, Level 16, State 1, Line 2
Ambiguous column name ‘store_ID’.

It usually means that MSSQL does not know which column you are trying to fetch as the same column name exists in the both tables!!!

Solution for this odd Ambiguous column name error is to use an alias for the column name e.g.

SELECT
   Cus.CustomerID
FROM
   Customers AS Cus
INNER JOIN
   Payments AS Pay
ON
   Cus.CustomerID = Pay.CustomerID
WHERE
   DATEDIFF(DAY, AddedDate, GETDATE()) < 30

Hope this helps someone

Read More

A Query for MERGE with CASE in UPDATE (T-SQL)

i’ve been asked by lost of people about how to use CASE when you write a MERGE statement which is synchronizing (updating) two tables.

So here we go (a very basic example which sync the quantity field in the Products table):

-- DELETES THE DUPLICATES IF ANY! (THIS IS A MUST WHEN YOU USE MERGE)
DELETE everything FROM (
SELECT *, rownum = ROW_NUMBER() OVER (PARTITION BY ItemID ORDER BY ItemID)
FROM QuantityUpdates
) everything
WHERE rownum > 1;
 
-- please notice that you can also use group by to prevent duplicate rows !!!
 
MERGE INTO
Products AS Prod
USING
QuantityUpdates AS Qty
ON
Prod.ItemID = Qty.ItemID
WHEN
MATCHED
THEN UPDATE SET
QtyInStock = Qty.QtyInStock,
UpdatedDateStamp = GETDATE(),
Discontinued = CASE WHEN Qty.QtyInStock > 0 THEN 0 ELSE 1 END;

Voila! Hope this helps someone

Read More

Suppress Uppercase Conversion in Visual Studio 2012

As you’ve already noticed, by default all the Main Menu items in your Visual Studio 2012 are uppercase.

To fix this (to disable/suppress uppercase conversion) you have to create a new DWORD in the Registry Editor.

1. run RegEdit.exe (type RegEdit in the Run)

2. Expand the HKEY_CURRENT_USER as shown on the image below

Registry Editor
Registry Editor

3. Right-click General node and then select New -> DWORD (32-bit) Value as shown on the image below.

Context Menu
Context Menu

4. Name it “SuppressUppercaseConversion” and click OK!

5. Double click the newly created value and set the Value data to 1 (as shown on the image below)

Value data
Value data

Voila. Now re-open your Visual Studio 2012 and your Menu items will appear like in the previous version of your favorite IDE

Fix the uppercase menu items in VS 2012
VS 2012 Main Menu uppercase items

Hope this helps to someone! Cheers

Read More

A generic error occurred in GDI+ (Possible Solution)

I guess you’ve read about permissions thing which is that your application doesn’t have a write permission on some directory. But sometimes it can be simply a missing directory. Yeah it did happen to me today. I just found out that VS compiler excluded an empty folder from the pre-compiled version. As soon as i copied the precompiled version i started getting “A generic error occurred in GDI+” error. So next time just double check if missing folder is your problem. Find the code that deals with the GDI+ and be sure that your paths match existing folder(s).

Hope this helps to someone

Read More

How to get rid of the XML Parsing Error

XML Parsing Error
XML Parsing Error
I just want to share a possible fix for this odd error. In my case it was a silly if statement in which i decide if MyPanel control should be rendered or not. However i missed the name of the panel control so i ended up with this XML Parsing Error. After i while i figured out that i have an error in the code-behind that looked like the following:

If condition = True Then
   MyPanel.Visible = True
Else
   Visible = False
End Try

Once i changed to the below it worked like a charm.

If condition = True Then
   MyPanel.Visible = True
Else
   MyPanel.Visible = False
End Try

Hope this helps to someone at least

Read More

WebsiteSpark Unsubscribe – is it possible?

I would say it is not. Why? Well, because they send you a broken unsubscribe links.
Of course i did that long time ago in the account options (currently cancelled) but it kept sending me various emails.
Most of them if not all, do not contain an unsubscribe link. And now they finally added the link at the footer but it does not work.
If you click it does nothing as it starts with “file:///C%7C/Users/Stephen/Desktop/Projects” etc.
This is the whole link:
(more…)

Read More

How to add and watch movie on your PSP

watch movie on your PSP
watch movie on your PSP

I bought it several months ago. Mainly for my kids to play the games on it. But, last night they ask me if they can watch a cartoon on it. I googled and found a tons of tutorials about how to convert movie to psp format which is MP4. So far so good. I converted the Rio DvdRip to MP4. I connected the PSP with my laptop hoping that i will just copy the converted cartoon to the stick and it will work. But i was wrong. I put it to the root of the memory stick but it didn’t work at all. The PSP was not able to find the movie. Then i googled again and found a lots of tutorials about how to put movie on your PSP. They all suggested the same which is creating a two folders MP_ROOT and 100MNV01 inside it. Some of them even suggested that i name the files M4V10001.MP4, M4V10001.MP4 etc. respectively.  None of these worked for me. Rather i tested something pretty silly as it seemed from beginning. Meaning, i created a brand new folder named VIDEO in the root of the memory stick and i put the converted file as is Rio 2011.mp4. Final result X:\VIDEO\Rio 2011.mp4 !!! Voila!

It worked like a charm. My kids were very happy because of that. Hopefully someone else will find this useful too.

Read More

RadControls For ASP.NET AJAX 2011 Q1

RadControl for ASP.NET AJAX
Hello Guys,

Before I continue I would like to mention that I deleted the previous version of this review which was much longer, and more eloquent but then I realized that it is not necessary at all. Simplified, the Telerik controls are a must for every serious asp.net developer.

Ok here we go:

I am fairly new to Telerik stuff and I am wondering where to start really. Nevertheless I am very pleasantly surprised by the overall look and performance.

Actually I have NOT been so pleasantly surprised for longer. I cannot resist mentioning that I love its ease of use and above all, easy of install.

Well, usually you use the standard installation (.MSI Setup) but, rather you can DL the libraries and simply add a reference to DLL’s . Voila! You are all set up to use RadControls for ASP.NET AJAX.

It can’t be simpler, right? (more…)

Read More

How to Remove unused Application Pools using ServerManager Class

Public Sub RemoveUnusedApplicationPools()
        Dim manager As New ServerManager
        Dim AppPools As New List(Of String)
        ' fill the list with all pools
        For Each apppool As ApplicationPool In manager.ApplicationPools
            AppPools.Add(apppool.Name)
        Next
 
        ' if it's used remove from the total list
        For Each website As Site In manager.Sites
            For Each app As Application In website.Applications
                AppPools.Remove(app.ApplicationPoolName)
            Next
        Next
 
        ' remove the unused pools
        For Each unusedApplicationPool As String In AppPools
            Dim apppool As ApplicationPool = manager.ApplicationPools(unusedApplicationPool)
            manager.ApplicationPools.Remove(apppool)
        Next
 
        ' call the commitchanges method
        manager.CommitChanges()
        manager.Dispose()
    End Sub

Read More

A regex that matches all credit cards

Regular Expression For Credit Card Numbers
Regular Expression For Credit Cards

This is a regular expression that validates all credit card numbers including VISA, MASTER, AMEX and DISCOVERY! ^((4\d{3})|(5[1-5]\d{2})|(6011)|(34\d{1})|(37\d{1}))-?\d{4}-?\d{4}-?\d{4}|3[4,7][\d\s-]{15}$

<asp:RegularExpressionValidator ID="CreditCardValidator" runat="server" 
   ControlToValidate="CreditCardNumber" Display="Static" 
   ErrorMessage="Please enter valid card number" 
   ValidationExpression="^((4\d{3})|(5[1-5]\d{2})|(6011)|(34\d{1})|(37\d{1}))-?\d{4}-?\d{4}-?\d{4}|3[4,7][\d\s-]{15}$"  
  ValidationGroup="CustomSignup" Text="*" />

Read More

SQL Rounding Up Issue

often people complain about rounding up decimal values. The first question they ask is why SQL Server truncates the decimals which is silly because it happens in the code-behind.

For instance, say that you have a field of decimal datatype with precision 5 and scale 2 – decimal(5, 2)
Now if you don’t define precision of the output parameter the value will be rounded up. e.g. 0.99 becomes 1

CREATE PROCEDURE mySP
(
     @MyDecValue DECIMAL(5, 2) output
)
AS
     SELECT @MyDecValue = MyDecField FROM MyTable WHERE Foo=1
Dim command As SqlCommand = connection.CreateCommand
command.CommandText = "mySp"
command.Parameters.Add("@MyDecValue", SqlDbType.Decimal, 5).Direction = Output

now if you execute the command the value will be as mentioned rounded up .. meaning, 0.99 becomes 1

You can solve it if you Define the precision and scale of the parameter e.g.

Dim command As SqlCommand = connection.CreateCommand
command.CommandText = "mySp"
Dim decimalsparam As New SqlParameter
decimalsparam.Direction = ParameterDirection.Output
decimalsparam.ParameterName = "@MyDecValue"
decimalsparam.Precision = 5
decimalsparam.Scale = 2
decimalsparam.Size = 5
 
command.Parameters.Add(decimalsparam)
command.ExecuteNonQuery()

Read More