Posts

Showing posts from July, 2015

Convert Spring LocalSessionFactoryBean to Hibernate SessionFactory -

Convert Spring LocalSessionFactoryBean to Hibernate SessionFactory - i trying integrate spring hibernate. however, not able hibernate's sessionfactory object through spring's localsessionfactorybean. i tried next approaches: 1) utilize either of org.springframework.orm.hibernate3 , org.springframework.orm.hibernate4 localsessionfactorybean class 2) utilize abstractsessionfactorybean class 3) seek sessionfactory=localsessionfactorybean.getobject() sessionfactory=localsessionfactorybean here's project structure: not allowed post images till reach 10 credits, sad.. here 's bookservice bundle com.zzz.service; import org.hibernate.session; import org.hibernate.sessionfactory; import org.springframework.beans.factory.annotation.autowired; import org.springframework.orm.hibernate3.abstractsessionfactorybean; import org.springframework.orm.hibernate4.localsessionfactorybean; import com.zzz.forms.bookform; public c

multithreading - Delphi thread return value -

multithreading - Delphi thread return value - can explain me how homecoming value mythread calling function test? function test(value: integer): integer; begin result := value+2; end; procedure mythread.execute; begin inherited; test(self.fparameters); end; procedure getvaluefromthread(); var capture : mythread; begin list := tstringlist.create; capture := mythread.create(false); capture.fparameters := 2; capture.resume; end; declare class derived tthread . add field, or multiple fields, contain result value or values. set result value field(s) in overridden execute method. when thread has finished, read result thread instance. as remy points out, if wish homecoming single integer value, can utilize returnvalue property of tthread . utilize in same way described above. note value placed in returnvalue value returned underlying os thread. you can hear onterminate find out when thread done. or phone call waitfor . note set threa

c# - Deserialize a string bytes into BitStream -

c# - Deserialize a string bytes into BitStream - my problem follows: serialize info , send them playerprefs bitstream bitstream = new bitstream(istypesafe); bitstream.writebyte(species); bitstream.writeint32(revision); playerprefs.setstring(species.tostring(), bitstream.tostring()); and seek deserialize data: bitstream bitstream = new bitstream(istypesafe); bitstream.writestring(playerprefs.getstring(species.tostring())); species = bitstream.readbyte(); revision = bitstream.readint32(); but output wrong data. doing wrong? the fundamental problem here utilize strings storage binary data. wrong because changing string encoding can occur ruin data. unfortunately, playerprefs doesn't provide way save/load binary data. thus, solution utilize textual serialization instead. p.s. looks incorrect: bitstream.writestring(playerprefs.getstring(species.tostring())); c# unity3d

R function arguments' range or pre-conditions -

R function arguments' range or pre-conditions - i matlab, java, python user, started learning r. find annoying not beingness able see allowed input parameter values. i know can phone call ?afunction or args(afunction) not seem complete. i'll give example. png has input argument bg default set white , turns out can set black , transparent , red , etc follows in no way documentation or args() -call. now question not png example, question is: there more informative (meta)-functions args , help tell user "ah, these allowed values parameter", and, "aha, argument needs of type numeric "? r function documentation arguments args

xml - php simplexml with unique values -

xml - php simplexml with unique values - i have xml file , using simplexml : $xml = simplexml_load_file('feed.xml', 'simplexmlelement', libxml_nocdata); foreach($xml->item $products) { $name = (string)trim($products->name) ; $weight = (string)$products->weight; .....and on... the xml feed follows: <?xml version="1.0"?> <root> <update_time>2014-06-09</update_time> <item> <name>product 1</name> <weight>0.3000</weight> <price>31.4400</price> </item> <item> <name>product 2</name> <weight>0.2000</weight> <price>32.4400</price> </item> <item> //duplicate <name>product 1</name> <weight>0.1000</weight> <price>22.4400</price> </item> </root> the name value had duplica

c++ - JNI DeleteLocalRef Clarification -

c++ - JNI DeleteLocalRef Clarification - question 1: jstring jstrkey; for(int i=1;i<=1000;++i) { lpwstr strkey = l"string"; jstrkey = env->newstring((jchar *)strkey, wcslen(strkey)); } env->deletelocalref(jstrkey); question 2: for(int i=1;i<=1000++i) { lpwstr strkey = l"string"; jstring jstrkey = env->newstring((jchar *)strkey, wcslen(strkey)); env->deletelocalref(jstrkey); } am using deletelocalref in both questions? especially in question 1, deleting local ref after loop. think correct, , need not phone call deletelocalref within loop since not creating new local ref. so no issues respect usage of deletelocalref right? in both cases should phone call deletelocalref() within loop because each newstring() crerates new local ref. local references discarded jni on homecoming native method, process has nil java garbage collection. usually, don't need worry local references. local ref table

c++ - C++11 Difference in Constructors (Braces) -

c++ - C++11 Difference in Constructors (Braces) - i quite new c++ , have observed, next lines of code deed differently myclass c1; c1.do_work() //works myclass c2(); c2.do_work() //compiler error c2228: left side not class, structure, or union. myclass c3{}; c3.do_work() //works with header file class myclass { public: myclass(); void do_work(); }; can explain me, difference between 3 ways of creating object is? , why sec way produce compiler error? ways 1 , 3 phone call default constructor. myclass c3{}; is new initialization syntax called uniform initialization. called default brace initialization. however: myclass c2(); declares function c2 takes no parameters homecoming type of myclass . c++ c++11 constructor most-vexing-parse

header files - C typedef for function prototype dlsym -

header files - C typedef for function prototype dlsym - i writing shared library ld_preload , intercept calls existing library (in linux). i have 50+ different function prototypes , attribute declaration write , want maintain code short possible because function prototypes large. the issue having following: lets want intercept calls dostuff(int, void*) i have next code: header file: typedef int (*dostuffprototype) (int, void*); extern dostuffprototype dlsym_dostuff; extern int dostuff(int, void*); c file dostuffprototype dlsym_dostuff; __attribute__((constructor)) void libsomething() { void* lib_ptr; dlerror(); lib_ptr = dlopen(lib_name, rtld_lazy); ... // loading references real library dlsym_dostuff = (dostuffprototype) dlsym(lib_ptr, "dostuff"); } ok works fine i'd replace next line in header: extern int dostuff(int, void*); with like: extern dostuffprototype dostuff; but 'dostuff' redeclared

html - change css property of a div with :after pseudo-element dynamically using jquery -

html - change css property of a div with :after pseudo-element dynamically using jquery - here situation: have wrapper div, main div within , <img /> in main div, aspect ratio have maintain when window resizes. width , height of <img /> not fixed , may alter 1 image another. maintain aspect ratio of each image preserved, have used :after pseudo-element wrapper class this: wrapper:after{ padding-top: **%; display: block; content: ''; } but since don't know width , height of image, have calculate aspect ratio dynamically using jquery when page loads, this: $("#ad_image_main").load(function(){ var h = $(this).height(); var hh = (h/660)*100; /**/ }); #ad_image_main id of <img /> tag and have insert in /**/ padding-top value (which hh ) wrapper:after -element aspect ratio want. how can this? if search web, you'll find couple ways (apply new class , update document.stylesheet ), if inser

c++ - Shift image content with OpenCV -

c++ - Shift image content with OpenCV - starting image, shift content top of 10 pixels, without alter size , filling sub image width x 10 on bottom black. for instance, original: and shifted: is there function perform straight operation opencv? is there function perform straight operation opencv? http://code.opencv.org/issues/2299 or this cv::mat out = cv::mat::zeros(frame.size(), frame.type()); frame(cv::rect(0,10, frame.cols,frame.rows-10)).copyto(out(cv::rect(0,0,frame.cols,frame.rows-10))); c++ opencv

python - Trouble Routing in Flask -

python - Trouble Routing in Flask - i have static html file (but 1 in want add together dynamic template variables 1 time working.) my html file in templates directory. my flask code looks this: @restserver.route('/mypage/', methods=['get']) def func(self): homecoming render_template('mypage.html') i seek opening page in browser going localhost:5000/mypage and http 500 error. can please provide insight? thanks. flask provides automatic redirection non-slash route slash route default ensure there 1 canonical url resource. quoting the docs: take these 2 rules; @app.route("/projects/") , @app.route("/about") though rather similar, differ in utilize of trailing slash in url definition. in first case, canonical url projects endpoint has trailing slash. in sense, similar folder on file system. accessing without trailing slash cause flask redirect canonical url trailing slash. in sec case, how

security - Laravel form creation exposes schema -

security - Laravel form creation exposes schema - in laravel, creating form create new record in database. in controller, saving input info database straight using input::all() . so, work; creating form elements same names database fields; {{ form::label('name', 'project name:') }} {{ form::text('name', null, ['class' => 'form-control']) }} so, if looks @ output html, easy guess project table , fields within table. what know is: normal practice? okay implement this? laravel experts using best practice situation? with laravel there no problem if knows name of fields, in each form laravel create hidden field contain token not can send post requests site security laravel laravel-4

java - Getting multiple files from JFileChooser -

java - Getting multiple files from JFileChooser - in gui app working on, require select multiple files instead of straight opening file chooser first need add together required files in selected list (so instead of selecting files 1 time again , 1 time again different directories can select them @ time , open files added list). should able remove multiple files nowadays in selected file list too. is possible jfilechooser or need design 1 per requirements? what looking not standard feature, can customize chooser, using jfilechooser.setaccessory(...) takes argument jcomponent . can create panel list can add together , remove selected files (or other jcomponent want create) , add together accessory file chooser. see filechooserdemo2 more explanation on this. here's example. created jlist can add together selecting files, , remove files selecting file list , clicking remove. when click open, files can obtained defaultlistmodel filelistaccessory class

Android Detect Package Installer Has Started -

Android Detect Package Installer Has Started - my goal temporarily disable service when installing new apk file. there couple of receivers related bundle installer such after install , after uninstall shown below, haven't found 1 trigger when bundle installer opens. <receiver android:name=".packageinstallerreceiver" > <intent-filter> <action android:name="android.intent.action.package_removed"/> <action android:name="android.intent.action.package_added"/> <data android:scheme="package" /> </intent-filter> </receiver> there doesn't seem solution observe when app opened or else easy solution. any ideas? android installer package

jquery - IE 10 reports as device while I am running in a PC -

jquery - IE 10 reports as device while I am running in a PC - i need find site opened in pc or in mobile/tablet devices. can modify site performance/design. this code used observe it isdevice: function () { homecoming (/mobile|tablet|android|kindle/i.test(navigator.useragent.tolowercase())); } this returns true when run site in ie 10 in windows 8 64bit touch machine. works correctly in other browsers. help resolve it. thanks in advance. jquery internet-explorer jquery-mobile browser windows-mobile

error: expected constructor, destructor, or type conversion before 'typedef' in arduino uno -

error: expected constructor, destructor, or type conversion before 'typedef' in arduino uno - we have been getting error in next code. beginner @ stuff, please explain in simple way might have been doing wrong. #include <servo.h> servo myservo1; // create servo object command servo servo myservo2; servo myservo3; servo myservo4; servo myservo5; int potpin1 = 0; // analog pin used connect potentiometer int val1; // variable read value analog pin int potpin2 = 1; int val2; int potpin3 = 2; int val3; int potpin4 = 3; int val4; int potpin5 = 4; int val5; void setup() { myservo1.attach(3); // attaches servo on pin 9 servo object myservo2.attach(5); myservo3.attach(6); myservo4.attach(9); myservo5.attach(10); } void loop() { val1 = analogread(potpin1); // reads value of potentiometer (value between 0 , 1023) val1 = map(val1, 0, 1023, 0, 179); // scale utilize servo (value between 0 , 180) myservo1.write(val1);

ssh - Adding an RSA key without overwriting -

ssh - Adding an RSA key without overwriting - i want generate set of keys home server ssh into, ssh-keygen -t rsa , message: id_rsa exists. overwrite (y/n)? well, don't want overwrite because keys have utilize ssh university's servers, , pain have junk 1 time again every time wanted switch. there easy way append keys? tried next tutorial (which cannot find) suggesting using cat command, pretty lost. seems solution simple i'm not seeing. you can utilize same public key on both servers. if don’t want that, specify different location ~/.ssh/id_rsa when ssh-keygen prompts before that, , utilize agent: % ssh-agent sh # replace favourite shell. $ ssh-add ~/.ssh/id_rsa_2 $ ssh somewhere $ exit % ssh-agent can used without starting new shell eval $(ssh-agent) . ssh rsa ssh-keygen

web services - Parallel website running to my original website -

web services - Parallel website running to my original website - we have been working on gaming website. while making note of major traffic sources noticed website found carbon-copy of our website. uses our logo,everything same ours different domain name. cannot be, domain name pointing our domain name. because @ several places links ccwebsite/our-links . website has links images ccwebsite/our-images . what has happened ? how have done ? can stop ? there number of things might have done re-create site, including not limited to: using tool scrape finish re-create of site , place on server use dns name point site manually re-create site own respond requests site scraping yours real-time , returning response etc. what can stop this? not whole lot. can seek prevent direct linking content requiring referrer headers images , other resources requests need come pages serve, 1) can faked , 2) not browsers send you'd break little percentage of legitimate users

html - Inside div 100% height of link -

html - Inside div 100% height of link - i know when using 100% height elements parents must have 100% height . i want create .overlay height: 100%; can't work. if alter .col height: 100% works don't want .col 100%. http://jsfiddle.net/8hfjv/ is there anyway around this? noticed if give a tag display:block , height: 100%; works. there way div? html: <div class="col col1"> <a href="#"> <div class="overlay"></div> <img src="#"> </a> </div> css: html, body { height: 100%; } .col { float: left; display: block; position: relative; } .col { display: block; height: 100%; } .col img { width: 100%; display: block; height: auto; } .overlay { height: 100%; background: #000; z-index: 1; display: block; } .col1 { width: 25%; } since class name overlay believe want overlap

android - Is there any property of render to scroll linchart horizontaly by more than 1 point? -

android - Is there any property of render to scroll linchart horizontaly by more than 1 point? - when scroll chart in horizontal direction scroll 1 point there render property create chart scroll more 1 point. i.e. when scroll wee should straight shift more 1 point. (i using achartengine draw line chart) in advance. you can add together panlistener graphicalview , handle there graphicalview mchartview; mchartview.addpanlistener(mpanlistener); ....... panlistener mpanlistener = new panlistener() { @override public void panapplied() { //manage scrolling alternative here } }; android achartengine linechart

sql - MyBatis RowBounds doesn't limit query results -

sql - MyBatis RowBounds doesn't limit query results - i developing stateless api needs back upwards pagination. i utilize oracle database. utilize spring mybatis database access. from documentation, understand can utilize rowbounds class limit number of rows returned query. however, seems there's no special optimization done query back upwards pagination. for example, if set rowbounds offset 100 50 records, i'd expect query have next added: (original query clause...) , rownum < 150 , rownum >= 100 but there's nil there, it's query defined manually. this terrible performance, since might have several one thousand results. what doing wrong? thanks. mybatis leaves many things sql driver beingness used, , appears exact behavior surrounding rowbounds 1 of those. see http://mybatis.github.io/mybatis-3/java-api.html, particularly section says: different drivers able accomplish different levels of efficiency in

sql - Wrong (future) convert to datetime -

sql - Wrong (future) convert to datetime - these numeric values needs converted date time. date of birth values can not in future. can somehow implement rule not take date-of-birth value equal on 100 years old?? 201246-1324 040210-6387 111257-0647 040210-6387 result: 2046-12-20 00:00:00.000 - wrong 2010-02-04 00:00:00.000 - right 1957-12-11 00:00:00.000 - right 2010-02-04 00:00:00.000 - right temporarily alter cutoff, since you're working dobs in past.. sp_configure 'two digit year cutoff', 2015 reconfigure then utilize standard datediff on years < 100. sql date datetime type-conversion

java - Is there a best use API client pattern for Android? -

java - Is there a best use API client pattern for Android? - this question may seem subjective because i'm not sure how inquire leads objective answer. there best utilize design pattern creating rest api client in android? typically i: put api methods in static apiclient class write manual serialization code each model i'm getting api (mostly because adding serialization library seems more complication). let activities handle success , error responses. however i've seen lot of code has distinct classes each type of api call, extending classes abstractaction , abstractresponse. seems lot of people have own, different, ways of doing it, unusual because writing api client 1 of first things have when writing app. there right way it, or @ to the lowest degree improve way it? the best pattern combination of various patterns. it's subjected type of activity supposed do. for recommended design patterns see: google i/o 2010 - android rest client applic

jquery ui - UI tabs page showing all content at once -

jquery ui - UI tabs page showing all content at once - i tried mentioned here jquery ui tabs: tabs show same content, can't figure out wrong. i have tabs ui working fine locally, can't work online. any suggestions? this page i'm trying work on. http://www.connect4webdesign.com/test/ colorbox.js breaking page. it's .js file, not include tags in document. jquery-ui tabs

c# - How to add a certificate into a PDF file and check whether the pdf is not tampered externally? -

c# - How to add a certificate into a PDF file and check whether the pdf is not tampered externally? - i working on pdf related operations, , need check whether pdf not tampered users or not. assume, requires digital signature added file. how create sure pdf not tampered? i using pdfsharp pdf manipulation, , don't think pdfsharp can not sure. there thought whether can or not? c# pdf certificate digital-signature digital-certificate

c++11 - C++ standard wording: Does "through all iterators in the range" imply sequentiality? -

c++11 - C++ standard wording: Does "through all iterators in the range" imply sequentiality? - this question sparked give-and-take std::generate , guarantees made standard. in particular, can utilize function objects internal state , rely on generate(it1, it2, gen) phone call gen() , store result in *it , phone call gen() again, store in *(it + 1) etc., or can start @ back, example? the standard (n3337, §25.3.7/1) says this: effects: first algorithm invokes function object gen , assigns homecoming value of gen through iterators in range [first,last) . sec algorithm invokes function object gen , assigns homecoming value of gen through iterators in range [first,first + n) if n positive, otherwise nothing. it seems no ordering guaranteed, since other paragraphs have stronger wording, illustration std::for_each (effects: applies f result of dereferencing every iterator in range [first,last) , starting first , proceeding last - 1 . if we're taki

python - Why is my implementation of binary search very inefficient? -

python - Why is my implementation of binary search very inefficient? - i doing python exercise search word given sorted wordlist , containing more 100,000 words. when using bisect_left python bisect module, efficient, using binary method created myself inefficient. please clarify why? this searching method using python bisect module: def in_bisect(word_list, word): """checks whether word in list using bisection search. precondition: words in list sorted word_list: list of strings word: string """ = bisect_left(word_list, word) if != len(word_list) , word_list[i] == word: homecoming true else: homecoming false my implementation inefficient (don't know why): def my_bisect(wordlist,word): """search given word in wordlist using bisection search, known binary search """ if len(wordlist) == 0: homecoming false if len(wordlist)

google chrome - Error in flowplayer flash : 201, unable to load stream or clip, connection failed -

google chrome - Error in flowplayer flash : 201, unable to load stream or clip, connection failed - i getting 201, unable load stream or clip, connection failed… coming in chrome, when play chrome incognito window, plays nicely. , in browsers, running . may problem, kindly help. google-chrome flowplayer

import - SAS Mainframe to read CSV column names automatically -

import - SAS Mainframe to read CSV column names automatically - is there way read read csv column names automatically in mainframe environment proc import not supported in mainframe? tried below code working in pc sas not in mainframe sas. filename filein "abc.cust.file" disp=shr recfm=v; info varnames; infile filein delimiter=',' dsd obs=1 lrecl=32000; input varname $ @@; run; thanks in advance. csv import sas mainframe

xml - XSLT - Search for last element in a group -

xml - XSLT - Search for last element in a group - i iterating on grouping of elements , while iterating need access info lastly node set. for example, have test goes out level1 elements, while getting values current node set, check , see if there multiple elements contain same grouping number, , if need access info lastly node set contains grouping number 3. <root> <level1> <group>1</group> <name>test1</name> <email>test@email.com</email> </level1> <level1> <group>3</group> <name>test2</name> <email>test2@email.com</email> </level1> <level1> <group>3</group> <name>test3</name> <email>test3@email.com</email> <manager>manager@email.com</email> </level1> </root> i have tried next out root level check

json - How to convert C# MultipartFormDataContent to JObject -

json - How to convert C# MultipartFormDataContent to JObject - does 1 how convert multipartformdatacontent newtonsoft jobject . and, possible @ all? have tried: jobject.fromobject(multipartcontent) , or jobject.parse(jsonconvert.serializeobject(multipartcontent)) but none of work. any ideas? thanks lot that not possible because if @ class not class contains several variables can converted json object,it looks more method driven class every method has function, hence not converted json object. c# json json.net

c++ - constexpr and initialization of a static const void pointer with reinterpret cast, which compiler is right? -

c++ - constexpr and initialization of a static const void pointer with reinterpret cast, which compiler is right? - consider next piece of code: struct foo { static constexpr const void* ptr = reinterpret_cast<const void*>(0x1); }; auto main() -> int { homecoming 0; } the above illustration compiles fine in g++ v4.9 (live demo), while fails compile in clang v3.4 (live demo) , generates next error: error: constexpr variable 'ptr' must initialized constant expression questions: which of 2 compilers right according standard? what's proper way of declaring look of such kind? tl;dr clang correct, known gcc bug. can either utilize intptr_t instead , cast when need utilize value or if not workable both gcc , clang back upwards little documented work-around should allow particular utilize case. details so clang right on 1 if go draft c++11 standard section 5.19 constant expressions paragraph 2 says: a conditi

desire2learn - Get completion summary for a topic in a module / for a module -

desire2learn - Get completion summary for a topic in a module / for a module - i working valence api completion summary topic/or module. i can modules , topics under course of study offering using phone call /d2l/api/le/(version)/(orgunitid)/content/root/ , how completion summary or status topics/modules (like users have completed topic/module)? i can see way completion details in course of study offering level calling /d2l/api/le/(version)/(orgunitid)/grades/coursecompletion/ can please help me on this? the valence learning framework api calls around course of study content designed give callers overview of content construction @ rest. there no provision, currently, revealing content completion info users through api. desire2learn valence

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version -

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version - i using sybase powerfulness designer create database physical info model (sybase creates sql file) . when import sql file phpmyadmin have next error: #1064 - have error in sql syntax; check manual corresponds mysql server version right syntax utilize near 'if exists(select 1 sys.sysforeignkey role='fk_artwork_creates_artist'' @ line 7 . any ideas? error appear due errors on physical model or there problem? this code : if exists(select 1 sys.sysforeignkey role='fk_artwork_has_buy') alter table artwork delete foreign key fk_artwork_has_buy end if; the error getting mysql. regardless of tool used generate sql, database seems mysql (or terribly wrong systems if confused , think mysql). the mysql if statement (documented here) has within stored program. means code compiles within stored procedure, user defined

objective c - Accessing OS X keychain item from trusted application -

objective c - Accessing OS X keychain item from trusted application - i'm creating keychain , i'm adding item predefined trusted aplication list it: seckeychaincreate([keychainpath utf8string], (uint32)strlen(keychainpass), keychainpass, false, null, &somekeychain); osstatus somestatus = seckeychainitemcreatefromcontent(ksecgenericpassworditemclass, &list, len, encryptedpass, somekeychain, accessref, &somekeychainitem); when open newly created keychain keychain access application, can see application on trusted app list: the problem is, when seek read key keychain through 1 of trusted applications seckeychainunlock(somekeychain, (uint32)strlen(keychainpass), keychainpass, true); uint32 passwordlen = 0; void *passdata = nil; const char *cuser_name = [nsusername() cstringusingencoding:nsutf8stringencoding]; osstatus genericpasserr = seckeychainfindgenericpassword(somekeychain, 0, null, strlen(cuser_name), cuser_name, &passwordlen, &passda

html - Unwanted white space at the bottom of the page - Can't find an answer? -

html - Unwanted white space at the bottom of the page - Can't find an answer? - i kind of new stackoverflow, came here help... have stupid question: have unwanted white space @ bottom of page, has been bothering me days , can't seem prepare it... website is: http://mateo226.byethost4.com/plans.html picture: http://i1252.photobucket.com/albums/hh576/mateo72354/screenshotfrom2014-06-22194407_zpse274bef9.png give thanks you! i see white space in maximized window. if that's want rid of, you're going need scale content (which might ugly) or space out vertically. either way, think looks fine. if white space issue browser specific, seek adding @ origin of css *{padding:0;margin:0;} , seeing if fixes things. and on personal note, move away byet. sound who's learning aren't seem. i've had best luck serversfree.com. edit: it's window. if bothers , want framing, go ahead , give page center column: body{ width:1000px; margin:au

Java: How to call a method from class from an enumeration of instanced objects? -

Java: How to call a method from class from an enumeration of instanced objects? - i made several instances of objects in hashtable , want phone call method each of them. i made goes through enumeration of values retrieved said hashtable, i'm unsure how phone call method on each object. for(enumeration<agent> agentenum = agentlist.elements(); agentenum.hasmoreelements();){ //content+= agentenum.nextelement(); } content should receive homecoming of method i'm trying phone call class agent. iterate on keys in hashmap. example: enumeration<agent> agentenum = agentlist.keys(); while(agentenum.hasmoreelements()) { agent key = agentenum.nextelement(); your_class value = agentlist.get(key); value.whatever(); ... } edit or utilize values directly: for(your_class obj : agentlist.values()) { obj.whatever(); ... } other methods discussed here, example. java

c# - Entity Framework - Manual Updates to edmx file overwritten with DB update -

c# - Entity Framework - Manual Updates to edmx file overwritten with DB update - in entity framework, understand if create changes automatically created classes, lose chages on kind of db update. so, due you, create changes these objects in separate file using partial class syntax. in similar way, had alter actual .edmx file manually add together in defining query described here. now, when go add together in new tables db, of changes made edmx file lost , start getting errors in project. is there way similar edmx file? - maybe create sec xml under same namespace hence append on @ load-time? and, if so, there examples of how this? ef brand new me , beating me much more thought :) thanks!! you can create partial class model main file. there class name yourmodel.context.cs(vb). can create class out of model , create class partial class, , customizations in partial class, otherwise loose customization on each model update. c# .net vb.net entity-framework

Date and Time in C# ASP.NET MVC4 -

Date and Time in C# ASP.NET MVC4 - i have field in asp.net mvc4 view user should come in datetime stored in db now user can come in date , ignore time how can forcefulness user come in both date , time , in case ignore time tell him error please come in time date? and 1 more thing how can create test if: startdate > enddate must homecoming error , inquire user come in date after startdate jquery ui date picker decent alternative . can utilize . the other part of question var startdate = $('#datepickerstart').datepicker('getdate') var enddate = $('#datepickerend').datepicker('getdate') if(startdate >enddate ) return; asp.net-mvc-4

javascript - Replace uppercase acronym with its full text lowercase *except* when in a Headline Case Sentence -

javascript - Replace uppercase acronym with its full text lowercase *except* when in a Headline Case Sentence - i want replace uppercase acronym (e.g. "what ip address") lowercase total text ("what internet protocol address") unless has been used in sentence that's in headline case, in case want create acronym headline case ("what internet protocol address?"). the fact target replacement uppercase acronym makes more complicated simple substitution cloud-to-butt. i'll doing in javascript browser plugin, don't want super slow. i can think of couple pretty gross, awkward hacks maybe create work, if has more elegant, i'd love see it. use javascript replace function replace string, , few checking create sure has not been used in header. javascript string

Unusual Output from C Array Code -

Unusual Output from C Array Code - as simple effort @ coding exercise in book i've been reading, wrote next code: #include <stdio.h> int main() { double data[12][5]; int i; double t = 2.0; for(i = 0; < 12; i++) { data[i][0] = t; t += 0.1; } for(i = 0; < 12; i++) { data[i][1] = 1.0 / data[i][0]; data[i][2] = data[i][0] * data[i][0]; data[i][3] = data[i][2] * data[i][0]; data[i][4] = data[i][3] * data[i][0]; } printf("x 1/x x^2 x^3 x^4\n"); int row; int column; for(row = 0; row < 12; row++) { printf("%10lf %10lf %10lf %10lf %10lf\n", data[i][0], data[i][1], data[i][2], data[i][3], data[i][4]); } homecoming 0; } however, when run output appears @ ideone.com: http://ideone.com/klwtdk. according how think code should run, f

android - Can't invoke NFC onNewIntent() method -

android - Can't invoke NFC onNewIntent() method - i'm trying read id of mifare classic 1k card using foreground dispatch. can see logs, can enable foreground dispatch, can not invoke onnewintent() method. suggestions appreciated. mainactivity.java ... @override protected void onresume() { setupforegrounddispatch(this, madapter); super.onresume(); } public static void setupforegrounddispatch(final activity activity, nfcadapter adapter) { final intent intent = new intent(activity.getapplicationcontext(), activity.getclass()); intent.setflags(intent.flag_activity_single_top); system.out.println("setup fgd."); // can see output. final pendingintent pendingintent = pendingintent.getactivity(activity.getapplicationcontext(), 0, intent, 0); intentfilter[] filters = new intentfilter[1]; string[][] techlist = new string[][]{}; // notice same filter in our manifest. filters[0] = new intentfilter(); filters[0].ad

xml - how can i navigate to a document three times only -

xml - how can i navigate to a document three times only - i want create vxml application in which, machine asks user employee code , checks against database. can done 3 times only. 1) inquire user employee code 2) find corresponding name code 3) if code invalid, inquire user seek 1 time again (this can done 3 times only <?xml version="1.0" encoding = "utf-8"?> <vxml version="2.1" xml:lang="en-in" xmlns="http://www.w3.org/2001/vxml" application="lang_select.vxml"> <var name="stop" expr="stop+1"/> <var name="count" expr="1"/> <form id="ecode"> <field name="employee" type="digits?minlength=04;maxlength=04"> <prompt count="1" cond="lang=='2'"> please 4 digit employee code. </prompt> <prompt x

Touch screen panel + USB controller - send generic (x,y) data to PC -

Touch screen panel + USB controller - send generic (x,y) data to PC - i'm wondering how impossible can connect touch panel (with usb controller) pc send x,y coordinates when event happens (the panel touched). after searching web couldn't find more pieces of info don't tell whole story. of understood far can purchase touch panel development kit (ebay), create basic c code acts driver , utilize c functions handle input on device in other applications. question is, touch panel + usb controller + c code plenty in order utilize input on touch panel in other applications i'll build myself (in c++ or other languages)? , c code be? (i don't want utilize touch panel mouse, independent. should provide coords when touch event happend thru function phone call - part of c code mentioned earlier) an reply "buy [touch panel] , [microcontroller], write c code [code], compile g++, run build , utilize [getcoord()] function whenever [touchhappened()] function

javascript - How can convert numbers to words on load event? -

javascript - How can convert numbers to words on load event? - i did javascript working fine , translating numbers words. but doing action when click on "calculate" , want show translation without typing or doing click assing value here view <form> number words<br> <br>number/n&uacute;mero <input name="number" type="text" size="60" value="123"><br> <input name="calc" type="button" value="calculate" onclick="calculate(this.form)"> <input name="reset" type="button" value="reset" onclick="clearform(this.form)"> <br> spanish<br><textarea name="spanish" rows="5" cols="90"></textarea><br> </form> here demo http://jsfiddle.net/rq7r4/13/ somebody can help me this? the next both 'translate' on load , while type -

java - Match parameters to method signature -

java - Match parameters to method signature - i have method , list<object> of parameters method invoked with. list of parameters may not in right order , may include many/not plenty parameters match method signature. before reinvent wheel, function exist invoke method list of parameters have , match, best can, parameters method signature...maybe in spring? no, implementation solve problem need external info provider of method , list<object> have. with method like void method (string name, string city, string parent) {} and list "sotirios", "new york", "alexander" where each argument go in method#invoke(..) ? only can know information. java spring reflection

Changing the UUID algorithm in CouchDB -

Changing the UUID algorithm in CouchDB - this question referencing couchdb version 1.5.0 for purposes of environment, want able order documents in database later retrieval based on sort of time index. read online there 4 algorithms uuid creation in couchdb. documentation shows algorithms can used in uuid generation listed in here: http://couchdb.readthedocs.org/en/latest/config/misc.html#uuids-configuration i suspect default uuid algorithm setting "sequential", when issuing http://couchdb:5984/_uuids?count=50 , see big chunk of them (if not all) first 26 digits identical , lastly 6 unique. i tried changing algorithm 1 of utc options (either "utc_random" or "utc_id" work) first 16 bits time in microseconds unix epoch in hex. the method used alter uuid algorithm go local.ini file , append next stanza (it wasn't in there previously): [uuids] algorithm = utc_random i restart couchdb service service couchdb restart when query

Calling JavaScript function with the syntax (0, myFunction)() -

Calling JavaScript function with the syntax (0, myFunction)() - i'm new in javascript, found syntax (0, myfunction)() phone call anonymous functions on javascript, don't know means 0 before anonymous function, don't know if instead of 0 can utilize 1 or 2, etc. basically question difference between phone call function myfuntion() or (0, myfunction)() . function in global context. here example. var object = {} object.foo = function(){} the difference between phone call function (0,object.foo)(); or object.foo(); you can rewrite both calls next equivalents: object.foo.call(null); // (0,object.foo)(); object.foo.call(foo); // object.foo(); as can see, difference "binding" of this within called function; utilize of (0, something)(); considered cryptic , should avoided in professional code base. javascript

javascript - handling username and pass in session in nodejs-express -

javascript - handling username and pass in session in nodejs-express - i have nodejs-express app running , newbie @ this. in home page ('/') have following: app.get('/', function(req, res){ // check if user's credentials saved in cookie // if (req.cookies.user == undefined || req.cookies.pass == undefined){ res.render('login', { title: 'krishimoney' }); } else{ // effort automatic login // am.autologin(req.cookies.user, req.cookies.pass, function(o){ if (o != null){ req.session.user = o; res.redirect('/home'); } else{ res.render('login', { title: 'krishimoney' }); } }); } }); now when print req.cookies.user gives me username.anyhow, somwhere downwards routes have admin route: app.get('/admin', function(req, res){

javascript - Backbone.js breaking the each loop while switching view -

javascript - Backbone.js breaking the each loop while switching view - i have singleton backbone view : testview = backbone.view.extend({ initialize : function(){ _.each(array,function(arrayelement){ //-do }); }; }) homecoming testview() the problem want reuse view array on 'each' loop iterating big when switch views , re-enter (reuse) view, previous each loop still running. there way can stop executing each loop while switching views? i don't think so, because _.each synchronous operation , not have command on via flags or whatsoever.. suggest utilize recursive settimeout (just create asynchronous , non blocking) offset of few milliseconds , maybe able interrupt execution.. var arr = [1,2,3]; function asynceach(elementsarray) { var element; if (globalflag) { element = elementsarray.shift(); // element settimeout(function () { asynceach(elementsarray); },

apache - PHP svn_diff error -

apache - PHP svn_diff error - when executing svd_diff page shows "no info received unable load webpage because server sent no data. error code: err_empty_response" i'm trying execute this: $diff = svn_diff($this->folder, $this->from_revision, $this->folder, $this->to_revision ? $this->to_revision : svn_revision_head); apache error.log shows: [fri jun 20 11:31:13.772711 2014] [core:notice] [pid 21314] ah00051: kid pid 21319 exit signal segmentation fault (11), possible coredump in /etc/apache2 i'm using apache/2.4.9 (ubuntu) php version 5.5.13-2+deb.sury.org~trusty+1 on ubuntu 14.04 lts have svn , php5-svn installed this happening since alter ubuntu 12 14 how can prepare this? this code might help you <?php list($diff, $errors) = svn_diff( 'http://www.example.com/svnroot/trunk/foo', svn_revision_head, 'http://www.example.com/svnroot/branches/dev/foo', svn_revision_head ); if (!$diff) exit;

MySQL stability issues after attempting to backup WAMP -

MySQL stability issues after attempting to backup WAMP - i trying create backup of wamp directory effort install 32-bit version since need php library required assignment. i'm stand-in while place of employment tries find replacement guy vacated position , set up, , it's bit on head , i'm lost in procedure. the mysql process keeps crashing when effort create temporary table part of info conversion. error log startup crash: 140620 10:32:24 [note] plugin 'federated' disabled. 140620 10:32:24 innodb: innodb memory heap disabled 140620 10:32:24 innodb: mutexes , rw_locks utilize windows interlocked functions 140620 10:32:24 innodb: compressed tables utilize zlib 1.2.3 140620 10:32:24 innodb: initializing buffer pool, size = 128.0m 140620 10:32:24 innodb: completed initialization of buffer pool 140620 10:32:24 innodb: highest supported file format barracuda. innodb: log scan progressed past checkpoint lsn 343041027227 140620 10:32:24 in

laravel upload image in google app engine -

laravel upload image in google app engine - i trying upload images in laravel 4. locally works, upload image , save path in database, problem when deploy google app engine doesn't works. shows error: symfony \ component \ debug \ exception \ fatalerrorexception phone call fellow member function getclientoriginalextension() on non-object view {{ form::model($v, array('files' => true,'route' => array('upload.image', $v->id),'method' => 'post','class'=>'form-horizontal','id'=>'upload-images')) }} {{ form::file('image') }} <br> {{ form::submit('add photo', array('class' => 'btn btn-primary' )) }} {{ form::close() }} controller $file = input::file('image'); $destinationpath = 'img_gallery/'; $extension = $file->getclientoriginalextension(); $

TransactionManager error in grails app after installing spring-security-core -

TransactionManager error in grails app after installing spring-security-core - i've been struggling bit getting spring security core integrated application , working properly. after digging, found lot of guidance, have nail wall. i'm @ place accounts exist, roles exist, passwords beingness encoded properly, logins failing every account. i next along debugging advice given in this question , turned issue different 1 answered there, , haven't been able find answers when googling. might due newness framework. i added config.groovy burt had suggested: grails.plugin.springsecurity.onabstractauthenticationfailureevent = { e, appctx -> println "\nerror auth failed user $e.authentication.name: $e.exception.message\n" } and tried 1 time again log application. again, received "sorry, not able find user username , password" error. when looked @ console, having enabled logging via log4j directed in above question, found this: error auth

r - Format geom_text label doesn't work when using aes_string -

r - Format geom_text label doesn't work when using aes_string - i using dot function format text labels in plot created ggplot2 . works fine when using aes , doesn't work expected when using aes_string . there workaround create work aes_string ? require(ggplot2) # define format function dot <- function(x, ...) { format(x, ..., big.mark = ".", scientific = false, trim = true) } # create dummy info df <- data.frame(cbind(levels(iris$species),c(10000000000,200000,30000))) df$x2 <- as.numeric(as.character(df$x2)) # works aes ggplot(iris) + geom_bar(aes(species,sepal.width),stat="identity") + geom_text(data=df,aes(x=factor(x1),y=180,label=dot(x2))) # doesn't work aes_string ggplot(iris) + geom_bar(aes(species,sepal.width),stat="identity") + geom_text(data=df,aes_string(x="x1",y=180,label=dot("x2"))) rather quote "x2", must quote whole expression ggplot(iris) +