Posts

Showing posts from August, 2012

multithreading - Algorithm to run code with no more than one concurrent thread per unique id -

i have go web application needs execute given section of code in 1 goroutine per unique id. scenario have requests coming various ids represent sort of transaction. subset of operations on these needs guaranteed run "one @ at time" given id (and other competing requests should block until prior 1 working on/for id done). i can think of few ways book keeping seems tricky - need keep global mutex lock access map of concurrent requests happening , use mutex or counter there, , make sure doesn't deadlock, , garbage collect (or reference count) old request entries. can this, sounds error prone. is there pattern or in standard library can used effect in case? didn't see obvious. edit: 1 thing think confusing in explanation above use of word "transaction". in case each of these not need explicit close - it's identifier associate multiple operations with. since don't have explicit "close" or "end" concept these, might rec

javascript - Nested array is not returning deepest obj -

i working lodash , trying obtain object nested in array. need bettypes , put var needdeepestobj bettypes using _.filter var deepestobj = function(betslipdata) { var needdeepestobj = _.filter(betslipdata.customerbettypes, function(betindex) { return _.filter(betindex.bettypes, function(bettypes) { console.log('1', bettypes); //returns need return bettypes; }); }); console.log('2', needdeepestobj); //returns first _.filter param *betindex* }; so, how can reach scope contains bettypes ? this betindex param returns in browser console. { "header": { "name": "straights", "priority": "1" }, "bettypes": [ { "id": "1", "name": "straight", "buypoints": "y", "maxpoints": "3", "minpoints": "0", "isava

html - Text Outside of Div -

for 1 reason or another, when attempt add text div, cleverly misses it. i'm trying text inside div, it's staying outside of it. here's jfiddle: http://jsfiddle.net/hspwtyag/1/ <div align="center"> <div id="box1"> <img src="https://upload.wikimedia.org/wikipedia/commons/c/cc/rectangle_.png" /> </div> <div id="box2"> <h2>proudly celebrating 10 years</h2> </div> </div> * { background-image: url("http://images.virtualworldsland.com/blog/2322/796.jpg"); background-attachment: fixed; } #box1 { border-radius: 1px solid black; width: 500px; background: white; border-radius: 15px 15px 15px 15px ; } #box2 { border-radius: 1px solid black; width: 500px; background: white; border-radius: 15px 15px 15px 15px ; height: 150px; } it is inside div - it's background image that's tricking you. see, if remove background image, , change div's

Excel VBA - Loop through column one at a time -

i trying loop through each row in sht1 (b2:b138) , , set "input" cell sht2 (a1) each item in loop, 1 @ time. then, value in "output" cell sht2 (n7) copied sht1 (c2:c138) . so example: sht2 (a1) = value in sht1 (b2) , sht1 (c2) = value in sht2 (n7) repeat sht2 (a1) = value in sht1 (b3) , sht1 (c3) = value in sht2 (n7) over , on until reaches bottom of list. may have expand list in sht1 colb , have been trying have evaluate number of iterations needed dynamically. the code i'm trying below gives me correct "outputs" not end in correct cell in sht2 colc . please see below. researched , found this q/a helpful , used influence code. appreciate in advance. my workbook in case need see it. sub fndesccalc() 'define objects dim wb workbook dim framework worksheet dim sumframework worksheet dim colb long dim colc long dim lastcolc integer dim lastcolb long 'set variables set wb = thisworkbook set framework = wb.sheets(&

android - How to use multithreading in LibGDX? -

i making game in libgdx. have gamescreen(screen) class main gameplay happens. want use use multithreading user can his/her own thing in screen , computer own thing in screen (changing output of screen @ same time). have knowledge of multithreading in java. graphics i'm confused. appereciated.thanks in advance. you can use threading per usual. thing have think of when working swing graphics thread can graphics operations if worker thread needs graphics use libgdx postrunnable command.

php - unlink($filename) : Permission denied Warning -

i getting permission denied waring when try use unlink(). i have created function delete image content directory : function del($fnam){ chmod('content/'.$fnam, 0777); chown('content/'.$fnam,465); unlink('content/'.$fnam); } i have used chmod() , chown() after reading forums , still getting warning , image not getting deleted. how ever runs charm when call different location. if($temp2==1){ //for delete $sql="delete blog b_id=$temp1"; $im=fetch('blog','b_img','b_id='.$temp1); //deleting image del($im); } code above not in function (running procedural fashion), , giving me positive response. how fix that? try changing permissions content directory function del($fnam){ chmod('content/, 0777); unlink('content/'.$fnam); }

What is the correct way of writing typeof(Xml) for C# .NET? -

i'm making dictionary maps .net types sql server types. using msdn's "sql server data type mappings" page show me correct conversions are. @ bottom of table says .net framework type xml, , wrote: {typeof (xml), "xml"} as key-value pair of dictionary. resharper has xml in red , says cannot resolve symbol. what's correct statement typeof(xml)? rest of dictionary looks , doesn't have problems: private static readonly dictionary<type, string> sqlservermap = new dictionary<type, string> { {typeof (int64), "bigint"}, {typeof (boolean), "bit"}, {typeof (byte[]), "binary"}, {typeof (double), "float"}, {typeof (int32), "int"}, {typeof (decimal), "decimal"}, {typeof (single), "real"}, {typeof (int16), "smallint"}, {typeof (datetime), "date"}, {typeof (timespan), "time"}, {typeof (string), "n

java - Why does this cast to a generic type parameter work? -

having idea of type erasure, think this cast not compile or work @ runtime: public class genericdatumreader<d> implements datumreader<d> { ... @suppresswarnings("unchecked") public d read(d reuse, decoder in) throws ioexception { return (d) read(reuse, actual, expected != null ? expected : actual, in); } however, works! how program know @ runtime d is? edit i wrote simple test: 1 public class main { 2 3 public static class something<d> { 4

android - ImageView black background on some devices -

i have listview contains images (each row), width of each image match_parent , height 0.4 of width. now works fine, except on big screen devices (like nexus 7...), instead of images see black background here listview adapter public class adapter extends arrayadapter<string>{ int width = 0; private final activity context; private final string[] title; private final int[] img; public plansadapter(activity context, string[] title, int[] img) { super(context, r.layout.listsingle, title); this.context = context; this.title = title; this.img = img; } @override public view getview(int position, view convertview, viewgroup parent) { layoutinflater inflater = context.getlayoutinflater(); convertview = inflater.inflate(r.layout.listsingle, null, true); textview title = (textview) convertview.findviewbyid(r.id.text); title.settext(title[position]); ima

jquery - How to Construct HTML in form of a String for this -

i trying change title of marker style this html constructing , passing but not applying style could please let em know how resolve function createmarker(latlng, html) { var tooltiponclcik = 'company name : 1 , <br> ' + 'sales off name : 2 , <br>' + 'warehouse name : 3 '; var marker = new google.maps.marker({ position: latlng, map: map, zindex: math.round(latlng.lat() * -100000) << 5, title:tooltiponclcik }); } the title can of straight text , can construct ?? fiddle http://jsfiddle.net/6wp7enot/16/

c++ - Interpretation of IMU-Data (ROS & XSens MTi) -

we have xsens mti , subscribe imu data via sensor_msgs::imu. the output of linear_acceleration is: x: 0.12 y: 0.02 z: 9.83 all changing in small range. data tell me? why robot apparently accelerating in z-direction. robot stands still. orientation data good, linear acceleration confuse me. the acceleration in z-direction caused gravity of earth 9.81 n/kg (or equivalently m/s²) small variation depending on actual location on earth. if object standing still, accelerated amount towards ground (this why things fall down, if there nothing hold them). if want know acceleration of robot relative surroundings have subtract value. some implications of this: if z-acceleration zero, means robot in free fall. robot late then, applications can useful detect , activate safety functions prevent damage. you can use fact calculate orientation of sensor. example if have y = 9.81 , z = 0, means robot has fallen side. in case, small non-zero values of x , y indicate sensor not

symfony - Doctrine connection time out error in AWS RDS -

i trying connect aws rds aws ec2 application zend framwork app using doctrine module connect mysql. can successfuly connent aws rds database mysql workbench. appreciated. of stack traces: pdoexception /vendor/doctrine/dbal/lib/doctrine/dbal/driver/pdoconnection.php:40 sqlstate[hy000] [2002] connection timed out vendor/doctrine/dbal/lib/doctrine/dbal/driver/pdoconnection.php(40): pdo->__construct('mysql:host=doct...', 'user', 'password', array) vendor/doctrine/dbal/lib/doctrine/dbal/driver/pdomysql/driver.php(41): doctrine\dbal\driver\pdoconnection->__construct('mysql:host=doct...', 'user', 'password', array) vendor/doctrine/dbal/lib/doctrine/dbal/connection.php(356): doctrine\dbal\driver\pdomysql\driver->connect(array, 'user', 'password', array) vendor/doctrine/dbal/lib/doctrine/dbal/connection.php(680): doctrine\dbal\connection->connect() vendor/doctrine/orm/lib/doctrine/orm/query/exec/singleselectexe

objective c - Venmo iOS sdk crashing application, when Venmo returning back to app after login to Venmo from safari -

i using venmo ios sdk in application, have done pod file installation , all. have venmo app id , secret key, using same able login venmo sample app provided venmo, if use same app id , secret key in application getting crashed in "startloading" method in "venurlprotocol.m" class. getting '[nsurl querydictionary]: unrecognized selector sent instance' error. below method in app crashing.this method gets executed after clicking on allow button on venmo login page. (in safari) ` -(void)startloading { nsstring *host = [self.request.url host]; nslog(@"self.request.url = %@",self.request.url); nsdictionary *querydictionary = [self.request.url querydictionary];//application crashing here if ([host isequaltostring:@"oauth"]) { nsstring *oautherrorcode = [querydictionary valueforkey:@"error"]; if (oautherrorcode) { nsstring *oautherrormessage = querydictionary[@"message"] ?: @"";

python - Multidicts and Sets -

i have n csv's created multidict with: for name in filenames: open(path+name) openfile: reader = csv.reader(openfile) line in reader: if line[1] in t: pass elif line[1] == 'filer_name': pass else: t[name[:-8]].add(line[1]) this works , outputs multidict (from collections import defaultdict) form: {company name: {other_company_1, other_company_2,...}} there n companies n sets of other companies. now, want other_company in each key, check if other_company in values of company. example: defaultdict(<class 'set'>, {apple : {samsung, qualcomm, nvidia}},{microsoft: {samsung, alcoa, dollar tree}}) i want samsung returned, needs search each set of values every key. if dollar tree in values of third company, find dollar tree too. attempt @ solution: for key, values in t.items(): item in values: if item in values: print(item) additionally, there way ret

sql server - Select first duplicate in aliased field SQL -

i have sql query uses case .. when statement creates aliased field based upon values of other fields. select id, case when len(lastname) = 0 firstname end displayname mytable the resultant select statement contains "duplicates" alias displayname . understand not duplicates because id field unique. how go obtaining distinct list of displayname if don't care id associated it? cannot use displayname alias in group by statement because of order of logical operator precedence. update - should have mentioned need id back, however, long id associated 1 of duplicates (first, last, etc ..) select max(id) [id], displayname ( select id, case when len(lastname) = 0 firstname end displayname mytable ) group displayname

java - iText, insert new blank line inside PdfPTable column -

how insert new blank line inside pdfptable column. \n , n number of spaces has not done trick me. java code working with. chtbc_report1_table.setmodel(new javax.swing.table.defaulttablemodel( new object [][] { {"h.b.g", "some value", "lbs/kg", "adult m : 120lbs \n adult f : 90lbs"}, ..... ..... //other rows }, new string [] { "investigation", "result", "unit", "weight" } )); i want put new line between "adult m : 120lbs **\n** adult f : 90lbs" update this code have used creating pdfptable document.open(); pdfptable pdftable = new pdfptable(chtbc_report1_table.getcolumncount()); (int rows = 0; rows < chtbc_report1_table.getrowcount(); rows++) { (int cols = 0; cols < chtbc_report1_table.getcolumncount(); cols++) { pdftable.addcell(chtbc_report1_table.getmodel().getvalueat(rows, cols).tostring()); } } fl

sql - How get data between two ranges dates -

in sql write select statement fetch data between 2 range dates, using between , ..if use betwenn ('01/01/2013') , ('31/12/2015') data want between specified dates... exclude year of 2014 ex: select * xxx date between ('01/01/2013') , ('31/12/2013') , date between ('01/01/2015') , ('31/12/2015') but returned 0 rows. use or instead of and select * your_table date between ('01/01/2013') , ('31/12/2013') or date between ('01/01/2015') , ('31/12/2015') you don't want data in both date ranges not possible @ same time. want data in either 1 of them.

apache spark - Save data from R code -

i've adapted example spark work on ec2 cluster via hdfs. i've gotten example work saving parquet files. library(sparkr) # initialize sparkcontext , sqlcontext sc <- sparkr.init() sqlcontext <- sparkrsql.init(sc) # create simple local data.frame localdf <- data.frame(name=c("john", "smith", "sarah"), age=c(19, 23, 18)) # create dataframe json file peopledf <- jsonfile(sqlcontext, file.path("/people.json")) # register dataframe table. registertemptable(peopledf, "people") # sql statements can run using sql methods provided sqlcontext teenagers <- sql(sqlcontext, "select name people age >= 13 , age <= 19") # store teenagers in table saveasparquetfile(teenagers, file.path("/teenagers")) # stop sparkcontext sparkr.stop() when use savedf instead of saveasparquetfile , empty file in hdfs. drwxr-xr-x - root supergroup 0 2015-07-23 15:14 /teenagers how can store data

combobox - c# : Arranging child controls at certain position in a flow layout pannel -

my first post , quite new in c# programming. googled , searched lot of forums not find answer specific question. i'm implimenting gui reads values usb device. once button (read_usb_button) pressed, app read values usb device , displayes them in 4 different combo boxes shown below. read_usb_button switch_combox switch_combo2 switch_combo3 switch_combo4 exit_button now after selecing values "switch_combo1", "switch_combo2" , ...."switch_combo5" , gui should this. read_usb_button switch_combo1 switch_combo2 switch_combo3 switch_combo4 port_combo1 port_combo1 port_combo1 port_combo1 port_combo2 port_combo2 port_combo3 port_combo2 port_combo3 port_combo3 port_combo3 port_combo3 exit_button but i'm getting results shown below

java - When to use DropWizard bundles? -

i curious elusive - potentially powerful - dropwizard feature called bundles . according docs: a dropwizard bundle reusable group of functionality, used define blocks of application’s behavior. given dropwizard (dw) extremely documented, i’m shocked explanation on bundles. see few examples of them in wild: asset bundle cassandra bundle but don’t understand is: bundles seem code packaged , distributed in jars. why can’t write “raw” (non-“bundle”-compliant) java classes need, slap them in jar, include jar on build/compile classpath, ad use them in dw app? of use dw bundle, , when should 1 use them? bundles addons dropwizard make easy add small pieces of functionality. example, if use assets bundle, can attach ui api testing purposes , run on same port , easy use. example migrations bundle ties liquibase dropwizard can run database migrations same jar. works since api accessing sql database has connection parameters defined in yml file, migrations able run on

Trouble using barButtonItem for popoverPresentationController in iOS 9? -

i've had code using new uialertcontroller class that's been working fine in ios 8. crashes in ios 9, following error message: 2015-07-23 10:38:27.499 myapp[828:563509] -[uitabbaritem _viewforpresenting]: unrecognized selector sent instance 0x157644960 2015-07-23 10:38:27.500 myapp[828:563509] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[uitabbaritem _viewforpresenting]: unrecognized selector sent instance 0x157644960' the problem seems using barbuttonitem field configure popoverpresentationcontroller, instead of using sourceview/sourcerect thing. if switch latter, it's fine (but of course, action sheet doesn't pop wanted pop up). googling error message has come blank far. here code. it's pretty basic, nothing fancy going on here: uialertcontroller *alertcontroller = [uialertcontroller alertcontrollerwithtitle:@"what want do?" message:nil preferredstyle:uialertcontrollerstyleactionsh

c++ - Java program to mulitiply matrices by calling C code -

so i'm interested in concept. have lot of experience programming in c , fortran, little no java experience. feasible able call c code (even c++) multiply matrices within java code? my idea, in concept, this public class matrixmultiplication { public static void main(string[] args) { // parameters int matrix_size_m = 5000; int matrix_size_n = 5000; // allocate matrices multiplication double matrixa[][] = new double[matrix_size_m][matrix_size_n]; double matrixb[][] = new double[matrix_size_n][matrix_size_m]; double matrixc[][] = new double[matrix_size_m][matrix_size_n]; // initialize matrices ... // call c code here multiply c=a*b ... // other stuff a, b, , c ... } } if can accomplished, next step call mkl linear algebra computations, pretty cool. thoughts? is feasible call c code multiply matrices out can it? yes can. don't understan

haskell - Typeclasses 101: GHC too "eager" to derive instance? -

given following code: class c foo :: -> f :: (c a) => -> f = id p :: (c a) => (a -> a) -> -> p g = foo . g now, if try invoke p f, ghc complains: > p f no instance (c a0) arising use of `p' in expression: p f in equation `it': = p f i find surprising, since f accepts "a" has instance of typeclass c. reason? edit: know did not define instance c shouldn't "proper" response be: p f :: (c a) => -> when put plain expression ghci, trying print it, so > p f is approximately same having following in file main :: io () main = print $ p f as pointed out, p f :: (c a) => -> a . in order print $ p f ghc needs evaluate p f . ghc cannot evaluate value type class context without choosing dictionary pass in. so, needs find c a instance a , doesn't exit. needs find show instance a -> a . inability find either of these results in 2 errors no instance (show (a -> a)) arising use of

oop - How does overloading work? -

let have these overloaded methods in class: class test{ public void func1(int x , string s) { // } public void func1(int x) { // } public void func1(int x , int y) { // } what happen (what compiler do) when func1(2,3) class called: the compiler finds directly thired version of func1 in class test calling non-overloaded methods or like if-else statements, entire overloaded methods name func1 tested find of them has same set of arguments func(2,3) i searched in documentations couldn't find answer.

deployment - Capistrano 3: Relative symlink instead of absolute for current, linked_dirs and linked_files -

i need have relative symlink​ instead of absolute symlink​ when deploying. i think tree tasks need overwritten are. rake::task["deploy:symlink:linked_dirs"] rake::task["deploy:symlink:linked_files"] rake::task["deploy:symlink:release"] ​ ​ what dsl can drop in deploy.rb when i'm deploying created links relative. you can juste use in deploy.rb overwrite default behaviour ## use relative path instead of absolute rake::task["deploy:symlink:linked_dirs"].clear rake::task["deploy:symlink:linked_files"].clear rake::task["deploy:symlink:release"].clear namespace :deploy namespace :symlink desc 'symlink release current' task :release on release_roles :all tmp_current_path = release_path.parent.join(current_path.basename) execute :ln, '-s', release_path.relative_path_from(current_path.dirname), tmp_current_path execute :mv, tmp_current_path, current_path.p

Rails/Ruby, mixing modules and remaining DRY -

i trying write more modular code rails apps, have started playing more including modules in classes. have basic understanding of function, finding hard keep them flexible while remaining dry. here current example. i have module called contactable. has 2 basic functions. ensures right contact columns present in db. validates fields. here module contactable extend activesupport::concern error = 'please ensure necessary fields in place' included required_database_fields.map { |rdf| raise "#{rdf} not included. #{error}" unless column_names.include?(rdf)} required_input_fields.map { |rif| validates rif.to_sym, presence: true} end end i contactable comprised of 3 other modules (phoneable, emailable , addressable) contain arrays of columns require , fields validate against. 1 working on right 'addressable' module addressable extend activesupport::concern error = 'please ensure necessary fields in place' required_d

php - Two submit buttons - perform cgi on second -

i working on form allows user edit, add, , remove committees. in edit section, wrote php code allows user select (from drop down populated csv) name of committee , then, when first submit clicked, information committee automatically displays in fields of form. the problem need cgi action linked second submit button @ end of form, once clicked, of information updated. button needs send in data. previous submit button php value of selected committee , info it. php-autofill feature (hopefully) make life easier user. php intertwined html having separate file tricky. my question: can have 2 submit buttons in 1 form if form has action="something.cgi" , second button supposed action? you need use either (a) use 2 separate forms separate action 's, or (b) write js handler second button post different url

batch file - FTP Glob won't work -

i have problem ftp via command line. this how run ftp file: ftp -i -s:backup.ftp pause and ftp file: open host user pass mget *.json disconnect quit i getting error: no such file or directory. if change * specific filename, work. can see, didn't turn globbing off. also, when connect ftp server, globbing work. seems ftp server blocks globbing or something. idea??

Observable pattern implementation in Java -

i using java's observer/observable pattern , wondering: why there need of setchanged() method in current implementation ? understand here have call notifyobservers() once, @ end of our treatment. that way, if want can rollback changes clearchanged(). still, checking in our own implementation, , call notifyobservers() when absolutely want update observers. i'm missing something, don't understand why didn't simplify way. ideas? the intent keep separate concerns apart. notifying observers can called in 1 place, while keeping track of changes happens in place. times don't need kind of separation, java.util.observable implementation designed able handle complex cases, don't have 1-1 correspondence between changes , notifications. for instance have requirement throttle notifications avoid flooding clients events, shouldn't affect tracking changes occur. example below uses worker thread periodically calls notification method doesn't know

python - Running multiple Django sites on Windows in Virtual Host -

i have downloaded , installed django stack has apache, python , django. during installation setup created sample project configured run on one.local.com(127.0.0.1) , created project run on two.local.com(127.0.0.1) . .../two/wsgi.py import os, sys os.environ["python_egg_cache"] = ".../two/egg_cache" os.environ["django_settings_module"] = "two.settings" sys.path.append('.../two') # i'm getting internal server error without django.core.wsgi import get_wsgi_application application = get_wsgi_application() .../one/wsgi.py import os, sys os.environ["python_egg_cache"] = ".../one/egg_cache" os.environ["django_settings_module"] = "one.settings" sys.path.append('.../one') # i'm getting internal server error without django.core.wsgi import get_wsgi_application application = get_wsgi_application() and seems working fine on apache side site uses same settings of whichever h

android - How to align baseline of one view to top of another -

Image
i need green icon aligned baseline top of white card in case can align top part of green icon top part of white card. layout_margintop green icon doen't allow move top in case. <relativelayout android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.wearable.view.cardframe android:id="@+id/card_home" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="text" android:textcolor="@color/black"/> </android.support.wearable.view.cardframe> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content"

objective c - new to ios - not sure how property is being used -

i have been going through following tutorial , came across line dont understand how works: nsarray *upcomingweather = [self.weather upcomingweather]; i have tried understand how works, , spent long hours. here know. upcomingweather method extracts json portion , returns array. however, have no idea purpose for: self.weather <-- no clue how being used. can explain significance of self.weather ? [self.weather upcomingweather]; there no functions in objective-c, there messages. self.weather object send message upcomingweather . these messages similar function 1 big difference : if object nil, exception silenced , no error when sending message. furthermore, in given case first part in [%@ %@] object, , second 1 message sending. in case have more 1 parameter use : [self.weather upcomingweather:parameterone andwithparametertwo:parametertwo]; the important thing mention here that, when declaring funtions, have 2 parts : private , public. send message accessing p

javascript - Why is text inside div getting hidden? -

function clicked(idclicked) { var elementclicked = document.getelementbyid(idclicked); elementclicked.classname = elementclicked.classname == 'hidden' ? '' : 'hidden'; } div.hidden { height: 500px; } div { height: 0px; -webkit-transition: height 0.5s; transition: height 0.5s; overflow: hidden; } <span onclick="clicked('homepage'); ">about</span> . . . <div id="homepage" class='hidden'> <h1>home page</h1> </div> <div id="intro_page"> <h1 id="intro_page_caption">about me</h1> <p id="intro_main_text">i enjoy reading, swimming, jogging, painting , exploring.</p> <figure class="intro_pic1"> <img src="img/award.jpg" alt="receiving award" height="250"/> <figcaption>award 2015</figcaption> </figure> &l

html - PHP mail function doesn't complete sending of e-mail -

<?php $name = $_post['name']; $email = $_post['email']; $message = $_post['message']; $from = 'from: yoursite.com'; $to = 'contact@yoursite.com'; $subject = 'customer inquiry'; $body = "from: $name\n e-mail: $email\n message:\n $message"; if ($_post['submit']) { if (mail ($to, $subject, $body, $from)) { echo '<p>your message has been sent!</p>'; } else { echo '<p>something went wrong, go , try again!</p>'; } } ?> i've tried creating simple mail form. form on index.html page, submits separate "thank submission" page, thankyou.php , above php code embedded. code submits perfectly, never sends email. please help. there variety of reasons script appears not sending emails. it's difficult diagnose these things unless there obvious syntax error. without 1 need

HTTP Status 406 with spring mvc jqgrid -

i trying load model data jqgrid in spring mvc application. working fine in spring mvc application following code , dependencies,but not working me,i getting following error. 406 error(http status error) :the resource identified request capable of generating responses characteristics not acceptable according request "accept" headers. please needful. **more data:** spring version :<spring.version>4.1.0.release</spring.version> spring security version: <dependency> <groupid>org.springframework.security</groupid> <artifactid>spring-security-core</artifactid> <version>3.2.4.release</version> </dependency> java version:<java.version>1.8</java.version> **controller:** @requestmapping(value = "/getpackagelist", method = requestmethod.get) public @responsebody

java - How can i invoke two instances of two different versions of jvm or same version of jvm in a single dos prompt? -

if had installed 2 versions of java(jdk 7 & jdk 8) how can invoke these 2 instance of jvm in single dos prompt simultaneously? if single version installed how can invoke 2 or more instance of same jvm simultaneously in ram? you have 1 default version in path, can specify version need explicitly. e.g. on windows laptop have 4 versions installed , can run 1 want. c:\>"c:\program files\java\jdk1.7.0_60\bin\java" -version java version "1.7.0_60" java(tm) se runtime environment (build 1.7.0_60-b19) java hotspot(tm) 64-bit server vm (build 24.60-b09, mixed mode) c:\>"c:\program files\java\jdk1.8.0_05\bin\java" -version java version "1.8.0_05" java(tm) se runtime environment (build 1.8.0_05-b13) java hotspot(tm) 64-bit server vm (build 25.5-b02, mixed mode) c:\>"c:\program files\java\jdk1.8.0_25\bin\java" -version java version "1.8.0_25" java(tm) se runtime environment (build 1.8.0_25-b18) java hotspot

internet explorer - CSS styling via data attribute is not working properly on IE -

i have list data attribute "data-layout", can 2 options "vertical" , "horizontal". in css change list items display property according layout. on chrome works expected on ie (tested on ie11) not redraw screen change. if enter ie's devtools , select on of items in elements panel redraws correct state. here reproduction of problem. http://fiddle.jshell.net/dimshik/bss3je3u/ thank you. document.getelementbyid('toggle').addeventlistener('click',function(){ var list = document.getelementbyid('list'); if(list.dataset.layout == 'vertical'){ list.dataset.layout = 'horizontal'; } else { list.dataset.layout = 'vertical'; } }); [data-layout="horizontal"] li { display: inline; padding: 0 10px; } <ul id="list" data-layout="vertical"> <li>a</li> <li>b</li> <li>c&

Nested cells matlab -

Image
i have 73 x 1 cell, each of cells contains 16 x 1 cell , each of cells image. there easy way can convert 1 big array of cells containing images? many thanks. if c cell, use b = [c{:}] create 16×73 cell b every column 1 of original 16×1 cell elements. works, because c{:} accesses every element in cell c , brackets ( [ ] ) group these elements 1 array again. possible, because every element in c of same type , size. use b = b(:) 1168×1 cell (73*16=1168), if want. either way, b{n} accesses n -th image.

In Cucumber on Ruby w/rspec, how do I expect/assert a webmocked call in a Then clause? -

i'm writing gem acts client remote api, i'm using webmock mock out remote api, testing cucumber rspec-mock present too. as part of cucumber tests intend stub api in given clause specify remote api called in then clause. a basic example be: feature file scenario: doing triggers call given have mocked google when call library calls google stub , response library step definition given /i have mocked api/ stub_request(:get, 'www.google.com') end when /i call library/ mylibrary.call_google_for_some_reason end /it calls google stub/ # somehow test here end the question: how can verify google stub has been called? side note: i'm aware use expect(a_request(...)) or expect(webmock).to ... syntax feeling i'll repeating what's defined in given clause. i answer myself, though verify correct and/or has no major pitfalls: given /i have mocked api/ @request = stub_request(:get, 'www.google.com') end /it calls

Converting LaTeX expression to infix expression -

let assume have expression in latex form: var latex =\frac{x}{\frac{y}{y}} so output required is: output= (x)/((y)/(y)); i tried out example stated in link: convert latex dynamic javascript function getting output of above latex as: (x)/(\frac{y){y}}` how can expression converted properly? in advance! solution of above problem var func = '\frac{x}{\frac{y}{y}}'; func = func.replace(/}{/g, ")/(").replace(/\frac{/g, "(").replace(/}/g, ")") console.log(func); innput = \frac{x}{\frac{y}{y}} output = (x)/((y)/(y))

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

i lost "unknown" error: karma.conf.js: frameworks: ['mocha', 'should'], plugins: ['karma-mocha', 'karma-should', 'karma-phantomjs-launcher'], ... browsers: ['phantomjs'], error: 23 07 2015 14:35:37.691:warn [karma]: no captured browser, open http://localhost:9876/ 23 07 2015 14:35:37.701:info [karma]: karma v0.13.3 server started @ http://localhost:9876/ 23 07 2015 14:35:37.707:info [launcher]: starting browser phantomjs 23 07 2015 14:35:37.738:error [karma]: { [error: spawn unknown] code: 'unknown', errno: 'unknown', syscall: 'spawn' } error: spawn unknown @ exports._errnoexception (util.js:749:11) @ childprocess.spawn (child_process.js:1093:11) @ exports.spawn (child_process.js:933:9) @ object._execcommand (c:\users\jinga4x\git\mdl-sample-project\node_modules\karma\lib\launchers\process.js:63:21) @ object._start (c:\users\jinga4x\git\md

Converting arrays of strings from matlab to java -

i have java gui have written, has underlying end in matlab. i trying call end functions java portion ease of use, , have been able run matlab functions java using matlab controller ( https://code.google.com/p/matlabcontrol/ ), implementation seems limited numeric data, whereas data dealing array of strings (call 90 x 8 array of strings safe). i able see array of numbers in java using matlabcontroller library. i have tried using matlab compiler sdk , there multiple internally generated errors when tried running code. i out of ideas of how might accomplish conversion. json unreasonable option pursue? i think you're doing wrong way. don't send matlab array java. instead construct java array in matlab, , send java. how done here http://de.mathworks.com/help/matlab/ref/javaarray.html .

android - GoogleApiClient onConnected not called on Watch -

i have read thread still faced similar issue: googleapiclient onconnected never called on wearable device i tried follow how works: https://developer.android.com/training/wearables/data-layer/events.html here codes: public class main extends activity implements dataapi.datalistener, googleapiclient.connectioncallbacks, googleapiclient.onconnectionfailedlistener { private static final string path = "/phonewatch"; private googleapiclient client; @override protected void oncreate(bundle savedinstancestate) { log.d("phone watch", "on create!"); super.oncreate(savedinstancestate); setcontentview(r.layout.main); client = new googleapiclient.builder(this).addapi(wearable.api).build(); ... } @override protected void onstart() { log.d("phone watch", "on start!"); super.onstart(); client.connect(); } @override protected void onstop() { log.d("phone watch", "on stop!");