31 Ağustos 2013 Cumartesi

Cant initialize oci error occured during the login process using toad

You are using TOAD, and you are getting following message when trying to connect to the database:
Can't initialize OCI Error 1
Connections using sql*plus or sql*developer using the OCI thick driver are succeeding fine.
If you have more than 1 Oracle home installed, make sure TOAD is using the correct Oracle_home.
You can either specify a TOAD_HOME in toad, or you can switch to the correct ORACLE_HOME using our free Oracle Locator Express.
If this does not work for you, one work around can be to create an environment variable ORACLE_HOME and set it to the correct Oracle_home.
Some versions of TOAD still will generate this error, even all parameters are ok.
If you are sure the correct ORACLE_HOME is inside the PATH environment variable and all registry settings are ok, than you will need to manually create the ORACLE_HOME environment variable.
In order to create this environment variable:
  1. Open up the Control Panel
  2. Double click on the SYSTEM icon
  3. Goto the Advanced tab page
  4. Choose environment variables
Now, add a new ‘User variable’ for ORACLE_HOME and set its value to the correct location of the Oracle home you want to use.
When you change your system to use a different Oracle home, make sure to also make the necessary changes to your environment variable.
If all of this fails, and you are connected using a remote desktop, or are using Citrix, following steps might help:
Permissions on the folders (give users read and execute) and the “create global objects” security setting are the problem. Instructions to fix:
To resolve this issue, identify the users group that is used to run the program, and then assign the “Create global objects” user right to that users group. To do this, follow these steps:
  1. Click Start, point to Programs, point to Administrative Tools, and then click Local Security Policy.
  2. Expand Local Policies, and then click User Rights Assignment.
  3. In the right pane, double-click Create global objects.
  4. In the Local Security Policy Setting dialog box, click Add.
  5. In the Select Users or Group dialog box, click local users group or the user account that you want to add, click Add, and then click OK.
  6. Click OK.
When you perform these steps, make sure you read about the security concerns at the microsoft website.

Dataset kullanımı ile veri tabanı güncellemesi

    Bildiğimiz gibi dataset nesneleri sanal veritabanları olarak tabir edebileceğimiz veri tabanından bağımsız çalışan, veritabanlarındaki gibi birden fazla tablo barındırabilen ve bu tablolar içerisindeki kayıtlar arasında ilişki kurabilen veri blokları dır.

      Bu yazıdaki hedefimiz datasetlerin kullanımını öğrenmek değil. Bu yüzden dataset hakkında belli bilgiye sahip olduğunuzu varsayıyorum.

     Veritabanı güncellemelerini dataset nesnesi kullanmadan da yapmak mümkün; bunun en basit şekli Command nesnemiz in ExecuteNonQuery metodunu kullanmak. Ancak programlarımızda dataset nesneleri kullanıyorsak bu nesneler üzerindeki değişikleri de veritabanımıza geri yansıtmamız mümkün.

  • DataAdapter’ dan Dataset’ e Bilgi Aktarımı


       Dataset’ i veritabanı bilgileri ile doldurmak için .NET data sağlayıcıları kendi DataAdapter’ larını kullanmak zorundadırlar: OLE DB .NET data sağlayıcısı için OleDbDataAdapter nesnesi ve SQL Server .NET data sağlayıcısı içinse SqlDataAdapter nesnesi kullanılır. Bu doldurma işleminin yapılması için DataAdapter’ ın Fill metodu kullanılır. Örneğin: (Sql Server için)

DataSet ds=new DataSet();
SqlConnection cnn=new SqlConnection("server=local\\vsdotnet;trusted_connection=yes;database=northwind");
SqlDataAdapter da=new SqlDataAdapter("select * from categories",cnn);
cnn.open()
da.Fill(ds,"categories");
cnn.close();

    Bu komut blokunda görüleceği üzere önce northwind veritabanı ile bağlantımızı kuruyor, daha sonra SqlDataAdapter nesnemiz in yapıcısına Select sql komutumuzu yazarak veri kaynağımıza bağlıyoruz. Burada dikkat etmemiz gereken, SqlDataAdapter yazıcısındaki sql komut parametresinin mutlaka Select sql komutu olmasıdır. Daha sonra “categories” tablosundaki verileri ds adlı dataset nesnesine aktarmak için Fill metodumuzu kullanılıyoruz  Fill metod parametresinde kullandığımız “categories” dataset’ in içerisindeki tablonun ismidir. Bu opsiyoneldir, istersek tablo ismi vermeden de dataset doldurabiliriz. Bu durumda dataset tabloya default olarak “table” ismini verir. Neyse çok fazla uzatmadan datasetten veritabanı güncellemesine geçmek istiyorum. Şimdiye kadar yaptıklarımız hepsi birer hazırlık aşamasıydı.



  • Dataset Güncellemeleri


      Güncelleme dediğimizde aklımıza aslında dataset’ e yeni kayıt ekleme, kayıt silme, kayıt güncelleme gibi terimler gelmesi gerekiyor. Yukarıda doldurduğumuz dataset üzerinde şimdi değişiklik yapacağız ve bu değişiklilerin nasıl veri tabanına geri yansıtıldığını göreceğiz. 

         Öncelikle biraz teknik bilgi:

        Dataset’ te yapılan değişikler, veri tabanına Update metodu ile gönderilir. Bu olayın nasıl gerçekleştiğini şu örnekle inceleyelim.

Dataset içerisine aktarılan veriler şöyle olsun:


(RowState)
CustomerID
Name
Status
(Unchanged)
C200
Robert Lyan
Good
(Unchanged)
C400
Nancy Buchanan
Pending

      Uygulamamızda “C400” CustomerID’ li müşterimizin Status bilgisini DataSet içerisinde “Preffered” olarak değiştirdik diyelim. Bu değişiklik sonucunda DataRow.RowState özelliği, değişen satırlar için Unchanged’ den Modified’ a döner. Yani DataSet içeriği söyle olur:


(RowState)
CustomerID
Name
Status
(Unchanged)
C200
Robert Lyan
Good
(Modified)
C400
Nancy Buchanan
Preffered

      İşte bu sırada DataAdapter nesnemiz in Update metodunu çalıştırdığımızda, Update metodu her satırı denetler. İlk satır için veri tabanına hiçbir Sql komutu gönderilmez, çünkü RowState özelliğinin değeri “Unchanged” olarak kalmıştır. Buradaki RowState özelliği DataSet’ i oluşturan DataTable nesnesinin her DataRow nesnesinde bulunan bir özelliktir. Ancak ikinci satır için, Update metodu otomatik olarak komutu uyarır ve bu komutu veritabanı gönderip orada işlettirir. Bu komutu uyarma işlemi kafanızı karıştırmış olabilir: Update metodu RowState özelliğindeki duruma göre DataAdapter nesnemizde tanımladığımız komutu arar ve onu çağırır: RowState özelliği değişen satırlar için Modified”, dataset’ e yeni eklenen satırlar için “Added” ve silinen satırlar için “Deleted” değerlerini alır ve DataAdapter nesnesinden Modified satırlar için UpdateCommand, Added satırlar için InsertCommand ve Deleted satırlar içinse DeleteCommand’ da tanımlanmış Sql komutlarını veri tabanına gönderir ve değişikliklerin orada da olmasını sağlar. İşte bütün bu özelliklerin çalışmasını sağlayan Update metodudur.


        Şimdi bu anlattıklarımızı bir örnekte pekiştirelim.
DataSet ds=new DataSet();
SqlConnection cnn=new SqlConnection("server=local\\vsdotnet;trusted_connection=yes;database=northwind");
SqlDataAdapter da=new SqlDataAdapter("select * from categories",cnn);
//veritabanına işlenecek bilgiler için gerekli sql komutumuzu tanımlıyoruz
da.UpdateCommand=new SqlCommand("update categories set categoryname=@categoryname,description=@description where categoryID=@categoryID",cnn);
//parametreler tanımlanıyor
da.UpdateCommand.Parameters.Add("@categoryname",SqlDbType.NVarChar,15,"categoryname");
da.UpdateCommand.Parameters.Add("@description",SqlDbType.NVarChar,50,"description");
da.UpdateCommand.Parameters.Add("@categoryID",SqlDbType.Int,0,"categoryID");
cnn.Open();
//Datasetimizi güncelliyoruz
DataRow crow=ds.Tables["categories"].Rows[0];
crow["categoryname"]=”kategoriadı”;
crow["description"]=”tanımlama”;
da.Update(ds,"categories");
cnn.Close();

    Öncelikle veritabanı bağlantımızı kuruyoruz. Sonra SqlDataAdapter nesnemizi tanımlıyoruz. Bu nesne sayesinde dataset nesnemize veri aktarabilip, dataset nesnemizdeki güncellemeleri veritabanımıza geri aktarabileceğiz. DataSet nesnemiz üzerinde veri güncelleme yapacağımız için DataAdapter nesnemizin UpdateCommand özelliğine update sql komutunu aktarıyoruz. Burası önemli çünkü dataset nesnemizde ne tür değişiklik yapıyorsak(veri güncelleme, veri ekleme yada veri silme), uygun özellikleri kullanmak zorundayız (InsertCommand, UpdateCommand, DeleteCommand). Aksi takdirde programımızda hatalar oluşur. Bu programda UpdateCommand özelliğini kullanıyor ve sql komutumuzda belirttiğimiz parametreleri tanımlıyoruz. Parametre tanımlama başlı başına ayrı bir makale konusudur, bu yüzden burada parametreleri inceleyemeyeceğiz.

   DataSet nesnemizde de gerekli değişikleri yaptıktan sonra, Update metodumuzu çalıştırıyoruz. Update metodu DataSet nesnemizdeki değişiklikleri yukarıda bahsettiğimiz şekilde algılıyor ve DataRow nesnelerimizdeki RowState özelliğini kontrol ederek, DataAdapter nesnemizde tanımlanmış uygun komutları arıyor. Bu örnekde “0” indeksli satırımız değiştikten sonra aynı satırdaki RowState özelliği “Unchanged” den “Modified” a dönüyor ve Update metodu UpdateCommand özelliğindeki sql komutunu veritabanına göndererek çalıştırılmasını ve datadet nesnemizdeki değişikliklerin veritabanımızda da gerçekleşmesini sağlıyor. Eğer dataset nesnemize yeni satır ekleseydik, Update metodu DataAdapter nesnesinde tanımlanmış InsertCommand özelliğini arayacak ve bu özellikteki sql komutunu gönderecekti, yine tahmin ettiğiniz gibi silinmiş satırlar için ise DeleteCommand özelliği aranacaktı.

       Bu yazı işin tekniği konusunda sizi en azından bir temel bilgi vermiştir umarım. Yakında bu konularda daha derin bilgiler vermeyi düşünüyorum.

30 Ağustos 2013 Cuma

An absolutely brilliant analogy as to why software development task estimations are regularly off by a factor of 2-3

 

Let's take a hike on the coast from San Francisco to Los Angeles to visit our friends in Newport Beach. I'll whip out my map and draw our route down the coast:




The line is about 400 miles long; we can walk 4 miles per hour for 10 hours per day, so we'll be there in 10 days. We call our friends and book dinner for next Sunday night, when we will roll in triumphantly at 6 p.m. They can't wait!

We get up early the next day giddy with the excitement of fresh adventure.  We strap on our backpacks, whip out our map, and plan our first day. We look at the map. Uh oh:




Wow, there are a million little twists and turns on this coast. A 40-mile day will barely get us past Half Moon Bay. This trip is at least 500, not 400 miles.  We call our friends and push back dinner til Tuesday. It is best to be realistic. They are disappointed, but they are looking forward to seeing us. And 12 days from SF to LA still is not bad. 

With that unpleasantness out of the way, we head off. Two hours later, we are barely past the zoo. What gives? We look down the trail:




Man, this is slow going! Sand, water, stairs, creeks, angry sea lions! We are walking at most 2 miles per hour, half as fast as we wanted. We can either start walking 20 hours per day, or we can push our friends out another week.  OK, let's split the difference: we'll walk 12 hours per day and push our friends out til the following weekend. We call them and delay dinner until the following Sunday. They are a little peeved but say OK, we'll see you then.

We pitch camp in Moss Beach after a tough 12 hour day. Shit, it takes forever to get these tents up in the wind. We don't go to bed until midnight. Not a big deal: we'll iron things out and increase velocity tomorrow.

We oversleep and wake up sore and exhausted at 10 a.m. Fuck! No way we are getting our 12 hours in. We'll aim for 10, then we can do 14 tomorrow. We grab our stuff and go.

After a slow slog for a couple of hours, I notice my friend limping. Oh shit, blisters. We need to fix this now... we are the kind of team who nips problems in the bud before they slow our velocity. I jog 45 minutes, 3 miles inland to Pescadero, grab some band-aids, and race back to patch up my friend. I'm exhausted, and the sun is going down, so we bail for the day. We go to bed after only covering 6 miles for the day. But we do have fresh supplies. We'll be fine. We'll make up the difference tomorrow.

We get up the next morning, bandage up our feet and get going. We turn a corner. Shit! What's this?




Goddamn map doesn't show this shit!  We have to walk 3 miles inland, around some fenced-off, federally-protected land, get lost twice, then make it back to the coast around noon. Most of the day gone for one mile of progress. OK, we are *not* calling our friends to push back again. We walk until midnight to try to catch up and get back on schedule.

After a fitful night of sleep in the fog, my friend wakes up in the morning with a raging headache and fever. I ask him if he can rally. "What do you think, asshole, I've been walking in freezing fog for 3 days without a break!" OK, today is a loss. Let's hunker down and recover. Tomorrow we'll ramp up to 14 hours per day since we'll be rested and trained... it is only a few more days, so we can do it!

We wake up the next morning groggy. I look at our map:




Holy shit! We are starting day 5 of a 10 day trip and haven't even left the Bay Area! This is ludicrous! Let's do the work to make an accurate estimate, call our friends, probably get yelled at, but get a realistic target once and for all.

My friend says, well, we've gone 40 miles in 4 days, it is at least a 600 mile trip, so that's 60 days, probably 70 to be safe. I say, "no f--ing way... yes, I've never done this walk before, but I *know* it does not take 70 days to walk from San Francisco to Los Angeles. Our friends are going to laugh at us if we call and tell them we won't see them until Easter! 

I continue, "if you can commit to walking 16 hours a day, we can make up the difference! It will be hard, but this is crunch time. Suck it up!" My friend yells back, "I'm not the one who told our friends we'd make it by Sunday in the first place! You're killing me because you made a mistake!"

A tense silence falls between us. The phone call goes unmade. I'll call tomorrow once my comrade regains his senses and is willing to commit to something reasonable.

The next morning, we stay in our tents till a rainstorm blows over. We pack our stuff and shuffle off at 10 a.m. nursing sore muscles and new blisters. The previous night's fight goes unmentioned, although I snap at my idiot friend when he leaves his water bottle behind, and we have to waste 30 minutes going back to get it.

I make a mental note that we are out of toilet paper and need to stock up when we hit the next town. We turn the corner: a raging river is blocking our path. I feel a massive bout of diarrhea coming on...

29 Ağustos 2013 Perşembe

Introducing the Google Chrome OS

Official Blog


Posted:
It's been an exciting nine months since we launched the Google Chrome browser. Already, over 30 million people use it regularly. We designed Google Chrome for people who live on the web — searching for information, checking email, catching up on the news, shopping or just staying in touch with friends. However, the operating systems that browsers run on were designed in an era where there was no web. So today, we're announcing a new project that's a natural extension of Google Chrome — the Google Chrome Operating System. It's our attempt to re-think what operating systems should be.

Google Chrome OS is an open source, lightweight operating system that will initially be targeted at netbooks. Later this year we will open-source its code, and netbooks running Google Chrome OS will be available for consumers in the second half of 2010. Because we're already talking to partners about the project, and we'll soon be working with the open source community, we wanted to share our vision now so everyone understands what we are trying to achieve.

Speed, simplicity and security are the key aspects of Google Chrome OS. We're designing the OS to be fast and lightweight, to start up and get you onto the web in a few seconds. The user interface is minimal to stay out of your way, and most of the user experience takes place on the web. And as we did for the Google Chrome browser, we are going back to the basics and completely redesigning the underlying security architecture of the OS so that users don't have to deal with viruses, malware and security updates. It should just work.

Google Chrome OS will run on both x86 as well as ARM chips and we are working with multiple OEMs to bring a number of netbooks to market next year. The software architecture is simple — Google Chrome running within a new windowing system on top of a Linux kernel. For application developers, the web is the platform. All web-based applications will automatically work and new applications can be written using your favorite web technologies. And of course, these apps will run not only on Google Chrome OS, but on any standards-based browser on Windows, Mac and Linux thereby giving developers the largest user base of any platform.

Google Chrome OS is a new project, separate from Android. Android was designed from the beginning to work across a variety of devices from phones to set-top boxes to netbooks. Google Chrome OS is being created for people who spend most of their time on the web, and is being designed to power computers ranging from small netbooks to full-size desktop systems. While there are areas where Google Chrome OS and Android overlap, we believe choice will drive innovation for the benefit of everyone, including Google.

We hear a lot from our users and their message is clear — computers need to get better. People want to get to their email instantly, without wasting time waiting for their computers to boot and browsers to start up. They want their computers to always run as fast as when they first bought them. They want their data to be accessible to them wherever they are and not have to worry about losing their computer or forgetting to back up files. Even more importantly, they don't want to spend hours configuring their computers to work with every new piece of hardware, or have to worry about constant software updates. And any time our users have a better computing experience, Google benefits as well by having happier users who are more likely to spend time on the Internet.

We have a lot of work to do, and we're definitely going to need a lot of help from the open source community to accomplish this vision. We're excited for what's to come and we hope you are too. Stay tuned for more updates in the fall and have a great summer.

Update on 7/8/2009: We have posted an FAQ on the Google Chrome Blog.

"The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying." John Carmack

Breaking down Amazon’s mega dropdown

Breaking down Amazon’s mega dropdown

The hover effects on Amazon’s big ‘ole “Shop by Department” mega dropdown are super fast. Look’it how quick each submenu fills in as your mouse moves down the list:

image

It’s instant. I got nerd sniped by this. Most dropdown menus have to include a bit of a delay when activating submenus. Here’s an old Khan Academy dropdown as an example:

image

See the delay? You need that, because otherwise when you try to move your mouse from the main menu to the submenu, the submenu will disappear out from under you like some sort of sick, unwinnable game of whack-a-mole. Enjoy this example from bootstrap’s dropdown menus:

image
I love bootstrap, don’t get it twisted. Just a good example of submenu frustration.

 

How did Amazon get away without using a delay?

 

It’s easy to move the cursor from Amazon’s main dropdown to its submenus. You won’t run into the bootstrap bug. They get away with this by detecting the direction of the cursor’s path.

image
If the cursor moves into the blue triangle the currently displayed submenu will stay open for just a bit longer.

At every position of the cursor you can picture a triangle between the current mouse position and the upper and lower right corners of the dropdown menu. If the next mouse position is within that triangle, the user is probably moving their cursor into the currently displayed submenu. Amazon uses this for a nice effect. As long as the cursor stays within that blue triangle the current submenu will stay open. It doesn’t matter if the cursor hovers over “Appstore for Android” momentarily — the user is probably heading toward “Learn more about Cloud Drive.”

And if the cursor goes outside of the blue triangle, they instantly switch the submenu, giving it a really responsive feel.

So if you’re as geeky as me and think something this trivial is cool, I made a jQuery plugin that fires events when detecting this sort of directional menu aiming: jQuery-menu-aim. We’re using it in the new Khan Academy “Learn” menu:

image

I think it feels snappy. I’m not ashamed to copy Amazon. I’m sure this problem was solved years and years ago, forgotten, rediscovered, solved again, forgotten, rediscovered, solved again.

If anyone else on the planet ends up finding a use for jQuery-menu-aim, I’d be grateful to know what you think.

Official Blog: A new approach to China: Asia, free expression, policy and issues, privacy, security

A new approach to China


Posted: Tuesday, January 12, 2010
Like many other well-known organizations, we face cyber attacks of varying degrees on a regular basis. In mid-December, we detected a highly sophisticated and targeted attack on our corporate infrastructure originating from China that resulted in the theft of intellectual property from Google. However, it soon became clear that what at first appeared to be solely a security incident--albeit a significant one--was something quite different.
First, this attack was not just on Google. As part of our investigation we have discovered that at least twenty other large companies from a wide range of businesses--including the Internet, finance, technology, media and chemical sectors--have been similarly targeted. We are currently in the process of notifying those companies, and we are also working with the relevant U.S. authorities.
Second, we have evidence to suggest that a primary goal of the attackers was accessing the Gmail accounts of Chinese human rights activists. Based on our investigation to date we believe their attack did not achieve that objective. Only two Gmail accounts appear to have been accessed, and that activity was limited to account information (such as the date the account was created) and subject line, rather than the content of emails themselves.
Third, as part of this investigation but independent of the attack on Google, we have discovered that the accounts of dozens of U.S.-, China- and Europe-based Gmail users who are advocates of human rights in China appear to have been routinely accessed by third parties. These accounts have not been accessed through any security breach at Google, but most likely via phishing scams or malware placed on the users' computers.
We have already used information gained from this attack to make infrastructure and architectural improvements that enhance security for Google and for our users. In terms of individual users, we would advise people to deploy reputable anti-virus and anti-spyware programs on their computers, to install patches for their operating systems and to update their web browsers. Always be cautious when clicking on links appearing in instant messages and emails, or when asked to share personal information like passwords online. You can read more here about our cyber-security recommendations. People wanting to learn more about these kinds of attacks can read this Report to Congress (PDF)by the U.S.-China Economic and Security Review Commission (see p. 163-), as well as a related analysis (PDF)prepared for the Commission, Nart Villeneuve's blog and this presentation on the GhostNet spying incident.
We have taken the unusual step of sharing information about these attacks with a broad audience not just because of the security and human rights implications of what we have unearthed, but also because this information goes to the heart of a much bigger global debate about freedom of speech. In the last two decades, China's economic reform programs and its citizens' entrepreneurial flair have lifted hundreds of millions of Chinese people out of poverty. Indeed, this great nation is at the heart of much economic progress and development in the world today.
We launched Google.cn in January 2006 in the belief that the benefits of increased access to information for people in China and a more open Internet outweighed our discomfort in agreeing to censor some results. At the time we made clear that "we will carefully monitor conditions in China, including new laws and other restrictions on our services. If we determine that we are unable to achieve the objectives outlined we will not hesitate to reconsider our approach to China."
These attacks and the surveillance they have uncovered--combined with the attempts over the past year to further limit free speech on the web--have led us to conclude that we should review the feasibility of our business operations in China. We have decided we are no longer willing to continue censoring our results on Google.cn, and so over the next few weeks we will be discussing with the Chinese government the basis on which we could operate an unfiltered search engine within the law, if at all. We recognize that this may well mean having to shut down Google.cn, and potentially our offices in China.
The decision to review our business operations in China has been incredibly hard, and we know that it will have potentially far-reaching consequences. We want to make clear that this move was driven by our executives in the United States, without the knowledge or involvement of our employees in China who have worked incredibly hard to make Google.cn the success it is today. We are committed to working responsibly to resolve the very difficult issues raised.
Update: Added a link to another referenced report in paragraph 5.

Posted by David Drummond, SVP, Corporate Development and Chief Legal Officer

Open Data Structures

 

Sayfa : http://opendatastructures.org/

 

Reddit yorumları : http://www.reddit.com/r/compsci/comments/te9ux/a_professor_of_mine_sick_of_students_paying_way/

 

Açık Kaynak kodlu bir veri yapıları kitabı.Java ve C++ kodları da mevcut.