Posts

Showing posts from June, 2011

c# - How to Do the total web form in disable mode -

i having web page consist of 130 drop downs , 100 check box list . total no of lines 7500. page used user view receiving query string other page. starting each , every control.enable = false taking time. how it.thanks in advance. i found not possible make whole form disable once i.e form does't have attribute disabled. can go below function , call function on body onload. function disable() { var limit = document.forms[0].elements.length; (i=0;i<limit;i++) { document.forms[0].elements[i].disabled = true; } }

css - Foundation gem Incompatible units: 'rem' and 'px' -

i've installed foundation gem version 5.5.2.1. when start application receive error: showing /home/user/scrivania/sites/store/app/views/layouts/application.html.erb line #9 raised: incompatible units: 'rem' , 'px'. following other case on internet tried change file _settings.scss on gem folder: ../../var/lib/gems/2.1.0/gems/foundation-rails-5.5.2.1/vendor/assets/stylesheets/foundation/_settings.css i've commented these lines: $row-width: rem-calc(1000); $column-gutter: rem-calc(30); $total-columns: 12; and i've set custom $base-font-size: $base-font-size: 14px; $rem-base: $base-font-size; i don't want downgrade gems, can me error? the problem occurring somewhere in scss because mixing rem-calc , px in function, thrown error. ran same problem , fixed changing custom styles , overrides rem-calc . overriding variable conflicting default foundation style. here's example of how error might occur: $my-font-size: rem-ca

Update SAS dataset based on results from a PROC SQL from another dataset -

new sas user here: have dataset (table) created proc sql statement: proc sql; create table work.dm_1 select distinct a.subject, c.dsyn dsyn_ds_1, d.dsyn dsyn_ds_2 s_raw.dm_1 left join work.edt_eg b on a.subject=b.subjid left join s_raw.ds_1 c on a.subject=c.subject left join s_raw.ds_2 d on a.subject=d.subject c.dsyn='no' , d.dsyn='no'; quit; using results table (work.dm_1), want modify (existing) table (work.edt_ecg, created previous procedure) select matching records (using subject in dm_1 , subjid in edt_eg) table in proc sql above, , update table work.edt_ecg. have tried following: proc sql; update table work.edt_eg select * work.edt_eg subjid in (select distinct subject work.dm_1); quit; but not working me! ideas welcome you should either create new table or view subset of data need create view work.edt_eg_wanted select * work.edt_eg subjid in (select distinct subject work.dm_1); or

Omnet++: How to implement OSPF routing over a StandardHost based node? -

i have network of nodes in random topology. nodes use udp communication , submodules based on "standardhost". i want have shortest route between 2 nodes use ospf. in order have such mechanism how add property of ospf node? in short, you'll need include module in standardhost implements routing mechanism. assume you've found inet framework , has implementation of ospf; source code has bunch of examples ospf (which can find here ). means you'll end .ned file references ospf module in way -- unfortunately don't have experience module itself, can't tell how internals work, if @ simple example included in source, you'll find omnetpp.ini contains reference udp echo application, , this code (as rest of file) shows how routers , hosts connected.

javascript - Laravel 5.1 typeahead.js unable to find any data -

i'm using laravel 5.1 , try add autocomplete form, not return error it's return unable find any. i'm new in javascript. please me fix it here template: {!! form::label('name', 'name:') !!} {!! form::text('name',null,['class'=>'form-control', 'id'=>'users']) !!} here route : route::get('/', 'searchcontroller@index'); route::get('/query','searchcontroller@query'); here controller class searchcontroller extends controller { public function index() { return view::make('template'); } public function query() { $query = input::get('name'); $res = user::where('name', 'like', "%$query%")->get(); return response::json($res); } } here main.js jquery(document).ready(function($) { var sugest = new bloodhound({ remote: '/bookstore/query?name=%query%', /

osx - Can't open IntelliJ, RubyMine or PyCharm due to recovery dialogue -

i'm having problem intellij, rubymine , pycharm. problem seems same, regardless of try launch. example pycharm, face same problem intellij , rubymine. i'm on os x 10.9.5 upon launching ide message: the last time opened pycharm, unexpectedly quit while trying reopen windows. want try reopen it's windows again? i prompted click don't reopen or reopen . clicking either option causes pycharm crash , i'm stuck , unable open pycharm. does know of file can delete pycharm open without trying recover old windows? or able suggest might causing crash, can remedy this?

d3.js - How can I use drag behavior and dblclick event with d3? -

i have been trying many hours , couldn't working. have element d3 draggable using drag behavior, , want add dblclick event, performs action when double clicked. couldn't dblclick event reached. have studied many ways of trying stop propagation within drag, , changing order of declaration of events, no success far. code like: switch = box.append('rect') .data([{x: point.x, y: point.y}]) .attr('transform', function (d) { return 'translate(' + d.x + ',' + d.y + ')'; }) .attr('height', 8) .attr('width', 8) .attr('stroke', color) .attr('fill', color) .on('dblclick', function () { d3.event.stoppropagation(); alert('hello'); // doesn't enter }, true).call(d3.behavior.drag().on('dragstart', function () { d3.event.sourceevent.stoppropagation(); }).on('drag', function (d) { d.x += d3.event.dx; d.y += d3.event.

c++ - Can't read file larger than 2GB in Ubuntu 64 bit OS -

solved @nsilent22, suggestion. change made in seekg() function parameter. nd_file.seekg( (long)(block_number)*disk_block_size ); nd_file.read((char*)(&count), sizeof(int)); original post i know similar questions have been asked , answered earlier. still need existing program. hardware spec : ubuntu 14.04, 64 bit, ext4 file system i have old program creating disk based index. when index file reaches 2.1gb, following read() function inputs wrong value , program aborts. nd_file.seekg(block_number*disk_block_size); nd_file.read((char*)(&count), sizeof(int)); based on similar posts, have put #define _file_offset_bits 64 @ beginning of each file. following make file: gcc=g++ -d_file_offset_bits=64 ndt: main.o utility.o logclass.o g++ -g -o ndtree main.o utility.o logclass.o rm *.o main.o: main.cpp config.h box_queries.h meta_entry.h meta_node.h dir_entry.h dir_node.h leaf_entry.h leaf_node.h logclass.h nd_tree.h node.h utility.h g++ -g -c main.c

Adding test users to private Yodlee sandbox -

i've looked on yodlee website can't see documentation on how best test , development. we have been allocated private sandbox testing api not allow adding users. there doesn't seem way add them either seems pretty pointless. i registered on developer portal , got our code working test users generated there expired after 30 days not viable option continued testing. is there way add users private sandbox? if have been allocated private sandbox testing can use register3 api add test users , continue testing.

batch file - Running .cmd/.bat script in Powershell -

i'm trying write , execute .cmd script in powershell. code have is: $script = @' @echo off setlocal call here '@ invoke-expression -command: $script this based off this link explains here string in powershell. it's @ bottom of link. here's the related msdn . here's another related link trying same thing. i keep getting error has including '@' operator within string: invoke-expression : @ line:1 char:7 + @echo off + ~~~ unexpected token 'off' in expression or statement. @ line:1 char:1 + @echo off + ~~~~~ splatting operator '@' cannot used reference variables in expression. '@echo' can used argument command. reference variables in expression use '$echo'. i've tried escaping '@' symbol, , plethora of other things. i'd know why seemed work them in third link, throws error in case. edit: writing .bat file running bat file resulted in same error: $batchfilecontent = @' @echo o

c++ - CImg: stack overflow when loading .cimg file -

i'm stumped on crash here. have in past been able load .cimg files fine. these files saved cimg.save() function. paths like: "c:\\nionprojects\\testenvironment\\data\\nionccd\\nionccd1010plugin\\dark_exptimeus=121536_bin=1_dualreadout=1.cimg" (no spaces) i'm getting stack overflow here: nionccd1010_x64.dll!cimg_library::cimglist<float>::_load_cimg(_iobuf * const file, const char * const filename) line 45175 c++ loading image simple standalone dll works fine - image data seems ok. cimg.h included in multiple dll's in system. possible source of confusion? call stack looks ok me: nionccd1010_x64.dll!__chkstk() unknown nionccd1010_x64.dll!cimg_library::cimglist<float>::_load_cimg(_iobuf * const file, const char * const filename) line 45175 c++ nionccd1010_x64.dll!cimg_library::cimg<float>::load_cimg(const char * const filename, const char axis, const float align) line 38130 c++ nionccd1010_x64.dll!cimg_library::cimg<fl

Using assert in Selenium -

as title suggest wanted know if using assert in selenium thing. once suggested using asserts slows down test , shouldn't use them. wanted know other people's take on this. thanks. edit: thank views on matter. =) i don't think bottleneck of tests. waiting browser render web page, executing javascript , parsing , accessing page via selenium outweight time needed assertions far.

android - DownloadManager doesn't receive download complete action -

i have intent service downloads file in background, broadcast receiver registered listen download completion, never gets in onreceive() function of receiver. file seems finish downloading, can see in file explorer, , message downloadmanager status success. right before download success message i'm getting error failed chmod /mnt/internal_sd/../filedownloaded intent started main activity oncreate: intent = new intent(context, myintentservice.class); startservice(i); intent service: public class myintentservice extends intentservice { downloadmanager downloadmanager; @override protected void onhandleintent(intent intent) { intentfilter filter = new intentfilter(downloadmanager.action_download_complete); registerreceiver(downloadreceiver, filter); downloadfile(); } void downloadfile(uri downloaduri) { downloadmanager = (downloadmanager) getsystemservice(download_service); downloadmanager.request request

javascript - Why are these Knockout subscriptions notifying an object that shouldn't have subscriptions at all -

check out here: jsfiddle here's html: <script src="http://code.jquery.com/jquery-2.1.4.min.js" ></script> <div id="first"> <button data-bind="click: togglecolumn">click me!</button> </div> <ul id="list_test"> <!-- ko foreach: list --> <li data-bind="text: $data.colname"></li> <!-- /ko --> </ul> here's javascript: function viewmodel(){ var self = this; self.showcolumn = ko.observable(true); self.togglecolumn = function(){ self.showcolumn(!self.showcolumn()); }; self.listofobjects = [ {colname: 'test1', visible: self.showcolumn}, {colname: 'test2'}, {colname: 'test3', visible: self.showcolumn}, {colname: 'test4'}, {colname: 'test5'}, ]; }; function testviewmodel(params){ var self = this; self.list = ko.observablear

excel - How to do 'Save As' using VBA -

i ask helping code below. got when recorded macro upon saving new file desktop. i having issues change directory line. changes happen every time different user using macro can depend on value of e . also, part of filename varies depends on value of d . please me improve codes. thanks! dim b, c, d, e string b = msgbox("this file has saved. click ok.", vbokcancel, "save sharepoint") activeworkbook.save c = msgbox("save file local", vbokonly, "save local") d = inputbox("this shift record falls on week?", "save shift record", "yyyymmdd-yyyymmdd") e = inputbox("enter eid", "save shift record", "eid") 'this line give error ~~~~~ chdir "c:\users\ma.cristina.i.gumato\desktop" activeworkbook.saveas filename:= "c:\users\d\desktop\manila_shiftrecord_" + d + ".xlsx", fileformat:=xlopenxmlworkbook, createbackup:=false does work you? di

ios - How to overcome a #import loop? -

imagine have 2 header files: somefilea.h , somefileb.h somefilea.h includes somefileb.h , , somefileb.h includes somefilea.h . this creates loop , confuse compiler. how can overcome this? you should "forward declare" classes. tells compiler class exists, without need import it. somefilea.h @class somefileb // <-- "forward declares somefileb" @interface somefilea @property (nonatomic, strong) somefileb *somefileb; ... @end somefilea.m #import "somefileb.h" @implementation somefilea ... @end and same thing, other way around in somefileb somefileb.h @class somefilea // <-- "forward declares somefilea" @interface somefileb @property (nonatomic, strong) somefilea *somefilea; ... @end somefileb.m #import "somefilea.h" @implementation somefileb ... @end if don't use class in header, don't need forward declare it. @interface somefilea //i took out property somefileb.. no need @cla

internet explorer - Visual Studio 2015 system requirements -

what visual studio 2015 system requirements regarding internet explorer (ie)? the respective microsoft page states visual studio 2013 needs ie 10, yet nothing mentioned 2015 release.

c - K&R Exercise 1-9: output the input, replacing multiple blanks by a single blank -

i've been working through books on c trying c legs (sea-legs! it?!). i've finished exercise 1-9 k&r book, reference "write program copy input output, replacing each string of 1 or more blanks single blank." have question what's going on code, though-- #include <stdio.h> //copy input output. replace each string of multiple spaces 1 single space int main(int argc, char *argv[]){ int ch, lch; // variables hold current , last characters, respectively /* loop should 'put' current char, store current char in lc, * loop back, 'get' new char , check if current , previous chars both spaces. * if both spaces, nothing. otherwise, 'put' current char */ for(ch = getchar(); (ch = getchar()) != eof; lch = ch){ if(ch == ' ' && lch == ' ') ; else putchar(ch); } return 0; } this works, except first character input. instance, if

java - JavaFX Property for a BitSet -

i need javafx property bitset in order create tablecolumn toggle button each bit in bitset . have implemented property<bitset> oracle documentation meaning , usage of of interface methods still eludes me, me looks superfluous boilerplate. please tell me if on right track implementation , can improve. didn't implement bindings yet because don't expect need them use case. import java.util.*; import javafx.beans.invalidationlistener; import javafx.beans.property.property; import javafx.beans.value.changelistener; import javafx.beans.value.observablevalue; public class bitsetproperty implements property<bitset> { private bitset value; private final set<changelistener<? super bitset>> changelisteners = new hashset<>(); private final set<invalidationlistener> invalidationlisteners = new hashset<>(); @override public object getbean() {return value;} @override public string getname() {return "what shall re

Perl Loop Conceptualization -

i'm having trouble trying figure out how attack problem. have file looks : 1 1 1 1 1 1 2 1 1 1 3 4 4 4 1 1 1 4 4 4 2 2 2 2 3 3 3 2 b 2 2 2 1 1 1 1 b which, want count how many times first 3 numbers repeat consecutively. in load data set perl, , spit out: 3 2 as string '1 1 1' found @ start of line 3 times in row, , string '2 2 2' found begin line 2 times in row. either string may appear later in file, complicates things. well, not know beginning string either, , varies. honestly, i'm confused on how attack this. if can conceptualize this/ give me pseudo-code help, great. edit: per borodins answer, works asked. however, if wanted print count plus letter is, how that? far, my ( $inp, $outp) = qw / out2 outfile/; open $input, '<', $inp or die; open $output, '>', $outp or die; ($last_key, $count); while ( <$input> ) { $key = join ' ', (split)[0..2]; $id = join ' ', (split)[7]; if ( defined $last_key

asp.net - How to find the physical directory of an application on IIS with NSIS -

i'm building installer nsis install multiple asp.net applications @ same time. need find physical directory of these applications on server install files. nsisiis provides functions return: web sites, virtual directory , app pools, nothing return list of applications , properties. i know name of these applications, physical directories varies server server. i wondering if had solution problem. thx to solve problem, can use appcmd.exe, can job you. call nsis this: section "test" nsexec::exectostack 'c:\windows\system32\inetsrv\appcmd list vdir "default web site/virtual_path" /text:physicalpath' pop $0 ;return value pop $1 ;printed text detailprint "output command: $1" sectionend you must after call pop twice, because exectostack stores return value (%errorlevel%) above text returned executed command.

ios - How to change NSIndexPath in another UIViewController in swift -

i nsindexpath array uitableviewcontroller , nsindexpath of specific file. mp3 files document folder in nsindexpath array , specific file selected row uitableviewcell in nsindexpath file. i want switch mp3 files need change nsindexpath in uiviewcontroller plays music. or there different methods switching mp3 files document folder? the uitableviewcontroller code override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) { var playervc = (segue.destinationviewcontroller as! uinavigationcontroller).topviewcontroller as! playmusicviewcontroller var indexpath = tableview.indexpathforselectedrow() var nameofobjectforpass = listofmp3files![indexpath!.row] // default it's name , var filemanager = nsfilemanager.defaultmanager() var waytofile = filemanager.urlsfordirectory(nssearchpathdirectory.documentdirectory, indomains: nssearchpathdomainmask.userdomainmask) var passmusicfileurl: nsurl? // pass mp3 if let documentpath: nsu

java - Decimal floating point literal syntax in javascript -

in java, a decimal floating point literal(fpl) can either decimal fpl or hexadecimal fpl . decimal fpl consists of, <digits>.<digits><exponentpart><f|f|d|d> , <exponentpart> consists of <e|e><+|-><digits> (the sign optional). hexadecimal fpl consists of, <0x|0x><hexdigits><.><hexdigits><binaryexponent><f|f|d|d> , <binaryexponent> is, <p|p><+|-><digits> (sign optional). what fpl notation in javascript? note: beginner in js in javascript there no formal type floating-point number there number type. number can have fraction or not. from ecmascript 2015 standard decimalliteral :: decimalintegerliteral . decimaldigits(opt) exponentpart(opt) . decimaldigits exponentpart(opt) decimalintegerliteral exponentpart(opt)

c++ - How to solve the error: "no matching function for call to ‘bind(<unresolved overloaded function type>" when std::bind is used in a class -

usually, std::bind works in boost::math::tools::bisect(). however, when tried use std::bind in class member functions, there error: " no matching function call ‘bind( " this 1 member function of class: double singlecapillarytube::callocationfunctionwithoutangle(const tubegeometry &tg, const fluidproperties &fp, double templocation, double initiallocationvalue, double temptime, const double initialtimepoint) { auto coefficientb = calcoefficientb(tg, fp); auto coefficienta = calcoefficienta(tg, fp); auto coefficientd = calcoefficientd(tg, fp); auto tempvalue = -coefficientb * (templocation - initiallocationvalue) - \ 1./2. * coefficienta * (pow(templocation, 2.) - \ pow(initiallocationvalue, 2.)) - coefficientd * \ (temptime - initialtimepoint); return tempvalue; } then function used

reactjs - Javascript indexOf object not found -

Image
i'm trying find index of object inside array in javascript. this code i'm using, this returns -1 it's not found. it's there var index = this.state.users.indexof(user); the object i'm comparing identical one's in collection shown in picture below i'm using code compare two console.log(this.state.users[0]); console.log(member); so don't understand why giving negative result in javascript object compared reference, such as var obj1 = {prop: 0}; var obj2 = {prop: 0}; alert(obj1 === obj2); //false indexof compare this, isn't finding anything. to find object in array identical given, can use array.prototype.filter method. or ecmascript 2015 array.prototype.find method

How to assign a value to a string outside the declaration in C ? Bus error/segfault -

i'm trying recode equivalent of strstr() function, after few try got right, here code: (i know there simpler way did, time wanted try using 3rd string stock occurrence) char *my_strstr(char *s1, char *s2) { int i, j; char *tmp; = (j = 0); if (s1 != '\0' && s2 != '\0') { while (s1[i] != '\0' && s2[j] != '\0') { if (s1[i] == s2[j]) { tmp[j] = s1[i]; j++; } i++; } printf("tmp = %s\n", tmp); } return (tmp); } int main() { char a[] = "test point123"; char b[] = "point123"; char *ret; ret = my_strstr(a, b); printf("ret = %s\n",ret); return (0); } i output wanted: tmp = point123 ret = point123 but sure tried longer string, , that's problems started. here string tried, char a[] = "test point123456789"; char b[

VS 2015 IntelliSense: Assembly Not Referenced Error -

i switched vs 2015. have older mvc 5 app runs against 4.52. in vs 2013 it's fine. in vs 2015 i'm getting red squigglies under @html.textboxfor() error indicating: the type 'expression<>' defined in assembly not referenced. must add reference assembly 'system.core, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089'. the project builds , runs fine -- concerned intellisense error never happened in vs 2013. okay, try add reference system.core recommended in error above , error: a reference 'system.core' not added. component automatically referenced build system. again, fine in vs 2013. i had same issue, in mean time i've found answer: i had add following references web.config (add inside opening system.web tag): <compilation debug="true" targetframework="4.5"> <assemblies> <add assembly="system.core, version=4.0.0.0, culture=neutral

asp.net mvc - Upgrade MVC1 project to MVC5 -

is there way convert asp.net mvc 1 project build in vs2008 asp.net mvc 5 , vs2015? i tried open in vs 2015 gave error "this project incompatible current version of visual studio". there ways reference newer versions , update, eg: http://www.asp.net/mvc/overview/releases/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2 .. updating mvc1 (especially if cannot open project) don't want manually install asp.net mvc installs etc (if remember) i suggest creating new mvc5 application, referencing mvc via nuget etc , pulling in code required. give chance re-structure things , learn newer ways otherwise fighting mvc configuration , references.

java - Get and set focus position in SWT browser -

i want , set position within swt browser don't know how. first, created browser control: browser browser = new browser(shell, swt.none); then launched html document: file file = new file("c:\\test\\index.html"); browser.seturl(file.touri().tostring()); that works perfect far. scroll down page find interesting text passage , click menu item create kind of bookmark. question is: how can current focus position (x,y) remember point in text , how can reset position later "apply" specific bookmark? you can interact browser content through browser#evaluate() , browser#execute() . both methods allow execute javascript in context of browsers document. to send javascript code queries current position, use like: object position = browser.evaluate( "window.getcurrentposition();" ); the type of return value depends on code evaluated. debug through code see actual return type is. if aren't interested in return value, use execute .

c# - Is it possible to have multiple controllers for a single entity type? -

i have entity framework model. let's have object foo , object bar. related, foo has navigation property bar, , vice versa. now, odata endpoint, i'd have 2 collections available foo, instance declared so: var builder = new odataconventionmodelbuilder { namespace = "test" }; builder.entityset<foo>("fools"); builder.entityset<foo>("footballs"); builder.entityset<bar>("bars"); the idea here access fools go through foolscontroller , access footballs go through footballscontroller, return different sets of data in each endpoint. trying this, however, causes following notsupportedexception error message: cannot automatically bind navigation property 'foothing' on entity type 'foo' entity set or singleton 'bars' because there 2 or more matching target entity sets or singletons. matching entity sets or singletons are: fools, footballs. i sort of understand issue, if know fact footbal

c - returning array of string from function not working as expected -

i trying pass array of strings function, make changes inside function, , pass main() , print see changes. not working expected. please tell me i'm going wrong. #include <stdio.h> #include <string.h> #include <malloc.h> //don't forget declare function char** fun(char [][20]); int main(void) { char strar[10][20] = { {"abc"}, {"def"}, {"ghi"}, {""},{""} }; //make sure 10 added char** ret; //no need allocate ret, ret placeholder, allocation done in fun int = 0; ret = fun(strar); for(i=0;i<4;i++) printf("[%s] ",ret[i]); printf("\n"); return 0; } //don't forget function has return char** , not int. (remember char**, not char*) char** fun(char strar[][20]) { int = 0; char** ret; ret = malloc(sizeof(void*)); //sizeof(void*) enough, has hold address for(i=0;i<5;i++) { ret[i] = malloc(20 * sizeof(char)); st

javascript - Implenting local storage for each request in node.js -

i instrument node.js application, these need find out method belongs request, these have maintained unique id each request, should store id accessible methods , should separate each request. need thread-local concept of java in nodejs, try node-cache it's pretty easy use var nodecache = require('nodecache'); var mycache = new nodecache(); var obj = {'some': 'object'}; mycache.set('key', obj); var cached = mycache.get('key'); it won't work if have node cluster believe. in case you'll have use external system redis. of course, javascript objects can used associative arrays: var associativearray = {}; associativearray.foo = 'bar'; associativearray['bar'] = associativearray['foo'];

Is there a plugin for parsing and integrating Matlab in Sonarqube? -

does know, can find plugin parsing , integrating matlab in sonarqube ? if have got or written plugin, can use internal pmd runner of sonarqube check created custom rules (xpath) matlab ? or have write "parser" extending pmd matlab ? thank in advance! edit okay, still thinking it. seems, have write/extend matlab grammar, if want use pmd (with javacc can generate parser , lexer). before this, can generate parser , lexer sonarqube created grammar , generator (e.g. antlr) ? there no matlab plugin sonarqube. if decide develop plugin (which not small undertaking), not need pmd. have @ php or css plugins source code know how started: https://github.com/sonarcommunity/sonar-php https://github.com/sonarcommunity/sonar-css alternatively, can add support of matlab language pmd, , develop sonarqube "matlab pmd" plugin. not make sense, unless want integrated pmd reason. there seems very limited matlab support in pmd http://pmd.sourceforge.n

java - FileInputStream and closing -

in code, wherever fileinputstream required argument, i'm doing this: new obj(new fileinputstream(filelocation)); as not assigning fileinputstream reference variable, not closing using close() method. does result in memory leaks? aren't resources released fileinputstream in above approach? if there no references input stream, garbage collected , stream automatically closed - see fileinputstream.finalize() method. however, not programming practice because not know when garbage collection happen. result in memory leak. correct , safer approach use try resources block, or in older java versions try-catch-finally, close stream in block - ioutils apache commons, not have care ioexception thrown close() method

mule - jasypt property placeholder not working -

i have properties file: secret.key = enc(foobar) region = abc then in config.xml : <spring:beans> <encryption:encryptor-config id="econf" password-sys-property-name="mule_encryption_password" algorithm="pbewithmd5anddes" password="" /> <encryption:string-encryptor id="stringenc" config-bean="econf" /> <encryption:encryptable-property-placeholder encryptor="stringenc" location="${env}.properties" /> </spring:beans> but property placeholders don't work, example: <sqs:config secretkey="${secret.key}" region="${region}"></sqs-config> does know why? encrypted password needs write within enc() function , should encrypted. let's consider in properties file password value login@123... encrypted value in properties file :- password=enc(b0u7d8wlwq/ugin31knpp78gbclp7vin) step1 :- can generate key usi

ruby - Rails active record query with multiple associations -

i have tables called users , orders , , delivery_times linked using following relationship. for table user : belongs_to :orders for table orders : belongs_to :delivery_times i want write query on table users using condition on table delivery_times shown: user.includes(order: :delivery_time).where("delivery_times.start < ?",time.now) pg::undefinedtable: error: missing from-clause entry table "delivery_times" however error. can use ror orm make query work using includes, though know there solution using joins? you need join kind of query, since need joint knowledge of delivery_times table , users table. what includes decides between preload , eager_load automatically , tries take better one. in case eager_load ; have article . for error get, guess yould result starting users , not user : user.includes(order: :delivery_time).where("delivery_times.start < ?",time.now) everything else seems correct me.

javascript - How to wrap groups of li tags inside ul -

i have navigation menu contains bunch of li tags , of them having class "sub-item" , want group li tags inside ul navigation : <ul class='main-menu'> <li><a href="#">home</a></li> <li><a href="#">pages</a></li> <li class='sub-item'><a href="#">_contact us</a></li> <li class='sub-item'><a href="#">_community</a></li> <li class='sub-item'><a href="#">_about me</a></li> <li class='sub-item'><a href="#">_blog</a></li> <li><a href="#">dropdown </a></li> <li class='sub-item'><a href="#">_sub menu 1</a></li> <li class='sub-item'><a href="#">_sub menu 2</a></li> <li class=&

c# - Crouch Script/ Scaling transform from one side only -

im trying make crouching script there's wrong code, i've been stuck in here many hours , still don't know what's wrong. im trying decrease height of player transform crouch, , increase stand up. here's code: public float crouchspeed; public float crouchwalkspeed; public bool iscrouching = false; public bool iscrouched = false; void update () { crouch(); iscrouchingvoid(); } public void crouch() { if(input.getkeydown(keycode.leftcontrol) && isongroud) { iscrouched = !iscrouched; iscrouching = true; } } public void iscrouchingvoid() { if(!iscrouched) { if (iscrouching) { vector3 temp = transform.localscale; temp.y -= crouchspeed / 60; temp.x = 1f; temp.z = 1f; transform.localscale = temp; if (temp.y <= 0.5f)

css - intel xdk set button width -

Image
this should such easy thing. i'm writing first intel xdk app. have "login" button defaults 100% (nearly) of screen. want make narrower. i've added class width @ 50% , i've tried kinds of stuff can't figure out how make stupid button narrower, or matter, higher, thing want do. i understand working on adding width , other options app designer cases this, unfortunately it's not out yet. in meantime, can try construct specific css rule might higher priority whatever rule setting it's width. might set both width , max-width. adding !important if necessary, though no 1 likes use if can avoid it.

xaml - Scrollviewer ChangeView function not scrolling to bottom -

i have used listview inside scrollviewer in windows phone 8.1 rt app. have requirement of scrolling bottom of list change view function not working per requirement. created sample same scenario: mainpage.xaml <page x:class="infilist.mainpage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:infilist" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:customlv="using:infilist" mc:ignorable="d" background="{themeresource applicationpagebackgroundthemebrush}"> <page.resources> <style x:key="listviewstyle1" targettype="listview"> <setter property="istabstop" value="false"/> <setter property="tabnavigation" value="onc

vb.net - Scroll to Datagridview selected Row -

i've done quite bit of searching answer none have been able me. i've attempted use or see if .focus() was applicable since other websites suggested it, not. datagridview , historydata. to jump selected row. of course not scroll when enough items fill grid. there parameter i'm missing on grid? here's code: private sub historysearch_textchanged(sender object, e eventargs) handles historysearch.textchanged try if historysearch.text.tostring <> "" each historyrow datagridviewrow in historydata.rows historydata.clearselection() each historycell datagridviewcell in historyrow.cells if historycell.value.tostring.startswith(historysearch.text.tostring) historyrow.selected = true dim integer = historydata.currentrow.index() else historyrow.selected = false end i

ruby on rails - Only getting the index for the current user -

i have pretty basic app. i've managed install devise. idea have users have created challenges (1 many relationship). want logged in user able see challenges have created. i order correct in thinking can pass current user id parameter challenges of current user follows (assuming view set correctly) <%= link_to challenges_path(user_id: current_user.id), class: 'expandable' %> challenges controller def index @challenges = challenge.all render :layout => false end if default behaviour want index of challenges , can change controller action directly, , no need modify link_to add user_id challenges controller def index @challenges = challenge.where(user: current_user) end now if want change behavior if user_id param set, can keep link_to , modify controller way def index @challenges = params[:user_id] ? challenge.where(user: current_user) : challenge.all end

c# - Android gmail gif flickering -

i'm creating gif file using camera in c#, sending gif persons email. i've attached gif , created html email, display gif inline using img tag src being cid of attached gif file. its working except androids gmail client. when view email in android gmail client, gif flashes, showing background either between frames, @ end of gif sequence, or showing gif once gif disappears. i using table (it seems divs made worse), , no background images or colors. seemed things did fixed problem because playing fine, after opening email couple times or sending couple more, gif again (start flashing). is bug in gmail client or something? nothing i've done seems help. gif plays in every other client i've tried , in browser works fine. is there try might fix problem? i'm sure people want see code, here is, super simple <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" style="min-width:6

mod rewrite - RewriteRule in .htaccess and Reverse Proxy -

here problem, i`m struggling few days. we`ve got domain firstpart.maindomanin.com nad subdomain secondpart.maindomain.com. under first domain there first part of project (based on saas commerce) , second part (under secondpart.maindomain.com) - based on symfony. 2 parts connected through soap services etc. for firstpart.maindoman.com using cloudflare. we`ve got reverse proxy so: firstpart.maindomain.com/uk/made pointed secondpart.maindomain.com/uk and (we cant enable cloudflare secondpart.maindomain.com due unrelated issues) want redirect url-s secondpart.maindomain.com/uk firstpart.maindomain.com/uk/made example secondpart.maindomain.com/uk/furniture firstpart.maindomain.com/uk/made/furniture secondpart.maindomain.com/uk/sales firstpart.maindomain.com/uk/made/sales etc. need change domain , add 'made' between language code , rest of url other need redirect urls firstpart.maindomain.com/uk/furniture firstpart.maindomain.com/uk/made/furniture (add 'made' b

css - Different striping for table heading with twitter bootstrap -

Image
the bootstrap guide has info on how add striped rows table. in examples given, heading row (which contains "#", "first name",...) has same striping row 2 ("2", "jacob", ...). is there "bootstrap way" of changing striping of heading row, opposed specifying in css background color of <th> element? changing order of striping, such heading row started grey, , example #2 grey, heading row , example #2 used same shade of grey, wouldn't solve problem. heading row special, should have own special background shade. you can use bootstrap helper classes add deferent shade of color this <thead class="bg-success"></thead> but colors limited 5 more color available other white , grey. can find them here .

html - Image inside table make it go overflow even with height blocked on 100% -

i'm going crazy, have website( http://piscagliacostruzioni.it/ ) divided 3 frames(three rows), in first 1 have table menu, uses around 30 % of height of screen. in table put images, table set 100% fit frame , image set fit cell(only in height, don't care width) expecting image fit in height without overflow, result image going out of frame bottom , not being displayed. here example: https://jsfiddle.net/danipisca07/g0dpr0cl/ (i used div simulate frame parent) <div style="height : 10%"> <table style="height: 100%; table-layout:fixed"> <tr height="65%"> <img src="http://piscagliacostruzioni.it/scrittariga.jpg" style="height:100%"/> </tr> <tr heigth="35%"> <img src="http://piscagliacostruzioni.it/contatti/contatti.jpg" style="height:100%"/> </tr> </table> tried set table-layout fixed , image display prop

OpenCV 3 in Python 2.7 gives error while using Brute-Force Matcher -

i'm using opencv 3 python 2.7 on windows. here's code i'm working with: import numpy np import cv2 matplotlib import pyplot plt img1 = cv2.imread('feature.jpg',0) img2 = cv2.imread('large-pic.jpg',0) orb = cv2.orb_create() # cv2.orb() doesn't work mentioned in documentation kp1, des1 = orb.detectandcompute(img1,none) kp2, des2 = orb.detectandcompute(img2,none) bf = cv2.bfmatcher(cv2.norm_hamming, crosscheck=true) matches = bf.match(des1,des2) matches = sorted(matches, key = lambda x:x.distance) img3 = np.zeros((1,1)) img4 = cv2.drawmatches(img1,kp1,img2,kp2,matches[:10],img3,flags=2) plt.imshow(img4) while trying implement brute force feature matching using orb descriptors, following error after plt.imshow(img4) : traceback (most recent call last): file "<pyshell#18>", line 1, in <module> plt.imshow(img4) file "c:\python27\lib\site-packages\matplotlib\pyplot.py", line 2368, in imshow ret = ax.i

c - Undefined references in GSL -

i'm trying link gsl in small c program. #include "stdlib.h" #include "stdio.h" #include "gsl/gsl_block_float.h" #include "gsl/gsl_matrix_float.h" int main(void) { gsl_matrix_float* m = gsl_matrix_float_alloc(2, 2); gsl_matrix_float_fprintf(stdout, m, "%f"); } i'm compiling gcc -lgsl -lgslcblas -lm program.c . i've tried gcc $(pkg-config --cflags gsl) $(pkg-config --libs gsl) program.c well, along gsl-config . in every case, gcc returns /tmp/cc1wkgxm.o: in function `main': program.c:(.text+0x13): undefined reference `gsl_matrix_float_alloc' program.c:(.text+0x32): undefined reference `gsl_matrix_float_fprintf' collect2: error: ld returned 1 exit status objdump --syms /usr/lib/libgsl.so | grep gsl_matrix_float returns proper symbols, grepping headers. in /usr/lib or /usr/include doing wrong? i got ubuntu forums. order of arguments to gcc might issue gcc -o program program.c `gsl-con