Posts

Showing posts from July, 2014

c - How do I declare a pointer to a struct within a struct? -

instead of being int, prev pointer vertex. however, can't declare prev vertexpointer because typedef vertexpointer comes afterwards. how should declare prev? #include <stdio.h> #include <stdlib.h> #include <time.h> //function generates random float in [0,1] float rand_float(); //all info vertex typedef struct{ int key; int prev; float loc[4]; } vertex; //using pointer typedef vertex *vertexpointer; you try this typedef struct vertex{ int key; struct vertex *prev; float loc[4]; } vertex;

ios - Rotate CAEmitterCell content based on Animation Direction -

using caemitterlayer , cell show particles have direction sensitive content image (an arrow). want content (arrow image) point in direction cell moving. here code having arrows move outside edge toward center. how rotate image image points in direction of movement: emitterlayer = [caemitterlayer layer]; emitterlayer.emitterposition = self.view.center; emitterlayer.emittersize = self.view.bounds.size; emitterlayer.emittermode = kcaemitterlayeroutline; emitterlayer.emittershape = kcaemitterlayerrectangle; caemittercell* arrow = [caemittercell emittercell]; arrow.birthrate = 10; arrow.velocity = 100; arrow.emissionlatitude = m_pi; arrow.scale = 0.5; arrow.lifetime = 2; arrow.contents = (id) [[uiimage imagenamed:@"arrowoutline.png"] cgimage]; emitterlayer.emittercells = @[arrow]; [self.view.layer addsublayer:emitterlayer]; how content image adjust based on direction of cell movement? ended using 4 different caemitterlayers 1 each dire

Matching object name in nested collection full text search mongodb -

we have got nested object in mongo db collection e.g. profile object has got array of address , contacts data. { "_id" : "f714af57-b4bd-4c1d-b09c-88f71a446262", "_class" : "com.vaap.dataobject.profilemanagement.companytypeprofile", "companycode" : "ibm", "companyshortname" : "ibm", "companytitle" : "ibm", "companyname" : "ibm", "companydescription" : "ibm", "parentcompanyid" : "", "companyownername" : "", "companyphoneno" : "", "companyemail" : "", "companyfaxno" : "", "companywebsite" : "", "companytotalemployees" : "", "companyannualrevenue" : "", "totalpayperiods" : "", "payperiodstartdate" : "", "companycreditlimit" : "",

android - How to print a log from text file(saved in my phone) to cmd prompt -

when scenario gets failed in uiautomator, want print exception/failure logs in cmd prompt logcat log.how achieve this? (below code prints current log) bufferedreader bufferedreader = new bufferedreader( new inputstreamreader(runtime.getruntime().exec("logcat -e").getinputstream())); string data; while((data = bufferedreader.readline()) != null) { system.out.println(data); } } the actual command used logcat *:e this print error logs of device on command prompt. please update code in way. bufferedreader bufferedreader = new bufferedreader( new inputstreamreader(runtime.getruntime().exec("logcat -d *:e") .getinputstream()));

python - How to select a class of div inside of a div with beautiful soup? -

i have bunch of div tags within div tags: <div class="foo"> <div class="bar">i want this</div> <div class="unwanted">not this</div> </div> <div class="bar">don't want either </div> so i'm using python , beautiful soup separate stuff out. need "bar" class when wrapped inside of "foo" class div. here's code from bs4 import beautifulsoup soup = beautifulsoup(open(r'c:\test.htm')) tag = soup.div each_div in soup.findall('div',{'class':'foo'}): print(tag["bar"]).encode("utf-8") alternately, tried: from bs4 import beautifulsoup soup = beautifulsoup(open(r'c:\test.htm')) each_div in soup.findall('div',{'class':'foo'}): print(each_div.findall('div',{'class':'bar'})).encode("utf-8") what doing wrong? happy simple print(each_di

C++ Can't pass reference to a pointer when the function arg type is class interface -

i have interface looks : class igameobject { public: virtual ~igameobject(){} virtual void notify(massage message) = 0; virtual void sendmessages() = 0; }; class winframeobj :public sprite , public basegameobject<winframeobj> { public: winframeobj(); virtual ~winframeobj(){}; static winframeobj* createinternal(); void notify(massage message); }; template<typename t> class basegameobject : public igameobject { public: basegameobject(){}; virtual ~basegameobject(){}; static t* createobj() { return t::createinternal(); } }; // simple catch class typedef std::map<gameobjecttype, igameobject*> componentsmap; class componentmadiator{ .... .... void componentmadiator::register(const gameobjecttype gameobjecttype,igameobject*& gameobj) { componentsmap[gameobjecttype] = gameobj; // std map } ... ... } now in code in main class winfram

c# - Get calendar tasks for several employees using EWS -

i need store appointment data several exchange calendars. right have solution loops through group containing employees using: expandgroupresults mygroupmembers = service.expandgroup("allusers@....onmicrosoft.com"); foreach (emailaddress address in mygroupmembers.members){ service.impersonateduserid = new impersonateduserid(connectingidtype.smtpaddress, address.address); datetime startdate = datetime. datetime enddate = startdate.adddays(7); calendarfolder calendar = calendarfolder.bind(service, wellknownfoldername.calendar, new propertyset()); calendarview cview = new calendarview(startdate, enddate); cview.propertyset = new propertyset(appointmentschema.subject, appointmentschema.start, appointmentschema.end); finditemsresults<appointment> appointments = calendar.findappointments(cview); foreach (appointment in appointments) { file.write(address.address + ";");

error running hadoop mapreduce to run jar files -

i have tried run zip files download link https://github.com/verma7/geneticalgorithmsusingmapreduce cant run in apache hadoop. file should run zip perform mapreduce task? can please tell me how work hadoop using zip files following link https://github.com/verma7/geneticalgorithmsusingmapreduce i'm facing several problems while doing please me out. want know step step procedure. have read readme file in link? has step step instructions on how run mr job. requirement: hadoop 0.19 or higher (and it's dependencies) ################################################################################### may need modify variable "rootdir" in mapreduce.java , cga.java point home directory or directory on hdfs have read , write permissions on. compile class files , jar files, run $ ant compile jar create build , bin directory class files, compiling against hadoop 0.19 jar located in lib directory. also, create ga.jar mapreduces simple genetic alg

java - In convertible cast, casting from T to double -

i want create generic method getting maximal value array. got stuck @ problem of conversion between t type math.max method uses. here code: first cannot initialize maxvalue like: t maxvaue = 0; secondly cannot use data[i] in math.max, in both cases got error of in convertible cast. class matrix<t>{ public t getmaxvalue(t[] data){ t maxvalue; (int i=0; i<data.length; i++){ maxvalue = math.max(data[i], maxvalue); } return maxvalue; } } math.max takes int, float, double , long. can not use t . what can write own max() method using t. example, method take comparator object in param. or t objects can implement comparable interface. have @ post : how implement generic `max(comparable a, comparable b)` function in java?

node.js - Building contextify fails with error: field ‘time’ has incomplete type -

background: i'm using jquery test javascript code (which using jquery objects) nodeunit . jquery need jsdom provide window object. building jsdom fails because requires contextify , not build on 64-bit debian. tested on linux mint, both standard ubuntu , debian edition, same result. problem: node.js in both cases 0.11.11-release, , built git repository. when building, time , it_interval , , many more incomplete. why? the full build log here: http://pastebin.com/itq75435 starts with: npm http https://registry.npmjs.org/contextify npm http 304 https://registry.npmjs.org/contextify npm http https://registry.npmjs.org/bindings npm http 304 https://registry.npmjs.org/bindings > contextify@0.1.6 install /tmp/node_modules/contextify > node-gyp rebuild make: entering directory `/tmp/node_modules/contextify/build' cxx(target) release/obj.target/contextify/src/contextify.o in file included /home/sie/.node-gyp/0.11.11/src/node.h:61:0, ../src/cont

Memory usage in creating python dict from xml using pattern -

i have largeish xml (40 mb) , use following function parse dict def get_title_year(xml,low,high): """ given xml document extract title , year of each article. inputs: xml (xml string); low, high (integers) defining beginning , ending year of record follow """ dom = web.element(xml) result = {'title':[],'publication year':[]} count = 0 article in dom.by_tag('article'): year = int(re.split('"',article.by_tag('cpyrt')[0].content)[1]) if low < year < high: result['title'].append(article.by_tag('title')[0].content) result['publication year'].append(int(re.split('"',article.by_tag('cpyrt')[0].content)[1])) return result ty_dict = get_title_year(pr_file,1912,1970) ty_df = pd.dataframe(ty_dict) print ty_df.head()

yii - php - ./yiic rresque start does nothing -

i installed extension http://www.yiiframework.com/extension/yii-resque/ user@host:/path/to/protected$ ./yiic rresque start yii command runner (based on yii v1.1.13) usage: ./yiic <command-name> [parameters...] following commands available: - message - migrate - shell - webapp see individual command help, use following: ./yiic <command-name> what's might wrong? edit i figured out problem: didn't put rresquecommand.php ./protected/commands folder. put rresquecommand.php inside protected/commands according yii docs : console commands stored class files under directory specified cconsoleapplication::commandpath . by default, refers directory protected/commands .

node.js - Issue on LEMP configuration and how can i redirect to NodeJS request to NGINX -

i configured lemp server on ubuntu nodejs i'm getting following error on browser. "the page looking temporarily unavailable . please try again later." how can redirect nodejs request nginx .can please me how can sort out these issues. if nginx work through php-fpm (fastcgi process manager) can uncomment important part php location ~ \.php$ {} stanza in default vhost defined in file vi /etc/nginx/sites-available/default like [...] location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; } [...] and nodejs can modify same vhost file vi /etc/nginx/sites-available/default and add lines below location ~ \.php$ {} stanza like [...] location /testapp/ { proxy_pass http://localhost:3000/; proxy_set_header host $host; proxy_set_header x-real-ip $rem

sql server - Retrieving Data from Stored Procedure in MVC -

i have following 2 model classes public partial class items { public items() { this.items_ratings = new hashset<items_ratings>(); } public int itemid { get; set; } public string itemname { get; set; } public virtual icollection<items_ratings> items_ratings { get; set; } } public partial class items_ratings { public int itemsid { get; set; } public byte itemsrating { get; set; } public string comments { get; set; } public virtual items items { get; set; } } i've created stored procedure review average rating create procedure dbo.get_item_averagerating @itemid int begin select avg(overallrating) overallrating items_ratings itemid = @itemid group itemid end go in model class, have added public virtual icollection<get_item_averagerating_result> get_item_averagerating { get; set; } in controller calls, tried adding return view(db.items.include(c => c.get_item_averagerating).tolist()); however, i&

how to redirect from Normal java class to other java class which extends activity in android? -

how redirect normal java class other java class extends activity in android putting data. to start activity class intent = new intent(this, activitytwo.class);//this current class startactivity(i); to pass value in class 1 intent = new intent(this, activitytwo.class); i.putextra("value1", "this value 1 activitytwo "); i.putextra("value2", "this value 2 activitytwo"); to values .from activitytwo.class bundle extras = getintent().getextras(); if (extras == null) { return; } // data via key string value1 = extras.getstring(intent.extra_text); if (value1 != null) { // data }

java - How to show ColumnKey on bar in JFreeChart? -

Image
i have stacked bar chart in image above. need show column keys ("series 1","series 2","series 3") on bars instead of values. how can that? you can this: renderer.setbaseitemlabelgenerator( new standardcategoryitemlabelgenerator("{0}", numberformat.getinstance())); the label generator works off template replaces instances of '{0}' series name, '{1}' category key, , '{2}' data value. number formatter passed constructor used formatting data values (but in case, data value not displayed formatter not used).

ruby on rails - Trigger the reloading of a page after a background job -

i have rails 4 application, doing background calculus. user press button , launches background job long calculus (using delay_job) , arrive on waiting page. despite fact calculus done asynchronously, find way warn user , automatically reload page once calculus finish. i have looked @ several solutions : faye or private_pub => can't afford use server specific job actioncontroller::live => not sure how trigger action once job finished polling => best solution moment, expect find less greedy polling if have smart solution problem, or advise limitation in listed ideas. i'll explain how works you http when send request rails, browser doesn't have way "listen" happens other direct response. http request "sent" & doesn't have mechanism wait until asynchronous process complete your job give app "listener" front-end can receive updates generated (out of scope of http), hence websocket or sse stuff we

css3 - CSS div float. push last div up -

Image
i have 5 <div> elements , float left. how can push last div? (i cant use 2 more wrappers because re-sized jquery, 5 of them must in same wrapper) i don't know if explain problem in right way if have question, please ask. html : <div id="modelisadrzajair"> <div class="kocka220x140">1</div> <div class="kocka220x140">2</div> <div class="kocka220x300">3</div> <div class="kocka220x300">4</div> <div class="kocka460x140">5</div> </div> css : #modelisadrzajair { width: 960px; margin: -60px 0px 0px -10px; min-height: 500px; background-color: #00ffff; position: absolute; z-index: 1000; } .kocka220x140 { border-radius:5px; width: 220px; margin: 10px; height: 140px; float: left; background-color: #ffff00; } .kocka220x300 { border-radius: 5px; width: 220px; m

c# - How to access a dynamically created element -

i using watin test website. contains created dynamically on clicking tablecell. how can access dynamically created . issue deleted after short span of time (even before control can move next line) if(tablecell.exists) { tablecell.clicknowait(); //this creates dynamic <div> if(div.exists) //the control not go inside { //code edit div contents. } } i hope helps. browser.waituntil

pdf - navigating to a specific page with the mupdf android library -

how go navigating specific page mupdf library? or there way make library not remember page last on in pdf? uri uri = uri.parse(path); intent intent = new intent(mainactivity.getcontext(), mupdfactivity.class) intent.setaction(intent.action_view); intent.setdata(uri); c.startactivity(intent); //c context this how i'm opening pdfs. you can add page index in bundle intent, load index in mupdfactivity thereafter , call mdocview.setdisplayedviewindex(your_index_from_bundle); should job. something that: uri uri = uri.parse(path); intent intent = new intent(mainactivity.getcontext(), mupdfactivity.class) intent.setaction(intent.action_view); intent.setdata(uri); bundle extras = intent.getextras(); extras.putint("key_page_index", 10); c.startactivity(intent); then edit oncreate in mupdfactivity, add code @ end of oncreate: intent intent = getintent(); if(intent!=null){ bundle extras = intent.getextras(); if(extras!=null){ int index = extra

google maps - Embedding play-services when using android-sdk-plugin+sbt -

i have scala android app, build sbt , android-sdk-plugin. i need include google play-services library, using google maps api v2. contains resources , code. after reading the android-sdk-plugin doc , i've seen this: using google gms play-services aar: librarydependencies += "com.google.android.gms" % "play-services" % "3.1.36" i've done so, when compiling app through sbt, receive error: androidmanifest.xml:34: error: error: no resource found matches given name (at 'value' value '@integer/google_play_services_version') for me, clear symptompt resources of play-services aren't included. must referenced androidmanifest.xml: <application android:name="..."> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/> ... </application> with gradle, haven't had problem, same androidmanifest.xml , depen

Export Signed .Apk From Existing Android Project Via Eclipse -

update - project values eclipse/android problem does have straightforward solution problem encountered whilst importing existing android project eclipse. the intention of using existing android project utilise eclipse adt export wizard produce signed .apk should work on android device version 2.3.3 upward . the existent android project has been tested on device (android version 2.3.3) , functions correctly. tools used: android sdk/eclipse ide bundle (march 2014), plus java jdk (march 2014). all tools function correctly. import existing android project process: open eclipse > file > new > project > android project existing code > next > browse select project root directory > select project > finish). this process worked & existing android project imported & displayed left hand side of eclipse console under project explorer view. i signed project using eclipse adt export wizard before exporting final .apk. summary: all softwar

ruby - migration still runs code when it has been commented out -

i have code has been commented out in migration yet when run migration code still attempts run. gives following error: error pg::error: error: column "rount_id" of relation "rounds" not exist the error above reason why has been commented out. def remove_column :rounds, :rount_id end def down add_column :rounds, :rount_id, :integer end are sure running on development replace migration file following code, def change remove_column :rounds, :rount_id, :integer end and run rake db:migrate rails_env="development" if going comment it, like def change #remove_column :rounds, :rount_id, :integer end

How to reload input value in React / Javascript with Virtual DOM? -

i have problem reload input value. <input type="email" ref="email" id="email" value={this.props.handlingagent.email}/> after use this.props.handlingagent.email = "asd" in debugger value of this.props.handlingagent.email asd, in input still old value. how refresh value without jquery? shouldn't refresh automatically? first, props what's been passed onto you. view them function parameters. child shouldn't go modify them since breaks whatever assumption parent has , makes ui inconsistent. here, since prop's passed onto you, want handler parent can call notify change: var app = react.createclass({ getinitialstate: function() { return {inputvalue: ''}; }, handlechange: function(value) { console.log('value gotten child: ' + value); this.setstate({ inputvalue: value }); }, render: function() { return <field onchange={this.handlechange} inputvalue={th

How to (idiomatically in R) create a data.frame from values with column and row indexes? -

i have data.frame l, each row contains 3 cells: 'x', 'y', 'value'. need create new data.frame values in indexes 'x' , 'y'. naive solution this: out = data.frame() for(i in 1:nrow(l)) { row <- l[i,] out[row[['x']], row[['y']]] <- row['value'] } is there idiomatic way, how in r? how about: tapply(l$value,list(l$x,l$y),mean) another option: out = array(na,dim=c(max(l$x),max(l$y))) out[cbind(l$x,l$y)]=l$value

printing specific hash values perl -

i trying print hash values numbers have corresponding letters, new @ this, don't know how conditional statements run through each value put in on single line of user input. trying make cryptogram. #!/usr/bin/perl print "enter numbers corresponding letters\n"; chomp( $num = <>); while ($num >= 0 && $num <= 27 || $num == 'c'){ %num_to_letter; $num_to_letter{"4"} = "a"; $num_to_letter{"9"} = "b"; $num_to_letter{"17"} = "c"; $num_to_letter{"5"} = "d"; $num_to_letter{"13"} = "e"; $num_to_letter{"7"} = "f"; $num_to_letter{"21"} = "g"; $num_to_letter{"6"} = "h"; $num_to_letter{"23"} = "i"; $num_to_letter{"15"} = "j"; $num_to_letter{"1"} = "k"; $num_to_letter{"20"} = "l"; $num_to_letter{"26"} = &

Mosaic of images HTML/CSS -

Image
i want make image layout portrait images inside div fixed aspect ratio of 3:2 . size of images 327x491px . the main issue unwanted spaces between images. how align images mosaic using html/css ? html : <div id="pictures1" class="_pictures1 grid"> <div class="_pictures1-01"><div style="width:125px;height: 188px; background: red;"><img src="" width="125" height="188" alt="" /></div></div> <div class="_pictures1-02"><div style="width:192px;height: 288px;background: green;"><img src="" width="192" height="288" alt="" /></div></div> ... on ... </div> css : ._pictures1 { width: 935px; height: 490px; margin: -26px 0 0 59px; float: left; top: 20%; left: 20%; position: absolute; border: 1px gray solid; } ._pictures1 div {position: a

ios - Using CAGradientLayer for an angle / circle gradient -

Image
how can use cagradientlayer efficiently draw gradient around circle / angles? i made 1 underneath of project . uses bitmap context drawing cagradientlayer far more efficient. unfortunately figure out how make linear gradients it. gradient layers support linear gradients. however, if @ interface gradient layers, includes type property. right type defined kcagradientlayeraxial (linear). the fact there type property suggests apple adding more types @ future date, , radial gradients seem like addition. you might @ creating own custom subclass of cagradientlayer draws radial gradients linear. i've seen demo projects on net create custom calayer subclasses.

pipe - Bash: Is trap while piping work as expected? -

here minimal code issue demonstration: http://pastebin.com/5txdpsh5 #!/bin/bash set -e set -o pipefail function echotraps() { echo "= on start:" trap -p trap -- 'echo func-exit' exit echo "= after set new:" trap -p # can ensure after script done - file '/tmp/tmp.txt' not created trap -- 'echo sig 1>/tmp/tmp.txt' sigpipe sighup sigint sigquit sigterm } trap -- 'echo main-exit1' exit echo "===== subshell trap" ( echotraps; ) echo "===== pipe trap" echotraps | cat echo "===== done everything" output ===== subshell trap = on start: = after set new: trap -- 'echo func-exit' exit func-exit ===== pipe trap = on start: = after set new: trap -- 'echo func-exit' exit ===== done main-exit1 expected output ===== subshell trap = on start: = after set new: trap -- 'echo func-exit' exit func-exit ===== pipe trap = on start: = after set new: trap -

android - OnBack Press Fragment showing blank Screen -

i using fragments in application.so on home page have grid view of 5 item on selection of again opening new fragment . so happening on press showing blank screen after closing application . please suggest me have done wrong in this. mycode gridview.setonitemclicklistener(new onitemclicklistener() { @override public void onitemclick(adapterview<?> arg0, view v, int arg2, long arg3) { if (dashboard_links[arg2].equals("a")) { fragtran.replace(r.id.content_frame, firstfrag); fragtran.settransition(fragmenttransaction.transit_fragment_open); fragtran.addtobackstack(null); fragtran.commit(); } if (dashboard_links[arg2].equals("b")) { fragtran.replace(r.id.content_frame, secondfrag); fragtran.settransit

javascript - Run function on every route change -

i have app built on angular.js, , want run function whenever route changed , new template rendered in view. found way in controller when activated, this: $scope.$on('$routechangestart', function(next, current){ //...do stuff here... }); but there way run function on each route change, have enter once? if view <div ng-app='myapp'> <ng-view/> </div> change to <div ng-app='myapp' ng-controller='rootcontroller'> <ng-view/> </div> in rootcontroller can add event handler $routechangestart . since rootcontroller created once , remains lifetime of app can safely subscribe event here.

junit - Play scala unit test with JUnitRunner and Specification -

im running test on play framework scala. have scala class tests, go this: @runwith(classof[junitrunner]) class updateproducttest extends specification { abstract class withdbdata extends withapplication { } "product db repository" should { //this test #1 ! "add product minimal fields" in new withdbdata { val name = some(localizeditem(idgenerator.newid, "testname")) val description = some(localizeditem(idgenerator.newid, "testdescription")) val product = new product(option(idgenerator.newid), "defaulttestname", "defaulttestdescription", some(1), none, none, none, none, new references(some("1"), some("1"), some("1"), some("1")), none, none, name,description, none) val productrepository = new productdbrepositoryimpl() productrepository.addproduct("en_us", "1", product)

Overriding the Magento customer controller to have custom form actions -

i've created new template homepage registration , login form. far, actions on both these forms default actions called this: echo mage::helper('customer')->getregisterposturl() registration form and echo mage::helper('customer')->getloginposturl() login form. i trying override customer controller change action of these forms. far have: a. created new module , edited app/code/local/myco/homepage/etc/config.xml file this: <?xml version="1.0"?> <config> <modules> <myco_homepage> <version>0.1.0</version> </myco_homepage> </modules> <frontend> <routers> <args> <modules> <myco_homepage before="mage_customer_accountcontroller">myco_homepage</myco_homepage> </modules> </args> </routers> </frontend> </config> b. created controller in file app/code/local/m

javascript - Horizontal slides with vertically scrollable content inside -

basically want slide between divs (slides) vertically scrollable content in jquery mobil app. currently have done using combination of owl carousel , iscroll5 . unfortunately owl carousel doesn't support infinite scrolling - won't slide first slide last. hence again i'm trying achieve using combinations of various carousel plugins excolo carousel iscroll, swiper iscroll etc creating horizontal carousel in each slide have vertically scrollable content. but i'm having trouble making these plugins work together. excolo , iscroll5 works fine except when number of slides 3. swiper , iscroll having issues since iscroll not applied duplicate elements created dynamically swiper. recently found swiper has scrollbar plugin, scrolls horizontally horizontal slider , verivally vertical slider, need opposite behavior. i'm trying achieve nesting vertical slider inside horizontal slider idangerous swiper.. has else done this? forget plugins, way achieve this?

regex - PHP preg_match "AND" operator -

i use "or" operator "|" match onle of words of $name variable $name = "one 5 6 two"; if (preg_match('/(one|two)/i', $name)) {return true;} what operator should use preg_match have "and" condition if words inside of $name? i.e. if (preg_match('/(two "and" five)/i', $name)) {return true;} if still want use regex, you'll need positive lookaheads: if (preg_match('/^(?=.*one)(?=.*two)/i', $name)) {return true;} it's not recommended simple stuff (kind of overkill), , gets messy more complex stuff...

How to see oplog in standalone MongoDB -

i want see oplog have started mongodb suggested in here mongod --master --port 8888 --dbpath ... but when run >db.oplog.rs.find() it returns nothing when run >db.oplog.rs.stats() returns error { "ok" : 0, "errmsg" : "ns not found" } i have tried these commands '>use local'. see same results.i planning read using java oplog watcher api. not able it. missing.how see oplog. ok isn't replica set when use --master deprecated master-slave replication got me thinking maybe different name: > show collections oplog.$main startup_log > db.oplog.$main.find() { "ts" : timestamp(1394104629, 1), "op" : "n", "ns" : "", "o" : { } } { "ts" : timestamp(1394104643, 1), "op" : "n", "ns" : "", "o" : { } } { "ts" : timestamp(1394104653, 1), "op" : "n", "ns" :

matlab - How can i plot Fourier transform of a wav without using FFT -

how can plot fourier transformation of wav sound without using fft ? take rectangle windows size 256 on whole signal. following code: my code: [wave,fs]=wavread('.\sound clip 32.wav'); sound(wave,fs); t=1:1/fs:length(wave)-1/fs; plot(t,wave); n=length(wave)-1; l=1:n, x(l)=0; end i=1:n, h=1:256, x(i)=x(i)+wave(h)*(exp(-(j*2*pi*i*h)/n)); end end f=1:fs/n:n; wavefft=abs(x); plot(f,wavefft); but error error: ??? error using ==> plot vectors must same lengths. error in ==> alirezabahrami @ 8 plot(t,wave); how can resolve problem? the first plot error caused t , wave being different lengths. truncate longest of 2 , plot, in case, t linearly increasing vector, can write plot (wave) and display same thing, ie., audio wave. if write plot(t) diagonal line. further down have exact same problem, write: plot(wavefft)

c++ - Why structure size is incorrect -

this question has answer here: why isn't sizeof struct equal sum of sizeof of each member? 11 answers i tried check how memory allocated structure objects, taking more space expected. using 64 bit windows os , microsoft visual studio 2010(i think 32 bit), can explain why printing 52 bytes ? struct test { int year;// should take 4 byte string title;// how bytes take ? in case taking 31 bytes ? double date;//should take 8 byte int month;// should take 4 byte } mine; int main () { cout << " size is: "<<sizeof(mine);//printing 52 ? cout << " size is: "<<sizeof(struct test);//printing 52 ? return 0; } note that sizeof(struct) >= sizeof(its members) because each member might aligned lowest address after previous member satisfies: mod(address/sizeof(member)) == 0 for example, consider struc

html - Keep values fom labels by jquery after page refresh -

hello got code <div class="values"><span>labels :</span><span class="selected"></span> </div> <div id='main'> <div class="data"> <div class="values"> <div> <p> <label data-name="1">a</label> <input type="checkbox" value="1" /> </p> </div> <div> <p> <label data-name="2">b</label> <input type="checkbox" value="2" /> </p> </div> <div> <p> <label data-name="3">c</label> <input type="checkbox" value="3" />

How will xml modularisation in scala 2.11 play with xml literals? -

reading release notes scala 2.11.0-rc1, noticed splitting-off of scala xml separate jar starting 2.11 series. affect use of xml literals, in 2.11 or down line? clearly, if use xml literals need scala xml jar -- i'm wondering if there plans deprecate xml literals well. as aside, sense scala's support xml felt mistake. language user, i've been happy support literals , interpolation. i've found metadata , unprefixedattribute awkward manipulating attributes, not terrible. main issues scala xml? there a thread in adriaan moors replied @virtualeyes xml literal syntax is, , has been while now, "effectively" deprecated. there a gsoc project start macrotized interpolator xml first step spinning off , divesting xml support. interpolator expected support pluggable libraries. an xml interpolator envisioned in interpolation sip, quasiquoting, has been in works.

actionscript 3 - How to animate a spritesheet without an atlas? -

i have sprite sheet 30 frames of different animations not in order. i use starling make animations not have / don't have time make atlas xml. if did, rather not use atlas. furthermore, sprite sheet has black background , examples researched have transparent background. any appreciated. thanks. here example on how retrieve textures atlas giving frames want , frames width , height: package { import starling.textures.texture; import flash.geom.rectangle; public class animfromatlas { public function animfromatlas( ) { } public static function texturesfromatlas( atlas:texture, frames:array, framewidth:int, frameheight:int ):vector.<texture> { // declare x , y properties var x:int, y:int = 0; // create base rectangle flrame width , frame height, have update x , y values. var region:rectangle = new rectangle( 0, 0, framewidth, frameheight ); //

php - How can I get form_ID field from table before inserting the options? -

i have 3 tables on database, form ·form_id ·active form_options ·form_id ·option form_results ·form_id ·option_selected ·ip when Ι create poll Ι need associate options created new form, Ι don't want insert first form_id field on form table, after selecting last form_id on form , inserting id on form_id on form_options table. when sending form, want new form_id on form_options same form_id on form in 1 step. that say, should know newly created form_id on form insert same in form_id on form_options table. i know possible in php, don't remember how.

javascript - Phonegap WebSQL DELETE row not work on iPad -

i have 2 functions: function removepreorder(id) { db.transaction(function(tx) { tx.executesql("delete preorder id= ?", [id], removerow(id)); console.log ('ok'); }); } function removerow(id) { $( "#"+id+"" ).remove(); } function removepreorder() binded on click event on href . function renderresults(tx, results) { var len = results.rows.length; var preorder = []; (var i=0; i<len; i++){ preorder.push( "<tr id ='"+results.rows.item(i).id+"'><td>"+results.rows.item(i).name+"</td><td>"+results.rows.item(i).tel+"</td><td>"+results.rows.item(i).email+"</td><td>"+results.rows.item(i).size+"</td><td><a href='#'onclick='removepreorder("+results.rows.item(i).id+")' class='button [tiny small success aler

php - group elements inside a json -

i'm trying make json looks this: { "data": { "error_message": "", "data": { "person": [ [ { "name": "teset1", "image": "http://test.co.il/test/icons/billadress.png" }, { "name": "test2", "image": "http://test.co.il/test/icons/email.png" }, { "name": "test3", "image": "http://test.co.il/test/icons/homeicon.png" } ], [ { "name": "a", "image": "http://test.co.il/shay/keykit

JAVA save several DATE into a LIST using a custom Datatype -

i want save several periods of time, that: public class periodoftime { date from; date to; } into list, looks that list <periodoftime> periodsoftime = new list<periodoftime>() right now. how can store !for example! date s = new date(); in list? my thoughts were, can done periodsoftime.add(s,s) but keeps on telling me the method add(int, periodoftime) in type list not applicable arguments (date, date) can guide me? probably totally blind right now.... you may want make getters , setters:) try: periodoftime period = new period(); period.from = date; period.to = another_date; and add example arraylist : periodsoftime.add(period); it help.

forms - PHP - Checkbox issues when trying to get their values -

so made simple example try , explain me problem can't understand. the scenario this, have 5 checkboxes in 1 form , button in form. know have created button in same form checkboxes, sake of example, let's absolutely have in different forms. here code: <?php if(isset($_post['submit2'])){ if(isset($_post['selecao'])){ print_r($_post['selecao']); } } $names = array("joão", "ana", "alex", "carla", "carolina"); ?> <form action="" method="post"> <?php $limite = 5; for($i=0 ; $i<$limite ; $i++){ ?><input type="checkbox" name="selecao[]" value="<?php echo $names[$i]?>"/> <?php } ?> </form> <form action="" method="post"> <input type="submit"

Lost my java packages and project from eclipse package explorer -

i have been working on android app development on eclipse , find package explorer has got blank, not able locate previous packages , project eclipse package explorer can still locate on work-space folder. please, me restore projects , packages. probably have deleted project (by default leaves source files on workspace). try right-clicking, import java project, locate project in workspace. should solve issue.

linux - Mail sent via the "mail" command to an alias not working -

i have cron job running script processing , sends out mail @ end. email sent alias xyz@companydomain.com contains 4 people. 2 email addresses belong different company domain (say "outsidedomain.com"). problem facing email received folks having addresses "companydomain.com" , not email addresses "outsidedomain.com". can me issue ? need check exchange server settings ?

android - FragmentActivity custom Fragment transition -

i trying make kind of transition on fragments, , using default application skeleton in eclipse creating fragmentactivity. noticed other posts specifying custom transition animation xml, being done on transaction, , none using fragmentactivity. (which btw easier.) i know how make custom transitions in fragmentactivity. in advance! edit: somthing this fragmentactivity. musicplayeractivity.java public class musicplayeractivity extends fragmentactivity { sectionspageradapter msectionspageradapter; viewpager mviewpager; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // init pager , set adapter msectionspageradapter = new sectionspageradapter( getsupportfragmentmanager()); mviewpager = (viewpager) findviewbyid(r.id.pager); mviewpager.setadapter(msectionspageradapter); //other init code ... } public class sectionspageradapter extends fragmentpageradapter { public sectionspag

javascript - jQuery mega menu showing some blocks on slow connection. how to fix it? -

i using mega menu on this. [due security , backlinks delete link - in case if 1 needs link pm me] i using mega menu navigation. only following script using this. and placed mega menu jquery script before </body> tag <script type="text/javascript"> $(function(){ $('#mega-menu-3').dcmegamenu({ rowitems: '2', speed: 'fast', effect: 'fade' }); }); </script> but block displayed @ navigation area till page or js files load guess. i see odd blocks on slow connections. how can fix guys? css: #mega-menu-3 { display: none; } js: $(window).load(function(){ $('#mega-menu-3').show(); }); if doesn't work, try (and ignore css suggested above): $(document).ready(function(){ $('#mega-menu-3').hide(); }); $(window).load(function(){ $('#mega-menu-3').show(); }); now show when page loaded. hope helps. :)

android - Managing Fragments inside tabs -

i'm creating simple activity, contains 2 tabs. i'm following documentation , i'm using fragment . in activity there 2 tabs. first 1 map ( mapfragment ), while second simple list ( listfragment ) all works good, problem can't manage correctly map. in ontabselected callback have use following code: public void ontabselected(tab tab, fragmenttransaction ft) { if (mfragment == null) { mfragment = fragment.instantiate(mactivity, mclass.getname(), margs); ft.add(android.r.id.content, mfragment, mtag); } else { ft.attach(mfragment); if(mtag.comparetoignorecase("map")==0) setupmapifneeded((mapfragment)mfragment); } } where map tag of first activity , mthod setupmapifneeded is: private static void setupmapifneeded(mapfragment mmapfragment) { // null check confirm have not instantiated map. if (mmap == null) { mmap = mmapfragment.getmap(); // check if successful in obtaini

jasmine - How to see what Protractor tests is currently executing? -

in protractor test script, use usual notation: describe("mytest") { ... it(" should this") { ... it(" should that") { i able see test , part of each running when run them. there option can use output test descriptions console? you can use --verbose option print more information tests, not tell test being run. i suggest create issue if want feature. https://github.com/angular/protractor/issues/new $ ./node_modules/protractor/bin/protractor protractor-config.js --verbose ------------------------------------ pid: 7985 (capability: chrome #1) ------------------------------------ using selenium server @ http://localhost:4444/wd/hub angularjs homepage should greet named user todo list should list todos should add todo finished in 5.915 seconds 3 tests, 5 assertions, 0 failures