Posts

Showing posts from March, 2011

git - Rails app using sqlite3 for development won't deploy into heroku -

i trying deploy rails app created using sqlite3. after running git push heroku master keep getting following error initializing repository, done. counting objects: 164, done. delta compression using 4 threads. compressing objects: 100% (147/147), done. writing objects: 100% (164/164), 78.88 kib | 0 bytes/s, done. total 164 (delta 33), reused 0 (delta 0) -----> ruby app detected -----> compiling ruby/rails -----> using ruby version: ruby-2.0.0 -----> installing dependencies using 1.6.3 running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment fetching gem metadata https://rubygems.org/......... fetching additional metadata https://rubygems.org/.. installing rake 10.3.2 installing i18n 0.6.9 installing minitest 5.3.5 installing thread_safe 0.3.4 installing builder 3.2.2 installing erubis 2.7.0 installing rack 1.5.2 installing mime-ty

c - A variable declaration following an argument list -

this question has answer here: what weird function definition mean? 5 answers reading glibc , saw piece of code in string/strerror.c : char * strerror (errnum) int errnum; { char *ret = __strerror_r (errnum, null, 0); int saved_errno; if (__glibc_likely (ret != null)) return ret; saved_errno = errno; if (buf == null) buf = malloc (1024); __set_errno (saved_errno); if (buf == null) return _("unknown error"); return __strerror_r (errnum, buf, 1024); } note how there int errnum following argument list. how valid syntax? , doing? that's old-style way of doing things, k&r, pre-ansi. once function prototypes introduced, way of doing things rendered obsolete. not actually obsolete since it's still valid in c11 (as per 6.9.1 function definitions /13 ), few people use more). it's specifying typ

mysql - Can't get simple (no encryption) php forgot password form to work -

well, have been @ php/mysql authentication system weeks, piecing tutorials , learning go. @ tricky part password forgot.php page. have little experience phpmail , , there seems many few things fundamentally wrong code. first off, since added code phpmail info, page blank. when working, page go blank after user hit submit. not sure keeping form displaying. also, not sure if going @ correctly in terms of working php password forgot email form. code on login.php: <form action="<?=$_server['php_self']?>" method="post"> username: <input type="text" name="username" /><br /> password: <input type="password" name="password" /><br /> remember me: <input type="checkbox" name="remember" /><br /> <input type="submit" name="submit" value="login" /> <a href="forgot.php">forgot password?</a> &

Creating a matrix in Mathematica with Pure Functions -

i know how create one-dimensional array in mathematica using pure functions , mapping on range. syntax follows: # & /@ range[1,3] this returns: {1, 2, 3} i know how create two-dimensional array similar syntax. two- dimensional array returned be: { {{1, 1}, {1, 2}, {1, 3}}, {{2, 1}, {2, 2}, {2, 3}}, {{3, 1}, {3, 2}, {3, 3}} } the syntax had hoped work is: {#1, #2} & @@ {range[1,3] , range[1,3]} (or similar), instead returns: { {1, 2, 3}, {1, 2, 3} } you can use table[] function create matrix of ordered pairs, pure function syntax seems more dynamic, perhaps.

c# - UPDATE faster in SQLite + BEGIN TRANSACTION -

this 1 related spatilite (not sqlite) i have file database ( xyz.db ) using sqliteconnection ( sqliteconnection extends spatialite). i have many records needs update database. (int y = 0; y < castarraylist.count; y++) { string s = convert.tostring(castarraylist[y]); string[] h = s.split(':'); sqlitecommand sqlqctsql4 = new sqlitecommand("update temp2 set geom = " + h[0] + "where " + dtsqlquery2.columns[0] + "=" + h[1] + "", con); sqlqctsql4.executenonquery(); x = x + 1; } at above logic castarraylist arraylist contains value need process database. when checked above code updating around 400 records in 1 minute. is there way can able improve performance ? note :: (file database not thread-safe) 2. begin transaction let's suppose run 2 (or millions) update st

c# - error in .net reflector -

i have reflected 1 program .net reflector , open in visual studio. 1 item in each form is: bool icontrolbyoptions.get_isdisposed() { return this.isdisposed; } when build solution , has error : 'solo.module.ctrlproductform.solo.base.icontrolbyedition.get_isdisposed()' explicit method implementation cannot implement 'solo.base.icontrolbyedition.isdisposed.get' because accessor. icontrolbyoptions file contents : using system; namespace solo.base { public interface icontrolbyoptions { bool isdisposed { get; } void refreshuifromcompanyorpersonaloptions(); } } how fix error ? try changing implementation to bool icontrolbyoptions.isdisposed { { return this.isdisposed; } } update based on comments. try properties setter. bool ictrltemplateoption.visible { { return this.visible; } set { this.visible = value; } }

java - Custom Mapping with orika -

i using orika mapper mapping fields of source , destination class. i can one-to-one mapping perfectly. i have 2 fields dateofdeparture , dateofarrival in source class. i have calculate difference between these dates , map field "travelduration" in destination class. following mapper class. package com.tcs.orika; import java.text.parseexception; import java.text.simpledateformat; import java.util.date; import java.util.hashmap; import java.util.map; import java.util.concurrent.timeunit; import ma.glasnost.orika.mapperfacade; import ma.glasnost.orika.mapperfactory; import ma.glasnost.orika.converter.converterfactory; import ma.glasnost.orika.impl.configurablemapper; import ma.glasnost.orika.impl.defaultmapperfactory; public class mapper extends configurablemapper { public static void main(string[] args) throws parseexception { /*date calculation*/ simpledateformat dateformat = new simpledateformat("dd-m-yyyy hh:mm:ss")

How to circumvent BigQuery's 20 concurrent queries limitation? -

wondering if knows... or have ran this.. there's 20 concurrent queries limitation bigquery. https://developers.google.com/bigquery/quota-policy#queries is there way disable limit? our mapreduce tasks needs many concurrent queries in order complete within reasonable amount of time. we have similar problem. there no way how change side. "upgrading plan" @dominik suggest won't help. have contact goggle directly, explain problem (business case) , if valid can increase quota limits (for google cloud project)

python - Class definition parameter vs. Normal class definition -

this question has answer here: what difference between old style , new style classes in python? 9 answers what difference between two? don't both of these have same functionality? don't understand whole point of object parameter. class car(object): # object parameter def foobar(): print("hello world!\n") vs. class car(): # no parameter def foobar(): print("hello world!\n") in python 2, former "new-style class" , latter "old-style class" exists backwards compatibility. should never use latter new. in python 3, believe there no difference @ all. can leave out parentheses entirely.

Google Spreadsheet: Wrap all text onEdit -

i have google spreadsheet sheet called wrapped sheet responses collected google form. on every new added response (thus onedit function), want call wrap text option on cells. opened script editor , created onedit.gs following code: function onedit(){ var activesheet = spreadsheetapp.getactivespreadsheet(); if(activesheet.getname() == "wrapped sheet") { var datarange = activesheet.getrange(1,1,data.length,headers.length); datarange.setwrap(true); } } however, function not triggered on new response. additionally, calling manually within script editor not report error. you should go , give google script event docs full read. you'll find out there specific event use case: on form submit. instead of executing code when sheet modified (function onedit(e)) should execute code when form submitted. in same docs can find exemple of how use trigger . note: aware there 2 types of events triggers: simple ones , installed ones. onformsubit event

git - Avoid gulp running a task if file has not changed (multiple user) -

i'm using gulp-changed avoid running task if files didn't change. the images in assets/images , 1 in dest/images committed in git repository. the problem when other peoples run task first time regenerate images. images has bit different because git mark theme modified. how can avoid generating optimizing images **for every user* if original image didn't change. this i'm using right now // optimize image , move them in dest folder gulp.task('images', function () { return gulp.src(['assets/images/**']) // take files changed since last time run .pipe(changed(dest + '/images')) .pipe(imagemin({ pngquant: true, progressive: true })) .pipe(gulp.dest(dest + '/images')) }); it make sense see if source images (assets/images/) have changed rather checking dest versions. i've found gulp-change slow , it's quicker run through them have check first. depends on when , doing it, , how man

How to get the right PHP output on HTML form select tag -

here whole php-code use, until flug: works fine: <?php echo "//bestelldatum: " . date("d/m/y"); ?> <br> <br> <p>--------------------</p> <strong>kundendaten</strong><br> <br> <p>vorname: <?php echo $_post["firstname"];?><br></p> <p>nachname: <?php echo $_post["lastname"];?><br></p> <p>e-mail: <?php echo $_post["mail"];?><br></p> <p>telefon/mobile: <?php echo $_post["phone"];?><br></p> <p>--------------------</p> <p><strong>wünsche/bemerkungen: </strong><br></p> <?php echo $_post["text"];?> <br> <p>--------------------</p> <strong>wunschflug</strong><br> <br> <p>flug:</p> <?php echo $_post["flight"]; ?> and html-code (selcet tag only): <

jquery - How can I get the id from a select2 dropdown -

i want associated id selected value in select2 dropdown. possible? $myselect2.on("change",function(){ var textvalue = $(this).val(); //works console.log($(this).select2('id'));// ???? }); var theid = $(this).select2('data').id; http://jsfiddle.net/platypusman/xduug/

qt - Extending TabViewStyle styleData -

i trying find nicer way this, add icon tab. right piggy backing off styledata.title include icon source, nice able extend styledata can include other custom properties. here current hack: tab { ... title: "home|images/home-75.png" ... } style: tabviewstyle { ... tab: rectangle { ... text { ... text: styledata.title.split("|")[0] ... } image { ... source: styledata.title.split("|")[1] } } } however nicer this: tab { ... title: "home" source: "images/home-75.png" ... } style: tabviewstyle { ... tab: rectangle { ... text { ... text: styledata.title ... } image { ... source: styledata.source } } } here application markup is: import qtquick 2.2 import qtquick.window 2.1 import

html - How to override css grouped styles -

i'm looking way override bootstrap accordian style. .panel-group .panel-heading+.panel-collapse .panel-body { border-top: 1px solid #ddd; } i using accordian inside <div class="settings"><div> . can therefore overide styles settings selector. .settings .panel-heading { padding: 0; border: 0; } but when use settings selector grouped styles @ top doesn't work... .settings.panel-group .panel-heading+.panel-collapse .panel-body { border-top: 1px solid #ddd; } this doesn't work... .settings.panel-group .settings.panel-heading+.settings.panel-collapse .settings.panel- body { border-top: 1px solid #ddd; } please can point me in right direction? if markup looks this: <div class="settings"> <div class="panel-group" id="accordion"> ... </div> </div> then need have space in css selector between .settings , .panel-group indicate descendant ele

xml - How to get the nearest ancestor node based on multiple value -

how nearest ancestor based on multiple choice nodes ? mean: let's assume have lot of tags in xml file : chapter , section , subsection , subsubsection , abstract , others. let's assume on node on level , want see node nearest me based 1 choices have ( chapter , section , subsection , subsubsection ). you can use ancestor::*[self::chapter | self:section | self::subsection | self::subsubsection][1] . if want name use name(ancestor::*[self::chapter | self:section | self::subsection | self::subsubsection][1]) .

ios - Passing string to separate WebViewController doesn't take -

i new objective c , xcode, have come long way in learning following tutorials , searching on stack overflow. have encountered problem can’t seem find solution for. know must doing wrong (perhaps storyboard set incorrectly). attempting load embedded webpage in second scene pressing button in first scene. need button press pass nsstring containing url address. have tried various senders - 1 using is: - (ibaction)websitebuttonpressed:(id)sender { webviewcontroller *destinationcontroller = [[webviewcontroller alloc] initwithstring:self.webinfo]; destinationcontroller.webinfo = _webinfo; } the _webinfo nsstring containing url. the webviewcontroller .h file defines initwithstring follows: - (id)initwithstring:(nsstring *)webinfo; and webviewcontroller .m file contains following code: @synthesize weburl; - (id)initwithstring:(nsstring *)webinfo { self = [super initwithnibname:@"webviewcontroller" bundle:nil]; if (self) { weburl = [webin

Ruby on Rails installation Error on Ubuntu 12.04 -

i installed ruby , rails using rvm. my ubuntu version 12.04 ruby version ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux] rails version rails 4.1.2 rvm version rvm 1.25.27 (stable) after installation create demo application rails new demo when type rake getting below error hadoopnode1@hadoopnode1:~/work/demo$ rake rake aborted! execjs::runtimeunavailable: not find javascript runtime. see https://github.com/sstephenson/execjs list of available runtimes. /home/hadoopnode1/.rvm/gems/ruby-2.1.2/gems/execjs-2.2.1/lib/execjs/runtimes.rb:51:in `autodetect' /home/hadoopnode1/.rvm/gems/ruby-2.1.2/gems/execjs-2.2.1/lib/execjs.rb:5:in `<module:execjs>' /home/hadoopnode1/.rvm/gems/ruby-2.1.2/gems/execjs-2.2.1/lib/execjs.rb:4:in `<top (required)>' /home/hadoopnode1/.rvm/gems/ruby-2.1.2/gems/uglifier-2.5.1/lib/uglifier.rb:3:in `require' /home/hadoopnode1/.rvm/gems/ruby-2.1.2/gems/uglifier-2.5.1/lib/uglifier.rb:3:in `<top (required)>' /

javascript - Remove pagination number after search query -

i want remove pagination number in bootstrap pagination, after search queries. working example here: jsfiddle var $rows = $('#employeestable.table tr.tablebody'); $('#employeesearchbox').bind('keydown keypress keyup change', function () { var val = $.trim($(this).val()).replace(/ +/g, ' ').tolowercase(); $rows.show().filter(function () { var firstname = $(this).find('.employeesfirstname').text().replace(/\s+/g, ' ').tolowercase(); var lastname = $(this).find('.employeeslastname').text().replace(/\s+/g, ' ').tolowercase(); var firstandlastname = firstname.concat(" "+lastname); var lastandfirstname = lastname.concat(" "+firstname); return !~lastname.indexof(val) & !~firstname.indexof(val) & !~firstandlastname.indexof(val) & !~lastandfirstname.indexof(val); }).hide(); $table.find("tbody tr[style='display: table-row;

Facebook FQL nested SELECT field value -

if have query nested query: select name, start_time event creator in (select page_id, name place distance(latitude, longitude, "59.436961", "24.753575") < 100) limit 1 output: { "data": [ { "name": "join club – james werts live", "start_time": "2014-06-29t23:00:00+0300" } ] } so have name of event, how can "name" field in query "place" table? in sql, do: select event.name, place.name event, place but fql quite limited , lets either select ... event or select ... place . so in case, not able place name place table, host field event table, contains same information: select name, start_time, host event creator in (select page_id place distance(latitude, longitude, "59.436961", "24.753575") < 100) limit 1 result: { "data": [ { "name": "join club – james we

ios - NSTimer does not stop when invalidate -

i want check if application idle (user doesn't take action last 30 minutes) , log out user. for have event manager resets timer. - (void)sendevent:(uievent *)event { if(event == nil) { [self resetidletimer]; } else { [super sendevent:event]; // want reset timer on began touch or ended touch, reduce number of timer resets. nsset *alltouches = [event alltouches]; if ([alltouches count] > 0) { // alltouches count ever seems 1, anyobject works here. uitouchphase phase = ((uitouch *)[alltouches anyobject]).phase; if (phase == uitouchphasebegan || phase == uitouchphaseended) [self resetidletimer]; } } } - (void)resetidletimer { if (self.idletimer) { [self.idletimer invalidate]; self.idletimer = nil; } nsinteger maxtime = 60*30; //30 minutes self.idletimer = [nstimer scheduledtimerwithtimeinterval:maxtime target:self selector:

java - Is it possible to installing tomcat in different directory and keeping web application in other directory -

this question has answer here: how tomcat locate webapps directory? 3 answers i don't know asking correct question or not (may silly). suppose having tomcat installed on dir c:\apache\tomcat 7.0\.. web applications in , wanted deploy application (war) don't want keep web application on location c:\apache\tomcat 7.0\webppas\{myapplicationdir} wanted deploy on suppose d:\{applicationdir} is possible? if yes there kind of problem gonna face. its possible, can define base in configuration file each webapp. these configuration files located in c:\apache\tomcat 7.0\conf\catalina\localhost directory. config file should named {app_name}.xml , might have root.xml heres 1 of mine looks project have in eclipse <?xml version="1.0" encoding="utf-8"?> <context docbase="c:\workdir\test\dev\web\src\main\webapp" path

javascript - Highstock + Bootstrap datepicker -

my question same 1 here: highstock date input jquery ui datepicker position changes but i'm using bootstrap datepicker instead of jquery. noticed has on("show", ... ), on("hide" ...) instead of beforeshow, onclose respectively. don't know how change bodies work datepicker. try this settimeout(function () { $('input.highcharts-range-selector', $(chart.container).parent()) .datepicker({ format: "dd/mm/yyyy", todaybtn: "linked", orientation: "auto left", autoclose: true, todayhighlight: true }); }, 0);

how to execute the linux terminal custom command using java -

i have binary of engine developed hadoop(hdfs,hbase,mapreduce) , java use generate csv file. there operation performed engine table creation in hbase , generating csv file hbase. engine performed operation through command line , input given linux terminal in form of command. requirement connect linux terminal through java program , run commands not able run of command there 2 option tried none of them worked. please provide suggestion or solution solve problem beginner of linux , hadoop figure out problem 1st-way public class enginetest { public static void main(string[] args) { try { process process = runtime .getruntime() .exec("/home/cloudera/pvgproto/base/ anloss -i ${tool_input}/census_10000_col5.csv -d ${tool_def}/attr_all_def.txt -q k=14,dage=2 -g ${tool_res}/census_100_col8_gen.csv"); process.waitfor(); bufferedreader bufferedreader = new bufferedreader( new inputstreamreader(proce

Using Android ADT eclipse bundle on 32 bit and moving on to 64 bit -

i starting new android app , creating on 32 bit machine , wondering if cause problems moving 64 bit machine sometime down line? can keep running 32 bit version on 64 bit machine without problems or have use 64 bit eclipse? affect rest of files? no real problem. use eclipse architecture. maybe have install additional libs (keyword: ia32-libs). sources , project won't affected change.

php - How to validate the username and password and also the selected role from database using javascript/ajax or any other validation formates -

hi want indicate user name wrong ur password wrong ur role wrong ., using validations ajax/javascript or other.. index.php <html> <head> </head> <body> <style> body { width:400px; height:auto; margin: 0 auto; padding-top:20px; } body { text-decoration:none; color:#0099cc; } .border{ border:#999999; border-style:solid; border-width:thin; } </style> <?php include('connect.php'); ?> <table width="350" class="border" > <form id="form1" name="form1" method="post" action="login.php" onsubmit="return validate()"> <tr> <td width="112">&nbsp;</td> <td

custom font in Android Studio -

how create custom fonts in android studio ? im trying use custom font, , i've read suppose place fonts in assets/fonts. have searched long , hard found nothing helped yet. wrong? not know do. wrote details below. i've tried , did not succeed. i'm using android studio , doesn't seem have assets folder. created one. app crashes when place assets folder in /main/assets. im using code load fonts. i know . structure project in android studio 0.5.2: root-module |--.idea |--app |----build |----src |------main |--------assets |----------fonts/somefont.ttc |----------fonts/anotherfont.otf |--------java |----------source code here |--------res |------androidmanifest.xml |----build.gradle update my fonte file dir : e:\androidprojects\readnews\readnews\src\main\assets\fonts\ end update my code : @override protected void onpreexecute() { textview titletextview = (textview) _dialog.findviewbyid(r.id.title_news_textview); textview messag

php - Using a link and submit button to submit a form -

i working on website. website redirect index.php index.php?lang=en. this because site multi-lingual , default language needs set english on home page. used header() method causes redirect loop site keeps reloading forever. how can overcome barrier? in php: <?php // default english if $_get['lang'] isn't set $lang = isset($_get['lang']) ? $_get['lang'] : 'en'; // if language not in array of available languages, reset english if (!in_array($lang, array('en', 'es', 'fr'))) { $lang = 'en'; } header('location: index.php?lang=' . $lang); ?> in html: <a href="index.php?lang=en">english</a>, <a href="index.php?lang=es">español</a>, <a href="index.php?lang=fr">français</a>

c# - Sockets maintain socket open and just check the messages that the client is sending -

Image
what trying check messages client sending. want maintain socket created open , check message client send time time. i using system.net.sockets only, want make implementation based on barkeley sockets. here code, using system; using system.collections.generic; using system.net; using system.net.sockets; using system.text; using system.runtime.remoting.metadata.w3cxsd2001; namespace socket_v1._0 { class program { private const int bufsize = 200;// size of receive buffer private const int backlog = 5; // o valor backlog define o número de pedidos de conexão que podem ser mantidos em espera sem serem aceites pela "system-call" accept. static void main(string[] args) { int servport = 8070; //port number socket server = null; try { // create socket accept client connections server = new socket(addressfamily.internetwork, sockettype.stream, protocoltyp

javascript - JQuery onchange works multiple times in jsfiddle but only once in browser -

i have added jquery (1.11.1) script business catalyst site cart page hide or display message depending on dropdown user clicks. works multiple times in jsfiddle http://jsfiddle.net/nathanhill/462tk/ once in browser. javascript placed in line after drop down. i not have control on html dropdown cannot insert function html onchange. html: <select onchange="somebcfunction(a,b,c);" id="shippingcountry"> <option value="af">afghanistan</option> <option value="ax">aland islands</option> <option value="gb" selected="selected">united kingdom</option> </select> <div id="zones">show message</div> javascript: <script type="text/javascript"> $(document).ready(function(){ $('#shippingcountry').on('change', function() { if ( this.value == 'gb') { $("

How to remove multiple root tags in XML using XSLT? -

my xml looks like: <payusw2r> <g_employee1> .. . </g_employee1> </payusw2r> <payusw2r> <g_employee2> .. . </g_employee2> </payusw2r> i want make formed xml follows: <payusw2r> <g_employee1> .. . </g_employee1> <g_employee2> .. . </g_employee2> </payusw2r> basically want remove root tags < payusw2r >. can achieve using xslt? please provide here. since xml input xslt needs well-formed, you'll have wrap instance in temporary root element. how depend on how you're running xslt. simple concatenating new start/end tags existing xml. what should end this: <temp> <payusw2r> <g_employee1> .. . </g_employee1> </payusw2r> <payusw2r> <g_employee2> .. . </g_employee2> </payusw2r>

javascript - Triggering a jQuery Re-Draw After Getting Data With Ajax -

good day, all, long-time listener, first-time poster... i have client has been promised seemingly complex bit of functionality. want load contents of 3 separate pages one, after visitor site logs in account. want happen without page refresh. ajax solution. not, however, experienced ajax. i'm having trouble figuring out how tell when $.get command (using jquery's ajax commands) has finished loading content. approach to, once login has been successful, go , fetch 3 separate pages, load xhtml content variables, , redraw pages. below you'll see pseudo-code. use "xxitemxx" stand-in actual paths. each resulting page i'm trying pull in has div class "content" surrounding data want retrieve. xhtml looks this: <html> <head> <title>page name</title> </head> <body> <div id="header">...</div> <div class="content"> . .

python - Blank page when trying to set up Apache and Django together -

i'm trying set python , django work apache. the django project gave me nothing blank page, i've tried sample i've found in many places: def application(environ, start_response): status = '200 ok' output = 'this website!' response_headers = [('content-type', 'text/plain'), ('content-length', str(len(output)))] start_response(status, response_headers) return [output] i've added following lines @ beginning of app.py file: #!c:/program files/python34/python.exe print('content-type: text/html') print('\n\n') i still blank page. if add following code: def testfunction(text): print(text) testfunction('this works') i appropriate output ('this works') guess python script is running. how callable application(environ, start_response) called ? i'm new python/django , new apache may missing trivial, here's i've tried: lookin

Unable to get an event interrupter for preventing form submission to work corrctly in a basic JavaScript and PHP tutorial -

i trying learn javascript, php , basic client-side form validations in trying build basic javascript tutorial interacts php , html. trying interrupt form submission event, i.e. user forgets enter valid email format in email submission input , clicks on submit button should display error message , not allow form submitted. can't work me. happens instead taken support_process.php page when should not happen. @ appreciated. here index.html code form: <div> <form id="frmsupport" name="frmsupport" method="post" action="support_process.php"> <fieldset id="fastsupport"> <legend><strong>fast support</strong></legend> <p>if you've booked singing rails girls coach,</br> , have not gotten confirmation number,</br> drop line , we'll respond within 24 hours.</p> </p> <p> <label for="email">email:</l

linux - DDOS mod Rewrite IP Request -

we're receiving ddos attack specific range of ips (192.168.0-255.0-255). in our htaccess file we've attempted forward requests static html file half requests being blocked. see why be? rewritecond %{remote_addr} ^(10\.0\.0\.1|192\.168\.[0-9]{0,3}\.[0-9]{0,3})$ rewritecond %{request_uri} [^/etc/blocked_ip.html] rewriterule ^(.*)$ /etc/blocked_ip.html [r=301,l] and our access logs show: 2014-06-27 11:59:03 192.168.20.232 - 1.2.3.4 443 /etc/blocked_ip.html ? 2014-06-27 11:59:08 192.168.20.231 - 1.2.3.4 443 /video/832 note: i've substituted actual ip ranges private ranges. thanks suggestions. actually rewrite condition incorrect: rewritecond %{request_uri} [^/etc/blocked_ip.html] probably meant: rewritecond %{request_uri} !^/etc/blocked_ip\.html you rule can shortened to: rewritecond %{remote_addr} ^(10\.0\.0\.1|192\.168\.[0-9]{1,3}\.[0-9]{1,3})$ rewriterule !^etc/blocked_ip\.html$ /etc/blocked_ip.html [r=301,l,nc] also make sure first rule in

r - Accounting for temporal correlation in GLMM -

i trying account autocorrelation in glmm. response variable boolean, represents presence , absence of en event in life cycle of set of bee nests. trying predict probability of such event set of numerical variables describing state of each nest. thefore, used binomial distribution in generalized model nest random effect (using glmer()). however, events autocorrelated, pretty horrible pattern in residuals. if using gaussian distribution in errors without random effects, estimate correlation parameters using correlation structure gls(), not gonna work in case. have been looking ways include autocorrelation in glmm, don't seem right. found data set can transformed using function ts() , diff() allow model include predictor, previous values of response. works linear model lm(), making residuals nicer. basket.1<-subset(basket,select=c(nest,day,number_cells,provitioning_cells,closed_cells, reopened_cells,eclosed_cells,pollen)) basket.ts<-ts(as.matri

javascript - chrome tab focus index API -

i use chrome api tabs open multiple links @ once. but problem last link open (or focus) first. $scope.data = [{ "url":"http://www.google.com" },{ "url":"http://www.bing.com" },{ "url":"http://www.yahoo.com" }]; angular.foreach($scope.data, function(data){ chrome.tabs.create({ url: data.url }); }); it's not suitable reserve loop because arrangement of tabs messed up. think should use https://developer.chrome.com/extensions/tabs#method-update i've no idea how it. help. the method chrome.tabs.create allows specify whether new tab should become active. here sample code keeps first of several opened tabs active: for (var i=0; i<urlarray.length; i++) { chrome.tabs.create({ url: urlarray[i], active: i==0 }); } the above written after xan 's suggestion; older version chrome.tabs.update follows. the update method can used change activ

winforms - c# Determine button function according to previous action -

i have 1 win form 4 panels in it, each panel seeing separately if independent forms, created function control it. public void panelview(int pw) { if (pw == 1) { panelmenu.visible == true; /*panelmenu - main menu*/ panel2.visible == false; /*panel2 - has textbox , "ok" button*/ panel3.visible == false; /*panel3 - see product details*/ panel4.visible == false; /*panel4 - see products within order*/ } if (pw == 2) { panelmenu.visible == false; panel2.visible == true; panel3.visible == false; panel4.visible == false; } if (pw == 3) { panelmenu.visible == false; panel2.visible == false; panel3.visible == true; panel4.visible == false; } if (pw == 4) { panelmenu.visible == false; panel2.visible == false; panel3.visible == false; panel4.visible == true; } } private void btncheck_click(object sender, eventargs e) { panelview(2); } private void btnorder_click(o

Use jQuery in external php file -

i have php file load php file jquery. works, moment start using jquery in 'external file', error 500. reason used approach because handy refresh data after ajax function. this have: test.php: <script type="text/javascript" src="js/modernizr.custom.29473.js"></script> <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.js"></script> <script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <script> $(function () { $(document).tooltip({ items: ".plupic , .ingr", content: function() { var element = $( ); if ( element.is( ".plupic " ) ) { var src = element.attr('src'); return "<img src='" + src + "' style='