Posts

Showing posts from September, 2012

c - Seg Fault while strcpy -

this relevant piece of code i'm working on. tokenize input stdin no issue , when go copy input, i'm getting segfault. however, no segfault "strcpy(s,input)". missing fundamental here? thank you char *s = malloc(64 * sizeof(char)); char *token = malloc(64 * sizeof(char)); char *currstring = malloc(128 * sizeof(char)); currstring = null; fgets(input,100, stdin); strcpy(s, input); token = strtok(s,delim); while (token) { //condition checking strcpy(currstring,token); } char *currstring = malloc(128 * sizeof(char)); currstring = null; you allocate memory, discard , set pointer null. rid of second line. if trying set empty string ( "" ), instead do: currstring[0] = '\0'; // or strcpy(currstring, ""); this isn't necessary, though. don't need set string "" if you're going strcpy() later. char *token = malloc(64 * sizeof(char)); you not need allocate memory token . strtok() ca

How do I get Eclipse Debug Server to debug rails application? -

i have simple rails app runs in eclipse juno when use command line 'rails server' launch. need debug in eclipse ide , set breakpoints, , can't figure out how run server withing eclipse using either 'run server', 'debug server', 'run as', or 'debug as'. nothing happens, no output console, nothing. my gemlist has: using debugger-linecache (1.2.0)/ using debugger-ruby_core_source (1.3.2)/ using debugger (1.6.6) i ran bundle install , 'gem install debugger' successfully. have ruby 1.93, rails 3.2.17 windows 7. restarted. i have eclipse environment configured on mac, debugger, can't find missing piece windows setup. thanks much, anne i had similar issue eclipse + aptana plugin. when select 'debug/run server', nothing happened. the issue project structure. in case, had empty rails project (testproject) in eclipse , imported rails application file system (railsapp). so, project explorer, had hierarchy as

configuration management - How can I see Puppet-managed file contents that would be created in --noop mode for nonexistent files? -

context: if there's puppet managed file on system, , puppet wants change contents, tell me differences have made if not --noop . however, if file doesn't exist, --noop output tells me should file . question: is there way configure --noop mode (or other verbosity/debugging settings) see contents put file, if doesn't exist? what i've tried: if run puppet (agent or apply) in --noop mode, --debug , --verbose , lot of information, not info want. perhaps there's way using generated/cached catalog? i'm not aware of puppet option give you're looking perhaps create empty file , run puppet --noop on unix can run: touch /path/to/file

c# - Not lock up the GUI on thread.sleep -

i'm writing multiple user server\client application. essentially, implement chat room , allow users communicate each other. i've gotten application work between server\client far sending request server, checking incoming network connection, , responding immidiately. however, client receive chat messages server, thing can think of running server on client. if this, however, client freeze , not able anything. plus, client not designed opening ports connect server. what best recommendation on waiting on data server come client, without causing client lock up? thanks! (and also, i'm not \professional\ c# programmer, more of amateur, please don't give me complicated answers) if you, use either background worker, or second thread. if don't want that, can use thread.suspend . to start new thread: using system.threading; thread t = new thread() t.start; note: not recommended.

css - trying to display a picture in XML -

a picture of piece of pie suppose display, won't. code picture individual used in video tutorial, changed name of picture. have asked teachers , response received size of picture might issue. images not exceed size of 48 x 48 pixels , not. code have listed 1 entry. appreciate might give me. thank you, tisha <?xml version="1.0"?> <?xml-stylesheet type="text/css" href="pies6.css"?> <pies> <pie> <indo>pp12</indo> <name>perfect pecan</name> <factory>baker</factory> <price>$8.30</price> <b-s>t</b-s> <html:img xmlns:html='http://www.w3c.org/tr/rec-html40/' src='images/pecan.gif' /> </pie> </pies> the css code is: pies { background-color:#e0f8f7; width:100%; } pie { display:block; margin-bottom:60pt; } name { display:block; color:#0b2161; margin-left:15pt; font-size:25pt} this works i

php - Doctrine entity creation strategy -

when working entities in doctrine it's obvious add "helper" methods entity. take example; class post { protected $tags; public function __construct() { $this->tags = new arraycollection(); } public function gettags() { return $this->tags; } public function addtag( $tagname ) { $tag = new tag(); $tag->setname( $tagname ); $this->gettags()->add( $tag ); } } in works , makes clean code: $post = new post(); $post->addtag('economy'); however, becomes more problematic when tag many many relationship , when adding tag post want check if tag exists. e.g. post might not have tag 'economy' adding post new tag post's point of view. however, if tag 'economy' exists in database have problem. want our entity popo possible, i.e. not have references entity managers or repositories. what strategy solve problem? you need outside entity. example... class post {

javascript - How to have different images change every second in a Div? -

i have javascript gets images in folder called "pictures/" want code writen can have each div different different images folder tell cant figure out how set up. im knew , appreciate help: function displayimage(image) { document.getelementbyid("img").src = image; document.getelementbyid("img2").src = image; document.getelementbyid("img3").src = image; } function displaynextimage() { x = (x == images.length - 1) ? 0 : x + 1; displayimage(images[x]); } function displaypreviousimage() { x = (x <= 0) ? images.length - 1 : x - 1; displayimage(images[x]); } function starttimer() { setinterval(displaynextimage, 1000); } var images = [], x = -1; images[0] = "pictures/" + "1.jpg"; images[1] = "pictures/" + "2.jpg"; for(var y=2;y<4;y

function - creating a Sin formula in c programming -

the program compile when running not getting correct values inputs, had looked way make sine formula , had found 1 don't believe right. is formula correct? think running sin function in c giving me wrong value well. * still getting wrong values these changes if input 1.5 , 4 im getting 0.000 , random integer /* * function mysin using sin formula sin of x * function returns sin value computed * parameters -for function mysin "x" value sin * -"n"is number of series run * *the program uses sin(x) function real sin * */ #include <stdio.h> #include <math.h> int mysin(double x, int n){ int i=0; double sinx=0; for(i=1; i<=n; i+=2){ sinx=(pow(x,i)+sinx); // } return sinx; } int main(double sinx){ double realsin=0; double x=0; int n=0; printf("please input x , n:"); scanf("%lf",&x); scanf("%d",&n);

javascript - detect jquery version use on or live -

i writing plugin can used in website dont know exact version of jquery , getting few issues .on() method. to fix have simple still getting errors in jquery 1.4.2. var $myelements = $('.elements'), myfunction = function(e){ console.log('here'); e.preventdefault(); } if (typeof jquery != 'undefined') { if(jquery.fn.jquery < 1.4){ $myelements.live('click', myfunction); } else { $(document).on('click', $myelements, myfunction); } } based on previous answer, can too: ;(function($) { if(!$.fn.on) { $.fn.on = $.fn.live; } }(window.jquery || window.zepto)); then can use on in rest of code.

ember.js - difference between emberjs model's _data and _attribute? -

i using model app.license has property called expires_at . while editing license, in edit method of licensecontroller , setting it's expiry : this.get('model').set('expires_at', '2014-12-31'); then doing this.get('model').save(); make put request server. in request, expires_at parameter send old value of model. when printed model in console, showed me expires_at in both _attributes , _data . strange thing expires_at in _attributes updated one, , 1 in _data old 1 (which sent put request). other properties of license getting set , sent put parameters except expires_at . missing out on small important thing? on appreciated.

java - My Play! process stops as soon as I close the console -

i'm trying deploy , run poc ws on server. ws works fine on dev computer.i package app using dist command. upload , unzip on server, start server using myapp& command. close connection server web server stops... it shouldn't attached console... how can fix ? for i'm adding script called nohup that's bad it's not default behavior

java - Is there any dependency between Spring and Apache Tomcat Jar -

following timeline of how got error in application used spring 2.5.3 , tomcat 7.0.27 - no error upgraded spring 3.1.1 same tomcat (7.0.27) - no error upgraded tomcat 7.0.42, used spring 3.1.1 - verifyerror when stop application, 1000 verifyerrors (seperate error every destroybean) when upgraded tomcat 7.0.42. following stack trace: java.lang.verifyerror: (class: org/springframework/orm/jpa/entitymanagerfactoryutils, method: convertjpaaccessexceptionifpossible signature: (ljava/lang/runtimeexception;)lorg/springframework/dao/dataaccessexception;) wrong return type in function @ org.springframework.orm.jpa.support.persistenceannotationbeanpostprocessor.postprocessbeforedestruction(persistenceannotationbeanpostprocessor.java:357) @ org.springframework.beans.factory.support.disposablebeanadapter.destroy(disposablebeanadapter.java:193) @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.destroybean(defaultsingletonbeanregistry.java:498) @

java - override spring batch admin to use mysql database -

i trying use mysql database instead of default hsql in spring batch admin. per documentation http://docs.spring.io/spring-batch-admin/reference/reference.xhtml , using jndi datasource spring batch admin i copied env-context.xml src/main/resources/meta-inf/batch/override/manager/env-context.xml , changed configuration value from <value>classpath:batch-${environment:hsql}.properties</value> to <value>classpath:batch-mysql.properties</value> below full configuration. <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <!-- use set additional properties on beans @ run time --> <bean id="placeholderproperties" class="org

javascript - How to add additional form fields using angularjs? -

i have researched online on how create additional form field. method using comes site. http://mrngoitall.net/blog/2013/10/02/adding-form-fields-dynamically-in-angularjs/ so trying do, have data inputted in. don't know how many data points person put in. enable can let them put additional points if wish. i have in tag: <script> function angularctrl($scope) { function controller($scope) { $scope.master = {}; $scope.update = function(user) { $scope.master = angular.copy(user); }; $scope.reset = function() { $scope.user = angular.copy($scope.master); }; $scope.reset(); } $scope.choices = [{id: 'choice1'}]; $scope.addnewchoice = function() { var newitemno = $scope.choices.length+1; $scope.choices.push({'id':'choice'+newitemno}); }; $scope.showaddchoice = function(choice) { return choice.id === $scope.choices[$scope.choices.length-1].id; }; $scope.showchoicelabel = function (choi

android - text and sp / dp, it just does not work nicely -

i testing app on nexus 5 (full hd screen) , htc 1 x (720p). using sp android developer, gives me result not want! text on nexus 5 bigger on htc 1 x, taking account screen bigger in size. when use 'dp' instead of 'sp', more alike...the result want... but want use sp, way should it. so created values-sw380dp directory , put there different value. but, nexus 5 not use these values! used code: displaymetrics displaymetrics = getresources().getdisplaymetrics(); float dpheight = displaymetrics.heightpixels / displaymetrics.density; float dpwidth = displaymetrics.widthpixels / displaymetrics.density; surprisingly: both phones, dpwidth == 360! have no way nicely 720p , 1080p screen ? does have idea or solution? i tempted use dp...

ios - Multiple NSManagedObjectContexts or single context and -performBlock -

i have been using core data single nsmanagedobjectcontext long time, fetching, saving, background update operations done on single context through helper classes, planning implement multiple nsmanagedobjectcontext approach (which recommended solution in of searching). my question is: performblock execute code context? can't below: - (void) checksyncserver { dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_background, 0), ^{ //do here, check , fetch data // create nsmanagedobject's [_tempcontext save:&error]; //mastercontext merge changes through notification observers }); } (i.e) execute code apart -performblock method. how can execute multiple asynchronous methods , perform save? however, find single context (which managed 1 singleton nsobject class) simpler use. this multiple context contextconcurrencytype looks more complicated (in terms of execution flow). there better solution? you

c++ - For a derived class with a constructor that takes a base class pointer, how do I refer to the base class pointer? -

i'm working on assignment on abstract base classes shapes. last section need write class general 3d version of of prior 2d shapes eg. square. so can see code below, constructor takes base class pointer shape* . in function " getvolume " need multiply z area of shape pointed shape* , can calculated function getarea() specified in each shapes respective class. refer shape being pointed to? class prism : public square, public rectangle, public circle { private: double z; public: prism(){z=0;} prism(shape*, double a){z=a;} ~prism(){cout<<"prism destructor called"<<endl;} //access functions void print_(){cout<<"prism length = "<<z;} double getlength(int n)const{ return z; } void setlength(double a){z=a;} //other functions double getvolume(){ return ??????????;} }; how refer shape being pointed to? hoping this->getarea() or shape*->getarea() errors tell me "shape

c - Finding issues in a code snippet -

i need screening question (in c) asked company. the question find out issues below code. short test() { short a,b,c; b=10; c = + b; return c; } also, if signature changed short test(short a) , removed stack? i cannot seem find issues code except junk values stored in 'a' not initialized. , second question, difference make if 'a' passed argument function? can please me this? the value of a indeterminate because uninitialized. reading a results in undefined behavior. if a passed function , uninitialized same problem occur, sooner.

python 2.7 - how to test class private method in nosetest -

how test class private method in nosetest ? my code class txt(object): """docstring txt""" def __init__(self, im_file): super(txt, self).__init__() self.im_file = im_file @classmethod def __parse_config(cls, im_file): line in im_file: print(line) pass my nosetest class testtxt(object): """docstring testtxt""" @classmethod def setup_class(cls): cls.testing_file = '\n'.join([ 'rtsp_link: rtsp://172.19.1.101', ]) def test_load(self): txt.parse_config(stringio(self.testing_file)) pass you can access txt.__parse_config() private method prepending class name before method name: txt._txt__parse_config() . demo: >>> class a(): ... _private = 1 ... __super_private = 2 ... >>> a._private 1 >>> a.__super_private traceback (most recen

Why amazon gives an error occurred fetching Instance data at EC2 instance dashboard? -

Image
i have several running ec2 instances today when login amazon , go ec2 instance dashboard gives me "an error occurred fetching instance data". and not showing running instances , instead of showing count on dashboard it's showing "error retrieving resource count". i'm seeing same problem. aws having problems ec2 api on us-east-1. wait out bit , have them fix it. you can check overall aws health status here: http://status.aws.amazon.com/ here's screenshot of status of 06:14 utc time:

pagination - Laravel 4 many to many relation paginate -

stuck second , solution did not find answers, maybe searching wrong my model class mediacategory extends eloquent { protected $table = "md_categories"; public function media() { return $this->belongstomany('media', 'media_categories')->orderby('id', 'desc'); } } controller public function getcategory($slug) { $categories = $this->category->has('media')->orderby('name', 'asc')->get(); $medias = $this->category->whereslug($slug)->get(); // $medias = $results->media(); $this->layout->title = 'média tár'; $this->layout->content = view::make('front::page/results') ->with('categories', $categories) ->with('medias', $medias); } view <div class="content-left"> @include('

visual studio 2010 - ping IP addresses constantly -

i project engineer , working on multiplexer system , writing software control system using visual basic 2010 company won't spend money profession software developer. main program working have quick question people more experienced. have 10 x ethernet devices within system (topside , subsea) need monitor connection status of. the way going pinging each ip address in sequence on , on in loop , if connected/disconnected change pitcurebox imagelist control show connection status. done in new thread stop main interface becoming unresponsive , works slow update of course, so... my question guys there better way of showing connected/disconnected ip addresses on system? have searched internet find isn't quite i'm looking for, or i'm sh*te @ searching. thank time. since using ui-application, have @ ping -class async method pinging , depending on normal ping times , how heavy network traffic change ping time, @ least once second needed. in form use timer

windows - Changing IE version being used with Lotus Sametime 8.5.2 -

we using ie (browser control) inside sametime 8.5.2 problem on few of systems sametime using ie version 8 instead of system installed version 10 , spoils whole web page. how make lotus sametime use system installed browser(ie) if using sametime client embedded in lotus/ibm notes client, can change browser being used following below. http://www-10.lotus.com/ldd/notestipsblog.nsf/dx/how-to-change-the-default-browser-for-notes

linux - Problems for show branch in terminal -

i have problem shell script, it's in ~/.bashrc: parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' } ps1="\[${debian_chroot:+($debian_chroot)}\033[1;34m\u\033[1;34m@\h\033[0;32m:\w\033[1;35m $(parse_git_branch) $ \033[0m\]" i need show current branch, , it's doing fine, when need change directory take source ~ /. bashrc return work. another problem when delete wrong typed erases information on line including vinicius@pontocom:~ (master) $ git comes shell scripts showing current branch, can use them adding source '/usr/local/etc/bash_completion.d/git-prompt.sh' to bash config file on os x. if you're using debian, should able source same file, installation path might different. you can enable git bash completions sourcing file well: source '/usr/local/etc/bash_completion.d/git-completion.bash'

c# - Grab Value In String -

i have list of browser agent strings each string looking - mozilla/5.0 (ipad; cpu os 6_1 mac os x) applewebkit/536.26 (khtml, gecko) version/6.0 mobile/10b141 safari/8536.25 using foreach loop going through list of these strings. on each iteration want extract os version out i'm assigning variable before proceed process further. foreach (var e in agentstrings) { var myos = e.useragent os (6_1_3) ?? // more stuff here } what's easiest way retrieve value between os , in agent string? probably best way check see if string contains short list of os's you're looking for: string theos = ""; var agentstring = e.useragent; if(agentstring.contains("mac os x") theos = "mac os x"; else if(agentstring.contains("windows 8") theos = "windows 8"; etc. that's how msdn , other stack overflow questions seem recommend doing

Perl parser acts wierdly with sort and uniq -

hi newbie in perl. have trouble in understanding operator precedence. found program in wikipedia page ruby "nice day isn't it?".downcase.split("").uniq.sort.join # => " '?acdeinsty" i tried same thing in perl parser acts wierdly. have following program use strict; use warnings; use list::moreutils qw(uniq distinct) ; $hello = q/nice day isn't it?/ ; print join ('', sort ( list::moreutils::uniq (split(//, lc $hello )))); # &list::moreutils::uniq parses correctly , need include & before call. print "\n"; print join('', sort( list::moreutils::uniq(split(//, lc $hello, 0)))); output : '?acdeiiinnstty '?acdeinsty also tried how perl parses code b::deparse module , here output perl -mo=deparse test.pl use list::moreutils ('uniq', 'distinct'); use warnings; use strict 'refs'; $hello = q[nice day isn't it?]; print join('&#

javascript - format string from Date.getTime() -

for reason can't find answer how format string new date().gettime(). when run string, sequence of numbers such 1395430135200. how format readable date time zone? why not use new date()? var = new date(); console.log(now.tolocaledatestring()); console.log(now.tolocaletimestring());

Executing code on creation in scala trait subclass -

i'd define val in trait gets computed once sub-class gets instantiated. for instance : trait example { val p : int val after : int = p + 1 } class ex(x : int) extends example { val p = x } i want after computed each instance of ex, no matter parameter x give, after 1 . if, p 0 computation. of course, works def, no longer computed once. after in example instantiated right away, before ex instantiated - , before looking @ x . to fix can turn after lazy val , evaluated first time use it.

xcode - Error distributing iOS app ITMS-9000 -

i have made game using game maker , got exported xcode 5 on mac. have played game on iphone, game work quite well. i have provisional profile, certificates needed (developer , distribution). have certificate once in keychain. i created app on developer website ready upload. whenever try upload can select app , starts uploading, after short time error: error itms-9000 bundle "com.grown-apps.whopays" @ bundle path payload/whopays.app not signed using apple submission certificate @ softwareassets/softwareasset (mzitmspsoftwareassetpackage) but have signed in xcode 5. selected distribution profile sign with. it doesn't matter how try upload, using application loader or xcode 5, same error. i have tried whole week searching internet, , got end cannot stand anymore. have followed every video or text guide possibly find. have found many people same issues both here , everywhere else, none of solutions people came , worked many didn't work me. sitting here @ 3

r - if() simple loop code -

say have 2 data sets. ill call first set train , here variables month = c(1,1,1,2,2,2,3,3,3,4,4,4) day=c(3,8,12,3,8,12,3,8,12,3,8,12) trend=c(0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1,0.2,0.3,0.4) train=cbind(month,day,trend) and second set called test, has month , day variables tsmonth = c(1,2,2,3,3,3,4,4,4) tsday=c(3,3,12,3,8,12,3,8,12) now want fill in trend portion of test set using values training data example: in test set, january 3rd, had trend value of 0.1 there first value in test should 0.1 in end should tstrend = 0.1, 0.4, 0.4....so on i tried code gave me error msg , don't know change here tstrend=rep(0,length(tsmonth)) (i in 1:length(tsmonth)){ (j in 1:length(month)){ if (tsday[i] = day[j] & tsmonth[i] =month[j]) { tstrend[i] = trend[j] } } } i appreciate help. thank you, a i don't quite understand trying do, definetly see wrong if() statement, should be: if (tsday[i] == day[j] && tsmonth[i] == month[j]) == compare =

python - building reusable package in django -

am trying build reusbale package django, package contains multiple application since project quite large. so, structure, has apps folder , inside there multiple apps payment, product, account..etc as trying make project re-usable, created in different location of source project , did symbolic link root folder in source project. now, when want install apps, have write them 1 one in installed_apps installed_apps = ('package.apps.store', 'package.apps.product', 'package.apps.delivery', 'package.apps.payment', 'package.apps.store', 'package.apps.cart', 'package.apps.tax') is there way, can include 'package' in installed apps , perhaps use package init load other modules? i tried doing in package/__init__.py from django.conf import settings user_settings package.conf import settings user_settings.instal

postgresql - Importing MySQL to Postgres. Permission issues -

i have mysql , postgres databases. have been working on mysql db populated data. me use heroku, need port postgres. these steps followed: i exported data mysql db simple dump command: mysqldump -u [uname] -p[pass] db_name > db_backup.sql i logged postgres sudo su postgres now when try import sql postgres, not have access db_backup.sql. changed permissions users , made dump file read/write still cannot import sql. my question correct way duplicate (both schema , data) mysql postgres. why not able access dump file after changing permissions? , if have dump mysql chances runs issues while running on postgres (i not have procedural stuff in mysql. creation of tables , dumping data tables.)? thanks! p.s. on mac-mavericks if matters while primary part of question answered @wildplasser thought put entire answer people looking @ porting mysql data postgres. after trying out multiple solutions, easiest , quite smooth solution this: https://github.com/lanyrd/mys

git - How to prevent storing postgres password in tomcat's context.xml -

in application have context.xml file in src/main/tomcat/conf contains following information: <?xml version='1.0' encoding='utf-8'?> <context> <watchedresource>web-inf/web.xml</watchedresource> <resource factory="org.apache.tomcat.jdbc.pool.datasourcefactory" name="jdbc/tomcatdatasource" auth="container" type="javax.sql.datasource" initialsize="1" maxactive="20" maxidle="3" minidle="1" maxwait="5000" username="postgres" password="postgres" driverclassname="org.postgresql.driver" validationquery="select 'ok'" testwhileidle="true" testonborrow="true" numtestsperevictionrun="5"

ID3 Unicode arabic characters php -

Image
im creating audio library , have upload function. upload function should read id3 tags store in database. since sounds arabic tracks, id3 tags in arabic , function have right reads tags don't read arabic tags, returns "?????" arabic words/names. how can encode it? solution? class cmp3file { var $title;var $artist;var $album;var $year;var $comment;var $genre; function getid3 ($file) { if (file_exists($file)) { $id_start=filesize($file)-128; $fp=fopen($file,"r"); fseek($fp,$id_start); $tag=fread($fp,3); if ($tag == "tag") { $this->title=fread($fp,30); $this->artist=fread($fp,30); $this->album=fread($fp,30); $this->year=fread($fp,4); $this->comment=fread($fp,30); $this->genre=fread($fp,1); fclose($fp); return true; } else { fclose($fp); return false; }

java - Sqrt function invokes an error -

i'm trying aplication calculates equation. need use sqrt errors after trying different metods i've seen on internet. code: public void calculate(view v){ edittext number1text=(edittext)findviewbyid(r.id.num1text); edittext number2text=(edittext)findviewbyid(r.id.num2text); edittext number3text=(edittext)findviewbyid(r.id.num3text); int num1=integer.parseint(number1text.gettext().tostring()); int num2=integer.parseint(number2text.gettext().tostring()); int num3=integer.parseint(number3text.gettext().tostring()); integer del= num2*num2+4*num1*num3 ; integer first=-num2-math.sqrt(del)/2*num1 ; -getting errors here integer second=-num2+math.sqrt(del)/2*num1 ; -and here textview delta=(textview)findviewbyid(r.id.deltatxt); textview x1=(textview)findviewbyid(r.id.x1txt); textview x2=(textview)findviewbyid(r.id.x2txt); delta.sett

javascript - Retrieve text from textarea -

i have <textarea></textarea> on html page , want retrieve info based on user types it. if user types "hello" in textarea. "how you" appear. like (code doesn't work, example: <script> if ('msg'.value === "hello") { document.write("how you"); } </script> <textarea id="msg"></textarea> <input type="submit></input> hope can me out! edit: outputs msg val, on submit. thanks! 'msg' string. need element: if (document.getelementbyid('msg').value === "hello") { document.write("how you"); }

html - How to get an automatic effect of rosace in css ? -

Image
i making website , there effect have putted on circle. circle automaticlly opens on mouse hover , close when mouse away. want make automatic . mens should open , close automaticlly. here css code circle . html <div class="circle"> <h1>trance-2014</h1> </div> css .circle { background: rgb(255, 255, 255); border-radius: 100%; cursor: pointer; position: relative; margin: 0 auto; width: 15em; height: 15em; overflow: hidden; -webkit-transform: translatez(0); -moz-transform: translatez(0); -ms-transform: translatez(0); transform: translatez(0); } .circle h1 { color: rgba(189, 185, 199, 0); font-family:'lato', sans-serif; font-weight: 900; font-size: 1.6em; line-height: 8.2em; text-align: center; text-transform: uppercase; -webkit-font-smoothing: antialiased; -webkit-user-select: none; -moz-user-se

html - overflow:scrol doesn't show the scroll -

i using asp.net 4 problem the scrol not shown asp code <div id="tabs-1"> <asp:scriptmanager id="scriptmanager2" runat="server" /> <asp:updatepanel id="updatepanel3" updatemode="conditional" runat="server"> <contenttemplate> <table id="bookingtable" runat="server" class="tableresultclass"> <tr> <th>id</th> <th>plantime</th> </tr> </table> </contenttemplate> <triggers> <asp:asyncpostbacktrigger controlid="mealtimeselector&qu

I can't click form in UIWebView (iOS) -

i builing ios app in users swipe left right show uiwebview containing html form , scrollable html element. however, click in uiwebview rejected. can't click or scroll in it. how come ? - (void)viewdidload { // chat nsstring *fullurl = @"http://website.com/chat"; nsurl *url = [nsurl urlwithstring:fullurl]; nsurlrequest *requestobj = [nsurlrequest requestwithurl:url]; chat = (uiwebview *)[self.view viewwithtag:101]; [chat loadrequest:requestobj]; chat.frame = cgrectmake(-284, 0, chat.frame.size.width, chat.frame.size.height); // move uiwebview uiswipegesturerecognizer * gesturerecognizer = [[uiswipegesturerecognizer alloc] initwithtarget:self action:@selector(movechat:)]; // left or right [gesturerecognizer setdirection:(uiswipegesturerecognizerdirectionright)|(uiswipegesturerecognizerdirectionleft)]; [self.view addgesturerecognizer:gesturerecognizer]; } // handle swipe gesture - (void)movechat:(uiswipegesturerecognizer *)re

java - Mysql: Get Strings? -

i try receive names out of database. i did write code: public static string getcmdcommand(int resultcount) throws exception { try { // load mysql driver, each db has own driver class.forname("com.mysql.jdbc.driver"); // setup connection db connect = drivermanager.getconnection(""+mybot.mysqldbpath+"",""+mybot.mysqldbusername+"",""+mybot.mysqldbpassword+""); preparedstatement zpst=null; resultset zrs=null; zpst=connect.preparestatement("select `befehlsname` `eigenebenutzerbefehle`"); zrs=zpst.executequery(); if(zrs.next()){ return zrs.getstring(resultcount); }else{ return "-none-"; } }catch (exception e) { throw e; } { close(); } } and start method running loop: for(int = 0; &l

css - Side by side boxes: how to make one slide underneath? -

imagine 2 boxes side side. right 1 floated right, fixed width holding photo, , left contains text fills remaining width left edge of container. if resize (squash down) browser want text in left box fluid. ok far good... here's difficult part: need minimum width on left container, when reached, text box stops reducing, , right photo box starts sliding underneath left box until disappears. possible? any appreciated! you can achieve z-index overlapping positioning, cannot floating. you'll have this: http://jsfiddle.net/jphb2/ code , inline explanation: .leftbox { position: relative; /* stay sort of in document flow */ z-index: 2; /* positioned @ level 2 */ min-width: 200px; /* minimum width @ stop getting smaller */ margin-right: 200px; /* catering right column */ background-color: rgba(155, 155, 255, 0.8); /* transparent can see right box go 'underneath' */ } .rightbox { position: absolute; /* remove document flow */

tomcat - sed command is not working in userdata of ubuntu ec2 -

i want replace line in apache-tomcat-7.0.50/conf/server.xml via template in ubuntu ec2 instance.i used following command not working. #!/bin/sh -v /usr/bin/apt-get update -y /usr/bin/apt-get upgrade -y sed -i 's/proxyname=.*/proxyname=elburl proxyport=\"80\"\/>/' /home/ubuntu/apache-tomcat-7.0.50/conf/server.xml service tomcat restart but able run sed command in command prompt. thanks in advance sed -i 's#proxyname=.*/proxyname=elburl proxyport=\"80\"\#>#' /home/ubuntu/apache-tomcat-7.0.50/conf/server.xml use (here use # ) separator default / because use inside pattern (or escape in pattern)

RabbitMQ 2.7.1 doesn't start with configuration file; Reason: function_clause -

i try use rabbit on ubuntu 12.04. after installation rabbitmq-server works fine. stop , add configuration file. root@rabbit1:~# tail /etc/rabbitmq/rabbitmq-env.conf rabbitmq_config_file=/etc/rabbitmq/myrabbitmq root@rabbit1:~# tail /etc/rabbitmq/myrabbitmq.config [{rabbit, [{cluster_nodes, {['rabbit@rabbit1', 'rabbit@rabbit2'], disc}}]}]. with files rabbitmq-server says on start: root@rabbit1:~# rabbitmq-server activating rabbitmq plugins ... 0 plugins activated: +---+ +---+ | | | | | | | | | | | | | +---+ +-------+ | | | rabbitmq +---+ | | | | | | v2.7.1 +---+ | | | +-------------------+ amqp 0-9-1 / 0-9 / 0-8 copyright (c) 2007-2011 vmware, inc. licensed under mpl. see http://www.rabbitmq.com/ node : rabbit@rabbit1 app descriptor : /usr/lib/rabbitmq/lib/rabbitmq_server-2.7.1/sbin/../ebin/rabbit.app home dir : /var/lib/rabbitmq config file(s) : /etc/rab

javascript - Disabling Diagnostic Tool key shortcut -

how can disable sapui5 diagnostic tool @ in application? it's triggered key combination alt + shift + s stands letter Åš . not run application debug=true , should false default. unfortunatelly haven't found answer question in sapui5 documentation. tried put sap.m.support.off(); line, didn't work me. looking @ code think can disable setting productive configuration property true. the configuration needs appear before bootstrap in header. <script type="text/javascript"> window["sap-ui-config"] = { productive: true }; </script> i've created jsbin example. http://jsbin.com/waqiyimo/1/edit regards, jason

javascript - CSS/js z-index(zIndex) drop down menu -

i have been working on page has started give me trouble hope can me out with. problem explained rather simple, , hope answer same. :) i have css drop down menu @ top of page , right below have js video player. problem drop down menu appearing behind video player , have no idea why. using boostrap dropdown menu , z-index set 1000. can tell me why player ontop? i know there zindex option js hoping fix problem, not afraid admit have no js skills ever. css: .dropdown-menu { position: absolute; top: 100%; left: 0; z-index: 1000; display: none; float: left; min-width: 160px; padding: 5px 0; margin: 2px 0 0; font-size: 14px; list-style: none; background-color: #fff; background-clip: padding-box; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, .15); border-radius: 4px; -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175); box-shadow: 0 6px 12px rgba(0, 0, 0, .175); } js: function changechannel(url, chanid) { var player = doc

r - Filtering permutations to avoid running out of memory -

the context of problem asset allocation. if have n assets, , can allocate them in 5% chunks, permutations exist such sum of allocation equal 100%. for example if had 2 assets there 21 (created using function "fmakeallocationsweb(2)" code @ bottom of post: [,1] [,2] [1,] 0 100 [2,] 5 95 [3,] 10 90 [4,] 15 85 [5,] 20 80 [6,] 25 75 [7,] 30 70 [8,] 35 65 [9,] 40 60 [10,] 45 55 [11,] 50 50 [12,] 55 45 [13,] 60 40 [14,] 65 35 [15,] 70 30 [16,] 75 25 [17,] 80 20 [18,] 85 15 [19,] 90 10 [20,] 95 5 [21,] 100 0 the problem of course come when number of assets increases, modestly. understandable repetition number of permutations n^(n) , i'm not able allocate intermediate step of creating permutations memory. example 20 assets number of permutations 5.84258701838598e+27!! i able filter these on fly (sum==100) not run memory allocation issue. digging code beneath gtools::pe

python - opening and implementing a txt file into a Dictionary -

i having problems following lines of code: dictionary = {} open("text docs/clues.txt", "r") l: l in clues: dictionary[l[0]] = dictionary[l[1]] getting error says: (file location), line #, in function l in clues: nameerror: global name 'clues' not defined you not iterating on file object, meant: dictionary = {} open("text docs/clues.txt", "r") l: line in l: ...

python 2.7 - Add plus button to TabWidget pyqt4 -

the following code gives tab interface can dynamically add tabs import sys, random pyqt4 import qtcore, qtgui class tabcontainer(qtgui.qwidget): def __init__(self): super(tabcontainer, self).__init__() self.next_item_is_table = false self.initui() def initui(self): self.setgeometry( 150, 150, 650, 350) self.tabwidget = qtgui.qtabwidget(self) vbox = qtgui.qvboxlayout() vbox.addwidget(self.tabwidget) self.setlayout(vbox) self.pages = [] self.add_page() self.show() def create_page(self, *contents): page = qtgui.qwidget() vbox = qtgui.qvboxlayout() c in contents: vbox.addwidget(c) page.setlayout(vbox) return page def create_table(self): rows, columns = random.randint(2,5), random.randint(1,5) table = qtgui.qtablewidget( rows, columns ) r in xrange(rows): c in xrange(columns): table.setitem( r, c, qtgui.qtablewidgetitem( str( random.randint(0,10) ) ) ) return table

c - UDP server not responding to client -

working on program meant emulate data layers in networking. i've got messages coming through server correctly, however, client not receiving ack frame server. causing program wait endlessly. in fixing matter appreciated. sender #include <stdio.h> #include <unistd.h> #define maxframe 97 main(int argc, char* argv[]){ char *frame; int len = 0; int c; dlinits("spirit.cba.csuohio.edu", 43525); frame = malloc(maxframe); file *file = fopen(argv[1], "r"); if (file == null) return null; while ((c = fgetc(file)) != eof) { if(len == (maxframe-1)){ dlsend(frame, len, 0); len = 0; memset(frame,0,strlen(frame)); } frame[len++] = (char) c; } dlsend(frame, len, 1); } receiver #include <string.h> #include <unistd.h> char* dlrecv(); main(){ char* test[100]; dlinitr(43525); while(1){ strcpy(test,dlr

google cloud messaging - android - GCM Notification Dynamic Large Icon not working -

i trying load dynamic large icon gcm push notification. returns null. here code. bitmapfactory.decode() returns null. checked code fetch icon image view , works fine in case, not in case. notificationcompat.builder mbuilder = new notificationcompat.builder(this) .setsmallicon(r.drawable.ic_launcher) .setlargeicon(downloadbitmap(url)) .setcontenttitle(context.getstring(r.string.app_name)) .setcontenttext(message); static public bitmap downloadbitmap(string url) { final androidhttpclient client = androidhttpclient.newinstance("android"); final httpget getrequest = new httpget("http://files.softicons.com/download/system-icons/crystal-project-icons-by-everaldo-coelho/png/22x22/apps/skype.png"); bitmap bitmap = null; try { httpresponse response = client.execute(getrequest); final int statuscode = response.ge

Perl data labels of chart in excel -

i'm struggling problem more or less 2 days , i'm frustrated, since problem not big algorithm... want write perl program, saves few values excel sheet , makes xlcolumnstacked100 labeled diagram specific column colors out of it. far, managed make either stacked diagram (win32::ole) or labeled 1 (excel::writer::xlsx). doing wrong?? tried many things, somehow never has be... in advance tips! #!/usr/bin/perl -w use warnings; use win32::ole; use win32::ole qw(in); use win32::ole::const 'microsoft excel'; use win32::ole::const 'microsoft office .* object library'; use diagnostics; use strict; $xlapp = win32::ole->new('excel.application'); $xlapp->{visible} = 1; $xlbook = $xlapp->workbooks->add; $mydata = [["", "a", "b", "c", "d", "e"], ["x", "1", "2", "3", "4", "5"], ["y", "2", "