text = text.replace(/\.(?=[a-zA-Z0-9\[])/g, "<span style='background-color: #FF00FF'>.</span>");
I want to use javascript to highlight all full stops that is followed by letters, numbers and [. The above expression works for letters and numbers, but not bracket. Any idea what's wrong?
I've a main method using SchemaUpdate to display at the console what tables to alter/create and it works fine in my Hibernate project:
public static void main(String[] args) throws IOException {
//first we prepare the configuration
Properties hibProps = new Properties();
hibProps.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("jbbconfigs.properties"));
Configuration cfg = new AnnotationConfiguration();
cfg.configure("/hibernate.cfg.xml").addProperties(hibProps);
//We create the SchemaUpdate thanks to the configs
SchemaUpdate schemaUpdate = new SchemaUpdate(cfg);
//The update is executed in script mode only
schemaUpdate.execute(true, false);
...
I'd like to reuse this code in a JPA project, having no hibernate.cfg.xml file (and no .properties file), but a persistence.xml file (autodetected in the META-INF directory as specified by the JPA spec).
I tried this too simple adaptation,
Configuration cfg = new AnnotationConfiguration();
cfg.configure();
but it failed with that exception.
Exception in thread "main" org.hibernate.HibernateException: /hibernate.cfg.xml not found
Has anybody done that?
Thanks.
Hi
I have a form field which requires a json object as its value when it is rendered.
When the form is submitted it returns a comma seperated string of ids as its value (not a json string). however if the form does not validate i want to turn this string of ids back into a json string so it will display properly (is uses jquery to render the json object correctly).
how would i do this?
I was thinking of overwriting the form.clean method but when I tried to change self.data['fieldname'] I got the error 'This QueryDict instance is immutable'
and when i tried to change self.cleaned_data['fieldname'] it didn't make a difference to the value of the field.
Thanks
Hye Guys,
I'm busy working on a time series and am trying to find the commands that allow me to insert a quarter count variable. To keep things simple, the third quarter of 1995 (date my observations start) should be quarter -2, the fourth quarter of 1995 should be -1 etc etc uptill 2006 (should be somewhere around 45 by then). My dates are in date9 format, such as 20JUN04 etc..
Anyone who can help me with the commands I need t o let this work in SAS?
Thanks
A quartz scheduler is being used in an Application I am working on. A process that runs using the quartz scheduler spawns new threads. I was wondering if it is possible for these threads to continue living after the server is killed?
Ok so I have a problem with getline.
I have a file that contains a couple strings. I created it by myself and I have each string on a seperate line.
Ex. textfile.txt
Line 1
Line 2
Line 3
Line 4
//Little snip of code
ifstream inFile("textfile.txt");
getline(inFile, string1);
When I debug the program and ask it to print out string1 it shows that "Line 1\r" is saved into string1. I understand that it's from me actually hitting enter when I created the file. This problem causes my program to have a segmentation fault. I know my code works because if I use ofstream to write the file first and then i read it in, it works.
So for my quesiton, is their anyway to use the getline function without it picking up the escape sequence \r? If i am not clear just let me know.
Hi
I have a ol list:
<ol>
<li class="group1">item 1</li>
<li class="group1">item 2</li>
<li class="group2"> item 3</li>
<li class="group3">item 4</li>
<li class="group1">item 5</li>
<li class="group3"> item 6</li>
<ol>
and a set of checkboxes which correspond to the class names
<input type="checkbox" value="group1" />group 1
<input type="checkbox" value="group2" />group 2
<input type="checkbox" value="group3" />group 3
What I want to happen is that when a user clicks on a checkbox to 'tick' it, any li rows which are not checked are fadedOut (change opacity) and then any rows which have the class which matches the value of the checkbox are highlighter (background colour changed to yellow).
So for example if group 3 was clicked, item 4 and item 6 would be highlighted. Then if group 2 was clicked item 3 would be highlighted (item 4 and 6 would remain highlighted). If group 2 was un-ticked, item 3 would become faded out although item 4 and 6 would remain highlighted.
The code I have at the moment is:
$('input').click(function(){
input = $(this);
classVal = "." + input.val();
elements = $(classVal );
if (input.is(':checked')) {
elements.css("background-color", "#FFFF00");
} else {
elements.css("background-color", "");
}
});
This handles the highlighting but does not do the fading of the unchecked elements. I know I can change the opacity using css("opacity", 0.33) or fadeTo("slow", 0.33) but not sure how to handle this in the code and where to put it.
If any of my other code can be tidied up also please let me know
Thanks
Let's say I want to make a simple project tracking system. A manager can create a project. Then he can create tasks for that project. Team members can record the hours they work for each task or for the project as a whole.
Is the following design for the t_timesheet table a good idea?
timesheet_id - primary key, autoincrement
project_id - not null, foreign key constraint to t_project
task_id - nullable, foreign key constraint to t_task
user_id - not null, foreign key constraint to t_user
hours - decimal
Or should I do something like this:
timesheet_id - primary key, autoincrement
task_id - not null, foreign key constraint to t_task
user_id - not null, foreign key constraint to t_user
hours - decimal
In the second option, I intend to always have a record in t_task labelled "miscellaneous items" with a foreign key to the relevant t_project record. Then I'll be able to track all hours for a project that aren't for any particular task.
Are any of the ideas above good? What would be better?
Hello I have a string and when i try to use replace method in for loop it doesn't work
String phrase="hello friend";
String[] wordds=phrase.split(" ");
String newPhrase="sup friendhello weirdo";
for (int g=0;g<2;g++)
{
finalPhrase+=newPhrase.replace(wordds[g],"");}
}
System.out.println(finalPhrase)
It prints out "sup hello weirdo" and i expect it to print "sup weirdo".
What am i doing wrong?
I want to add a UISlider to my app programmatically without using the IB.
I am adding a UISlider to my UIViewController using the code below. However I don't see the slider when the view comes up. What am I missing? I am using iPhone SDK 3.1.2.
Appreciate any help.
@synthesize slider;
....
- (void)viewDidLoad {
...
...
slider = [[UISlider alloc] initWithFrame: CGRectMake(0, 480 - 80, 300, 20)];
slider.minimumValue = 0.0;
slider.maximumValue = 100.0;
slider.tag = 0;
slider.value = 50;
slider.continuous = YES;
slider.enabled = YES;
[slider addTarget:selfaction:@selector(handleSlider:)forControlEvents:UIControlEventValueChanged];
self.view addSubview:slider];
In the .h file
...
UISlider *slider;
...
@property (nonatomic, retain) UISlider *slider;
- (void) handleSlider:(id)sender;
Hi there.
I'm currently busy working on an IP ban tool for the early versions of Call of Duty 1. (Apparently such a feature wasn't implemented in these versions).
I've finished a single threaded application but it won't perform well enough for multiple servers, which is why I am trying to implement threading.
Right now, each server has its own thread. I have a Networking class, which has a method; "GetStatus" -- this method is synchronized. This method uses a DatagramSocket to communicate with the server. Since this method is static and synchronized, I shouldn't get in trouble and receive a whole bunch of "Address already in use" exceptions.
However, I have a second method named "SendMessage". This method is supposed to send a message to the server. How can I make sure "SendMessage" cannot be invoked when there's already a thread running in "GetStatus", and the other way around? If I make both synchronized, I will still get in trouble if Thread A is opening a socket on Port 99999 and invoking "SendMessage" while Thread B is opening a socket on the same port and invoking "GetStatus"? (Game servers are usually hosted on the same ports)
I guess what I am really after is a way to make an entire class synchronized, so that only one method can be invoked and run at a time by a single thread.
Hope that what I am trying to accomplish/avoid is made clear in this text.
Any help is greatly appreciated.
I have a User object, that is related to a Post object via two different association paths:
Post --(has_many)-- comments --(belongs to)-- writer (of type User)
Post --(belongs to)-- writer (of type User)
Say the following hold:
user1.name == "Bill"
post1.comments[1].writer == user1
post1.writer == user1
Now when I retrieve the post1 and its comments from the database and I update post1.comments[1].writer like so:
post1.comments[1].writer.name = "John"
I would expect post1.writer to equal "John" too. But it doesn't! It still equals "Bill".
So there seems to be some caching going on, but the kind I would not expect. I would expect Rails to be clever enough to load exactly one instance of the user with name "Bill"; instead is appears to load two individual ones: one for each association path.
Can someone explain how this works exactly and how I am to handle these types of situations the "Rails way"?
Is there a way a Web site can learn something about your browsing activities outside of this Web site from an HTTP request sent to the Web site by your browser?
Using simplexml_load_string() how do I get "ForgotPassword" from the following XML?
<?xml version="1.0" encoding="utf-8"?>
<ForgotPassword>
<version>1.0</version>
<authentication>
<login>username</login>
<apikey>login</apikey>
</authentication>
<parameters>
<emailAddress>[email protected]</emailAddress>
</parameters>
</ForgotPassword>
I've checked my elisp files to make sure that I do not have any bindings that contain Shift+R (and I have not found any). I expect SHIFT+R to print an uppercase character, but instead I get R R undefined inside of the Emacs command line. This is only in C/C++ major modes.
Any suggestions?
Update: Describing the key shows that it is undefined. How would I define it for the normal, expected use (capitalizing the letter R)?
How should I model a zero or one to a many relationship in the database? For example, a user record may or may not have a parent. So should my user table have a t_user.parent_id or should I have an associative table called t_user_hierarchy with the columns t_user_hierarchy.parent_id and t_user_hierarchy.user_id?
I am trying to compile a library originally written for Cocoa. Things are good until it looks for the function marg_setValue(). It says there is a syntax error before char in
marg_setValue(argumentList,argumentOffset,char,(char)lua_toboolean(state,luaArgument));
(it's talking about the third argument, not (char) )
I am trying to port LuaObjectiveCBridge to the iPhone. It has two choices, either using Runtime or Foundation. I have discovered there are some problems with foundation so I am trying runtime. But the compiler is not co-operating.
I'm trying to redirect to
http://localhost/site/public/admin/login
from
http://localhost/site/public
but for some reason, it keeps redirecting to
http://localhost/admin/login
The code I am using is:
$this->_response->setRedirect('/admin/login')->sendResponse();
This is really frustrating me, and any help would be grealy appreciated
Software will often introduce and formalize concepts that may have ambiguous definitions in the real world. For example, in an attendance tracking system, an Occurrence refers to an Excused Absence, an Unexcused Absence, or a Tardy.
In technical documentation (both in helper text and in user guides, etc), should these concepts be proper nouns, and as such, should they be capitalized in usage?
In other words, which of the following examples is more appropriate:
After an Occurrence has been created,
it may be converted into an Excused
Absence once the Approval Form has
been uploaded.
or
After an occurrence has been created,
it may be converted into an excused
absence once the approval form has
been uploaded.
Can anyone recommend a plugin or library that allows people to upload images which automatically gets cropped and resized? I don't mind editting some config files to specify how images should be cropped and resized.
Additionally, after uploading, the front end user should be able to drag and drop for re-ordering.
Can someone recommend something that works with php?
My main goal with this question is optimization and faster run time.
After doing lot of processing in the Stored Proc I finally return a count like below:
OPEN cv_1 FOR
SELECT COUNT(*) num_of_members
FROM HOUSEHOLD_MEMBER a,
HOUSEHOLD b
WHERE RTRIM(LTRIM(a.mbr_last_name)) LIKE v_MBR_LAST_NAME || '%'
AND a.number = '01'
AND a.code = v_CODE
AND a.ssn_head = v_SSN_HEAD
AND TO_CHAR( a.mbr_dob, 'MM/DD/YYYY') = v_DOB;
But in my code that is calling the SP does not need the actual count. It just cares that count is greater than 1.
Question:
How can I change this to return just 1 or 0. 1 when count is 0 and 0 when count 1.
Will it be faster to do this rather than returning the whole count?
Is there any good software that will allow me to search through my SVN respository for code snippets? I found 'FishEye' but the cost is 1,200 and well outside my budget.
I read an article around schema-less database which sounds cool. (http://bret.appspot.com/entry/how-friendfeed-uses-mysql)
But what isn't clear to me is how do they run search queries on this data? Since the data is in JSON format how do we look for it?