Change style of XML defined SharedPreferences Activity, to match newer
Holo style
I have an existing Preference Activity (created using the standard XML
style, and calling with the Preferences intent).
My problem, is this looks like the old style (2.3) preferences, even on
4.0+ devices. I would like it to look like the newer settings style. Is
there some way to make this appearance change (perhaps applying a specific
style attribute or something)?
I launch the Activity (note: using ApplicationContext, which I think is
correct), in the following manner:
final Context cxt = this.getApplicationContext();
final Intent i5 = new Intent(cxt, Preferences.class);
startActivity(i5);
The XML is:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android" >
<PreferenceCategory android:title="@string/pref_notification_time" >
<com.wolfsoft.dotd.util.TimePickerPreference
android:defaultValue="07:30"
android:key="notif_time"
android:summary="@string/summary_notif_time"
android:title="@string/title_notif_time" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_notif_onoff" >
<CheckBoxPreference
android:defaultValue="true"
android:key="notif_pref"
android:summary="@string/summary_notif_preference"
android:title="@string/title_notif_preference" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_notif_category" >
<CheckBoxPreference
android:defaultValue="true"
android:key="notif_game_pref"
android:summary="@string/pref_game_notif_sum"
android:title="@string/pref_game_notif_sum_title" />
<CheckBoxPreference
android:defaultValue="true"
android:key="notif_business_pref"
android:summary="@string/pref_business_notif_sum"
android:title="@string/pref_business_notif_sum_title" />
<CheckBoxPreference
android:defaultValue="true"
android:key="notif_entertainment_pref"
android:summary="@string/pref_entertainment_notif_sum"
android:title="@string/pref_entertainment_notif_sum_title" />
<CheckBoxPreference
android:defaultValue="true"
android:key="notif_lifestyle_pref"
android:summary="@string/pref_lifestyle_notif_sum"
android:title="@string/pref_lifestyle_notif_sum_title" />
<CheckBoxPreference
android:defaultValue="true"
android:key="notif_personalization_pref"
android:summary="@string/pref_personalization_notif_sum"
android:title="@string/pref_personalization_notif_sum_title" />
<CheckBoxPreference
android:defaultValue="true"
android:key="notif_local_pref"
android:summary="@string/pref_local_notif_sum"
android:title="@string/pref_local_notif_sum_title" />
</PreferenceCategory>
</PreferenceScreen>
My current screen looks like this:
I would like it to look like this:
Friday, 27 September 2013
Am I allowing 3 guesses or 2?
Am I allowing 3 guesses or 2?
I am learning Python on Codecademy, and I am supposed to give the user 3
guesses before showing "you lose". I think my code allows 3 entries, but
the website shows "Oops, try again! Did you allow the user 3 guesses, or
did you incorrectly detect a correct guess?" unless the user guesses
correctly within 3 trials. Can someone tell me what's wrong?
from random import randrange
random_number = randrange(1, 10)
count = 0
# Start your game!
guess= int(raw_input("Please type your number here:"))
while count < 2:
if guess==random_number:
print "You win!"
break
else:
guess=int(raw_input("Please guess again:"))
count+=1
else:
print "You lose!"
print random_number
I am learning Python on Codecademy, and I am supposed to give the user 3
guesses before showing "you lose". I think my code allows 3 entries, but
the website shows "Oops, try again! Did you allow the user 3 guesses, or
did you incorrectly detect a correct guess?" unless the user guesses
correctly within 3 trials. Can someone tell me what's wrong?
from random import randrange
random_number = randrange(1, 10)
count = 0
# Start your game!
guess= int(raw_input("Please type your number here:"))
while count < 2:
if guess==random_number:
print "You win!"
break
else:
guess=int(raw_input("Please guess again:"))
count+=1
else:
print "You lose!"
print random_number
Under what circumstances would a .NET program just terminate?
Under what circumstances would a .NET program just terminate?
I have a WPF application written for the .NET 4 Full Framework. The
application uses SQL Anywhere as its database. My application has an
unhandled exception handler, which always logs errors to a custom event
log for the program. It then displays the error message to the user. The
program also sends messages to the event log whenever it's about to do
something in order too make debugging it easier.
The application is installed on a user's laptop, which is running Windows
7 and has 8 GB of RAM. When it is started on this machine, the splash
screen is displayed and then the program's main window is displayed. Less
than a second after being drawn, the program dies. There are no error
messages displayed.
Checking the event log shows that the program's last message written was
that it was doing a check for the existence of a user in the database.
There are no error messages.
The code that follows the last message that was displayed is a call to a
method that does some parameter checking and then executes the following
EF query:
LPRCore.CarSystem.User user = null;
IQueryable<User> query = from u in context.Users
from m in context.Members.Where( m => m.UserId ==
u.UserId )
.DefaultIfEmpty()
where u.LoweredUserName == userName.ToLower() &&
m == null
select u;
try {
user = query.SingleOrDefault();
} catch ( Exception ex ) {
....
}
I can't tell if the code in the catch block is ever called. My suspicion
is that it is getting called and an exception is occurring in there.
My question is, if an exception occurs in a catch block, won't that
exception be caught by the Unhandled Exception handler at the upper level,
if there is no other exception handler to catch the error? Or would it
cause the program to die without reporting anything?
I have a WPF application written for the .NET 4 Full Framework. The
application uses SQL Anywhere as its database. My application has an
unhandled exception handler, which always logs errors to a custom event
log for the program. It then displays the error message to the user. The
program also sends messages to the event log whenever it's about to do
something in order too make debugging it easier.
The application is installed on a user's laptop, which is running Windows
7 and has 8 GB of RAM. When it is started on this machine, the splash
screen is displayed and then the program's main window is displayed. Less
than a second after being drawn, the program dies. There are no error
messages displayed.
Checking the event log shows that the program's last message written was
that it was doing a check for the existence of a user in the database.
There are no error messages.
The code that follows the last message that was displayed is a call to a
method that does some parameter checking and then executes the following
EF query:
LPRCore.CarSystem.User user = null;
IQueryable<User> query = from u in context.Users
from m in context.Members.Where( m => m.UserId ==
u.UserId )
.DefaultIfEmpty()
where u.LoweredUserName == userName.ToLower() &&
m == null
select u;
try {
user = query.SingleOrDefault();
} catch ( Exception ex ) {
....
}
I can't tell if the code in the catch block is ever called. My suspicion
is that it is getting called and an exception is occurring in there.
My question is, if an exception occurs in a catch block, won't that
exception be caught by the Unhandled Exception handler at the upper level,
if there is no other exception handler to catch the error? Or would it
cause the program to die without reporting anything?
100% width div with child span won't right align
100% width div with child span won't right align
Given this fiddle, I want my menu to be at the right edge of the overall
"card", but for some reason it won't work. I've tried a couple different
methods (margins, right: 0, float) but they either don't work or I lose
the background color of the parent div (in the case of float where it
basically collapses the parent div).
Here is my current HTML and CSS, as seen in the fiddle.
<div class="server">
<div class="name">Server01</div>
<div class="menu">
<span class="items">
<span>Menu01</span>
<span>Menu02</span>
<span>Menu03</span>
</span>
</div>
<div class="content">
</div>
</div>
.server {
position: relative;
width: 400px;
height: 200px;
margin: 10px;
background-color: #686868;
}
.name {
font-size: large;
position: relative;
top: 0px; left: 0px; right: 0px;
padding-left: 10px;
background-color: cornflowerblue;
color: white;
cursor: default;
}
.menu {
font-size: small;
position: relative;
width: 100%;
background-color: cornflowerblue;
color: white;
}
.menu .items span {
margin-left: 10px;
}
.menu .items {
display: inline-block;
position: relative;
right: 0px;
text-align: right;
cursor: pointer;
}
Given this fiddle, I want my menu to be at the right edge of the overall
"card", but for some reason it won't work. I've tried a couple different
methods (margins, right: 0, float) but they either don't work or I lose
the background color of the parent div (in the case of float where it
basically collapses the parent div).
Here is my current HTML and CSS, as seen in the fiddle.
<div class="server">
<div class="name">Server01</div>
<div class="menu">
<span class="items">
<span>Menu01</span>
<span>Menu02</span>
<span>Menu03</span>
</span>
</div>
<div class="content">
</div>
</div>
.server {
position: relative;
width: 400px;
height: 200px;
margin: 10px;
background-color: #686868;
}
.name {
font-size: large;
position: relative;
top: 0px; left: 0px; right: 0px;
padding-left: 10px;
background-color: cornflowerblue;
color: white;
cursor: default;
}
.menu {
font-size: small;
position: relative;
width: 100%;
background-color: cornflowerblue;
color: white;
}
.menu .items span {
margin-left: 10px;
}
.menu .items {
display: inline-block;
position: relative;
right: 0px;
text-align: right;
cursor: pointer;
}
UISlider not animating in iOS7
UISlider not animating in iOS7
When I switched from iOS 6 to iOS 7 design, I noticed that using the
method setValue:animated: no longer animates the sliding process. Has
anyone else came across this problem and found a solution?
I'll just add some code to show I've done nothing complicated:
//Variable declaration
IBOutlet UISlider *s; //Connected in the .xib
//Button pressed
- (IBAction)buttonPressed:(id)sender
{
[s setValue:1 animated:YES];
}
And it jumps straight to 1 after I press the button.
When I switched from iOS 6 to iOS 7 design, I noticed that using the
method setValue:animated: no longer animates the sliding process. Has
anyone else came across this problem and found a solution?
I'll just add some code to show I've done nothing complicated:
//Variable declaration
IBOutlet UISlider *s; //Connected in the .xib
//Button pressed
- (IBAction)buttonPressed:(id)sender
{
[s setValue:1 animated:YES];
}
And it jumps straight to 1 after I press the button.
HashMap overridden by last value
HashMap overridden by last value
Statement selectStatement = connection.createStatement();
ResultSet selectResultSet = selectStatement.executeQuery(query);
logger.info("sql query " + selectStatement.toString());
ResultSetMetaData rsmd = selectResultSet.getMetaData();
int columnsNumber = rsmd.getColumnCount();
String[] row = new String[columnsNumber];
int ctr = 0;
logger.info("Reading from database...");
while(selectResultSet.next())
{
for(int i=0;i<columnsNumber;i++){
row[i] = selectResultSet.getString(i+1);
}
System.out.println();
dataFromQuery.put(ctr++, row);
}
selectResultSet.close();
On reading back from HashMap, it prints only the last row 'n' number of
times.
Statement selectStatement = connection.createStatement();
ResultSet selectResultSet = selectStatement.executeQuery(query);
logger.info("sql query " + selectStatement.toString());
ResultSetMetaData rsmd = selectResultSet.getMetaData();
int columnsNumber = rsmd.getColumnCount();
String[] row = new String[columnsNumber];
int ctr = 0;
logger.info("Reading from database...");
while(selectResultSet.next())
{
for(int i=0;i<columnsNumber;i++){
row[i] = selectResultSet.getString(i+1);
}
System.out.println();
dataFromQuery.put(ctr++, row);
}
selectResultSet.close();
On reading back from HashMap, it prints only the last row 'n' number of
times.
Thursday, 26 September 2013
Load an Image error
Load an Image error
I have a question. I have 2 classes, 1 SampleController class and 1 other
normal Class that i have made by myself. (And offcourse the FXML file). I
want to load an Image through a Pane at a click of a button. But i want to
load the image in through the other Class. But those classes have to have
controle to eachother, which results in this error:
at
blackjack.ControllerToImagesBridge.<init>(ControllerToImagesBridge.java:23)
at blackjack.SampleController.<init>(SampleController.java:27)
at
blackjack.ControllerToImagesBridge.<init>(ControllerToImagesBridge.java:23)
at blackjack.SampleController.<init>(SampleController.java:27)
at
blackjack.ControllerToImagesBridge.<init>(ControllerToImagesBridge.java:23)
at blackjack.SampleController.<init>(SampleController.java:27)
at
blackjack.ControllerToImagesBridge.<init>(ControllerToImagesBridge.java:23)
at blackjack.SampleController.<init>(SampleController.java:27)
at
blackjack.ControllerToImagesBridge.<init>(ControllerToImagesBridge.java:23)
at blackjack.SampleController.<init>(SampleController.java:27)
at
blackjack.ControllerToImagesBridge.<init>(ControllerToImagesBridge.java:23)
at blackjack.SampleController.<init>(SampleController.java:27)
at
blackjack.ControllerToImagesBridge.<init>(ControllerToImagesBridge.java:23)
at blackjack.SampleController.<init>(SampleController.java:27)
at
blackjack.ControllerToImagesBridge.<init>(ControllerToImagesBridge.java:23)
at blackjack.SampleController.<init>(SampleController.java:27)
at
blackjack.ControllerToImagesBridge.<init>(ControllerToImagesBridge.java:23)
at blackjack.SampleController.<init>(SampleController.java:27)
Does anyone know how i can solve this problem? Thankyou very much.
I have a question. I have 2 classes, 1 SampleController class and 1 other
normal Class that i have made by myself. (And offcourse the FXML file). I
want to load an Image through a Pane at a click of a button. But i want to
load the image in through the other Class. But those classes have to have
controle to eachother, which results in this error:
at
blackjack.ControllerToImagesBridge.<init>(ControllerToImagesBridge.java:23)
at blackjack.SampleController.<init>(SampleController.java:27)
at
blackjack.ControllerToImagesBridge.<init>(ControllerToImagesBridge.java:23)
at blackjack.SampleController.<init>(SampleController.java:27)
at
blackjack.ControllerToImagesBridge.<init>(ControllerToImagesBridge.java:23)
at blackjack.SampleController.<init>(SampleController.java:27)
at
blackjack.ControllerToImagesBridge.<init>(ControllerToImagesBridge.java:23)
at blackjack.SampleController.<init>(SampleController.java:27)
at
blackjack.ControllerToImagesBridge.<init>(ControllerToImagesBridge.java:23)
at blackjack.SampleController.<init>(SampleController.java:27)
at
blackjack.ControllerToImagesBridge.<init>(ControllerToImagesBridge.java:23)
at blackjack.SampleController.<init>(SampleController.java:27)
at
blackjack.ControllerToImagesBridge.<init>(ControllerToImagesBridge.java:23)
at blackjack.SampleController.<init>(SampleController.java:27)
at
blackjack.ControllerToImagesBridge.<init>(ControllerToImagesBridge.java:23)
at blackjack.SampleController.<init>(SampleController.java:27)
at
blackjack.ControllerToImagesBridge.<init>(ControllerToImagesBridge.java:23)
at blackjack.SampleController.<init>(SampleController.java:27)
Does anyone know how i can solve this problem? Thankyou very much.
Thursday, 19 September 2013
hotlink prevention for images on subdomain not working
hotlink prevention for images on subdomain not working
I currently am rewriting image requests to my site and redirecting them to
my sub-domain which handles all the images.
what I want to do is prevent one site from hot-linking those images. I've
already implemented,
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?bannedsite\.com/ [NC]
RewriteRule \.(jpg|gif|bmp|png|JPE?G)$ - [F]
and this works for images on my main domain, But fails for the sub-domain.
Any info would be awesome. Thanks.
I currently am rewriting image requests to my site and redirecting them to
my sub-domain which handles all the images.
what I want to do is prevent one site from hot-linking those images. I've
already implemented,
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?bannedsite\.com/ [NC]
RewriteRule \.(jpg|gif|bmp|png|JPE?G)$ - [F]
and this works for images on my main domain, But fails for the sub-domain.
Any info would be awesome. Thanks.
How do I create a custom walker that displays this submenu?
How do I create a custom walker that displays this submenu?
I'm looking to display a menu that mirrors my primary menu as a submenu in
the sidebar. Suppose my site menu is:
Page A
Page B
-Subpage A
-Subpage B
--SubSubpage A
-Subpage C
Page C
If you're on Page B, I'd want this to show:
Page B
-Subpage A
-Subpage B
-Subpage C
If you're on Subpage B, I'd want this to show:
Page B
-Subpage A
-Subpage B
--SubSubpage A
-Subpage C
I know I can do this with a custom walker, but after hours of searching, I
need help.
I'm looking to display a menu that mirrors my primary menu as a submenu in
the sidebar. Suppose my site menu is:
Page A
Page B
-Subpage A
-Subpage B
--SubSubpage A
-Subpage C
Page C
If you're on Page B, I'd want this to show:
Page B
-Subpage A
-Subpage B
-Subpage C
If you're on Subpage B, I'd want this to show:
Page B
-Subpage A
-Subpage B
--SubSubpage A
-Subpage C
I know I can do this with a custom walker, but after hours of searching, I
need help.
Java servelet issue when changing src folder path
Java servelet issue when changing src folder path
I'm new to Java inherited a project that is in dire need of some
refactoring. One of the issues is the src has a couple unnecessary folders
e.g. "src/Alpha/Beta/ClassGroupFolders". I want to get rid of folders
"Alpha" and "Beta" since they have nothing in them. This means my class
paths will no longer be "Alpha.Beta.ClassGroup.ClassName" They will be
"ClassGroup.ClassName". I moved the ClassGroup folders up two levels and
did a global replace to change "Alpha.Beta.ClassGroup" to just
"ClassGroup" and did the same for "Alpha/Beta/ClassGroup".
Eclipse is showing no errors but when a servlet is being called I'm
getting "HTTP Status 404 - Servlet Logon is not available". It worked
before I changed the folder structure and that is the only change. My
web.xml file has an entry for the servlet that is being called by the form
and the servlet-class node has been updated to match the updated folder
structure. I'm sorry I can't provide more information on how the site is
set up but I can tell you it's not using struts. It's using inline code in
the JSP files for the most part.
What can I do to track down the source of this issue?
I'm new to Java inherited a project that is in dire need of some
refactoring. One of the issues is the src has a couple unnecessary folders
e.g. "src/Alpha/Beta/ClassGroupFolders". I want to get rid of folders
"Alpha" and "Beta" since they have nothing in them. This means my class
paths will no longer be "Alpha.Beta.ClassGroup.ClassName" They will be
"ClassGroup.ClassName". I moved the ClassGroup folders up two levels and
did a global replace to change "Alpha.Beta.ClassGroup" to just
"ClassGroup" and did the same for "Alpha/Beta/ClassGroup".
Eclipse is showing no errors but when a servlet is being called I'm
getting "HTTP Status 404 - Servlet Logon is not available". It worked
before I changed the folder structure and that is the only change. My
web.xml file has an entry for the servlet that is being called by the form
and the servlet-class node has been updated to match the updated folder
structure. I'm sorry I can't provide more information on how the site is
set up but I can tell you it's not using struts. It's using inline code in
the JSP files for the most part.
What can I do to track down the source of this issue?
Need free download link for Jboss Soa platform 5.3
Need free download link for Jboss Soa platform 5.3
Can any one suggest me the free download link for jboss soa platform 5.3.
I already searched in the redhat site
https://access.redhat.com/site/downloads/ . But i did not find the Jboss
SOA. Please any one suggest me the download link
Thanks, Lalitha
Can any one suggest me the free download link for jboss soa platform 5.3.
I already searched in the redhat site
https://access.redhat.com/site/downloads/ . But i did not find the Jboss
SOA. Please any one suggest me the download link
Thanks, Lalitha
SQL Command Not Properly Ended driving me bananas
SQL Command Not Properly Ended driving me bananas
I am trying to run this query, but i repeatedly get an error message. Any
suggestions?
SELECT DD_INTERVAL, VENDOR_ID, COUNTRY, "SUM"(VOLUME) as Volume,
"SUM"(COST) as Cost
FROM Table_1
WHERE VENDOR_ID ='35', DD_INTERVAL = '7', COUNTRY =
('idn','lao','mys','phl','sgp','tha','vnm')
GROUP BY DD_INTERVAL, Vendor_ID, COUNTRY;
I am trying to run this query, but i repeatedly get an error message. Any
suggestions?
SELECT DD_INTERVAL, VENDOR_ID, COUNTRY, "SUM"(VOLUME) as Volume,
"SUM"(COST) as Cost
FROM Table_1
WHERE VENDOR_ID ='35', DD_INTERVAL = '7', COUNTRY =
('idn','lao','mys','phl','sgp','tha','vnm')
GROUP BY DD_INTERVAL, Vendor_ID, COUNTRY;
Warning: SimpleXMLElement::addAttribute(): string is not in UTF-8
Warning: SimpleXMLElement::addAttribute(): string is not in UTF-8
[Symfony\Component\Debug\Exception\ContextErrorException]
Warning: SimpleXMLElement::addAttribute(): string is not in UTF-8 in
W:\public_html\Project\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Export\Driver\XmlExporter.php
line 162
I have no idea why?
[Symfony\Component\Debug\Exception\ContextErrorException]
Warning: SimpleXMLElement::addAttribute(): string is not in UTF-8 in
W:\public_html\Project\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Export\Driver\XmlExporter.php
line 162
I have no idea why?
Find and return a class based on a string
Find and return a class based on a string
I have multiple classes of the parent class "command_functions"
example
class Empty_Command : command_functions
each of the command classes override a value
public override string command_display_name { get { return "Empty"; } }
is there anyway to search types of command_functions looking for where
command_display_name is set to a matching string and return that.
so I could use it like so
command_functions find = FindCommand("Empty");
if(find != null)
{
new find();
}
I have multiple classes of the parent class "command_functions"
example
class Empty_Command : command_functions
each of the command classes override a value
public override string command_display_name { get { return "Empty"; } }
is there anyway to search types of command_functions looking for where
command_display_name is set to a matching string and return that.
so I could use it like so
command_functions find = FindCommand("Empty");
if(find != null)
{
new find();
}
Building Shared Library from static Library *.a file
Building Shared Library from static Library *.a file
I have read other questions similar to this on stack overflow but they are
not having same like scenario.
I have FreeImage.a(23 MB file ) file which precompild static library for
android. I also have source code of FreeImage Project which have header
files.
I want to build .SO file from (.a) file I have with my JNI
code(FreeImageCompilation.cpp) Below code compiles fine but it does
produces SO File of (5KB only ) whre (*.a file is 23 MB )?
can somebody check if my code below for using *.a file is correct or not ?
In My Android.mk I have following code.
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := FreeImage
LOCAL_SRC_FILES := libFreeImage.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/FreeImage/Source/
include $(PREBUILT_STATIC_LIBRARY)
#My Own SO file
LOCAL_STATIC_LIBRARIES := FreeImage
include $(CLEAR_VARS)
LOCAL_MODULE := FreeImageSo
LOCAL_SRC_FILES := FreeImageCompilation.cpp
LOCAL_STATIC_LIBRARIES := FreeImage
include $(BUILD_SHARED_LIBRARY)
I have read other questions similar to this on stack overflow but they are
not having same like scenario.
I have FreeImage.a(23 MB file ) file which precompild static library for
android. I also have source code of FreeImage Project which have header
files.
I want to build .SO file from (.a) file I have with my JNI
code(FreeImageCompilation.cpp) Below code compiles fine but it does
produces SO File of (5KB only ) whre (*.a file is 23 MB )?
can somebody check if my code below for using *.a file is correct or not ?
In My Android.mk I have following code.
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := FreeImage
LOCAL_SRC_FILES := libFreeImage.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/FreeImage/Source/
include $(PREBUILT_STATIC_LIBRARY)
#My Own SO file
LOCAL_STATIC_LIBRARIES := FreeImage
include $(CLEAR_VARS)
LOCAL_MODULE := FreeImageSo
LOCAL_SRC_FILES := FreeImageCompilation.cpp
LOCAL_STATIC_LIBRARIES := FreeImage
include $(BUILD_SHARED_LIBRARY)
Wednesday, 18 September 2013
JavaScript stack size exceeded when using thick-box for multiple divisions approximately 6K
JavaScript stack size exceeded when using thick-box for multiple divisions
approximately 6K
I have a table displayed on the page with item details displayed . When
total cells are less than 5K then there is no JavaScript error but when
table has 6K rows or more then stack exceeding error occurs and JavaScript
doesn't works.
$(document).ready(function() {
$('body').click(function(e){
var Elem = e.target;
var itemgroup = $(Elem).attr('rel');
var itemid = $(Elem).attr('itemno');
if (Elem.className == 'additem'){
tb_show('Add' ,
'add_item.html'+'?&itemid='+itemid+'&itemgrp='+itemgroup+'&TB_iframe=true&height=420width=500',
'/images/items.jpg');
}
else if (Elem.className == 'showsoldqty'){
tb_show('Show' ,
'show_sold_qty.html'+'?&itemid='+itemid+'&itemgrp='+itemgroup+'&TB_iframe=true&height=420width=500',
'/images/items.jpg');
}
});
The table structure is as mentioned below with one row as sample (the
column in this row is being repeated and displayed more than 6K times) :
<table>
<tr>
<td>
<div class="additem" rel="G1" itemno="21">Add Item</div>
<div class="showsoldqty" rel="G2" itemno="22">Show Sold
Quantity</div>
</td>
</tr>
</table>
approximately 6K
I have a table displayed on the page with item details displayed . When
total cells are less than 5K then there is no JavaScript error but when
table has 6K rows or more then stack exceeding error occurs and JavaScript
doesn't works.
$(document).ready(function() {
$('body').click(function(e){
var Elem = e.target;
var itemgroup = $(Elem).attr('rel');
var itemid = $(Elem).attr('itemno');
if (Elem.className == 'additem'){
tb_show('Add' ,
'add_item.html'+'?&itemid='+itemid+'&itemgrp='+itemgroup+'&TB_iframe=true&height=420width=500',
'/images/items.jpg');
}
else if (Elem.className == 'showsoldqty'){
tb_show('Show' ,
'show_sold_qty.html'+'?&itemid='+itemid+'&itemgrp='+itemgroup+'&TB_iframe=true&height=420width=500',
'/images/items.jpg');
}
});
The table structure is as mentioned below with one row as sample (the
column in this row is being repeated and displayed more than 6K times) :
<table>
<tr>
<td>
<div class="additem" rel="G1" itemno="21">Add Item</div>
<div class="showsoldqty" rel="G2" itemno="22">Show Sold
Quantity</div>
</td>
</tr>
</table>
XSL value-of doesn't seem to get value from the xml
XSL value-of doesn't seem to get value from the xml
I have an xml file which contains following:
<?xml version="1.0"?>
<mods xmlns="http://www.loc.gov/mods/v3"
xmlns:mods="http://www.loc.gov/mods/v3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xlink="http://www.w3.org/1999/xlink">
<titleInfo><title>A-Title-01</title></titleInfo>
</mods>
And an XSL file:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<h2>Description</h2>
<p>Hello</p>
<p><xsl:value-of select="titleInfo/title"/></p>
</xsl:template>
</xsl:stylesheet>
My problem is I don't get the title value in the xHTML. I could only see
Description
Hello
But If I remove default namespace from the xml like this:
<?xml version="1.0"?>
<mods xmlns:mods="http://www.loc.gov/mods/v3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xlink="http://www.w3.org/1999/xlink">
<titleInfo><title>A-Title-01</title></titleInfo>
</mods>
and change the style sheet's match to <xsl:template match="/mods"> I can
see the title value.
But I can not remove the default namespace from the xml because xml is
generated by a form and it won't work if I remove the default namespace. I
don't even have a clue how to get around this or if I am doing something
wrong. Please help.
Thanks in Advance.
I have an xml file which contains following:
<?xml version="1.0"?>
<mods xmlns="http://www.loc.gov/mods/v3"
xmlns:mods="http://www.loc.gov/mods/v3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xlink="http://www.w3.org/1999/xlink">
<titleInfo><title>A-Title-01</title></titleInfo>
</mods>
And an XSL file:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<h2>Description</h2>
<p>Hello</p>
<p><xsl:value-of select="titleInfo/title"/></p>
</xsl:template>
</xsl:stylesheet>
My problem is I don't get the title value in the xHTML. I could only see
Description
Hello
But If I remove default namespace from the xml like this:
<?xml version="1.0"?>
<mods xmlns:mods="http://www.loc.gov/mods/v3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xlink="http://www.w3.org/1999/xlink">
<titleInfo><title>A-Title-01</title></titleInfo>
</mods>
and change the style sheet's match to <xsl:template match="/mods"> I can
see the title value.
But I can not remove the default namespace from the xml because xml is
generated by a form and it won't work if I remove the default namespace. I
don't even have a clue how to get around this or if I am doing something
wrong. Please help.
Thanks in Advance.
Why do I get 'undefined method `>=' for nil:NilClass' in do loop?
Why do I get 'undefined method `>=' for nil:NilClass' in do loop?
I have the following data architecture:
:tplangroups has_many :tplans
:tplans belongs_to :tplangroups
:tplans has attr_accessible :favrank
I need to get the id of the tplan with the highest favrank from each
tplangroup, this routine below is how I'm trying to accomplish that:
<% @tplangroups.each_with_index do |tplangroup, index| %>
<% @highest_favrank = 0 %>
<% @highest_id = tplangroup.tplans[0] %>
<% tplangroup.tplans.each do |tplan| %>
<% if tplan.favrank >= @highest_favrank %>
<% @highest_favrank = tplan.favrank %>
<% @highest_id = tplan.id %>
<% end %>
<% end %>
#does stuff with tplangroup
<% end %>
However, I keep getting the following error:
undefined method `>=' for nil:NilClass
Any ideas? I really have no idea why it's throwing this error. I know that
all of the attributes/variables I am referencing have values, I have
tested this. I am not sure where I'm going wrong, thanks in advance!
I have the following data architecture:
:tplangroups has_many :tplans
:tplans belongs_to :tplangroups
:tplans has attr_accessible :favrank
I need to get the id of the tplan with the highest favrank from each
tplangroup, this routine below is how I'm trying to accomplish that:
<% @tplangroups.each_with_index do |tplangroup, index| %>
<% @highest_favrank = 0 %>
<% @highest_id = tplangroup.tplans[0] %>
<% tplangroup.tplans.each do |tplan| %>
<% if tplan.favrank >= @highest_favrank %>
<% @highest_favrank = tplan.favrank %>
<% @highest_id = tplan.id %>
<% end %>
<% end %>
#does stuff with tplangroup
<% end %>
However, I keep getting the following error:
undefined method `>=' for nil:NilClass
Any ideas? I really have no idea why it's throwing this error. I know that
all of the attributes/variables I am referencing have values, I have
tested this. I am not sure where I'm going wrong, thanks in advance!
I would like to set my variables at the top of my class instead of in the method
I would like to set my variables at the top of my class instead of in the
method
I can't seem to tackle this confusing problem, I have lots and lots of
things that I would like to add at the top of my class to help cut down on
clutter.
Since multiple methods use these checkbox variables.
I would like to have everything at the top directly under the opening
bracket.
Here's what works, but not what I want.:
public class MyClass extends Activity implements View.OnClickListener {
//leaving out most code like onCreate. Just pretend it's there.
public void checkboth(View view) {
CheckBox cb1 = (CheckBox) findViewById(R.id.cb1);
CheckBox cb2 = (CheckBox) findViewById(R.id.cb2);
cb1.setchecked(true);
cb2.setchecked(true);
}
@Override
public void onClick(View v) {
}
}
But for the life of me I can't figure out why I can't do this:
public class MyClass extends Activity implements View.OnClickListener {
CheckBox cb1 = (CheckBox) findViewById(R.id.cb1);
CheckBox cb2 = (CheckBox) findViewById(R.id.cb2);
//leaving out most code like onCreate. Just pretend it's there.
public void checkboth(View view) {
cb1.setchecked(true);
cb2.setchecked(true);
}
@Override
public void onClick(View v) {
}
}
method
I can't seem to tackle this confusing problem, I have lots and lots of
things that I would like to add at the top of my class to help cut down on
clutter.
Since multiple methods use these checkbox variables.
I would like to have everything at the top directly under the opening
bracket.
Here's what works, but not what I want.:
public class MyClass extends Activity implements View.OnClickListener {
//leaving out most code like onCreate. Just pretend it's there.
public void checkboth(View view) {
CheckBox cb1 = (CheckBox) findViewById(R.id.cb1);
CheckBox cb2 = (CheckBox) findViewById(R.id.cb2);
cb1.setchecked(true);
cb2.setchecked(true);
}
@Override
public void onClick(View v) {
}
}
But for the life of me I can't figure out why I can't do this:
public class MyClass extends Activity implements View.OnClickListener {
CheckBox cb1 = (CheckBox) findViewById(R.id.cb1);
CheckBox cb2 = (CheckBox) findViewById(R.id.cb2);
//leaving out most code like onCreate. Just pretend it's there.
public void checkboth(View view) {
cb1.setchecked(true);
cb2.setchecked(true);
}
@Override
public void onClick(View v) {
}
}
re-using ServiceStack DTO in C# client
re-using ServiceStack DTO in C# client
I've successfully created the Hello World example from the ServiceStack
web site and modified it for my needs. Read: Basic authentication, a bit
of database access. etc.
I'd like to access the hello service from the test client
[Authenticate]
[Route("/hello/{Name}")]
public class HelloRequest : IReturn<HelloResponse>
{
public string Name { get; set; }
}
public class HelloResponse
{
public string Result { get; set; }
}
public class HelloService : Service
{
public object Any(HelloRequest request)
{
var userSession = SessionAs<CustomUserSession>();
var roles = string.Join(", ", userSession.Roles.ToArray());
return new HelloResponse { Result = "Hello, " + request.Name + ",
your company: " + userSession.CompanyName};
}
}
I see a few examples out there which appear to be using the "HelloRespnse"
and "Hello" types, but I cannot quite figure out how one would properly
import the DTO(s) created in the service. From the ServiceStack wiki:
HelloResponse response = client.Get(new Hello { Name = "World!" });
response.Result.Print();
So the summary of my question: How do I easily re-use DTOs created in my
service within a C# client?
Sorry in advance for my lack of totally understanding SS and thanks for
the help.
I've successfully created the Hello World example from the ServiceStack
web site and modified it for my needs. Read: Basic authentication, a bit
of database access. etc.
I'd like to access the hello service from the test client
[Authenticate]
[Route("/hello/{Name}")]
public class HelloRequest : IReturn<HelloResponse>
{
public string Name { get; set; }
}
public class HelloResponse
{
public string Result { get; set; }
}
public class HelloService : Service
{
public object Any(HelloRequest request)
{
var userSession = SessionAs<CustomUserSession>();
var roles = string.Join(", ", userSession.Roles.ToArray());
return new HelloResponse { Result = "Hello, " + request.Name + ",
your company: " + userSession.CompanyName};
}
}
I see a few examples out there which appear to be using the "HelloRespnse"
and "Hello" types, but I cannot quite figure out how one would properly
import the DTO(s) created in the service. From the ServiceStack wiki:
HelloResponse response = client.Get(new Hello { Name = "World!" });
response.Result.Print();
So the summary of my question: How do I easily re-use DTOs created in my
service within a C# client?
Sorry in advance for my lack of totally understanding SS and thanks for
the help.
Subscribe to:
Posts (Atom)