Posts

Showing posts from January, 2013

algorithm - How to calculate the entropy of a file? -

how calculate entropy of file? (or let's bunch of bytes) have idea, i'm not sure it's mathematically correct. my idea following: create array of 256 integers (all zeros). traverse through file , each of bytes, increment corresponding position in array. at end: calculate "average" value array. initialize counter zero, , each of array's entries: add entry's difference "average" counter. well, i'm stuck. how "project" counter result in such way results lie between 0.0 , 1.0? i'm sure, idea inconsistent anyway... i hope has better , simpler solutions? note: need whole thing make assumptions on file's contents: (plaintext, markup, compressed or binary, ...) at end: calculate "average" value array. initialize counter zero, , each of array's entries: add entry's difference "average" counter. with some modifications can shannon's entropy: re...

image - SVG display difference between <img> and <object> -

Image
what's difference between displaying svg image in <img> or <object> tag? facing problems using svg images in <img> tag on android 3.1: the shape in upper example <img> tag , lowest example exact same image display in <object> . why displayed different way? , <object> cached <img> ? what guys suggest? differences when svg used image (html <img> svg <image> or css background images) no scripting no interactivity no external dependencies (complete in single file) no dom (i.e. no script access them outside) can copied canvas via drawimage i suspect you're suffering no external dependencies rule. may want check svg data has preserveaspectratio attribute on root element , if value of attribute not none.

matlab - Store user input as wildcard -

i having trouble data processing function in matlab. function takes name of file processed input, finds desired files, , reads in data. however, several of desired files variants, such data_00.dat, data.dat, or data_1_march.dat. within function, search files containing data , condense them 1 usable file processing. to solve this, desiredfile converted wildcard. here statement use. selectedfiles = dir *desiredfile*.dat % search file names containing desiredfile this returns files containing variable name desiredfile, rather user input. the solution can think of writing separate function manually condenses variants 1 file before function run, trying keep number of files used down , avoid this. you concatenate strings that. considering desiredfile variable. desiredfile = input('files: '); selectedfiles = dir(['*' desiredfile '*.dat']) % search file names containing desiredfile enclosing strings between square brackets [string1 stri...

Convert from T-SQL to Access query? -

Image
is there convenient way convert t-sql query ms access? round , coalesce doesn't seem work in access. i'm trying custom avg field run in access gets syntax error (missing operator) . select top 50 [employeeid] ,[last name] ,[first name] ,[hrsthiswk] --avg hrs ,round( coalesce(( coalesce([1wksago],0) + coalesce([2wksago],0) + coalesce([3wksago],0) + coalesce([4wksago],0) + coalesce([5wksago],0) )/ nullif( case when coalesce([1wksago],0)=0 0 else 1 end + case when coalesce([2wksago],0)=0 0 else 1 end + case when coalesce([3wksago],0)=0 0 else 1 end + case when coalesce([4wksago],0)=0 0 else 1 end + case when coalesce([5wksago],0)=0 0 else 1 end, 0),0), 2) '--- avg hrs ---' ,[1wksago] ,[2wksago] ,[3wksago] ,[4wksago] ,[5wksago] [cmhr].[dbo].[tbl52weekhours_20150527] group [employeeid] ,[last name] ,[firs...

OKTA /authn/credentials/change_password API is throwing invalid provided error -

in okta admin screen, expired password associated username. tried primary authentication (/authn) described in http://developer.okta.com/docs/api/resources/authn.html . got proper status password_expired , state token. invoked change password api (ie /authn/credentials/change_password) above state token , old/new passwords. instead of getting success message, getting error message "e0000011: invalid token provided". my developer api token , state tokens correct. not sure why getting error. can please help? thanks nara after expire password in the ui, user of expired password no longer in active state. specifically, they're set password_expired state not allow password resets. security feature intent of explicitly setting user in state limit constrain access system. note user event model documented in okta developer guide @ http://developer.okta.com/docs/api/resources/users.html#user-status before can change user password, need re-activate user....

android - How to replace a fragment and change TextView in the new one in the same procedure? -

hello you! i not native english speaker, hope understand me anyway. in application have activity relativelayout wich use fragment-container. <framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <relativelayout android:id="@+id/fragmentcontainer" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/white" /> </framelayout> at time have 2 different fragments, 1 shown @ startup , die other 1 called click on textview in first one. both fragments have own class , first 1 has interface main activity perform replacement of fragment after onclick. and there problem.... public void oncallforagb() { getfragmentmanager().beg...

Vagrant provisioning with different dependencies based on branch -

different branches , versions of codebase have different dependencies, e.g. master branch might on ruby 1.9 , use rails 4, release branch might on ruby 1.8 , use rails 3. imagine common problem, haven't seen it. is there clean way detect/re-provision vagrant vm based on current branch (or maybe gemfile)? currently have set "bundle install" , other stuff in provisioner, sorta works still clutters vm enviroment dependencies each branch i've ever been on. why don't add vagrantfile , provisioning scripts repository? since part of branch then, can wish. if switch between branches might not suite anymore since need re-provision vm every time change branch. in case suggest setup multiple vms in vagrantfile , add provisioning scripts vms in parallel. like vagrant ruby1.8 vagrant ruby1.9 ... , on.

ruby - Logging for rspec selenium/capybara tests running in Browserstack -

i building set of automated regression tests in ruby using rspec , capybara. give idea of test, imagine logging in website, adding new data item of fields, saving it, validating new row, updating row, changing fields, , updating/validating that. for example: describe "auto regression test #1", :type => :feature, js: true "should add , update data" # login # go page # press new button # fill in fields # etc. end end this simplified version , there may many things going on within "it". @ first thinking should separate out single test multiple cases have login , page (which assume time don't need waste in automated tests - agree?). nonetheless, i'd log doing such shows in browserstack automate logging tab. what's in there related selenium operations or screenshots. have custom logging. reason being when test fails stack trace - line number (which great) along test fails. since test includes lots of functio...

handlebars.js - Customizing PUT route on save method in ember.js -

i manually specify put route saving model. possible ember? for example, have conversation model , when call conversation.save(), don't want search put conversations/somemail/conversations/:id manually tell ember use put /conversations/:id instead. here namespace : app.applicationadapter.reopen({ namespace: 'conversations/someemail' }); router : app.router.map(function(){ //routing list raw namespace path this.resource('conversations', { path : '/' }, function() { this.resource('conversation', { path : '/:conversation_id'}); }); }); model : app.conversation = ds.model.extend({ readstatus: ds.attr('string'), url: ds.attr('string'), status: ds.attr('string'), lastmessage: ds.attr('string'), createdat: ds.attr('string'), timeagoelement: ds.attr('string'), customer: ds.belongsto('customer'), content: ds.attr('array'), }); you can customize url in a...

javascript - google maps fitBounds not working with ajax function - only seems to work with one marker -

i'm having strange issue fitbounds not working after ajax call. on initial page load, fitbounds works fine, , centers 5 markers. however, after click on 1 of dropdown filters or pagination (which triggers ajax function update markers, doesn't want load, though appears trying center map based on markers should be. filters working because outputting list of maker locations beside map. i have noticed, if adjust query show 1 marker @ time, fitbounds tends work better, although not time. seems though in "for loop" may throwing off. still don't have 100% success rate showing 1 marker. seems work bit better part. regardless of how many markers output ajax function, eventually, after clicking on filters multiple times, it's map lags out. show marker, map behind won't right. , map start more , more distorted each time each time filters triggered. strange thing once trigger ajax function new marker, if hover on zoom bar on map, automatically slides way botto...

c - How to keep two related files in sync? -

suppose have makefile containing similar this: program.revision: smaug git rev-parse head > program.revision program: $(obj) $(cc) -o $@ $^ $(ldflags) the aim clear: want program.revision always mirror revision of source created program . but wrote , realized not adequately cover needs nor concerns: if compile of program fails half-way, old (working) version of program left behind, or deleted? related point 1, how make sure if program deleted, program.revision deleted well? , similarly, if old build survives, old program.revision remains intact? how make sure program.revision in sync, if execute make program opposed plain make ? i realize problem made considerably simpler deleting old files prior building them, important minimize chance program ends missing due failed build. how handle situation? edit: after writing this, realized problem might not think is. aim have build of program know revision created with, maybe answer isn't in mak...

c# - Building an MVC web application using the Database First approach with an Oracle DB -

Image
mapping membership provider tables in dev newly created oracle tables. i building internet application in mvc using database first approach (ado.net) oracle db. utilizing mvc 4/internet application template visual studio builds context class membership provider services.. once register account in app, visual studios creates database membership tables on local.. question is, if create tables in oracle db on server, how map application use oracle tables. appears mapping happens in webmatrix.webdata.websecurity class... if going @ wrong, please provide me best approach.. thanks in advance... you need map on app.config. see host on data source, define path oracle server. you can find more information on link: http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/dotnet/codefirst/index.html

javascript - VueJS - Prevent Default on link click but also capture object -

i learning vue.js , have run bit of problem. want user able click on <a href="#"></a> tag, e.preventdefault() , , grab object associated link. here code (note have @ preceding {{ because using blade): <a href="#" class="list-group-item" v-repeat="responder: responders" v-on="click: showresponder(responder)"> <div class="media"> <div class="media-left"> <img src="" v-attr="src: responder.avatar" alt="" class="media-object"/> </div> <div class="media-body"> <h4 class="media-heading">@{{ responder.first_name }} @{{ responder.last_name }}</h4> <p> ...

java - Datepicker when show, select date first -

i have edittext, , when click on this, show adatepicker . wish when click on edittext , date appears in first choice , , after selection of month , day. this code, listener date.setonfocuschangelistener(new view.onfocuschangelistener() { @override public void onfocuschange(view v, boolean hasfocus) { if (hasfocus) { myear = mycalendar.get(calendar.year); //add+1 month, mycalendar start @ month 0 mmmonth = mycalendar.get(calendar.month); mmonth = mmmonth + 1; mdayofmonth = mycalendar.get(calendar.day_of_month); final datepickerdialog mdatepicker = new datepickerdialog(register.this, new datepickerdialog.ondatesetlistener() { @override //method setdate edit text public void ondateset(datepicker view, int year, int monthofyear, int dayofmonth) { //set edittext selected...

c++ - std::getline fails after SSL function calls -

my getline read loop has stopped reading input after calls ssl functions. had: std::string input; ... while (std::getline(std::cin, line)) { ... } this worked fine. after wrapped socket ssl, input console no longer being read. ssl* ssl_fd = ssl_new(ctx); if (null == ssl_fd) { close(new_fd); continue; } if (0 == ssl_set_fd(ssl_fd, new_fd)) { close(new_fd); continue; } if (1 != ssl_accept(ssl_fd)) { err_print_errors_fp(stderr); close(new_fd); continue; } while (std::getline(std::cin, line)) { ... } i've tried adding calls clear buffer issues ( std::cout << std::flush , std::cin.ignore() , std::cin.clear() ), @ point i'm out of ideas. it's weird; if take out ssl calls, read loop runs fine , processes input correctly. far can tell, ssl calls don't have impact on stdin or stdout. any recommendations or alternate approaches try?

constraints - sqlalchemy python update a primary key with foreign key restraints -

i need change primary key in multiple tables have foreign key restraints. thinking either update or copy entry updated primary key , delete old entry. how can accomplish either? below minimal working set of tables. p , s rely on primary key of s , s relies on primary key of h. i need update value of ever table 1 entry. continually limited on changing value because of constraints. rather not remove constraints can permanent solution later use. class h(base): __tablename__ = 'ch' = column(string(255), nullable=false, primary_key=true) other_columns = column(string(255)) class s(base): __tablename__ = 'cs' = column(string(255), foreignkey('ch.a'), nullable=false, primary_key=true) sn = column(integer, nullable=false, primary_key=true) other_columns = column(date) header = relationship("h", backref=backref('cs', order_by=a, cascade='delete, all, delete-orphan'), foreign_keys='s.a') __ta...

java - Something is off with my code, can't find it -

for reason code below isn't working properly. structure of code i'm trying make here one-on-one fighting game. pick character 3 different options , battle against computer, picked character. 1 reaches 0 hp loses. so problem in code computer wins in every scenario. put character3 character, made overpowered (1000 hp, 20 strength compared 120hp , 8 strength), character still losing. i'm guessing problem simple, can't see it/figure out. thanks in advance. import java.util.random; public class test{ public static void main(string[] args){ character character1 = new character("test1", 100, 10); character character2 = new character("test2", 120, 8); character character3 = new character("test3", 1000, 20); character player = character3; character enemy = character2; boolean playersturn = true; while (player.gethp() > 0 || enemy.gethp() > 0){ if (playersturn == true){ enemy.damage(player...

c# - How do I change the ASP.NET MVC default login page to login by username instead of email address? -

i'll go on investigation , guys can figure out idea should next. the relevant m, v , c login public class loginviewmodel { [required] [display(name = "email")] [emailaddress] public string email { get; set; } [required] [datatype(datatype.password)] [display(name = "password")] public string password { get; set; } [display(name = "remember me?")] public bool rememberme { get; set; } } and @using (html.beginform("login", "account", new { returnurl = viewbag.returnurl }, formmethod.post, new { @class = "form-horizontal", role = "form" })) { @html.antiforgerytoken() @html.validationsummary(true, "", new { @class = "text-danger" }) <div class="form-group"> @html.labelfor(m => m.email, new { @class = "col-md-2 control-label" }) <di...

gpu - purposely causing bank conflicts for shared memory on CUDA device -

it mystery me how shared memory on cuda devices work. curious count threads having access same shared memory. wrote simple program #include <cuda_runtime.h> #include <stdio.h> #define nblc 13 #define nthr 1024 //------------------------@device-------------------- __device__ int inwarpd[nblc]; __global__ void kernel(){ __shared__ int mywarp; mywarp=0; (int i=0;i<5;i++) mywarp += (10000*threadidx.x+1); __syncthreads(); inwarpd[blockidx.x]=mywarp; } //------------------------@host----------------------- int main(int argc, char **argv){ int inwarph[nblc]; cudasetdevice(2); kernel<<<nblc, nthr>>>(); cudamemcpyfromsymbol(inwarph, inwarpd, nblc*sizeof(int), 0, cudamemcpydevicetohost); (int i=0;i<nblc;i++) printf("%i : %i\n",i, inwarph[i]); } and ran on k80 gpu. since several threads having access same shared memory variable expecting variable updated 5*nthr times, albeit not @ same cycle because of bank conflict. however, output ...

visual c++ - C++ Help, Password Verifier -

sorry if sound idiot or code bad, need get. lot of people have written code did not want @ theirs , copy , paste. here's problem, when try running program, gives me identifier _tchar undefined, , gives me warning on line 20 " < signed/unsigned mismatch". again i'd love can get. #include <iostream> #include <cstring> using namespace std; int main(int argc, _tchar* argv[]) { const int size = 1000; char password[size]; int count; int times1 = 0; int times2 = 0; int times3 = 0; cout << "please enter password: "; cin.getline(password, size); if (strlen(password) < 6){ cout << "not valid, password should atleast 6 letters"; } (count = 0; count < strlen(password); count++) { if (isupper(password[count])) { times1++; } if (islower(password[count])){ times2++; } if (isdigit(passwo...

java - Android WebView for lollipop -

excuse me simple question,i'm beginner java , android developer. have developed app of webview, have choose file button , not working in lollipop. i've got image upload funtion gaunt face website . how should upload songs, videos, & documents? the following code working image upload in lollipop.i use onshowfilechooser lollipop instead of openfilechooser here code: @suppresslint("setjavascriptenabled") public class mainactivity extends actionbaractivity { webview webview; progressbar progressbar; private valuecallback<uri> muploadmessage; private final static int filechooser_resultcode=1; protected static final int input_file_request_code = 0; @override protected void onactivityresult(int requestcode, int resultcode, intent intent) { if(requestcode==filechooser_resultcode) { if (null == muploadmessage) return; uri result = i...

excel - Querying SQL server that contains ranges of data -

i have connection sql server via excel 2007. data looks like: a0001-a9999,x9999-x9999 | 1234 b0001-b9999 | 5678 c0001-c4999 | 1111 c4500-c4999 | 1112 c5000-c9999,d0001-d9999 | 2222 ... the first column range of values second column value should outputted. examples: input of "c4000" return "1111", , input of "c4600" return "1111,1112". how write code allow user of form enter 1 input in cell on worksheet , output in cell? idea hit button activate macro truncate data , report results. proficient in writing vba code , prefer use that, otherwise not adverse trying learn sql. the user in case knows put letter followed 4 numbers input. not have ability edit data in table, pull sql server. the question vague tools want use. solution not sql solution. can set powerpivot in excel accomplish this.

displaying TRUE when shiny files are split into different folders -

i have shiny app using package shinydashboard. at first, had files 3 files - global.r, server.r, ui.r. as files got bigger , messy, took out codes each menus, , placed them in separate folder. (splitting shiny files - http://shiny.rstudio.com/articles/scoping.html ) everything works, there's annoying happening - displays 'true' @ bottom of ui of menus split separate folder. if in 1 big file, doesn't display true. anyone know why happening? functionally, same. what's happening source returns list 2 things inside: value actual r code inside, , visible whether or not code returned visibly or invisibly. true seeing reflection of fact code returned visibly. what want include value of list. instead of source("file.r", local = true) change to source("file.r", local = true)$value that should fix it

html - overlapping css of a table property with another -

Image
i working on web page has table several columns follows in above picture each td has blue border trying increase thickness left border of ask1 using following markup , css html <td class="clientoffer1">ask1</td> css clientoffer1 { border-left: 3px solid #0088cc; } but above css replaced original css of td used remaining columns follows td { padding: 1px; line-height: 10px; text-align: center; /*background-color:#3c78b5;*/ vertical-align: auto; border: 1px solid #0088cc; width: 120px; } how use both css without conflicting 1 another? classes selected leading period in css: .clientoffer1 { ... } demo td { padding: 1px; line-height: 10px; text-align: center; /*background-color:#3c78b5;*/ vertical-align: auto; border: 1px solid #0088cc; width: 120px; } .clientoffer1 { border-left: 3px solid #0088cc; } if still having troubles, because level of specificity taking ho...

java - JDBC performance when connection is stablished -

i want reduce time of part of project takes 2 hrs. how has been coded goes , take out 700,000 uid 1 table , pass 16 different threads. each thread connect jdbc , fetch row uid 1 one. runs 700,000 query! 50k each thread because uses 3 4 fields of each row plan needed fields @ first , don't connect database anymore. concerns: because fetch row uid ( assume should fast) improve performance dramatically ? i need worry memory , cache misses , everything, putting 700,000 rows couple of fields in memory scares me. overall think improve performance or think doesn't matter much. saving 5min because of testing necessary doesn't worth it. so think should pursue path or focus more on logic??? thanks lot as has been suggested in various comments, should load records in batches. don't know how infrastructure configured, if using cloud service, database round trip can take on order of hundreds of milliseconds. however, may not problem. if haven't con...

jquery - appending html into the dom, then when i use an on(click) function I get $this is undefined -

i have list of stuff, want insert options after dom loaded. $(document).ready( function() { //add sharing stages var $stage = $('.stage > h3'), $stagesharebtn = $('.stage h3'); $stage.append('<i class="fa fa-share"></i>'); $stage.after('<div class="share-stage"><a href="#"><i class="fa fa-facebook"></i></a><a href="#"><i class="fa fa-twitter"></i></a><a href="#"><i class="fa fa-google-plus"></i></a></div>').end; $stage.on( 'click', function(e){ e.preventdefault(); $this.next('.share-stage').toggleclass('active'); }); }); the append , after worked fine, jquery hooked correctly. if leave $this off function, works triggers on page.

javascript - Magnific Popup Jquery: Ajax Popup is not working -

i trying show web page content in popup window using magnific popup jquery i using ajax type show content. i tried below code. html: <a class="ajax" href="http://www.google.com"> text </a> jquery: <script type="text/javascript"> $(document).ready(function() { $('.ajax').magnificpopup({ delegate: 'a', type: 'ajax', aligntop: true, overflowy: 'scroll' // know popup content tall set scroll overflow default avoid jump } } }); }); </script> please check jsfiddle in terms of jquery novice. did wrong here? the problem external links. can't load/interpreted correctly cause wrong mime type. http://dimsemenov-static.s3.amazonaws.com/dist/magnific-popup.css http://dimsemenov-static.s3.amazonaws.com/dist/jquery.magnific-popup.min.js here fiddle working...

excel - Opening multiple webbrowser windows in a loop. -

i have excel spreadsheet , using vba code functions. having user enter x number entries spread sheet , want able open x number of webbrowsers each entry. webbrowsers go specific websites. code have works 1 entry , use webbrowser1.navigate "cx". want if there 5 entries webrowswer2....5.navigate "cx". there way have dynamic webbrowser? since you've not included code, little difficult see you're doing far. if add "microsoft internet explorer" reference vba can create array or browsers. can without adding reference using createobject wont intellitype in editor might harder if don't know control's methods etc ' create large array of them , initialise/destroy them needed dim browser(1 10) internetexplorer ' init browser1 set browser(1) = new internetexplorer ' destroy browser1 set browser(1) = nothing is there reason can use one/two browsers , load pages 1 after other? depending on goal might not much. ...

Polymer iron-media-query not working as previous versions -

the following component used work in 0.5, doesn't work in 1.0. if uncomment h1 tag display values returned iron-media-query, output ",,"; meaning of course values blank. <dom-module id="app-image"> <!-- should select correct image based on size --> <style> :host { display: inline-block; position: relative; overflow: hidden; } :host > ::content img { display: block; } </style> <template> <iron-media-query query="(min-width: 422px)" querymatches="{{ issmall }}"></iron-media-query> <iron-media-query query="(min-width: 642px)" querymatches="{{ ismedium }}"></iron-media-query> <iron-media-query query="(min-width: 1202px)" querymatches="{{ islarge }}"></iron-media...

PowerShell Workflow Thread Limit -

i have powershell workflow looks this, except each foo function different: function foo1 { "foo1 : {0:hh}:{0:mm}:{0:ss}" -f (get-date) start-sleep 2 } function foo2 { "foo2 : {0:hh}:{0:mm}:{0:ss}" -f (get-date) start-sleep 2 } function foo3 { "foo3 : {0:hh}:{0:mm}:{0:ss}" -f (get-date) start-sleep 2 } function foo4 { "foo4 : {0:hh}:{0:mm}:{0:ss}" -f (get-date) start-sleep 2 } function foo5 { "foo5 : {0:hh}:{0:mm}:{0:ss}" -f (get-date) start-sleep 2 } function foo6 { "foo6 : {0:hh}:{0:mm}:{0:ss}" -f (get-date) start-sleep 2 } workflow invoke-workflow { parallel { foo1 foo2 foo3 foo4 foo5 foo6 } } invoke-workflow the output of is: foo1 : 10:28:43 foo2 : 10:28:43 foo3 : 10:28:44 foo5 : 10:28:44 foo4 : 10:28:44 foo6 : 10:28:46 showing first 5 run immediately, , 6th item has wait 1 of previous ite...

php - Access a URL Parameter in a Route Prefix from Middleware -

i struggling access route prefix parameter middleware. given url: http://www.example.com/api/v1/campaign/40/status , , following route: route::group( [ 'prefix' => 'api/v1' ], function() { route::group( [ 'prefix' => 'campaign/{campaign}', 'where' => [ 'campaign' => '[0-9]+' ], 'middleware' => [ 'inject_campaign' ] ], function() { route::get( 'status', 'campaigncontroller@getstatus' ); } ); } ); how access campaign parameter (40 in example url) inject_campaign middleware? have middleware running fine cannot work out how access parameter. calling $request->segments() in middleware gives me parts of route seems fragile way of accessing data. if route changes? you can using shorter syntax you can use: echo $request->route()->campaign; or shorter: echo $request->campaign; ...

deploying sample application endeca -

i’m trying deploy sample application in endeca : ./deploy.sh –app /common/endeca/toolsandframeworks/3.1.2/reference/discover-data/deploy.xml i keep getting below error : ./deploy.sh: 41: ./deploy.sh: /common/endeca/platformservices/6.1.4/perl/bin/: permission denied need on how fix this.

jquery - If/else statement: Search through multiple possible values only finds last value (javascript) -

i have form various inputs search address. province , postal code first appear when load page, there option open toggle display more options such street name etc. basically, i'm trying achieve toggle remain open when page loads again if select , text inputs not empty (' ' , 0). i have of logic down, problem if/else statement looking @ last value getting. var allinputsvalue; var allinputs; //for testing purposes $('.address-options').each( function(){ allinputs = $(this); //for testing purposes allinputsvalue = $(this).val(); //console.log('type: ' + allinputs.attr('type') + ' name: ' + allinputs.attr('name') + ' value: ' + allinputs.val()); //console.log(' id: ' + allinputs.attr('id') + '\n' + ' value: ' + allinputs.val()); console.log('value: ' + allinputsvalue); } ); //if($('#civicno').val() == '', $('#street...

html - Display a child to outside its offscreen parent until parent appears wide enough -

let's have horizontally sliding menu toggles between being aligned to, , hidden beyond, left-hand side of browser window: open (has class "open") closed (class "open" removed) +------+--------------+ +---------------------+ | | | | | | | | | | | | | | | | | | | | | | | | | +------+--------------+ +---------------------+ scss: header nav[role="navigation"] { background: $primary-colour; bottom: 0; left: -282px; position: absolute; top: 0; width: 282px; @include transition(left 250ms cubic-bezier(0.645, 0.045, 0.355, 1.000)); &.open { left: 0; } } now let's want toggle button either: 1) sits @ left of window while menu closed, , 2) sits inside menu, aligned right when open:...

Is there any Data sharing mechanism in Linux kernel? -

is there data sharing mechanism exists in linux kernel? there need that? there ipc inside kernel? there lots of them: pipes, unix sockets, sysv message queues, posix message queues, shared memory, etc... shared memory fastest. pipes work in 1 direction, unix sockets in both. unix sockets work normal ip sockets, use udp or tcp. message queues, write queue , retrieve data later, or in other process.

regex - Ctrlp custom ignore regular expression -

documentation of ctrlp has example of ignoring folders: let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$' . and 1 used locally , works (default config files dotfiles ): let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$' i've got folders _build , node_modules etc. should ignored, having added new folders list did not solve problems , files still appear in list of files, makes ctrlp useless. my expression looked this: let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$\|_build$' what doing wrong?

Modifying a variable in javascript? Not Working -

i'm trying make when pacman runs ghost loses life. , according number of lives has specific message displayed, variable doesnt seem taking account i'm changing it. any suggestions? var life=3; // lorsque l'on rencontre un fantome. function mancheperdue() { x_pacman = 13; y_pacman = 10; life = life-1; if (life=2) { window.alert("2 lives left"); } else if (life=1) { window.alert("1 life left"); } else { window.alert("game over"); gameover(); } } you need use equality operator == in if's, not assignment operator = . if (life == 2) { alert("2 lives left"); else if (life == 1) { alert("1 life left"); } else { alert("game over"); gameover(); } using = means you're reassigning value in each check. example: var lives = 3; if (lives = 1) { alert("1 life"); // show } alert(lives); // show "1"! javascript has idea of strict ...

How to prevent JQuery Dialog queue buildup in hover event -

when use jquery ui dialog in hover event, have following problem: after moving mouse , down list of items, event being fired after stop moving mouse, until blinks number of times hovered on items. https://jsfiddle.net/fump59sm/ i behave way when move mouse away, stops, last 1 being 1 content of item have moved away from. i have found behaves way, when change close destroy : https://jsfiddle.net/fump59sm/1/ but destroy wipes off abruptly, without nice fade effect. also when use: close: function(){ $(this).dialog('destroy'); } doesn't solve problem, since doesn't have time disappear before enter item , dissappears on every second item: https://jsfiddle.net/fump59sm/3/ i tried use .stop(true) , no avail. is there better way achieve (get rid of queue build up) without losing animation effect? or @ least there way add animation destroy ?

java - Why do I get wrong output? -

i new java , trying write simple code. here description: write program prompts user number x. print numbers 1 x. however, in place of multiples of 4 print “qqqq”. in place of multiples of 7, print “seven”. if number divisible both 4 , 7 print “qqqqseven”. means if input 4, output should 1, 2, 3, (qqqq), ...but 1(qqqq), 2(qqqq), 3(qqqq), 4(qqqq)..... can me , let me know doing wrong? appreciated. you. public static void main(string args[]) { //print method system.out.println("enter number upto want print: "); scanner input = new scanner(system.in); int x; x = input.nextint(); for(int i=1; <= x; i++) { system.out.println(i); //if x multiples of 4 if (x % 4 == 0) system.out.println("qqqq"); //if x multiples of 7 if (x % 7 == 0) system.out.println("seven"); //if x divisible 4 , 7 if (x % 4 == 0 && x % 7 == 0) system.out.println("q...

Export an entire sheet from Excel to SQL server -

i'm trying create query export sheet excel sql server, came query yet i'm getting error invalid object name sheet1$ how can select sheet: "sheet1"? s = "insert testtable select * [sheet1$] " cn.execute s in case guess sql server doesnt have access sheet1 file. check here how make file accessible or problem sql locate file. there 2 ways know of how achieve this. 1>> bulk insert testtable 'c:\csvdata\sheet1.xls' ( firstrow = 2, fieldterminator = ',', --csv field delimiter rowterminator = '\n', --use shift control next row errorfile = 'c:\csvdata\schoolserrorrows.txt', tablock ) but make sure on system sql server has access folder want take excel file , have bulk import rights check out more info here 2>> use sql import wizard like this .

eclipse - Running selenium tests on Virtual box guest -

Image
so trying run selenium tests written in java through eclipse on guest machine. my host machine windows 7 , running windows 7 guest machine. have set 2 network adapter nat , host only. farily new whole selenium testing still exploring stuff. i run hub , node on guest next commands: java -jar selenium-2.39/selenium-server-standalone-2.39.0.jar -role hub -port 4444 -host 192.168.56.1 and node with: java -jar selenium-2.39/selenium-server-standalone-2.39.0.jar -role node -port 5555 -hub http://10.0.2.15:4444/grid/register -browser "browsername=internet explorer,version=11,platform=windows" -host 192.168.56.1 from eclipse trying access hub on http://192.168.56.1:5555/wd/hub , http://192.168.56.1:4444/wd/hub in both cases error: org.openqa.selenium.remote.unreachablebrowserexception: not start new session. possible causes invalid address of remote server or browser start-up failure. build info: version: '2.45.0', revision: '32a636c', time: '2...

Nashorn ClassFilter only filters Java.type()? -

i have following 2 code tests. first: javatypetest() blocks access java.io.file expected. second: javamethodgetfiletest() not block access when java.io.file object returned bypassing filter. is not supposed block when java.type() used? or there specific way should adding objects engine? expected output: javatypetest success: true javamethodgetfiletest success: true actual output: javatypetest success: true z:\eclipse ws\nashorntests\. javamethodgetfiletest success: false the reasoning behind want proxy class has allowed methods return allowed objects have getinstance() method returns dissallowedobject have access instance contained in proxy without exposing nashorn. public class nashorntest { class nashornclassfilter implements classfilter { public nashornclassfilter() { } @override public boolean exposetoscripts(string clazz) { if (clazz.equals("java.io.file")) return false; ...

c++ - Why doesn't Qt's qHash() have an overload for std::shared_ptr? -

i found out, surprise, following code not compile out of box in c++14 using qt 5.4: qset<std::shared_ptr<sometype>> var; the problem there no overload of qhash() method std::shared_ptr , or other smart pointer far can see: http://doc.qt.io/qt-5/qhash.html#related-non-members it seems natural me have following overload (or similar): template <typename t> uint qhash(const std::shared_ptr<t>& ptr, uint seed = 0) { return qhash(ptr.get(), seed); } but not exist. cannot qt developers overlooked. need include special header? reason why not exist? speak of devil, , doth appear: https://codereview.qt-project.org/113340 this cannot qt developers overlooked. it's not overlook, it's qt doesn't have endless resources add qhash overloads stl type has operator== .

c# - Generation, adding, editing and deleting by the same button in the same textbox -

i have code winform button, either generates random line text file or lets me add new sentence file. (depending on radiobutton active). private void button1_click(object sender, eventargs e) { string filepath = @"c:\file.txt"; if (radiobuttonnew.checked) { string[] lines = file.readalllines(filepath); random rand = new random(); string sentnew = lines[rand.next(0, lines.length)]; textbox.text = sentnew; } else { file.appendalltext(filepath, textbox.text + environment.newline); messagebox.show("value added"); } but example don't 1 of random results , want not add one.. but rather correct generated result, press button again , change line. or want delete generated line file @ all. can done within same button , same textbox adding 2 more radio buttons? i not sure how it, can help? goal have random generation, adding own (these have), editing ,...

groovy - Gradle createPom doesn't seem to read gradle.properties -

please note: although mention shadowjar plugin in question, providing full context. confident gradle guru can answer this, regardless of knowledge level of shadowjar. currently groovy project built following gradle build invocation: gradle clean build shadowjar running invocation produces packaged fat jar under build/libs version property specified in gradle.properties file. instance, if gradle.properties has version=1.2.3 , above invocation produces build/libs/myapp-1.2.3.jar . what doesn't produce, however, valid pom app. , found this answer , modified bit produce: task createpom << { pom { project { groupid ${group} artifactid 'myapp' version ${version} } }.writeto("build/libs/pom.xml") } my thinking group , version (both specified in gradle.properties ) "injected", , should produce pom.xml in same directory fat jar. after adding createpom task, run: ...

c - nasm, macro print not working -

i'm calling function written in assembly c file. c code passes 2 pointers assembly function. i'm using print macro assembly check value of addresses , of elements pointed them. here c code: extern int nn_from_set(float *q, float *t, int q_length, int *s, int s_length); int main() { float *matrix_dyn = malloc(6*4*sizeof(float)); int *s = malloc( 3 * sizeof(int)) //the vectors filled here //print address, no problem here printf("t: %p, s: %p, sizeof int*: %u\n", matrix_dyn, s, sizeof(matrix_dyn)); //assembly function called printf("prova: %d\n", nn_from_set(matrix_dyn, matrix_dyn, 3, s, 3)); return 0; } here assembly code, it's bit long. extern printf %macro pabc 1 ; "simple" print macro section .data .strm db %1,0 ; %1 first actual macro call section .text ; push onto stack bacwards push dword [nnfs_int] ; int push dword .strm push dword n...