Posts

Showing posts from February, 2012

Python String Help Hawaiian Word Pronunciation -

i having trouble figuring out why code not printing out after input value word. can input word, not output after evaluating through while loop. thoughts? ai = "eye-" ae = "eye-" ao = "ow-" au = "ow-" ei = "ay-" eu = "eh-oo-" iu = "ew-" oi = "oy-" ou = "ow-" ui = "ooey-" = "ah-" e = "eh-" = "ee-" o = "oh-" u = "oo-" p = "p" k = "k" h = "h" l = "l" m = "m" n = "n" word = input("please enter hawaiian word want pronounced") character_count1 = int(0) character_count2 = int(1) pronunciation = "" while character_count1 < len(word): if word[character_count1:character_count2] == ai or word[character_count1:character_count2] == "ae"or word[character_count1:character_count2] == "ao"or word[character_count1:character_count2] == "ei

ruby on rails - Spree installation - -

i'm getting troubles install spree. after installing necessary gems, launched following commands : rails _4.2.2_ new my_store spree install my_store i didn't error message when launch "rails s", spree homepage nothing else "no products found" message. any clue wrong ? thanks first of need install spree gem in environment if haven't installed yet gem install spree_cmd then need create rails project rails new my_store after created rails project run command, must run outside of project folder spree install my_store finally prompt questions in terminal (if want run seed, have default data), must answer yes (y) or not (n) depending on want install (i'd recommend yes all) and have spree project running default configuration , data.

linux - Create symbolic link excluding some files in a directory -

is possible symbolic link in linux excluding types of files or folders ? example if want symlink folder "folder1" has following files , folders -folder1 -1.json -2.json -3.xml -4.json -5.xml -folder2 -folder3 is possible exclude *.xml files , folder3 when symlinking ? if yes how ? no. if create link directory, point directory itself, not 'mirror' or duplication of files inside. can't changes linked directory not affect real directory, cause practically same if list of files in directory not change, can consider linking each of files instead of dir

Questions regarding GitHub Enterprise upgrade from 2.2.4 to 2.3.3 -

i planning upgrade our github enterprise 2.2.4 latest 2.3.3. reviewing upgrade document here: https://help.github.com/enterprise/2.3/admin/guides/installation/upgrading-the-github-enterprise-virtual-machine/ i have 2 questions far: "download upgrade package", official download page vmware 2.3.3 full .ova file, not .pkg file in doc. do need create "target root partition" /dev/xvda2 in doc beforehand? i have 3rd question: as backup solution, taking vm snapshot before upgrade, shall put github maintenance mode before taking vm snapshot? thanks jirong the upgrade successful. here answers: 1. copy url upgrade tab, not install. 2. no.

best way to create response curves for a GLM species distribution model in R? -

Image
i'm running binomial glm predict probability of species occurrence, training on 1 dataset , testing model on dataset: here's data trainingdata<-read.csv("trainingdata.csv")[,-1] trainingdata[,1]<-as.factor(trainingdata[,1]) trainingdata[,4]<-as.factor(trainingdata[,4]) testdata<-read.csv("testdata.csv")[,-1] testdata[,1]<-as.factor(testdata[,1]) testdata[,4]<-as.factor(testdata[,4]) mod<-glm(presence~var1+var2+var3, family=binomial, data=trainingdata) probs=predict(mod, testdata, type="response") what best way (or function) create response curves plot relationship between probability of presence , each predictor variable? thanks! the marginal probabilities can calculated predict.glm type = "terms", since each of terms calculated remaining variables set @ mean values. converted probabilty scale plogis(term + intercept). second, because data set contains , combination of continuous values , fac

routing - How can I redirect request from one site to a sub-domain site? -

you can see google have following scenario: http://www.google.com/shopping render web site seems separated site google.com site. how can achieve same scenario asp.net 5? it's responsibility http server, not asp.net 5 application. if use iis, have tune virtual directory. read articles: msdn.microsoft.com/en-us/library/bb763173.aspx www.iis.net/learn/get-started/planning-your-iis-architecture/understanding-sites-applications-and-virtual-directories-on-iis at azure webapps settings in "settings". see image: i.stack.imgur.com/zefx9.jpg

Replace text in first line of tab-delimited file using Powershell -

i have tab delimited file has 10k+ rows. need change specific field of first(header) record specific value.. using following script, messes format. $contents = get-content $path -delimiter "`t" $contents[1] = 'replaced text' $contents | out-file $path i can see format mess up, not sure how keep file , change need to. also, know if there efficient way.. because concerned first line of file. i tried different approach, works "ok" introduces blank lines after each line: $content = get-content $path -delimiter "`n" $content | foreach-object { if ($_.readcount -le 1) { $_ -replace 'a','b' } else { $_ } } | set-content $path one option: $content = {get-content $path}.invoke() $content[0].replace('a','b') | set-content $path $content.removeat(0) $content | add-content $path using . invoke() on script block causes get-content return collection rather array, s

c# - Have PostSharp help to log IF statements -

the behavior i'm looking following: [ifelselogging] public void foo(string bar) { if (bar == "somedumbstringbecausethisishorriblewayofdoingthings") { // here aspect log if statement above true, // , took path } else { // here aspect log if statement above false, // , took path } } if there way hijack if functionality, able adorn logging postsharp uses , dust off hands. other reason i'm adding question i'm not sure i'm being clear i'm asking. this project done jr developer. task not refactor document code level of flow charts. given nature of code, lack of descriptions, poor techniques , practices, nature of project, etc... here things i'm struggling with: i can't debug , step through code locally i can't create unit tests , refactor safely i can't understand code does! i have no original requirement documents understand goal of functionality is so i'm looking us

python - Sorting a "Tuple" by the second value (or by sum) -

my purpose make subroutine takes list of random 4-toops, sorts non-destructively sum of each toop largest smallest, , returns sorted list. an example output should be: ---- random 4-toops: toop 1: (93 97 78 77); 345 toop 2: (-1 82 92 -45); 128 toop 3: (62 25 -31 -4); 52 toop 4: (-77 -86 18 36); -109 toop 5: (-72 -96 -83 -6); -257 ---- random 4-toops sorted sum: toop 1: (93 97 78 77); sum = 345 toop 2: (-1 82 92 -45); sum = 128 toop 3: (62 25 -31 -4); sum = 52 toop 4: (-77 -86 18 36); sum = -109 toop 5: (-72 -96 -83 -6); sum = -257 here python variation of code working: def sort_random_4_toops_by_sum(toops): summit = 0 s = [] in toops: summit = 0 d in xrange(0,4): summit += i[d] s.append(summit) = zip(toops, s) sortedtog = sorted(together, key = lambda x: x[1],reverse=true) toops = [x[0] x in sortedtog] return toops so stuck problem: in python, zipped sum list , tuples list together, , sorted second element in

Having trouble calling two variables from method into main C++ -

i having trouble simple program. need call in method (getnumber) outside of main takes 2 numbers user , store numbers. 2 numbers used in calculation method (math) called main. getting uninitialized local variable 2 numbers calling in getnumber. user enter 2 numbers have them added , display result calling in methods. #include <iostream> #include <string> using namespace std; int getnumber(int x, int y) { // here user prompted input 2 numbers cout << "please enter 2 values" << endl; cin >> x >> y; return x, y; } int math(int x , int y) // here calculations done { int result; result = x + y; return result; } int main() { int x; int y; int result; x = getnumber(x, y); // trying call in input method here result=math(x,y); // calling in claculation method cout << result; system("pause"); return 0; } void getnum

ecmascript 6 - Why does Object.assign not appear to work on Safari 8.0.7? -

we're writing app using webpack , babel-core 5.8.25 . at 1 point in time, happens: somearray.map(item => { const updateditem = object.assign({}, item); // silently fails here... doesn't continue code updateditem.prop = 'something cool'; }); this compiled before hitting browser. works in latest version of chrome , latest version of ios safari, in safari 8.0.7 , fails silently (no error thrown... doesn't go past line). this, however, works expected (using lodash): somearray.map(item => { const updateditem = _.extend({}, item); // important part updateditem.prop = 'something cool'; }); any idea? tried poking around internet regarding this, no avail. object.assign works in chrome because chrome supports natively. babel-loader on own converts es6 syntax es5 syntax, not make es6 library functionality available. easiest way webpack change config like entry: 'app.js' to entry: ['babel-core/polyfill', &

vb.net - When writing to a file, how do I correctly resolve access to path is denied? -

here code: dim htmlfile = "\\folder\test.htm" if file.exists(htmlfile) file.delete(htmlfile) end if using strwriter streamwriter = new streamwriter(htmlfile, false) strwriter.write("content") end using it works of time i'll exception of "access path '\folder\test.htm' denied." exception occurs on line: using strwriter streamwriter = new streamwriter(filename, false) how can ensure creates new file , never causes exception? this routine waits time in case of error betweens 2 servers writing same file: retry_it: try dim htmlfile = "\\folder\test.htm" if file.exists(htmlfile) file.delete(htmlfile) end if using strwriter streamwriter = new streamwriter(htmlfile, false) strwriter.write("content") end using catch exception thread.sleep(2000) '2 seconds goto retry_it end try

java - Why is nothing happening when I run my program? -

when execute program console empty. have no idea causing happen. not receiving error messages except "scanner not closed" warning. causing issue? public class bmiprogram { public static void main(string[] args) { double bmi; double weight; double height; scanner bodymassscan = new scanner(system.in); weight = bodymassscan.nextint(); height = bodymassscan.nextint(); system.out.println("enter weight in pounds: "); system.out.println("enter height in inches: "); bmi = ((weight/math.pow(height, 2)) * 703); system.out.println(bmi + " bmi"); } } just rearrange code! scanner waiting make 2 inputs before printing out statements. public class bmiprogram { public static void main(string[] args) { double bmi; double weight; double height; scanner bodymassscan = new scanner(system.in); system.out.println("enter weight in pounds: "); weight = bodymasssca

excel - Add turnover column to my pivot table using PowerPoint -

i using powerpivot create metrics. on 1 pivot table, want show hires, terms , actives , turnover % each month. i have hires, terms & actives powerpivot data working, not know how can add turnover calculation. is there way insert new column pivot table , run simple division calculation in it? *tried posting image of data, not sure why site not post image me one line of of table such division | hires | actives | terms | turnover corporate | 5 | 150 | 3 | (terms/actives) you can following measures: sumactives:= sum(<fact table>[actives]) sumterms:= sum(<fact table>[terms]) turnover:= [sumactives] / [sumterms] adding measure power pivot model.

javascript - How to detect automatic scrolling to anchors? -

i have 1 page website, example.com . there 2 sections: intro @ top of page, , contact @ bottom of page. if want visit contact section without having scroll through intro , give them link: example.com/#contact . i'm talking these visits below. the browser automatically scrolls down contact section, ignores fixed navigation @ top of page, contact section scrolled behind navigation top of contact section becomes invisible. want correct using javascript, subtracting height of fixed navigation scroll position. let's call function scrollcorrector . problem don't know when such automatic scrolling happens, scrollcorrector isn't called everytime should be. when should scrollcorrector called? when automatic scrolling happens because of hash portion. why not use onscroll ? because way can't differenciate auto scroll user scroll. why not use onclick on every <a href="example.com/#contact"> ? i'll use it, if user navigates browser's butt

json - HighCharts - Filling a heatmap from SQL Query -

im trying fill highcharts heatmap data returned sql query. what have in js file is $(function () { var chart; $(document).ready(function() { $.getjson("php/all-counties-sales-data-box.php", function(json) { chart = new highcharts.chart({ chart: { renderto: 'chart-box-combined', type: 'heatmap', margintop: 40, marginbottom: 80, plotborderwidth: 1 }, title: { text: 'sales per employee per weekday' }, xaxis: { categories: ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'] }, yaxis: { categories: ['lucozade', 'rockstar', 'sprite', 'monster', '7up', 'fanta', 'coke'], title:

jquery - kendoui multiselect single tag mode max selections can't unselect -

when use kendoui multiselect in single tag mode maxselection, if hit max selections can't deselect items. there work around this? http://docs.telerik.com/kendo-ui/api/javascript/ui/multiselect i updated snippet http://dojo.telerik.com/ovasa to <!doctype html> <html> <head> <meta charset="utf-8"> <title>kendo ui snippet</title> <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2015.3.930/styles/kendo.common.min.css"> <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2015.3.930/styles/kendo.rtl.min.css"> <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2015.3.930/styles/kendo.default.min.css"> <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2015.3.930/styles/kendo.dataviz.min.css"> <link rel="stylesheet" href="http://kendo.cdn.telerik.com/20

Microsoft account password criteria -

i have local account "xyz" defined on multiple computers in workgroup. password lowercase, robust. i want add new windows 8.1 computer plan upgrade windows 10 pro. microsoft account "xyz@mydomain.com". account's password not same of local accounts. i understand windows 10 automatically create local alias "xyz". it seem updating password of microsoft account match local accounts allow new computer integrate seamlessly. however, when enter lower case password, microsoft account "change password" page displays error message "please choose password mix of lower , upper case letters, special characters, numbers , symbols". is there way microsoft nanny allow me enter password want? if not, i'll have update password on each computer, , on applications on each computer cares credentials. of these offline @ moment, i'll forget (until access fails). yeah, know answer going 'no', wanted vent. no, if se

buffer - OpenAL Soft - Loop with Intro -

i have been using openal soft win32, , i ran particular problem. my goal play looping sound has one-shot intro portion, similar .wav file loop marker. understand it, must achieved in openal using multiple buffers on source. in general, approach queue both buffers, wait until second buffer playing, , set source loop. works, problem once ready stop sound, don't seem able unqueue last buffer. code looks this: // set sound alsourcequeuebuffers(source, 1, &buffer1); alsourcequeuebuffers(source, 1, &buffer2); alsourceplay(source); ... // check loop sound in update alint buffer; algetsourcei(source, al_buffer, &buffer); if (buffer == buffer2) { alsourcei(source, al_looping, true); } .. // check stop sound in update if (shouldstop) { alsourcei(source, al_looping, false); alsourcestop(source); alsourceunqueuebuffers(source, 1, &buffer1); alsourceunqueuebuffers(source, 1, &buffer2); // al_invalid_operation } the result seems buffer

turbo c graphics no error but doesn't run -

the following code doesn't have error won't run. there's flash on screen when run it. doesn't provide output. have do? #include<graphics.h> #include<conio.h> void main() { int gd = detect, gm; initgraph (&gd, &gm, ""); setbkcolor (15); setcolor (0); settextjustify (1,1); settextstyle (3,0,12); outtextxy (getmaxx()/2, 1, "bataan peninsula state university"); outtextxy(getmaxx()/2, 3, "main campus"); settextstyle (3,0,10); outtextxy (getmaxx()/2, 5, "college of engineering , architecture"); outtextxy (getmaxx()/2, 7, "bachelor of science in civil engineering(bsce)"); settextstyle (3,0,15); outtextxy (getmaxx()/2, getmaxy()/2, "computerized tutorial system"); outtextxy (getmaxx()/2, 30, "(correction in taping)"); settextstyle (3,0,10); outtextxy (getmaxx()/2, getmaxy(), "programmed by: bsce-3a group 8");

machine learning - finding the best conjunctions in logistic regression? -

i'm trying hand @ logistic regression model. have 60 features , try conjunctions of features. there (principled) way explore space of pairs, triples, etc., short of trying possible combinations? data set large (10s of millions of examples), can go deep 4- or 5-feature combinations.

mysql - installed Xampp on Windows 7 32-bit. Errors when starting -

when try start mysql in xampp control panel (v3.2.1) have following message , mysql not start. 23:02:03 [mysql] problem detected! 23:02:03 [mysql] port 3306 in use ""c:\program files\mysql\mysql server 5.1\bin\mysqld" --defaults-file="c:\program files\mysql\mysql server 5.1\my.ini" mysql"! 23:02:03 [mysql] mysql not start without configured ports free! 23:02:03 [mysql] need uninstall/disable/reconfigure blocking application 23:02:03 [mysql] or reconfigure mysql , control panel listen on different port 23:02:03 [mysql] attempting start mysql service... the port 3306 in use in machine, need change port number 3307 in my.ini in c:\xampp\mysql\bin\my.ini . once done restart apache server.

python - iterate inside a dictionary comprehension statement -

i,m started learning python, i'm sure many things don't know may quite simple solve. however, searching through lot of questions couldn't find answer one. is possible iterate variable in dictionary comprehension statement? while searching answer i've found this: { _key : _value(_key) _key in _container } wich, i'm aware, way of looping inside comprehension, work me, need able iterate value each '_key' in '_container'. for basic example: alphabet = 'abcdefghijklmnopqrstuvwxyz' x = 1 alpha_numbers = {char : x char in alphabet} i 'x' 'x += 1' each 'char' in 'alphabet' container. every way try iterate it, inside dictionary comprehension, returns 'invalid syntax' error. so, possible it? or there better way make it? thanks in advance. you can use dict , enumerate passing x starting value: alphabet = 'abcdefghijklmnopqrstuvwxyz' dct = dict(enumerate(alpahbet, x)) #

Windows 10 UWP app - Back button only works when pressed the second time -

i developing windows 10 uwp app visual studio 2015. working on button functionality right now. unfortunately there problem. when press button (either on phone or on pc) doesn't go previous page. when press again works. it example: start app (page 1) go page 2 go page 3 click button (nothing happens) click button (it goes page 2) click button (it goes page 1) so first time when want go needs 2 presses... why? additionally i've found out first press doesn't trigger button event. why? i using implementation described in article: http://www.wintellect.com/devcenter/jprosise/handling-the-back-button-in-windows-10-uwp-apps it has splitview staying open , holding event . should close if using overlay. private void settingsbutton_click(object sender, routedeventargs e) { this.splitview.ispaneopen = false; frame.navigate(typeof(settingspage)); }

SQL - Keep getting an error Incorrect syntax near the keyword 'AS' -

keep getting error incorrect syntax near keyword 'as' is there error below? select avg(salary) [average_salary], concat('$',format( min(salary),2) [minimum_salary], concat('$',format ( max(salary),2) [maximum_salary] salaries (yearid = 1991); you must close concat parenthesis: select avg(salary) [average_salary], concat('$',format( min(salary),2)) [minimum_salary], concat('$',format ( max(salary),2)) [maximum_salary] salaries (yearid = 1991);

java - Reading a file from resource package -

i have read many posts on here , done many google searches still unable read file java package within current project. in 1 of classes have following code, input stream null. have tried using context class loader, many other solutions no avail. inputstream = this.getclass().getresourceasstream( "opcodes.txt" ); system.out.println(is); another attempt was: inputstream = classname.class.getresourcceasstream("/resources/opcodes.txt"); which returned null. any or explanation why can not find file within resource package great. p.s. using eclipse if makes difference. edit: if use openfiledialog find file, able open , read it, file exist , not corrupt. the documentation of getresourceasstream() method, found here: http://docs.oracle.com/javase/7/docs/api/java/lang/class.html#getresourceasstream(java.lang.string) says that: " before delegation, absolute resource name constructed given resource name using algorithm: if name begins '

select - MySQL trigger with if statement trying to query a different table for value to be inserted -

i setting triggers if there update on table value trigger insert fields changelog table. on original update have foreign keys setup keys changed value not used @ all. the following sql , keep getting syntax error: drop trigger if exists `history_hosts_modify`; delimiter // create trigger `history_hosts_modify` before update on `hosts` each row begin if old.hostname != new.hostname insert changelogs (cid, remoteid, cat, action, oldval, newval, modified) values(null, old.id, 'host', 'mod', old.hostname, new.hostname, now()); end if; if old.clients_id != new.clients_id declare temp1, temp2 int; select client clients id=old.clients_id temp1; select client clients id=new.clients_id temp2; insert changelogs (cid, remoteid, cat, action, oldval, newval, modified) values(null, old.id, 'host', 'mod', temp1, temp2, now()); end if; end // delimiter ; can please me? 13.6.3 declare syntax ..

xcode - tableView.insertRowsAtIndexPaths with prototype cell -

i'm trying insert 1 of prototype cells in tableview. defined 2 prototype cells , gave them unique identifiers couldn't manage insert them using specific identifier. there no such function tableview.insertrowsatindexpaths identifier. any thoughts guys? you can use cellforrowatindexpath , inside function, can deque prototype cell. here example override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { //you can have if condition here choose between ur prototype cells let cell = tableview.dequeuereusablecellwithidentifier("unique id_1", forindexpath: indexpath) as! uitableviewcell // configure cell... return cell } here more common way this //in parent class override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) { if segue.identifier == "maincatselectedsegue" { if let tvc = segue.destinationviewcontroller as? yo

c# - Multiple simultaneous requests to the same http host -

i have c# desktop application, needs make multiple simultaneous http requests same web server. here's test performed check whether requests happen simultaneously: on web server, created test page sleeps 3 seconds (simulates long-running task), returns current date/time. here's code (vb.net): <%system.threading.thread.sleep(3000)%><%=now%> in c# app, have function makerequest() uses system.net.http.httpclient make web request, , returns response string. then in c# app there's function invoked button click, calls makerequest() multiple times asynchronously: var responses = await task.whenall(makerequest(), makerequest(), makerequest()); in above example, makerequest() called 3 times. see on web server when monitor requests/sec performance counter, gets 2 requests, , 3 sec later 1 more request. that's design, because default value system.net.servicepointmanager.defaultconnectionlimit 2, c# app can send 2 requests @ time, though asked 3. overall

distance - Calculate time to reach top of the trajectory of a projectile -

Image
i have below information gravity, thrust, initial x, y , initial velocities. how calculate 1. time reach top of projectile 2. horizontal displacement during time "grav": 0.7, "thrust": 10.5, "me": { "x": 0, "y": 180, "vx": 4, "vy": 0 } so far have tried formula calculate vertical displacement (reference here ) for horizontal displacement, used t*vx0 ; if initial vertixal velocity(vy) zero, assuming gravity on y direction, how object ever going go reach top? generally thrown objects reach top when vy = 0 when t= vy/grav, , x position = t * vx.

Python adding data in multi-dimensional dictionary -

while (e > 0): line = raw_input("enter edges : ") data = line.split() mygraph[data[0]] = {data[1] : data[2]} //this line print mygraph e-=1 desired data structure: mygraph = { 'b': {'a': 5, 'd': 1, 'g': 2} 'a': {'b': 5, 'd': 3, 'e': 12, 'f' :5}} i want add multiple entries same key mycode taking 1 value 1 node , replacing entries.how that? you need first add empty dictionary key data[0] if doesn't exist, add values it. otherwise wipe out out every time loop. the 2 usual ways either use setdefault on normal dictionary: mygraph.setdefault(data[0], {})[data[1]] = data[2] or use collections.defaultdict default empty dictionary: >>> collections import defaultdict >>> mygraph = defaultdict(dict) >>> edges = [[1, 2, 3], [1, 3, 6]] >>> edge in edges: ... mygraph[edge[1]][edge[2]] = edge[3] >

javascript - Use lazy loading on bootstrap typeahaead dropdown -

i have custom template dropdown(combobox) of bootstrap typeahead having 940 elements each element having images well. so page load have show elements available in dropdown-combobox after if user type in result filtered. is there way can use lazy load or other functionality improve performance time of load when have show 940 elements. code : $('#scrollable-dropdown-menu .typeahead').typeahead({"highlight":true}, { name: 'fabrics', limit: 940, minlength: 0, display: function(){ return ''; }, source: substringmatcher(fabrics), templates: { header: function(){ if(selectedfabric) return selectedfabric }, empty: [ '<div class="empty-message">', 'no match found', '</div>' ].join('\n'

javascript - method chaining with sub-methods -

i trying use method chain sub-methods. ie: foo("bar").do.stuff() the catch stuff() needs have reference value of bar("bar") is there this.callee or other such reference achieve this? is there this.callee or other such reference achieve this? no, you'd have have foo return object do property on it, either: make stuff closure on call foo have information want foo("bar") property of do , , reference information in stuff do object via this , or // closure example: function foo1(arg) { return { do: { stuff: function() { snippet.log("the argument foo1 was: " + arg); } } }; } foo1("bar").do.stuff(); // using `do` object example (the `do` constructor , prototype // highlight `stuff` need not closure): function do(arg) { this.arg = arg; } do.prototype.stuff = function() { snippet.log("the argument foo2 was: " + this.arg); }; fun

c# - System.Net.IPAddress.Address' is obsolete -

i try convert ip address uint : ipaddress requstedipaddress; uint requesteipaddressuint = (uint)ipaddress.parse(requstedipaddress.tostring()).address; and got warning: 'system.net.ipaddress.address' obsolete: 'this property has been deprecated. address family dependent. please use ipaddress.equals method perform comparisons. what mean , should use other way ? the deprecation warning tells in next update of library has ipaddress defined, no longer have ipaddress.address property. code fail compile after next update library. if go documentation ipaddress.address notes property obsolete , should instead use ipaddress.getaddressbytes . the deprecation of ipaddress.address due adoption of ipv6 128 bits while c# type long , system.int64 , 64 bits.

r - Illustrate back transformed GLS with visreg() -

i have gls logarithmic transformed dependent variable. using visreg() visualization gives error code: library(visreg); library(nlme) fit1 <- gls(log(ozone) ~ wind , data=na.omit(airquality)) visreg(fit1,"wind",trans=exp,ylab="ozone") interestingly same works fine lm: library(visreg); library(nlme) fit2 <- lm(log(ozone) ~ wind , data=na.omit(airquality)) visreg(fit2,"wind",trans=exp,ylab="ozone")

command line interface - How to uninstall sample data from Magento 2 using CLI? -

Image
i have installed sample data in magento 2, due power failures of system stop in between. later saw, there showing categories , products installed. but @ home page not seem banner or product sliders. i tried install again shown message associated email exist. how can re-install via cli ? there no cli command uninstall sample data. must drop magento 2 database. can use magento setup:uninstall that. be careful sample-data not in composer.json or sample data might install again.

how to get each item without using a loop from string array in c# -

iam using 3 string arrays.i want each item corresponds index,ie if itnme have second item,then need second item other 2 string arrays such qntity,price.how can possible this? string[] itmnme= new string[0] { }; string[] price= new string[0] { }; string[] qntity= new string[0] { }; foreach (string iname in itmnme) { foreach (string qnt in qntity) { foreach (string prc in price) { } } } assuming size of arrays identical can use such code: for(int i=0; i<itmnme.length; i++) { var name = itmnme[i]; var quantity = qntity[i]; var price = price[i]; // need these values }

java - Linked List Optimization -

i'm working on program emulates restriction enzymes , dna splicing. i'm using dnasequencenode[s] linked list nodes. i have problem 1 of function in code, cutsplice() supposed create new dnastrand clone of current dnastrand, every instance of enzyme replaced splicee. for example, if linkeddnastrand instantiated "ttgatcc", , cutsplice("gat", "ttaagg") called, linked list should become (previous pointers not shown): first -> "tt" -> "ttaagg" -> "cc" -> null my function works. however, method cutsplice() takes more 80 seconds splice 200 dnas. i'm supposed bring 80 seconds 2 seconds. this code class : linkeddnastrand.java and here's code method cutsplice() public dnastrand cutsplice(string enzyme, string splicee) { dnastrand newstrand = null; string original_dna = this.tostring(); string new_dna = original_dna.replaceall(enzyme, splicee); string[] splicee_split = new_dna

Set layout background to parts of a large image in Android -

Image
i trying generate view pager swipe layout, instead of set of images, want use 1 enlarged image. when users swipes, layout should display portions of images single image. i know how use view pager show different images. need above ui spec. [edited] don't want implement viewpager anymore. have big image shown above. want display parts of image on event. example there 5 actions, , want divide image 5 parts , display based on action choosen dynamically. used bitmap files recreate part of image large image has low performance. (ui gets freezed). although create 5 different bitmaps before activity loaded, setting bitmaps background when user performs event freezes ui. please let me know if there alternate way show parts of image without using bitmap

javascript - How To add striped or Slant Line to progressbar? -

Image
i design progressbar like <style> #progress-holder{width:400px;height:20px;background:grey} #progress{width:0;height:100%;background:black} </style> <div id="progress-holder"> <div id="progress"></div> </div> <script> var progress = document.getelementbyid('progress'); function updatevalue(perc) { progress.style.width = perc+'%'; } updatevalue(40); </script> its simple , updatevalue() function can change progress value ... want add slant line progressbar do know that? or existing script? :) you can use bootstrap. bootstrap lets define progress bar easily. check this . note not available in ie9 , below. if want use css3 see this link

javascript - Is it possible to access the prototype variable GLOBALLY -

function person() {} person.prototype.getfullname = function(){ var name = "john micheal"; } var p1 = new person(); console.log(p1.getfullname()); here want access variable "name" other prototypes. possible? if not, there other way ? http://jsfiddle.net/kabeerrifaye/bcxqx1wj/ thanks in advance. you should go javascript tutorials. recommend treehouse or codeschool. anyways, there few possible options / interpretations of question. if you're trying return value need use return keyword. console.log output name. function person() {} person.prototype.getfullname = function(){ var name = "john micheal"; return name; } var p1 = new person(); console.log(p1.getfullname()); if want share value between functions need use this keyword. in example can set value in setname , retrieve getname . function person() {} person.prototype.getname = function(){ return this.name } person.prototype

mongodb - io_stream.lo Error 1 when installing php extension -

i'm trying install mongo php extension on osx 10.11 command: sudo pecl install mongo gives following error: ... in file included /private/tmp/pear/install/mongo/io_stream.c:34: /private/tmp/pear/install/mongo/contrib/php-ssl.h:33:10: fatal error: 'openssl/evp.h' file not found #include <openssl/evp.h> ^ 1 error generated. make: *** [io_stream.lo] error 1 error: `make' failed brew install openssl ln -s /usr/local/cellar/openssl/1.0.2d_1/include/openssl /usr/local/include/openssl

mobx - Injecting Store in React component results in Error -

i trying inject store react component getting following error: undefined not function (evaluating 'decorator(target,property,desc)') in app.js have: import react, { component } 'react'; import poolcomponent './app/components/poolcomponent'; import measurementsstore './app/stores/measurementsstore'; export default class poolapp extends component { render() { return ( <poolcomponent store="measurementsstore"/> ); } } in poolcomponent.js import react, { component } 'react'; import { observer, inject } 'mobx-react'; import { appregistry, text, view, textinput , picker, button} 'react-native'; @observer export default class poolcomponent extends component { saveitems() { console.log('pressed save'); } render() { const store = this.props.store; return ( <view> <text>selecteer pool</text> <picker>

c# - How to display a list of available meeting rooms at present using Microsoft Graph API -

Image
i have been trying play around microsoft graph api. have situation here. have assigned meeting rooms email id , want know availability of all. if rooms available , should name of meeting room , if possible , duration room available. want know how query multiple rooms , return data. a bit confused following apis, these ? https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/user_findmeetingtimes https://graph.microsoft.com/beta/me/calendar i have assigned meeting rooms email id , want know availability of all. the findmeetingtimes api should suit scenario. assigned meeting rooms, can list them inside locationconstraint parameter of request body, assigned attendee email id, can add attendees parameter of request body. response of api return list of meeting time suggestions based on meeting rooms available , attendees available. , the names of rooms available listed on "locations" of every suggestion. you can test api example insid

javascript - Reload div and set events in jQuery -

i try load div via jquery , want set click-event on dynamically created element makes request php-script , reloads div. unfortunately events aren't set after reload. code far looks this: $(document).ready(function () { $("#incomplete").load("incompletetasks.php", '', function () { //setting click-events $(".btn_aufg").click(function () { window.alert($(this).attr("id")); var encoded = encodeuricomponent($(this).attr("id")); //marking task completed... $(this).load("taskworker.php?action=complete&id=" + encoded); //reloading div $("incomplete").load("incompletetasks.php"); }); }); }); how can activate event again after user has clicked on button? do this... $(document).("click",".btn_aufg",function () { var encoded = encodeuricomponent($(this).a

Error:null value in entry: destinationDir=null in android studio -

when want generate application in android studio makes mistake: error:null value in entry: destinationdir=null it right yesterday, has problem today. clean , rebuild project doesn't work.

joomla 3.5 creates multiple duplicates of articles -

i have joomla 3.5 website @ point started show strange behaviors. in back-panel, articles have been duplicated around 20 times , each set of suplicated articles share same id (i checked db , correctly contains 1 entry each article). problem happens when create new article, since system creates lot of copy of it. not able delete duplicated copies, because action (publishing, unpublishing, trashing, ...) apply 1 of copy, affects other ones (which makes sense since share same id). ideas? it seems have touched query presents list, namely join because if not set correctly has several occurring repeated times, same id. activate joomla debugging , see query generates list try out find error.

javascript - Show a leading zero if a number is less than 10 -

possible duplicate: javascript equivalent printf/string.format how can create zerofilled value using javascript? i have number in variable: var number = 5; i need number output 05: alert(number); // want alert display 05, rather 5. how can this? i manually check number , add 0 string, hoping there's js function it? there's no built-in javascript function this, can write own easily: function pad(n) { return (n < 10) ? ("0" + n) : n; }

java - How to read and write data in 2 different child at the same time in Firebase -

i trying develop android app need send data firebase db having it's schema mentioned below: { "usercart": { "unique_id": { "book": [ "book_id1" : { "book_title": "abc", "book_url": "imageurl", "chapters_purchased": [ // multiple chapters "chapter_3": { "chapter_title":"title3", "chapter_page_count":"16" }, "chapter_4": { "chapter_title":"title4", "chapter_page_count":"18" } ] },

excel vba - run time error - Your network access was interrupted Error in VBA -

i have small excel macro uses ado connection fetch data ms access database. while writing code following error started appearing. tried closing excel work book , open again , close access database , open again error still coming. the excel file , access database both in same folder on c drive. run time error - 2147467259 (80004005) : network access interrupted. continue close database, , open again dim cn adodb.connection dim ors adodb.recordset set cn = createobject("adodb.connection") dbpath = "c:\[databse path]" & "\[database name].accdb" dbws = "[excel sheet name]" scn = "provider=microsoft.ace.oledb.12.0;data source=" & dbpath dsh = "[" & "[excel sheet name]" & "$]" cn.open scn dim ssql string dim f integer ssql = "select 'w',a.[subledger],null,sum(a.[amount]) gl_table a.[opex_group] = 10003 , year(a.[g/l date]) = " & year(sheets("repairs").ce

Filename PHP conventions -

i've developed many web applications on past time , never found myself adhering naming conventions when comes filenames. have php view can add users. here suggestions used on time , , that. so, there convention or arbitrary? user_add.blade.php users_add.blade.php user_add.blade.php add_user.blade.php add_users.blade.php useradd.blade.php adduser.blade.php the file naming system arbitary. there no particular method of naming file. use like. there restrictions in naming class or writing variable. there no standard naming conventions

sql - Confusion to form MySQL Primary & Foreign Key constraints -

i'm bulding website instructors upload courses , publish them. i'm planning database , have few questions in mind. consider following tables: instructors(id(pk), fullname, email, password, created, updated) categories(id(pk), title, description, created, updated) courses(id(pk), cat_id(fk), instructor_id(fk), title, description, created, updated) lessons(id(pk), course_id(fk), title, description, duration, created, updated) i have made basic relationships between said tables. questions are: i want check category of particular lesson . i want check lessons belong particular category . would fine if put category_id foreign key in lessons table? way able lessons in category joining tables. reverse relationship, can select category by selecting course . please me out. in advance. if lesson has 0 or 1 "categories", can put category_id in lessons . appropriate , correct. if lesson have multiple categories, need junction table: create tab

html - Bootstrap card not formatting correctly on mobile -

Image
i using 'cards' bootstrap. see quote, known , contact information gets pushed way out , can see without scrolling pictured below; and more downsized use on mobile device show small avatar icon push quote , information right not down here fullsized preview: here card block code: <div class="container"> </br> <div class="card" style="box-shadow: 2px 2px 1px grey;"> <div class="card-header bg-dark"> <h6 style="color:#fff; text-shadow: 1px 2px 1px rgba(0,0,0,0.3);"><?php echo $row['job_description'];?><small style="font-size:16px;"> - relation</small></h6> </div> <div class="card-body"> <div class="media"> <!-- card --> <div class="media-left"> <div class="card"