Posts

Showing posts from June, 2010

cygwin - How to abort the sequence of git commits being reverted -

i started git revert on long sequence of commits, not knowing -no-edit option. each commit being reverted pops editor. quitting editor without saving "aborts" revert, particular commit being reverted - exits git pops edit window next commit in sequence being reverted. the man page on web shows option --abort want, tried using (in different window), , usage message: $ git revert --abort live-20121111..v2.1-master usage: git revert [options] <commit-ish> i'm using cygwin git version 1.7.5.1, presumably --abort option introduced in newer version. how can cleanly stop whole sequence start on --no-edit option? don't want have quit hundreds of editor sessions. the manual revert --abort can replaced git reset --hard . have effect of stopping loop albeit errors complaining refs/heads branch not @ commit expected when quit editor. do git log (to check commit generated git revert), , select sha1 of commit want reset to. that being said, us

php - Could not open input file: yii -

i'm working yii2 , trying init migration files. working few months ago, i'm getting following error 'yii' not recognized internal or external command command i'm trying run 'yii migrate/create init_my_table i've been looking around not sure problem is. seems should pretty generic , easy fix error... before delve proposing solution, check if installed yii's basic template or advanced template. $ php yii serve will work "basic" template. make sure @ terminal, have changed "basic" directory, enter command: $ php yii serve output server started on http://localhost:8080 document root "path/public_html/yiiproject/basic/web" quit server ctrl-c or command-c. if using advanced template, read thread , see if thread here helps. read till end: http://www.yiiframework.com/forum/index.php/topic/68728-php-yii-serve/ had same issue using advanced template. php yii serve not open input file: yi

javascript - How to word-wrap a URL? -

word wrap works on long strings without special characters. i'd use on url. rather filling columns in row, text goes next row on encountering special characters =, & etc. there other method solve this? html: <div style="word-wrap: break-word; width:100px;" id="foo"></div> js: var div = document.getelementbyid("foo"); div.innerhtml = "https://www.google.co.in/search?q=hello+world&ie=utf-8&oe=utf-8&gws_rd=cr&ei=anquvz7zk4kvuati3igidg"; js fiddle here . ps: overflow isn't nice! try using word-break: break-all; var div = document.getelementbyid("foo"); div.innerhtml = "https://www.google.co.in/search?q=hello+world&ie=utf-8&oe=utf-8&gws_rd=cr&ei=anquvz7zk4kvuati3igidg"; #foo{ word-break: break-all; } <div style="width:100px;" id="foo"> </div>

ruby - testing Rails json API -

i have rails app serves json, , want test code request , process json via http. what's best way test code without stubbing http request-response? i'm thinking of firing webrick serve rails app, technically inept so. pointer code example appreciated. # lib/bam.rb require 'open-uri' class bam def bam host='localhost' hash = json.parse( open("http://#{host}/bam.json) ) # process hash end end # spec/bam_spec.rb rspec.describe 'bam' before(:all) # fire webrick end after(:all) # shutdown webrick end 'bam' hash = bam.new.bam hash.should eq('bam' => 'bam') end end you can use airborne gem https://github.com/brooklyndev/airborne . can compare json structure.

How to Access Database created through Wordpress in PHP using laravel framework -

i have created 1 website using wordpress , data coming website stored database.and more importantly database created using wordpress only. want access data through website developed through php(laravel framework) , have access database through phpmyadmin unable access database because data stored in encoded form wordpress. i have tried integrating wordpress in laravel framework didnt worked me. other solution please me. found tutorial here laravel & wordpress together , haven't tried it.

Menu mmenu not displaying with jquery mobile -

i using jquery ui autocomplete jquery mobile. in presence of these 2 libraries .mmenu displays nothing. i create menu using code: $(document).ready(function() { var mmenu = $("#mcba-menu").mmenu({}).data('mmenu'); $('a').click(function(ev) { ev.preventdefault(); mmenu.open(); }); }); my header is: <head> <title>mcba</title> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="shortcut icon" href="./favicon.ico"></link> <link href="./resources/css/jquery/jquery-ui.css" rel="stylesheet"></link> <link rel="stylesheet" href="./resources/css/jquery/jquery.mobile- 1.4.5.min.css"></link> <link rel="stylesheet" href="./resources/css/3rdparty/hamburger.css"></link> <link rel="sty

javascript - How do i get current value from bootstrap slider? -

this related question asked in link how min , max value of bootstrap slider? i not able answer particular question in discussion, thats why planed ask new question. what need current min , max value bootstrap slider control in javascript. this how control looks like <input id="rbslider" type="text" class="span2" value="" data-slider-min="0" data-slider-max="1000" data-slider-step="5" data-slider-value="[0,1000]" /> and in button click tried min ans max value using following var min = $('#rbslider').data('slider-min'); var max = $('#rbslider').data('slider-max'); but returns min 0 , max 1000 set min 2 , max 10. how 2 , 10 in javascript? for sure can way: var min = $('#rbslider').data('slider').options.min; var max = $('#rbslider').data('slider').options.max; update probably need: var min = $('#crsli

php - codeigniter, 404 not found error -

i have web site , have installed codeigniter 2 site under sub folder ( test ) users can access site using following link: http://www.example.com/test/ when user going access ( test ) site using above link url redirected following link , following error displayed. http://www.example.com/test/login not found the requested url /test/login not found on server. then add index.php above url, login page displayed. http://www.example.com/test/index.php/login when submit username , password again url redirected to, without logged on. http://www.example.com/test/login and again, not found. .htaccess : <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php/$1 [l] </ifmodule> config.php : $config['base_url'] = ''; $config['index_page'] = ''; $config['uri_protocol'] = "auto" ; i have tried

Creating charts in java or javascript without images -

one of project requirements new java web project have dynamic charts load fast. while in discussion , asked if implement charts without using images ie without loading jpg, png files etc. files pdf cannot used. basically question can charts implemented in jsp/javascript without using images,pdf etc ? ie api's used should not provide end result image,or pdf etc. i did not no right away , have implemented charts in console applications in c on screen. can on webpage ? ie show graph drawing on screen dots,lines,circles etc.but should possible inside div ? ps : comments , answer lucien stals helped understand technology looking svg. i looking nudging in right direction of experienced java , javascript programmers in so. a simple bar chart easy enough create divs , css. more complicated , think talking svg, drawn using http://raphaeljs.com/ , or maybe http://d3js.org/ . @ html5 canvas element.

php - CSV import in Yii2 -

did? i have trying upload csv file in project module.the csv format given below.at time of upload getting error message "1 row has validation error". values not inserted in db. what want? i want upload csv file data in mysql db. **my csv format** ============================================================================== model_name|imei_no|promoter_vendor_id|device_report_id|allocation_date ============================================================================== sam | 2342 | 7 | 3 |2015 ============================================================================== insert query mysql insert `dbname`.`tbl_device` (`device_id`,`model_name`,`imei_no`,`promoter_vendor_id`,`device_report_id`, `allocation_date`,`inserted_date`,`inserted_ip`,`inserted_by`,`updated_date`, `updated_ip`,`updated_by`,`status_in`,`record_status`)values (auto_inc,sam,34234,7,3,2015,?,?,?,?,?,?,?,?); model import function in m

Can I make an alias for `set -l` in the fish shell? -

i make liberal use of set -l / set --local in fish scripts, considered making alias it. name local seems apt. unfortunately, obvious approach doesn't work: function local set -l $argv end this fails because, of course, variable creates local local function itself. using alias doesn't work, either, since it's (perhaps legacy) shorthand above function. is there way can create local variable in calling scope without doing more complicated local foo 'bar' ? make eval (local foo 'bar') work, sort of defeat purpose. i'm open sort of trickery or hacks make work, if exist. i'm afraid not, local variables local topmost scope, , there's no way wrap set without creating new scope. best can this: function def --no-scope-shadowing set $argv end this creates variable in calling function scope. subtly different local: local scoped block, while above scoped function. still may sufficient use case.

Is it possible to have deployment slots with different service plans in Azure WebApps? -

i've worked lot in past azure cloud services web roles, bit new azure websites/webapps. loved concept of multiple deployment slots define webapps, enables useful cd scenarios. in case, have test->preprod->prod slots defined. good! is possible specify different pricing tiers or number of instances each of environments? seem share pricing tier of service plan. possible define different number of instances each one? well, multiple deployment slots available in standard sku (the highest one): http://azure.microsoft.com/en-us/pricing/details/websites/ so, no. require not possible. you can mitigate not using staged publishing. can instead, have different service plans different web apps. can link each of web apps different branch of repository ( https://azure.microsoft.com/en-us/documentation/articles/web-sites-deploy/ ). when push uat branch - deployment in uat web site. when push relese branch, deployment releas web site , on.

bash - PS1 can't have two "\$"? -

i want bash prompt string 1 have both date/time , return code of last command. so, thought do ps1="\[\e[00;34;01m\]\$(date +'%a %b %e, %t')\[\e[35m\] \$?\[\e[00m\] >> " which thought give me blue date (like thu jul 2, 01:01:01 ) purple return code , >> (given ansi escape sequences produce "normal" colors based on pallets terminals). however, doesn't work. ps1="\$? >> " and ps1="\$(date +\"%a %b %e, %t\") >> " both work, though, , when first way, first "\$" gets interpreted , other gets interpreted when bashrc sourced. (so, "\$?" gets evaluated 0 , stays 0 .) any thoughts why happening? note: have tried ps1='$(date +"%a %b %e, %t") $? >> ' can else replicate in unix bash? if so/if not, please leave comment. i don't know why bash ignores second \$, try using \d format date: ps1="\[\e[00;34;01m\]\d{%a %b %e,

css - Make HTML Element Expand To Fit Content -

i'm writing web app, predominantly in angularjs using css's flexbox of layout, if matters. i've been going crazy on last few hours trying solve problem i'm stuck on. the problem i'm running follows: there 2 side side div s on page. leftmost div menu must height of document's content or browser window (whichever greater). rightmost div 1 content gets appended dynamically. when program starts, rightmost div less height of browser window (because not have content) application progresses, content gets added such longer browser window. a jsfiddle shows problem can found by clicking here . the html structure of fiddle fixed (containers can added should not removed) tremendous simplification of complex application has same basic structure. additionally, set css heights 100% solely because of reading answer, not because know required make work (i want menu start out full screen minimal content, however). the black div represents menu , yellow div repres

Setup and deployment with input dialog in c#.net -

i created 1 windows service , want input dialog in setup take 2 parameters user @ time of installation , if user enter parameters next button should available. also want fetch these parameters value use them. i have added projectinstaller on service , added below code on projectinstaller.cs class, not working. public override void install(system.collections.idictionary statesaver) { base.install(statesaver); dbconfigurationclass objdbconfigurationclass = new dbconfigurationclass(); objdbconfigurationclass.susername = context.parameters["username"]; objdbconfigurationclass.slic = context.parameters["licensekey"]; } public override void commit(idictionary savedstate) { base.commit(savedstate); } public override void rollback(idictionary savedstate) { base.rollback(savedstate); } public override void uninstall(idictionary savedstate) { base.uninstall(savedstate); }

sas - Access data from OneDrive -

i've been searching answer on internet past few days , couldn't find any, i'm posting question here. there way can read sas datasets stored in onedrive without downloading or synchronizing it? is there libname statement? i don't use onedrive, don't know how works. if have direct web-address like: onedrive.com/username/file.sas7bdat, know code importing excel dataset. might work sas dataset too, @ least can try. code website . filename website url "http://www2.census.gov/acs2005/tables_profiles_subject_tables/010nation/united%20states.xls" debug; proc import out= readin datafile= website run;

css - nth-child selector unable to select last child -

below html code having 4 span under paragraph , want different stylings them. html markup: <div class="logobar"> <p> <span>heading text </span><span class="glyphicon glyphicon-chevron-right"></span><span>audit creation</span> <font class="pull-right">matt@heller.com<span class="glyphicon glyphicon-chevron-down"></span></font> </p> </div> so, applying css children using nth-child selector. , when first 3 span getting css fourth 1 using css of 1st child. don't know why? css: .logobar p span:nth-child(1){ font-family:ubuntubold; font-size:24px; } .logobar p span:nth-child(2){ margin: 0 18px; } .logobar p span:nth-child(3){ font-family:ubuntumedium; font-size:18px; } .logobar p span:nth-child(4){ margin:0 18px; } my guess: i think because having last span inside of font tags , not direct children paragra

MySQL crash with error 23 -

while loading batch of data mysql database (everything running locally data management research project), server crashed no obvious reason. examination of logs showed following errors: error, innodb: operating system error number 23 in file operation. innodb: operating system error numbers described @ http://dev.mysql.com/doc/refman/5.7/en/operating-system-error-codes.html error, innodb: file .\analysis_lastfm\lastfm_scrobbles.ibd: 'windows aio' returned os error 123. cannot continue operation innodb: cannot continue operation. this seemed that, somehow, named .ibd file had become corrupted. after various unsuccessful debugging attempts, deleted data, reinstalled mysql, , tried restoring backup. backup before had had problems (in other words, seems doubtful there's wrong data in backup). other tables restored fine, after couple of hours importing data lastfm_scrobbles table, server crashed same error. i realize question isn't specific be, i'm trying fi

substitution - R substitute how to express O^\prime\Sigma O -

Image
could tell me how use substitute function , paste in r express n(0,o^\prime\sigma,o) it's pretty standard ?plotmath stuff. "trick" use single apostrophe prime mark. example... plot(1, 1, main=expression(n(0,o*"'"*sigma,o)))

java - TextView align center - Android -

Image
i have text view this, <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancelarge" android:text="large text" android:id="@+id/textview" android:layout_centerhorizontal="true"/> it aligned in center horizontally, want move 20p left center. tried android:layout_marginstart="30dp" android:layout_marginleft="30dp" but stayed in middle how can move left, have reference center? here full xml <relativelayout 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" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@

hadoop - Pig multiply a number from a table to all the values of another table -

i have 2 tables: a: (feature:chararray, value:float) b:(multiplier:charray, value:float) where table thousands of rows , b has 1 row. what wanna take rows in , multiply a.value b.value. e.g. a:[('f1', 1.5) , ('f2', 2.3)] b:[('mul', 2)] i'd product table c c: [('f1', 3), ('f2', 4.6)] is there easy way so? you can cross , foreach ... generate . x = cross b; y = foreach x generate a::feature, a::value * b::value; the above code has not been tested.

actionscript 3 - how to trigger a mouse_over event ONLY when mouse_down event is active? -

i'm building game relies on gaining points through having mouse_over repeatedly on hit area, want player able gain points provided mouse_down active. if i'm not getting syntax errors, nothing's happening. know code's wrong. i need hit make pressing true, , trigger onpressing , then, onpressing trigger noot mouse_over , , each mouse_over registers score point , traces it. var score:int = 0 score = 0; var pressing:boolean = false; hit.addeventlistener(mouseevent.mouse_down, maketrue); function maketrue(evt:event){ pressing = true; trace("honk"); onpressing(); } } function onpressing(evt:event){ if (pressing==true){ noot(); } } function noot(event:mouseevent = null)// should mouse_over, gain points { score++; trace("moused over"); trace("score: " + score); } a few things: there's "}" after onpressing() onpressing() requires argument - suggest "evt" once these fixed, tracing work, , sco

Where is the Nest API to deauth an account -

looking through nest authorizations apis, cannot find api 'deauth'. nest documentation indicates should used when user wants remove nest access. thanks here documentation deauthorization api. https://developer.nest.com/documentation/cloud/deauthorization-overview

Why does performance of this batch insert degrade in MySQL? -

Image
i'm looking understanding why insert query gets slower table size grows. the query batch insert of 1k rows. batch mean multiple 'values' rows described in this answer . there longblob field in table. typical size of blob field data rather small @ around 2kb (but can larger). the image shows results of show profile query when inserting empty table vs inserting table had 1 million rows . fk tables empty in both cases. table structure (column names changed anonymity): create table `mytable` ( `modifiedtime` datetime default null, `column1` varchar(255) default null, `column2` varchar(255) default null, `column3` varchar(128) default null, `column4` decimal(20,5) not null, `column5` varchar(128) default null, `column6` varchar(255) default null, `id` varchar(128) not null, `creationtime` datetime default null, `version` decimal(20,5) default null, `status` varchar(255) default null, `column7` varchar(128) default null, `column8` varchar(128) defa

javascript - Passing a variable to a html modal -

i trying following. when user clicks on button modal should show up the modal should show different content depending on button has been pressed there many buttons of kind on site. want pass variable modal , make if comparison here modal <div class="modal fade" id="group_selection" role="dialog"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title" id="mymodallabel">select journal club vote should count</h4> </div> <div class="modal-body"> <form> {% group in groups %}

delphi - What are the fundamentals of optionally compiling a library or requiring DLL? -

i write component ability developer either require dll or include unit in app compiles library project, without dll. for example, let's it's called "mylibrary". if include mylibrary in uses clause, default require dll distributed application. on other hand, if unit mylibraryimplementation in uses clause, compile inside app without requiring dll. this component inside package installed ide. i'm not sure terminology this, or how go this. i'm familiar writing dll's, , not looking write full code. what fundamental things need know make optional dll possible? you won't find result satisfying. delphi cannot directly load classes dll. instead, you'll need define class in mylibrary unit. you'll have implement of methods there. you're welcome make methods little more stubs delegate work functions in dll, though. in stub constructor, call dll function allocates data structure , returns handle. in 3 other stub methods, pass hand

Rails has_many :through association: save instance into join table -

in our rails app, there 3 models: class user < activerecord::base has_many :administrations, dependent: :destroy has_many :calendars, through: :administrations end class administration < activerecord::base belongs_to :user belongs_to :calendar end class calendar < activerecord::base has_many :administrations, dependent: :destroy has_many :users, through: :administrations end and here corresponding migrations: class createusers < activerecord::migration def change create_table :users |t| t.string :first_name t.string :last_name t.string :email t.timestamps null: false end end end class createadministrations < activerecord::migration def change create_table :administrations |t| t.references :user, index: true, foreign_key: true t.references :calendar, index: true, foreign_key: true t.string :role t.timestamps null: false end end end class createcalendars < activerecord::m

java - Possible to get native performance for dynamically compiled code that can be unloaded? -

in .net, seems cannot dynamically compile code call compiled code directly (i.e. w/o "remoting", marshaling, etc) and remove (only) compiled code memory you have decide between 2. (by generating code calling appdomain itself) or 3. (by generating code throw-away appdomain), cannot have both. now i'm curious if possible in java. don't know enough classloaders, seems in java could dynamically compile code throw-away class loader call compiled code (say, through virtual method call predefined interface) directly, w/o marshaling remove references compiled class , throw-away class loader gc take care of removal is assumption valid? yes, can compile / load class code away class loader, call without issue. yes, dynamically code reach 'full performance'. there no difference. however, newly loaded code start in interpreted mode , needs warm before compiled. however, point 3. tricky. 'leaking' throw away class loader easy /

c# - Type.GetEnumUnderlyingType() replacement for .net35 -

i'm looking way replicate functionality of type.getenumunderlyingtype() missing in .net35. just use enum.getunderlyingtype instead: returns underlying type of specified enumeration.

jquery - Auto-Close AJAX inserted bootstrap alert messages? -

i'm having hard time getting bootstrap alert messages auto-close. alert ui <div class="alert-message fade in info " runat="server" id="alertmessage"> <div class="box-icon"></div> <p> <asp:label id="lblmsg" runat="server" text="test"></asp:label> <a href="#" class="close" >&times;</a> </p> </div> vb code-behind lblmsg.text = message alertmessage.attributes.add("class", "alert-message fade in info") radajaxpanel_alerts.responsescripts.add(string.format("$find('{0}').ajaxrequest();", radajaxpanel_alerts.clientid)) javascript $(document).ready(function () { $(".close").click(function () { $(".alert-message").alert('close'); }); }); $(".alert-message").delay(5000).fadeto(900, 0).slideup(500, fun

c# - Delete folder programmatically as admin -

Image
i'm trying delete user profile folder suing c# , asp.net, when through windows ui uac prompt fine. i wish programmatically using asp.net & c# . objective admin users launch webform , remotely on workstation i'm getting permission errors. (im running visual studio admin in debugging environment delete local users) {"access path 'c:\users\nzsp2013admin\appdata\local\microsoft\windows\application ..... denied."} code: var dir = new directoryinfo("c:\users\nzsp2013admin"); dir.attributes = dir.attributes & ~fileattributes.readonly; dir.delete(true); // true => recursive delete this has permissions configured in iis. every asp.net application run in iis run using identity can managed in application pools section in iis manager . by default, each application pool created (including default one) have permissions within limited scope. if i'm honest, phrase application pool makes things sound more

java - Is there a way to change android.R.layout.simple_list_item_1, to my custom layout? -

part of code package com.example.pass; import java.text.simpledateformat; import java.util.arraylist; import java.util.calendar; import android.app.activity; import android.app.datepickerdialog; import android.app.datepickerdialog.ondatesetlistener; import android.app.dialog; import android.app.timepickerdialog; import android.app.timepickerdialog.ontimesetlistener; import android.content.context; import android.database.cursor; import android.database.sqlite.sqlitedatabase; import android.os.bundle; import android.support.v7.app.actionbaractivity; import android.text.format.dateformat; import android.util.log; import android.view.keyevent; import android.view.layoutinflater; import android.view.menu; import android.view.menuitem; import android.view.view; import android.view.view.onclicklistener; import android.view.view.onkeylistener; import android.view.viewgroup; import android.widget.adapterview; import android.widget.adapterview.onitemlongclicklistener; import

ios - IB Color Issues -

Image
i noticed when setting uiview background in xcode 6, colors different. setting 1st view hex of #414042 in interface builder. , second view 0x414042 in code following hex rgb macro. #define rgb(hexvalue) [uicolor colorwithred:((float)((hexvalue & 0xff0000) >> 16))/255.0 green:((float)((hexvalue & 0xff00) >> 8))/255.0 blue:((float)(hexvalue & 0xff))/255.0 alpha:1.0] and can see there difference. in ib there gear setting change rgb type, after changing , trying set rgb, resets srgb. anyone know way around hex colors in code match hex color in ib? is ios version 10+ ? see apple document , apple changed default color space, if want xib using same color code,on xib ,you need choose device rgb or srgb , different generic rgb

Why does a JVM report more committed memory than the linux process resident set size? -

when running java app (in yarn) native memory tracking enabled ( -xx:nativememorytracking=detail see https://docs.oracle.com/javase/8/docs/technotes/guides/vm/nmt-8.html , https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr007.html ), can see how memory jvm using in different categories. my app on jdk 1.8.0_45 shows: native memory tracking: total: reserved=4023326kb, committed=2762382kb - java heap (reserved=1331200kb, committed=1331200kb) (mmap: reserved=1331200kb, committed=1331200kb) - class (reserved=1108143kb, committed=64559kb) (classes #8621) (malloc=6319kb #17371) (mmap: reserved=1101824kb, committed=58240kb) - thread (reserved=1190668kb, committed=1190668kb) (thread #1154) (stack: reserved=1185284kb, committed=11852

rust - How do I upgrade a reference to a mutable reference? -

i have program revolves around 1 shared data structure, proposing changes data, , applying these changes @ later stage. these proposed changes hold references core object. in c++ or language, make reference non-const, mutate when need to. rust doesn't play approach. (i asked in irc earlier today, sadly i'm still stuck.) to help, made distilled example booking tickets in theatre, theatre data structure, bookings proposed changes, , run method applying them if figure out how work! firstly, defining data structures. theatre has many rows, have many seats each: use std::sync::{arc, rwlock}; use std::thread; struct theatre { rows: vec<row> } struct row { seats: vec<seat> } struct seat { number: i32, booked: bool, } impl seat { fn new(number: i32) -> seat { seat { number: number, booked: false } } fn book(&mut self) { self.booked = true; } } here, get_booking method searches seat, returning booking refere

Correlate item in dataframe based on character string in r -

i have dataset newdat, dataframe containing item scores: set.seed(1) newdat <- setnames(data.frame(replicate(5,sample(1:5,10,replace=true))),paste0("i",1:5)) i1 i2 i3 i4 i5 1 2 2 5 3 5 2 2 1 2 3 4 3 3 4 4 3 4 4 5 2 1 1 3 5 2 4 2 5 3 6 5 3 2 4 4 7 5 4 1 4 1 8 4 5 2 1 3 9 4 2 5 4 4 10 1 4 2 3 4 i have character strings "newcv" , "newdv" are: newcv <- c("i3","i2") newdv <- c("i1") i attempting correlate dv of items except itself, , items contained in newcv. have tried following: corr<-cor(newdat,use="complete.obs")[-which(colnames(newdat)==c(newcv,newdv)),which(colnames(newdat)==c(newcv,newdv))] which works if there nothing found in cv, if there in cv error , no results. thoughts? thank you! if want calculate specific correlations can select columns pass cor cor(newdat[newdv], newdat[!(names(newdat) %in% c(newcv, newd

php - Perform a Stripe transaction without JS to retrieve token -

i trying perform stripe transaction without use of javascript. possibly curl cannot figure out header using v2 api. <form action="" method="post" id="payment-form"> <span class="payment-errors"></span> <div class="form-row"> <label> <span>card number</span> <input type="text" size="20" data-stripe="number"/> </label> </div> <div class="form-row"> <label> <span>cvc</span> <input type="text" size="4" data-stripe="cvc"/> </label> </div> <div class="form-row"> <label> <span>expiration (mm/yyyy)</span> <input type="text" size="2" data-stripe="exp-month"/> </label> <span> / </span> <input type=&qu

c - Fgets compilation error -

i'm stuck seems beginner's compilation error: my simple program: #include <stdlib.h> #include <stdio.h> #include "tiles_circular_linked_list.h" #define max_line_length 128; int main(int argc, char **argv) { struct node *head_tail; file *file; /*char filename[] = "/home/student/desktop/studies/c/testing_fodder/tiles";*/ argv++; /*go second character-array argument*/ file = fopen(*argv, "r"); char *curr_line; fgets(curr_line, max_line_length, file); return 0; } i try compile using command: gcc -g -wall -ansi launch_tiles.c -o tiles_prog and these errors: launch_tiles.c: in function ‘main’: launch_tiles.c:17:19: error: expected ‘)’ before ‘;’ token launch_tiles.c:17:19: error: few arguments function ‘fgets’ /usr/include/stdio.h:628:14: note: declared here launch_tiles.c:9:8: warning: variable ‘file’ set not used [-wunused-but-set-variable] launch_tiles.c:8

html - Wrong output in my php code in EditRocket -

i created hello.php file in editrocket on mac , wrote simple code <html> <body> <?php echo "hello world!"; ?> </body> </html> but got wrong output <html> <body> hello world!</body> </html> the correct output hello world! only. what doing wrong? your problem - interpreter dumps whole output script design. output hello world! only for internet browsers, html renderers. web browsers can read html files , render them visible or audible web pages. browsers not display html tags , scripts, use them interpret content of page. they parsing html , gives graphical representation. if want print hello world! whole output remove html tags code consist of: <?php echo "hello world!"; ?>

powershell - Only copy certain file types after unzipping -

i have following code unzip many folders in directory tree: new-item e:\files -type directory get-childitem -path e:\snl_insurance\* -recurse -exclude "*.md5" | foreach-object { $file = $_ write-host $file; $destination = "e:\files" $shell = new-object -com shell.application $zip = $shell.namespace($file.fullname) foreach($item in $zip.items()){ if ($item.name -eq ".txt") { $shell.namespace($destination).copyhere($item) } } } without if statement script copies zip files on too, not text files contained beneath. thought check make sure file extension .txt (or *.txt ive tried both) $item.name doesn't seem contain thought did. if have ideas and/or can explain $shell variable here (and $shell.namespace helpful) in advance. edit: responses. found way before saw these answers. here solution found if interested: new-item e:\files -type directory get-childitem -path e:\snl_insurance\in

c# - filtering results with Entity Framework -

another kinda newbie question guess. have ef setup , want select records based on filter. have someclass 4 items (all strings keep things simple, lets call them string1, string2, , on). now, in post send filter in instance of someclass, maybe not properties filled in. might end string1="something", string2="bla" , string4="bla2". string 3 = null. now, how setup query? if try like: var dataset = entities.mydatabase .where(x => x.string1 == someclass.string1 && x.string2 == someclass.string2 && x.string3 == someclass.string3 && x.string4 == someclass.string4) .select(x => new { x.string1, x.string2, x.string3, x.string4}).tolist(); ... no results, because string3=null. checking parameters , see if they're set , create query based on that, there must more elegant that. anyone? thanks! ronald the following return rows someclass.string null or equals x.string . var dataset = entities.mydatabase

html - value javascript function and dom -

i have function 1 window , takes value , passes on dom script , writes output screen on <div> or <p> or <a> , work well. my point change dom element , put value on 1 text input. try call input id on function , write value innerhtml,but nor work well. i not call function on input elements on other dom elements. this code var vect = []; function close(val) { var elem = document.getelementbyid("output"); elem.innerhtml = ""; vect.length = 0; (var in val.multiple) { var d = val.multiple[i]; if (c) { elem.innerhtml += c.print("%a, %y %b %d"); vect[vect.length] = c; } } val.hide(); return true; } thanks if want set value of input element, need use value , not innerhtml . should : elem.value += c.print("%a, %y %b %d");

python - Should I create a new Pool object every time or reuse a single one? -

i'm trying understand best practices python's multiprocessing.pool object. in program use pool.imap frequently. every time start tasks in parallel create new pool object , close after i'm done. i encountered hang number of tasks submitted pool less number of processes. odd occurred in test pipeline had bunch of things run before it. running test standalone did not cause hand. assume has making multiple pools. i'd find resources me understand best practices in using python's multiprocessing. i'm trying understand implications of making several pool objects versus using one. when create pool of worker processes, new processes spawned parent one. fast operation has cost. therefore, long don't have reason, example pool breaks due 1 worker dying unexpectedly, it's better use same pool instance. the reason hang hard tell without inspecting code. might not have clean previous instances (call close()/stop() , call join()). might have sent

java - Does collect operation on Stream close the stream and underlying resources? -

does below code need wrapped in try-with-resources make sure underlying file closed? list<string> rows = files.lines(inputfilepath).collect(collectors.tolist()); as javadoc of overloaded files#lines(path, charset) method states the returned stream encapsulates reader . if timely disposal of file system resources required, try-with-resources construct should used ensure stream's close method invoked after stream operations completed. so yes, wrap stream returned lines in try-with-resources statement. (or close appropriately.)