adding element in array when array is empty in Javascript is not working
I am facing a problem in javascript array...i am using Serversent event in
JS. I will be getting few values from server frequently...
My task is to catch all the details and display in drop-down box...
Now the problem is, during the first request, i will getting values
seperated by comma.. I have array object in js...i will check if the array
is empty, if so, then i will include the values in combo...
code:
var varArr = new Array();
//since i am using SSE, i will executing this below part multiple times
automaticall when ever server pushes data..
if(!varArr.length){
varArr[0]='somevalue';
//Printing some value in <div>
}
else{
//some task...to print in <div>
}
Since i have added some values in array if the array is empty, i am not
getting any values printed in div (//Printing some value in ), instead i
am getting (//some task...to print in )
Thursday, 12 September 2013
Execute create procedure after drop procedure by otl_cursor::direct_exec of OTL
Execute create procedure after drop procedure by otl_cursor::direct_exec
of OTL
I used 'SQL SERVER 2008 R2'(Driver={SQL Server}) and 'otlv4' in my
program. There is an error when executing 'create procedure' after 'drop
procedure'. The code is like this:
otl_cursor::direct_exec( m_DBConnection,
"if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[MyProcName]') and OBJECTPROPERTY(id,
N'IsProcedure') = 1) drop procedure [dbo].[MyProcName]");
otl_cursor::direct_exec( m_DBConnection,
"CREATE PROCEDURE GetUserForAvatar"
"@sAvatar nvarchar(50)"
"AS "
"BEGIN "
" select ixAtlasUser from Avatar where (sAvatar = @sAvatar)"
"END "
);
of OTL
I used 'SQL SERVER 2008 R2'(Driver={SQL Server}) and 'otlv4' in my
program. There is an error when executing 'create procedure' after 'drop
procedure'. The code is like this:
otl_cursor::direct_exec( m_DBConnection,
"if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[MyProcName]') and OBJECTPROPERTY(id,
N'IsProcedure') = 1) drop procedure [dbo].[MyProcName]");
otl_cursor::direct_exec( m_DBConnection,
"CREATE PROCEDURE GetUserForAvatar"
"@sAvatar nvarchar(50)"
"AS "
"BEGIN "
" select ixAtlasUser from Avatar where (sAvatar = @sAvatar)"
"END "
);
How to wrap text in image?
How to wrap text in image?
Hello! Can anybody explain, how to reach that effect in HTML/CSS or
HTML5/CSS3/JS?
I have result just when text in image, or text on background, together
don't work. Using the image, as clipping mask.
Example:
Variant one:
http://jsfiddle.net/iKeler/pR9FA/
Variant two:
http://jsfiddle.net/iKeler/uuTv8/
Variant three:
I need, need to combine both options
How i can locate text in image, and background with text together? Thanks
a lot!
Hello! Can anybody explain, how to reach that effect in HTML/CSS or
HTML5/CSS3/JS?
I have result just when text in image, or text on background, together
don't work. Using the image, as clipping mask.
Example:
Variant one:
http://jsfiddle.net/iKeler/pR9FA/
Variant two:
http://jsfiddle.net/iKeler/uuTv8/
Variant three:
I need, need to combine both options
How i can locate text in image, and background with text together? Thanks
a lot!
Delete row from table using JQuery. Please see code
Delete row from table using JQuery. Please see code
I used a code which I got in the net that adds a table row every onclick
event. It worked perfect for me until I realized I needed to have an
onclick event for every row that when clicked, it will delete the row.
Is there a way for that to happen using my code?
Please see codes below:
Javascript/JQuery code:
<script>
var counter = 2;
function addRow() {
event.preventDefault();
var newRow = jQuery('<tr><td><label>'+ counter
+'</label></td><td><textarea name="txtActionStep' + counter + '"
style="width:300px; height: 50px;
word-wrap:break-word;"></textarea></td><td valign="top"><input
type="text" name="txtOwner' + counter +
'"/></td></tr>');
counter++;
jQuery('table.actionsteps-list').append( newRow );
}
</script>
HTML Code:
<table class="actionsteps-list" width="510">
<tr>
<th colspan="3" align="left">Action Steps</th>
</tr>
<tr>
<td>Step #</td><td>Action Step</td><td>Owner</td>
</tr>
<tr>
<td><label>1</label></td>
<td><textarea name="txtActionStep1" style="width:300px; height:
50px; word-wrap:break-word;"></textarea></td>
<td valign="top"><input type="text" name="txtOwner1" /></td>
</tr>
</table>
<table width="510">
<tr>
<td align="right"><a href="#" title=""
onclick="javascript:addRow();">Add Action</a></td>
</tr>
</table>
Thank you!
I used a code which I got in the net that adds a table row every onclick
event. It worked perfect for me until I realized I needed to have an
onclick event for every row that when clicked, it will delete the row.
Is there a way for that to happen using my code?
Please see codes below:
Javascript/JQuery code:
<script>
var counter = 2;
function addRow() {
event.preventDefault();
var newRow = jQuery('<tr><td><label>'+ counter
+'</label></td><td><textarea name="txtActionStep' + counter + '"
style="width:300px; height: 50px;
word-wrap:break-word;"></textarea></td><td valign="top"><input
type="text" name="txtOwner' + counter +
'"/></td></tr>');
counter++;
jQuery('table.actionsteps-list').append( newRow );
}
</script>
HTML Code:
<table class="actionsteps-list" width="510">
<tr>
<th colspan="3" align="left">Action Steps</th>
</tr>
<tr>
<td>Step #</td><td>Action Step</td><td>Owner</td>
</tr>
<tr>
<td><label>1</label></td>
<td><textarea name="txtActionStep1" style="width:300px; height:
50px; word-wrap:break-word;"></textarea></td>
<td valign="top"><input type="text" name="txtOwner1" /></td>
</tr>
</table>
<table width="510">
<tr>
<td align="right"><a href="#" title=""
onclick="javascript:addRow();">Add Action</a></td>
</tr>
</table>
Thank you!
Wednesday, 11 September 2013
orientation change getting the same layout in fragment
orientation change getting the same layout in fragment
i'm doing orientation change from portrait to landscape and from landscape
to portrait. My code as below
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
//Set titlebar as "my@heaven"
getSherlockActivity().getSupportActionBar()
.setBackgroundDrawable(getResources().getDrawable(R.drawable.myheaven));
view = inflater.inflate(R.layout.memorial_listing, container, false);
setUpView(savedInstanceState);
return view;
}
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
// Checks the orientation of the screen
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
}
}
and i also add this to manifest
android:configChanges="orientation|keyboardHidden|screenSize"
and the same layout i put inside layout folder for portrait and
layout-land for landscape but when i try to rotate the screen if start
from portrait then still remain getting layout from layout folder. The
screen rotate but not getting right folder to display the layout. Please
help
i'm doing orientation change from portrait to landscape and from landscape
to portrait. My code as below
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
//Set titlebar as "my@heaven"
getSherlockActivity().getSupportActionBar()
.setBackgroundDrawable(getResources().getDrawable(R.drawable.myheaven));
view = inflater.inflate(R.layout.memorial_listing, container, false);
setUpView(savedInstanceState);
return view;
}
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
// Checks the orientation of the screen
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
}
}
and i also add this to manifest
android:configChanges="orientation|keyboardHidden|screenSize"
and the same layout i put inside layout folder for portrait and
layout-land for landscape but when i try to rotate the screen if start
from portrait then still remain getting layout from layout folder. The
screen rotate but not getting right folder to display the layout. Please
help
How to write a small helper function for Ajax Post requests?
How to write a small helper function for Ajax Post requests?
such that an object literal contains the parameters you want to send and
the result is a string you can send as data.
Here is my first try:
function makeData(obj) {
var data_send = '';
_.each(obj, function (val, key) {
data_send += encodeURIComponent(key) + '=' +
encodeURIComponent(val) + '&';
});
data_send.slice(1,-1);
return data_send;
}
Is this the correct form for ajax post data?
such that an object literal contains the parameters you want to send and
the result is a string you can send as data.
Here is my first try:
function makeData(obj) {
var data_send = '';
_.each(obj, function (val, key) {
data_send += encodeURIComponent(key) + '=' +
encodeURIComponent(val) + '&';
});
data_send.slice(1,-1);
return data_send;
}
Is this the correct form for ajax post data?
What is the best word-press plugin to emulate stackoverflow
What is the best word-press plugin to emulate stackoverflow
What is the best Word-Press plug-in to emulate the question/answer(vote)
format of Stack-Overflow? I'm interested in a community site that can ask
questions, get suggestions and vote on the answers, comment, etc. But this
is not technical in nature; and it needs to be "word-press" in nature
(something we can add to our word-press site).
Thanks.
What is the best Word-Press plug-in to emulate the question/answer(vote)
format of Stack-Overflow? I'm interested in a community site that can ask
questions, get suggestions and vote on the answers, comment, etc. But this
is not technical in nature; and it needs to be "word-press" in nature
(something we can add to our word-press site).
Thanks.
Subscribe to:
Posts (Atom)