Posts

Showing posts from September, 2013

jquery - display button after user choose options in multiple dropdown -

i want display button after user chooses option in every dropdown list. thank's help. button <button class="generate">generate iframe</button> dropdown lists <form id="video_selection"> <select id="select_video1" onchange="changevideo1()"> <option>vidéo 1</option> <?php foreach($id $video1) { $videoid1 = $video1['id']; $videolink1 = $video1['link']; ?> <option id="video1_iframe" value="<?php echo $videolink1;?>"><?php echo $videolink1;?></option> <?php } ?> </select> <select id="select_video2" onchange="changevideo2()"> <option>vidéo 2</option> <?php foreach($id2 $video2) { $videoid2 = $video2['id'];

php - Call view script of (parent) Abstract controller Zend -

i have parent (abstract) controller, have 2 child controllers extending abstract controller. have action common in both child controllers, hence implemented in abstract controller. the problem when call action 1 of child controllers (e.g. /module/child1/commonaction), action call pass through base controller , after executing functionality, looks view script. have common view script under folder name same of base controller, underlying zend mechanism looks view script in directory named after child controller (in case looks child1/commonaction.phtml) though have view script in basecontroller/commonaction.phtml. how can render view script under base controller directory? the easiest way within action disable default viewrenderer , render file yourself. // coerce view view renderer. $viewrenderer = zend_controller_action_helperbroker::getstatichelper('viewrenderer'); $viewrenderer->initview("/path/to/base/controller"); $this->view = $viewrendere

sql - Record not insert in table, INNODB table is full in MySql Database -

i created table engine innodb enginge os ubuntu. table structure : #id int(11), userid int(11), tokens varchar(100), created_date datetime current table detail data rows 42180773 data free 661651456 data length 2578464768 index length 3842785280 auto increments 72437133 i remove old rows able insert new records. issue table?

javascript - Combine each element of a string with the second string -

i have 2 strings [a,b,c] //there number of items in these 2 strings [x,y,z] i want output this a[x,y,z] b[x,y,z] c[x,y,z] not quite able logic output. to array use map() var s1 = '[a,b,c]', s2 = '[x,y,z]'; console.log( s1 .slice(1, -1) // remove `[` , `]` .split(',') // split based on `,` .map(function(a) { // iterate , generate array return + s2; }) ) to string use reduce() var s1 = '[a,b,c]', s2 = '[x,y,z]'; console.log( s1 .slice(1, -1) // remove `[` , `]` .split(',') // split based on `,` .reduce(function(a, b) { // iterate , generate string return + (a.length ? '\n' : ' ') + b + s2; }, '') )

plsql - Difference between bulk exceptions and normal exceptions in oracle.please explain with example? -

please explain difference bulk exception , normal exception. conditions use bulk exception? bulk exceptions exceptions have captured bulk collect statement in pl/sql. there no fundamental difference between bulk exceptions , normal ones, , fundamental difference ... or how ... thrown. how exceptions handled. bulk collect allows collect multiple exceptions rather terminating operation on first exception. reference: http://www.databasejournal.com/features/oracle/bulk-exceptions-in-oracle.html

html - Align div in li as center -

here fiddle: https://jsfiddle.net/5jnnutg8/ my question how can align "something #" list items center , inline. 1 can see "hi" title aligned in center using text-align: center in css, doesn't seem work list items. is there pure css way of doing without messing around <div> , <ul> , , <li> structure, using plugin wordpress , pain change this. i want "something #" list items centered aligned, , if browser resized "something 3" drops down still centered -- hope makes sense. thanks! do not use float: left , use display: inline-block; li { display: inline-block; } working demo .list-holder { background: black; height: 100px; color: white; text-align:center; } .div-list-item { background: red; color: black; margin-left: 10px; } .ul-class { list-style: none; padding: 0; } li { display: inline-block; } { display: black; } <div class="

windows phone 8 - XAML ProgressRing doesn't stop -

my problem progressring running time. use mvvm. progressring active when app new data. i have code in vm (i updated viewmodel): public class mainpageviewmodel : observablecollection<admodel>, isupportincrementalloading{ private visibility _loadervisibility; public visibility loadervisibility { { return _loadervisibility; } private set { _loadervisibility = value; }} public iasyncoperation<loadmoreitemsresult> loadmoreitemsasync(uint count) { coredispatcher coredispatcher = window.current.dispatcher; return task.run<loadmoreitemsresult>(async () => { await coredispatcher.runasync(coredispatcherpriority.normal, () => { this.loadervisibility = visibility.visible; }); var newads = new observablecollection<admodel>(); do{newads = await loadads();//get data api}

algorithm - Finding at least one common node in two lists with different lengths -

as title says, i'm looking efficient (not best) way find common node (one enough) in 2 lists. what know lists is, have 2 lists different lengths , somewhere got common node. point common node is, both lists merge accord each other point. i haven't written down code , won't because first need sure if way work. makes me unsure step 4: find out length of first list. find out length of second list. take bigger list , subtract smaller list (i call solution x). take longer list , run through first node x-th node ==> both lists should (!) have same number of nodes. now can run through both lists simultaneously till found common node. do think it's ready coded? :)

Manually convert XML SOAP response into PHP array -

i'm trying convert xml soap response php array, here xml soap response: string(1182) "<auctionlist isvalid="true" totalrecords="90"> <auction id="112906125" name="softwaresystems.co" traffic="0" bidcount="0" price="$11 usd" valuationprice="-" timeleft="17m 9s" rowid="1"/> <auction id="112557715" name="softwareintec.info" traffic="0" bidcount="0" price="$8 usd" valuationprice="-" timeleft="18m 9s" rowid="2"/> <auction id="101835614" name="softwareruleta.com" traffic="20" bidcount="0" price="$25 usd" valuationprice="-" timeleft="24m 9s" rowid="3"/> <auction id="112573759" name="softwareintec.com" traffic=&quo

curl - Uploading a file to http(s) server using POST request through libcurl in c -

i want upload file http server post request, using libcurl. static int copy_to_http_server(char *src, char *disp_src, char srcflag, char *dst, char *disp_dst, char dstflag) { curl *curl; curlcode res; char *url = disp_dst; char *outfilename = src; struct curl_httppost *formpost=null; struct curl_httppost *lastptr=null; struct curl_slist *headerlist=null; static const char buf[] = "expect:"; /* src = /users/play/team.jpg * url = http://10.1.2.3/repo/team_server.jpg * want 'src' copied under 'repo' directory on http server , * file name on server should team_server.jpg or team.jpg * fine */ curl_global_init(curl_global_all); /* fill in file upload field */ curl_formadd(&formpost, &lastptr, curlform_copyname, "sendfile", curlform_file, src, curlform_end); /* fill in filename field */ curl_formadd(&

php - Update only part of the column - multiple rows -

as part of migrating website https, i'm changing http urls in blog articles relative urls. current data in articles table: ╔════╦═══════════════════════════════════════════════════════════════╗ ║ id ║ content ║ ╠════╬═══════════════════════════════════════════════════════════════╣ ║ 1 ║ lorem ipsum <a href='http://www.example.com/'>link</a> etc ║ ║ 2 ║ see more <a href='http://www.example.com/page.html'>here</a> ║ ║ 3 ║ bla bla bla <img src='http://www.example.com/image.jpg' /> ║ ╚════╩═══════════════════════════════════════════════════════════════╝ desired output relative urls: ╔════╦═══════════════════════════════════════════════════════════════╗ ║ id ║ content ║ ╠════╬═══════════════════════════════════════════════════════════════╣ ║ 1 ║ lorem ipsum <a href='//www.example.com/'>li

osx - IntelliJ idea OS X weird color transformation -

on os x 10.11 , intellij 15, colors affected color profile set in display preferences on os x. weird becasue on sublime text, clion , webstorm colors arent affected, , have same monokai theme ported across them. have solution this? when set profile apple rgb colors same in intellij but, want use callibrated profile. when using profile , using os x color picker, backgorund in sublime 39, 40, 34, , intellij 52,53,46 ( i.e. multiplied ~4/3) in intellij preferences there 39, 40, 34. could tell me why multiplies colors 4/3, , how turn off? intellij idea 15 runs on apple jdk 6 default. apple jdk 6 renders graphics through quartz, applies gamma correction output. newer versions of intellij idea run on openjdk 8, uses opengl , not apply additional gamma correction.

c++ - How to compile dlib under make with multiple files? -

recently i've been trying add dlib library project (i interested in mpc part since want control quadrocopter), despite many different approaches couldn't find proper working solution. have makefile this: all : quadro_mini cxxflags = -std=c++11 -lpthread -o3 #-wall -pedantic libraries = -impu6050 -lmpu6050 -ihcsr04 -lhcsr04 objs = steer.o measurer.o logwriter.o server.o functions.o engine.o enginesmanager.o main.o hdrs = server.h measurer.h logwriter.h functions.h steeringsignalslistener.h engine.h enginesmanager.h constants.h steer.h $(objs) : $(hdrs) quadro_mini : $(objs) g++ -pthread $^ $(libraries) -lmpu6050 -lhcsr04 -dlib_no_gui_support -o $@ i want use dlib in steer.o module first approach linking header containing necessary includes objs = measurer.o logwriter.o server.o functions.o engine.o enginesmanager.o main.o dlib/control.o #nazwy sie musza zgadzac z nazwami *.cpp *.h hdrs = server.h measurer.h logwriter.h functions.h steeringsignalslistener.

c# - Antlr grammar for parsing C source code files and getting functions from them -

i wrote antlr grammar parsing functions c source code files: grammar newcfunctions; options { language = csharp; } @parser::namespace { generated } @lexer::namespace { generated } func :function+ { console.writeline("hello"); } //this debugging ; name :[a-za-z]+[a-za-z0-9]* ; typename : 'void' | [a-za-z]+ | 'char' | 'short' | 'int' | 'long' | 'float' | 'double' | 'signed' | 'unsigned' | '_bool' | '_complex' | '__m128' | '__m128d' | '__m128i' | name ; arguments : (typename name)* ; newline : '\r'? '\n' ; functionbody : ([a-za-z0-9]|newline)*; function : typename ' ' name '(' arguments ')' ' '? newline? '{' functionbody '}' newline? ; i gener

virtualbox - "vagrant up" failing: Vagrant VM failed to remain in the running state -

the command vagrant up failing , don't know why. $ egrep -v '^ *(#|$)' vagrantfile vagrantfile_api_version = "2" vagrant.configure(vagrantfile_api_version) |config| config.vm.box = "precise32" end $ vagrant bringing machine 'default' 'virtualbox' provider... [default] importing base box 'precise32'... [default] matching mac address nat networking... [default] setting name of vm... [default] clearing set forwarded ports... [default] creating shared folders metadata... [default] clearing set network interfaces... [default] preparing network interfaces based on configuration... [default] forwarding ports... [default] -- 22 => 2222 (adapter 1) [default] booting vm... [default] waiting vm boot. can take few minutes. vm failed remain in "running" state while attempting boot. caused misconfiguration or host system incompatibilities. please open virtualbox gui , attempt boot virtual machine manually more informative

ember.js - How to use valueBinding for toggle radio buttons? -

i have posted code here . here have used radio button define gender. <div class="control-group"> <label class="control-label">gender</label> <div class="controls"> <p><div id="gendertype" name="gender" class="btn-group rdgender" data-toggle="buttons-radio"> <button type="button" class="btn btn-info">male</button> <button type="button" class="btn btn-info">female</button> </div></p> </div> </div> i want implement binding in such way should support existing implementation of crud functionality. but not able implement binding radio button in scenario(refer provided fiddle). can tell me how implement binding toggle radio buttons in scenario? you can create view

html - Align <div> with display inline or inline-block without width -

Image
in project have row "user name", "company phone" , "logo". asked align company phone in middle between "logo" , "user name". have problem this, because user name can between 5 , 30 characters long, can't give fixed width. company phone image (not text). please help! can't find works example. thanks. you can use flexbox: .container { display: flex; } .phone { flex-grow: 1; /* grow fill avilable space */ text-align: center; /* center contents */ } <div class="container"> <div class="logo">logo</div> <div class="phone">1-999-999-999</div> <div class="name">user name</div> <div class="exit">exit</div> </div> <div class="container"> <div class="logo">logo</div> <div class="phone">1-999-999-999</div> <div

javascript - Add dynamic input field in ajax -

is there way put dynamic input inside ajax? using hayageek jquery file upload. wanted add input hidden inside form upload replacing file. appreciated. the div handles upload: <div id="replacefile">upload</div> i wanted put: <input type="text" name="replace"> $("#replacefile").uploadfile({ url : newurl, filename : "myfile", returntype : "json", dragdrop : true, showfilecounter: false, // show numbered list of file allowduplicates: false, multiple : true, //allow multiple file upload showfilesize : false, // show file size acceptfiles : "doc,pdf", onsuccess : function(files,data,xhr,pd) { // success }, onerror : function() { // error } }); $("#replacefile").uploadfile({ url : newurl, filename : "myfile", returntype :

objective c - Issues of pointing to same or different objects -

let's see example: scenario 1: nsstring *str1=@"hello";// str1 points literal string @"hello" nsstring *str2=[[nsstring alloc] initwithstring:str1]; nslog(@"%p %p",str1,str2);// str1 , str2 both point same object scenario 2: nsstring *str3=[[nsstring alloc] initwithformat:@"hello"]; nsstring *str4=[[nsstring alloc] initwithstring:str3]; nslog(@"%p %p",str3,str4);// str3 , str4 point different objects i want know difference between scenario 1 , 2. it implementation detail (and indication there optimization foundation could isn't). you should never assume 2 objects equal or unequal based on pointer equality. pointer equality useful checking if literally same object. isequal: must used check if semantically identical. under covers, foundation knows @"hello" constant string , creating second immutable string constant string can return constant string. it assuming initwithformat: p

Update All Records in Rails Database -

i making app in users place bets on future scenarios "who win american idol?" the user places bet (referred in code prop). then later, admin chooses correct answer editing answer of bet. i want then, check in database see whether answer each user has matches answer admin has provided. i trying this def update @user = user.find(session[:user_id]) @prop = prop.find(params[:id]) @answer = answer.find(params[:id]) @prop.update(prop_params) user.all.map { |user| #the code here called once each user # user accessible 'user' variable if @answer.choice == @prop.choice puts "hello" @user.score += 7 @user.save else @user.score -= 7 @user.save end } end what best way accomplish goal? it should this: def update @user = user.find(session[:user_id]) @prop = prop.find(params[:id]) @answer = answer.find(params[:id]) @prop.update

html - Bootstrap drop down not working laravel twig -

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <link href="https://fonts.googleapis.com/css?family=lato:100" rel="stylesheet" type="text/css"> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1q8mtjoasx8j1au+a5wdvnpi2lkffwweaa8hdddjzlplegxhjvme1fgjwpgmkzs7" crossorigin="anonymous"> <li class="navbar-right"> <a data-toggle="dropdown" href="#"> <span class="caret"></span></a> <ul class="dropdown-menu"> <li><<a href="{{ url('/logout') }}">logout</a></li> </ul> </li> when click on drop down arrow takes m

Importing Form from C++ project to C# project -

i made simple windows forms app in c++ recently. got new assignment make same program in c#, need rewrite it. problem have form. it's quite complex , don't want put these texboxes , buttons once again. how can import form? it's design of it. please, tell me should step-by-step make work. so... used ctrl+a select items , copy-pasted them new form @cody gray suggested. expected items become mess , have names , properties reset, didn't happen. well, simplest solutions best. thank though question trivial. maybe it's going in future.

using array of object in firebase -

firebase recommended storing data in object . but found hard fit want. - want size of object. - first object - , last object. does firebase support on object? it's not easy retrieve size of object without storing (and updating) separately @ moment. you can retrieve first object in list using ref.startat().limit(1) , last object using ref.endat().limit(1) .

vba - Excel "Do While" Loop Not functioning correctly after first iteration -

i have sub light formatting, , need evaluate , count whether column contains "1" or nothing, , if column has header isnumeric or not. first iteration of do...until loops functions should. however, if try run second time, throws active cell way rightmost column in worksheet (xfd). have total of 114,000 rows need loop through. please see code below, first loop; need nested inside loop cycling through rows: sub totalbookcountsprocess() dim ws excel.worksheet dim numberedbooks integer 'total number of physical books dim virtualbooks integer 'total number of virtual books dim firstbookcol integer 'first column book number dim ispeeccol integer 'ispec column dim lastworksheetcol integer 'last column in worksheet after adding total book count columns dim loopcoloffset integer 'offset column amounts new row reset after loop dim lastitem string 'last item number in last row of worksheet activecell.end(xldown)

ios - Using in-app purchases for glances and complications in WatchKit -

i making native apple watch app, , wondering if can have glances , complications available users have paid in-app purchase. also, if have not upgraded in-app purchase, when go glance, or click on (disabled) complication, view show saying: "please upgrade pro complications , glances". , there button saying "go app", open app on phone, in-app purchase button be. is possible? from developer's perspective: is possible developer? yes. in regard complication controller, return timeline entries based on existence of valid receipt. since storekit isn't available on watch, phone have had validate receipts, provide details watch. you need handle edge cases, such when in-app purchase state indeterminate complication controller (since launches in background before watch app has been launched first time). complication controllers aren't designed asynchronously fetch (from phone or network). it's expected data on hand, , return results da

codeigniter - php framework for part of website -

i have little experience web development. have used codeigniter in past. realize using framework allows structured project, aimed @ entire site. have situation have been asked out on site not use framework. site entirely static. have been asked develop form registration, include sql interaction. love use codeigniter form application not know how add existing site. create folder called 'contact' in public html folder. put main index.php of codeigniter in folder if able - above server root public html folder - put codeigniter system folder , application folder. protip - rename folders version and/or , - if download version 3.07 of codeigniter label them: system307 appcontact ok contact folder , index.php file - application , system folder paths - change these like $system_path = '../../system307'; $application_folder = '../../appcontact'; in contact folder make htaccess file like rewriteengine on rewriterule ^(application) - [f,l] rewritec

css - How can I create div with an opposite-curved bottom -

Image
so found question: can create div curved bottom? thanks managed make curved bottom of image, using code below: border-radius: 0 0 50% 50% / 15%; overflow: hidden; it looks like that : (practically). nice but... need curve totally opposite way : how can clean css? try this: div { height: 250px; width: 300px; background: tomato; position: relative; margin:0 auto; } div:after { content: ""; height: 50%; width: 100%; position: absolute; background: white; border-radius: 50%; bottom: -25%; transition: 0.8s; } <div></div>

java ee - After running project couple of times, WELD-001303: No active contexts for scope type javax.enterprise.context.RequestScoped -

after run project couple of times, began trow me error: "weld-001303: no active contexts scope type javax.enterprise.context.requestscoped". but if close , reopen netbeans project work again, couple of times...what seems problem?

while loop - How to go back to menu using case in switch case in C -

how go menu using case in switch case without using goto command. sample: while(1){ printf("1: basic math\n2. intermediate math\n3. advance math"); printf("enter choice: "); int choice; scanf("%d", &choice); switch(choice) int thechoices; case 1: printf("1. add\n 2. subtract\n3. go menu"); scanf("%d", &thechoices); switch (thechoices) { case 1: //calculation ... case 2: //calculation ... case 3: // go menu basic math, intermediate math, advance math // ***** want know how main menu. ***** case 2: // .... // .................... so question again how menu using case 3. when try using keyword break, automatically close program when chose case 3. please help. use continue; instead. jump out of case s , continue executing code after them, make program return first line after while (1) . don't for

Log-Return simulation in R does not lead to expected result -

i'm trying simulate log-returns in r , calculate expected p&l simple investment. code working, have problem in understanding why expected profit not equal to: (exp(annual_mean * (holding_period/253)) * investment) - investment which equals 5350 in example. however, running following simulation results profit of around 5580: investment <- 1000000 holding_period <- 45 annual_mean <- 0.03 annual_sd <- 0.05 simulations <- 1000000 # create matrix log-returns paths <- matrix(data = na, nrow = holding_period, ncol = simulations); # feed matrix log-returns (k in 1:simulations) { returns <- rnorm(holding_period, mean = annual_mean/253, sd = annual_sd/sqrt(253)); paths[, k] <- investment * exp(cumsum(returns)); } # calculate epnl epnl <- mean(paths[holding_period, ] - investment); print(epnl) considering high number of simulations wouldn't expect such big deviation expected profit. tried higher number of simulations

laravel - Eager-loading only some of the properties -

i have 2 models: question , answer . question has-many answers. eager-load question's answers, 1 must write this: $question->load('answers'); however, of answers' properties loaded way. following code, while illustrating want achieve, not work: $quesiton->load('answers')->select('id', 'body') so, how can eager-load questions' answers respective id , , body properties? you should try this: $question->load(['answers' => function ($query) { $query->select('id', 'body', 'question_id'); }]); as see might not enough load id , body . assuming have answer model question_id field, should specify in select otherwise answers won't assigned questions.

Checking if an Android application is running in the background -

by background, mean none of application's activities visible user? there few ways detect whether application running in background, 1 of them reliable: the right solution (credits go dan , commonsware , neteinstein ) track visibility of application using activity.onpause , activity.onresume methods. store "visibility" status in other class. choices own implementation of application or service (there a few variations of solution if you'd check activity visibility service).   example implement custom application class (note isactivityvisible() static method): public class myapplication extends application { public static boolean isactivityvisible() { return activityvisible; } public static void activityresumed() { activityvisible = true; } public static void activitypaused() { activityvisible = false; } private static boolean activityvisible; } register application class in androidmanifest.xml : <appli

c# - UWP: is there a method to close a currently open folder? -

i able find method open/launch folder: await launcher.launchfolderasync(folder); but couldn't find method close it. exist? thanks. according documentation launchfolderasync method open given folder in file explorer. so close operation not make sense in context , not exist because cannot close other applications (nor should you) app. if expect show contents of folder in file explorer, should fine using code have , don't have worry closing folder.

actionscript 3 - How can i remove extra black space in a movie clip in flash -

in flash cs6 or cc when convert image movie clip no matter kind of image take e square shape space. lets pyramid shape image has 2 side, narrow side , wide side if convert movie clip taking square shape space in both side. (narrow side) its creating big problem in game use (hittestobject) . there way solve it.

javascript - Large Visual Digit Counter -

i'm trying reuse code existed in theme used while back. can't seem work on own. it should take value in html , animate digits counter, quickly. see example: https://jsfiddle.net/96roocq1/5/ or js/css/html below: <div class="counter_holder center" style="color:#ffffff; font-size:168px;"> <span class="counter type1" data-delay="" style="background-color: black; height:168px; line-height:168px;">1678</span> </div> .counter_holder { display: block; opacity: 0; filter: alpha(opacity: 0); -webkit-transition: opacity 0.3s ease 0s; -moz-transition: opacity 0.3s ease 0s; -o-transition: opacity 0.3s ease 0s; width: 100%; font-size: 150px; line-height: 150px; } .counter_holder.left { text-align: left; } .counter_holder.right { text-align: right; } .counter_holder.center { text-align: center; } .counter_holder span.counter { font-family: "oswald", sans-seri

php - Idiorm - Fatal error: Class 'Controller\ORM' not found -

i using idiorm , looking update row column name 'path' in $image = orm::for_table('shop_product_images')->find_one($productid); $image->path = '/img/shop/products/'.$name; $image->save(); however when ran, response error is: fatal error: class 'controller\orm' not found which points top line of query. i should note create query works correctly: $image = \orm::for_table('shop_product_images')->create(); $image->productid = $productid; $image->path = '/img/shop/products/'.$name; $image->save();

java - ClassNotFoundException org.springframework.orm.hibernate4.support.OpenSessionInViewFilter -

i done solve own, searched on internet , nothing helped since then. building web application using java/spring/hibernate/tomcat and, @ session filter in web.xml, getting error: java.lang.classnotfoundexception: org.springframework.orm.hibernate4.support.opensessioninviewfilter @ org.apache.catalina.loader.webappclassloaderbase.loadclass(webappclassloaderbase.java:1333) @ org.apache.catalina.loader.webappclassloaderbase.loadclass(webappclassloaderbase.java:1167) @ org.apache.catalina.core.defaultinstancemanager.loadclass(defaultinstancemanager.java:520) @ org.apache.catalina.core.defaultinstancemanager.loadclassmaybeprivileged(defaultinstancemanager.java:501) @ org.apache.catalina.core.defaultinstancemanager.newinstance(defaultinstancemanager.java:120) @ org.apache.catalina.core.applicationfilterconfig.getfilter(applicationfilterconfig.java:258) @ org.apache.catalina.core.applicationfilterconfig.<init>(applicationfilterconfig.java:105) @ org.apache.catalina.core.standardcont

Reading Many CSV Files at the Same Time in R and Combining All into one dataframe -

i have 20 .csv files , of them have equal number of row/col (1 row , 42 columns). want make dataframe out of them , have each csv file 1 row of dataframe , have name of csv file row name. possible this? to illustrate example: a.csv 10 21 32 45 b.csv 33 45 93 90 c.csv 12 93 na 21 resulting dataframe looking be: a 10 21 32 45 b 33 45 93 90 c 12 93 na 21 both data.table ( rbindlist ) , dplyr ( bind_rows ) have functions this. preferred solution use readr::read_csv dplyr::bind_rows this: library(readr) library(dplyr) bind_rows( lapply( list.files( "path/to/csv_files", pattern = ".csv", full.names = true ), read_csv, header = false, na_strings = c("na") ) )

mysql - How do you update/add to SQL tables with bash commands? -

need add snmp information sql database , update on regular schedule. snmp info can queried bash commands. you can use bash commands write insert statements file, pipe file mysql program. say have file looks this: key1,1.0 key2,1.4 key3,1.9 key4,2.0 key5,3.5 you can pipe bash script looks like: #!/bin/bash while read key, value; echo "insert sometable(key, value) values('$key' $value);" done >/tmp/inserts.sql mysql </tmp/inserts.sql >/tmp/inserts.out if data comes somewhere else same principle, generate sql commands file , pipe them mysql. this strategy isn't kludgy might seem @ first. mysql's own mysqldump backup utility dumps database file in form of sql statements.

javascript - Different design desktop/mobile devices -

i hope there answer question. i'm not @ codeing , hope understand question. is there way have 2 different designs.. have design desktop/ipad , 1 mobile devices. 1 mobile device more design of application. want if javascript code find out website opened on mobile device, website turn version mobile device. for example: desktop/ipad version index.html , mobile version mobile.html is there way make javascript code go mobile version if if(!is_mobile) { (function(xxxxx) { xxxxxx } the following javascript code useful: function adjuststyle(){ var width = 0; //getting width of webpage if(window.innerheight){ width = window.innerwidth }else if(document.documentelement && document.documentelement.clientheight){ width = document.documentelement.clientwidth; }else if(document.body){ width = document.body.clientwidth; } //loading css if width less 600. make sure link tag has id "

networking - Numerical on Distance Vector Algorithm -

Image
i solving assignment on routing protocols , following question came up. unable come solution. please help. a network of 4 routers a, b, c , d arranged this: a_____b_____c_____d 3 2 1 the routers use distance vector routing, using number of hops metric. value “8” used routers indicate “infinity” (to conclude router unreachable). the link c-d goes down. a. how many exchanges require each of them conclude d unreachable? @ each exchange, show distances routers maintain router d. b. assume routers follow split horizon. how many exchanges needed routers conclude d unreachable? @ each exchange, show distances routers maintain router d. i wrote hand, hope legible. solution part (a).

math - Calculate forward and up vectors from euler position and rotation? -

i have object in 3d space have euler position , rotation. how can calculate forward , vectors information have? i know can calculate forward vector in way: vector3 forward = (target.getposition() - object.getposition()).normalize(); .. target point along axis object looking. using information have, how can pick arbitrary point in way normalize? i'm not sure how go solving "up" vector @ all. first create transform matrix euler angles (with same method using while rendering). extract axises vectors forward , directly. example view matrices uses z axis forward/backward , x axis left/right use two. find location of vectors here: understanding 4x4 homogenous transform matrices

java - Migrate EMF / GMF based eclipse 3 plugins to RCP -

some time ago created graphical editor gmf ( xsd->ecore->emf->gmf). additionally created plugins different views, launchers (debugger) , more. all plugins created eclipse helios. now, create rcp application out of plugins. did lot of internet research still not understand how begin. i read tutorial ( http://www.vogella.com/tutorials/eclipsercp/article.html#plugin_creatinge4 ) still not sure do. if told in tutorial, have build windows, editors, menus , on manually, correct ? and if so, how default eclipse features in rcp application, like: create empty project, starting "new diagram" wizard, double click diagram file in project view open editor...and on... do have build features manually application model file ?? i use pointers right direction. thanks in advance! the tutorial have found describing new e4 api. not support lot of older 3.x compatibility apis not suitable using build rcp uses plugins based on 3.x. e4 api building new rcps don&#

ios - Swift: UITextField resignFirstReponder() error -

Image
this code, drives me crazy: lazy var currentedit: uitextfield! = nil ... func cancelclicked() { self.navigationitem.rightbarbuttonitems = nil let setupbutton = uibarbuttonitem(title: "bearbeiten", style: uibarbuttonitemstyle.plain, target: self, action: #selector(detailviewcontroller.toggleediting)) self.navigationitem.rightbarbuttonitem = setupbutton if !self.managedobjectcontext.haschanges && !self.textchanged { // self.textchanged false self.toggleediting() return ... func toggleediting() { if !self.isvalid { return } if self.currentedit != nil { self.currentedit.resignfirstresponder() // error thrown here } i error 2016-05-28 23:04:39.606 visitenkarten[3695:121134] * terminating app due uncaught exception 'nsrangeexception', reason: '* -[__nsarrayi objectatindex:]: index 1 beyond bounds [0 .. 0]' i don´t know why! :-( means [__nsarrayi objectatindex:]: index 1 bey

algorithm - Simple general-purpose hash function for a collection -

please mark duplicate, questions i've found far specific or more complex i'm looking for. e.g. in "what hash function" , accepted answer seems oriented toward hashing strings. i've started programming in .net, , find unfortunate built-in classes lack ability basic things check equality , find hash. i'm sure have design reasons that; no need defend .net. want know how avoid significant sidetrack when need use collection key dictionary. want, example, 2 different list objects containing equal values map same entry in dictionary. out of box, don't: default behavior list list not equal itself, instance of list same values different key. implementing equals straightforward. it's hash function unsure of. is there provided can call in implementation of gethashcode? if have write scratch, what's simple enough hash algorithm? use sha1 think overkill. xor hashes of items, think have nasty collision properties. don't care if computing hashes b

javascript - Using replace() on decoded URI hex codes with native division operator -

building calculator. var process = "6÷6"; // need replace division sign 1 javascript can evaluate process = encodeuri(process); process.replace(/%c3%b7/gi,'/'); // replacement step doesn't work - %c3%b7 shows hex divison sign in chrome debugger, not sure why process = decodeuri(process); result = eval(process); the third line of code wrong. have assign return value of replace function variable. easiest way assign itself: process = process.replace(/%c3%b7/gi,'/'); so whole script code this: var process = "6÷6"; // need replace division sign 1 javascript can evaluate process = encodeuri(process); process = process.replace(/%c3%b7/gi,'/'); // replacement step works process = decodeuri(process); result = eval(process);