SQL 2005 Deadlocks
In an asp.net application that I work on I wrote the data access layer
with try - catch on every call to the database and in the catch phrase i
log any errors that occur. I also write most of the stored procedure code
and all the select statements are using the nolock hint. Some of these
select statements are getting numerous but not always deadlock errors like
the following "Transaction (Process ID 86) was deadlocked on lock
resources with another process and has been chosen as the deadlock victim.
Rerun the transaction." I need to know a process to discover what other
process is that the error message is referring to. Any help appreciated -
thank you.
Friday, 27 September 2013
Javascript Class and scope
Javascript Class and scope
I want to make a class in javascript to reuse from my main code in the
connection with an indexeddb object. What I have now is:
function DATABASE() {
this.DB_NAME = 'MYdatabase';
this.DB_VERSION = 1;
this.db = null;
this.results = null;
}
DATABASE.prototype.open = function(callback) {
var req = indexedDB.open(this.DB_NAME, this.DB_VERSION);
req.onsuccess = function (evt) {
this.db = this.result;
callback();
};
req.onerror = function (evt) {
console.error("openDb:", evt.target.errorCode);
};
req.onupgradeneeded = function (evt) {
console.log("openDb.onupgradeneeded");
};
}
My problem here is that when the onsuccess executes I loose the scope of
my main class and this is not what I expected. How can I do what I am
looking for? I want to make some connections at the same time with this,
something like:
var DB = new DATABASE(); DB.open(function(res){});
var DB2 = new DATABASE(); DB2.open(function(res){});
var DB3 = new DATABASE(); DB3.open(function(res){});
thanks so much.
I want to make a class in javascript to reuse from my main code in the
connection with an indexeddb object. What I have now is:
function DATABASE() {
this.DB_NAME = 'MYdatabase';
this.DB_VERSION = 1;
this.db = null;
this.results = null;
}
DATABASE.prototype.open = function(callback) {
var req = indexedDB.open(this.DB_NAME, this.DB_VERSION);
req.onsuccess = function (evt) {
this.db = this.result;
callback();
};
req.onerror = function (evt) {
console.error("openDb:", evt.target.errorCode);
};
req.onupgradeneeded = function (evt) {
console.log("openDb.onupgradeneeded");
};
}
My problem here is that when the onsuccess executes I loose the scope of
my main class and this is not what I expected. How can I do what I am
looking for? I want to make some connections at the same time with this,
something like:
var DB = new DATABASE(); DB.open(function(res){});
var DB2 = new DATABASE(); DB2.open(function(res){});
var DB3 = new DATABASE(); DB3.open(function(res){});
thanks so much.
Thursday, 26 September 2013
Jquery mobile right panel works different in browser and in emulator
Jquery mobile right panel works different in browser and in emulator
I want to create a panel as per the facebook so i tried the example shown
here the panel length is greater than the page. When i run the example in
the crome and firefox browser it working properly but when i try to run it
in the emulator then header and footer are moving a bit to left and the
panel opens under the header and footer and the content page moves to
right. here is the code i had return for creating the right panel:
<body>
<div data-url="panel-fixed-page1" data-role="page" class="jqm-demos
ui-responsive-panel" id="panel-fixed-page1">
<div data-role="header" data-theme="b" data-position='fixed'>
<h1>Fixed header</h1>
<a href="#nav-panel" data-icon="bars" data-iconpos="notext" id='menu'
>Menu</a>
<a href="#add-form" data-icon="gear" data-iconpos="notext"
id='add'>Add</a>
</div><!-- /header -->
<div data-role="content" class="jqm-content">
<h1>Panels</h1>
<h2>Fixed positioning</h2>
<p>This is a typical page that has two buttons in the header bar that
open panels. The left panel has the reveal display mode. The right
panel opens as overlay. For both panels we set
<code>data-position-fixed="true"</code>. We also set position fixed
for the header and footer on this page.</p>
<p>The left panel contains a long menu to demonstrate that the
framework will check the panel contents height and unfixes the panel
so its content can be scrolled. In the right panel there is a short
form that shows the fixed positioning.</p>
<h2>Responsive</h2>
<p>To make this responsive, you can make the page re-flow at wider
widths. This allows both the reveal panel menu and page to be used
together when more space is available. This behavior is controlled by
CSS media queries. You can create a custom one for a specific
breakpoint or use the breakpoint preset by adding the
<code>class="ui-responsive-panel"</code> to the page container. We
have added this class on this demo page.</p>
<a href="./" class="jqm-button" data-ajax="false" data-role="button"
data-mini="true" data-inline="true" data-icon="arrow-l"
data-iconpos="left">Back to Panels</a>
<div data-demo-html="#panel-fixed-page1"
data-demo-css="true"></div><!--/demo-html -->
</div>
<div data-role="footer" data-theme="b" data-position="fixed">
<h4>Fixed footer</h4>
</div>
<div data-role="panel" data-theme="a" id="nav-panel"
data-display="reveal" data-position-fixed="true">
<ul data-role="listview" data-theme="a" class="nav-search">
<li data-icon="delete"><a href="#" data-rel="close">Close
menu</a></li>
<li><a href="#panel-fixed-page2">Accordion</a></li>
<li><a href="#panel-fixed-page2">AJAX Navigation</a></li>
<li><a href="#panel-fixed-page2">Autocomplete</a></li>
<li><a href="#panel-fixed-page2">Buttons</a></li>
<li><a href="#panel-fixed-page2">Checkboxes</a></li>
<li><a href="#panel-fixed-page2">Collapsibles</a></li>
<li><a href="#panel-fixed-page2">Controlgroup</a></li>
<li><a href="#panel-fixed-page2">Dialogs</a></li>
<li><a href="#panel-fixed-page2">Fixed toolbars</a></li>
<li><a href="#panel-fixed-page2">Flip switch toggle</a></li>
<li><a href="#panel-fixed-page2">Footer toolbar</a></li>
<li><a href="#panel-fixed-page2">Form elements</a></li>
<li><a href="#panel-fixed-page2">Grids</a></li>
<li><a href="#panel-fixed-page2">Header toolbar</a></li>
<li><a href="#panel-fixed-page2">Icons</a></li>
<li><a href="#panel-fixed-page2">Links</a></li>
<li><a href="#panel-fixed-page2">Listviews</a></li>
<li><a href="#panel-fixed-page2">Loader overlay</a></li>
<li><a href="#panel-fixed-page2">Navbar</a></li>
<li><a href="#panel-fixed-page2">Navbar, persistent</a></li>
<li><a href="#panel-fixed-page2">Pages</a></li>
<li><a href="#panel-fixed-page2">New</a></li>
<li><a href="#panel-fixed-page2">Popup</a></li>
<li><a href="#panel-fixed-page2">Radio buttons</a></li>
<li><a href="#panel-fixed-page2">Select</a></li>
<li><a href="#panel-fixed-page2">Slider, single</a></li>
<li><a href="#panel-fixed-page2">New</a></li>
<li><a href="#panel-fixed-page2">New</a></li>
<li><a href="#panel-fixed-page2">New</a></li>
<li><a href="#panel-fixed-page2">Text inputs & textarea</a></li>
<li><a href="#panel-fixed-page2">Transitions</a></li>
</ul>
</div>
here is the css and js files i used:
<link rel="stylesheet" href="css/jquery.mobile-1.3.2.min.css">
<script src="js/jquery.js"></script>
<script src="js/jquery.mobile-1.3.2.min.js"></script>
here is the css style i used to set the width of the panel:
<style>
.ui-responsive-panel {
width:200px;
}
.ui-panel-animate.ui-panel-content-fixed-toolbar-position-left.ui-panel-content-fixed-toolbar-open.ui-panel-content-fixed-toolbar-display-reveal,
.ui-panel-animate.ui-panel-content-fixed-toolbar-position-left.ui-panel-content-fixed-toolbar-open.ui-panel-content-fixed-toolbar-display-push,
.ui-panel-animate.ui-panel-content-wrap-position-left.ui-panel-content-wrap-open.ui-panel-content-wrap-display-reveal,
.ui-panel-animate.ui-panel-content-wrap-position-left.ui-panel-content-wrap-open.ui-panel-content-wrap-display-push
{
left: 0;
right: 0;
margin-left:-70px;
}
.ui-panel{
width:12.6em;
}
@media (min-width:35em)
{
.ui-responsive-panel.ui-page-panel-open
.ui-panel-content-fixed-toolbar-display-push.ui-panel-content-fixed-toolbar-position-left,
.ui-responsive-panel.ui-page-panel-open
.ui-panel-content-fixed-toolbar-display-reveal.ui-panel-content-fixed-toolbar-position-left,
.ui-responsive-panel.ui-page-panel-open
.ui-panel-content-wrap-display-push.ui-panel-content-wrap-position-left,
.ui-responsive-panel.ui-page-panel-open
.ui-panel-content-wrap-display-reveal.ui-panel-content-wrap-position-left
{
margin-right: 17em; }
.ui-responsive-panel.ui-page-panel-open
.ui-panel-content-fixed-toolbar-display-push.ui-panel-content-fixed-toolbar-position-right,
.ui-responsive-panel.ui-page-panel-open
.ui-panel-content-fixed-toolbar-display-reveal.ui-panel-content-fixed-toolbar-position-right,
.ui-responsive-panel.ui-page-panel-open
.ui-panel-content-wrap-display-push.ui-panel-content-wrap-position-right,
.ui-responsive-panel.ui-page-panel-open
.ui-panel-content-wrap-display-reveal.ui-panel-content-wrap-position-right
{
margin-left: 17em; }
.ui-responsive-panel.ui-page-panel-open
.ui-panel-content-fixed-toolbar-display-push,
.ui-responsive-panel.ui-page-panel-open
.ui-panel-content-fixed-toolbar-display-reveal {
width:auto;
}
.ui-responsive-panel .ui-panel-dismiss-display-push {
display: none;
}
}
.ui-fixed-hidden {
position: fixed;
}
</style>
and is it possible to make only panel scrollable not the page or content.
Any idea is appreciated. Thanks in advance
I want to create a panel as per the facebook so i tried the example shown
here the panel length is greater than the page. When i run the example in
the crome and firefox browser it working properly but when i try to run it
in the emulator then header and footer are moving a bit to left and the
panel opens under the header and footer and the content page moves to
right. here is the code i had return for creating the right panel:
<body>
<div data-url="panel-fixed-page1" data-role="page" class="jqm-demos
ui-responsive-panel" id="panel-fixed-page1">
<div data-role="header" data-theme="b" data-position='fixed'>
<h1>Fixed header</h1>
<a href="#nav-panel" data-icon="bars" data-iconpos="notext" id='menu'
>Menu</a>
<a href="#add-form" data-icon="gear" data-iconpos="notext"
id='add'>Add</a>
</div><!-- /header -->
<div data-role="content" class="jqm-content">
<h1>Panels</h1>
<h2>Fixed positioning</h2>
<p>This is a typical page that has two buttons in the header bar that
open panels. The left panel has the reveal display mode. The right
panel opens as overlay. For both panels we set
<code>data-position-fixed="true"</code>. We also set position fixed
for the header and footer on this page.</p>
<p>The left panel contains a long menu to demonstrate that the
framework will check the panel contents height and unfixes the panel
so its content can be scrolled. In the right panel there is a short
form that shows the fixed positioning.</p>
<h2>Responsive</h2>
<p>To make this responsive, you can make the page re-flow at wider
widths. This allows both the reveal panel menu and page to be used
together when more space is available. This behavior is controlled by
CSS media queries. You can create a custom one for a specific
breakpoint or use the breakpoint preset by adding the
<code>class="ui-responsive-panel"</code> to the page container. We
have added this class on this demo page.</p>
<a href="./" class="jqm-button" data-ajax="false" data-role="button"
data-mini="true" data-inline="true" data-icon="arrow-l"
data-iconpos="left">Back to Panels</a>
<div data-demo-html="#panel-fixed-page1"
data-demo-css="true"></div><!--/demo-html -->
</div>
<div data-role="footer" data-theme="b" data-position="fixed">
<h4>Fixed footer</h4>
</div>
<div data-role="panel" data-theme="a" id="nav-panel"
data-display="reveal" data-position-fixed="true">
<ul data-role="listview" data-theme="a" class="nav-search">
<li data-icon="delete"><a href="#" data-rel="close">Close
menu</a></li>
<li><a href="#panel-fixed-page2">Accordion</a></li>
<li><a href="#panel-fixed-page2">AJAX Navigation</a></li>
<li><a href="#panel-fixed-page2">Autocomplete</a></li>
<li><a href="#panel-fixed-page2">Buttons</a></li>
<li><a href="#panel-fixed-page2">Checkboxes</a></li>
<li><a href="#panel-fixed-page2">Collapsibles</a></li>
<li><a href="#panel-fixed-page2">Controlgroup</a></li>
<li><a href="#panel-fixed-page2">Dialogs</a></li>
<li><a href="#panel-fixed-page2">Fixed toolbars</a></li>
<li><a href="#panel-fixed-page2">Flip switch toggle</a></li>
<li><a href="#panel-fixed-page2">Footer toolbar</a></li>
<li><a href="#panel-fixed-page2">Form elements</a></li>
<li><a href="#panel-fixed-page2">Grids</a></li>
<li><a href="#panel-fixed-page2">Header toolbar</a></li>
<li><a href="#panel-fixed-page2">Icons</a></li>
<li><a href="#panel-fixed-page2">Links</a></li>
<li><a href="#panel-fixed-page2">Listviews</a></li>
<li><a href="#panel-fixed-page2">Loader overlay</a></li>
<li><a href="#panel-fixed-page2">Navbar</a></li>
<li><a href="#panel-fixed-page2">Navbar, persistent</a></li>
<li><a href="#panel-fixed-page2">Pages</a></li>
<li><a href="#panel-fixed-page2">New</a></li>
<li><a href="#panel-fixed-page2">Popup</a></li>
<li><a href="#panel-fixed-page2">Radio buttons</a></li>
<li><a href="#panel-fixed-page2">Select</a></li>
<li><a href="#panel-fixed-page2">Slider, single</a></li>
<li><a href="#panel-fixed-page2">New</a></li>
<li><a href="#panel-fixed-page2">New</a></li>
<li><a href="#panel-fixed-page2">New</a></li>
<li><a href="#panel-fixed-page2">Text inputs & textarea</a></li>
<li><a href="#panel-fixed-page2">Transitions</a></li>
</ul>
</div>
here is the css and js files i used:
<link rel="stylesheet" href="css/jquery.mobile-1.3.2.min.css">
<script src="js/jquery.js"></script>
<script src="js/jquery.mobile-1.3.2.min.js"></script>
here is the css style i used to set the width of the panel:
<style>
.ui-responsive-panel {
width:200px;
}
.ui-panel-animate.ui-panel-content-fixed-toolbar-position-left.ui-panel-content-fixed-toolbar-open.ui-panel-content-fixed-toolbar-display-reveal,
.ui-panel-animate.ui-panel-content-fixed-toolbar-position-left.ui-panel-content-fixed-toolbar-open.ui-panel-content-fixed-toolbar-display-push,
.ui-panel-animate.ui-panel-content-wrap-position-left.ui-panel-content-wrap-open.ui-panel-content-wrap-display-reveal,
.ui-panel-animate.ui-panel-content-wrap-position-left.ui-panel-content-wrap-open.ui-panel-content-wrap-display-push
{
left: 0;
right: 0;
margin-left:-70px;
}
.ui-panel{
width:12.6em;
}
@media (min-width:35em)
{
.ui-responsive-panel.ui-page-panel-open
.ui-panel-content-fixed-toolbar-display-push.ui-panel-content-fixed-toolbar-position-left,
.ui-responsive-panel.ui-page-panel-open
.ui-panel-content-fixed-toolbar-display-reveal.ui-panel-content-fixed-toolbar-position-left,
.ui-responsive-panel.ui-page-panel-open
.ui-panel-content-wrap-display-push.ui-panel-content-wrap-position-left,
.ui-responsive-panel.ui-page-panel-open
.ui-panel-content-wrap-display-reveal.ui-panel-content-wrap-position-left
{
margin-right: 17em; }
.ui-responsive-panel.ui-page-panel-open
.ui-panel-content-fixed-toolbar-display-push.ui-panel-content-fixed-toolbar-position-right,
.ui-responsive-panel.ui-page-panel-open
.ui-panel-content-fixed-toolbar-display-reveal.ui-panel-content-fixed-toolbar-position-right,
.ui-responsive-panel.ui-page-panel-open
.ui-panel-content-wrap-display-push.ui-panel-content-wrap-position-right,
.ui-responsive-panel.ui-page-panel-open
.ui-panel-content-wrap-display-reveal.ui-panel-content-wrap-position-right
{
margin-left: 17em; }
.ui-responsive-panel.ui-page-panel-open
.ui-panel-content-fixed-toolbar-display-push,
.ui-responsive-panel.ui-page-panel-open
.ui-panel-content-fixed-toolbar-display-reveal {
width:auto;
}
.ui-responsive-panel .ui-panel-dismiss-display-push {
display: none;
}
}
.ui-fixed-hidden {
position: fixed;
}
</style>
and is it possible to make only panel scrollable not the page or content.
Any idea is appreciated. Thanks in advance
Wednesday, 25 September 2013
List item repeating in android customized listview
List item repeating in android customized listview
In my customized list view items are repeating.position of item is same
for all item. code is below
ListAdapter.java-
public class ListAdapter extends BaseAdapter{
private List<String> mName;
private List<Drawable> mIcon;
private Context mContext;
public ListAdapter(Context mContext, List<String> Name, List<Drawable>
Icon) {
this.mContext=mContext;
this.mName=Name;
this.mIcon=Icon;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return mName.size();
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public View getView(final int position, View v, ViewGroup parent) {
View mLayout;
TextView mText;
ImageView mImage;
CheckBox mCheckBox;
if(v==null){
LayoutInflater inflater = (LayoutInflater)
mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mLayout=new View(mContext);
mLayout=(LinearLayout) inflater.inflate(R.layout.list_menu, null);
mText=(TextView) mLayout.findViewById(R.id.Name);
mImage=(ImageView) mLayout.findViewById(R.id.Icon);
mCheckBox=(CheckBox) mLayout.findViewById(R.id.mCheckbox);
mText.setText(mName.get(position));
mImage.setImageDrawable(mIcon.get(position));
mCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton check, boolean
isChecked) {
if(check.isChecked()){
Toast.makeText(mContext,
"..."+mName.get(position)+"..."+position,
Toast.LENGTH_SHORT).show();
}
}
});
}
else{
mLayout=(View)v;
}
return mLayout;
}
}
In my customized list view items are repeating.position of item is same
for all item. code is below
ListAdapter.java-
public class ListAdapter extends BaseAdapter{
private List<String> mName;
private List<Drawable> mIcon;
private Context mContext;
public ListAdapter(Context mContext, List<String> Name, List<Drawable>
Icon) {
this.mContext=mContext;
this.mName=Name;
this.mIcon=Icon;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return mName.size();
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public View getView(final int position, View v, ViewGroup parent) {
View mLayout;
TextView mText;
ImageView mImage;
CheckBox mCheckBox;
if(v==null){
LayoutInflater inflater = (LayoutInflater)
mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mLayout=new View(mContext);
mLayout=(LinearLayout) inflater.inflate(R.layout.list_menu, null);
mText=(TextView) mLayout.findViewById(R.id.Name);
mImage=(ImageView) mLayout.findViewById(R.id.Icon);
mCheckBox=(CheckBox) mLayout.findViewById(R.id.mCheckbox);
mText.setText(mName.get(position));
mImage.setImageDrawable(mIcon.get(position));
mCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton check, boolean
isChecked) {
if(check.isChecked()){
Toast.makeText(mContext,
"..."+mName.get(position)+"..."+position,
Toast.LENGTH_SHORT).show();
}
}
});
}
else{
mLayout=(View)v;
}
return mLayout;
}
}
Thursday, 19 September 2013
Select2 Error: Object has no method 'destroy'
Select2 Error: Object has no method 'destroy'
I'm getting this error on line 667 of the select2.js script file. It's the
first time select2 is being called on any element on the page.
I'm using version 3.4.2 of the select2 plugin. It's being called on a
element fetched by its id attribute, with no other attributes on the
element.
I'm using jQuery version 2.0.3. I've tried other versions of jQuery with
no success, as well as a few recent versions of the select2 plugin.
Thanks in advance for any assistance.
Edit (showing code):
<select id="my-select">
<option>1</option>
<option>2</option>
</select>
<script type="text/javascript">
$('#my-select').select2();
</script>
I'm getting this error on line 667 of the select2.js script file. It's the
first time select2 is being called on any element on the page.
I'm using version 3.4.2 of the select2 plugin. It's being called on a
element fetched by its id attribute, with no other attributes on the
element.
I'm using jQuery version 2.0.3. I've tried other versions of jQuery with
no success, as well as a few recent versions of the select2 plugin.
Thanks in advance for any assistance.
Edit (showing code):
<select id="my-select">
<option>1</option>
<option>2</option>
</select>
<script type="text/javascript">
$('#my-select').select2();
</script>
I can't send email in network of my company
I can't send email in network of my company
I need help, in my company have a firewall bloked sending email
the code is
MailMessage msg = new MailMessage();
msg.From = new MailAddress("email@email.com", "Im");
msg.To.Add(new MailAddress("email@email.com", "SomeOne"));
msg.Subject = "This is a Test Mail";
msg.Body = "This is a test message using Exchange OnLine";
msg.IsBodyHtml = true;
SmtpClient client = new SmtpClient();
client.UseDefaultCredentials = true;
client.Credentials = new System.Net.NetworkCredential("my",
"secret");
client.Port = "587";
client.Host = "smtp.gmail.com";
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.EnableSsl = true;
try
{
client.Send(msg);
MessageBox.Show("Message Sent Succesfully");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
strange that I have access to the gmail browser.
it is possible to cheat the firewall?
I need help, in my company have a firewall bloked sending email
the code is
MailMessage msg = new MailMessage();
msg.From = new MailAddress("email@email.com", "Im");
msg.To.Add(new MailAddress("email@email.com", "SomeOne"));
msg.Subject = "This is a Test Mail";
msg.Body = "This is a test message using Exchange OnLine";
msg.IsBodyHtml = true;
SmtpClient client = new SmtpClient();
client.UseDefaultCredentials = true;
client.Credentials = new System.Net.NetworkCredential("my",
"secret");
client.Port = "587";
client.Host = "smtp.gmail.com";
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.EnableSsl = true;
try
{
client.Send(msg);
MessageBox.Show("Message Sent Succesfully");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
strange that I have access to the gmail browser.
it is possible to cheat the firewall?
How should I use identifierForVendor during development?
How should I use identifierForVendor during development?
The value of [UIDevice currentDevice].identifierForVendor changes every
time I run my application within the iOS simulator. I need to write logic
around this value persisting across debug / run sessions. Are there any
recommendations for accomplishing this?
The value of [UIDevice currentDevice].identifierForVendor changes every
time I run my application within the iOS simulator. I need to write logic
around this value persisting across debug / run sessions. Are there any
recommendations for accomplishing this?
Subscribe to:
Posts (Atom)