Posts

Showing posts from June, 2015

cakephp websocket ratchet install error -

i trying install cakephp ratchet plugin in existing project. cakephp version 2.4.3. says follow this link has following steps: $ cd myproject/app/ $ curl -s https://getcomposer.org/installer | php $ php composer.phar require --no-update opauth/opauth:dev-wip/1.0 opauth/twitter:dev- wip/1.0 $ php composer.phar config vendor-dir vendor $ php composer.phar install i not familiar composer , when last step,it shows following error.... your requirements not resolved installable set of packages. problem 1 - requested package opauth/opauth not found in version, there may typo in package name. problem 2 - requested package opauth/twitter not found in version, there may typo in package name. potential causes: - typo in package name - package not available in stable-enough version according minimum-stability setting edit: composer.json this { "require": { "opauth/opauth": "dev-wip/1.0", "opauth/twitter": "dev-wip/1....

How to transform this php associative array? -

i have php associative input array. array( (int) 0 => array( 'data' => array( 'id' => '12', 'type_id' => '1', 'data_value' => '35.5000' ), 'type' => array( 'id' => '1', 'name' => 'temperature' ) ), (int) 1 => array( 'data' => array( 'id' => '11', 'type_id' => '1', 'data_value' => '33.7000' ), 'type' => array( 'id' => '1', 'name' => 'temperature' ) ) i want convert output array; array( (int) 0 => array( (int) 0 => array( 'v' => (int) 1 ), (int) 1 => array( 'v' => ...

sql - Optimising MySQL count(*) query -

i'm creating mysql query needs count number of rows associated each column. wondering if me optimise it's taking around 10 seconds run , website. (not ideal) the query is: select model_make, count(*) deals group model_make union select model_brand, count(*) deals group model_brand union select model_name, count(*) deals group model_name; i'm sure there quicker way this? if way run this, other options there speed up? ensure have index on each of columns grouping on. still, mysql must scan through index. other solution calculate counts once , store them update them needed.

apache - Not able to start MySQL, using Xampp v3.2.1, MySQL shutdown unexpectedly -

i have installed xampp several weeks, working. today have installed microsoft net. framework 4. after apache shut down , not run it. mysql running. have uninstalled xampp, restarted computer , installed xampp again c:/xampp. now things goes oppositely. apache running. mysql shuts down unexpectedly. i try run mediawiki setup, breaks @ mysql configuration step: "db connection error: access denied user 'root'@'localhost' (using password: yes) (localhost). check host, username , password , try again. " what should done? the error message getting now: 6:46:21 pm [mysql] problem detected! 6:46:21 pm [mysql] port 3306 in use ""c:\program files (x86)\zend\mysql55\bin\mysqld" --defaults-file="c:\program files (x86)\zend\mysql55\my.ini" mysql_zendserver55"! 6:46:21 pm [mysql] mysql not start without configured ports free! 6:46:21 pm [mysql] need uninstall/disable/reconfigure blocking application 6:46:21 pm ...

iphone - Find distance using accleremoter, gyroscope and Device motion and also use double integration -

i want calculate distance 1 point point, when start capturing accelerometer data, , till stop that, should gather samples , should give me distance based on velocity, roll, pitch, yaw , displacement. i have tried following code based on link1 , link2 double integration. (int = 1; < [arrxdata count]; i++) { //======================================================================== //old velocity double v0 = [[arrvelocity objectatindex:(i-1)] doublevalue]; //time data double t0 = [[arrtimedata objectatindex:(i-1)] doublevalue]; double t1 = [[arrtimedata objectatindex:(i)] doublevalue]; //acceleration data double x0 = [[arrxdata objectatindex:(i-1)] doublevalue]; double x1 = [[arrxdata objectatindex:(i)] doublevalue]; //newvelocity double v1 = v0 + (t1 - t0) * (x0 + x1)/2; //======================================================================== //old distance double d0 = [[arrdistance objectatindex:(i-1)...

In kineticjs, is it possible to save complex shapes to json and restore it? -

i can't seem to work. know can built in shape functions such circle, polygon complex shapes, can still serialize if @ json string, don't see x,y coordinate. jsfiddle.net/q7g99/1/. serialize , de-serialize don't give errors nothing appear on canvas. the "primitive" shapes (kinetic.rect, kinetic.circle, etc) use properties define shapes. the kinetic.shape uses context drawing commands define shape. properties can serialized -- drawing commands cannot. that's why kinetic.shape not serialize. as workaround, save scenefunc function in .js file that's loaded page. eg. in myshapescenefuncs.js: // scenefunc code var shape1=new kinetic.shape function shape1scenefunc(context) { context.beginpath(); context.moveto(200, 50); context.lineto(420, 80); context.quadraticcurveto(300, 100, 260, 170); context.closepath(); // kineticjs specific context method context.fillstrokeshape(this); } // rewire scenefunc shape1...

c# - dynamically create detailsview and gridview insdie details view -

i learning .net , using c# language. creating application there 3 tables. 1] person 2] crime 3] charges relation between tables 1<2 (one many) 2<3(one many) i have created gridvew person name linkbutton, when user click button should show details view of crimes each crime includes 1 or many charges crime in details view should show charges related crime underneath in gridview please me figure out this. sure there must way running in circle , end getting nothing. thank in advance!!! hp

ruby on rails - How should i handle migrations with 2 apps and 1 database -

in our project have 2 distinct apps (3 if think resque workers), use different users same database in remote db server. the idea 1 app writes stuff on db , other reads stuff db . both have same models same attributes, security reasons 1 app cannot in circumstance write on db. because of setup have questions: how can ensure both apps in development have same migrations? should run migrations on 1 , copy code? if change on 1 model, best way sync changes? how should handle capistrano migrating database? should ignore it? or should create logic stop servers behind migration? edit i've done research , found solutions still don't feel confident using. creating gem hold model data too messy handle for 1 small change need many things update gem use git submodule or git subtree not straightforward nice handle shared models i've no idea migrations edit 2 i have config each app: # worker , admin, need write production: adapter: mysql2 encoding...

string - Java compareTo method. The student.compareTo method should return -

i ask write student.compareto method should return 0 if first name of 2 students , last name of 2 students same. should return negative value if student's name sort lexicographically lower 1 passed in. should return positive value if student's name sort lexicographically higher 1 passed in. here code far. negative value , positive value should fixed value or should use compareto value? public int compareto(student){ int comparison = (this.firstname.compareto(student.firstname)); int comparison2 = (this.lastname.compareto(student.lastname)); if (comparison == comparison2) return 0; else if ((comparison=0 && comparison2<0) ||(comparison<0 && comparison2=0) return -1; else return 1; } this code. wondering if did correctly public int compareto(student){ string studentinfo=(this.firstname + this.lastname); string studentinfo2=(s1.firstname + s1.lastname); int comparison =studentinfo.compareto(studentinfo2); return comparison; } ...

javascript - RequireJS incorrectly loads scripts from URLs -

i'm using requirejs load dependencies. how config looks like: 'use strict'; require.config({ paths: { jquery: 'http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min', underscore: 'http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min', backbone: 'http://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.0/backbone-min' } shim: { jquery: { exports: '$' }, underscore: { exports: '_' }, backbone: { deps: [ 'underscore', 'jquery' ], exports: 'backbone' } } }); when run static website, in console there messages this: get http://*myhost*/js/backbone.js 404 (not found) require.js:1896 uncaught error: script error for: backbone http://requirejs.org/docs/errors.html#scripterror require.js:166 http://*myhost*/j...

ios - How to set the colors in glowing effect of a UILabel? -

Image
we can typically set fontcolor of uilabel by: label.textcolor = self.sometextcolor; and shadow (glow) by: label.layer.shadowcolor = self.someglowcolor; label.layer.shadowoffset = cgsizemake(0.0, 0.0); label.layer.shadowradius = 3.0; label.layer.shadowopacity = 0.5; it'ok simple shadow. however, how can set font color fancy glowing effect? example: provided a color @ center, b color @ font boundary, , c glow effect. how can use ios api achieve effect shown in diagram?

xcode - iOS Animating Container Views makes them not respond to touch events -

Image
i have storyboard 1 viewcontroller. viewcontroller holds 2 container views. i want these 2 change position each other using standard animation. after animation done views dont respond touch events. behave static images , unresponsive. i have tried using this: uiview animatewithduration: animations: completion: uiview transitionwithview: duration: options: animations: completion: i have properties childviewcontrollers @property (nonatomic, strong) firstviewcontroller *fvc; @property (nonatomic, strong) secondviewcontroller *svc; assigning these using: self.fvc = self.childviewcontrollers[0]; self.svc = self.childviewcontrollers[1]; animating: self.fvc.view self.svc.view ---- ---- without code it's hard tell you're doing wrong, i'm pretty sure problem views (after animating) out of superview's bounds. child view controller's views subviews of respective container views, , having them switch places, each view outside bounds of...

javascript - Highcharts linked views -

i've tried searching answer, no success. i have multiple charts different information on each axis coming same data source. example, file multiple columns a, b, c, d, e originate 1 chart vs b, 1 c vs d , vs e. upon selecting point or area on first chart, selection reflected on other charts (so called linked views). an example of can found on d3 examples here: http://benjiec.github.io/scatter-matrix/demo/demo.html is such thing possible highcharts? or better use d3? the other point i'd wish make need working 500,000 points (of course can , should down sampled). feasible? thank answers trying figure out best tool needs. regards in highcharts, can use scatter series ( http://www.highcharts.com/demo/scatter ), use clippath point needs inside plotarea, in other cases marker cut.

security - can two applications in android communicate using local sockets? -

i have question in android documentation mentioned android process can communicate using local sockets. mean 2 applications different user id can communicate using local sockets , "bypass" sandbox? it indeed possible ipc using local sockets on android, see localsocketserver , localsocket classes. these translate unix sockets in abstract namespace. a word of warning though: samsung has started restricting local socket use in cases through selinux in latest firmwares (unfortunately not use same policies aosp). i'm not clear on details, have seen instances selinux blocked local socket connecting on these firmwares. depends on selinux context of different processes trying use local socket not matching. sure test if end going route.

html - find and replace parameter value within an array in div in jquery -

i have div want replace value of parameter within array. my php code generate html following <div id="data1<?php echo $data['id']; ?>" data-url="<?php echo 'post/comment', array('post_id' => $data['id'], 'comment_id' => $data['c_id'])); ?>"></div> when page rendered data-url contains /blog/index.php/post/updatecomment?post_id=16&comment_id='' i want put value in comment_id , comment_id=12 i tried first see if can data-url value but when $('#data1).map(function(){ alert(this.data-url); }); it returns nan $('#data1).map(function(){ alert(this.id); }); return id expected i'd know if there way search & replace comment_id='' comment_id=12 any appreciate do this: alert($(this).attr('data-url'));

PHP if statement comparison clarity -

i having problem php. i'm new it, driving me batty! falsify() function below works. if compare (falsify == false), echo false, why necessary? why falsify not return false without comparison?; <?php if (falsify) { echo "true"; } else { echo "false"; } function falsify(){ return false; } ?> if use undefined constant, php assumes mean name of constant itself, if called string ( constant vs "constant" ). error of level e_notice issued when happens. see manual entry on why $foo[bar] wrong (unless first define() bar constant) ... http://www.php.net/manual/en/language.constants.syntax.php falsify without () implicit string: var_dump(falsify); var_dump(falsify()); function falsify() { return false; } http://codepad.org/3kb6vcmo produces: string(7) "falsify" bool(false) the first evaluates true , hence if seeing logically true .

oop - Article and Comment classes: Who's responsible for what? -

considering law of demeter , single responsibility principle , tell, don't ask principle; correct relationship between article , comment class? a: comment concern of article class. can read , create , update , delete comments. comment class read-only representation of comment concept. b: comment concern of handlecomments class. can create new comments , assign them respective articles. can read , update , delete comments. comment class read-only representation of comment concept. c: comment not concern of neither article or handlecomments classes. has crud functionality itself. can assign article well. d: comment concern of either article or handlecomments classes; can read , create , delete comments. update functionality concern of comment class itself. update #1 here how think it, can't find answers because of reading ends non-practical or simple proof-of-concept examples: do have have readcomment , createcommnet , updatecomm...

java - How to round seconds to tenths place? -

this question has answer here: java decimal string format 6 answers i thought casting value float show seconds tenths place. long starttime = system.currenttimemillis(); while (running) { track.repaint(); // varying x position movement horse.setx(xpos += (int) (math.random() * 10 + 0)); // sleeping thread try { thread.sleep(100); } catch (interruptedexception e) { e.printstacktrace(); } if (xpos >= finish_line) { running = false; long endtime = system.currenttimemillis(); joptionpane.showmessagedialog(new jframe(), id + " won , took " +(float)(starttime - endtime)/1000*-1.0+ " seconds"); } } instead, giving me way precision. cut off bit. it's easy! use decimalf...

html - How to display specific value from database to a page using php? -

i'm new php , mysql , got stuck here. have database stores image paths. , these images displayed on page. now, have column called "upvotes" in database table , want display value "upvotes" database php page - under each image it's own value. i'd able increase or decrease "upvotes" value directly page , order images upvotes least upvotes. here's code display images: <?php $query_image = "select * acc_images"; $result = mysql_query($query_image); if(mysql_num_rows($result) > 0) { while($row = mysql_fetch_array($result)) { echo '<img alt="" src="images/'.$row["image"].'"><br><br>'; } } else { echo 'file name not found in database'; } ?> to specify data returning database need refine mysql query. $results = mysql_query("select 'columnname' `table` ...

2d array maps with if statements c++ -

i working on program produces map. in print map function, taking in boolean parameter. if showtreasure true, treasure print out , vice versa. have print characters out on map though. t treasure @ end, s start throughout whole program, x place player has visited, , p player is. if none of apply, prints star. figured out how treasure , star, can't seem other 3 work. here have: // cell types - map can have of these // characters @ location on map. const char start = 's'; const char player = 'p'; const char treasure = 't'; const char empty = '*'; const char visited = 'x'; print map function: // name: printmap // description: prints map shown in example // program output on assignment page. // return: nothing // --------------------------------------------------- void printmap(const char map[][cols], const bool showtreasure, int &treasurer, int &treasurec, int &startr, int &startc, int &row, int ...

javascript - getting data back to controller from form -

i have form below. when change text fields, shows changes here <div> {{authform.email}}{{authform.password}} </div> but when try submit form ng-click="signup()" on button, doesn't send me value of text fields. below code <div class="col-md-12" ng-controller="authctrl"> <div class="row"> <div class="col-md-14"> <div class="jumbotron"> <form> <div class="createuserdiv"><input type="text" name="email" placeholder="enter email address" ng-model="authform.email"/></div> <div class="createuserdiv"><input type="text" name="password" placeholder="enter password" ng-model="authform.password"/></div> <div class=...

fonts - MPDF dejavuserifcondensed.mtx.php No such file or directory -

can me getting following message when trying use mpdf include(/var/www/svn_data/skeletonapp/mpdf/ttfontdata/dejavuserifcondensed.mtx.php): failed open stream: no such file or directory i have chmod'ed correct files ttfontdata, tmp , graph_cache it seems system has generate files not. thanks, ross. the problem directory ttfontdata/ not writable process under php code running. mpdf needs generate , write files there. simplest solution is: chmod 777 ttfontdata

google spreadsheet - How to write in cells in GoogleSpreadSheet using app Script? -

and sorry stupid question. i know how program on vba excel, i´m having hard time doing simplest stuff in google spreadsheet , can´t find tutorials on-line. my question regarding cells. in vba write in cells do: cells(1,1) = 2 //that write number 2 in first row of first column in vba can assign cell variable, like: dim long = cells(1,1) how can apply same principles in google spreadsheet? thank much! i´ve tried guys suggested. , have follow question. i`m trying modify cells in specific range. i´ve tried code: var sheet = spreadsheetapp.getactivespreadsheet().getactivesheet(); var board = sheet.getrange(2,2,9,9); board[0][0].setvalue(2); but apparently can´t use array notation. i´m not sure if .setvaleu or .getrange problem. there way can use array notation chance cell? thanks again! try following: var sheet = spreadsheetapp.getactivespreadsheet().getactivesheet(); var cell = sheet.getrange(1,1); cell.setvalue(2);

c# - Add collection of items( xml elements) to XML doc -

how add collection of items xml document ? started trying, it's wrong! i'll grateful link on internet @ tutorial too. also, assumed iteration elements. such code: public static void create_interfaces() { xdocument interfaces; interfaces = xdocument.load("interfaces.xml"); list<string> intf = new list<string>{"em0","em1","em2"}; foreach (var in intf) { interfaces = new xdocument( new xelement("interfaces", new xelement("interface", new xelement("name", i), new xelement("vlan-tagging", xelement.emptysequence), new xelement("unit", new xelement("vlan-id", "10"), new xelement("family", new xelement("inet", new xelement("address", new xelement("name", "10.10.1.23/24")))))))); } interfaces.save("i...

c++ - no overloaded function takes 2 arguments(functors) -

i run probles while trying implement custom comparator support heap data structure here's how want like: template <class t, class pred = std::less<t>> class concurrentpriorityqueue { private: template <class t> class node { private: t data; bool operator < (const node<t>& t) { return pred(data, t.data); } }; }; and compare functor want use: struct comp { bool operator () (const std::pair<int, fn_type> &p1, const std::pair<int, fn_type> &p2) const{ return p1.first < p2.first; } }; concurrentpriorityqueue<std::pair<int, fn_type>, comp> fqueue; everything looks pretty right me, error error 2 error c2661: 'threadpool::comp::comp' : no overloaded function takes 2 arguments c:\users\usr\documents\visual studio 2013\projec...

html - Empty space on side of page when using width: 100% -

i've seen tons of entries this, , have looked @ many can, , none have resolved issue. following relevant css page: html, body { background-color:#e9e9e9; font-family: arial; width: 100%; height: 100%; margin: 0px; padding: 0px; } @media screen , (min-width: 900px) { #messagelisting { width: 70%; font-family: arial; list-style-type: none; padding-left: 15%; padding-right: 15%; } } @media screen , (max-width: 900px) { #messagelisting { width: 100%; font-family: arial; list-style-type: none; padding: 0px; margin: 0px; } } #messagelisting > ul { list-style-type: none; padding: 0px; } @media screen , (min-width: 900px) { #messagelisting > ul > li > .messageentry > .messagetitle { width: 100%; display: inline-block; background: -webkit...

c++ - with template constructor,template argument deduction/substitution failed,why? -

such codes: template<typename t> struct st{ st(); st(t t){} }; template<typename t> void fun(st<t> t, t a){ } int main(int argc, char * argv[]) { st<int> t=2; fun(2,2); } compile g++ 4.8.2 errinfo: no matches fun(int,int) candidate is: template void fun(st, t) template argument deduction/substitution failed: mismatched types ‘st’ , ‘int’ try: template<class t>struct identity{typedef t type;}; template<class t>void fun(typename identity<s<t>>::type s, t t) this block compiler trying argument type deduction on first argument. template type matching pattern matching. few conversions done, in general case cannot solved (is there t such x<t> can converted type z turing-complete arbitrary limits of template compilers: recursion depth etc). in c++11 can do: template<class t>struct identity{typedef t type;}; template<class t>suing identity_t = typename identity...

android - Will an uncaught Exception in an AsyncTask crash an app? -

if exception occurs in asynctask , not caught, crash whole app? if not crash app, why that? is there difference between uncaught exception in doinbackground() method , other methods such onpostexecute() , onpreexecute() , etc? there way handling uncaught exceptions in application. see here . if not handling exception , crash app, expected, wherever exception being thrown.

c++ - Embedding skia control in Qt window -

i have complicated custom control written using skia . possible embedd control inside qt application? how integrate window events? there example shows how this? thanks. you may research qtwinmigrate . but, see, skia cross-platform too.

javascript - Array of String to an array of JSON objects -

for example: var array = ['a','a','b','b','c','c','c','c','d','d','d','d','d','d']; var ans = array.reduce(function(acc,curr){ if(typeof acc[curr] == 'undefined') { acc[curr] = 1; } else { acc[curr] += 1; } return acc; }, {}); will give me: ans = {'a':'2','b':'2','c':'4','d':'6'} but goal in format ans = [{'word':'a','count':'2'},{'word':'b','count':'2'},{'word':'c','count':'4'},{'word':'d','count':'6'}] any appreciated thanks. you have concise data format however, if must transform more verbose version, try var wordcount = []; object.keys(ans).foreach(function(word) { wordcount.push({ word: word, ...

java - Eclipse Android Project forces close immediately after startup? -

i coding accelerometer app android through eclipse. new programming java (this fourth app). when running app opens textview1 doesn't display before app crashes , device returns home screen. thoughts?! researched else's problems different mine (problems included: abstract class, in xml, , others). attached mainactivity.java, activity_main.xml, , manifest. mainactivity.java package com.example.accelerometer; import android.app.activity; import android.content.context; import android.graphics.bitmap; import android.graphics.bitmapfactory; import android.hardware.sensor; import android.hardware.sensorevent; import android.hardware.sensoreventlistener; import android.hardware.sensormanager; import android.os.bundle; import android.view.menu; import android.view.view; import android.widget.imageview; import android.widget.textview; public class mainactivity extends activity implements sensoreventlistener{ float [] history = new float[3]; private int mindex = 0...

events - Access to EKevent and EKReminder -

in ios calendar app when request privacy ekeventstore event thing done well.but when allow app access reminders calendar disappear , when try calendars nil returned. this issue in ios 7.1 only. steps produced: 1-reset privacy settings. 2-run calendar app. 3-request privacy access events. 4-get calendar store work correctly. 5-request privacy access reminders. 6-kill app , reopen it. 6-get calendar doesn't work correctly , return nil. anyone can me ? could please check how many calendars , reminders list have, if more 100, event store stop working correctly. more information check apple: icloud: limits contacts, calendars, reminders, , bookmarks

php - How to get last inserted id in zf2? -

i new in zf2. make create action , want last inserted id calender_id equal zero. how can last insert id in create action ? here code: public function createaction() { if ($this->zfcuserauthentication()->hasidentity()) { $form = new calendarform(); $form->get('user_id')->setvalue($this->zfcuserauthentication()->getidentity()->getid()); $form->get('submit')->setvalue('add'); $request = $this->getrequest(); if ($request->ispost()) { $calendar = new calendar(); $form->setinputfilter($calendar->getinputfilter()); $form->setdata($request->getpost()); if ($form->isvalid()) { $calendar->exchangearray($form->getdata()); $this->getcalendartable()->savecalendar($calendar); if($request->isxmlhttpreques...

how create regex pattern for this string -

how create regex pattern string ? {text@lorem ipsum dolor sit amet, venenatis leo vulputate dignissim erat, sodales wisi tempus libero sollicitudin. ut vitae ut pretium fusce @ nullam, pharetra sed suspendisse elit sed nunc, metus scelerisque eu amet dapibus. ipsum integer porttitor diam ultrices sed, suspendisse elit, magna nam nunc enim montes vulputate, velit nibh sed @ atque quam vitae, venenatis nec justo proin. eros non per imperdiet magna massa enim, ultricies quis iaculis tortor tempor, eleifend vel viverra ipsum vulputate consectetuer, ligula placerat sagittis, torquent nunc turpis. neque } my regex patter looks ({text@)([\n.]*)(}) i thank in advance help if want catch text after text@ , inside {...} , can use (given there no } in wanted text): {text@([^}]*)} the result in first capturing group: http://regex101.com/r/op5tt2 [^}] means character except }

Redis Sentinel C# Client -

i've got 3 redis servers, 1 master & 2 slaves. 1 sentinel running, monitoring them well. promote whichever instance when required , smooth. the problem have communicating c#. googling, appear csredis supports sentinel retrieving slaves/masters. using code this... //create manager, has sentinels in (this have 3 when go live) redissentinelmanager sentman = new redissentinelmanager("localhost:26379"); //get slave, these read-only sentman.getslave("mymaster", 100, 100); //get master, storing object sentman.getmaster("mymaster", 100, 100); this works, absolutely fine , various responses change when kill instance. however, it's incredibly slow! if create manager , try , slave 5 times, takes around 1second per slave request, crazy slow. have noticed, first request very, fast. see code below... //try , 5 slaves ( int = 0; < 5; ++ ) { stopwatch = stopwatch.startnew(); var slave = sentman.getslave("mymaster", 50, 50);...

java - Retrieving data from JSP-Class (MVC with Servlet) -

im working on school project me , group supposed build mvc-project have classes building , room. relation onetomany, building-(onetomany)-room. problem occurs when want search building name , later show rooms in building. can extract relevant data when run our servlet without our jsp, when start project running our searchbuilding.jsp can type building name, , when expected see connected rooms, instead message "java.lang.classcastexception: java.util.arraylist cannot cast org.ics.ejb.room". might bit messy code appreciate if me spot problem since im supposed show professor tomorrow. this our code: building: @entity @table(name = "building") public class building { private string bname; private list<room> rooms; // building can have many rooms @id @column(name = "bname") public string getbname() { return bname; } public void setbname(string bname) { this.bname = bname; } @onetomany(mappedby = "building", fetc...

Unable to access objects in Typescript -

i unable access objects declared within class in typescript functions. here's have: export class questions { credentials:mysqlcredentials.mysqlcredentials; sqlconnector:mysql.mysql; constructor() { this.credentials = new mysqlcredentials.mysqlcredentials('192.168.249.139', 'dev', 'dev', 'test'); this.sqlconnector = new mysql.mysql(this.credentials); } addquestion(req, res) { var q = ...<lot of code on here> ; this.sqlconnector.query(q, null); //error shown line res.send(); } } error: typeerror: cannot call method 'query' of undefined if code structured shown above i.e. sqlconnector variable defined in typescript class, throws error. if place sqlconnector outside typescript class works fine. need fix need sqlconnector object inside class. export class questions { credentials:mysqlcredentials.mysqlcredentials; constructor() { this.credentials...

java - My Android App Crashes on Launch -

i'm trying build basic app displays newstories (currently hardcoded strings.xml file). keeps crashing on launch, though there no errors being shown in code. here's java part of code (i can supply other files, or zipped copy of workspace if that'll anyone) package cara.app; import android.os.build; import android.os.bundle; import android.annotation.suppresslint; import android.app.activity; import android.content.res.resources; import android.view.menu; import android.view.view; import android.widget.button; import android.widget.textview; public class mainactivity extends activity { final resources res = getresources(); final textview textview = new textview(null); final button next = (button) findviewbyid(r.id.linearlayout1); @suppresslint("newapi") @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); ...

Shell: grep the true value -

when use grep value, gave me 2 value. how can true value? for example: vmdk cid=abcdefgh parentcid=12345678 shell cid=$(grep -i "cid" "snapshot.vmdk" | cut -d'=' -f2) echo "cid = $cid" result: cid = abcdefgh 12345678 add -w flag in grep command like: grep -w -i ...

html - Undefined variable: use_smtp error in php mail script -

i have form on webpage calls php script send email though isn't working properly, nginx error log gives following when submit form; 2014/04/07 15:55:42 [error] 10829#0: *1 fastcgi sent in stderr: "php message: php notice: undefined variable: use_smtp in /home/deployer/example/releases/20140407153701/form-handler.php on line 62" while reading response header upstream, client: 86.131.120.178, server: example.net, request: "post /form-handler.php http/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "example.net", referrer: "http://example.net/" line 62 if($use_smtp == '1'){ from form-handler.php $use_smtp = '0'; $emailto = 'me@example.net'; // retrieve parameters $emailfrom = isset($_post["email"]) ? $_post["email"] : ""; $nocomment = isset($_post["nocomment"]) ? $_post["nocomment"] : ""; $subject ...

How To remove the http://www from the any given url in c# -

i need remove http://www. or www. url . example http://www.stackoverflow.com/questions/ask http://stackoverflow.com/questions/ask www.stackoverflow.com/questions/ask for above need stackoverflow.com/questions/ask this really simple var url = "http://www.stackoverflow.com/questions/ask"; url = url.replace("http://","").replace("www.","")

android - Getting compilation error "activity_main" can not be resolved or is not a filed -

i trying instrument android application sdk enables me test mobile application on device. needed create mainactivity class in app have following method: @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); but following compilation errors: "activity_main can not resolved or not field" i have seen postings in regards , provided solution has been: remove "import android.r;" add "import application.package_name.r; i have done follow: import com.mymobileapp.r where "com.mymobileapp" package name r.java resides error persists after re-build\clean project. if provide name of application import statement can not resolved , not think necessary since referencing package in same application. also, checked r.java class generated file , seems can not modified since eclipse gives me warning file can not edited. in r.java file under layou...

sql - Undefined variable data when I try to import a csv file in php -

im trying import csv file in sql database using php. i have code <?php echo $_files['userfile']['name']; echo $_files['userfile']['size']; include ("accesobd.php"); if ($_files['userfile']['size'] > 0) { echo "el archivo contiene informacion"; $file = $_files['userfile']['tmp_name']; $handle = fopen($file,"r"); $data2 = fgetcsv($handle,1000,",","'"); { if ($data[0]) { echo "entramos en el import"; mysql_query("insert alumno (nombre, apellidos, correoelectronico) values ( '".addslashes($data[0])."', '".addslashes($data[1])."', '".addslashes($data[2])."' ) "); } ...