2016 Olympics - The Outcome and Reactions.

 

Rank Medal Count Total
1 United States 46 37 38 121
2 Great Britain 27 23 17 67
3 China 26 18 26 70
4 Russia 19 18 19 56
5 Germany 17 10 15 42
  India 0 1 1 2

 

Congrats to Silver and Bronze Winners.

But one questions asked by everyone, Why just 2 medals ? and No Gold Medal ?

Olympic level sports person are not built overnight, it is a continuous process and requires time and effort. Sports bodies are expected to identify the right talent, at the right age, support and train them to Olympic level. Unfortunately, our sports bodies are not able to do this.

As per the survey 92% citizens believe funds misuse and corruption is common in State Sports Departments and Bodies. The politicisation of Indian sports is the root cause for the country not being able to create world class athletes.

Source:

https://www.quora.com/Why-cant-Indians-win-more-Olympic-medals

The allegations and denial.

http://www.mensxp.com/special-features/today/31996-indian-officials-at-rio-failed-to-provide-even-water-to-marathon-runner-who-eventually-fainted-at-the-finish-line.html

http://indiatoday.intoday.in/olympics2016/story/athletics-federation-of-india-op-jaisha-rio-olympics-2016/1/746475.html

Some athletes and coaches say chief medical officer Pawandeep Singh's standard response to most complaints of injuries has been a dose of Combiflam.

http://indianexpress.com/sports/rio-2016-olympics/conflict-of-interest-whiff-around-indian-medical-team-in-rio-pawandeep-singh-vinesh-phogat-injury-2982431/

 

There are interesting recommendations here of how sports can be improved.

http://businesswireindia.com/news/news-details/citizens-demand-reforms-sports-bodies-departments-better-performance-next-olympics/49817

 

 

 

 

Think you can be next fresh face ? - OPPO Fresh Face 2016 Event.

OPPO, is sponsoring Times Fresh Face 2016, a platform for younger generation to showcase their talent to the world.  OPPO is giving consumers an opportunity to discover the ‘selfie star’ in them as the theme this year is “Selfie”.  With “Selfie” being the theme, the participants across cities will be able to experience OPPO’s latest camera phones in selfie booths at on site venues. Candidates would be required to take selfies by the recently launched OPPO F1s which would be judged by the jury.  Auditions will be conducted in phases across 11 cities in India, covering about 180 colleges and 11 malls.

Interested ?  Then note the schedule and visit https://timesfreshface.com/ for registration.

Schedule

Mumbai

Delhi

Kolkata

Chennai

Pune

Launch  Date (Promotion start date)

12-Nov

17-Aug

10-Aug

27-Aug

20-Aug

Start of auditions

14-Nov

22 Aug - 10 Sept

16-Aug

1-Sep

22-Aug

End of auditions

26-Nov

3-Sep

27-Aug

25-Sep

3-Sep

Date for semi finals

2-Dec

27-28 Sept

13-Sep

9-Oct

16-Sep

Date for Finals

24-Dec

22-Oct

1-Oct

29-Oct

25-Sep

 

 

Schedule

Bangalore

Hyderabad

Ahmedabad

Lucknow

Chandigarh

Nagpur

Launch  Date (Promotion start date)

1-Sep

12-Aug

17-Sep

3-Sep

10-Sep

16-Aug

Start of auditions

7-Sep

22-Aug

19-Sep

7-Sep

14-Sep

19-Aug

End of auditions

30-Sep

31-Aug

1-Oct

22-Sep

29-Sep

27-Aug

Date for semi finals

9-Oct

17-Sep

14-Oct

20-Oct

26-Oct

3-Sep

Date for Finals

23-Oct

30-Sep

6-Nov

13-Nov

20-Nov

30-Sep

India new law, Visiting Torrent Website, may land you in jain for 3 yrs and/or 3 lakh fine.

The government of India wants to punish people who even visit a blocked URL.   A new directive on the blocked websites says that the user will be fined up to 3,00,000 and will be imprisoned for 3 years under 1957 Copyright act.

It is for even viewing these websites where the content is hosted. So even if you are accessing any legal material through these websites, you'd be in trouble.

As usual and not to be surprized, the language of the warning is vague without any proper guidelines or announcement done by either Department of Telecommunications or the Government of India. According to the warning ‘viewing’, ‘downloading’, ‘exhibiting’ or ‘duplicating’ ‘an illicit copy of content under this URL’ is deemed as a punishable offence.

This puts a question in my mind, Downloading content like movies, How is that any different from borrowing a DVD from a friend ?  except in this case its online.

Source:
http://timesofindia.indiatimes.com/tech/tech-news/You-may-face-3-years-jail-term-for-viewing-Torrent-website-in-India/articleshow/53805885.cms

 

The Message that appears on blocked sites.

"This URL has been blocked under the instructions of the Competent Government Authority or in compliance with the orders of a Court of competent jurisdiction. Viewing, downloading, exhibiting or duplicating an illicit copy of the contents of this URL is punishable as an offense under the laws of India, including but not limited to under Sections 63, 63-A, 65 and 65-A of the Copyright Act, 1957 which prescribe imprisonment for 3 years and also fine of up to Rs. 3,00,000/-. Any person aggrieved by any such blocking of this URL may contact at urlblock@tatacommunications.com who will, within 48 hours, provide you the details of relevant proceedings under which you can approach the relevant High Court or Authority for redressal of your grievance".

 

There was mix reactions as many users welcome the move, but majority, including me where not happy with such laws that is very harsh.  Also it was not clear what was the role of Tatacommunications in it.

Good news is that someone did more investigation on the issue and it appears you may not go to jail for visiting a blocked site. Here is what he wants to say about it.

http://gadgets.ndtv.com/internet/news/no-you-wont-go-to-jail-for-just-visiting-a-blocked-website-875479

 

 

 

A Possible discovery of fifth force of nature.

Electromagnetism, gravity, strong nuclear force and weak nuclear force are the four known fundamental forces.

While doing experiments in searching for “dark photons,” particles that would signify unseen dark matter, they uncovered an anomaly that hinted at the existence of a light particle that was 30 times heavier than an electron.

“The experimentalists weren’t able to claim that it was a new force. “They simply saw an excess of events that indicated a new particle, but it was not clear to them whether it was a matter particle or a force-carrying particle.”

If confirmed by further experiments, this discovery of a possible fifth force would completely change our understanding of the universe and Standard Model of physics could be due a major revision.

Source :

http://www.cnet.com/news/science-may-have-found-a-fifth-force-of-nature-to-tie-together-the-loose-ends-of-the-universe/

https://en.wikipedia.org/wiki/Fifth_force

ManageEngine Enters 2016 Gartner Magic Quadrant for SIEM as the Only New Entrant‏

ManageEngine, the real-time IT management company, today announced that it has been positioned by Gartner, Inc. for its log management and SIEM solution, Log360, in the 2016 Gartner Magic Quadrant for Security Information and Event Management. The company is the only new addition to the Gartner Magic Quadrant for SIEM.

Log360 is the one-stop solution for all log management and network security challenges. This solution offers real-time log collection, analysis, monitoring, correlating and archiving capabilities that help in protecting confidential data, thwarting internal security threats and combating external attacks. To help meet the most needed security, auditing and compliance demands, the solution comes packaged with 1,000+ predefined reports and alert criteria. For more information on Log360, visit  https://www.manageengine.com/log-management .

Airtel announces 4G offer for Samsung Galaxy J series users‏

Bharti Airtel, today announced that customers purchasing Samsung Galaxy J series mobile device, can enjoy 10 GB Airtel 4G data at the price of 1GB 4G data. 

Available with most of the Samsung Galaxy J series devices, under the offer, new and existing Airtel prepaid users can avail 10GB of 4G data at a nominal cost of Rs. 250. To claim the offer, customers will simply have log on to www.offers.airtel.com from their new Samsung J series devices using Airtel mobile internet (not Wi-fi) and follow instructions. Users can also visit their nearest Airtel Retail outlets to upgrade to Airtel 4G and activate the offer. 

Commenting on the newly launched offer, Mr. Ajai Puri, Director – Market Operations, Bharti Airtel, said, “We are delighted to extend our association with the popular Samsung J series. We believe this partnership will help customers enjoy best-in-class smartphone experience on Airtel’s 4G network.”  

Airtel had previously introduced bundled Double Data offerings with top industry players like Apple, Xiaomi, Micromax, Intex and Lava as well. Users can visit www.airtel.in/handset-offers to avail active offers. 

*For non 4G markets– Samsung Galaxy J device users can avail 10GB 3G Airtel Data @ Rs. 250 (1GB 3G data + 9 GB night 3G data)  

Accenture Opens Cyber Center to Help Organizations Tackle Complex Security Challenges

Global professional services company Accenture on Thursday said it opened a cyber centre here to expand its global security presence and help organisations tackle complex security challenges.

 

 

Source:

http://articles.economictimes.indiatimes.com/2016-04-21/news/72508633_1_cyber-security-challenges-security-solution-new-centre

 

 

4 Techniques to update databases thru datasets when joins are involved.

Introduction
The DataAdapter provides a set of methods and properties to retrieve and save data between a DataSet and its source data store. Frequently people have asked me I am getting the following error : Dynamic SQL generation is not supported against multiple base table. How we can use data adaptor  to update database when queries are based on joins. So I spent some time to write this article. 

Some of them say its not possible, well they are partially right , meaning there is no ready made way to do so, but one who knows how DataAdapter  works then he can figure out ways of doing so.  If you look at object model of ADO.NET you will find DataAdapter contains 4 properties UpdateCommand, DeleteCommand, InsertCommand and SelectCommand. The Fill method of the DataAdapter calls the SELECT command while Update method calls INSERT, UPDATE or DELETE command for each changed row. One of the great features about the DataAdapter object is that these co    mmands can be set explicitly at runtime using CommandBuilder object, alternatively you can explicitly providing the INSERT, UPDATE, and DELETE commands at design time.

Coming back to original question,  here I will show you 4 different way to achieve the results and will understand pros and corns of each 

  1. Before we start Create Table in SQL database and insert few records 
CREATE TABLE [dbo].[Dept] (
[DeptNo] [numeric](18, 0) NOT NULL ,
[Dname] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Location] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL 
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[Emp] (
[Empno] [numeric](18, 0) NOT NULL ,
[Ename] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Salary] [numeric](18, 0) NULL ,
[Deptno] [numeric](18, 0) NULL 
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Dept] WITH NOCHECK ADD 
CONSTRAINT [PK_Dept] PRIMARY KEY CLUSTERED 
(
[DeptNo]
) ON [PRIMARY] 
GO
ALTER TABLE [dbo].[Emp] WITH NOCHECK ADD 
CONSTRAINT [PK_Emp] PRIMARY KEY CLUSTERED 
(
[Empno]
) ON [PRIMARY] 
GO

 

  1. Create a new windows application and Insert DataGrid with two buttons "Fill" and "Update" 

Method#1 Setting Relations: Drag and drop SQLDataAdaptor1 object and select EMP during wizard. Drag and drop SQLDataAdaptor2 and select Dept table during wizard.  From property window of both SQLDataAdaptor1 and 2,  Click on "Generate DataSet" to create typed dataset. Bring both table's data from database into dataset by calling both DadaAdaptor's Fill and then set a relation between them using DataSet's Relation.Add Method, bind the datatable DEPT to datagrid using datagrid's datasource property. (MyDataSet1.Dept ). When relation is set in dataset between two tables and if the grid is bind with parent table , datagrid is smart enough to display in a parent-child relation. 

Private Sub btnFill_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFill.Click
Me.SqlDataAdapter1.Fill(Me.MyDataSet1)
Me.SqlDataAdapter2.Fill(Me.MyDataSet1)
Me.MyDataSet1.Relations.Add(Me.MyDataSet1.Dept.DeptNoColumn, Me.MyDataSet1.Emp.DeptnoColumn)
End Sub

 

Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
Me.SqlDataAdapter1.Update(Me.MyDataSet1)
Me.SqlDataAdapter2.Update(Me.MyDataSet1)
End Sub

 

This technique allows you to  update both tables , but if you wish to display data from both tables in one single view, you can't, you guess right in all situations this is not what you desire.

 

  

 

 

So lets write a join query 

Method #2. Specifying own UpdateCommand.  Create a new Windows Form Drag and drop DataAdaptor , in wizard write following query  

SELECT Emp.Empno, Emp.Ename, Emp.Salary, Dept.DeptNo, Dept.Dname, Dept.Location  FROM Dept INNER JOIN Emp ON Dept.DeptNo = Emp.Deptno

At the end wizard you will get error messages that it could not create appropriate statements for update, delete and insert. this is obvious as you are using joins in the query. Select "Finish". Select DataAdaptor and in TableMapping Properties change dataset table name to "Dept_Emp". From property window select "Generate DataSet" 

From DataAdaptor's property window click UpdateCommand and select "New" to create new UpdateCommand object. select commandText property and write your own statement as below 

(If SQLDataAdaptor then ) UPDATE Emp  SET Ename = @p1, Salary = @p2, Deptno = @p3 WHERE (Empno = @p4)
(If OLEDBDataAdaptor then ) UPDATE Emp SET Ename = ?, Salary = ?, Deptno = ? WHERE (Empno = ?)

Before selecting "OK" check "Regenerate parameters collection for this command" and you are almost through. don't forget to set  connection object.(SQLConnection1 in our case) in Connection property of UpdateCommand.  Drag and drop datagrid object and set DataSource to "Dept_Emp" table.

This technique will allow you to be able to update any one underlying table. on similar lines you can write your own Delete and Insert commands. this technique is efficient and in most situations you will prefer. 

 

 

 

 

lets get on with something more, in some situations you would like to update more then one table.  like during my .NET training one had asked me that my application requires to record changes made to tables into "Audit Tables". Well at very first I would suggest to use triggers for such situations, still if you want more control over UpdateCommand then ..

Method #3 Playing with DataAdaptor events.

RowUpdating : This event is raised before a DML (Insert,Update,Delete) operation is to take place on a particular row. The RowUpdating event can be used for to gain additional control on the update operation like retaining old values before the changes are being made,cancel a particular update based on certain business logic
RowUpdated : This event is raised after a DML operation on a particular row is complete. The RowUpdated event can be used to respond to errors and exceptions that occur, have a retry logic and so on.
FillError : This event is raised when an error occurs during a FILL operation. In case of a FillError , the row that caused it is not added to the DataTable. Hence this event can be used to resolve that error and add it to the DataTable or exclude it and continue the Fill operation

For more details you should go through this URL (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaddingremovingadonetproviderevents.asp

Continuing in the same code of  Method#2, create a handler for event RowUpdating and insert following. I am not doing any thing sensible here but this is just to give you an idea how you can make your things work. I am checking if the user has done any changes to Field2 (i.e Dname), by finding if there is difference between original and current value, if found I am creating a new command object to fire update statement on Dept table using same connection object

Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
Try
Me
.SqlConnection1.Open()
Me.SqlDataAdapter1.Update(Me.MyDataSet1)
Me.SqlConnection1.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
MsgBox("Update Success")
End
Sub

Private Sub SqlDataAdapter1_RowUpdating(ByVal sender As Object, ByVal e As System.Data.SqlClient.SqlRowUpdatingEventArgs) Handles SqlDataAdapter1.RowUpdating

If e.Row.Item(1, DataRowVersion.Current) <> e.Row.Item(1, DataRowVersion.Original) Then
Dim
x As New SqlClient.SqlCommand("Update Dept set dname=@p1 where Deptno=@p2")
x.Parameters.Clear()
x.Parameters.Add("@p1", e.Row.Item(1))
x.Parameters.Add("@p2", e.Row.Item(0))
x.Connection = e.Command.Connection
x.ExecuteNonQuery()
' e.Status = UpdateStatus.SkipCurrentRow

End If
End
Sub

Based on your business logic if you wish not to update any particular record but continue updating the rest then uncomment the above line in green. (*Remember: this is not going to do UNDO the updates made to DEPT table). 

I did changes in ename of Record1 and Dname and Ename of record 2 when you click update ename of record2 will not change where as rest changes will be applied. 

 

 

This technique is less efficient then Method#4(The Ultimate Way-Stored Procedure), as you are increasing lots of trip to the server, but really useful when the underlying database does not support stored procedure

Method #4. The Ultimate Way-Using Stored Procedure: This is what I will prefer, to take best advantage of available facility. also sometimes we want to avoid using SQL DML statements directly in our code for security reasons. Create a new WindowsForm with DataGrid and 2 Buttons (Fill and update). Drag DataAdaptor, in wizard select "Create New Stored Procedure" , Select one table and click next you will see the screen like below. 

based on the select statement wizard will create four stored procedures. but again here if your query is based on joins wizard will not be able to create stored procedures  

so what we will do is go to back step and choose select  from existing stored procedure. but before that lets create a simple stored procedure as shown below.

 

 

 

 

 

 

 

 

CREATE PROCEDURE [EMPUpdateCommand]
(
@Original_Empno numeric(18),
@Ename char(10),
@Salary numeric(18),
@Original_Deptno numeric(18),
@Dname char(10),
@Location char(10)
)
AS
SET NOCOUNT OFF;
UPDATE dbo.Emp SET Ename = @Ename, Salary = @Salary, Deptno = @Original_Deptno WHERE (Empno = @Original_Empno);
Update dbo.Dept Set Dname=@Dname , location=@location where deptno=@original_deptNo;
GO

  1. Drag and drop SQL DataAdaptor
  2. Select Connection
  3. Select "Use Existing Stored Procedure"
  4. Select Right procedures as seen in screen shot.

Complete all step to "Finish" and Wow! we are through, fill in code for events of two buttons (Fill and Update as below)

 

Private Sub btnFill_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFill.Click
Me.SqlDataAdapter1.Fill(Me.MyDataSet1)
End
Sub

 

Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
Me.SqlDataAdapter1.Update(Me.MyDataSet1)
End
Sub

Run the code make some changes and click on update. 

Hurray!. 

Conclusion

Stored procedures offer developers a lot of flexibility with many features not available using standard SQL. ADO.NET's DataAdaptor allows us to use stored procedures seamlessly. The combination of these two allows us to create very powerful applications rapidly.

That's it folks, I believe this article will clear your doubts and gives sufficient hits to accomplish your tasks. and with that I too get back with my task (2.00am Time to Sleep)

if you have any queries regarding article use my forum to post your questions or if you find some typographical error mail me at blogs@jigneshdesai.com