I am developing a project in which I am persisting some POJOs by adding Hibernate annotations. One problem I am running into is that code like this fails, as Hibernate tries to map the sub-fields within the Time_T onto the same column (i.e. startTime.sec and stopTime.sec both try to map to the colum sec, causing an error).
@Entity
public class ExampleClass
{
@Id
long eventId;
Time_T startTime;
Time_T stopTime;
}
@Embeddable
public class Time_T
{
int sec;
int nsec;
}
As there will be many occurrences like this throughout the system, it would be nice if there was an option to automatically append a prefix to the column name (e.g. make the columns be startTime_sec, startTime_nsec, stopTime_sec, stopTime_nsec), without having to apply overrides on a per-field basis. Does Hibernate have this capability, or is there any other reasonable work-around?
I have a large directory tree of files, and am using the following script to list and replace a searched-for name with a specific file. Problem is, I don't know how to write the createList() for-loop correctly to account for whitespace in a directory name. If all directories don't have spaces, it works fine.
The output is a list of files, and then a list of "cp" commands, but reports directories with spaces in them as individual dirs.
aindex=1
files=( null )
[ $# -eq 0 ] && { echo "Usage: $0 filename" ; exit 500; }
createList(){
f=$(find . -iname "search.file" -print)
for i in $f
do
files[$aindex]=$(echo "${i}")
aindex=$( expr $aindex + 1 )
done
}
writeList() {
for (( i=1; i<$aindex; i++ ))
do
echo "#$i : ${files[$i]}"
done
for (( i=1; i<$aindex; i++ ))
do
echo "/usr/bin/cp /cygdrive/c/testscript/TheCorrectFile.file ${files[$filenumber]}"
done
}
createList
writeList
Hi,
I would like a batch script to all the text documents in a folder.
This is what I have managed so far
@ECHO off
title Test
set dir1=C:\Users\Family\Desktop\Example
:Start
cls
echo 1. test loop
echo 2. Quit
set /p choice=I choose (1,2):
if %choice%==1 goto test
if %choice%==2 exit
:test
cls
echo running loop test
FOR %%n in (%dir1% *.txt) DO echo %dir1%\%%n
echo Done
pause
What I would like outputted is
running loop test
C:\Users\Family\Desktop\Example\doc 1.txt
C:\Users\Family\Desktop\Example\doc 2.txt
Done
But I Get this
running loop test
C:\Users\Family\Desktop\Example\C:\Users\Family\Desktop\Example
C:\Users\Family\Desktop\Example\doc 1.txt
C:\Users\Family\Desktop\Example\doc 2.txt
Done
Thanks in advance
Kyle
I would like to have direct access to the text inside a textbox on another form, so I added a public variable _txt to a form and added an event like so:
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
_txt = richTextBox1.Text;
}
But the form is loaded like this:
public FrmTextChild(string text)
{
InitializeComponent();
_txt = text;
richTextBox1.Text = _txt;
Text = "Untitled.txt";
}
Is there a better way to directly link the two?
Does anyone know the rationale behind this naming convention? I don't see any benefit. The extra prefix just pollutes the API.
I like Konrad Rudolph's response found in this related article
hi
function liveUpdate(fld,value,id) {
$.ajax({
type: 'POST',
url: 'myurl.html',
data: { fld:value, 'id': id },
success: function(data){//console.log(data);
}
});
}
i want fld to be posted as fld's value not the variable name fld? i've tried to wrap around with eval but no luck
any ideas?
thanks
Hi
In my mode I am selecting a field as
$query1 = $this->db->query("SELECT dPassword
FROM tbl_login
WHERE dEmailID='[email protected]'");
How to return dpassword as a variable to my controller
I tried this way return dpassword;
I have this bash script where I am trying to change all *.txt files in a directory to their date of last modification. This is the script:
#!/bin/bash
# Renames the .txt files to the date modified
# FROM: foo.txt Created on: 2012-04-18 18:51:44
# TO: 20120418_185144.txt
for i in *.txt
do
mod_date=$(stat --format %y "$i"|awk '{print $1"_"$2}'|cut -f1 -d'.'|sed 's/[: -]//g')
mv "$i" "$mod_date".txt
done
The error I am getting is:
renamer.sh: 6: renamer.sh: Syntax error: word unexpected (expecting "do")
Any help would be greatly appreciated. Thank you for your time.
I have a string of a variable length and at the end of the string are some digits. What would be the best / efficient way, to parse the string and get the number from the end as an Integer?
The String and the digits at the end can can be of any length. For example:
abcd123 -- 123
abc12345 -- 12345
ab4cd1 -- 1
hello java guys,
im thinking of a simple java app (command line) that connects to the internet to download xml file, the problem is that my ubuntu is using a proxy to connect to internet with username and password (tru http_proxy ="http://:@:" ). So My question is, could it be possible to write a java app to use http_proxy variable? instead of programmatically setting http proxy and host in every app i will write.
Hi,
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4
5 my @array = qw[a b c];
6 foreach my($a,$b,$c) (@array) {
7 print "$a , $b , $c\n";
8 }
I receive following error: Missing $ on loop variable
What is wrong?
I am using: perl v5.10.1 (*) built for x86_64-linux-thread-multi
I am running a query from the VBA editor of Access:
select max(somerow) from sometable
I want to put the result of this query into a VBA variable. How do i do it?
I want to call require_once("test.php") but not display result and save it into variable like this:
//pseudocode
$test = require_once('test.php');
//some operations like $test = preg_replace(…);
echo $test;
Is it possible?
I have an assoc array with a list of what are parameters to me. Here's an example:
array(
'param1' => 'value1',
'param4' => 'value4',
'param3' => 'value3',
'param2' => 'value2',
);
Note that they may come unsorted. Now, is there a way I can make a call (static or from an instance, using call_user_func_array or similar) and correctly pass each value to each parameter? Just to be sure, an example function I'd like to call using that parameter array is one such this:
exampleFunction($param1, $param2, $param3, $param4) {
...
}
PS: Reflection is great, but I'm concerned about execution times (which, at least, in Java tends to increase a lot when using Reflection). If you know any other way to do so, it would be awesome.
Hi I am having a problem, accessing a remote index server catalog. The name of the server has - in it, so i put the index catalog name as:
i.e num.num.num.num\name of catalog
or an-example-server
I get the following error when using an ole data connection to pull results from the index:
"Format of the initialization string does not conform to specification starting at index 39"
I tried putting single quotes and &qoute; with no luck - anyone have idea?
PS. This Microsoft Index Server Question!
I have a stored procedure that will return xml. I have delared a variable of type xml and trying to execute the following code
declare @v xml
set @v = execute get_xml @id, 33
whereas id is returned by another query. now it keeps compalinng about the following error
Incorrect syntax near the keyword 'execute'.
hi,
i am doing a shopping cart.i had a variable $total.when i add 1st product of price 200 i get $total=200 , when i add 2nd product of price 100 i get $total=200100 when i add 3rd product of price 400 i get $total=200100400 . i want to get $total=700. how to fix this problem?
please help me........
thanks,
Hmwd
Say I have my class
@interface Person : NSObject { NSString *name; }
I need to get the name of NSString's within my class
Person *person = [[Person alloc] init];
NSLog(@"Name of variable %s\n", NameofVariable(person.name));
i can't read the variable in the function, i want to use it outside the function, here is my code.
var contentLoader:URLLoader = new URLLoader();
contentLoader.load(new URLRequest("http://localhost/data.php"));
function onComplete(event:Event):void
{
var txtu:String = event.target.data;
}
contentLoader.addEventListener(Event.COMPLETE, onComplete);
trace(txtu);
thanks.
What I want to do is pretty simple:
f=Foobar.objects.get(id=1)
foo='somefield'
bar='somevalue'
f.foo=bar
f.save()
This doesn't work as it tries to update the f object's 'foo' field, which of course doesn't exist. How can I accomplish this?
I need to put a javascript variable as image source.That is my image tag should be in this format
here i am adding my script
document.getElementById("pricefilter").innerHTML =''
here variablename carries my image path.How can i put this in double quates.Please help to solve this
I want to display a certain in the template only if a certain GET variable is set....I thought using {% if request.get.my_var %} would work, but it's not giving me the results.
hi when i write css or html i found that i want add two name like this
web-development
web_development
which one is better according SEO or write style name, file name or image name.