What useful css classes do you keep in your stylesheet? to use in every project. and with semantic names.
is right-bdr, bdr-bottom2px are good class names
I have the following 2 macros:
#define SCOPED_ENUM_HEADER(NAME) struct NAME{ enum _NAME{
#define SCOPED_ENUM_FOOTER(NAME) };}; typedef NAME::_NAME NAMEtype;
Only the first instance of NAME get replaced by the passed NAME. What's wrong with it?
Is is to be used in such a way:
SCOPED_ENUM_HEADER(LOGLEVEL)
UNSET,
FILE,
SCREEN
SCOPED_ENUM_FOOTER(LOGLEVEL)
Thanks you
I'm trying to have method void run( string method ) which would run method in that class. For example:
class Foo {
public:
void run( string method ) {
// this method calls method *method* from this class
}
void bar() {
printf( "Function bar\n" );
}
void foo2() {
printf( "Function foo2\n" );
}
}
Foo foo;
int main( void ) {
foo.run( "bar" );
foo.run( "foo2" );
}
this would print:
Function bar
Function foo2
Thanks! :)
Hi,
What's the best way to implement showing a number in a small circle on a UITableView row, much like is seen on the 'Inbox' row in the image below?
Thanks,
Lets say I have a simple Enum called Animal defined as:
public enum Animal {
CAT, DOG
}
and I have a method like:
private static Object valueOf(String value, Class<?> classType) {
if (classType == String.class) {
return value;
}
if (classType == Integer.class) {
return Integer.parseInt(value);
}
if (classType == Long.class) {
return Long.parseLong(value);
}
if (classType == Boolean.class) {
return Boolean.parseBoolean(value);
}
// Enum resolution here
}
What can I put inside this method to return an instance of my enum where the value is of the classType?
I have looked at trying:
if (classType == Enum.class) {
return Enum.valueOf((Class<Enum>)classType, value);
}
But that doesn't work.
`public void SeparateData()
{
//read file
StreamReader sr = new StreamReader("myTextFile.txt");
//string to hold line
string myline;
myline = sr.ReadLine();
while ((myline = sr.ReadLine()) != null)
{
string[] lines = Regex.Split(myline, " ");
foreach (string s in lines)
{
using (StreamWriter sw = new StreamWriter("myTextFile.txt"))
sw.WriteLine(lines);
}
}
} `
I have added some UIButton objects into .xib file, and some UIButton objects with the code.
But now I am facing one problem. While Zooming the UIImageView the UIButtons that are added through code are shown on the UIImageView and those that are added with .xib file are below the UIImageView.
Code for UIButtons added with code:
btnBrightness = UIButton.FromType (UIButtonType.RoundedRect);
btnBrightness.Frame = new RectangleF (540, 20, 95, 37);
btnBrightness.SetTitle ("Brightness", UIControlState.Normal);
More details:
monotouch
I have a checkboxes on my site that when unchecked, update their row in in the db as unchecked, and if checked,update their row in the db as checked. I am creating an ifstatement that will commence with its command if checked, and not if unchecked. I have echoed the variable and it is holding the proper value (checked or unchecked) but not sure if I am syntactically correct on displaying the state of the row in the db.
This is what I am trying and will not work. I am new at php still and thank you very much for any help.
if($auth->check_prof == 'checked'){// do the stuff in here}
I have a model called "Activity" in my django app. in the admin interface, it appears on the screen as "Activitys". how can I override the label on the admin page to make it "Activities" instead?
I see in the archives how to do this for a field, but not for a model itself. thanks!
Hi, I have a site setup that is working fine in ie8 and firefox but as you can see here:
http://i36.tinypic.com/nzq63m.jpg
Is this an issue with some css or a png transparency? Or is this just something with IE7.
Thanks in advance :)
Hi all,
Does anyone here know how to set up a pager_query() to automatically go to the last page of the query when the page is displayed? I'm using theme_pager() to format the page.
I have the following 2 macros:
#define SCOPED_ENUM_HEADER(NAME) struct NAME{ enum _NAME{
#define SCOPED_ENUM_FOOTER(NAME) };}; typedef NAME::_NAME NAMEtype;
Only the first instance of NAME get remplaced by the passed NAME. What's wrong with it?
Is is to be used in such a way:
SCOPED_ENUM_HEADER(LOGLEVEL)
UNSET,
FILE,
SCREEN
SCOPED_ENUM_FOOTER(LOGLEVEL)
Thanks you
I've got a Dictionary<string, string> and would like to have the user to see and edit the content, possibly adding new entries. How should I do that?
Input verification, handling dynamic updates of the source Dictionary and looking nice are a bonus.
Eg:
$variable = "10000";
for($i=0; $i<3;$i++)
{
$variable++;
$file = $variable."."."txt";
open output,'>$file' or die "Can't open the output file!";
}
This doesn't work. Please suggest a new way.
I happened to be working on a Singleton class in ruby and just remembered the way it works in factory_girl. They worked it out so you can use both the long way Factory.create(...) and the short way Factory(...) I thought about it and was curious to see how they made the class Factory also behave like a method.
They simply used Factory twice like so:
def Factory (args)
...
end
class Factory
...
end
My Question is: How does ruby accomplish this? and Is there danger in using this seemingly quirky pattern?
showDescriptionPath is being passed from the previous Tableview. The text shows up, but the entire path prints in the UITextField instead of just the value of "Description" in my plist.
NSString *DescriptionPath = [[NSBundle mainBundle] bundlePath];
NSString *DescriptionInfoPath = [DescriptionPath stringByAppendingPathComponent:showDescriptionInfo];
showDescription.text = [[NSString alloc] initWithFormat:@"%@",DescriptionInfoPath];
So I know the convention for naming M-M relationship tables in SQL is to have something like so:
For tables User and Data the relationship table would be called
UserData
User_Data
or something similar (from here)
What happens then if you need to have multiple relationships between User and Data, representing each in its own table? I have a site I'm working on where I have two primary items and multiple independent M-M relationships between them. I know I could just use a single relationship table and have a field which determines the relationship type, but I'm not sure whether this is a good solution. Assuming I don't go that route, what naming convention should I follow to work around my original problem?
I am trying to run this code on my blakberry simulator, but it will not appear on the main menu. Can anybody please help me out.
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.MainScreen;
public class FirstScreen extends MainScreen implements FieldChangeListener {
ButtonField theButton;
public FirstScreen() {
add(new LabelField("First Screen"));
theButton = new ButtonField("New Screen", ButtonField.CONSUME_CLICK);
theButton.setChangeListener(this);
add(theButton);
}
public void fieldChanged(Field field, int context) {
if (field == theButton) {
UiApplication.getUiApplication().pushScreen(new SecondScreen());
}
}
public class SecondScreen extends MainScreen {
public SecondScreen() {
add(new LabelField("Second Screen"));
}
}
}
As you can imagine, Googling or Binging for any phrase containing an '@' is difficult.
In creating a new web service, one of the members of the imported C# proxy class is prefixed with the @. For example:
plan.@event = new Insurance.Event();
I assume that it is Visual Studio's way resolving potential conflicts with reserved words because 'event' is a reserved word. Changing the property in the web service interface to something other than 'event' (i.e. 'healthevent') removes the @ from the property. Is this a correct assumption?
Hi,
Is there a way to search the DOM for an element with a particular stylename class? Something like:
var node = document.findByClassName("foo");
if so, will this be extremely slow if my page has like 2000 elements in it or so?
Thanks
For some odd reason the part where objects are shown and hidden in my script doesn't seem to be working. I'm not sure if its the fact firefox doesn't like that or whether its the function-based code I have (to save duplicating lines of code)?
There is a working example here and the javascript is here
All help appreciated
This is my code:
class Base { /* something */ };
class Derived : public Base { /* something */ };
vector<Base*> v; // somebody else initializes it, somewhere
int counter = 0;
for (vector<Base*>::iterator i=v.begin(); i!=v.end(); ++i) {
if (typeof(*i) == "Derived") { // this line is NOT correct
counter++;
}
}
cout << "Found " << counter << " derived classes";
One line in the code is NOT correct. How should I write it properly? Many thanks in advance!