Posts

Showing posts from June, 2013

c++ - How i can extract information from DICOM file ? -

i want write script extract header information of dicom file using c or c ++, don't want use external libraries dicomsdl... when open file bloc-notes see special characters , character string patient name .. if can me read file. yes, open file in binary though might contain sequences of characters. out deep it, consider writing following record of out file (i'm showing record c-struct): struct rec_tag { int id; char name[50]; }; now, suppose use structure create file, shown in following code: file1.c: /* compile as: gcc -ansi -pedantic -wall file.c -o file_test */ #include <stdio.h> #include <stdlib.h> #include <string.h> struct rec_tag { int id; char name[50]; }; int main(int argc, char** argv) { file* fp = null; struct rec_tag rec1; struct rec_tag rec2; rec1.id = 20; strcpy(rec1.name, "thurizas"); rec2.id = 345689; strcpy(rec2.name, &quo

javascript - Set element width to image inside it -

Image
i have page displays image, along metadata it. image , metadata should centered in page. i'd div containing metadata wide image. sorta so: unfortunately, it's not possible me reliably determine image's width before serving page. right i'm using listener on load: $('.image-container img').one('load', function() { $('.image-container, .image-container *').css('max-width', $(this).width()); }); this works, if image large , takes while load, page looks crappy until finishes. i'm looking either: a way use css express container should wide image inside it. an event fires browser gets enough information know image's width (which pretty on, can see). thanks! this quite easy without jquery. set container display:inline-block this: div {display:inline-block; margin:0; padding:0;} example in fiddle (image size 600px x400px)

stata - Logit model (backed up) Warning -

i trying run logit identifying probability of being tribal versus non-tribal on subsample of adult women only. have 5 rounds of data , independent variable includes years of education, age, marital status, rural residence, children under 5, household size, age of household head , monthly per capita income. have included set of zone dummies zone1-zone6 divides country 6 unique zone-with each zone consisting of group of states. this command use foreach r in 1 2 3 4 5 { logit scst age yrs_ed rural marital n_mpce ch_under5 fhead headage heademp hhsize i.zone [aw=hhwt] /* */ if (keep_agerc==1) & (sex==2) & (round==`r'), iterate (100) predict phatscst`r' if e(sample), pr sum scst [aw=hhwt] if (keep_agerc==1) & (sex==2) & (round==`r') gen pbarscst`r'=r(mean) gen scstwt`r'= (phatscst`r'/(1-phatscst`r')) * ((1-pbarscst`r')/ pbarscst`r') * (hhwt) if scst==0 & round==`r' } the issue run rounds 1,2 , 3 logit converges

java - Netbeans background scanning project stuck -

i'm using netbeans 7.4 java ee project school. when open netbeans, background scanning of project takes ages. if check ide log, see alot of info netbeans not beeing able read symbolic links files in library. these links files in frameworks folder. before, netbeans scanned folder named tex in de library, deleted that, since didn't need anymore, deleting frameworks folder don't trust much. since netbeans keeps scanning, can't run project. can me?

linux - Why is a deluge startup script necessary? -

i'm working on making spare raspberry pi headless bittorrent box, using deluge. most guides on setting deluge on linux include custom startup script run @ boot. however, when you're ssh'd pi, can start deluged daemon typing in "deluged". however, when wrote basic bash script ran command, put in /etc/init.d/ , added using update-rc.d, didn't work. nano /etc/init.d/startdeluged.sh chmod 755 /etc/init.d/startdeluged.sh update-rc.d startdeluged.sh defaults the bash script contained this: #!/bin/sh deluged exit i'm new setting startup scripts on linux, , i'm wondering why special script necessary when running command in terminal has same effect. have user entering command? you must add begin init infos after #!/bin/sh . looks : ### begin init info # provides: scriptname # required-start: $remote_fs $syslog # required-stop: $remote_fs $syslog # default-start: 2 3 4 5 # default-stop: 0 1 6 # short-descript

dataframe - trouble combining two numeric columns into one R -

so having bit of bother combining 2 columns one. have 2 columns of ages, split child , adolescent columns. example: child adolescent 1 na 12 2 na 15 3 na 12 4 na 12 5 na 13 6 na 13 7 na 13 8 na 14 9 14 15 10 na 12 11 12 13 12 na 12 13 na 13 14 na 14 15 na 14 16 12 13 17 na 14 18 na 13 19 na 13 20 na 14 21 na 12 22 na 13 23 12 15 24 na 13 25 na 15 26 na 12 27 na 15 28 na 15 29 na 13 30 na 12 31 13 15` now combine them 1 column called "age" , remove na values. when try following code, encounter problem: age<- c(na.omit(data$child),na.omit(data$adolescent)) the problem being original data has 514 rows, yet when combine 2 columns, removing nas, somehow end 543 values, not 514 , don't know why. so, if possible, explain firstly why getting more values planned, , secondly might better way combine 2 columns. edit: looking this age 1 12 2 15 3 12 4 12 5 13 6 13 7 13 8 14

How SpringServletContainerInitializer is bootstrapped during Spring initialization? -

i'm using webapplicationinitializer-approach initialization of spring's webapplicationcontext. official documentation webapplicationinitializer: implementations of spi detected automatically springservletcontainerinitializer, bootstrapped automatically servlet 3.0 container the question how springservletcontainerinitializer 'bootstrapped automatically'? as per doc springservletcontainerinitializer implements servletcontainerinitializer . implementations of servletcontainerinitializer notified servlet 3.0-compliant container during container startup. that's contract of servlet3.0 complaint container. doc servletcontainerinitializer can seen here doc how bootstrapped here

POST of Spring edit form on Tomcat 8 fails with 405 while on tomcat 7 works -

setting invalid value in edit form (bigger value long limit) causes 405 on submit (post) on tomcat 8. same submit on tomcat 7 works expected , shows field binding error: failed convert property value of type java.lang.string required type java.lang.long property userid; nested exception java.lang.numberformatexception: input string: "56345345345345345345345345" any idea? the max value long 9223372036854775807. number bigger it. try bigdecimal parameter or string , parse bigdecimal .

node.js - It is interesting to create a new node app to handle socket.io? -

Image
i want add on existing project sockets nodejs , socket.io. have 2 servers : an api restful web service, storage , manage datas. a public web service return html, assets (js, css, images, ...) on first try, create socket server on public one. think better if create other 1 handle socket query. what think ? it's idea or useless add more problem solve (maybe duplicate intern lib, ..) also, i'm using token communicate between public , api, have create communication between socket , api ? or can use same 1 ? ------[edit]------ as nobody didn't understand me have create schema infrastructure thinking about. it way proceed ? the public server , socket server have same ? or can separate ? do must create socket connection between api , socket server each client connected ? thank ! thanks explaining better. first of all, while seems reasonable, way of using socket.io not common one. biggest advantage of using socket.io keeps channel open 2-way

java - How to print <String, Array[]> as a flat pair? -

setup: i have data customers , favorite top 10 tv shows. far, able data in javardd<tuple2<string, shows[]>> . able print , check if expected, is. objective: now, need print data file, in following format: customer_1 fav_tv_show_1 customer_1 fav_tv_show_2 customer_1 fav_tv_show_3 customer_1 fav_tv_show_4 customer_2 fav_tv_show_1 customer_2 fav_tv_show_2 customer_2 fav_tv_show_3 customer_2 fav_tv_show_4 customer_3 fav_tv_show_1 customer_3 fav_tv_show_2 customer_3 fav_tv_show_3 customer_3 fav_tv_show_4 problem: i don't know how that. far, have tried this: // need flat pair javapairrdd<string, shows> resultpairs = result.maptopair( new pairfunction<tuple2<string,shows[]>, string, shows>() { public tuple2<string, shows> call(tuple2<string, shows[]> t) { // won't work have return multiple <customer - show> pairs } }); } any appreciated. well, i

knockout.js - KnockoutJS Appending To the Beginning of observableArray -

i have viewmodel retrieve data server , new data concatenated data have. problem is, new data goes after old data , want other way around fresh data shows @ top of view . this have: self.serverdata(self.serverdata().concat(newdata)); and view displayed as: old data old data old data new data prepend observable arrays using unshift function. modify underlying array , tell observable updated. var x = ko.observablearray([1,2,3]); x.unshift(0); // x() returns [0,1,2,3]

excel - Cell mask format -

i'm trying develop mask cells requirement needs text or numerals. i have clean button reset respective cells. that's problem. mask checking macro working if when use clean button , empty, same checking macro blank isn't accepted. following code: private sub worksheet_change(byval target range) on error goto whoa application.enableevents = false if not intersect(target, range("c5")) nothing if not isnumeric(range("c5").value) msgbox "valor inválido." application.undo goto letscontinue end if range("c5").value = "" & format(range("c5").value, "") end if if not intersect(target, range("c7")) nothing 'apaga se nao o numero if not isnumeric(range("c7").value) msgbox "valor inválido." application.undo goto letscontinue

How to initiate request from java web application to android client -

i need in task plz: need implement request server java web application, android clients, means first of all, android client login application, after need server initiate request anytime , send clients, example ask him help, , waiting replies. you might want check out google cloud messaging service.

ember.js - Click not working in Ember-CLI integration test with PhantomJS -

i'm trying click button in ember-cli integration test, , works chrome, tells me click undefined in phantomjs. i've seen other posts recommend defining own click event phantomjs, couldn't work. $("a:contains('next'):visible")[0].click(); that works in chrome, not phantomjs. built in click helper, in ember-cli, appears not work "a:contains('next'):visible". can help? update: i talked guys on ember-cli irc , got selectors work ember click helper in tests, clicks appear nothing. ideas? test("tour next, back, , cancel builtinbuttons work", function(assert) { assert.expect(6); visit('/').then(function() { assert.equal(find('.shepherd-active', 'html').length, 1, "body gets class of shepherd-active, when shepherd becomes active"); assert.equal(find('.shepherd-enabled', 'body').length, 2, "attachto element , tour shepherd-enabled class"); assert.equal(find(

css - Move single element to the end of a flex container -

i thought i'd able shift single button end of flex-box. i have set parent display: flex; , thought i'd able target 1 element , pin bottom of container align-self: flex-end; it doesn't work. here pen: my codepen illustrating issue <div class="row services"> <div class="small-3 panel columns service"> <i class="fa fa-thumbs-o-up"></i> <h3>suspendisse</h3><p>lorem ipsum dolor sit amet, consectetur adipisicing elit. a, ad?</p> <div class="button">read more</div> </div> <div class="small-3 panel columns service"> <i class="fa fa-key"></i> <h3>maecenas</h3><p>porro quibusdam nostrum eaque, quasi laudantium delectus quaerat cumque, quos.</p> <div class="button">read more</div> </div> <div class="small-3 panel columns service">

dojox.grid.datagrid - How to return values of an editable column in a Dojo DataGrid on an XPage? -

Image
i have editable priority column in dojo datagrid. prior saving user's changes want verify handful of entries in grid, user has not set value priority field same value. is, in case set priority column [1,2,3,3,5] 5 rows in grid want raise alert reminding them priority column needs unique values. the following code xe:viewitemfileservice grid: <xe:restservice id="restservice1" jsid="restserviceobj" pathinfo="pathinfo"> <xe:this.service> <xe:viewitemfileservice defaultcolumns="true" contenttype="application/json" viewname="docsbyusername" var="rsentry" sortcolumn="priority" keys="#{sessionscope.username}"> </xe:viewitemfileservice> </xe:this.service> </xe:restservice> the following markup dojo datagrid editable priority column: <xe:djxdatag

javascript - Access random object on parsing JSON via combined variable -

this question has answer here: dynamically access object property using variable 10 answers i'm having simple json file looks like: { "seasons" : { "s_1" : { "episodes" : 7 }, "s_2" : { "episodes" : 21 }, "s_3" : { "episodes" : 22 }, "s_4" : { "episodes" : 30 }, "s_5" : { "episodes" : 18 }, "s_6" : { "episodes" : 12 } } } and want randomly select s_ x value seasons when parsing file: var random = math.floor(math.random() * 6) + 1; $.getjson('js/data.json', function(data) { console.log(data.seasons.s_+random); }); this not work. how correct way? thanks does work? console.log(data.seasons

javascript - Uglify with anonymous function -

i have .js , i'm compacting it: 'use strict'; !(function () { var object = typeof exports != 'undefined' ? exports : this; }()); when use google closure compiler don't erros , 'this' referencing window object. when use uglify ( mangle true or false ) gets undefined on 'this' ( object undefined , receive error ). knows why? basically can change window , work concern other codes, libs or else i'm uglyfing in future. note: i'm using grunt-contrib-uglify plugin options: mangle: true, preservercomments: false, sourcemap: true it expected behaviour: with 'use strict'; function's context undefined , not global object.

c - How does ASCII value work internally? -

please use code reference telling how giving ascii output int main() { char c; printf("enter character: "); scanf("%c",&c); /* takes character user */ printf("ascii value of %c = %d",c,c); return 0; } the line printf("ascii value of %c = %d",c,c); will show value of c in 2 ways. firstly character, secondly number. whether or not ascii value, depends on c is, because ascii standard not encompass all of 256 values representable char or unsigned char . depends on system settings such code page, language, etc. moreover, not of ascii characters printable - terminal or console outputs use printable representation of number rather using control - although 7 might ring bell!

form for - Rails 4, show attributes -

if want submit fields of nested resources instead of parent. how can this? i've got 2 models: product , product_details. =form_for @product |f| =f.fields_for product_details |ff| =ff.radio_button :price, ff.price =f.submit so need submit form above product_details_controller instead of products_controller. if form_form product_details got "to_key" undefined.. what best way this? accepts_nested_attributes_for can you. for example:- class project < activerecord::base has_many :tasks accept_nested_attributes_for :tasks, :allow_destroy => true end in view <% form_for @project |project_form| %> <% project_form.fields_for :tasks |task_form| %> <p> <div> <%= task_form.label :name, 'task:' %> <%= task_form.text_field :name %> </div> </p> <%end%> <%= project_form.submit %> <% end %> so @project.save save c

c - Can someone please explain how stdio buffering works? -

i don't understand buffer doing , how it's used. (also, if can explain buffer does) in particular, why need fflush in example? int main(int argc, char **argv) { int pid, status; int newfd; /* new file descriptor */ if (argc != 2) { fprintf(stderr, "usage: %s output_file\n", argv[0]); exit(1); } if ((newfd = open(argv[1], o_creat|o_trunc|o_wronly, 0644)) < 0) { perror(argv[1]); /* open failed */ exit(1); } printf("this goes standard output.\n"); printf("now standard output go \"%s\".\n", argv[1]); fflush(stdout); /* new file become standard output */ /* standard output file descriptor 1, use dup2 */ /* copy new file descriptor onto file descriptor 1 */ /* dup2 close current standard output */ dup2(newfd, 1); printf("this goes standard output too.\n"); exit(0); } in unix system stdout buffering happens improve

How to open Yaml files in python from http? -

i learning python , part of challenge myself able create script can automatically identify book it's barcode. i have api key isbndb.com, can return requests in plain yaml. i've been able read yaml files locally harddrive , display information book, able open these files directly http. i've done googling around couldn't find on topic. any appreciated :)

arrays - Java 8 Lambda to convert Number[][] to double[][] -

number[][] intarray = new integer[][]{ {1, 2, 3}, {4, 5, 6}, {7, 8, 9} }; double[][] doublearray = arrays.stream(intarray) .foreach(parray -> arrays.stream(parray) .maptodouble(d ->d.doublevalue()) .toarray()) .toarray(); i want convert number[][] double[][]. above lambda not work, outer toarray not compile. arrays.stream(intarray) : returns stream of integer[] foreach : every integer[], creating stream of integers, converting each integer double , returning double[]. the each creates double[] , thought outer toarray return array of double[] how can work? here's how it: double[][] doublearray = arrays.stream(intarray) .map(arr -> stream.of(arr).maptodouble(number::doublevalue).toarray()) .toarray(double[][]::new); this can decomposed follow

javascript - Force strips with % width to moves like in marquee without blank space -

i have 5 strips 20% of full width , different background-colors of each 1 , want animate in way: 1) strips moves left right, 2) after ^ animation want keep moving in "marquee" case want avoid blank space , glitches after repeats (something infinite horizontal scrolling). i've tried use http://aamirafridi.com/jquery/jquery-marquee-plugin#examples plugin, it's doesn't work in case because of width , different background colors. maybe there way use pure css3? here's sketch: http://jsfiddle.net/sbgrhtqv/ <div class="strips"> <div class="strip"></div> <div class="strip"></div> <div class="strip"></div> <div class="strip"></div> <div class="strip"></div> </div> .strips { width:100%; -webkit-animation-name: slide; -webkit-animation-duration: 4s; -webkit-animation-iteration-count: infinite;

reactjs - Can you use React.addons.PureRenderMixin with components that use props.children? -

example: will component re-render expected when updatename called if mycomponent uses react.addons.purerendermixin ? ... render() { return <mycomponent> <helloworld name={ this.state.name } /> </mycomponent>; } updatename() { this.setstate({name: 'fred'}); } it "renders same result given same props , state", when call this.setstate({name: 'fred'}) re-render assuming this.state.name !== 'fred'

java - Where do I get AES Key Schedule encryption key? -

i have implemented aes key schedule in java there 1 thing confused about. in wikipedia ( http://en.wikipedia.org/wiki/rijndael_key_schedule#key_schedule_description ) says: the first n bytes of expanded key encryption key. where "encryption key" come from? generated randomly , if constraints should generate etc? at moment have method generates random array of 16 bytes: public int[][] initvec() { int[][] key = new int[4][nk]; (int = 0; < 4; i++) { (int j = 0; j < nk; j++) { key[i][j] = mrnd.nextint(255) % (0xff + 1); int keyval = key[i][j]; // system.out.printf("%x,",keyval); } // system.out.println(""); } return key; } i print key out java has signed bytes if use number larger 127 (currently 255) negative numbers can't represented in string using outputbyte byte[] , has integers converted bytes , stored inside it: string output = new string(outputbyte,

spring - How to explictly state that an Entity is new (transient) in JPA? -

i using spring data jparepository , hibernate jpa provider. normally when working directly hibernate, decision between entitymanager#persist() , entitymanager#save() programmer. spring data repositories, there save() . not want discuss pros , cons here. let consider following, simple base class: @mappedsuperclass public abstract class persistableobject { @id private string id; public persistableobject(){ this.id = uuid.randomuuid().tostring(); } // hashcode() , equals() implemented based on equality of 'id' } using base class, spring data repository cannot tell entities "new" (have not been saved db yet), regular check id == null not work in case, because uuids eagerly assigned ensure correctness of equals() , hashcode() . repository seems invoke entitymanager#merge() - inefficient transient entities. the question is: how tell jpa (or spring data) entity new, such uses entitymanager#persist() instead of #merge() if p

Can't get Rust types correct -

use std::num::float; fn main() { in 1..101 { euler(i) } } fn euler(x: i32){ let n: i32 = x; let e: f64 = (1.0+(1.0/n)).powi(n); println!("euler's number n = {} {}", n, e); } i have code , can't compile. i'm pretty new rust appreciated! let's @ error message: <anon>:11:28: 11:29 error: mismatched types: expected `_`, found `i32` (expected floating-point variable, found i32) [e0308] <anon>:11 let e: f64 = (1.0+(1.0/n)).powi(n); ^ here, rust has very good messages: need provide floating-point variable, not integral one: let e: f64 = (1.0+(1.0/n f64)).powi(n); // here ^~~~~~~~

angularjs - angular.mock.inject causing $injector:moduleerr -

i setting unit tests using karma, require.js, mocha , chai. after setting up, have simple spec file test controller , scope variable. i know inject function needs used $controller service instantiate controller. unable this. here have : define([ 'angular', 'angularmocks' ], function() { describe('myctrl', function() { var $controller; beforeeach(angular.mock.module('myapp')); // ////////// attempt 1 // beforeeach(angular.mock.inject(function(_$controller_){ // $controller = _$controller_; // })); // ////////// attempt 2 // it('should', inject(function(_$rootscope_, _$controller_, _$httpbackend_) { // })); it('should', function() { // ////////// goal expect($scope.message).to.equal('hello world'); }); }); });

matlab: vectorizing a single loop that is ORing N binary matrices -

the below code computation on data matrix, data laid -- data = [ ... 1 2 3 4 5 6; ... 1 2 3 4 5 6; ... 1 2 3 4 5 6;] and code running -- [~,col] = size(data) ; flag1 = bsxfun(@lt, data(:,1), data(:,1).'); flag2 = bsxfun(@gt, data(:,1), data(:,1).'); cindex = 2:col % can rid of loop ? flag1 = flag1 | bsxfun(@lt, data(:,cindex), data(:,cindex).'); flag2 = flag2 | bsxfun(@gt, data(:,cindex), data(:,cindex).'); end what code doing comparing each row in column major order , creating 2 matrices of binary values flag1 , flag2 . is there anyway rid of for cindex = 2:col loop ? you need permuting(rearrange dimensions) create singleton dimensions expansions take place when using bsxfun later on, replace looping used in original posted code. so, implementation - flag1 = any(bsxfun(@lt,permute(data,[1 3 2]),permute(data,[3 1 2])),3); flag2 = any(bsxfun(@gt,permute(data,[1 3 2]),permute(data,[3 1 2])),3);

c# - New Line Character is not shown in TextBox -

Image
i have form shown in image below: now, when user clicks on save template , save text of textbox in xml file. code use save text in xml file : public static void savetemplate(string message) { xdocument xmldocument = xdocument.load(templatespath); xmldocument.element("templates").add( new xelement("template", new xattribute("id", xmldocument.root.elements("template").lastordefault() != null ? int.parse(xmldocument.root.elements("template").lastordefault().attribute("id").value) + 1 : 1), new xelement("body", message))); xmldocument.save(templatespath); } the text saved in xml file looks like: after user may whatever wants. when user runs application again, textbox empty. so, click on load template button. @ time text shown in datagridview: now, user clicks on select template , text datagridviewcell copied textbox again. text not contain new lines. @ image below:

xml - XSL for-each with position to get dynamic column-number -

this not working me. trying correct number of additional columns table depending upon number of nodes in xml. in example, have 2 "stuff" nodes, xml data can have between 1 , four, , table can have between 1 , 4 additional columns. first column there. here's xml: <stuff> <thing>house</thing> <color>red</color> </stuff> <stuff> <thing>hat</thing> <color>brown</color> </stuff> here's xsl: <fo:table width="100%" table-layout="fixed"> <fo:table-column column-width="27%" column-number="1"/> <xsl:for-each select="stuff"> <xsl:if test="position()=1"> <fo:table-column column-width="73%" column-number="2"/> </xsl:if> <xsl:if test="position()=2"> <fo:table-column column-width="36.5%"

solr - CqlSolrQueryExecutor: Undefined name x in selection clause -

i'm using dse solr , ran problem whenever query via cql using 'as' assign value not defined in schema. eg: select f_2 d881 solr_query='f_2:1'; would return results. doing: select f_2, token(f_n) fk d881 solr_query='f_2:1'; would yield: unable complete request: 1 or more nodes unavailable. checking logs can see error: error [thrift:7] 2015-03-21 02:59:58,272 cqlsolrqueryexecutor.java (line 202) java.lang.runtimeexception: undefined name fk in selection clause i understand it's because solr isn't aware of fieldnames, don't know how configure ignore them.

javascript - make async call inside forEach -

i trying iterate thru array of objects , add stuff inside these objects using async function in node.js. so far code looks like: var channel = channels.related('channels'); channel.foreach(function (entry) { knex('albums') .select(knex.raw('count(id) album_count')) .where('channel_id', entry.id) .then(function (terms) { var count = terms[0].album_count; entry.attributes["totalalbums"] = count; }); }); //console.log("i want printed once foreach finished"); //res.json({error: false, status: 200, data: channel}); how can achieve such thing in javascript? use async.each async.each(channel, function(entry, next) { knex('albums') .select(knex.raw('count(id) album_count')) .where('channel_id', entry.id) .then(function (terms) { var count = terms[0].album_count; entry.attributes[&quo

saving data - Lua: Why does my table revert to nil after one remove? -

the following part of script use indicate items (in case, mobs in mud) not in tabled database. if mqtable[1] == nil note("no mobs missing database!") else if "%1" ~= "" mindex = "%1" mdesc = mqtable[tonumber(mindex)] end if "%2" ~= "" mlvl = "%2" end if "%3" ~= "" mkeyw = "%3" end if not mindex , mqtable[1] tprint(mqtable) elseif mindex , not mlvl note(mdesc) elseif mindex , mlvl , not mkeyw note("syntax is: mqmob [index] [level] [keywords]") else mobtable[mdesc]={level = mlvl, keywords = mkeyw} table.save(mobtable,savepath.."/mobs/"..areazone..".tbl") note(mqtable[tonumber(mindex)] .. " saved. level: ".. mlvl .. " -- keywords: " .. mkeyw) table.remove(mqtable, tonumber(mindex)) mobtable = table.load(savepath .. "/mobs/" .. areazone .. ".tbl") mlvl, mkeyw, mdesc = nil, nil, nil end

unique - remove SQL duplicate values, distinct not working -

select bm.puser, bm.desc, bm.price, bm.info, cast (case when bi.closed = 'e' bq.qty-bq.consign-(sum(bd.qtysold)) else bq.qty-bq.consign end int) stock binvoice bi , bdetail bd , bqty bq , bmaster bm (bd.user = bi.user) , (bq.partno = bd.partno) , (bq.partno = bm.partno) , (bm.price > 0.01) , (bm.active = 'y') group bm.puser, bm.price, bm.desc, bm.info, bq.consign, bq.qty, bi.closed my issue want 1 of each puser display, of them appear multiple times. believe case have made coming from. not quite sure how around this. using select distinct did not work me. guidance appreciated. used on nexusdb. use distinct select distinct column_name,column_name table_name; select distinct bm.puser, bm.desc, bm.price, bm.info, cast (case when bi.closed = 'e' bq.qty-bq.consign-(sum(bd.qtysold)) else bq.qty-bq.consign end int) stock binvoice bi , bdetail bd , b

jMeter CSV_Data_Set config and XML dynamic binding -

Image
i using jmeter -csv_data_config element bind csv data xml template shown below. works beautifully when data in excel cells static ie.. know set of columns. eg. 6 cols in csv file bind 6 variables in xml file. lets end user decides have 15 cells of data in csv file. can make jmeter script dynamic add new xml elements eg.item new attributes based on number of cells in csv file ? i think beanshell script might if not ? not sure how .. -much appreciated ! personally use following approach getting data csv file unknown number of columns: user defined variables (defined variable n value of 0 ) while controller counter (start: 1, increment: 1, reference name: n) samplers data-driven logic and use following line condition while controller ${__javascript("${__csvread(/path/to/your/file.csv,${n})}"!="",)} see __csvread() function documentation more details.

How to create key value JSON response in perl script with MYSQL data -

i have perl script query , return response in json format. return json array of values. this perl script my $sql_query = "select * table_categories"; $statement = $db_handle->prepare ($sql_query) or die "couldn't prepare query '$sql_query': $dbi::errstr\n"; $statement->execute() or die "sql error: $dbi::errstr\n"; @loop_data = (); while (my @data = $statement->fetchrow_array()) { push(@loop_data, @data); } $json; $json->{"entries"} = \@loop_data; $json_text = to_json($json); print $json_text; and response this { "entries": [ [ "1", "salt , sugar", "/images/salt_sugar.png", "7" ], [ "2", "tea , coffee", "/images/tea_and_coffee.png", "6" ], [ "3",

ORDER BY is not working properly in MySQL -

the following select query want order by transtype = 'i' , after transdate in ascending order. through query can transtype = 'i' record after not displays in proper sequence. select tranjectionid,date_format(transdate,'%d-%m-%y') transdate,motiamount, transtype,tranjection.partyid,item.itemname,gwt,loss,netwet, party.partyname,melting,westage,finewet,rhodium,amount,bhav tranjection,party,item party.partyid = tranjection.partyid , item.itemid = tranjection.itemid , tranjection.partyid = ".$partyid." order (transtype = 'r') desc, transdate while doing order may as order case when transtype = 'i' 0 else 1 end, transdate;

C++ Access violation reading location, class this pointer is NULL -

i current project struggle understand went wrong in program. believe problem constructor. when call member function behaves haven't initialized class members. here class: class banklist { public: // constructor banklist(); banklist(int size); bool isempty() const; int size() const; void insertbankentry(std::string account, std::string level, std::string lname, std::string fname, float value); // add single entry list void insertbankdata(std::string filename); // populate list data file void deletebankentry(std::string key); // delete single entry void findbankentry(std::string key) const; // find , display 1 element using key void checkbankentry(std::string account); void printhashbankdata() const; // list data in hash table sequence void printhashkeybankdata() const; // list data in key sequence (sorted) void printtreebankdata() const; // print indented tree void writebankdata(); // write data file void outputhas

html - CSS -- Expanding window causes weird horizontal scroll issue -

loading page http://development.items-landingpage.divshot.io/ viewport less 1024px expanding greater 1024px causing body horizontally scrollable in firefox 36.0.1, chrome 41.0.2272.89 (64-bit), , safari 8.0.4. weirdly not issue if page loads first @ > 1024px shrinking , again expanding page. i have narrowed down transform animation on .right element switching class right animated fadeinup right animated fadein before expanding screen makes issue go away. ideas?

passwords - android enable or disable passcode lock using shared preference -

i designed passcode lock activity requires user input passcode before accessing app. i have setting page allow user enable or disable passcode lock, , setting saved in sharedpreference how can app: show passcodelock activity upon launch or resume if "passcode lock" in setting page checked? not show passcodelock activity if "passcode lock" in setting page unchecked? its simple logic in oncreate method of passcode activity value of "passcode lock" shared preference if(passcode){ /* * startactivity(new intent(this,yournextpage.class)); * / } so if "passcode lock" checked not display passcode activity... hope you

css - Overflow issue in header causing Horizontal Scrolling on Mobile? -

as title says, getting horizontal scrolling on mobile devices due possible header overflow issue. cant seem pin issue down using developer tools on chrome. now there lot of code in header , css files on place since wordpress theme ill give link check out: lendenapp.com. before using html, body { overflow-x: hidden; }, causing issue in body. i find way using css stop horizontal scroll issue on content on mobile devices. thanks guys alex

opengl - Wrong framebuffer status (return 36054) when try to do depth attachment -

here code setting framebuffer shadow mapping, yet returns 36054 when checking framebuffer status. ideas? //bind framebuffer shadow mapping gl.glgenframebuffers(1, framebuff); gl.glbindframebuffer(gl4.gl_framebuffer, framebuff.get(0)); gl.glgentextures(1, texturebuff); gl.glbindtexture(gl4.gl_texture_2d, texturebuff.get(0)); gl.gltexstorage2d(gl4.gl_texture_2d, 1, gl4.gl_depth_component32f, displaywidth, displayheight); gl.gltexparameteri(gl4.gl_texture_2d, gl4.gl_texture_mag_filter, gl4.gl_linear); gl.gltexparameteri(gl4.gl_texture_2d, gl4.gl_texture_min_filter, gl4.gl_linear);//gl_linear_mipmap_linear gl.gltexparameteri(gl4.gl_texture_2d, gl4.gl_texture_wrap_s, gl4.gl_clamp_to_edge); gl.gltexparameteri(gl4.gl_texture_2d, gl4.gl_texture_wrap_t, gl4.gl_clamp_to_edge); gl.gltexparameteri(gl4.gl_texture_2d, gl4.gl_texture_compare_mode, gl4.gl_compare_ref_to_texture); gl.gltexparameteri(gl4.gl_texture_2d, gl4.gl_texture_compare_func, gl4.gl_lequal); gl.glframebuffertexture(gl4.gl_

java - Issue in changing the visiblity of buttons inside OnClickListener -

below code playing audio in project.when click on play button changes pause button , playing audio through init() method inside application class.the issue facing after clicking on play button takes few seconds(5-10 seconds) after play button changes pause.but should change pause button first statement inside onclick() holder.pause.setvisibility(view.visible); . if comment out init method call line projectapplication.getinstance().init(mctxt, lmoment.getprojectmedialoc(), holder.lvisualizerview, laudioprogressbar,holder.image,holder.image2); changes pause button init method required playing audio.if use postdelayed() method , call init() method after 2 seconds works expected .but fail understand why init() method creating problem in changing visiblity of play , pause buttons init method() called after changing visiblity. holder.play.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view)

ios - How to determine UINavigationBar size before device orientation changes -

i'm writing app in objective-c using xcode 6 , ios 8. app needs able deployed on iphone 5, 6, or 6+. if want straight answering question, jump down last sentence. if want understand why have question do, or maybe how can alter ui layout in order solve problem way, read on. in 1 of view controllers, have scroll view top constrained bottom of navigation bar, , bottom constrained top of table view. table view's bottom constrained bottom of view controller's main view (i.e. bottom of phone). the scroll view contains subviews expand/contract when user taps on them. want scroll view grow subviews grow, don't want scroll view grow off screen because looks bad , because cause unsatisfiable constraints (the table view's top--which constrained bottom of scroll view--would cross below bottom--which constrained bottom of main view...this causes error). so, use following code make scroll view resize according subviews sizes without growing right off screen: // max he

matlab - Transform note to pitch and get the audio signal -

there pitch , duration , sample rate fs "pitch" vector of note pitch in semitones (with 0 indicating silence), "duration" vector of note duration in seconds, "fs" sample rate of output wave signals playback. pitch= [55 55 55 55 57 55 0 57 60 0 ]; duration=[23 23 23 23 23 35 9 23 69 18 ]/64; fs=16000; i want use above info return audio signal in matlab. can teach me? thx this requires thought , might take time write down before working. personally, i'd split task multiple functions in mind involve: 1. semitone frequency 2. time sample number 3. frequency , sample number output waveform and if possible should add array involves level further progress later on/ helps simplify problem stages. as im not sure semitone scaling using have confirm need sort of converter/look table (formulas according physics of music website ): function [frequency] = semitone2frequency(semitone) %your input how many semitones above middle

vba - Calculate average values for rows with different ids in MS Excel -

Image
file contains information products per day, , need calculate average values month each product. source data looks this: b c d id date rating price 1 1 2014/01/01 2 20 2 1 2014/01/02 2 20 3 1 2014/01/03 2 20 4 1 2014/01/04 1 20 5 1 2014/01/05 1 20 6 1 2014/01/06 1 20 7 1 2014/01/07 1 20 8 3 2014/01/01 5 99 9 3 2014/01/02 5 99 10 3 2014/01/03 5 99 11 3 2014/01/04 5 99 12 3 2014/01/05 5 120 13 3 2014/01/06 5 120 14 3 2014/01/07 5 120 need get: b c d id date rating price 1 1 1.42 20 2 3 5 108 how that? need advanced formula or vb script. update: have data long period - 2 years. need calculate average values each product each week , , after each month . source data example: id date rating 4 2013-09-01 445 4 2013-09-02 446 4 2013-09-03

Java JFileChooser filter files for "File.txt" -

how can make jfilechooser filter filter "file.txt", can make filter ".txt" thats not want. i'm going have string[] of files filter such as string[] filters = new string[filterscount]; string[0] = "file.txt"; string[1] = "text.txt"; string[2] = "uncaptext.txt"; i want able browse files exact names, capitalization count "uncaptext.txt" accepted "uncaptext.txt" or "uncaptext.txt" won't. this seems easy question couldn't find topic on it. i suggest writing filter checks for... return arrays.aslist(filters).contains(file.getname()); in other words, make list out of array (to have nice "contains" method) , ask list if name of file contained in it.

Create an android model class in Android Studio -

i trying create model class in eclipse adt creating folder , referencing in android studio bit confused. how can create model class in android studio , folder appropriate if right click on package->new->? you can this right click on package com.example.setu , new->package .here give name model .then create folder under package.you can add pojo classes here right clicking new->java class

html - Nav Bar collapse not working -

here nav bar navbar don't open when in mobile mode please me navbar shows drop down button nothing happens in mobile mode please help <nav class="navbar navbar-inverse navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="index.php">theatre</a> </div> <div id="navba

javascript - Jquery contextmenu event always returns e.which as 0 -

i using contextmenu bound using jquery on . , noticed e.which , e.button 0 . is there reason this? $("div").on("contextmenu", function(e){ if(e.which) //always 0 //do }); edit: mistake happens in ie8, missed specify browser version. you should go mousedown event works on ie8 $("div").on("mousedown", function(e){ alert(e.which); if(e.which == 3){ //do } }); demo

TFS And Nuget Auto Package restore -

does tfs 2010 support new non-xml automatic package restore introduced of nuget 2.7. or (as suspect) 2013 upwards. as tfs 2010 on 5 years old there no new functionality added. so, no. not support advances since last update in 2011. you should consider upgrading tfs 2013 or preferably vso 2010 falls out of mainstream support in few months. http://nakedalm.com/its-that-time-again-get-ready-to-upgrade-to-tfs-2015/ if still on tfs 2010 question competency of whomever supporting tfs. that's long time behind when there no cost upgrading time. if common problem in organisation vso better solution.