I am having this piece of code, which in my opinion is fairly ugly and I am wondering how it can be done better:
if dict.get(key, None) is None:
dict[key] = None
Points for elegance ;-)
I have spinner in my application .The spinner have drop down list.I want to take the value of the dropdown list from the database .how can i do this ?
here is my code for spinner with dropdownlist:
ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, selectdefault);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
my code-
<?php
session_start();
$_SESSION['errors']="failed";
?>
<head>
function myfunc()
{
alert(<?php echo $_SESSION['errors']; ?>);
}
</head>
<body onload="myfunc();">
but alert msg is not popping up.
I'm using the 3.5 library for microsoft code contracts
public object RetrieveById(int Id)
{
Contract.Ensures(newObject != null, "object must not be null");
return newProject;
//No error message if I move the Contract.Ensures to here
//But it isn't asserting/throwing a contract exception here either
}
I get the compiler message:
"Error 18 Contract section within try block in method 'Controller.RetrieveById(System.Int32)'
Possible Duplicate:
A puzzle - a program printing its own source
In your favorite programming language, write a program that, when run, will print out its own source code!
Sounds interesting, now let's go!
ps: Literally, there is "NO" use case for this, just plain curiosity!
I am developing a vb.net application in SQL server 2005 ,now i would like to import MS access database tables from a network into sql server 2005 database, using stored procedure or vb.net code without using SQL server 2005 Wizard . please find a sollution thanks a lot.
I'm using subeclipse plugin for eclipse for SVN. My project looks like this :
ProjectName\
- branches
- special_
- tags
- trunk
I have currently checked out project from special_ and I've modified and added one class, how can I merge the code which I updated/added to trunk ? I'll take anything into consideration
Hi,
i have the following form item
{
fieldLabel:'Username'
,id:"username"
,name:'username'
,allowBlank:false
,plugins:[Ext.ux.plugins.RemoteValidator]
,rvOptions: {
url:'/registration/member/valid-username'
}
is it possible to remove plugins later via code?
I must do a automatic codes generator with user-configurable string with predefined keys and can not find a good way to do it.
For example, a string
OT-{CustomCode}-{Date}-{##}
could generate codes
OT-C0001-20100420-01
OT-C0001-20100420-02
I thought of using RegExpr.Replace(), but I would have problems if the code of a customer was {##}
Any help is welcome! (and sorry for my english)
Is there any way to round numbers in C?
I do not want to use ceil and floor. Is there any other alternative?
I came across this code snippet when I Googled for the answer:
(int)(num < 0 ? (num - 0.5) : (num + 0.5))
The above line always prints the value as 4 even when float num =4.9.
Please suggest a solution.
Hey all,
I am looking to render ribbon diagrams of proteins using OpenGL and C++. Does anyone know if any open source code for this already exists, or if there are good guides to do this? If not, I'd prefer to figure it out myself ;) but I didn't want to reinvent the wheel, especially if the wheel was free.
I'm looking for a light, free tool to format my Vbscript code.
The only way I've found so far is to auto-format it in VisualStudio. Although, it's too much to launch VisualStudio for this purpose.
Is there any web app or a free light tool for this purpose? Maybe a plugin for Notepad++?
Can someone explain how to code the feedback button seen on foursquare.com? It's a vertical button on the side of the webpage and it opens a new window and dims out the background. I've seen this on some other sites as well. Thanks in advance.
Hi,
i have a wcf service which runs perfectly on my dev machine (vs2010, target 3.5) but once deployed, it shows me the code behind of the service (actually the plain text of the .svc file) and not the normal service page:
<%@ ServiceHost Language="C#" Debug="true" Service="SilverlightPoc.Web.FinanceData" CodeBehind="FinanceData.svc.cs" %>
Anyone any idea why the .svc file is rendered as plain text and not as wcf service?
I have tried this
login_div.Style("display") = "none";
But it's not working.how can I set the display of the div to none through code behind,
in aspx I have a div:
<div id="login_div" runat="server">
Given that state information is implicit in the zip code aren't storing both of them some violaiton of third normal form? Can or should you simply combine them into one field?
I am looking for c++ code coverage tool which fares well in mutli server setup and on both windows and linux without licensing issues(if non free).
I have done some research and found 2 free tools: Covtool and gcov. Any disadvantages on these or any other suggestions?
I am not familiar with javascript and I have had some exposure to java but I found a web application that fits the goals of my app perfectly. The owner has provided the source by viewing the source in the html and I was wondering how hard it would be to reuse the code to deploy a similar app.
I want show an information page after success db opartions. And after the info I want to close each pages (information page and main page)
I wrote this in button oncommand event:
//but this code does not work
Response.Write("<script language='javascript'>setTimeout('self.close();',3000);</script>");
at the same time, I want to show an information message. And then I want to close all, after three seconds.I hope I could explain :)
Thanks.
I have an HTML table which may contain thousands of rows (number of columns is not a problem here).
I would like to be able to browse this table easily and be able to do the following:
Decide how many rows will be presented
Jump to the next/previous X number of rows
Scroll the table using the scroll bars to any desired line
Be able to customize/extend easily this Javascript/jQuery code
Has anyone seen something similar ?
Thank you very much !
Hello there,
I have a C code created in Plato3. I want to create an exe file so I can share it with others.
Can someone please tell me how is this possible ?
I have tried sending the exe file that is created when normally compiled, but it crashes every time in runs on computers other than mine ...
Please help,
Thanks :)