Programmers Stackoverflow Off-topic Moderation

The programmers.stackoverflow Faq talks about this

What kind of questions can I ask here?

Programmers — Stack Exchange is a site for professional programmers who are interested in getting expert answers on conceptual questions about software development. If you have a question about…

    algorithm and data structure concepts
    design patterns
    developer testing
    development methodologies
    freelancing and business concerns
    quality assurance
    software architecture
    software engineering
    software licensing

and it is not about…

    career advice, including general workplace issues1
    personal lifestyle, including relationships, office politics, and non-programming activities
    what language you should learn next, including which technology is better1
    salary or compensation1
    résumé help1
    what project you should do next1
    programming tools (ask on Stack Overflow instead)

…then you're in the right place to ask your question!

Ok My question was closed as off topic and I agree it fail the above. The question is are there other question which are not closed as off-topic but failed the test? You decide.

1. Explain to a non-technical manager that the tool he chose isn’t apt

Accepted Answer :

down vote accepted

Simply send an e-mail to the tech support of the product: “How should I do task Y using your tool?”

Maybe you’ll be surprised, maybe your manager…

Hmm, does this question fits to workplace issues or algorithm? The answer talks about which algorithm?

2. Manager keeps changing requirement specification after every demo.

Accepted Answer :

down vote accepted

The short version:

Run.


The somewhat longer version:

If the manager doesn’t know how to run a project, and if the senior goes along with it, then you have next to no chance of fixing things.

In order to manage software projects, a manager does need to understand something about software. If managers don’t, they need to learn first. What are your chances you could persuade your management and your senior(s) that they got it all wrong? What are the chances you will teach them something?

I have been in a similar situation once (only there was no senior). I quit after a terrible year, and never looked back (except in disgust).

Work issue or algorithm, testing, software architecture, quality assurance?

3.How do you explain NP-Completeness/Unsolvability to a non-technical supervisor?

4.How to Deal with an out of touch “Project manager”

5.How do you explain the complexity of bulk emailing to a manager?

These are just a few that I picked. The actual number is of course very large?Can someone point out these questions are of technical nature and valid according to the Faq?

Posted in Uncategorized | Leave a comment

[Solved] Procedure or function xxx has too many arguments specified – ASP.NET

If you are getting this error in your .NET application (AsP.NET for example), it says obvious that you are passing too many parameters to the stored Procedure. However there is a scenario where this error actually makes you look in the wrong direction. Example is below

you have sqldataSource which inserts a customer into the database for example. Let say a customer is renewed and you want to store the ID of the old customer in a field “OLDID”. Now your stored procedure looks like this

InsertCustomer(
@ID int,
@name varchar(25),


@OldID int
)

In ASP.NET When you bind a value to the @OldID parameter, according to the logic you should be actually doing this

<asp/textbox id="txtOldID" text= Text='’

Note that I am updating txtOLDID field through backend programming in C# in page_load function. Now everything looks according to the book. You need to pass @oldID to the stored procedure, there is a field @oldID and you are binding your textbox to that field. But it does not work and instead throughs this exception.

In this case the error is misleading, the fix is rather change the stored procedure.

How to fix this?

Change the stored procedure so that @OldID parameter reads as @ID. Down in the store procedure, use the correct logic where there this ID needs to be inserted. Since we want to use it in place of OLDID, the logic should be follow

insert into customer (OLDID) values(ID)

Now in the ASP.NET application, change the binding to ID field rather than OLDID and everything should work fine. It is rather bizarre error.

this will give you the following error. Everything is according to the book.

Posted in Uncategorized | 1 Comment

How to set automatic bid in Ebay?

To set automatic bid in ebay, login, go to the item you want to bid. Do not enter you bid yet. Click the bids link which show history of the bids. At the right bottom corner, enter your bid in “Your maximum bid” and there you go, you have set your automatic bid. If another bidder goes higher than you, you bid will automatically increase, unless it reaches your highest bid. At that point you will get an email from ebay that your bid had bean beaten. At that point you can increase your maximum bid or bid manually yourself.

Posted in Uncategorized | Leave a comment

System.Data.SqlClient.SqlException: Error converting data type varchar to float.

If you are getting the above .NET error, one reason for this is wrong case statement. Here is an example


create table #table1 (
id int not null primary key identity,
category varchar(10),
amount float null
)

insert into #table1 values(‘A’,23)
insert into #table1 values(‘A’,23)
insert into #table1 values(‘B’,NULL)
insert into #table1 values(‘B’,0)
insert into #table1 values(‘C’,NULL)
insert into #table1 values(‘C’,NULL)
insert into #table1 values(‘D’,0)
insert into #table1 values(‘D’,0)

select * from #table1 — works

select category, sum1 — works
from
(select category, SUM(Round(ISNULL(amount,0),0)) as Sum1 from #table1
group by category) D

select category, sum2 = — does not work
case Sum1
when ‘A’ then Sum1 * 1 — Error converting data type varchar to float
when ‘B’ then Sum1 * 2
when ‘C’ then Sum1 * 3
when ‘D’ then Sum1 * 4
else Sum1
end
from
(select category, SUM(Round(ISNULL(amount,0),0) ) as Sum1 from #table1
group by category) D

 

I get System.Data.SqlClient.SqlException: Error converting data type varchar to float. for this from my C# code when i access the “does not work” query. You can see there is a problem here, the CASE statement is wronglyl written. The correct statement should be


select category, sum2 = -- does not work
case Category -- Fixed the stetement here
when 'A' then Sum1 * 1 -- no error
when 'B' then Sum1 * 2
when 'C' then Sum1 * 3
when 'D' then Sum1 * 4
else Sum1
end
from
(select category, SUM(Round(ISNULL(amount,0),0) ) as Sum1 from #table1
group by category) D

Posted in Uncategorized | Leave a comment

Binding SQLDataSource programmatically can cause error

In one of my project, I came across a formview which which was bound to SQLDataSource. There were 4 procedures inside that SQLDataSource. They were

  • GetCustomer
  • Insert_Customer
  • Delete_Customer
  • Update_Customer

Now the way functionality called renew functionality.  The purpose of renew was to fetch the same record as GetCustomer but instead it fetches it from a different table in a different database. Fortunately all the fields were the same in both stored procedure but what if one SP has different field? Well this actually produces an error.

Assume I am bound my FormView inside codebehind. I used another storedprocedures GetCustomer2 which basically is the same as GetCustomer but it fetches data from different table (it actually is used in a different sense to renew a customer). What happens if I fetch a field that is in GetCustomer2 but not in GetCustomer storedprocedure. It gives an error. Because the comiler tries to find my “new field” in GetCustomer but it is not not there therefore it say, can not find “New Field” in

System.Data.DataRowView’ does not contain a property with the name ‘xxx’.

In this case, I have  include a textbox that captures data from the new field and it should technically work but it does not. The way Microsoft implements thing is quite unflexible and rigid.

To solve this problem, you have to include this “new filed” in GetCustomer Stored Procedure, and if it is not in the table itself, you have to add that field to the table too.

Posted in Uncategorized | Leave a comment

Top 10 Apps for Android that saves you money

There are a lot of Apps available for Android (and iPhone) that actually saves you money. If you were to buy these devices individually, they would cost you money and another inconvenience, you have to carry that with you where ever you go. Android app, most of which are free, some could really save you money. I will not talk about games here but really useful apps that would otherwise cost you money. I would list their dollar amount as well.

GPS Status and Toolbox – $75

GPS is an important device to find your location. You are on the place and you want to find where exactly you are. You are hiking somewhere and you are lost, turn on your GPS and it will tell you where you are. GPS status and toolbox give you the same features (and more) that gives you a cheap handheld GPS. At amazon they are prices at $75-$300. I would make it worth 75$ plus the additional advantage that you dont have to carry an extra gps unit around.

Digital Compass – $15

Digital compasses are ranged $20+ on Amazon and their reviews are
t’ that great. Android phone (and iphone) comes built in with Digital compass but they need a software to read data from them. There are a number of them available. I would just mention my very first app here as well, which also provides direction, East-West-North-South. It is probably more sophisticated that the compass you can get at Amazon. I would price it at $15.

Chess Clock for Android -$20

For some reason chess clocks are expensive. You can can find the cheapest on Amazon.com for $20+. I would certainly would expect cheaper clocks but they are just not available. Well you can download free chess clock on Android Market that works pretty well, just like a chess clock. Their only drawback is…. they are free. Chess Clock for Android is simply awesome. It is free. There is another free one which is good too with larger button, call “Game Clock Deluxe”.

Cardio Trainer (Pedometer) – $15

Cardio Trainer is a work out programme which does more than simply a pedometer. But one of its task is that it measure your step, distance and the entire map of your work out, if you were walking. It is really kool. If such a device was sold by itself, it would probably be worth 50$ or so. Here I have listed it for $15.

Weather Bug (weather forecast) – $15

Weather stations are available in Walmart and at Amazon from $25 and up. They give you max, min and current temperate. They also give you forecast for the city you live in. Weather Bug is App which does exactly that. It give you current temperature, maxiumum tempreture, precepitation (humidity), forecost and even more as it gives you the option to add more city. You can also see rador maps and full forecost for a week + All this in a small App that you can carry with you everywhere you go. This App also give you weather alerts!

MetroFax Mobile (Fax) – $25

Faxes are not free service. You have to get a subscription and pay for it monthly basis. Based on that I am listing this application as Fax Machine. You can send Faxes, you can receive faxes for about $7 a month. Everything is on the go. You take a pick or choose one from your photo and send it. It is that simple. You get a free phone number. You can’t beat it if you need a fax machine. Any time you don’t want it, cancel the subscription and the fax is gone. No need to throw the old fax away (if you were not using it).

Ageo Graphic Calculator (Graphic Calculator) – $10

Graphic calculators are not cheap. They are usually much bigger than your android phone. They are mostly in mono color though. If you want to experiment with lines, sin, tan etc, this will do the job. This is quite limited to what a graphic calculator can do. It does not solve quadratic equation, it works only in one variable. One nice feature is you can draw 3 different graphs and it can generate a table which is nice. Valuing it for $10 for what it is offering. You do get a hang of a graphic calculator though. There is probably not a best App in this area. There is certainly a room to come up with a nice graphic calculator and solver.

Instant Heart Rate

I am listing this for fun. “Instant Heart Rate” give you your heart beat. You put the index finger on the back camera and wait for about 10 sec. You get your heart beat rate. Quite kool.

Variometer ($100)

Variometer is a kool App, $1.41 that lets you track different parameters in your flight. It shows ascend, descent, ground speed, north south, GPS accuracy. While I have not tried it in an Aeroplane, it looks kool and promising. The real Variometer are in $300+ range and they are not even available everywhere.

Stud Finder

This may not work on all phones but when it works, it works. You can locate metal studs in the wall. Note that wooden studs are not detected which is use mostly in the home.

TuneIn Radio (Radio) – $15

If you would like to listen to the radio, your android phone is your radio, you just have to download the App. TuneIn Radio is among the best, while there are a number of them available. Note that in this case you need a wifi connection or a data plane but the advantage is your can listen to radios across the country with no distortion and clear sound. You can easily store them as your favorite channel.

EMF Detector (Ghost Hunting and others ) –

Remote

Posted in Uncategorized | Leave a comment

SQL column with default date and time

The following shows how to specify default datetime field for a field in MSSQL and MYSQL. You do not have to specify it in the query. It is automatically filled when a record is inserted.

MSSQL

In MSSQL the function used to get default date and time is GetDate(), there for this must be used when specifying the default value.

create table test_tbl (
id int not null primary key identity,
test_name varchar(25),
datecreated smalldatetime default  GETDATE()
)

Now insert a value

insert into test_tbl (fname) values (‘test user’)

This will populate the value for datecreated as = 2011-11-07 08:53:00, which is the current date and time.

MYSQL

In my sql, the function used to get current datetime is NOW(). Hence the following query will be used to accomplish the same

create table test_tbl (
id int not null primary key identity,
test_name varchar(25),
datecreated smalldatetime default  NOW()
)

Then insert a value

insert into test_tbl (fname) values (‘test user 2′)

*Note that MYSQL query has not  been test*

Posted in Uncategorized | Leave a comment