Posts

Showing posts from February, 2011

core data - Swift Fetch Request Returning Empty Item In Results -

i have project need fetch request gets recent 'updated' date of core data entity. when examine results returned query seeing rather strange behaviour. in addition 'correct' result containing date results include empty dictionary item. happens every time, regardless of underlying data looks like. stranger, if turn on sql logging in xcode , execute logged query against sqllite db produces correct result no entries. i'm not quite sure i'm doing wrong here, appreciated. the function builds , executes query: func queryforcontactdate(context:nsmanagedobjectcontext) -> anyobject? { var expressiondescriptions = [anyobject](); let expressiondescription = nsexpressiondescription() // name column expressiondescription.name = "maxupdated" // use expression specify aggregate action want take , // on column. in case max on update_at column expressiondescription.expression = nsexpression(format: "@max.updated_at") ...

amazon web services - Set Environment Variables in AWS EBS -

i wonder how can set environment variables in amazon's elastic beanstalk? i've worked gae before, in env vars can set in config.yaml file. didn't find similar way in ebs documentation. lot. in folder, create file env.yaml inside file env.yaml: option_settings: aws:elasticbeanstalk:application:environment: var1: xxxx var2: yyyy the variable names have less 20 characters in length , cannot contain underscores. (i read somewhere on stackexchange). for variable names more 20 characters , containing non-alphanumeric characters "_", way around string requirement use web interface. check environmental variables have been set going configuration -> software configuration

python - How do I add an include path when pip installing lxml on Centos7 using Salt? -

i'm trying install lxml python 3.4 on centos7. i have salt state looks this: lxml: pip.installed: - bin_env: /opt/rh/rh-python34/root/bin/pip3 - env_vars: include: /usr/include/libxml2 but doesn't work. or without env_vars, error: src/lxml/includes/etree_defs.h:14:31: fatal error: libxml/xmlversion.h: no such file or directory so environment variable have add build see xmlversion.h ? exists: # salt 'myminion' file.readdir /usr/include/libxml2/libxml | grep version - xmlversion.h if have xml dev packages installed already, can please try symlink sudo ln -s libxml2/libxml libxml noted here: src/lxml/etree_defs.h:9:31: fatal error: libxml/xmlversion.h: no such file or directory

javascript - Sticky navigation bar - not working -

question i want navbar stick conditionally on scroll. there bugs can not quite diagnose, new jquery. preventing nav bar sticking conditionally on scroll? the jquery in jsfiddle below not run correctly, , after trying awhile make work, cannot seem make run. i've looked @ other examples of i'd rather not change jquery entirely until know reason code not work. not link html full of lorem ipsum test text body. found in jsfiddle link. what error in javascript isn't making navbar apply sticky class? javascript var navtop = $(".nav").offset().top; var stickynav = function(){ if ($(window).scrolltop() >= navtop){ $(".nav").addclass(".sticky") } else { $(".nav").removeclass(".sticky") } }; stickynav(); $(window).scroll(function(){ stickynav(); }; css * { margin: 0; box-sizing: border-box; } .mainheader { width: 100%; height: 20%; background-color: rgb(62, 65, 66); text-align: cen...

ios - Data is passed only once to child VC in container view -

i trying pass data container view contain 1 of several child view controllers depending on user state. passing data first time new vc instantiated, if close , reopen child vc, data doesn't passed through again. here action when button pressed: @ibaction func onmapbuttonpressed(sender: uibutton) { let latitude = double(selectedplace.latitude!) let longitude = double(selectedplace.longitude!) bringinsubview("mapviewscreen") (childviewcontrollers[0] as! placemapdetailvc).latitude = latitude! (childviewcontrollers[0] as! placemapdetailvc).longitude = longitude! (childviewcontrollers[0] as! placemapdetailvc).placename = selectedplace["name"] as! string } and helper methods: func bringinsubview(name:string) { newviewcontroller = self.storyboard?.instantiateviewcontrollerwithidentifier(name) newviewcontroller!.view.translatesautoresizingmaskintoconstraints = false self.addchildviewcontroller(self.newvi...

android - Passing data between activities problems -

in project, using volley library data, , based on data adding buttons, buttons displayed correctly problem opening activity not working: requestqueue requestqueue; textview txt; final int my_req_code = 12345; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_categories); final gridlayout layout = (gridlayout) findviewbyid(r.id.layout); requestqueue = volley.newrequestqueue(this.getapplicationcontext()); jsonobjectrequest jsonobjectrequest = new jsonobjectrequest(request.method.get, "url", null, new response.listener<jsonobject>() { @override public void onresponse(jsonobject response) { try { jsonobject jsonanswer = response.getjsonobject("answer"); final string[] name=new string[9]; txt = (textview) findviewbyid(r....

sql - Insert into with union -

i have problem. there 3 tables: t1, t2, t_target. t1 , t2 table have many different columns need id column both. t_target table has id column of course , another: project_no. there ids appears in t1 , t2 too, don't want create duplicates between them, if id appears in both table have inserted t_target once if in t_target it's allowed act twice. other of criteria every newly inserted id must value 21 in 'project_no' column. so, e.g.: t1: id 2548 2566 2569 2843 2888 ... t2: id 2557 2566 2569 2700 2913 2994 3018 5426 ... t_target: id project_no 2976 1 3331 7 4049 7 5426 8 5915 3 6253 10 ... and result want see: t_target: id project_no 2548 21 2557 21 2566 21 2569 21 2700 21 2843 21 2888 21 2913 21 2976 1 2994 21 2018 21 3331 7 4049 7 5426 8 5426 21 5915 3 6253 10 ... so, tried code (it important here "not null" criteria because both of t_target columns primary key): insert t_target ...

css - Background image stretch y-axis only, keep repeat-x -

i have image set background image of div. div size changing , inside image gradient. css: #scroller_shadow{ background-image:url(../img/ui/shadow.png); background-repeat:repeat-x; background-position:top; } i need cross-browser solution making image fit height of div in y-axis only, keeping repeat-x. div being resized dynamically via jquery. their might cross-browser option using jquery. don't mind using scripts achieve in order cross-browser support (ie7+). don't want stretch image because loses intensity when stretch image on x-axis, making semi-transparent png image transparent. thanks. i had problem too. it's easy in browsers, ie8 , below it's tricky. solution modern (anything not ie8 , below) browsers: #scroller_shadow { background: url(../img/ui/shadow.png) center repeat-x; background-size: auto 100%; } there jquery plugins can mimic background-size ie8 , below, backgroundsize.js doesn't work if want repeat....

parsing - Unindented code breaks my grammar -

i have .g4 grammar vba / vb6 lexer/parser, lexer skipping line continuation tokens - not skipping them breaks parser , isn't option. here's lexer rule in question: line_continuation : ' ' '_' '\r'? '\n' -> skip; the problem causing, whenever continued line starts @ column 1, parser blows up: sub test() debug.print "some text " & _ vbnewline & "some more text" end sub i thought "hey know! i'll pre-process string i'm feeding antlr insert whitespace before underscore, , change grammar accept it!" so changed rule this: line_continuation : ws? ws '_' newline -> skip; newline : ws? ('\r'? '\n') ws?; ws : [ \t]+; ...and test vba code above gave me parser error: extraneous input 'vbnewline' expecting ws for solution tell users indent code. there way can fix grammar rule? (full vba.g4 grammar file on github) you want line conti...

mysql - JDBC exception while connecting to remote database -

i have spring project connects remote mysql database , displays data it. app tested in eclipse on tomcat localhost server , there no problems. later on, extracted project in .war format , uploaded on openshift.com server, , worked more 2 weeks. suddenly, error when open on server: http status 500 - request processing failed; nested exception java.lang.runtimeexception: com.mysql.jdbc.exceptions.jdbc4.communicationsexception: communications link failure type exception report message request processing failed; nested exception java.lang.runtimeexception: com.mysql.jdbc.exceptions.jdbc4.communicationsexception: communications link failure description server encountered internal error prevented fulfilling request. exception org.springframework.web.util.nestedservletexception: request processing failed; nested exception java.lang.runtimeexception: com.mysql.jdbc.exceptions.jdbc4.communicationsexception: communications link failure last packet sent server 0 milliseconds ago. driv...

php - Curling Instagrams API -

i trying curl url https://www.instagram.com/<handle>/media/ profiles data json. how come when hit url in browser correct response when try curl using php follows: $url = "https://www.instagram.com/<handle>/media/"; $curl_connection = curl_init($url); curl_setopt($curl_connection, curlopt_connecttimeout, 30); curl_setopt($curl_connection, curlopt_returntransfer, true); curl_setopt($curl_connection, curlopt_ssl_verifypeer, true); $json = curl_exec($curl_connection); curl_close($curl_connection); echo $json; i response: {"status":"ok","items":[],"more_available":false} however not useful , not same when hit url in browser. this leads me believe not curling correctly. any suggestions? follow up: i tried file_get_contents($url); seems give users data correctly account not. there reason this? i'd suggest using file_get_contents instead: file_get_contents("https://www.instagram.com/d...

java - Open Jar through batch file through PATH -

i made batch file executes commands through jar: @java -jar commands.jar %* this file tree: c:\ commands\ commands.bat commands.jar i have path variable set "c:\commands\" can access commands anywhere on pc. can run batch file, reason won't open jar. when type commands or commands help it says error: unable access jarfile commands.jar i have tried using quotes around jar name, have tried moving jar... nothing works... %~dp0 gives bat file path so @java -jar %~dp0commands.jar %* see call /? (even though aren't using call ). by using ftype , assoc , , editing setx variable pathext add jar files can type jar's name , have run without batch file needed.

rx java - How to start RxJava development on Android? -

as i've noticed: more , more developers use rxjava android development. i want learn it. can recommended project use rxjava? i'm pretty sure visiting fragmented podcast parts rxjava (i linked them below) nice start of rxjava development: the rxjava show dan lew (part 1) the rxjava show dan lew (part 2) jake wharton on testing, sqlbrite, notrxandroid, rxjava , more why these sites? click on first link , find there not player on normal podcast page, many recommended authors resources explained in podcast. many projects rxjava find on github . recommend these: https://github.com/kaushikgopal/rxjava-android-samples https://github.com/jhusain/learnrxjava https://github.com/richardradics/rxandroidbootstrap also take @ github page of rxjava , rxandroid , android specific bindings rxjava . any question? please free ask. hope helps

git - Commit files without Staging -

i new git , using git extension. want ask when commit directory whether these file automatically go staging or these committed without staging?? can commit files without staging?? yes, can stage , commit using a , m in commit: git commit -am "my commit message" however, tend use git add -u anyway because above command not stage untracked files.

c# - Interface best practices -

i'm working on application split in following way (simplified bit) app | framework | data (persistance) | data.couchbase inside app we're setting di container , registering concrete implementations used when particular interface needed. i.e. iuserrepository in data namespace fulfilled couchbaseuserrepository in data.couchbase namespace. in future if swap out persistance layer technology, mongo, update di registration , fulfilled mongouserrepository all , good.... question 1 there obvious benefit providing interfaces cross system boundaries whatabout within data.couchbase namespace itself. there point in having icouchbaseuserrepository interface if doesn't provide functionality itself? seems though if register iuserrepository -> couchbaseuserrepository should enough? similary within concrete implementations there point in splitting components further interfaces wont swapped out question 2 similarly worth having bunch of interfaces in framework whos pu...

c# - Delegate not working in asp.net -

i having trouble getting delegate work. want function when user clicks button first time label display driver came in third, second time hit button label clear , driver placed in second display in place , when click button third time display winner of race this aspx.cs page using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; namespace webprogramming3.week_3 { public partial class exercise1 : system.web.ui.page { static raceresult userclick; //public int clicks = 0; protected void page_load(object sender, eventargs e) { userclick = new raceresult(0); userclick.nbrclicksreached += user_click_nbrclicksreached; } private void user_click_nbrclicksreached(string message) { lblraceresults.text += message; } protected void btnrace_click(object send...

JavaScript Validation for dynamic checkbox list -

i'm having issues getting validation work. need make sure textbox's populated , @ least 1 checkbox ticked. text fields easy enough, way checkbox's populated making hard. here snippet form looks like, there lot more after this. can change event on checkbox's or remove them? <form id="orderform" action="#" method="get" onsubmit="return cdsubmitvalidate();"> <section id="selectcd"> <h2>select cds</h2> <div class='item'> <span class='cdtitle'>a biography of rev. absalom dawe</span> <span class='cdyear'>2001</span> <span class='catdesc'>comedy</span> <span class='cdprice'>11.70</span> <span class='chosen'><input type='checkbox' name='cd[]' value='651' title='11.70' onclick='checkboxcheck(this)'/...

css - How to stretch the background color of a child element so that it has the same height as the parent element while using float? -

please java guy simple css problem. been trying hours , can't find proper solution problem: how stretch background color of child element has same height parent element while using float? bet has display:flex , can't work :-/ here's code: https://jsfiddle.net/bycor29w/ goal: right column background colour must filled same height middle column no matter how or little text contains requirement: must use float stackoverflow demands: "links jsfiddle.net must accompanied code", here go: <!doctype html> <html> <head lang="en"> <meta charset="utf-8"> <title></title> </head> <body> <style> div { border: 1px #000 solid; } .container { height: 100%; width:980px; float:left; display: flex; } .left { width: 200px; float: left; } .mid{ padding-top: 1px; width: 560px; floa...

postgresql - Accessing array-item from array of arrays -

so simple... need retrieve item of array-of-arrays, item must simple array. example: with t (select '{{1,2,3},{333,444,555}}'::int[][] a, '{{{{1,2}}}}'::int[] b) select a[2], -- returns null (!), why not works? a[2:2], -- returns array-into-array, not simple array b[1][1], -- null b[1][1][1:2], -- ugly array-into-array-into...-array a[1][1] -- correct, works scalars t; the result null,{{333,444,555}},null,{{{{1,2}}}},1 ... need simple array a[2] , {333,444,555} ... how access it? ps: guide , google-examples show slices... perhaps obvious not remember why a[2] invalid in postgresql. i had forgotten discussed here : restricted form of "array of arrays"... named "multidimensional array"... persisted in thinking in ambiguous way, is, thinking in array of arrays... the best answer comes tom lane @ pgsql-hackers.at.postgresql.org forum, "multi-dimensional arrays in postgres not 'array...

coreos - Kubernetes pods can't connect between machines -

i used node.yaml , master.yaml files here: http://kubernetes.io/v1.1/docs/getting-started-guides/coreos/coreos_multinode_cluster.html create multi-node cluster on 3 bare-metal machines running coreos. however, pods on different nodes can’t communicate each other. i’d appreciate pointers or suggestions. i’m @ loss. i have 3 pods running rabbitmq: thuey:~ thuey$ kbg pods | grep rabbitmq rabbitmq-bootstrap 1/1 running 0 3h rabbitmq-jz2q7 1/1 running 0 3h rabbitmq-mrnfc 1/1 running 0 3h two of pods on 1 machine: kbd node jolt-server-3 | grep rabbitmq thuey rabbitmq-bootstrap 0 (0%) 0 (0%) 0 (0%) 0 (0%) thuey rabbitmq-jz2q7 0 (0%) 0 (0%) 0 (0%) 0 (0%) and other pod on machine: thuey:~ thuey$ kbd node jolt-server-4 | grep rabbitmq thuey rabbitmq-mrnfc 0 (0%) 0 (0%) 0 (0%) 0 (0%) i can ping rabbi...

css - Simulate display: inline in React Native -

Image
react native doesn't support css display property, , default elements use behavior of display: flex (no inline-flex either). non-flex layouts can simulated flex properties, i'm flustered inline text. my app has container contains several words in text, of need formatting. means need use spans accomplish formatting. in order achieve wrapping of spans, can set container use flex-wrap: wrap , allow wrapping @ end of span rather traditional inline behavior of wrapping @ word breaks. the problem visualized (spans in yellow): (via http://codepen.io/anon/pen/gowmdm?editors=110 ) is there way proper wrapping , true inline simulation using flex properties? you can effect wrapping text elements in other text elements way wrap span in div or element: <view> <text><text>this writing should fill of container </text><text>this writing should fill of container</text></text> </view> you can effect declaring ...

ruby on rails - Devise - Perform actions after authentication, but before redirect -

i'm trying perform actions after creation of session , before redirect. user subscribes lesson, , after they've picked lesson sign for, i'd provide option sign in, , use existing card on file finalize purchase without making them go through process again (it's stated happen on form). i'm overriding default actions devise, so: rails.application.routes.draw devise_for :users, controllers: {registrations: 'registrations', sessions: 'sessions'} end and using controller: class sessionscontroller < devise::sessionscontroller def create super my_service = myservice.new my_service.charge_card_and_create_event(resource, params) end end with form: = form_for(resource, as: resource_name, url: session_path(resource_name)) |f| = f.email_field :email, autofocus: true, class: 'signin-fields', placeholder: "email" = f.password_field :password, autocomplete: "off", class: 'signin-fields', ...

ruby - Rails won't exit on first CTRL-C -

no rails command exit on first ctrl-c. rails s or rails c require me hit control ctrl-c second time , commands wouldn't have required ctrl-c @ such rake routes / db:migrate require me press it. the issue not happening of teammates. i'm on osx using iterm2. there no instances of 'rescue exception' in app. i've reinstalled mysql using brew , issue still present. rails version 4.0.5 , sql server version 5.6.27. idea issue might be? [2016-01-13 16:18:33] info webrick 1.3.1 [2016-01-13 16:18:33] info ruby 2.1.2 (2014-05-08) [x86_64-darwin13.0] [2016-01-13 16:18:33] info webrick::httpserver#start: pid=2329 port=3000 ^c[2016-01-13 16:18:54] info going shutdown ... [2016-01-13 16:18:54] info webrick::httpserver#start done. exiting ^c honestly webrick 1.3.1 released in december 28, 2011 suggest moving away see webrick answer reasons. as have said happens in rails consoles , other tasks (you should put in question helps debugging) suggest gem causin...

How to compare a parameter string Visual C++ -

i want simple: check parameter is. void _tmain(int argc, wchar *argv[]) { if(argv[4] == "-h"); { //do stuff } } i getting incompatible error wchar * const char *. such conversion question has been asked, answers have found many , not simple. total newbie @ c++. what looking not pointers complicated functions, rather actual code put program make work. just looking simple, straightforward, working code. thanks! #include <string.h> void _tmain(int argc, wchar *argv[]) { if( 0 == wcscmp(argv[4], l"-h") ) { //do stuff } } that should it.

swing - JAVA jtable passing value -

Image
i facing problem of passing value print out in jtable. trying pass data variable table getting error once trying run project. image below shown tried. i declare these 2 variable in global. vector<vector<object>> data = new vector<vector<object>>(); string[] headers = {"ip", "port", "destination", "port"}; i pass in value read text file data variable this: vector<object> row = new vector<object>(); row.add(alltcp.get(x).gettcpsourceip()); row.add(alltcp.get(x).gettcpsourceport()); row.add(alltcp.get(x).gettcpdestip()); row.add(alltcp.get(x).gettcpdestport()); data.add(row); can tell me did wrong or shall in order me pass in value output table form. way, designed table in third tab. read defaulttablemodel api. you can create defaulttablemodel using: an array of column names , 2 dimensional array of data, or an vector of column names , vector of vectors data. you can't create...

php - Laravel App Development Advice -

i in process of planing build app , have few questions 100% in head. what best method prospective in regards updating code , going between live/maintenance mode sites? what recommend authentication? how handle cacheing , cdn? well start, i'd welcome newest version of laravel (released apx 3 weeks ago). second: authentication handled in version of laravel, , documented customize. as far switching live / maintenence mode, suggest keeping live repo , branch development. may suggest using bitbucket coupling our forge service in order ease deploying , setting servers! as far cdn goes, that's based on experience. don't recommend 1 on other because opinion biased , current version new, packages/dependencies previous versions need updated and/or tested compatibility :) i hope helps!

variables - New to XML and stuck -

good evening 1 , all. newer xml , have spent large chunk of today trying figure out code doing. spent lot of time testing/rewriting provided on free online xsl transformer (xslt) - freeformatter.com. officially stuck we utilize tool can ingest xml feeds, albeit new xml can fix somethings work not tonight. have write translation translate xml xls file. xls stuck. issues follow: have multiple reporthost , 1 report when run following code through transformer not of information host-ip, host-fqdn, system-type, operating-system in variable call outs. can see data in xml thats feeding not in output. , appreciated! xls follows: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns="http://www.archer-tech.com/"> <xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes" /> <xsl:templat...

Using javascript, how do I copy svg tspan elements inside an svg text element into a different text element? -

i have svg text element 2 tspan elements. looks this. <text id="majnote5" x="25" y="70"> <tspan>d</tspan> <tspan font-family="'opus text'" font-size="25">b</tspan> </text> i have 2nd empty text element looks this. <text id="majchord1" x="425" y="70" ></text> i want copy both tspan elements , respective texts in first text element 2nd text element. i tried following: var majnote5 = document.getelementbyid('majnote5'); var majchord1 = document.getelementbyid('majchord1'); majchord1.textcontent = majnote5.textcontent; this copy text contents of tspan elements , places in other container, without of tspan elements. afterward looks this: <text id="majchord1" x="25" y="70">db</text> how second text container first container? thanks, --christopher

php - Symfony2 Manual Redirect to Login, Preserving _security.main.target_path -

okay, know how via firewall. curious how symfony doing under hood , how can replicated manually. i have tried things like: return $this->redirect( '/login', 301 ); but when that, loses the _security.main.target_path and thus, when user logs in, no longer redirected page on. how redirect login in manner replicates firewall , preserves _security.main.target_path ? try following code add setting in security.yml file #app/config/security.yml security: firewalls: main: form_login: always_use_default_target_path: true target_path_parameter: redirect_url your login form must have following input tag <input type="hidden" name="_target_path" value="account" /> like form <form action="{{ path('login_check') }}" method="post"> <label for="username">username:</label> <input type="text...

html - angularjs background image not working on span tag -

i'm trying apply background image span tag using angular ng-style , when span tag clicked calls chgimg doesn't seem working. working if directly replacing {{img}} /images/chk.svg <span ng-style="{'background-image':'url({{img}})'}" ng-click="chgimg()" class="pollchoice--radio">{{img}} </span> angularcode: app.controller('homectrl', ['$scope', 'posts', function($scope, posts) { $scope.posts = posts.posts; $scope.chgimg = function(){ $scope.img = "/images/chk.svg"; }; } ]); please use $scope.apply below: $scope.chgimg = function(){ $scope.$apply(function () { $scope.img = "/images/chk.svg"; }); };

javascript - Extending MomentJS to override toString() function -

i'm trying extend moment's tostring function return date in different format. i.e. want create momentdate below: // return "sat dec 12 2015 00:00:00 gmt+1100" moment('2015-12-12').tostring(); // return custom format, e.g. "2015-12-12" momentdate('2015-12-12').tostring(); i've been trying no success. i'm not sure if it's possible because of how moment written thought ask here. my question answered here: https://stackoverflow.com/a/34626333/2248573 note: solution works v2.11.0. function extendedmoment() { var self = moment(); self.__proto__ = extendedmoment.prototype; return self; } extendedmoment.prototype.__proto__ = moment.prototype; extendedmoment.prototype.tostring = function(){ return this.format('yyyy-mm-dd') } document.write("original: " + moment().tostring()); document.write("<br/>"); document.write("extended: " + exte...

How to prevent non numeric or non character input or symbols and getting desired output in C -

here's source code modified youtube tutorial. purpose of program is: it ask age. if put 18 or more ask gender print can enter dude or m'lady(depends on gender). if put age less 18 prints "nothing see here!" i want make sure if input isn't ask(only number or character) shows "invalid input". in program, first part program ask age, when input age either alphabet or symbol shows invalid input. whenever combine alphabet number 18a or 18/ shows: "please enter gender.(m/f)" "invalid input." also, if input 18 or more , go part program ask gender(m/f) shows invalid input if put number or symbol.. when combine m1 or m/ shows: "you may enter website dude." can me how can remove problem? #include <stdio.h> #include <conio.h> int main(void) { char gender; int age=0; printf("please enter age. \n"); if(scanf(" %d",&age)!=1) { printf("invalid input. \n...

wordpress - Why MySQL Restarted When Number of Processes Running Now 0 -

some background. hosted wordpress site in vps , mysql down error "error establishing database connection". i've spent time research , believe problem due when mysql restarted, not able allocate enough ram proceed. i believe can improve situation increasing physical ram or swap. question post is, why mysql need restart itself? site pretty low traffic , doesn't seem db corrupted. below full log issue: 160103 18:39:54 mysqld_safe number of processes running now: 0 160103 18:39:54 mysqld_safe mysqld restarted 160103 18:39:55 [note] /usr/libexec/mysqld (mysqld 5.5.44-mariadb) starting process 22061 ... 160103 18:39:55 innodb: innodb memory heap disabled 160103 18:39:55 innodb: mutexes , rw_locks use gcc atomic builtins 160103 18:39:55 innodb: compressed tables use zlib 1.2.7 160103 18:39:55 innodb: using linux native aio 160103 18:39:55 innodb: initializing buffer pool, size = 128.0m innodb: mmap(137756672 bytes) failed; errno 12 160103 18:39:55 innodb:...

php - How to save backslashes in database via wordpress -

i use wordpress , want save pattern ".*www.site.com" in database. $wpdb->query("insert $wpdb->postmeta (`post_id`, `meta_key`, `meta_value`) values (1, 'pattern', '.*www\.site\.com')"); it saves without backslashes ".*www.site.com". how solve it? in php can print backslash following: echo 'abc\xyz'; //use single slash if using single quotes(') or echo "abc\\xyz"; //use double slash if using double quotes; so write query as: $wpdb->query("insert $wpdb->postmeta ( post_id , meta_key , meta_value ) values (1, 'pattern', '.*www\\.site\\.com')");

Excel VBA to Deal With AJAX -

i practicing use excel vba download information website: http://mops.twse.com.tw/mops/web/t05sr01_1 but have no idea how download data behind click button, image shown: http://i.stack.imgur.com/kzhiz.jpg i excerpt web code below. explain me how code in excel vba data? thank mush. web code: <td style='text-align:left !important;' nowrap>鴻海</td> <td style='text-align:left !important;'>105/01/05</td> <td style='text-align:left !important;'>11:41:00</td> <td style='text-align:left !important;'>說明媒體報導</td> <td><input type='button' value='詳細資料' onclick="document.fm_t05sr01_1.seq_no.value='1';document.fm_t05sr01_1.spoke_time.value='114100';document.fm_t05sr01_1.spoke_date.value='20160105';document.fm_t05sr01_1.company_name.value='?e??';document.fm_t05sr01_1.company_id.value='2317';document.fm_t05sr01_1.skey.value='2317201601051...

C# read stream get WebException -

i'm trying open connection server , response body, image. want save image , , later display in picturebox . here code: try { var response = webrequest.create(string.format(url + "?t=webwx&_={0}", timestamp)); var stream = response.getrequeststream(); image image = image.fromstream(stream); qe_img.image = image; qe_img.height = image.height; qe_img.width = image.width; } catch (exception e) { console.writeline(e); } i get: exception thrown: 'system.net.protocolviolationexception' in system.dll system.net.protocolviolationexception: cannot send content-body verb-type. @ system.net.httpwebrequest.checkprotocol(boolean onrequeststream) @ system.net.httpwebrequest.getrequeststream(transportcontext& context) @ system.net.httpwebrequest.getrequeststream() @ windowsformsapplication1.form1.showqrimage() in c:\users\morgan\documents\visual studio 2015\projects\windowsfor...

Base64 java string with . decode in c# -

i have following string client - encoded , signed certificate based off of java based sso 3rd party component "eyjhbgcioijsuzi1niisinr5cci6ikpxvcj9.eyjlehaioje0ntiwnte4ntesimlhdci6mtq1mja1mtc5mswiaxnzijoiahr0chm6ly9vyxv0ac9hcgkvb3blbmlkl3yxl3rva2vuiiwiyxvkijoizwe2njexnjctytrimc00zdq4lwiwztetnwrjotmwmzk5mdgziiwic3viijoimwq1zmiwyjctn2njmy00mjrkltg1m2qtmwe5ywnjmzg2ytm5iiwiyxrfagfzaci6ikf6dnktnujor2nbn0e2ujjqmkewywcilcjjx2hhc2gioij5dzf0nnpncvltbe5ittncqmjyemvnin0.r6x1hz23eahr8h2uzswqra5muytibgl8ymsmh-t7giep1jaqyvmoakronj7dwynqrg7owei6rgoyihgkotid-tkhnpgcae3mcvcw0gtlzj1llq5b8zmfinlbtcwgxvvk54enj04jyr04pir6lxb4vyk1mhec_vhwbmtjkoqrphfsozh99tq-l5akemua-ygnk4ai_gcei7yy4as6al4oa1o3e5dpqmtzd-zz_sum-3bihblpa-9oxrpfrwhmdyrytpar4yhvyhsvcxotul9ahdikf7kddiyo9abq6ujgochggfepvz3ioerphoy8hsrkl5jgfw3w1to6k5dwbbhs9q" for java c# base64 conversions, know '-' needs replaced '+' , '_' needs replaced '/', plus additional padding if required using '=' @ ...

java - Encoding of DBUnit Blob Column on JPA Entity -

i creating unit tests existing functionality. i using dbunit embedded h2 database test jpa entities. our production environment uses sql server. the problem having need perform operations on blob column on 1 of entities seems if copy contents of blob data 1 of sql server rows dbunit xml dataset, when instantiate string bytes not represent text expect. snippet of entity: @entity @table(name = "mn_gateway_template") public class gatewaytemplate implements serializable { @lob @column(name = "config_file_bytes", length = 500000) private byte[] configfilebytes; } to save bytes this: gatewaytemplate template = entitymanager.find(gatewaytemplate.class, 1l); byte[] bytes = postedstringcontent.getbytes(); template.setconfigfilebytes(bytes); entitymanager.persist(template); my dataset: <?xml version="1.0" encoding="utf-8"?> <dataset> <mn_gateway_template id="4" disabled="0" description=...

Pandas:drop_duplicates() based on condition in python -

having below data set: data_input: b 1 c13d c07h 2 c07h c13d 3 b42c b65h 4 b65h b42c 5 a45b a47c i.e. row 1 , row 2 in data_input same,i want keep one,so drop row 2. want output below: data_output: b 1 c13d c07h 2 b42c b65h 3 a45b a47c you can create third column 'c' based on 'a' , 'b' , use find duplicates such: df['c'] = df['a'] + df['b'] df['c'] = df['c'].apply(lambda x: ''.join(sorted(x))) df = df.drop_duplicates(subset='c')[['a', 'b']]

python - Django app successfully deploys to Heroku but immediately crashes with the Heroku open or Heroku local command -

i able create heroku app , deploy project heroku without error. additionally, app runs locally. when run command heroku ps in command line: web.1: crashed 2016/01/06 01:30:10 when run heroku open default error message: an error occurred in application , page not served. please try again in few moments. if application owner, check logs details. with command: heroku local web.1 | [2016-01-06 07:04:52 +0000] [33239] [info] starting gunicorn 19.4.5 web.1 | [2016-01-06 07:04:52 +0000] [33239] [info] listening at: http://0.0.0.0:5000 (33239) web.1 | [2016-01-06 07:04:52 +0000] [33239] [info] using worker: sync web.1 | [2016-01-06 07:04:52 +0000] [33242] [info] booting worker pid: 33242 my directory set shown: directory settings.py import os import dj_database_url # build paths inside project this: os.path.join(base_dir, ...) base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # quick-start development settings - unsuitable producti...

xml - How to count the number of records/nodes in the xslt only whose value is greater than zero -

my xml below : <report_entry> <filedatetime>2016-01-05t22:45:55.692-08:00</ filedatetime> < currentyear>2016</ currentyear> < memnum>133034</ memnum> < ssn>000000</ ssn> < first_name>br</ first_name> < last_name>g</ last_name> < employee_status_date>2013-10-04-07:00</ employee_status_date> < payrollresults> < depodt>2016-01-08-08:00</ depodt> < fsa_dep_contributions>48.08</ fsa_dep_contributions> < fsa_limitd_contributions>0</ fsa_limitd_contributions> < fsa_med_contributions>0</ fsa_med_contributions> </ payrollresults> </ report_entry> < report_entry> < filedatetime>2016-01-05t22:45:55.692-08:00</ filedatetime> < currentyear>2016</ currentyear> < memnum>205767</ memnum> < ssn>777777</ ssn>...

c# - Who owns controls? -

let's have component this: class someform : form { private control example; public void stuff() { this.example = new combobox(); // ... this.controls.add(example); } public void otherstuff() { this.controls.remove(example); } } who responsible calling dispose on example control? removing this.controls cause disposed? or leak bunches of window handles backing controls? (for reference, i'm asking because don't see windows forms designer generates code call dispose on form's children) form.dispose() dispose of controls within controls collection. removing control controls require dispose of control yourself.

.htaccess - 301 redirect everything to new website root/whole site including sub pages? Moved Permanently -

quick update ok getting there mod_alias? redirectmatch 301 ^/ http://brightmist.co.uk/ i've added 1 line of code underneath , appears work, other directories such http://brightmist.co.uk/blog/2013/02/23/manchester-art-gallery-feb-2013 telling google these pages have temporarily moved - see http://www.internetofficer.com/seo-tool/redirect-check/ does mean have go right way though site , add tone of redirects? original question i have new website. i'd redirect of old site links http://artygirl.co.uk new 1 http://brightmist.co.uk/ i'm designer years of experience using in photoshop, css, html, wordpress, , jquery don't know editing things htaccess file. , don't want wrong means google ranking drops etc does know of script can paste bottom of htaccess file, i'd redirect links/pages on site same place before. example if type http://artygirl.co.uk/buy-art-prints-cheshire/ want go http://brightmist.co.uk/buy-art-prints-cheshire/ i'm using...