Twice entries per day, I rock :D
Now what? the question I got into my head about the gaming industry. Now we have WARP in windows 7, and intel i7, and DirectX 10, besides the GPU. They are all maximizing the power of the games rendering and blending. Which will open the gates for a new games that have richer interface and much more bump mapping textures.
You know what? all that means in simple statement that the game will use the GPU and CPU for game processing. which leed to GPU+CPU(cores). It may seem like running the game upon maultiple processors on your computer. interesting.
It is a thread world after all. The more you use thread the better code it will be. and this can be done from the IDE itself!!!
After all, lets cruse the new threading world.
Monday, December 1, 2008
Does your website contain a malware, infection?
Too long for not writing anything in the blog. But it seems I missed it a lot.
one question in the subject, are you sure your web content is safe? if you are sure from the content you type. Then may be the users that write reviews or commenting had something else.
in the article below you will find 3 online tools to discover if your website contains malware, unauthorized content, your bad neighbors.
Trust me it is useful to check your site from time to another. to check its content.
check the site for more info.
http://www.labnol.org/internet/detect-webpages-that-serve-malware/5597/
one question in the subject, are you sure your web content is safe? if you are sure from the content you type. Then may be the users that write reviews or commenting had something else.
in the article below you will find 3 online tools to discover if your website contains malware, unauthorized content, your bad neighbors.
Trust me it is useful to check your site from time to another. to check its content.
check the site for more info.
http://www.labnol.org/internet/detect-webpages-that-serve-malware/5597/
Thursday, August 21, 2008
Web 2.0 and Indentity
From a long time, discovering passwords and the secret questions were hard to get and almost uses the technical expertise sniffing on ports, and hacking the target computer by applications or even using brute force attack, and getting some information about the domain you would like to hack, and all these stuff. The hardest part was to crack someone's identity over the web. It has to be through the relationship between you and the person you would like to hack. So, you sneak around him/her and watch the different activities he/she does to guess what he/she likes - like pets, furniture, trees, flowers...etc - it was the hardest part. It turns that you are a spy on him/her.
Web 2.0 has been coming. This sentence has changed the world. Many many people will be writing their stories and experience. The content will be from the users not from the companies. There were a punch of tools like blogging and wiki and other tools that make Web 2.0 more powerful. Yet we have a huge source of information getting from the people themselves and the companies. Pretty Cool huh !!!!
Now it is getting clear enough that Web 2.0 drives the identity to be public and more than that readable by hackers and crackers. I read this article How I Stole Someone's Identity, and I got shocked, not that shock when you touch electricity, but yeah your identity and my identity are public now. Anyone can read it and download it, and spend a day discovering my hobbies and my interests and begin trying to access my e-mail that i gave him. and then trying to access my visa number that I talked about it once in my blog, but not this blog :), and then ta da. I got busted and then I will receive a letter from the bank that I make my balance zero :( :( :( .
I guess from now, secrets should be kept in your mind only. Do not talk about yourself loudly, or you got busted by many hackers...
Now it is getting clear enough that Web 2.0 drives the identity to be public and more than that readable by hackers and crackers. I read this article How I Stole Someone's Identity, and I got shocked, not that shock when you touch electricity, but yeah your identity and my identity are public now. Anyone can read it and download it, and spend a day discovering my hobbies and my interests and begin trying to access my e-mail that i gave him. and then trying to access my visa number that I talked about it once in my blog, but not this blog :), and then ta da. I got busted and then I will receive a letter from the bank that I make my balance zero :( :( :( .
I guess from now, secrets should be kept in your mind only. Do not talk about yourself loudly, or you got busted by many hackers...
Labels:
Blog,
Brute force attack,
Identity,
Web 2.0
Tuesday, July 15, 2008
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)
If you have this exception, with wired error message and the stack trace is some how freeek.
Simply, this exception occurs when you have a server side call from javascript located at the head tag of the html like that
Simply, this exception occurs when you have a server side call from javascript located at the head tag of the html like that
< head runat="server" >
< script >
var controlClientObject = <%= RadControl1.ClientID %>
...
< / script>
< body >
...
you should do that
I googled a lot and this is what concluded.
ref. http://www.telerik.com/help/aspnet/menu//menu_move_codeblocks.html< script >
var controlClientObject = <%= RadControl1.ClientID %>
...
< / script>
< body >
...
you should do that
< head runat="server" >
< body >
< script >
var controlClientObject = <%= RadControl1.ClientID %>
...
< / script >
...
< body >
< script >
var controlClientObject = <%= RadControl1.ClientID %>
...
< / script >
...
I googled a lot and this is what concluded.
Monday, May 19, 2008
Excel Export
the problem is we don't know how to deal with excel, and how excel deals with data connectors like ODBC.
I faced these issues and searched a lot to get a result and got these guidelines.
1- for loading an excel file make sure you format the excel file to the desired format you want. example: if you only will get the data in number format, so format the column with the suitable numeric format. so that all the data that you will have is the numbers, if you types a word in this column, excel will not transfer this value to the ODBC driver.
If you want it generic so you will format it as text. so whatever gets into the cell excel will transfer it.
here is a snippet of how loading from excel. [the code is in C#]
public DataTable LoadSheet(string sheetName)
{
DataTable dtSheet = new DataTable();
string excelConString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FilePath + ";Extended Properties=\"Excel 8.0;HDR=YES;IMEX=1\";";
string command = "select * from [" + sheetName + "$]";
new System.Data.OleDb.OleDbDataAdapter(command, excelConString).Fill(dtSheet);
return dtSheet;
}
this how to load a sheet of excel into DataTable which you can deal with in the rest of your code.
*Trick: when reading, excel considers the first formatted row as the table header [formatted means bordered] if you did not do that the headers will be F1, F2...etc
2- Writing to Excel. the problem begins.
- first you have to export to a named sheet
- the sheet should be in a table format, if you typed in this sheet before exporting the writing process will begin writing after your writing. example: you write in cell A2, when exporting the excel will begin writing from A3, B3,C3...etc.
- any formats should be applied on the previous cell that you want to write in. example: you to begin writing in cell A4, and you want it to be formated as numeric (#.00). So, you have to apply this format on cell A3 only and not the column.
- now you need the way to insert the rows.
connection.Open();
OleDbCommand command;
// insert rows
foreach (object item in items)
{
// insert row
command = CreateInsertCommand(sheetName, fields, connection, item);
command.ExecuteNonQuery();
}
private OleDbCommand CreateInsertCommand(string sheetName, ExcelField[] fields, OleDbConnection connection, object item)
{
StringBuilder builder = new StringBuilder();
string fieldValue;
OleDbParameter parameter = null;
int count = fields.Length;
OleDbCommand command = connection.CreateCommand();
for (int i = 0; i < count; i++)
{
fieldValue = (item is DataRow) ? fields[i].GetDataRowValue(item) : fields[i].GetValue(item);
if (i == 0)
{
builder.AppendFormat("insert into [{0}$] values(?", sheetName);
}
else
builder.Append(", ?");
parameter = new OleDbParameter(string.Format("param{0}", i), GetOleDBType(fields[i].FieldType));
parameter.Value = fieldValue;
command.Parameters.Add(parameter);
if (i == count - 1)
builder.Append(")");
}
command.CommandText = builder.ToString();
return command;
}
and tada it did insert the rows.
*Tricks: make sure you cast the fields values to its proper type.
Now the nightmare part. the calculations and advanced formatting. this is an excel behavior. if you need to do this you have to create a separate sheet for viewing and other sheets to get the data and make a reference from the view sheet to the other sheets.
the calculations will be on the view sheet. your export function will export to those sheets. And you have to open the file to apply the formatting otherwise it will not affected!!!!
Enjooy the excel loading and exporting.
those tips for formatting Excel.
Labels:
.net,
and Tutorials,
C#,
Excel,
FAQs,
Help,
Microsoft Excel,
ODBC,
Open Database Connectivity,
Programming
Wednesday, May 7, 2008
This is a test For Zemanta :)
Tuesday, March 4, 2008
Asp.net TreeView state
Don't you ever wanted to preserve the tree status over multiple pages? I searched for many times and found the solution.
function getCookieVal (offset)
{
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < style="color: rgb(51, 51, 255);">var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function SetCookie (name, value)
{
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function DeleteCookie (name)
{
var exp = new Date();
exp.setTime (exp.getTime() - 1000000000); // This cookie is history (changed -1 to make it previous time)
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
2-
Parent
+ child 01
--+child 02
-----leaf
it will be indexed like this
Parent [0]
+ child 01 [1]
--+child 02 [2]
-----leaf [3]
var increment = 0;
for(;incrementvar child_node_name = TreeView_GetNodeText(childNodes[increment]) ;
}
In the server side parse the cookie back and preserve the collapse/expand behaviour.
- use cookies
- javascript override functions
- TreeView javascript important functions
- these script assign a value to cookie:
function getCookieVal (offset)
{
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < style="color: rgb(51, 51, 255);">var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function SetCookie (name, value)
{
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function DeleteCookie (name)
{
var exp = new Date();
exp.setTime (exp.getTime() - 1000000000); // This cookie is history (changed -1 to make it previous time)
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
2-
To override the function in JavaScript, simply define a new variable to hold the old function, and redefine the old function variable as a new function. Here’s the syntax:
var base_TreeView_ToggleNode = TreeView_ToggleNode;
TreeView_ToggleNode = function(data, index, node, lineType, children){
base_TreeView_ToggleNode(data, index, node, lineType, children);
setProfileFolder(data, index,node,children);
return;
}
The setProfileFolder function is our addition to the base method.
see the original reference here.
3- Now you have to see the important functions and concepts about the treeview control
- TreeView_GetNodeText(node): it takes a node object and returns the node name
- Facing the similar nodes in text but in different branches:
Parent
+ child 01
--+child 02
-----leaf
it will be indexed like this
Parent [0]
+ child 01 [1]
--+child 02 [2]
-----leaf [3]
- you can navigate through the child nodes like this
var increment = 0;
for(;increment
}
In the server side parse the cookie back and preserve the collapse/expand behaviour.
Subscribe to:
Posts (Atom)
