I hava grid containing a column for displaying countrynames. I need to display value in that column as contrycode-first 10 letters of country name (in-India) .I tried it using Eval functions with in the item template:
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="CountryNameLabe" runat="server" Text='<%# Eval("CorporateAddressCountry").SubString(0,6) %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
But it shows error.
Can i use custom functions in eval?
please help
I'm trying to make a text as big as I can making it fit a Rect.
basically I use a StaticLayout for pre-calculate the text size and make it fit the Rect's height:
// Since the width is fixed for the StaticLayout it should only fit the height
while (currentHeight>Rect.getHeight()){
size-=2;
}
textPaint.setTextSize(size);
The problem is that if the Rect is very high, the exit condition is reached but breaking the words (see the capture). Is there a way for avoid this?
Goal:
Actual:
Current code:
textSize=MAX_TEXT_SIZE
do {
if (textSize < mMinTextSize) {
Log.i(TAG, "Min reached");
textSize = mMinTextSize;
textPaint.setTextSize(textSize);
fits = true;
} else {
textPaint.setTextSize(textSize);
StaticLayout layout = new StaticLayout(text, textPaint, targetWidth, Alignment.ALIGN_NORMAL, 1.0,
0, true);
layout.draw(canvas);
float heightRatio= (float) layout.getHeight() / (float) targetHeight;
boolean fitsHeight = heightRatio<= 1f;
if (fitsHeight) {
fits = true;
} else {
textSize -= 2;
}
}
Log.i(TAG, "textSize=" + textSize + " fits=" + fits);
} while (!fits);
thanks
I want to find the current selection of the data table whenever a selection changes. I can update other items using:
<a4j:ajax render=":tmp,:tmp2" event="selectionchange">
But I cannot find the current selection - I think the major issue is that the UIExtendedDataTable backing does not get updated on the Ajax request. Is there a way to update the current selection on a selectionchange (Using RichFaces 4)?
Hi,
I have 3 tables:
Countries:
Code, Name
Vacances:
id(autoincrement),CountryCode, NameOfCountry, numberOfdays
How to foreach country insert Row:
countryCode,'Welcome in " + nameofCountry +"!",12
document.write("window.location.href");&layout=button_count&show_faces=true&width=450&action=like&font=arial&colorscheme=light&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px;" allowTransparency="true"
i am trying to bind current url of my page to this html
how can i do that
I have a class that stores data in asp.net c# application that never changes. I really don't want to put this data in the database - I would like it to stay in the application. Here is my way to store data in the application:
public class PostVoteTypeFunctions
{
private List<PostVoteType> postVotes = new List<PostVoteType>();
public PostVoteTypeFunctions()
{
PostVoteType upvote = new PostVoteType();
upvote.ID = 0;
upvote.Name = "UpVote";
upvote.PointValue = PostVotePointValue.UpVote;
postVotes.Add(upvote);
PostVoteType downvote = new PostVoteType();
downvote.ID = 1;
downvote.Name = "DownVote";
downvote.PointValue = PostVotePointValue.DownVote;
postVotes.Add(downvote);
PostVoteType selectanswer = new PostVoteType();
selectanswer.ID = 2;
selectanswer.Name = "SelectAnswer";
selectanswer.PointValue = PostVotePointValue.SelectAnswer;
postVotes.Add(selectanswer);
PostVoteType favorite = new PostVoteType();
favorite.ID = 3;
favorite.Name = "Favorite";
favorite.PointValue = PostVotePointValue.Favorite;
postVotes.Add(favorite);
PostVoteType offensive = new PostVoteType();
offensive.ID = 4;
offensive.Name = "Offensive";
offensive.PointValue = PostVotePointValue.Offensive;
postVotes.Add(offensive);
PostVoteType spam = new PostVoteType();
spam.ID = 0;
spam.Name = "Spam";
spam.PointValue = PostVotePointValue.Spam;
postVotes.Add(spam);
}
}
When the constructor is called the code above is ran. I have some functions that can query the data above too. But is this the best way to store information in asp.net? if not what would you recommend?
In my application I have this code in my view model:
hiddenTextContainer.PreHideVerticalOffset = VerticalOffset;
hiddenTextContainer.HiddenText = Text.Remove(SelectionStart, SelectionLength);
hiddenTextContainer.HasHiddenText = true;
hiddenTextContainer.NonHiddenTextStart = SelectionStart;
Text = Text.Substring(SelectionStart, SelectionLength);
SelectionStart = Text.Length;
hiddenTextContainer.ImmediatePostHideVerticalOffset = VerticalOffset;
This code is used to hide selected text in a textbox. Text is a string property data bound to the text property of a textbox and VerticalOffset is a double property data bound to the VerticalOffset property of that same textbox.
I need to save the VerticalOffset before and after the hiding of selected text takes place, but with my code below both hiddenTextContainer.PreHideVerticalOffset and hiddenTextContainer.ImmediatePostHideVerticalOffset are always set to the same value no matter what.
I have figured out that this is because the text of the textbox has not been updated by the time the code reaches:
hiddenTextContainer.ImmediatePostHideVerticalOffset = VerticalOffset;
Is there any way I can fix this?
I've got in-memory dataset with some table defined and I populate this table in a following way:
for(...)
ds.Fields.AddFieldsRow(++j, 0, heading, "Char", "", "", "Input", 0, "","","");
On the GUI I've got DataGridView bound to that table inside TabControl (bound through BindingSource).
Very strange thing is happening: if I open tab pane with this grid and populate table with some data then I see changes in grid. On the other side if I'm at other tab, populate table, and then switch to tab with grid I've got following exception: "DataMember property 'Fields' cannot be found on the DataSource".
In similar way I've got 2 tab panes with grid in each that are bound to the same datatable using different datasources and I open one of them, populate, see the changes, then switch to second tab and get crash.
What am I missing?
How can I achieve this with mod_rewrite?
from:
.com/index.php?menu=home
to:
.com/home
AND
from:
.com/index.php?menu=home&list=hello
to:
.com/home/hello
ALSO (without the folder hierarki)
from:
.com/index.php?menu=home&list=hello
to:
.com/hello
I'm using this for the first one:
RewriteRule ^([^/\.]+)/?$ index.php?menu=$1 [L]
But how to I connect them if there are multiple variables?
Tried this:
RewriteRule ^([^/]*)/([^/]*)?$ index.php?home=$1&list=$2
I'm trying to port the unix utility ldd to windows, because dependency walker and cygcheck don't quite give me the usage I'm looking for. (also for the learning experience)
Ive been looking all over MSDN, for a windows API that lists dll dependencies of an executable, or even the storage format in the complied exe (just to filter it out), but I've been unable to find anything.
If anyone knows what API call windows uses for listing modules to load, or what patterns I can search for in an executable to find modules to load, please help me out
:)
thanks!
-note: I'm not looking to profile for dynamic modules, just list the ones that are required at runtime
I have an application that has a Service uses a ArrayList to store in the background for a very long time, the variable is initialized when the service started. The service is in the background and there will be frequent access to the variable (that's why i don't want to use file management or settings since it will be very expensive for a file I/O for the sake of battery life). The variable will likely to be ~1MB-2MB over its life tie. Is it safe to say that it will never be nulled by GC or the system or is there any way to prevent it? Thanks.
I am using MySQL server on Ubuntu 10.04 and after changing the bind-address from 127.0.0.1 to my webserver IP in /etc/mysql/my.cnf the mysql server fails to load. Any clues will be highly appreciated!
I have tried disabling iptables but useless
Thanks,
If you use dynamic pages like JSP or asp.net, you can have your page template included, and then content added. But what if you have no server-side component and all pages are just HTML/JS? You can of course create a template then copy it for each page, but then if you want to change something you risk having to modify every page, even if you put most styling in CSS properly.
Are there any non-awful ways to do this? I could see that an iframe could be used to load the content into the central page but that sounds nasty. Does HTML provide any way to include a base file and add to it?
Is there a way to change order in which the default binder binds property values of model?
For example I have model class A:
class A
{
public string A1 {get; set;}
public string A2 {get; set;}
}
and action DoSomethig:
public ActionResult DoSomething(A model)
{
...
}
I want that A2 property has been bound before the A1 property. Is it possible? Or I need to write custom binder?
I have there domain classes:
:: Person. (Person.ID, Name,Address)
:: Designation.(Designation.ID, Title, Band)
:: SalarySlip (Person.ID, Designation.ID, totalIncome, Tax etc etc.)
In the update method the person controller when I assign a person a designation from a list of designation values I want to insert a new record inside SalarySlip.
Something like:
def update = {
def SalarySlipInstance = new SalarySlip()
SalarySlipInstance.Person.ID = Params.ID //is this correct?
SalarySlipInstance.Designation.ID = ?? //since the value is coming from a list. How can I bind this field?
}
Much Appreciated,
Thanks,
WB
I am curious whether it is possible to determine the maximum size that an array can have in C++.
#include <iostream>
using namespace std;
#define MAX 2000000
int main()
{
long array[MAX];
cout << "Message" << endl;
return 0;
}
This compiles just fine, but then segfaults as soon as I run it (even though array isn't actually referenced). I know it's the array size too because if I change it to 1000000 it runs just fine.
So, is there some define somewhere or some way of having #define MAX MAX_ALLOWED_ARRAY_SIZE_FOR_MY_MACHINE_DEFINED_SOMEWHERE_FOR_ME?
I don't actually need this for anything, this question is for curiosity's sake.
Hello all,
I develop the part of app functionality. I have the databinding object 'A' and another object 'B'.
public class SomeProxy
{
public SomeProxy(BindingSource A)
{
var b = new B();
}
}
public class B
{
public int SomePropertyFromA{get;set;}
//Some autocalculated propeties, that are based on SomePropertyFromA
//I want to reculculate them, when the SomePropertyFromA will be changed
}
'B' object culculates some values, based on the property 'a' of the 'A' object.
I want to bind property in object 'B' to the same property 'a' in 'A'. It's need to handle on changes of the 'a' property, because some UI controls are binded to 'B'-s properties.
How can I do this?
Sorry for some oddness. Thanks
Is it possible to set the IP address of an interface in Android within an application? I can query the available interfaces and their current addresses using java.net.NetworkInterface, but this doesn't provide a facility to change these. Did I just miss something somewhere or is it not allowed?
I was hoping to be able to make my application either change or add an alias to one or more of the existing interfaces at runtime on an "off the shelf" device. (2.1/2.2). Ideally I'd like to do this for both IPv4 and v6 addresses.
Hello all,
I have been told its better to bind events to elements rather than having onclicks with functions everywhere. I agree with this as it devolves more from the HTML which means cleaner and easier to debug code.
But I am having trouble doing this! I loop through some data with PHP (see below) and I currently use onclick to call a function. How can I bind this onclick event to many elements using JQuery.
<?php foreach($main_tags as $key=>$value){ ?>
<li>
<a id="<?php echo $key; ?>" href="#" onclick="tag_search('<?php echo $key; ?>'); return false;">
<?php echo $key; ?>
<span class="num-active">
<?php echo $value; ?>
</span>
</a>
</li>
<?php } ?>
Thanks all for any help
Hello everyone I am new to blackberry and I want a textfield that scroll it's text i.e greater than the preferred width horizontally , also able to show label out side the text draw area ( e.g. on the left side). Please help me.
I am developing a project in asp.net web forms. I have a little problem. Whent the page load, I load some data from the dabase and present it on the page. On the same page I have form where I can input some textobox and with the click on the button make update on the same data in the database whis is at the first time loaded on the same page?
The date is update, I can see it in SQL SERVER, but on the web page not. Its still the old data presents.
After I close my application and run it again, then the new data appears on the page.
Hi all,
I am currently having a problem since the DB has been changed.
I am using Datasets for a c# application, and there is a user management system.
For the security issues, our current DB design is like
user log into app.
DB returns a session ID
On use of any other stored procedures, a session ID must be specified.
BUT, the DB didn't request session ID before.
since I am using the datasets, I used update/insert/delete stored procedures with
"TableAdaptor Configuration Wizard".
Bind Commands to Existing Stored Procedures
(choose stored procedures to call and specify any reuiqred parameters)
Now, it seems like I have to specify session ID for Insert/Update/Delete stored procedures.
How do I specify session ID parameter here?
It seems like I have to pick one return parameter variable from a select statement.
Thanks,
Here is my problem. I have a list of models that are displayed to the user. On the left is a checkbox for each model to indicate that the user wants to choose this model (in this case, we're building products a user can add to their shopping cart). The model has no concept of being chosen...it strictly has information about the product in question.
I've talked with a few other developers after having gone through and the best I could come up with is getting the formcollection and string parsing the key values to determine whether the checkbox is checked or not. This doesn't seem ideal. I was thinking there would be something more strongly bound, but I can't figure out a way to do it.
I tried creating another model that had a boolean property to represent being checked and a property of the model and passing a list of that model type to the view and creating a ActionResult on the controller that accepts a list of the new model / checked property, but it comes back null. Am I just thinking too much like web forms and should just continue on with parsing checkbox values?
Here's what I've done for wrapping the models inside a collection:
public class SelectableCollection[T] : IList[T] {}
public class SelectableTrack{
public bool IsChecked{get;set;}
public bool CurrentTrack{get;set;}
}
For the view, I inherit from
ViewPage[SelectableCollection[SelectableTrack]]
For the controller, I have this as the ActionResult:
[HttpPost]
public ActionResult SelectTracks(SelectableCollection sc) {
return new EmptyResult();
}
But when I break inside the ActionResult, the collection is null. Any reason why it isn't coming through?
do you got the solution for your problem ?
im working on the exact same thing and cant get it to work...
if u could post the solution, it would be much appreciated :o
greetingz
msn: [email protected]
steam : [email protected]