Posts

Showing posts from June, 2011

Cloudant Query android -

i using cloudant store user details when register application shown below: { "_id": "xxx", "_rev": "xxx", "encrypted_password": "testing123", "username": "testing", "email_address": "test@hotmail.com" } i want authenticate user searching through documents same username , password provided user code doesn't seem work. code shown below: public boolean authenticateuser(final string username, final string password) { map<string, object> query = new hashmap<string, object>() { { put("username", username); put("password", password); } }; queryresult result = indexmanager.find(query); if(result != null) return true; // reach here if no existing username found return false; } cloudant query: https://github.com/cloudant/sync-android/blob/master/doc/query.md your document doesn't see

vba - How to create a mergefield with a formula containing mergefields -

i want build mergefields decide between data coming 2 different mergefields. example «field_1» should contain: if «field_1» > "" "«field_1»" "«field_2»" i tried following way: sub createfield() dim mergestring string mergestring = "if{mergefield field_1}>"""" ""{mergefield field_1}""""{mergefield field_2}""" selection.fields.add range:=selection.range, type:=wdfieldempty, preserveformatting:=false selection.typetext text:=mergestring end sub also insertformula: sub createfield() dim mergestring string mergestring = "if{mergefield field_1}>"""" ""{mergefield field_1}""""{mergefield field_2}""" selection.insertformula formula:= mergestring end sub but it's mess. unfortunately, code insert text regular string rather mergefields. if insert fields in word manua

angularjs - use of angular.forEach instead of for -

i new angularjs, please tell how use angular.foreach below code for(i=0;i<$scope.data.tabs.length;i++){ $scope.data.tabs[i]['position']=i+1; } you have remember that... the iterator function invoked iterator(value, key, obj) see https://docs.angularjs.org/api/ng/function/angular.foreach angular.foreach($scope.data.tabs, function(tab, i) { tab.position = + 1; }); so here, tab value of $scope.data.tabs[i] , i index of each tab in array.

javascript - Join in Meteor with publishComposite -

i have removed autopublish meteor app. i'm publishing collections manually. have related collections. want increase performance as possible. if i'm, instance, looking @ post , want see comments related post, have query database both post: posts.findone(postid) , comments: comments.find({postid: postid}) . querying 2 collections in data field iron-router present in template i'm subscribing publications in waiton . have found https://github.com/englue/meteor-publish-composite lets me publish multiple collections @ same time. don't quite understand it. if i'm using meteor.publishcomposite('postandcomments', ...) in server/publish.js , subscribing postandcomments in waiton , , setting both post , comments in data do, have saved demand on database? me looks still query database same number of times. queries done when publishing queries made while queries done data way retrieve has been queried database? besides, in example 1, shown how publish t

iis - Calling shared drive folder using javascript -

i have 2 servers: , b. classic asp application deployed on server a. server b contains folder (scanneddocuments). have created shared drive on server point folder. share drive named q:. on ie 7, when try access file using javascript, using: window.open(file://q:/a.txt) it opens file. on ie 8 , above , versions of firefox, not opening. neither error generated nor file opening. i guess getting blocked browser's security features. please let me know how can open files on these browser versions. is there other way open remote file using javascript or using iis? ** edited ** tried creating virtual directory on iis , pointing shared drive. gives error: resource or directory not found. i using iis 7 @anant dabhi right - create simple ajax call server ant return file content. client (js). use instead of window.open(file://q:/a.txt) function getfile(filename) { $.ajax({ url: "/yourweb/file/get", data: { filename: fil

javascript - equality check with more than 1 var -

i have following code: const mult = (a, b) => * b; const result = mult(2, 3) + mult(4, 5); const result1 = 6 + mult(4, 5); const result2 = 6 + 20; console.log(result); console.log(result1); console.log(result2); console.log(result === result1 === result2); the expression result === result1 === result2 equates false when result === result1 true , result1 === result2 true. can explain why? it solved left side right, resolving as: (result === result1) === result2; true === result2; for example, event fail: 1 === 1 === 1 it due type conversion not done === operator. following resolves true! 1 == 1 == 1

javascript - Adding content to react elements -

i new react.js , have heard js library reacts badly modifies it's component structure. there specific procedure add content react elements using jquery. example, if want add content react's div field, can directly use jquery append method insert text div or there other way implement things?. the idea either use traditional approach, or ditch jquery , use react , means using react rendering tree, build tasks, client-side router/spa. you should not modify dom generated react components outside since maintains internal state , virtual dom become out of sync. either use 1 ecosystem or another; 2 different approaches writing website.

jquery - Buttons changing position on full-size -

Image
i'm using flexslider, , edited buttons in following form: however keep position (which correct position) on window re-size. when putting window on full size, button animation , placed follow: how fix them in same position on full-size when window re-sized. ps: jsfiddle : http://jsfiddle.net/v8hgwg8k/ if re-size result window you'll notice problem. html: <!doctype html> <html> <head> <title>the mode website template | home :: w3layouts</title> <link rel="stylesheet" href="../sss/woothemes-flexslider-83b3cae/flexslider.css" type="text/css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> <script src="../sss/woothemes-flexslider-83b3cae/jquery.flexslider.js"></script> <!-- place in <head>, after 3 links --> <script type="text/javascript" charset="utf-8"> $(window).load(func

regex - How to change "x" and "y" in a line into "y" and "x" using hash -

i trying replace strings in huge file contains many lines. file.txt line1: "x" = 5.5; "y" = 7.5; "z" = 9.0; line2: "v" = 66; "y" = 3; "u" = 11.0; so on ... the replacement hash (%rhash) contains map information $rhash{"x"} = "y"; $rhash{"y"} = "x"; $rhash{"z"} = "a"; $rhash{"v"} = "b"; $rhash{"u"} = "c"; when tried while (($cur, $cng) = each(%rhash)) { $line =~ s/\q"$cur"\e/\"$cng\"/g; } line 1 change either "x" = 5.5; "x" = 7.5; "a" = 9.0; or "y" = 5.5; "y" = 7.5; "a" = 9.0; but correct change is "y" = 5.5; "x" = 7.5; "a" = 9.0; how can achieve this.. thanks help... you need change them simultaneously. easiest way make compound executable regexp, , substitution bas

Deploying Ruby on Rails 2.3 on Production -

am sorry noobness this, i developing ruby on rails application on ubuntu 14.04. development, i'm starting application using ruby script/server . ruby -v 1.8.7 rails -v 2.3.14 mysql now question how deploy on production? planning use ubuntu 14.04 server well. i read phusion passenger did not understand for. i hoping make ubuntu server localhost. if point browser myrailsapp , application available (normally use script/server ). have use script/server command everytime server restart? please tell me if im on right track. ------------ follow tutorial -------------- i follow tutorial 1 can't figure out how make virtual host working created virtual host this: /etc/hosts 0.0.0.0 example.com /opt/nginx/conf/nginx.conf server { listen 80; server_name example.com; passenger_enabled on; location / { root /opt/nginx/html/ror/blog/public; } } on browser 403 forbidden , have start rails app script/server? try foll

MongoDB index: totalDocsExamined returns 0 -

i have coded mongodb index using mongo java driver follows: mongoclient mongoclient = new mongoclient("localhost", 27017); db db = mongoclient.getdb("test"); dbcollection coll = db.getcollection("indexdemo"); coll.createindex(new basicdbobject("code",1)); (int ii=0;ii<100000;ii++) { dbobject doc = new basicdbobject("code", ii); coll.insert(doc); } when execute explain plan of index (mongodb 3.x), index bounds seems recognized totalkeysexamined 0 , totaldocsexamined 0 db.indextest.find({code: 5000}).explain("executionstats") { . . . . "executionstats":{ "executionsuccess":true, "nreturned":0, "executiontimemillis":0, "totalkeysexamined":0, "totaldocsexamined":0, "executionstages":{ "stage":"fetch", "nreturned":0, "executiontimemillise

java - networking javaSE applications -

this db class javase application. public class db { static connection c; public static connection get_connection() throws classnotfoundexception,sqlexception { if (c == null) { string ip = ""; string port = ""; string username = ""; string password = ""; try { bufferedreader br = new bufferedreader(new filereader(system.getproperty("user.home") + "/connectionsettings.txt")); ip = br.readline(); port = br.readline(); username = br.readline(); password = br.readline(); br.close(); } catch (exception e) { e.printstacktrace(); } class.forname("com.mysql.jdbc.driver"); c = drivermanager.getconnection("jdbc:mysql://" + ip + ":"+port + "/mydb", username,

.net - How to retrieve complex excel file with merged cells and save as xml file using vb.net? -

Image
i have can retrieve excel file , save xml file. imports microsoft.office.interop.excel imports system.xml imports system.io module module1 sub main() try dim excel application = new application dim filename string = "person" dim file_extension string dim path string = "c:\users\" dim w workbook try file_extension = "xlsx" w = excel.workbooks.open(path & filename + "." & file_extension) catch ex exception file_extension = "xls" w = excel.workbooks.open(path & filename + "." & file_extension) end try integer = 1 w.sheets.count dim sheet worksheet = w.sheets(i) dim r range = sheet.usedrange dim array(,) object = r.value(xlrangevaluedatatype.xlrangevaluedefault) if array isnot nothing dim bound0 integer = array.getupperb

mysql - Retrieve related data-set on Phalcon -

i have 2 tables. wanted return not parent data "lists", including relationship "listtypes". how can that? $d = self::find(); // works - missing relations, see expected result. tables: lists list types with following code relations. // models/lists.php <?php use phalcon\mvc\model; class lists extends model { public function initialize() { $this->hasone('type_id', 'listtypes', 'id'); } public function getdata() { $d = self::find(); } } ?> // models/listtypes.php <?php use phalcon\mvc\model; class listtypes extends model { public function initialize() { $this->belongsto('id', 'lists', 'type_id'); } } ?> current results: array ( [0] => array ( [id] => 1 [name] => airbus [type_id] => 1 ) [1] => array ( [id] => 2 [name] =&g

Android - Programmatically Extract Contents of .apk -

what app doing copying .apk /data/app folder, extract contents of it, , copy files it, repackage it, sign it, , copy back. current issue extracting .apk file, people .zip file having issues it. have been able extract .zip files no problem, after renaming .apk .zip doesnt go. able extract es file explorer, repackage .zip , app work , extract .zip , continue repackage , once installed again worked fine. there sort of library made handle kind of file? have tried standard java extract, zip4j, , apache commons, have lead no avail. appreciated, thanks!

clojure - define project specific tasks in leiningen -

is there way define rake tasks within project leiningen. i want define custom task in leiningen project.clj invoke function in project namespace you can define project-specific aliases , e.g.: :aliases {"launch" ["run" "-m" "myproject.main"] ;; values project map can spliced arguments ;; using :project/key keywords. "launch-version" ["run" "-m" "myproject.main" :project/version] "dumbrepl" ["trampoline" "run" "-m" "clojure.main/main"] ;; :pass-through-help ensures `lein my-alias help` not converted ;; `lein my-alias`. "go" ^:pass-through-help ["run" "-m"] ;; complex aliases, docstring may attached. docstring ;; printed instead of expansion when running `lein help`. "deploy!" ^{:doc

ruby on rails - Passing value from child class to parent -

a package made of expense, revenue, , balance based on sales made of amount. how add each @sale.amount @package.revenue ? model package.rb: class package < activerecord::base has_many :sales end model sale.rb: class sale < activerecord::base belongs_to :package end routes.rb: rails.application.routes.draw resources :packages resources :sales end end end activerecord has handy sum method calculating sum of values in column: class package < activerecord::base has_many :sales def revenue sales.sum(:amount) end end note while looks similar sales.map(&:amount).sum performance vastly better because activerecord let database calculation , retrieve single value (the final sum) database, whereas other method fetch every associated record database (of there may many thousands), instantiate sale object each one, amount each sale object , calculate sum.

opencv - How to detect motion from already store webm video in c++ -

i want detect motion in existing video, video stored in webm format. have seen demo of opencv samples capturing motion of live webcam streaming. is there library or api capture motion of webm video file in c++? please me. if have code run webcam input have change input type accept video file input. basically, can accomplish using videocapture object. cv::videocapture cap("path/for/file.fileextension") and then, putting input mat datatype (separating frame): mat frame; cap >> frame;

schema.org - hat is the proper structure for Parcel Delivery schema if your delivery contains multiple tracking numbers? -

it possible our orders contain multiple sku's multiple tracking numbers per sku on order. i have been referencing https://developers.google.com/gmail/markup/reference/parcel-delivery . using json-ld format. { "@context":"http://schema.org", "@type":"parceldelivery", "deliveryaddress":{ "@type":"postaladdress", "name":"john frank", "streetaddress":"24 willie mays plaza", "addresslocality":"san francisco", "addressregion":"ca", "addresscountry":"us", "postalcode":"94107" }, "originaddress":{ "@type":"postaladdress", "name":"john frank", "streetaddress":"25 willie mays plaza", "addresslocality":"san francisco", "addressre

how to set default value of select_tag in rails? instance variable -

i have controller action: class candidatescontroller < applicationcontroller helper_method :current_or_guest_user def show # authorize! :read, @user @candidate = candidate.friendly.find(params[:id]) @candidates = candidate.all if request.path != candidate_path(@candidate) redirect_to @candidate, notice: 'moved permanently' end @comparison = usercomparisonservice.new(current_user, @candidate) @contact = contactcandidate.new(candidate_email: @candidate.email) end this calls partial render on show page , passes @candidate instance variable: = render 'users/compare', :candidate => @candidate this form within partial: profile-searchbar.text-left = form_tag(compare_path, method: 'get', remote: true, id: 'compare_form') = select_tag "v_friend_id", options_from_collection_for_select(@candidates, :id, :full_name, @comparison.v_friend.id), :include_blank => true, :class =&

html - Unable to prevent an input from submitting when press the enter key on it -

i'm getting unexpected behaviour input. have following code: <form id="search_form"> <div id="search_container"> <input type="text" id="search_text"> </div> <select onchange="search_field_on_change()" name="search_field"> <option value="login" selected>usuario</option> <option value="su.name">nombre</option> <option value="surnames">apellidos</option> <option value="email">correo</option> <option value="role">rol</option> <option value="access">acceso</option> <option value="center">centro</option> </select> <button type="button" onclick="search()">buscar</button> <span id="modify_user_message"></span&

java - Creating an ArrayList from data in a text file -

i trying write program uses 2 classes find total $ amount text file of retail transactions. first class must read file, , second class must perform calculations. problem having in first class, arraylist seems price of last item in file. here input (which in text file): $69.99 3 shoes $79.99 1 pants $17.99 1 belt and here first class: class readinputfile { static arraylist<double> pricearray = new arraylist<>(); static arraylist<double> quantityarray = new arraylist<>(); static string pricesubstring = new string(); static string quantitysubstring = new string(); public void gatherdata () { string s = "c:\\filepath"; try { filereader inputfile = new filereader(s); bufferedreader bufferreader = new bufferedreader(inputfile); string line; string substring = " "; while ((line = bufferreader.readline()) != null) substring = line.substring(1, line.lastindexof(" ") + 1);

Matlab - highlight a specific interval using patch -

Image
i highlight specific interval in plot. found way using patch object. problem layout gets messy whenever use it. here's example of plot: x = 1:0.05:25; plot(x,sin(x)+sin(100*x)/3); xlabel('x axis'); ylabel('y axis'); title('\omega \delta test'); legend('sin \sigma') and highlight period: yl = ylim; patch([5 5 10 10],[yl(1) yl(2) yl(2) yl(1)],'k',... 'facecolor',[.4 .6 .4],'edgecolor',[.4 .6 .4],... 'facealpha',0.3,'edgealpha',0.3) my results , without patch command: normal: messy: look @ fonts , legend block. ideas on how fix that? is there better way highlight interval? need choose color , set transparency. just 1 more question: why have use third input (color) if it's not applied? thanks in advance! edit: answer valid matlab versions before 2014b, incredibly useful erasemode property has been removed hg2 graphic objects on later matlab versions. i ran p

Copy multiple input fields to other matching input fields with jQuery/Javascript -

i have dummy form , actual form in @ point want copy input values dummy form across real form. dummy fields have same names real form (so can match them up). so in dummy form: <input name="item1" value="field1" /> <input name="item2" value="field1" /> <input name="item3" value="field1" /> and in real form: <input name="item1" value="" /> <input name="item2" value="" /> <input name="item3" value="" /> i assume i'll need iterate on each input in dummy form (using jquery .each() ?) while collecting name , value in js object. iterate on each input in real form, matching name selector , setting value (perhaps can done in 1 .each() function ???) i've started following code grabs values (and index) array, because need 2 values (name , value, , index irrelevant) assume i'll need object not array, not sure begin t

c++ - Running external executable in Qt using QProcess -

i'm trying run external executable (code below) in qt separate process. test.c: #include <stdio.h> int main () { file *f; f = fopen("a.txt", "w"); fprintf(f, "1\n"); fclose(f); return 1; } and in qt have: qprocess* process = new qprocess(); qstring program = "/users/myuser/desktop/a.out"; process->execute(program); i've read on differences between execute(), start(), , startdetached() , understanding want use execute() because want process running external executable finish before continuing execution in main process. i've tried 3 expecting find file a.txt containing text "1" in it, doesn't exist. or suggestions why it's not working? thanks! check in main() -function a.txt -file exists , open before writing it. check in qt "program" -file exists before executing it. return different result codes main() -function , check result in qt: qprocess *proc =

c++ - Make template function for nested container -

i'm trying make generic test function takes container such list, set or vector, , returns nested container: list of lists, set of sets, vector of vectors. non-generic functions this: vector<vector<string>> test(vector<string>& in_container) { vector<vector<string>> out_continer; // out_continer filed using values in_container return out_continer; } list<list<int>> test(list<int>& in_container) { list<list<int>> out_continer; // out_continer filed using values in_container return out_continer; } set<set<float>> test(set<float>& in_container) { set<set<float>> out_continer; // out_continer filed using values in_container return out_continer; } but dont know how make 1 template test function equivalent these separate test examples. vector , list (and deque ) have identical sets of template parameters , ordinary sequences,

javascript - variable with lt jQuery -

here js looks var h = 9; $('#list li:lt('+x')').show(); if (x < listnumber) { $('#list li:lt(5)').hide(); } i think can cache $('#list li') var, var $list = $('#list li') but how can combine it? tried following format, doesn't work me $('#list li')+(':lt(5)') or $('#list li').is(':lt('+x+')')? once cache $('#list li') in var, use .filter() on variable. for more information on how use .filter() api function http://api.jquery.com/filter/ var h = 9; var $cacheditems = $('#list li'); $cacheditems.filter(':lt(' + h + ')').show(); if (x < listnumber) { $cacheditems.filter(':lt(5)').hide(); }

statistics - ANOVA - comparing 3 groups in R -

Image
i attempting analyze data set research project have ran lot of issues, , have not been able find directly related answer online. have worked other statistical programs new r. have had hardest time figuring out how shape data set best answer questions. in research participants asked answer questions pictures presented, these pictures of faces exhibiting 3 emotions (happy, angry, sad) - want compare answers given each question in regards pictures. meaning want see if there differences between these 3 groups. i have used 1 way anova in past doing - in minitab put images 3 factors (1,2,3) , scores given question in column next it. specific picture , score particular question lined horizontally. image pleasing 1 1 3 2 1 2 3 1 1 4 1 1 5 1 1 6 1 2 this how have set in r - when try run anova cannot because image still class of integer , not factor. therefor gives me this: > paov <- aov(image ~ pleasing) >

.net - How to set ServiceThrottlingBehavior for IIS hosted WCF service programmatically -

i'm trying figure out shove object: servicethrottlingbehavior stb = new servicethrottlingbehavior { maxconcurrentsessions = 100, maxconcurrentcalls = 100, maxconcurrentinstances = 100 }; i've found info on how configure in web.config i'm little confused that. used have stuff in our web.config looked this: <service name="authenticationservice.authenticationservice" behaviorconfiguration="development"> <endpoint address="http://services.local/0.0.0.5/authenticationservice.svc" binding="basichttpbinding" bindingconfiguration="tupsoapbinding" contract="authenticationservice.servicedomain.isecurityservice" name="soapcatalogservice" /> </service> if still used know how configure throttling via web.config, found take endpoints out of web.config , still worked , less maintenance since didn't have go update

wordpress - My Custom Meta Box Won't Save -

i have created custom post type , added meta boxes. able display custom post type on front end built in elements such post title , featured image. when saving information in meta box clears fields when save post. here code: add_action( 'add_meta_boxes', 'fellowship_church_information' ); function fellowship_church_information() { add_meta_box( 'fellowship_church_information', // unique id __( 'church information', 'myplugin_textdomain' ), // title 'fellowship_church_information_content', // callback function 'fellowship', // admin page (or post type) 'normal', // context 'default' // priority ); } function fellowship_church_information_content( $post ) { echo '<div class="fellowship-church-information-form">

javascript - Chrome Gapless WebM + FFMPEG -

i'm trying gapless playback of segments generated using ffmpeg: i use ffmpeg encode 3 files source 240000 samples @ 48khz, i.e. 5 seconds. ffmpeg -i tone.wav -af atrim=start_sample=24000*0:end_sample=240000*1 -c:a opus 0.webm ffmpeg -i tone.wav -af atrim=start_sample=24000*1:end_sample=240000*2 -c:a opus 1.webm ffmpeg -i tone.wav -af atrim=start_sample=24000*2:end_sample=240000*3 -c:a opus 2.webm when looking @ meta data (using ffprobe , ffmpeg -loglevel debug ) file following seems me inconsistent values: duration: 5.01, start 0.007 discard 648/900 samples 240312 samples decoded if have several of these files how play them seamlessly without gaps? i.e. in browser i've tried: sourcebuffer.timestampoffset = 5 * n - 648/48000; sourcebuffer.appendwindowstart = 5 * n; sourcebuffer.appendwindowend = 5 * (n+1); sourcebuffer.appendbuffer(new uint8array(buffer[n])); however, there audible gaps. how many samples supposed discard? 0.007 * 48000, 648, or 240312 - 24

Custom Folder in Android Project -

i need put folder in android project can access using file mydir = new file(path-to-dir); can't seem find way this. have tried putting in assets folder need access folder itself, can perform operations on once have in file object. appreciated. step 1 : create folder ins assets folder , place files there.. step 2 : assuming have folder named myfolder in assets folder, try code readfromfile("/myfolder/myfile.txt", mcontext); and function public string readfromfile(string filename, context context) { stringbuilder returnstring = new stringbuilder(); inputstream fin = null; inputstreamreader isr = null; bufferedreader input = null; try { fin = context.getresources().getassets() .open(filename, context.mode_world_readable); isr = new inputstreamreader(fin); input = new bufferedreader(isr); string line = ""; while ((line = input.readline()) != null) { retu

swift - iOS8: Auto-layout and Gradient -

Image
setup: i have view controller consists of view , container view . the view (orange) pinned top 0, left 0, , right 0. the container view (gray) pinned bottom 0, left 0, , right 0. the view 's bottom space to: container view = 0 the view 's proportional height container view = 1 desired results: add gradient background of view (orange) tried: i'm using auto-layout class sizes different behavior on different screen. code: class viewcontroller: uiviewcontroller { @iboutlet weak var graphview: uiview! @iboutlet weak var containerview: uiview! override func viewdidload() { super.viewdidload() let backgroundcolor = cagradientlayer().graphviewbackgroundcolor() backgroundcolor.frame = self.graphview.frame self.graphview.layer.addsublayer(backgroundcolor) } i have category: extension cagradientlayer { func graphviewbackgroundcolor() -> cagradientlayer { let topcolor = uicolo

android - (Corona SDK) Properly remove a scrollView -

in game have scrollview widget declared inside function, , want remove scrollview using function, this: local function createscrollview(event) if(event.phase=="ended")then local function scrolllistener( event ) local phase = event.phase local direction = event.direction if "began" == phase --print( "began" ) elseif "moved" == phase print( "moved" ) elseif "ended" == phase --print( "ended" ) end -- if scrollview has reached it's scroll limit if event.limitreached if "up" == direction print( "reached top limit" ) elseif "down" == direction print( "reached bottom limit" ) elseif "left" == direction print( "reached left limit" ) elseif "right"

java - Spring Data one to many mapping -

i try configure onetomany , manytoone mapping in spring data project have issues. so have 2 entities: employer , project . 1 employer have many projects. entity classes: employer.java @entity @table (name="employer") public class employer { @id @sequencegenerator(name="my_seq", sequencename="global_sequence") @generatedvalue(strategy = generationtype.sequence ,generator="my_seq") @column (name="employer_id") private int id; @column (name="name") private string name; @joincolumn (name="employer_id") @onetomany(mappedby = "employer", cascade = cascadetype.all, fetch = fetchtype.eager) private set<project> project = new hashset<project>(); ...................... } project.java @entity @table (name="project") public class project { @id @sequencegenerator(name="my_seq", sequencename="global_sequenc

java - How to use Arrays and Returning values -

so, im creating program takes user input, stores in array, , uses array various calculations returns. ive been working on while , cannot work. i'm newbie @ please help! import java.util.scanner; public class array { public static int getvalues(int[] array) { scanner keyboard = new scanner(system.in); system.out.println("enter series of " + array.length + " numbers."); (int index = 0; index < array.length; index++) { system.out.print("enter number " + (index + 1) + ": "); array[index] = keyboard.nextint(); } } public static int gettotal(int[] array) { double total = 0; (int index = 0; index < array.length; index++) total = total + array[index]; return total; } { public static int getaverage(int[] array) (int index = 0; index < array.length; index++)

php - Codeigniter 3 Routing Issues -

i have setup route in routes.php file this: $route['videos/video'] = 'videos'; so if user enters: http://domain.com/videos/video/ i want load videos page works, issue running is keeping url same when user clicks on 1 of videos videos page url this: http://domain.com/videos/video/video/1 when should this: http://domain.com/videos/video/1 is there way change behavior? also, there way hide method in url? $route['videos/video'] = "videos/index"; $route['videos/video/(:num)'] = "videos/video/$1";

Grails - Unit test controller that's using a named marshaller -

i'm trying unit test controller that's using named marshaller. controller looks this: def userbyemail(userbyemailcommand userbyemailcommand) { render checkforerrorsandexecute(userbyemailcommand) { userbyemailcommand cmd -> json.use("complete") { [users: [userservice.getuserbyprimaryemailaddress(cmd.email)]] json } } } when run test i'm getting exception saying converter configuration name 'complete' not found! . any on appreciated. thanks. you can create named config in test itself. example: given: 'register marshaller' json.createnamedconfig('complete') { it.registerobjectmarshaller(map) { map item -> item } } when: 'controller action called' controller.userbyemail() then: // assertion goes here

javascript - Uncaught TypeError: Cannot set property '_node' of undefined -

please see source code posted here https://github.com/codesdk/famous_engine_issue_debug_position follow steps in readme.md i getting following error uncaught typeerror: cannot set property '_node' of undefined which traces following line */ function position(node) { this._node = node; <---------------------- please help. right here: https://github.com/codesdk/famous_engine_issue_debug_position/blob/master/src/myscene.js#l24 you forgot new keyword.

objective c - Category on NSObject also works on Class -

so have category on nsobject called customcategory, following: #import <foundation/foundation.h> @interface nsobject (customcategory) -(bool)dosomething; @end #import "nsobject+customcategory.h" @implementation nsobject (customcategory) -(bool)dosomething { nslog(@"done"); return no; } @end ideally, work on object this: nsobject* object = [nsobject new]; [object dosomething]; however, found works in way no problem: [nsobject dosomething]; so wondering, since instance method have added through category, why works on class? instance methods on nsobject class methods on nsobject. this works because of way objective-c dynamic dispatch. if send message object method implementation looked in objects class. if send message class sending regular message class object. there implementation looked in called meta-class. meta-classes automatically generated compiler. class methods instance methods of meta-class. handled transparent

corona - Lua - nil value -

i following error message corona sdk : attempt call field "imagesheet" (a nil value) stack traceback. can point out mistake? local ispar = { width = 2541, height = 264, numframes = 7 } local imagesheet = graphics.imagesheet("apus.png, ispar") local apussequencedata = { {name = "fly", frames {1,2,3,4,5,6,7}, time = 800, loopcount = 0} } local apus = display.newsrpite(imagesheet, apussequencedata) apus.x = display.contentwidth/2 apus.y = display.contentheight/2 apus:play() you got function name wrong, supposed graphics.newimagesheet. misplaced quotation marks when calling it. , afterwards misspelt newsprite this code should work: local ispar = { width = 2541, height = 264, numframes = 7 } local imagesheet = graphics.newimagesheet("apus.png", ispar) local apussequencedata = {{name = "fly", frames = {1,2,3,4,5,6,7}, time = 800, loopcount = 0}} local apus = display.newsprite(imagesheet,

sendmail - PHP Mail Sending Blank Message On Page-Load -

i having issue php mailer. sending blank email every time page loaded. i'm sure it's simple (maybe missing condition if submit button hit) fix this. their documentation doesn't seem have 1 though , script first worked when first used started sending emails on page load after first few times. thanks! <form method="post" action=""> <div class="form-group"> <input name="name" type="text" class="form-control" placeholder="enter name"> </div> <div class="form-group"> <input name="email" type="email" class="form-control" placeholder="enter email"> </div> <div class="form-group"> <input name="subject" type="text" class="form-control" placeholder="enter subject"> </div> <div class="form-

How to download an image object from webgl/javascript -

i have directory 100 images. need copy of them in various folders along other information download webgl. hence want upload them onto browser , download them again (hope isn't stupid) here code: var imagefile = model.features[cindex].imagename.substring(model.features[cindex].imagename.lastindexof('/')+1); var image = new image(); image.src = model.imagedirectory + imagefile; image.onload = function() { console.info("read \""+image.src + "\"...done"); } image.onerror = function() { var message = "unable open \"" + image.src + "\"."; console.error(message); alert(message); } var data = image.src; zip.file('image_rh_original' + cindex +'.png', data , {base64: true}); is wrong? how similar "todataurl" image object? todataurl method of canvas, , webgl draws canvas. call canvas.todataurl(). need set preservedrawingbuffer true well.

c++ - How to apply a C preprocessor only to certain (#if/#endif) directives? -

i wondering if possible, , if yes how, can run c preprocessor, cpp, on c++ source file , process conditional directives #if #endif etc. other directives stay intact in output file. i'm doing analysis on c# code , there no c# pre-processor. idea run c preprocessor on c# file , process conditionals. way example, #region directive, stay in file, cpp appears remove #region. you might looking tool coan : coan software engineering tool analysing preprocessor-based configurations of c or c++ source code. principal use simplify body of source code eliminating parts redundant respect specified configuration. it's precisely designed process #if , #ifdef preprocessor lines, , remove code accordingly, has lot of other possible uses.

Changing View on Xamarin Studio -

Image
currently view stuck "watch" outside of other views: ideally have "watch" tabbed in other views such "locals, breakpoints, threads, application output." normally simple dragging "watch" other tabbed views. however, have been unable , snaps solo tab. how combine these tabs? driving me crazy. figured out! wasn't intuitive be: to conjoin separate tabs, need drag tab center of new tab seen in picture below. note. not try drag new tab tabbed part. drag center of want conjoin. in above picture dragging breakpoints tab these tabbed views.

configure - Tomcat 6 to 7 Migration Realm error overrides final method init.()V -

i'm trying migrate application apache tomcat 5.5 version 7. migrated application tomcat 5.5.25 tomcat 6.0.41. migrating application version 6.0.41 version 7.0.28 , ran issue. when start tomcat 7 server receive following error in catalina.out log: jul 1, 2015 2:15:31 pm org.apache.catalina.startup.hostconfig deploydescriptor info: deploying configuration descriptor /usr/local/opt/ldtools/share/java/apache-tomcat-7.0.28/conf/catalina/localhost/ttste st.xml jul 1, 2015 2:15:31 pm org.apache.tomcat.util.digester.digester startelement severe: begin event threw error java.lang.verifyerror: class com.att.csp.sca.tomcat.csprealm overrides final method init.()v @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclass(classloader.java:616) @ java.security.secureclassloader.defineclass(secureclassloader.java:124) @ java.net.urlclassloader.defineclass(urlclassloader.java:260) @ java.net.urlclassloader.access$000(urlclassloader.java:56