Tuesday, 15 June 2010

java - Any descriptive struts2 api doc for tags? -



java - Any descriptive struts2 api doc for tags? -

folks trying find tags api doc on net not find 1 descriptive. everywhere link reference http://struts.apache.org/2.1.8/docs/if.html illustration if have figure out if mymanager in below if tag treated string literal or ognl look against valuestack, can not find decription this.

<s:if test="mymanager"> </s:if>

can point me doc/link?

i guess help you, site listed article on apache official site. http://www.roseindia.net/struts/struts2/struts-2-tags.shtml http://www.dzone.com/tutorials/java/struts-2/struts-2-tutorial/struts-2-tutorial.html

java api struts2

web services - Salesforce/php - downloaded image attachments are corrupted - Any Ideas? -



web services - Salesforce/php - downloaded image attachments are corrupted - Any Ideas? -

here code downloading attachment salesforce.com using php toolkit , enterprise wsdl:

header('content-type: application/force-download'); header('content-disposition: inline; filename="image.jpg"'); $mysforceconnection = getconnection(); $query = "select id, name, body attachment id ='" .$id ."'"; $queryresult = $mysforceconnection->query($query); $records = $queryresult->records; print_r(base64_decode($records[0]->fields->body));

when file gets downloaded correctly right number of bytes when open image, windows image viewer says corrupt. thought why happening?

the same code works fine pdfs , text files.

you want echo output, @eyescream mentioned. when utilize print_r function, additional tab , newline characters placed output create more readable. plain echo output properly.

header('content-type: application/force-download'); header('content-disposition: inline; filename="image.jpg"'); $mysforceconnection = getconnection(); $query = "select id, name, body attachment id ='" .$id ."'"; $queryresult = $mysforceconnection->query($query); $records = $queryresult->records; echo base64_decode($records[0]->fields->body);

php web-services salesforce

text - Python - Nested loop that doesn't work when reading a file -



text - Python - Nested loop that doesn't work when reading a file -

this nested loop works fine when reading lists:

list = [1,2,3,4,5] num = 0 while num < 5: in list: print(i) num += 1

this loop print elements in list. problem doesn't work @ when reading textfiles. instead of printing first 5 lines of text read through , print them.

f = open(r'c:\users\me\python\bible.txt') num = 0 while num < 50: line in f: print(line) num += 1

i can assume num variable doesn't increment after each iteration, there reason this, , there solution?

the code

for line in f: print line num += 1

is looping on lines in file. @ same time increment num one. @ end of for-loop num equal number of lines in files, larger 50, exit while-loop.

using style should write:

for line in f: print line num += 1 if num > 50: break

also first code has same problem. why need 2 loops if want loop on 1 construction in 1 dimension? codes not pythonic, illustration should rewrite them as:

list = [1,2,3,4,5] in list: print i,line in enumerate(f): print line if > 50: break

python text iteration

sql - SUM() from a multi-part JOIN -



sql - SUM() from a multi-part JOIN -

select sum(t.optlevel) + sum(o.reqlevel1) + sum(b.noptvalue) _inventory left bring together _items t on t.id64 = i.itemid left bring together _refobjcommon o on o.id = t.refitemid left outer bring together _bindingoptionwithitem b on b.nitemdbid = i.itemid i.charid = 7843 , i.slot between 0 , 12 , i.itemid != 0

i'm having problem query, not quite experienced joins be.

t.optlevel >= 0 _items , row there

o.reqlevel1 between 1 , 101 _refobjcommon , row there

however, b.noptvalue _bindingoptionwithitem either null, 1, or 2 row not there... when b.noptvalue = 1 or 2 nowadays in 1 of 12 row results ( i.slot between 0 , 12 ) script runs perfectly: sum total if b.noptvalue returns null in 12 row results sum gets returned null whole query.

i know there simple solution, cannot find it.

without understanding question, there's cool function coalesce(), returns first of parameters not null.

select coalesce(sum(t.optlevel), 0) + coalesce(....

sql join sum

c++ - what should be the format of input data file which is passed as an object to MyDataStream stream(argv[1]) -



c++ - what should be the format of input data file which is passed as an object to MyDataStream stream(argv[1]) -

i using "libspatialindex" library creating r-tree index. info 2 dimensional next values:

(1, (1,5)), (19, (6,8)), (20, (3,8)), (4, (1,9)).

the description of info is:

1 info point , nowadays in interval (1,5) 19 info point , nowadays in interval (6,8) 20 info point , nowadays in interval (3,8) 4 info point , nowadays in interval (1,9)

i trying mass load above info r-tree. doing using next test code libspatialindex. however, not getting what should format of input info file passed object *mydatastream stream(argv[1]);*

the test code using is:

// copyright (c) 2002, marios hadjieleftheriou // include library header file. #include <spatialindex/spatialindex.h> using namespace spatialindex; #define insert 1 #define delete 0 #define query 2 class mydatastream : public idatastream { public: mydatastream(std::string inputfile) : m_pnext(0) { m_fin.open(inputfile.c_str()); if (! m_fin) throw tools::illegalargumentexception("input file not found."); readnextentry(); } virtual ~mydatastream() { if (m_pnext != 0) delete m_pnext; } virtual idata* getnext() { if (m_pnext == 0) homecoming 0; rtree::data* ret = m_pnext; m_pnext = 0; readnextentry(); homecoming ret; } virtual bool hasnext() { homecoming (m_pnext != 0); } virtual uint32_t size() { throw tools::notsupportedexception("operation not supported."); } virtual void rewind() { if (m_pnext != 0) { delete m_pnext; m_pnext = 0; } m_fin.seekg(0, std::ios::beg); readnextentry(); } void readnextentry() { id_type id; uint32_t op; double low[2], high[2]; m_fin >> op >> id >> low[0] >> low[1] >> high[0] >> high[1]; if (m_fin.good()) { if (op != insert) throw tools::illegalargumentexception( "the info input should contain insertions only." ); part r(low, high, 2); m_pnext = new rtree::data(sizeof(double), reinterpret_cast<byte*>(low), r, id); // associate bogus info array every entry testing purposes. // 1 time info array given rtree:data local re-create created. // hence, input info array can deleted after operation if not // needed anymore. } } std::ifstream m_fin; rtree::data* m_pnext; }; int main(int argc, char** argv) { seek { if (argc != 5) { std::cerr << "usage: " << argv[0] << " input_file tree_file capacity utilization." << std::endl; homecoming -1; } std::string basename = argv[2]; double utilization = atof(argv[4]); istoragemanager* diskfile = storagemanager::createnewdiskstoragemanager(basename, 4096); // create new storage manager provided base of operations name , 4k page size. storagemanager::ibuffer* file = storagemanager::createnewrandomevictionsbuffer(*diskfile, 10, false); // applies main memory random buffer on top of persistent storage manager // (lru buffer, etc can created same way). mydatastream stream(argv[1]); // create , mass load new rtree dimensionality 2, using "file" // storagemanager , rstar splitting policy. id_type indexidentifier; ispatialindex* tree = rtree::createandbulkloadnewrtree( rtree::blm_str, stream, *file, utilization, atoi(argv[3]), atoi(argv[3]), 2, spatialindex::rtree::rv_rstar, indexidentifier); std::cerr << *tree; std::cerr << "buffer hits: " << file->gethits() << std::endl; std::cerr << "index id: " << indexidentifier << std::endl; bool ret = tree->isindexvalid(); if (ret == false) std::cerr << "error: construction invalid!" << std::endl; else std::cerr << "the stucture seems o.k." << std::endl; delete tree; delete file; delete diskfile; // delete buffer first, storage manager // (otherwise the buffer fail trying write dirty entries). } grab (tools::exception& e) { std::cerr << "******error******" << std::endl; std::string s = e.what(); std::cerr << s << std::endl; homecoming -1; } homecoming 0; }

chop out readnextentry , test that:

void readnextentry(istream& is) { id_type id; uint32_t op; double low[2], high[2]; >> op >> id >> low[0] >> low[1] >> high[0] >> high[1]; }

we can create test input stream using istringstream:

bool isgood(const std::string& input) { std::istringstream ss(input); readnextentry(ss); homecoming ss.good(); }

and demonstrate:

int main() { std::cout << "good? " << isgood("asdf qwer zxcv uyio ghjk") << std::endl; std::cout << "good? " << isgood("0.0 0 0 0 0") << std::endl; std::cout << "good? " << isgood("1 2 3 4 5") << std::endl; }

c++ data-structures r-tree

android - take value from EditText from a ListView -



android - take value from EditText from a ListView -

i have simplecursoradapter edittext , textview, have take value every text view when button pressed,and have no ideea how create it,this simplecursoradapter class

private class edittextadapter extends simplecursoradapter { private context adcontext; public int getcount() { homecoming calatori.size()+1; } public edittextadapter(context context, int layout, cursor c, string[] from, int[] to) { super(context, layout, c, from, to); this.adcontext = context; } public view getview(int pos, view inview, viewgroup parent) { view v = inview; if (v == null) { layoutinflater inflater = (layoutinflater) adcontext .getsystemservice(context.layout_inflater_service); v = inflater.inflate(r.layout.element_lista_cipasport, null); } if (pos == getcount()){ ((textview) v.findviewbyid(r.id.text_ci)).settext("telefon"); ((edittext) v.findviewbyid(r.id.edt_ci)).sethint(""); ((edittext) v.findviewbyid(r.id.edt_ci)).setinputtype(inputtype.type_class_number); } ((textview) v.findviewbyid(r.id.text_ci)).settext(" ci/pasport "+calatori.get(pos).nume); } homecoming v; } }

android listview android-edittext

javascript - Can't get RegExp to match in GWT -



javascript - Can't get RegExp to match in GWT -

example text: in park, kid plays. kid tall. kid watches kid @ play.

i want match "child" in first sentence, "child" in sec , 3rd sentences not "child" in 3rd sentence. or in other words, match "child" or "child" not if proceeded word "another"

i thought using negative behind

((?<\!another) [cc]hild)

but can't seem syntax right produce valid regexp.

even if syntax right not sure can in gwt. here snippet gwt javadoc

java-specific constructs in regular look syntax (e.g. [a-z&&[^bc]], (?<=foo), \a, \q) work in pure java implementation, not gwt implementation,...

any help or insight appreciated.

update:

colin's reply works isn't quite right.

colin's regex match "child" , "child" , not match "another child" asked. there few problems though.

what trying match on "child" , "child" can replaced either child's name or right pronoun he/she, depending on child's gender.

the problem colin's regex matches ", child" , ". child". doesn't match "child" if first word in text. example:

"child went park. in park, kid plays. kid tall. kid watches kid @ play."

the first kid not match. subsequent matches on ", child", ". child", , ". child".

i worked on regex colin came trying match "child" or "child" can't create work.

the regex in gwt has same level of back upwards regexp javascript, since calls on native javascript classes.

i can't think of way reject "another child" straight in regex, given javascript regex doesn't have back upwards look-behind or possessive quantifier.

therefore, write regex that, if "another" appears before "child", "another" matched; otherwise, "child" matched. can filter out matches have more 5 characters.

regexp.compile("(?:another +)?[cc]hild", "g")

note "child" in string "some children" matched. , if "another" embedded within longer word string, illustration "ranother"1, blindly pick fragment. prevent such cases, need add together word boundary check \b2:

regexp.compile("(?:\\banother +)?\\b[cc]hild\\b", "g") --- --- --- | | | prevent "ranother" prevent "children" matching or "nochild" matching

you may allow case-insensitive matching (which quite reasonable text) i flag. however, leave decide.

using regex above, match "another child" before matching "child". therefore, when match contains "child", know "another" does not precede it. therefore, can filter away matches length > 5, , left valid strings.

footnote

i utilize made word example. normal in arbitrary string, don't know if there word in english language "another" embedded inside.

there caveat here. "child4" or "child_something" not matched when \b used. while "another" in "_another child" or "5another child" not picked regex (and "child" matched, means take match). possible workaround this, , if request it.

javascript regex gwt negative-lookbehind

xcode4 - Xcode error: Undefined symbols for architecture x86_64 -



xcode4 - Xcode error: Undefined symbols for architecture x86_64 -

i writing template matrix class school assignment. have included error source , header files below. don't think wrong code, pretty sure reason xcode isn't recognizing header , source file. tempmlated matrix class declared in matrix.h, function definitions in matrix.cpp, , main routine in main.cpp. have included 3 files total error message xcode gives me below. i've spent lastly 2 days googling error no avail. new xcode help appreciated. if need me post more information, settings or else, don't hesitate ask. total error is:

ld /users/mikey/library/developer/xcode/deriveddata/hw3-glwfyunpxigvvpfacidnbejyprfa/build/products/debug/hw3 normal x86_64 cd /users/mikey/desktop/programming/pic10b/hw3 setenv macosx_deployment_target 10.8 /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/clang++ -arch x86_64 - isysroot /applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx10.8.sdk -l/users/mikey/library/developer/xcode/deriveddata/hw3-glwfyunpxigvvpfacidnbejyprfa/build/products/debug -f/users/mikey/library/developer/xcode/deriveddata/hw3-glwfyunpxigvvpfacidnbejyprfa/build/products/debug -filelist /users/mikey/library/developer/xcode/deriveddata/hw3-glwfyunpxigvvpfacidnbejyprfa/build/intermediates/hw3.build/debug/hw3.build/objects-normal/x86_64/hw3.linkfilelist -mmacosx-version-min=10.8 -stdlib=libc++ -o /users/mikey/library/developer/xcode/deriveddata/hw3-glwfyunpxigvvpfacidnbejyprfa/build/products/debug/hw3 undefined symbols architecture x86_64: "operator^(matrix<double>, int)", referenced from: _main in main.o "operator>>(std::__1::basic_istream<char, std::__1::char_traits<char> >&, matrix<double>&)", referenced from: _main in main.o ld: symbol(s) not found architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation)` //main.cpp #include<iostream> #include<vector> #include<string> #include "matrix.h" using namespace std; int main () { int numberofplanets; int steps; string planet; vector<string> planetnames; matrix<double> markovmatrix; matrix<double> stepmatrix; cout<<"please come in number of planets:"; cin>>numberofplanets; cout<<"please come in names of planets:"; for(int i=0;i<numberofplanets;i++) { cin>>planet; planetnames.push_back(planet); } cout<<"how many steps take?"; cin>>steps; cout<<"please come in "<<numberofplanets<<"x"<<numberofplanets<<" markov matrix:"; cin>>markovmatrix; stepmatrix=markovmatrix^steps; for(int i=0;i<numberofplanets;i++) { int maxentry = stepmatrix.findmax(i); cout<<"after "<<steps<<" steps, "<<planetnames[i]<<"you end @ " <<planetnames[maxentry]; cout<<endl; } homecoming 0; } //matrix.h #include<iostream> #include<iomanip> #ifndef matrix_h #define matrix_h using namespace std; template<typename t> class matrix { public: matrix(); matrix(int r, int c); ~matrix(); matrix<t>(const matrix<t>& right); matrix<t>& operator=(const matrix<t>& right); t& operator() (int i, int j); t operator() (int i, int j) const; friend ostream& operator<<(ostream& out, const matrix<t>&right); friend istream& operator>>(istream& in, matrix<t>& right); friend matrix<t> operator*(const matrix<t> left, const matrix<t> right); friend matrix<t> operator+(const matrix<t> left, const matrix<t> right); friend matrix<t> operator^(const matrix<t> right, int power); int findmax(int r) const; private: int rows; int columns; t* elements; }; #endif` //matrix.cpp #include "matrix.h" #include<iostream> #include<iomanip> using namespace std; template<typename t> matrix<t>::matrix() { rows = 0; columns = 0; elements = null; } template<typename t> matrix<t>::matrix(int r, int c) { rows = r; columns = c; elements = new t[rows*columns]; for(int i=0;i<rows*columns;i++) { elements[i]=0; } } template<typename t> matrix<t>::matrix(const matrix<t>& right) { rows = right.rows; columns = right.columns; elements = new t[rows*columns]; for(int i=0;i<rows*columns;i++) elements[i]=right.elements[i]; } template<typename t> matrix<t>& matrix<t>::operator=(const matrix<t>& right) { if(this!=&right) { rows = right.rows; columns = right.columns; delete[] elements; for(int i=0;i<rows*columns;i++) { elements[i]=right.elements[i]; } } homecoming *this; } template<typename t> t matrix<t>::operator()(int i, int j) const { homecoming elements[i*rows+j]; } template<typename t> t& matrix<t>::operator()(int i, int j) { homecoming elements[i*rows+j]; } template<typename t> matrix<t> operator+(const matrix<t>& right, const matrix<t> left) { matrix<t> a(right.rows, right.columns); for(int i=0;i<a.rows;i++) { for(int j=0;j<a.columns;j++) { a(i,j) = right(i,j)+left(i,j); } } homecoming a; } template<typename t> matrix<t> operator*(const matrix<t>& right, const matrix<t> left) { matrix<t> a(left.rows, right.columns); for(int i=0;i<left.rows;i++) { for(int j=0;j<right.columns;j++) { for(int k=0;k<right.rows;k++) { a(i,j)+=left(i,k)*right(k,j); } } } homecoming a; } template<typename t> matrix<t>::~matrix() { delete[] elements; } template<typename t> matrix<t> operator^(const matrix<t>& right, int power) { matrix<t> = right; for(int i=1;i<power;i++) a=a*right; homecoming a; } template<typename t> int matrix<t>::findmax(int r) const { int maxcolumnentry = 0; t rowmax = elements[r*columns]; for(int j=1;j<columns;j++) { if(elements[r*columns+j]>rowmax) { rowmax = elements[r*columns+j]; maxcolumnentry = j; } } homecoming maxcolumnentry; } template<typename t> ostream& operator<<(ostream& out,const matrix<t>& right) { for(int i=0;i<right.rows*right.columns;i++) { out<<setw(10)<<right.elements[i]<<" "; if((i+1)%right.columns==0) out<<endl; } homecoming out; } template<typename t> istream& operator<<(istream& in, matrix<t>& right) { for(int i=0;i<right.rows*right.columns;i++){ in>>right.elements[i]; } homecoming in; }

i believe you're compiling wrong lib. alter build settings use: compiler default in apple llvm compiler settings maybe libstdc++.

and:

project -> build settings -> find llvm compiler grouping -> c++ standard library

xcode4 clang x86-64

validation - can @Valid annotation check on fields recursively in spring mvc? -



validation - can @Valid annotation check on fields recursively in spring mvc? -

i create model object jsr-303 validator annotation:

public class userinfobasicmodel implements serializable{ @notnull(message="cannot null") @notempty(message="cannot empty") private string name; //getter , setter //..ignored.. }

auto data-binding in controller:

@controller @requestmapping("/user") public class usercontroller { @requestmapping(method = requestmethod.post, value = "/registry/") public string registry(httpservletrequest request, modelmap modelmap, @valid userinfobasicmodel userinfobasicmodel, bindingresult result) { //...some code here... } }

in above scenario, works fine validation. when encapsulate model object below, validation on userinfobasicmodel doesn't work anymore:

the object encapsulates userinfobasicmodel object:

public static class userupdateformtransmitter { @valid private userinfobasicmodel userinfobasicmodel; //getter , setter //..ignored.. }

the controller:

@controller @requestmapping("/user") public class usercontroller { @requestmapping(method = requestmethod.post, value = "/registry/") public string registry(httpservletrequest request, modelmap modelmap, @valid userupdateformtransmitter userupdateformtransmitter, bindingresult result) { //...some code here... } }

i'm wondering why doesn't @valid annotaion works recursively jsr 303: bean validation says.could 1 give me solution can valid object recursively, lot!!!!

i have never done recursive validation, according this possible purchase tagging sub-objects @valid.

validation spring-mvc bean-validation hibernate-validator

uiview - Embedded SegmentControl fails to respond to touch -



uiview - Embedded SegmentControl fails to respond to touch -

i have solved issue segmentcontrol wasn't scrolling table view. did embedding command in table view, so:

uiview *headerview = [[uiview alloc] init ]; [headerview addsubview:resultssegment]; self.tableview.tableheaderview = headerview;

this works nicely......

but can't click on segment control. it's embedded mean it's behind tableview far users touch concerned?

any ideas on how create segmentcontrol "clickable" again?

thanks

the segment command not behind tableview. on tableview.

to create segmentcontrol clickable again, need set segmentcontrol properties. here illustration code web.

nsarray *itemarray = [nsarray arraywithobjects: @"one", @"two", @"three", nil]; uisegmentedcontrol *segmentedcontrol = [[uisegmentedcontrol alloc] initwithitems:itemarray]; segmentedcontrol.frame = cgrectmake(35, 200, 250, 50); segmentedcontrol.segmentedcontrolstyle = uisegmentedcontrolstyleplain; segmentedcontrol.selectedsegmentindex = 1; [segmentedcontrol addtarget:self action:@selector(pickone:) forcontrolevents:uicontroleventvaluechanged]; [self.view addsubview:segmentedcontrol];

uiview ios6 tableview uisegmentedcontrol

How can I pass form values like email, name, phone etc from my C# console application to any website? -



How can I pass form values like email, name, phone etc from my C# console application to any website? -

how can pass values email, phone, name etc... website console application. want develop console application open website url , fill form , submit it.

using system; using system.diagnostics; using system.net; namespace samplenamespace { public class sampleclass { public static void main() { string url; string browser=""; string browserpath=""; console.writeline("please come in website url (eg. http://www.google.com): "); url=console.readline(); while(browser.toupper()!="chrome" && browser.toupper()!="mozilla" && browser.toupper()!="ie" && browser.toupper()!="opera") { console.writeline("in browser want open website? (chrome | mozilla | ie | opera) "); browser=console.readline(); if (browser.toupper()!="chrome" && browser.toupper()!="mozilla" && browser.toupper()!="ie" && browser.toupper()!="opera"){ console.writeline("please come in right option!!!"); } if (browser.toupper()=="chrome") { browserpath=@"c:\users\weblink\appdata\local\google\chrome\application\chrome.exe"; } else if(browser.toupper()=="mozilla") { browserpath=@"c:\program files\mozilla firefox\firefox.exe"; } else if(browser.toupper()=="ie") { browserpath=@"c:\program files\internet explorer\iexplore.exe"; } else if(browser.toupper()=="opera") { browserpath=@"c:\program files\opera\opera.exe"; } process.start(browserpath,url); system.console.writeline("please press eenter key exit!"); console.readline(); } } }

if goal post website application don't need worry using browser.

you can connect straight website in question using java library (eg: http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/httpclient.html)

there plenty of examples of sending http post requests around:

java - sending http parameters via post method easily http://sigterm.sh/2009/10/simple-post-in-java/

you don't need load form in question (usually). can supply post request form's action (destination).

suppose form in question came http://example.com/forms/

you post url http://example.com/forms/contact.html

if you're trying develop spam bot, you're way behind curve ;-)

c# website console

php - select from table where day difference is less than some number -



php - select from table where day difference is less than some number -

i trying grab sql entries day difference between current date , expiration date < 4 days

my first approach following:

$sql_i_requested = "select *, (to_days(date_return)-to_days(now())) daydif ".$tbl_name." (status!='completed' , status!='canceled') , owner_id=".$owner_id." , daydif < 4 order date_created desc";

my sec aproach (according sql datedifference in clause):

$sql_i_requested = "select * ".$tbl_name." (status!='completed' , status!='canceled') , owner_id=".$owner_id." , date_return > dateadd(day, -3, getdate()) order date_created desc";

neither of them work, how select table day_difference between "date_return" , now() less 4 days?

edit:

changed

and daydif < 4

to

and (to_days(date_return)-to_days(now())) < 4

and it's working. anyway, maybe guys suggest other solutions.

using datediff

where datediff(date_return, now()) < 4

php sql

WordPress 4-letter comment error -



WordPress 4-letter comment error -

this 1 of weirdest bugs i've seen. uploaded wordpress onto 1 of new sites, http://viewmixed.com/, , there unusual bug when posting four-letter words.

at first thought couldn't leave comments @ because kept trying leave comment word "test". realized 4 letter word seems break comments i.e. "four" or "1234", other string posts comment fine.

i have tried deleting files/database , re-installing wp, , didn't solve anything. i'm on newest wp version, 3.5.1, , tried installing 3.4.2 , 3.1.4, none fixed issue...

anyone have thought of going on?

edit: forgot mention have custom theme right now, bug there before installing theme, , tried changing themes, 4-letter bug doesn't go away.

it's not easy reply in detail because there couple of reasons getting error, can see in title there error 406 not acceptable mod_security problem.

frist alter permalink settings within wordpress , if error still appears.

second seek deactivate mod_security. hence can add together .htaccess file within wp-admin directory...

<ifmodule mod_security.c> secfilterscanpost off </ifmodule>

...or add together .htaccess file within root disable completely:

<ifmodule mod_security.c> secfilterengine off </ifmodule>

if still not work suggest contact hosting provider you.

as not easy find solution (and farther reading) suggest reading this blogpost on finding 406 error , this blogpost similar solution within wordpress.

hopefully might helpful you.

wordpress

jquery - Why is removeClass is not working in this case? -



jquery - Why is removeClass is not working in this case? -

i have following:

js:

$('.home-toggle').click(function() { scroll(); $('#content twelvecol > a').removeclass('selected-tile'); $(this).addclass('selected-tile'); $('.hidden').hide(); $('.home-container').slidedown(); }); $('.why-toggle').click(function() { scroll(); $('#content twelvecol > a').removeclass('selected-tile'); $(this).addclass('selected-tile'); $('.hidden').hide(); $('.why-container').slidedown(); });

html:

<div id="content" class="container" style="display:none;"> <div class="row"> <div class="twelvecol"> <a href="#" class="home-toggle tile first"> <img class="tile-top" src="images/tile1.png" alt="" /> <img class="tile-bottom" src="images/tile1h.png" alt="" /> </a> <a href="#" class="why-toggle tile"> <img class="tile-top" src="images/tile2.png" alt="" /> <img class="tile-bottom" src="images/tile2h.png" alt="" /> </a> <a href="#" class="solutions-toggle tile last"> <img class="tile-top" src="images/tile3.png" alt="" /> <img class="tile-bottom" src="images/tile3h.png" alt="" /> </a>

so .selected-tile should removed other .tile 1 time click on one.

but reason, class still remains in other tiles.

what problem?

you have bug in selector

$('#content twelvecol > a')

should

$('#content .twelvecol > a') // ^ dot

since latter selects anchors top children within of container with class of twelvecol, within of element id of content.

jquery

jsf - How to validate file to be uploaded? -



jsf - How to validate file to be uploaded? -

i working on liferay project. have set file upload functionality. have used

<bridge:inputfile/>

but upload method not called when seek upload blank file of 0 bytes. validation blank file within upload method.

jsf file-upload liferay portlet

Magento incoming mail (replies) going to wrong email SMTP issue? -



Magento incoming mail (replies) going to wrong email SMTP issue? -

i have client keeps getting client service reply emails in mail service box when should going client service email. i've searched everywhere record of email , nowhere. guessing because client service emails of different domain replies getting marked spam , beingness sent server admin business relationship instead. have downloaded extension: http://www.magentocommerce.com/magento-connect/aschroder/extension/1865/aschroder.com-smtp-pro. different domain email smtp? advice appreciated.

we had problem few of our recipients well.

mainly comcast users , century link name few. problem is, sending (for example) www-data@thisdomain (this machines domain name ie. www-data@webserver01) -- in header, regardless of in from field. actual domain in field customer_service@yourstoredomain.com. need 1 of 2 things.

if host magento install on own operating scheme , have command of it, you'll need alter machines hostname match of web domain name. ie yourwebsite.com.

if isn't option, need utilize magento plugin 1 mentioned, , have log in via smtp email service provider (we utilize office365) , send email "real" email address have created.

the reason fails due spf record on providers (ie comcast centurylink) not allowing emails domain other specified in header. prevent spam etc customers. companies these block or, in cases, redirect email user @ originating from domain.

if @ possible, easiest route going to seek alter domain in header of email. manage own operating scheme have command on this. if not, seek see if hosting provider provide access "jailed" area can alter said settings. smtp route no fun ...

magento smtp

php - mysqli_fetch_assoc returns duplicate data -



php - mysqli_fetch_assoc returns duplicate data -

there similar questions here, after lot of searching , trying different things, i'm still stuck.

when using mysqli_fetch_assoc() populate array, each row beingness added twice.

$query = "select column table year = 2012"; if ($result = mysqli_query($connect, $query)) { while ($row = mysqli_fetch_assoc($result)) { $data[] = $row["column"]; } echo implode(',', $data); mysqli_free_result($result); }

this returning following: 1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10

i'm expecting 1,2,3,4,5,6,7,8,9,10

i added few lines debugging...

print_r($data) yields

array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 [7] => 8 [8] => 9 [9] => 10 [10] => 1 [11] => 2 [12] => 3 [13] => 4 [14] => 5 [15] => 6 [16] => 7 [17] => 8 [18] => 9 [19] => 10 )

print_r($result); yields

mysqli_result object ( [current_field] => 0 [field_count] => 1 [lengths] => [num_rows] => 10 [type] => 0 )

if [num_rows] => 10, , i'm using mysqli_fetch_assoc() , not mysqli_fetch_array(), why adding values array twice?

probably you've assigned info $data array. seek empty before while instruction:

$query = "select column table year = 2012"; if ($result = mysqli_query($connect, $query)) { $data = array(); while ($row = mysqli_fetch_assoc($result)) { $data[] = $row["column"]; } echo implode(',', $data); mysqli_free_result($result); }

and see outputs.

i believe column not real column name otherwise you'll error.

php mysql mysqli fetch

What is "Generic C"? -



What is "Generic C"? -

i programming pupil , have encountered references to: generic c, mean plain classic c?

"generic c/c++ implementations commonly used info structures in serious piece of software"

it typically appears in contexts such this; pretty sure have been misreading such references (generic c)/c++ rather than: generic (c/c++). looks referring set of libraries. replies.

generic c/c++ implementations commonly used info structures in serious piece of software"

here, generic , c/c++ distinct adjectives listed in front end of implementations of info structures; equivalently have said "c/c++ generic implementations..." or "generic implementation in c/c++" etc.. info structures such lists , binary trees commonly used arbitrary info types int, double , user-defined structures. implementations allow info construction code reused arbitrary types called "generic" implementations.

in c, examples standard library's binary search , quick sort functions, take info without understanding content of memory, pointers functions phone call perform meaningful interpretation of data. see http://www.cplusplus.com/reference/cstdlib/qsort/ , http://www.cplusplus.com/reference/cstdlib/bsearch/

in c++, templates provide improve back upwards generic info structures, standard library hosting generic vectors, lists, (binary tree associative) maps, double-ended queues, stacks, more hash tables termed unordered_maps etc..

c

python - Where should markdown parsing code live in a Django app? -



python - Where should markdown parsing code live in a Django app? -

i using wmd editor in django admin. have written simple parser (regex mostly) can grab specific tags in markdown , insert html accordingly. problem need access django object itself.

currently i'm overriding model.save() , calling model.process_markdown()

def process_markdown(self): p = re.compile("\[\[\s*(?p<tag>image):(?p<id>[\d,]+)\s*\]\]") processed = p.sub(partial(render_markdown, self), self.body_markdown) homecoming markdown.markdown(processed)

the result saved model.rendered field on model. if notice have render_markdown function beingness called. thats stored in file called util.py in app , real work.

everything working seems there should improve way. know can tie markdown custom tags , cleaner have beable access django object , reference related inline objects. far can tell there not way me this.

is there improve way organize this?

beware markdown allows html tunneled through. if this, want markdown(html, safe_mode='escape') if you're allowing untrusted sources insert .body_markdown, need sanitize input via bleach: http://pypi.python.org/pypi/bleach

python django markdown wmd-editor

google play - How to Update android app by programmatically without android market -



google play - How to Update android app by programmatically without android market -

i need help,

1) developing app in want display offline web site including videos added videos in raw folder offline access of app , want alter videos after days( may add together or delete videos app). possible update app without using android market?

the thought when start app parse json , check wether new version of app available on site or not. if available start download of it(i don't want open browser download. update should done within app or in background ) , reinstall .how can programmatically?

also how can cache entire website in web view.currently using code cache visited pages (the page open in app)

webview.getsettings().setloadsimagesautomatically(true); webview.getsettings().setdomstorageenabled(true); webview.getsettings().setappcachemaxsize(1024*1024*24); string appcachepath = getapplicationcontext().getcachedir().getabsolutepath(); webview.getsettings().setappcachepath(appcachepath); webview.getsettings().setallowfileaccess(true); webview.getsettings().setappcacheenabled(true); webview.setwebchromeclient(new webchromeclient()); webview.setwebviewclient(new webviewclient()); if (savedinstancestate == null) { if(isnetworkavailable() == true){ webview.getsettings().setcachemode(websettings.load_default); webview.loadurl("http://www.xyz.com"); } else { webview.getsettings().setcachemode(websettings.load_cache_only); webview.loadurl("http://www.xyz.com"); } } }

2)how can install apk mac tablet usb without clicking on run button of eclipse. want install apk 200 tablets, looking batch programme or script 1 click install script app. search on gooogle found 1 multiple apk on click don't know work on non rooted tablet or not.

waiting reply. give thanks

there 2 ways can first utilize force notifications , tell users new version when click on notification download apk web server , allow them install (i have used 1 )

other alternative may polling web server after prepare time say(one day) , check if new version available 1 time available force notification area new version available when user clicks 1 time again repeat above procedure need web server request send , create users download application

android google-play

java - urlrewritefilter not redirecting -



java - urlrewritefilter not redirecting -

i'm trying implement seems simple redirect urlrewritefilter follows not redirecting.

<rule> <from>/?industry_id=22</from> <to type="permanent-redirect">/industry/22/publishing</to> </rule>

other rules work fine. suggestions?

thanks!

java url-rewriting xml-parsing tuckey-urlrewrite-filter

python - I can not compile Pillow in Windows XP -



python - I can not compile Pillow in Windows XP -

i installed mingw gcc, add together path path variable, create file in folder distutils.cfg lib / distutils in python installation. tried installing pip or download source code , run "python setup.py install". tried installing virtualenv , straight scheme well. log of pip:

------------------------------------------------------------ c:\entorno\scripts\pip-script.py run on 02/14/13 15:33:32 downloading/unpacking pillow running setup.py egg_info bundle pillow running egg_info writing pip-egg-info\pillow.egg-info\pkg-info writing top-level names pip-egg-info\pillow.egg-info\top_level.txt writing dependency_links pip-egg-info\pillow.egg-info\dependency_links.txt c:\python27\lib\distutils\dist.py:267: userwarning: unknown distribution option: 'use_2to3' warnings.warn(msg) warning: manifest_maker: standard file '-c' not found reading manifest file 'pip-egg-info\pillow.egg-info\sources.txt' reading manifest template 'manifest.in' warning: no previously-included files found matching '.hgignore' warning: no previously-included files found matching '.hgtags' warning: no previously-included files found matching 'buildme.bat' warning: no previously-included files found matching 'make-manifest.py' warning: no previously-included files found matching 'ship' warning: no previously-included files found matching 'ship.bat' warning: no previously-included files matching '*' found under directory 'tests' writing manifest file 'pip-egg-info\pillow.egg-info\sources.txt' source in c:\entorno\build\pillow has version 1.7.8, satisfies requirement pillow installing collected packages: pillow running setup.py install pillow running command c:\entorno\scripts\python.exe -c "import setuptools;__file__='c:\\entorno\\build\\pillow\\setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\docume~1\aaa\config~1\temp\pip-8kdxpq-record\install-record.txt --single-version-externally-managed --install-headers c:\entorno\include\site\python2.7 running install running build running build_py running build_ext building '_imaging' extension creating build\temp.win32-2.7 creating build\temp.win32-2.7\release creating build\temp.win32-2.7\release\libimaging c:\mingw\bin\gcc.exe -mno-cygwin -mdll -o -wall -ilibimaging -ic:\entorno\include -ic:\python27\include -ic:\entorno\pc -c _imaging.c -o build\temp.win32-2.7\release\_imaging.o c:\mingw\bin\gcc.exe -mno-cygwin -mdll -o -wall -ilibimaging -ic:\entorno\include -ic:\python27\include -ic:\entorno\pc -c decode.c -o build\temp.win32-2.7\release\decode.o c:\mingw\bin\gcc.exe -mno-cygwin -mdll -o -wall -ilibimaging -ic:\entorno\include -ic:\python27\include -ic:\entorno\pc -c encode.c -o build\temp.win32-2.7\release\encode.o c:\mingw\bin\gcc.exe -mno-cygwin -mdll -o -wall -ilibimaging -ic:\entorno\include -ic:\python27\include -ic:\entorno\pc -c map.c -o build\temp.win32-2.7\release\map.o c:\mingw\bin\gcc.exe -mno-cygwin -mdll -o -wall -ilibimaging -ic:\entorno\include -ic:\python27\include -ic:\entorno\pc -c display.c -o build\temp.win32-2.7\release\display.o in file included display.c:40: libimaging/imdib.h:38: error: expected specifier-qualifier-list before 'uint8' display.c: in function '_fromstring': display.c:186: error: 'struct imagingdibinstance' has no fellow member named 'ysize' display.c:186: error: 'struct imagingdibinstance' has no fellow member named 'linesize' display.c:191: error: 'struct imagingdibinstance' has no fellow member named 'bits' display.c: in function '_tostring': display.c:204: error: 'struct imagingdibinstance' has no fellow member named 'bits' display.c:204: error: 'struct imagingdibinstance' has no fellow member named 'ysize' display.c:204: error: 'struct imagingdibinstance' has no fellow member named 'linesize' display.c: in function '_getattr': display.c:230: error: 'struct imagingdibinstance' has no fellow member named 'mode' display.c:232: error: 'struct imagingdibinstance' has no fellow member named 'xsize' display.c:232: error: 'struct imagingdibinstance' has no fellow member named 'ysize' display.c: in function 'pyimaging_drawwmf': display.c:761: warning: pointer targets in passing argument 2 of 'setwinmetafilebits' differ in signedness display.c:767: warning: pointer targets in passing argument 2 of 'setenhmetafilebits' differ in signedness display.c:793: warning: passing argument 4 of 'createdibsection' incompatible pointer type c:\python27\lib\distutils\dist.py:267: userwarning: unknown distribution option: 'use_2to3' warnings.warn(msg) error: command 'gcc' failed exit status 1 finish output command c:\entorno\scripts\python.exe -c "import setuptools;__file__='c:\\entorno\\build\\pillow\\setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\docume~1\aaa\config~1\temp\pip-8kdxpq-record\install-record.txt --single-version-externally-managed --install-headers c:\entorno\include\site\python2.7: running install running build running build_py running build_ext building '_imaging' extension creating build\temp.win32-2.7 creating build\temp.win32-2.7\release creating build\temp.win32-2.7\release\libimaging c:\mingw\bin\gcc.exe -mno-cygwin -mdll -o -wall -ilibimaging -ic:\entorno\include -ic:\python27\include -ic:\entorno\pc -c _imaging.c -o build\temp.win32-2.7\release\_imaging.o c:\mingw\bin\gcc.exe -mno-cygwin -mdll -o -wall -ilibimaging -ic:\entorno\include -ic:\python27\include -ic:\entorno\pc -c decode.c -o build\temp.win32-2.7\release\decode.o c:\mingw\bin\gcc.exe -mno-cygwin -mdll -o -wall -ilibimaging -ic:\entorno\include -ic:\python27\include -ic:\entorno\pc -c encode.c -o build\temp.win32-2.7\release\encode.o c:\mingw\bin\gcc.exe -mno-cygwin -mdll -o -wall -ilibimaging -ic:\entorno\include -ic:\python27\include -ic:\entorno\pc -c map.c -o build\temp.win32-2.7\release\map.o c:\mingw\bin\gcc.exe -mno-cygwin -mdll -o -wall -ilibimaging -ic:\entorno\include -ic:\python27\include -ic:\entorno\pc -c display.c -o build\temp.win32-2.7\release\display.o in file included display.c:40: libimaging/imdib.h:38: error: expected specifier-qualifier-list before 'uint8' display.c: in function '_fromstring': display.c:186: error: 'struct imagingdibinstance' has no fellow member named 'ysize' display.c:186: error: 'struct imagingdibinstance' has no fellow member named 'linesize' display.c:191: error: 'struct imagingdibinstance' has no fellow member named 'bits' display.c: in function '_tostring': display.c:204: error: 'struct imagingdibinstance' has no fellow member named 'bits' display.c:204: error: 'struct imagingdibinstance' has no fellow member named 'ysize' display.c:204: error: 'struct imagingdibinstance' has no fellow member named 'linesize' display.c: in function '_getattr': display.c:230: error: 'struct imagingdibinstance' has no fellow member named 'mode' display.c:232: error: 'struct imagingdibinstance' has no fellow member named 'xsize' display.c:232: error: 'struct imagingdibinstance' has no fellow member named 'ysize' display.c: in function 'pyimaging_drawwmf': display.c:761: warning: pointer targets in passing argument 2 of 'setwinmetafilebits' differ in signedness display.c:767: warning: pointer targets in passing argument 2 of 'setenhmetafilebits' differ in signedness display.c:793: warning: passing argument 4 of 'createdibsection' incompatible pointer type c:\python27\lib\distutils\dist.py:267: userwarning: unknown distribution option: 'use_2to3' warnings.warn(msg) error: command 'gcc' failed exit status 1 ---------------------------------------- command c:\entorno\scripts\python.exe -c "import setuptools;__file__='c:\\entorno\\build\\pillow\\setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\docume~1\aaa\config~1\temp\pip-8kdxpq-record\install-record.txt --single-version-externally-managed --install-headers c:\entorno\include\site\python2.7 failed error code 1 in c:\entorno\build\pillow exception information: traceback (most recent phone call last): file "c:\entorno\lib\site-packages\pip-1.2.1-py2.7.egg\pip\basecommand.py", line 107, in main status = self.run(options, args) file "c:\entorno\lib\site-packages\pip-1.2.1-py2.7.egg\pip\commands\install.py", line 261, in run requirement_set.install(install_options, global_options) file "c:\entorno\lib\site-packages\pip-1.2.1-py2.7.egg\pip\req.py", line 1166, in install requirement.install(install_options, global_options) file "c:\entorno\lib\site-packages\pip-1.2.1-py2.7.egg\pip\req.py", line 589, in install cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=false) file "c:\entorno\lib\site-packages\pip-1.2.1-py2.7.egg\pip\util.py", line 612, in call_subprocess % (command_desc, proc.returncode, cwd)) installationerror: command c:\entorno\scripts\python.exe -c "import setuptools;__file__='c:\\entorno\\build\\pillow\\setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\docume~1\aaa\config~1\temp\pip-8kdxpq-record\install-record.txt --single-version-externally-managed --install-headers c:\entorno\include\site\python2.7 failed error code 1 in c:\entorno\build\pillow

it not library have problems, need install one.

thank you!

ps: google translation translatios, sorry.

when tried install pillow under windows, got similar gcc failure, , reason apparently outdated setuptools version.

installation docs say:

python wheel note: experimental. requires setuptools >=0.8 , pip >=1.4.1 $ pip install --use-wheel pillow

so, updated setuptools (making sure removed old version), , pip install started work flawlessly.

python mingw pip

html - How would you display a sent message in PHP without redirecting through header location? -



html - How would you display a sent message in PHP without redirecting through header location? -

i using jquery mobile , has issues loading external files - displaying "error loading page" message. can't utilize header location in php redirect page after submiting form.

how display sent message underneath submit button 1 time it's been pressed?

this html:

<form method="post" id="update_beer" action="php/input_pint.php"> <p><label for="name">your name</label><input type="text" size="30" name="name" id="name" /></p> <p><label for="price">price of pint</label><input type="number" name="price" id="price" cols="5" /></p> <p><input type="submit" value="update" name="commit" id="message_submit"/> or <a class="close" href="/">cancel</a></p> </form>

this php sending input database:

<?php //input price_pint.php $con = mysql_connect("hostname", "databasename", "password"); if (!$con) { die("could not connect." . mysql_error()); } mysql_select_db("databasename", $con); $sql="insert price_pints (name, price) values ('$_post[name]','$_post[price]')"; if (!mysql_query($sql,$con)) { die('error: ' . mysql_error()); } mysql_close($con); ?>

i don't know how relate echo message form.

you can utilize ajax, need sql escape inputs, else drink foster's sam smith's ect going break query.

<script> $("#update_beer").submit(function(e){ $.ajax({ type: "post", url: "php/input_pint.php", data: $("#update_beer").serialize(), success: function(data){ if(data=='true'){ alert('beer added'); } } }); e.preventdefault(); }); </script>

also heres improve way of connecting , inserting database, using pdo:

<?php seek { $db = new pdo("mysql:host=127.0.0.1;dbname=databasename", 'dbuser', 'dbpassword'); $db->setattribute(pdo::attr_errmode, pdo::errmode_exception); $db->setattribute(pdo::attr_emulate_prepares, false); }catch (exception $e){ die('cannot connect mysql server.'); } if($_server['request_method']=='post'){ if(!empty($_post['name']) && !empty($_post['price'])){ $sql = 'insert price_pints (`name`,`price`) values (:name,:price)'; $query = $db->prepare($sql); $query->bindparam(':name', $_post['name'], pdo::param_str); $query->bindparam(':price', $_post['price'], pdo::param_str); $query->execute(); die('true'); } } die('false'); ?>

php html forms jquery-mobile echo

matlab - Sudoku Solver, check each 3x3 box -



matlab - Sudoku Solver, check each 3x3 box -

to sum problem in nutshell, checking each 3x3 box if there 1 missing value, if there is, computes number is, , fills number in. however, upper left 3x3 box, , stops there. here snippet of code relates issue. if you'd see rest of code inquire , i'll post rest.

edit: user inputs board. test purposes tried inputting completed sudoku puzzle, , take out top right value in each box. filled in first 3x3, still output board @ end, had 8 other blanks fill in (from other 8 3x3 boxes)

% check each 3x3 box 1 through nine, fill in = 0:2 j = 0:2 if sum(sum(board([1:3]+i*3,[1:3]+j*3)~=0))==8 [row,col] = find(board([1:3]+i*3,[1:3]+j*3)==0); reply = 45 - sum(sum(board([1:3]+i*3,[1:3]+j*3))); board(row,col) = answer; end end end disp(board);

you close. problem each block getting row , column index of 3x3 block. so, each block next true: row <= 3 , col <= 3.

you can solve adding these 2 lines after line utilize find:

row = row + (3*i); col = col + (3*j);

this way convert block-relative index board-relative index.

matlab

unity3d - Display precise time remaining -



unity3d - Display precise time remaining -

i have next code , want add together miliseconds var display this:

minutes : seconds : miliseconds

2 : 35 : 98

time.time time elapsed app begin, update function gets called every frame.

var starttime:float; var timeremaining:float; var minutes:int; var seconds:int; var miliseconds:int; var timestr:string; function start () { starttime = 130.0; } function update () { timeremaining = starttime - time.time; minutes = timeremaining / 60; seconds = timeremaining % 60; //miliseconds = ? timestr = minutes.tostring()+":"+seconds.tostring("d2"); guitext.text = timestr; }

if understand correctly trying do, seek code:

var starttime:float; var timeremaining:float; var minutes:int; var seconds:int; var miliseconds:int; var timestr:string; function start () { starttime = 130.0; } function update () { timeremaining = starttime - time.time; minutes = timeremaining / 60; seconds = timeremaining; miliseconds = timeremaining * 1000; seconds -= minutes*60; miliseconds -= seconds*1000; timestr = minutes.tostring()+":"+seconds.tostring("d2")+":"+miliseconds.tostring(); guitext.text = timestr; }

unity3d countdowntimer unityscript

c++ - How to use wm_deadchar to send non Ascii signs -



c++ - How to use wm_deadchar to send non Ascii signs -

i'm trying send umlaut keyevent function keybd_event. windows documentation states that: "a dead key key generates character, such umlaut (double-dot), combined character form composite character. example, umlaut-o character (Ö) generated typing dead key umlaut character, , typing o key."

how emit dead key?

i tried next without success:

keybd_event(wm_deadchar,0x0103,0,0); keybd_event(0x4f,0,0,0);

sorry bad english. forwards reply.

the first argument keybd_event virtual-key code. e.g. keyboard dead key " vk_oem_7.

c++ windows winapi

database - Getting results based on condition from another table in SQL SERVER -



database - Getting results based on condition from another table in SQL SERVER -

i have got 2 tables microhydel application, 1 consists monthly billing record of consumers monthly client bill generated.

create table billing_history( [id] [numeric](18, 0) identity(1,1) not null, [reading_date] [date] not null, [reading_year] [smallint] null, [reading] [numeric](18, 0) not null, [consumer_id] [int] not null, [paid_amount] [numeric](18, 0) null)

i have table stores different slab per unit cost both commercial , domestic users.

create table [rate_list]( [flag] [varchar](50) null, [limit] [numeric](18, 0) not null, [price] [numeric](18, 0) not null, [service_charges] [numeric](18, 0) not null, [surcharge] [numeric](18, 0) not null )

for e.g domestic client consuming 50 units or less electricity monthly charged differently commercial client consuming same amount of electricity. consuming units on slab have rate applied on them.

thanks @bluefeet have query generate numbers of units consumed first table using query

select c.consumer_id, sum(c.reading - isnull(pre.reading, 0)) totalreading ( select consumer_id, reading, month(getdate()) curmonth, year(getdate()) curyear, case when month(getdate()) = 1 12 else month(getdate()) -1 end premonth, case when month(getdate()) = 1 year(getdate())-1 else year(getdate()) end preyear billing_history month(reading_date) = month(getdate()) , year(reading_date) = year(getdate()) ) c left bring together billing_history pre on c.consumer_id = pre.consumer_id , month(pre.reading_date) = c.premonth , year(pre.reading_date) = c.preyear grouping c.consumer_id;

however need generate monthly bill each client e.g according rates in rate_list table. key here domestic/commercial has different slabs number of units consumed.

any ideas

a few comments on answer.

first, wasn't not sure type_of_connection flag nowadays in sql fiddle posted added consumers.

second, think need alter price_list2 table include limit start , end values prices. otherwise hard determine cost each consumer.

i used next price_list2 table contain start/end values each limit:

create table [price_list2]( [flag] [varchar](50) null, [limitstart] [numeric](18, 0) not null, [limitend] [numeric](18, 0) not null, [price] [numeric](18, 0) not null, [service_charges] [numeric](18, 0) not null, [surcharge] [numeric](18, 0) not null);

on query, using tables , original query posted should able utilize this:

select c.consumer_id, r.totalreading * p.price totalbill consumers c inner bring together ( select c.consumer_id, sum(c.reading - isnull(pre.reading, 0)) totalreading ( select consumer_id, reading, month(getdate()) curmonth, year(getdate()) curyear, case when month(getdate()) = 1 12 else month(getdate()) -1 end premonth, case when month(getdate()) = 1 year(getdate())-1 else year(getdate()) end preyear billing_history month(reading_date) = month(getdate()) , year(reading_date) = year(getdate()) ) c left bring together billing_history pre on c.consumer_id = pre.consumer_id , month(pre.reading_date) = c.premonth , year(pre.reading_date) = c.preyear grouping c.consumer_id ) r on c.consumer_id = r.consumer_id inner bring together price_list2 p on c.type_of_connection = p.flag , r.totalreading between p.limitstart , p.limitend

see sql fiddle demo

as can see when joining on price_list2 table joining on start/end range of limits. allows determine cost should used bill.

sql-server database

Ant get file creation timestamp -



Ant get file creation timestamp -

i writing manifest.xml file during ant build opencms project.

i need able pull file's create date, , lastly modified date on file. (although current process giving each file timestamp of wed, 31 dec 1969 19:00:00 est anyway -- @ to the lowest degree on windows machines when run build.)

is there way can pull creation date timestamp of file in ant? i'm using standard ant tasks , ant-contrib tasks.

it depends on os, f.e. unix doesn't store file creation time, see details here 2 possible solutions :

solution 1, works on windows java >= 6, no addons needed

<project> <!-- works on windows only, uses jdk builtin rhino javascript engine (since jdk6) utilize dir command without /t:c lastmodificationtime --> <macrodef name="getfiletimes"> <attribute name="dir" /> <attribute name="file" /> <attribute name="setprop" default="@{file}_ctime" /> <sequential> <exec executable="cmd" dir="@{dir}" outputproperty="@{setprop}"> <arg value="/c" /> <arg line="dir @{file} /t:c|find ' @{file}'" /> </exec> <script language="javascript"> tmp = project.getproperty("@{setprop}").split("\\s+") ; project.setproperty("@{setprop}", tmp[0] + "/" + tmp[1]) ; </script> </sequential> </macrodef> <getfiletimes dir="c:/tmp" file="bookmarks.html" /> <echo> $${bookmarks.html_ctime} => ${bookmarks.html_ctime} </echo> </project>

solution 2, needs java 7 , groovy-all-2.1.0.jar (contained in groovy binary release)adjust simpledateformat liking. on unix filesystems when asking creationtime you'll lastly modification time.

<project> <taskdef name="groovy" classname="org.codehaus.groovy.ant.groovy"/> <!-- solution java 7, uses nio bundle needs groovy-all-2.1.0.jar --> <macrodef name="getfiletimes"> <attribute name="file"/> <attribute name="ctimeprop" default="@{file}_ctime"/> <attribute name="mtimeprop" default="@{file}_mtime"/> <sequential> <groovy> import java.nio.file.* import java.nio.file.attribute.* import java.text.* import java.util.date.* path path = paths.get("@{file}") basicfileattributeview view = files.getfileattributeview(path, basicfileattributeview.class) basicfileattributes attributes = view.readattributes() lastmodifiedtime = attributes.lastmodifiedtime() createtime = attributes.creationtime() dateformat df = new simpledateformat("dd-mmm-yyyy hh:mm:ss", locale.us) df.format(new date(createtime.tomillis())) properties.'@{ctimeprop}' = df.format(new date(createtime.tomillis())) properties.'@{mtimeprop}' = df.format(new date(lastmodifiedtime.tomillis())) </groovy> </sequential> </macrodef> <getfiletimes file="c:/tmp/bookmarks.html"/> <echo> $${c:/tmp/bookmarks.html_ctime} => ${c:/tmp/bookmarks.html_ctime} $${c:/tmp/bookmarks.html_mtime} => ${c:/tmp/bookmarks.html_mtime} </echo> </project>

i tried using builtin javascript engine, got errors :

sun.org.mozilla.javascript.internal.evaluatorexception: missing name after . operator

imo, simple things using javascript <script language="javascipt"> sufficient, if need import java packages etc. .. it's pita. groovy works.

ant

php - Using item's name in the URL address instead of IDs -



php - Using item's name in the URL address instead of IDs -

i have built php-mysql website retrieves products database. items taken id in url this: index.php?id=25.

however, read not best alternative seo purposes.

is there simple way have item name , category populated in url instead of id number? or should phone call each item using field name , category database?

thanks!

when print link add together detail (that index.php not utilize anyway).

so links like: index.php?id=25&c=airplanes&q=fighter+jet+z672

index.php function before via id , ignore &c= , &q=.

to create improve you'll utilize .htaccess file rewrite links like: mysite.com/airplanes/25-fighter-jet-z672

php mysql url

android - GridLayout and width -



android - GridLayout and width -

i'm creating gridlayout number of buttons within it.

i want width of gridlayout match device screen, don't know if should menage width of gridlayout or witdhs of buttons within gridlayout.

i add together buttons gridlayout dynamically. buttons might needs more space space screen gives them! that's why don't know how menage it.

if want gridlayout match devices width set layout xml to:

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".gridactivity" > <gridlayout android:id="@+id/button_grid" android:layout_width="fill_parent" android:layout_height="wrap_content" > </gridlayout> </relativelayout>

android

d3.js - Difference between GeoJSON and TopoJSON -



d3.js - Difference between GeoJSON and TopoJSON -

what difference between geojson , topojson , when utilize 1 on other?

the description of topojson on github implies topojson files 80% smaller. why not utilize topojson time?

if care file size or topology, utilize topojson. if don’t care either, utilize geojson simplicity’s sake.

the primary advantage of topojson size. eliminating redundancy , using more efficent fixed-precision integer encoding of coordinates, topojson files order of magnitude smaller geojson files. secondary advantage of topojson files encoding topology has useful applications, such topology-preserving simplification (similar mapshaper) , automatic mesh generation (as in state-state boundaries in this illustration choropleth).

these advantages come @ cost: more complex file format. in javascript, example, you’d typically utilize topojson client library convert topojson geojson utilize standard tools such d3.geo.path. (in python, can utilize topojson.py.) also, topojson’s integer format requires quantizing coordinates, means can introduce rounding error if you’re not careful. (see documentation topojson -q.)

for server-side manipulation of geometries not require topology, geojson simpler choice. otherwise, if need topology or want send geometry on wire client, utilize topojson.

d3.js gis geojson

symfony2 - Call to undefined method Doctrine\Bundle\DoctrineBundle\Registry::persist() -



symfony2 - Call to undefined method Doctrine\Bundle\DoctrineBundle\Registry::persist() -

i upgraded 1 of projects symfony 2.0.x 2.1.x

everything works fine, when seek persist entity in service, php throws error:

call undefined method doctrine\bundle\doctrinebundle\registry::persist()

in controllers, works fine. fetching objects db in service works, no phone call ->persist($entity).

this service definition:

registration_form: class: knowhow\eregistration\backendbundle\service\registrationformservice arguments: [ @doctrine ]

and class:

class registrationformservice { /** @var $em \doctrine\orm\entitymanager */ private $em; /** * ctor. * * @param $doctrine */ public function __construct($doctrine) { $this->em = $doctrine; } }

this okay, when seek thi $this->em->persist($entity) error gets thrown.

i have no thought what's going on there.

you have inject @doctrine.orm.entity_manager you're trying do

registration_form: class: knowhow\eregistration\backendbundle\service\registrationformservice arguments: [ @doctrine ] ----^ (isn't good)

modify to

registration_form: class: knowhow\eregistration\backendbundle\service\registrationformservice arguments: [ @doctrine.orm.entity_manager ]

alternatively, have utilize somthing (in constructor)

public function __construct(doctrine $doctrine) { $this->em = $doctrine->getentitymanager(); }

as cyprian suggest, i'll add together type of $doctrine variable type checking. don't know if doctrine right class, suppose is

i suggest inject entity_manager if don't need whole doctrine vendor

symfony2 doctrine2 symfony-2.1

onclick - JQuery capturing click event on nested a tag in li -



onclick - JQuery capturing click event on nested a tag in li -

i'm having problem capturing jquery onclick event on nested tag within ul

<ul class="paginate"> <li>>1</li> <li> <a href="http://www.xxx.co.uk/xxx/" onclick="ajaxpage('2',true,'left'); homecoming false;">2</a>

i've tried number of ways capture if user clicks on tag, nil seems work;

$('.paginate li').click(function(){ alert('caught page'); }); $('ul.paginate li').click(function(){ alert('caught page'); }); $('.paginate li a').click(function(){ alert('caught page'); });

can help?

$(document).ready(function() { $('ul.paginate li').click(function(e) { alert('caught page'); }); }

jquery onclick

python - How to tell whether an update statement is successful in pysqlite 2.6.3 -



python - How to tell whether an update statement is successful in pysqlite 2.6.3 -

i'm using pysqlite talk sqlite db, , wonder right way check whether update sql statement has update in table.

is there variable can check after execution in pysqlite?

check cursor.rowcount attribute; it'll indicate number of affected rows.

if update not successful rowcount 0:

>>> conn = sqlite3.connect(':memory:') >>> conn.execute('create table foo (bar, baz)') <sqlite3.cursor object @ 0x1042ab6c0> >>> conn.execute('insert foo values (1, 2)') <sqlite3.cursor object @ 0x1042ab730> >>> cursor = conn.cursor() >>> cursor.execute('update foo set baz=3 bar=2') <sqlite3.cursor object @ 0x1042ab6c0> >>> cursor.rowcount 0 >>> cursor.execute('update foo set baz=3 bar=1') <sqlite3.cursor object @ 0x1042ab6c0> >>> cursor.rowcount 1

of course, if seek update table or column doesn't exist, exception thrown instead:

>>> cursor.execute('update nonesuch set baz=3 bar=2') traceback (most recent phone call last): file "<stdin>", line 1, in <module> sqlite3.operationalerror: no such table: nonesuch >>> cursor.execute('update foo set nonesuchcolumn=3 bar=2') traceback (most recent phone call last): file "<stdin>", line 1, in <module> sqlite3.operationalerror: no such column: nonesuchcolumn

i used sqlite3 library included python demo this; pysqlite2 added python under name in python 2.5. difference simply import:

try: import sqlite3 # included library except importerror: pysqlite2 import dbapi2 sqlite3 # utilize pysqlite2 instead

python sqlite pysqlite

apache - RedirectMatch Equivalent of a Mod_Rewrite Rule for Rearranging Directory Structure -



apache - RedirectMatch Equivalent of a Mod_Rewrite Rule for Rearranging Directory Structure -

i want recreate mod_rewrite rule in form of redirectmatch directive.

first, please take @ mod_rewrite rule:

rewriteengine on rewritecond %{http_host} (www.)?africananimals.com rewritecond %{request_uri} zebras rewriterule ^(stripes|hooves)/zebras/?$ zebras/$1 [r,l]

the rule (written helpful , knowledgeable stackoverflow contributor) tells server transform these 4 urls:

http://africananimals.com/stripes/zebras

http://africananimals.com/hooves/zebras

http://www.africananimals.com/stripes/zebras

http://www.africananimals.com/hooves/zebras

-- these improve , more logically structured ones:

http://africananimals.com/zebras/stripes

http://africananimals.com/zebras/hooves

http://www.africananimals.com/zebras/stripes

http://www.africananimals.com/zebras/hooves

(these not actual urls, examples.)

there other websites on hosting server, may happen have identical directory structure, first conditional ensures rule applied africananimals.com domain, or without www.

the sec conditional ensures rule applied when word "zebras" nowadays in url.

the rule selects either "stripes" or "hooves" followed "/zebras" or "/zebras/" , rewrites url, placing selected item (either "stripes" or "hooves") after "zebras/" – exactly should done.

question: how can same task accomplished using redirectmatch directive?

being apache amateur, much appreciate insight professional.

i guess it:

redirectmatch 301 ^/(stripes|hooves)/zebras/?$ http://africananimals.com/zebras/$1

apache mod-rewrite url-rewriting rewrite

css3 - CSS transition going backwards/reverse -



css3 - CSS transition going backwards/reverse -

i'm wondering if there way utilize same css transition instance both move forwards , backwards/reverse. example, lets have transition:

@-webkit-keyframes fade-transition { { opacity: 0; } { opacity: 1; } }

and 2 runners transition. 1 fade in , other fade out:

.fade-in { -webkit-animation: fade-transition .2s linear backwards; } .fade-out { -webkit-animation: fade-transition .2s linear forwards; }

what want accomplish utilize same transition both fade in , fade out way i'm doing doesn't work.

here illustration on jsbin.

use percentage instead of from , to

@-webkit-keyframes fade-transition { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }

you can iterate number of times want or set infinite

css css3 animation transition

java - what is Gang of Four design pattern -



java - what is Gang of Four design pattern -

this question has reply here:

examples of gof design patterns in java's core libraries 7 answers

i have come know there design pattern in java called gang of 4 (gof). i'm not able understand , what's use. can create me clear on this? in advance.

the authors of designpatternsbook came known "gang of four." name of book ("design patterns: elements of reusable object-oriented software") long e-mail, "book gang of four" became shorthand name it.

after all, isn't book on patterns. got shortened "gof book", pretty cryptic first time hear it.

source: http://c2.com/cgi/wiki?gangoffour

java design design-patterns

javascript - Drawing App - Curve Fitting -



javascript - Drawing App - Curve Fitting -

i'm working on web-based drawing app, utilize position of pointer generate line. speed determines width of line.

my problem browser events not produce clean info when getting position, width becomes quite "jittery" other beingness soft , smooth.

i'm wondering best way smooth out sort of info drawing beingness made? thinking on curve fitting, i'm not sure algorithm work improve in case.

p.s. i'm not redrawing line start every single time on canvas, i'm adding "final part".

thanks!

you might seek pulling both "smooth" , "simplify" functions out of paper.js (their mit license allows this). worked me in border detection project. check out here: http://paperjs.org/tutorials/paths/smoothing-simplifying-flattening.

javascript canvas drawing curve-fitting

jquery - Passing variable to window.location href -



jquery - Passing variable to window.location href -

this question has reply here:

how can create page redirect using jquery? 53 answers jquery location href? [duplicate] 6 answers

i'm trying delay outgoing links when clicked, googles event tracking have time occur.

i wrote next code, i'm unsure of how pass variable window.location. adds string "url" , not link adress. doing wrong?

$("a.private-product-order-button").click(function(e) { e.preventdefault(); _gaq.push(['_trackevent', 'order buttons', 'click', 'service']); var url = $(this).attr("href"); settimeout(function() { $(window.location).attr('href', 'url'); }, 200); });

no need utilize jquery set property of location object (and no need utilize jquery href property of anchor object):

$("a.private-product-order-button").click(function(e) { e.preventdefault(); _gaq.push(['_trackevent', 'order buttons', 'click', 'service']); var url = this.href; settimeout(function() { window.location.href = url; }, 200); });

jquery redirect settimeout window.location

Advanced sorting of a multidimensional array in PHP -



Advanced sorting of a multidimensional array in PHP -

i have looked through answers sorting multidimensional arrays in php on stack overflow, none have straight answered question.

from various answers have understood should using either php usort function or php array_multisort function, not sure how apply these specific array structure:

here variable $array:

array ( [0] => array ( [field1] => 10 [field2] => 100 [field3] => 100 [subarray] => array ( [0] => array ( [field1] => 10 [field2] => 100 [field3] => 100 ) [1] => array ( [field1] => 10 [field2] => 100 [field3] => abcorderbythis ) ) ) [1] => array ( [field1] => 10 [field2] => 100 [field3] => 100 [subarray] => array ( [0] => array ( [field1] => 10 [field2] => 100 [field3] => 100 ) [1] => array ( [field1] => 10 [field2] => 100 [field3] => ghiorderbythis ) ) ) [2] => array ( [field1] => 10 [field2] => 100 [field3] => 100 [subarray] => array ( [0] => array ( [field1] => 10 [field2] => 100 [field3] => 100 ) [1] => array ( [field1] => 10 [field2] => 100 [field3] => deforderbythis ) ) ) )

i able sort array field3 of last array in subarray. accessing element easy plenty php end function so:

<?php foreach($array $array_single){ foreach(end($array_single['subarray']) $sub_array){ echo $sub_array; } } ?>

and on i'm stuck in how sort multidimensional array alphabetically next result:

$array[0] - remains on top because field3 value abcorderbythis $array[2] - jumps middle because field3 value deforderbythis $array[1] - @ bottom because field3 value ghiorderbythis

thanks in advance!

try code:

$array = array(); $arraytemp['field1'] = 10; $arraytemp['field2'] = 100; $arraytemp['field3'] = 100; $arraytemp['subarray'][0]["field1"] = 10; $arraytemp['subarray'][0]["field2"] = 100; $arraytemp['subarray'][0]["field3"] = 100; $arraytemp['subarray'][1]["field1"] = 10; $arraytemp['subarray'][1]["field2"] = 100; $arraytemp['subarray'][1]["field3"] = "abcorderbythis"; $array[] = $arraytemp; $arraytemp['field1'] = 10; $arraytemp['field2'] = 100; $arraytemp['field3'] = 100; $arraytemp['subarray'][0]["field1"] = 10; $arraytemp['subarray'][0]["field2"] = 100; $arraytemp['subarray'][0]["field3"] = 100; $arraytemp['subarray'][1]["field1"] = 10; $arraytemp['subarray'][1]["field2"] = 100; $arraytemp['subarray'][1]["field3"] = "ghiorderbythis"; $array[] = $arraytemp; $arraytemp['field1'] = 10; $arraytemp['field2'] = 100; $arraytemp['field3'] = 100; $arraytemp['subarray'][0]["field1"] = 10; $arraytemp['subarray'][0]["field2"] = 100; $arraytemp['subarray'][0]["field3"] = 100; $arraytemp['subarray'][1]["field1"] = 10; $arraytemp['subarray'][1]["field2"] = 100; $arraytemp['subarray'][1]["field3"] = "deforderbythis"; $array[] = $arraytemp; // sort multidimensional array usort($array, "custom_sort"); // define custom sort function used in usort function custom_sort($a,$b) { homecoming strcmp($a['subarray'][1]["field3"], $b['subarray'][1]["field3"]); }

php multidimensional-array

c# - SqlBulkCopy Insert with Identity Column -



c# - SqlBulkCopy Insert with Identity Column -

i using sqlbulkcopy object insert couple 1000000 generated rows database. problem table inserting has identity column. have tried setting sqlbulkcopyoptions sqlbulkcopyoptions.keepidentity , setting identity column 0's, dbnull.value , null. none of have worked. sense missing pretty simple, if enlighten me fantastic. thanks!

edit clarify, not have identity values set in datatable importing. want them generated part of import.

edit 2 here code utilize create base of operations sqlbulkcopy object.

sqlbulkcopy sbc = getbulkcopy(sqlbulkcopyoptions.keepidentity); sbc.destinationtablename = lookup_table; private static sqlbulkcopy getbulkcopy(sqlbulkcopyoptions options = sqlbulkcopyoptions.default) { configuration cfg = webconfigurationmanager.openwebconfiguration("/rswifi"); string connstring = cfg.connectionstrings.connectionstrings["wifidata"].connectionstring; homecoming new sqlbulkcopy(connstring, options); }

to have destination table assign identity, not utilize sqlbulkcopyoptions.keepidentity option. instead, don't map identity source, , don't extract source send through sqlbulkcopy.

c# sql-server sqlbulkcopy identity-insert

facebook - How to retrieve User Token with server side app integration -



facebook - How to retrieve User Token with server side app integration -

the objective extremely simple, yet there no examples on how retrieve user token associated running app.

my objective pull public facebook page (business page finish open access) app have created in facebook mere created app id , secret can have php perform request info , iterate on homepage. simple, yet documentation on site deals facebook logins have no intention of doing. want feeds public business page on site.

this think facebook goes horribly wrong. here code far queries generates empty info set:

$app_id = "app_id"; $app_secret = "app_secret"; $app_token_url = "https://graph.facebook.com/oauth/access_token?" . "client_id=" . $app_id . "&client_secret=" . $app_secret . "&grant_type=client_credentials"; $response = file_get_contents($app_token_url); $params = null; parse_str($response, $params); $graph_url = "https://graph.facebook.com/202978003068170/feed?access_token=".$params['access_token']; $app_details = json_decode(file_get_contents($graph_url), true); echo '<pre>'; var_dump($app_details); echo '<pre>';

now allow clarify actual access_token value because facebook vague ambiguous this. there 2 types of access tokens , app have created has both types if logged in , working on app can see here: https://developers.facebook.com/tools/access_token/

the major problem access_token value oauth returns code above "app token" has no problem querying user profile info (which kinda scary) returns blank info when seek query public business page {"data":[]} have enabled permissions for. after week of trying out different methods , slamming head on desk , finding partial salvation through 3rd party sources of info did figure out difference between these two.

i have ran across post on here said have 2nd oauth query pull app's "user token" (which have tested user token associated app token token debugger in fbook , works) facebook query consist.

please help. should not difficult, not wanting users login site fbook. want display business events, feeds , pictures on business website.

thank you

facebook facebook-graph-api

How to get list of all bookmark-elements from a Word document to an array in order by location: VBA / Word -



How to get list of all bookmark-elements from a Word document to an array in order by location: VBA / Word -

i want fetch bookmarks in word document, , force them array. bookmarks must sorted location in document not name.

ex. here's list of bookmarks in document,

[bm_s] (header) [bm_h] (title) [bm_a] (footer)

i want bookmarks maintain order array following,

array {bm_s, bm_h, bm_a, }

ex. how should not below,

array {bm_a, bm_h, bm_s, }

i got fetching of bookmarks document working. bookmarks in random order when fetching , pushing array.

oki, figured out,

here's how done if else interested in fetching of bookmarks respect location on document.

dim objdoc document set objdoc = activedocument = 1 objdoc.bookmarks.count debug.print objdoc.range.bookmarks(i) 'here can alter code force bookmarks in array next

vba ms-word word-vba

java - Need help getting Spring, Hibernate project working again with Hibernate reverse engineering creates classes -



java - Need help getting Spring, Hibernate project working again with Hibernate reverse engineering creates classes -

i had project working few months firm moving new model classes need help getting spring, hibernate project working 1 time again hibernate reverse engineering science created.

below dao code worked in past

@transactional(readonly=true, propagation=propagation.required) public memberinquirylookup getmemberinquirylookup(string requester) {

log.debug("looking info for:" + requester); memberinquirylookup dr = (memberinquirylookup) sessionfactory.getcurrentsession() .get(memberinquirylookup.class, requester); if (dr == null) { log.debug("no info :" + requester + " found."); dr = new memberinquirylookup(); } homecoming dr; }

and here old model class:

@entity @table(name = " member_inquiry_lookup") public class memberinquiryinformation { @id @column(name = "email") private string email; @column(name = "first_name") private string first_name; @column(name = "last_name") private string last_name; public string getfirst_name() { homecoming first_name; } public void setfirst_name(string first_name) { first_name = first_name; } public string getlast_name() { homecoming last_name; } public void setlast_name(string last_name) { last_name = last_name; } @column(name = "member_id") private string member_id; @column(name = "school_id") private string school_id; @column(name = "title_id") private string title_id; @column(name = "title_description") private string title_description; @column(name = "school_search_name") private string school_search_name; @column(name = "borough_description") private string borough_description; @column(name = "district") private string district; @column(name = "phone") private string phone; @column(name = "file_number") private string file_number; @column(name = "member_group") private string member_group; public string getemail() { homecoming email; } public void setemail(string email) { this.email = email; } public string getmember_id() { homecoming member_id; } public void setmember_id(string member_id) { this.member_id = member_id; } public string getschool_id() { homecoming school_id; } public void setschool_id(string school_id) { this.school_id = school_id; } public string gettitle_id() { homecoming title_id; } public void settitle_id(string title_id) { this.title_id = title_id; } public string gettitle_description() { homecoming title_description; } public void settitle_description(string title_description) { this.title_description = title_description; } public string getschool_search_name() { homecoming school_search_name; } public void setschool_search_name(string school_search_name) { this.school_search_name = school_search_name; } public string getborough_description() { homecoming borough_description; } public void setborough_description(string borough_description) { this.borough_description = borough_description; } public string getdistrict() { homecoming district; } public void setdistrict(string district) { this.district = district; } public string getphone() { homecoming phone; } public void setphone(string phone) { this.phone = phone; } public string getfile_number() { homecoming file_number; } public void setfile_number(string file_number) { this.file_number = file_number; } public string getmember_group() { homecoming member_group; } /** * @return */ public string getqueue() { if (getmember_group().equalsignorecase("rt")) homecoming "retiree"; homecoming getborough_description(); /*if (getborough_description().equalsignorecase("bronx")) homecoming constants.bronx; if (getborough_description().equalsignorecase("brooklyn")) homecoming constants.brooklyn; if (getborough_description().equalsignorecase("queens")) homecoming constants.queens; if (getborough_description().equalsignorecase("manhattan")) homecoming constants.manattan; if (getborough_description().equalsignorecase("staten island")) homecoming constants.statenisland;*/ } public void setmember_group(string member_group) { this.member_group = member_group; } }

but hibernate reverse engineering science creates next 2 classed same table:

@entity @table(name = "member_inquiry_lookup") public class memberinquirylookup implements java.io.serializable { private memberinquirylookupid id; public memberinquirylookup() { } public memberinquirylookup(memberinquirylookupid id) { this.id = id; } @embeddedid @attributeoverrides({ @attributeoverride(name = "email", column = @column(name = "email", nullable = false)), @attributeoverride(name = "memberid", column = @column(name = "member_id")), @attributeoverride(name = "firstname", column = @column(name = "first_name", length = 15)), @attributeoverride(name = "lastname", column = @column(name = "last_name", length = 25)), @attributeoverride(name = "schoolid", column = @column(name = "school_id", length = 10)), @attributeoverride(name = "titleid", column = @column(name = "title_id", length = 5)), @attributeoverride(name = "titledescription", column = @column(name = "title_description", length = 60)), @attributeoverride(name = "schoolsearchname", column = @column(name = "school_search_name")), @attributeoverride(name = "boroughdescription", column = @column(name = "borough_description")), @attributeoverride(name = "district", column = @column(name = "district")), @attributeoverride(name = "phone", column = @column(name = "phone", length = 16)), @attributeoverride(name = "filenumber", column = @column(name = "file_number", length = 9)), @attributeoverride(name = "membergroup", column = @column(name = "member_group", length = 4)) }) public memberinquirylookupid getid() { homecoming this.id; } public void setid(memberinquirylookupid id) { this.id = id; } }

and

@embeddable public class memberinquirylookupid implements java.io.serializable { private string email; private integer memberid; private string firstname; private string lastname; private string schoolid; private string titleid; private string titledescription; private string schoolsearchname; private string boroughdescription; private string district; private string phone; private string filenumber; private string membergroup; public memberinquirylookupid() { } public memberinquirylookupid(string email) { this.email = email; } public memberinquirylookupid(string email, integer memberid, string firstname, string lastname, string schoolid, string titleid, string titledescription, string schoolsearchname, string boroughdescription, string district, string phone, string filenumber, string membergroup) { this.email = email; this.memberid = memberid; this.firstname = firstname; this.lastname = lastname; this.schoolid = schoolid; this.titleid = titleid; this.titledescription = titledescription; this.schoolsearchname = schoolsearchname; this.boroughdescription = boroughdescription; this.district = district; this.phone = phone; this.filenumber = filenumber; this.membergroup = membergroup; } @column(name = "email", nullable = false) public string getemail() { homecoming this.email; } public void setemail(string email) { this.email = email; } @column(name = "member_id") public integer getmemberid() { homecoming this.memberid; } public void setmemberid(integer memberid) { this.memberid = memberid; } @column(name = "first_name", length = 15) public string getfirstname() { homecoming this.firstname; } public void setfirstname(string firstname) { this.firstname = firstname; } @column(name = "last_name", length = 25) public string getlastname() { homecoming this.lastname; } public void setlastname(string lastname) { this.lastname = lastname; } @column(name = "school_id", length = 10) public string getschoolid() { homecoming this.schoolid; } public void setschoolid(string schoolid) { this.schoolid = schoolid; } @column(name = "title_id", length = 5) public string gettitleid() { homecoming this.titleid; } public void settitleid(string titleid) { this.titleid = titleid; } @column(name = "title_description", length = 60) public string gettitledescription() { homecoming this.titledescription; } public void settitledescription(string titledescription) { this.titledescription = titledescription; } @column(name = "school_search_name") public string getschoolsearchname() { homecoming this.schoolsearchname; } public void setschoolsearchname(string schoolsearchname) { this.schoolsearchname = schoolsearchname; } @column(name = "borough_description") public string getboroughdescription() { homecoming this.boroughdescription; } public void setboroughdescription(string boroughdescription) { this.boroughdescription = boroughdescription; } @column(name = "district") public string getdistrict() { homecoming this.district; } public void setdistrict(string district) { this.district = district; } @column(name = "phone", length = 16) public string getphone() { homecoming this.phone; } public void setphone(string phone) { this.phone = phone; } @column(name = "file_number", length = 9) public string getfilenumber() { homecoming this.filenumber; } public void setfilenumber(string filenumber) { this.filenumber = filenumber; } @column(name = "member_group", length = 4) public string getmembergroup() { homecoming this.membergroup; } public void setmembergroup(string membergroup) { this.membergroup = membergroup; } public boolean equals(object other) { if ((this == other)) homecoming true; if ((other == null)) homecoming false; if (!(other instanceof memberinquirylookupid)) homecoming false; memberinquirylookupid castother = (memberinquirylookupid) other; homecoming ((this.getemail() == castother.getemail()) || (this.getemail() != null && castother.getemail() != null && this.getemail().equals( castother.getemail()))) && ((this.getmemberid() == castother.getmemberid()) || (this .getmemberid() != null && castother.getmemberid() != null && .getmemberid().equals(castother.getmemberid()))) && ((this.getfirstname() == castother.getfirstname()) || (this .getfirstname() != null && castother.getfirstname() != null && .getfirstname().equals(castother.getfirstname()))) && ((this.getlastname() == castother.getlastname()) || (this .getlastname() != null && castother.getlastname() != null && .getlastname().equals(castother.getlastname()))) && ((this.getschoolid() == castother.getschoolid()) || (this .getschoolid() != null && castother.getschoolid() != null && .getschoolid().equals(castother.getschoolid()))) && ((this.gettitleid() == castother.gettitleid()) || (this .gettitleid() != null && castother.gettitleid() != null && .gettitleid().equals(castother.gettitleid()))) && ((this.gettitledescription() == castother .gettitledescription()) || (this.gettitledescription() != null && castother.gettitledescription() != null && .gettitledescription().equals( castother.gettitledescription()))) && ((this.getschoolsearchname() == castother .getschoolsearchname()) || (this.getschoolsearchname() != null && castother.getschoolsearchname() != null && .getschoolsearchname().equals( castother.getschoolsearchname()))) && ((this.getboroughdescription() == castother .getboroughdescription()) || (this .getboroughdescription() != null && castother.getboroughdescription() != null && .getboroughdescription().equals( castother.getboroughdescription()))) && ((this.getdistrict() == castother.getdistrict()) || (this .getdistrict() != null && castother.getdistrict() != null && .getdistrict().equals(castother.getdistrict()))) && ((this.getphone() == castother.getphone()) || (this .getphone() != null && castother.getphone() != null && .getphone().equals(castother.getphone()))) && ((this.getfilenumber() == castother.getfilenumber()) || (this .getfilenumber() != null && castother.getfilenumber() != null && .getfilenumber().equals(castother.getfilenumber()))) && ((this.getmembergroup() == castother.getmembergroup()) || (this .getmembergroup() != null && castother.getmembergroup() != null && .getmembergroup().equals(castother.getmembergroup()))); } public int hashcode() { int result = 17; result = 37 * result + (getemail() == null ? 0 : this.getemail().hashcode()); result = 37 * result + (getmemberid() == null ? 0 : this.getmemberid().hashcode()); result = 37 * result + (getfirstname() == null ? 0 : this.getfirstname().hashcode()); result = 37 * result + (getlastname() == null ? 0 : this.getlastname().hashcode()); result = 37 * result + (getschoolid() == null ? 0 : this.getschoolid().hashcode()); result = 37 * result + (gettitleid() == null ? 0 : this.gettitleid().hashcode()); result = 37 * result + (gettitledescription() == null ? 0 : .gettitledescription().hashcode()); result = 37 * result + (getschoolsearchname() == null ? 0 : .getschoolsearchname().hashcode()); result = 37 * result + (getboroughdescription() == null ? 0 : .getboroughdescription().hashcode()); result = 37 * result + (getdistrict() == null ? 0 : this.getdistrict().hashcode()); result = 37 * result + (getphone() == null ? 0 : this.getphone().hashcode()); result = 37 * result + (getfilenumber() == null ? 0 : this.getfilenumber() .hashcode()); result = 37 * result + (getmembergroup() == null ? 0 : this.getmembergroup() .hashcode()); homecoming result; } }

so mvn bundle , getting next error:

tests in error: testgetmemeberrequestinformation(org.uftwf.memberinquiry.test.testapp): provided id of wrong type class org.uftwf.model.memberinquirylookup. expected: class org.uftwf.model.memberinquirylookupid, got class java.lang.string

you're doing lookup through hibernate requester, assume string. id in entity memberinquirylookupid. hibernate not know on column should match given value.

a workaround work criteria api or write hql:

from memberinquirylookup m m.id.email = :parameter

it seems me hibernate reverse engineered table in wrong manner. have composite primary key in database? if not, should adapt code right error.

java mysql spring hibernate