Posts

Showing posts from March, 2013

javascript - How to convert binary fraction to decimal -

javascript has function parseint() can convert integer in binary form decimal equivalent: parseint("101", 2) // 5 however, need convert binary fraction decimal equivalent, like: 0.101 = 0.625 i can write own function calculate result following: 1 * math.pow(2, -1) + 0*math.pow(2, -2) + 1*math.pow(2, -3) // 0.625 but i'm wondering whether there standard already. you can split number (as string) @ dot , treat integer part own function , fraction part function right value. the solution works other bases well. function convert(v, base) { var parts = v.tostring().split('.'); base = base || 2; return parseint(parts[0], base) + (parts[1] || '').split('').reduceright(function (r, a) { return (r + parseint(a, base)) / base; }, 0); } document.write(convert(1100) + '<br>'); document.write(convert(0.0011) + '<br>'); document.write(convert(1100.0011) + '<br...

JavaScript strict type checking fails -

i checking 3 strings equality; var str1 = "hello world!"; var str2 = "hello \ world!"; var str3 = "hello" + " world!"; //console.log(str1===str2);//true // console.log(str2===str3);//true console.log(str1 === str2 === str3); //false how can check scenario want compare 3 variables? your question isn't totally clear me.  assuming question how compare equality of 3 strings: with console.log(str1 === str2 === str3); you're checking (str1 === str2) === str3 (yes, associativity left right here) that is, you're comparing boolean string. what want is (str1 === str2) && (str2 === str3) assuming question how compare strings not caring numbers , types of spaces (see note below): then best normalize strings using function like function normalize(str){ return str.replace(/\s+/g,' '); } and can define function comparing strings: function allequals(strs) { var p; (var i=0; i...

relational database - PostgreSQL find locks including the table name -

i'm trying take @ locks happening on specific tables in postgresql database. i see there's table called pg_locks select * pg_locks; which seems give me bunch of columns possible find relation because see 1 of columns relation oid. what table must link to relation name? try : select nspname,relname,l.* pg_locks l join pg_class c on (relation=c.oid) join pg_namespace nsp on (c.relnamespace=nsp.oid) pid in (select procpid pg_stat_activity datname=current_database() , current_query!=current_query())

Rails app using doorkeeper and devise : how to handle direct login and OAuth? -

i have existing app use devise authentication. app has doorkeeper allow third party app users data. when user log in third party app redirected page handled devise in app, , after successful login, redirected third party app. the "doorkeeper devise login" page view form login, error or password lost redirect normal devise view, , lose redirection third party app. how should handle authentication in app providing oauth , allowing user login directly?

Spark from SQL External source automatically updated -

i have simple question. loading large extrenal source of data using spark map<string, string> options = new hashmap<string, string>(); options.put("url", "jdbc:postgresql:dbserver"); options.put("dbtable", "schema.tablename"); dataframe mydf= sqlcontext.read().format("jdbc"). options(options).load(); i wanted know if external sql database updated changes reflect data frame or again need call load function populate dataframe. in case need call load function again,is there more efficient way in spark can update data frame when external sources change? short answer doesn't details relatively subtle. in general spark cannot event guarantee consistent state of database. each executor fetches own part of data inside separate transaction if data actively modified there no guarantee executors see same state of database. this becomes more complicated when consider explicit , implicit (shuffle files) caching ...

c++ - where is overloading operator in memory? -

i researched body of function member in memory , know located in code segment , function member allocated once class defined. but bodies of overloaded operators located in c++? like other function, in code segment. in binary, overloaded operator same other function or method. the difference between normal function , overloaded operator syntax call them.

android - how save checkbox value with shared preferences? -

this question has answer here: what nullpointerexception, , how fix it? 12 answers hy everybody, don't know why code not save checkbox checked value; if check checkbox , after click on tab , comeback previous tab, checkbox not selected...i hope find error in code! ide me: fatal exception: main java.lang.nullpointerexception @ line ".oncreateview(holder.chkbox.setchecked(true);" why? thanks in advance! adapter class: public abstract class planetadapter extends arrayadapter<planet> implements compoundbutton.oncheckedchangelistener { private list<planet> planetlist; private context context; arraylist<birra> objects; public planetadapter(list<planet> planetlist, context context) { super(context, r.layout.single_listview_item, planetlist); this.planetlist = planetlist; this.context = context; ...

python - Group by 2 keys with only month in second key -

i trying group 2 keys in list of dict second key being datetime.date. need group nick_name , month , couple of sums, conditional sums etc. in sql select rw_worker_nick ,date_trunc( 'month', rw_date ) month ,sum(rw_end - rw_start) work_time results_woshi rw_script = 93 group rw_worker_nick ,date_trunc( 'month', rw_date ) order month keys have same names db columns there more conditions think easier in python on db level this code far not know how group month grouper = itemgetter("rw_worker_nick", "rw_date") result = [] itertools import groupby pprint import pprint key, grp in groupby(sorted(summary, key = grouper), grouper): temp_dict = dict(zip(["rw_worker_nick", "rw_date"], key)) result.append(temp_dict) rather relying upon itemgetter , write own key function ignores day in date: grouper = lambda x: (x["rw_worker_nick"], x["rw_date"].replace(day=1)...

javascript - Meteor.js update only one parameter instead of whole collection -

i'm trying mark message readed using code below : template.fullmessage.onrendered(function () { var id = flowrouter.getparam('id'); messages.update(id, {$set: {readed: true} }); }); collection : "_id": "ymxyn9nodpezqfp83", "whatabout": "adsfadsfasdf", "message": "sdfadsfadfadsfasdfasdf", "recipientid": "9ewif8jtnp77pmijw", "author": "9ewif8jtnp77pmijw", "createdat": "2016-05-09t08:37:52.282z", "owner": "seofilms", "readed": false } i expected column "readed":"false" replaced "readed":true, but instead of it, in here changing, including owner. instance if open message user test, change owner of message. why happens ? is possible prevent sending whole object , change id? thank ideas. try this: messages.update({_id: id}, {$set: {rea...

machine learning - Combining training, validation and test datasets -

is possible train model based on training , validation data sets.basically end combining both of them create new model. , combined model use classify of data in test dataset. this done. assuming know how transfer hyperparameters, fit model on train data, select hyperparameters based on score on valid one. when combine train + valid bigger dataset, "optimal hyperparameters" might different ones selected before. in general - yes, done, might more tricky expect (especially if method highly stochastic, non deterministic, etc.).

jquery - Live Search with PHP not working correctly on Chrome for Ubuntu -

i have webpage livesearch using php , mysql. works in chrome on mac , on pc, it's not running on chrome linux (ubuntu 16.04). when search keywords, gets results, when click on result doesn't anything, when supposed fill several inputs. guess chrome settings on linux, don't have clue. here's code: $( document ).ready(function() { $(function(){ $(".search").keyup(function() { var searchid = $(this).val(); var datastring = 'search='+ searchid; if(searchid!='') { $.ajax({ type: "post", url: "search.php", data: datastring, cache: false, success: function(html) { $("#result").html(html).show(); } }); }return false; }); jquery("#result").live("click",function(e){ var $clicked = $(e.target); var $name = $clicked.find('.name').html(); var decoded = $("<div/>").html($name).text(); $('#searchid').val(decod...

java - Is there a way to provide a read-only representation of an EObject (EMF)? -

i have emf model , want provide read-only representation of objects in model (in order prevent unwanted changes being made model). is there way provide (maybe kind of read-only proxy/facade eobjects)? don't want solve not generating setters. in fact, want avoid changing existing model classes far possible. instead, i'd rather add it... thanks in advance, ingo what approach take going depend on bigger picture of trying achieve. if want framework work emf-transaction worth looking at. access model achieved through transactions , there support read-only transactions. if want lighter emf objects implement read-only interfaces. shouldn't work add template automatically generate these if wished. tas

python - + sign eliminates in web.py input parameters (GET request) -

i have following code takes input parameter t , return same value. import web urls = ( '/test(.*)', 'test', ) class test(web.storage): def get(self,r): t = web.input().q print t return t if __name__ == "__main__": app = web.application(urls, globals()) app.run() so works correctly when execute following url in browser http://localhost:8080/test?q=word1-word2 but when there + sign eliminates that. http://localhost:8080/test?q=word1+word2 and returns word1 word2 where expected result word1+word2 how can prevent this? try url encoding query string: http://localhost:8080/test?q=word1%2bword2 as + used replace space.

web applications - How to change the screen orientation (Tizen, Web-app) -

i can set screen orientation on config.xml screen-orientation="portrait" or "landscape". setting pages. how can change screen orientation code? screen.lockorientation("portrait"); screen.lockorientation("landscape"); developer.tizen.org/help/index.jsp

Cassandra schema version mismatch -

Image
we have 4 node cassandra cluster running 2.0.12. recently, upgraded 1 node 2.1.13, following steps given in datastax upgrade procedure. after upgrade, created new table named 'testing' in existing keyspace using cqlsh on upgraded node. gives me following error: however, when created testing table in nonupgraded node no warning occurs. but, checked other nodes confirm creation of testing table. except upgraded node, create table has propagated other nodes. after 15 minutes, create table gets propagated upgraded node instead of immediate propagation. nodetool describecluster shows different schema version upgraded node i ran nodetool resetlocalschema on upgraded node , of no use. i deleted system.schema* directories data directory location , restarted node. still, no use. after that, deleted system.schema* directories , copied system.schema* directories non-upgraded node , restarted. still issue persists. (ps: using hector jar connect cassandra. when set wri...

html - Want to create a transparent color overlay over background image but want everything infront of overlay -

basically, want background, transparent overlay, , of content brought front. far have #overlay{ position:absolute; left:0; right:0; top:0; bottom:0; background-color:grey; opacity:0.5; } and have <div id="overlay"> surrounding in html document. in advance. i use thepios answer use :before rid of unnecessary overlay div: body { width: 100%; height: 100%; } .content { position: relative; width: 500px; height: 500px; background-image: url('http://static.vecteezy.com/system/resources/previews/000/094/491/original/polygonal-texture-background-vector.jpg'); background-size: cover; padding: 50px; } .content:before{ content: ' '; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); } .inner-content { width: 250px; height: 250px; padding: 20px; background-color: #ffffff; color: #000000; ...

shadow - can't find symbol crypto_stream_salsa20_xor_ic in libsodium.so.4 -

i can't find symbol crypto_stream_salsa20_xor_ic in libsodium.so.4 when starting shadowsocks chacha20 mode. how use chacha20 on shadowsocks ? you should update libsodium lastest version.such as: //if has install libsodium `yum`,you should remove first. wget https://github.com/jedisct1/libsodium/releases/download/1.0.10/libsodium-1.0.10.tar.gz tar zxvf libsodium-1.0.10.tar.gz cd libsodium-1.0.10 ./configure && make && make install echo /usr/local/lib > /etc/ld.so.conf.d/usr_local_lib.conf ldconfig everything fine now.

Passing 3 parameters from angularjs $resource to C# Web API Controller Post method, one of the parameters returns null -

i have been trying pass 3 parameters post method angularjs c# web api controller. information being passed angularjs service correctly. have tried many combinations on client , server side post method receive multiple parameters closest have come 2/3. here code. server side controller: // post api/values [httppost("{id}")] public iactionresult post(int id, string userid, [frombody]post post) { if(post.id == 0) { _repo.addpost(id, userid, post); } else { _repo.updatepost(post); } return ok(post); } client side service: namespace myapp.services { export class postsservice { private postsresource; constructor(private $resource: ng.resource.iresourceservice) { this.postsresource = this.$resource("/api/posts/:id"); } getpost(id) { return this.postsresource.get({ id: id }); } savepost(id, userid, posttosave) { ...

symfony - Show decimal percent type field -

i'm trying show form has percent type field can show values 3.03% exemple. seems rounding integers, e.g 3% in case. entity field : /** * @var float * @orm\column(type="float") */ private $penaltyrate; form builder : ... ->add('penaltyrate', percenttype::class, ['label' => 'create.form.penalty']) is limitation of percenttype , should use type , add manually '%' indicator ? edit for future googler, while @emanuel oster right pointing official symfony documentation, wasn't obvious me first time read here example if want allow 2 decimals : form builder : ... ->add('penaltyrate', percenttype::class, [ 'label' => 'create.form.penalty', 'scale' => 2 ]) from symfony documentation : scale type: integer default: 0 by default, input numbers rounded. allow more decimal places, use option.

asp.net mvc - Display File From Local Drive in MVC view -

i have been trying display local pdffile d drive in view of mvc along other data.i have tried out iframe , added extensions browsers local links display of no use.i have been stuck problem since 3 days.i have tried out following code. <iframe src="@url.content("file:///d:/pdfsfolder/" + model.filename)"></iframe> this works fine me in ie not working in other browsers.when try open file using hyperlink works in browsers.my problem display along other data.please me out if there other way display file in view other iframe. you have write controller & action fetch file , pass response: public actionresult testpdf() { return file(@"d:\test.pdf", "application/pdf"); } and in view use iframe point controller action: <iframe src="<%= url.action("testpdf", "somecontroller") %>"></iframe>

database - Filemaker 13 calculations among unrelated tables -

i'm using database have several tables store information receipts , expenses. what produce format put overall balance, i.e. (table1.receipts_total + table2.receipts_total) - ( table3.expenses_total + table4.expenses_total) the main problem here these tables not related each-other , seems difficult deal aspect in filemaker. i thought there way runa low-level "raw" sql statement, not able that. first, suggest normalize data structure - since whatever current 1 hack. anyway, it's quite easy figure want without using executesql() - run simple script like: go layout [ table1.receipts ] show records set variable [ $balance; value:table1.receipts::stotalamount ] go layout [ table2.receipts ] show records set variable [ $balance; value:$balance + table2.receipts::stotalamount ] go layout [ table3.expenses ] show records set variable [ $balance; value:$balance - table3.expenses::stotalamount ] at point, $balance variable contain requested nu...

Create a sort of view tab with VBA in Excel -

is there way mirror data 1 tab in excel tab(view) if meets conditions(colour), , stop doing condition gets changed(colour gets changed in view)? unfortunately, couldn't figure out way formulas only. the reason need have shared excel file. new data added every week main data tab. data reviewed party, data added, , colour changed, playing ball us. there should 2 additional sheets. no colour/white: rows without colour can seen in view1. party1 knows need give input. when did so, change colour in view1 orange , rows can seen in view2 orange: orange rows can seen here clear need further processing. when party2 processed records, change colour green. data should not visible in view, should go green in main data tab. unfortunately green when comes vba, appreciated. thank you! the 3 tabs

web scraping - python beautifulsoup capture image -

using below script trying capture image , save on disk. , have save local path in db. i have writting simple code capture image webpage:- import urllib2 os.path import basename urlparse import urlsplit bs4 import beautifulsoup url = "http://www.someweblink.com/path_to_the_target_webpage" urlcontent = urllib2.urlopen(url).read() soup = beautifulsoup(''.join(urlcontent)) imgtags = soup.findall('img') imgtag in imgtags: imgurl = imgtag['src'] try: imgdata = urllib2.urlopen(imgurl).read() filename = basename(urlsplit(imgurl)[2]) output = open(filename,'wb') output.write(imgdata) output.close() except: pass the page code image :- <div class="single-post-thumb"> <img width="620" height="330" src="http://ccccc.com/wp-content/uploads/2016/05/weerewr.jpg"/> if want download image using url of image can try this import u...

Java using Map.Entry over a Map not compiling -

i getting error cannot seem fix myself, might stupid error, unable see it. map<templatebean, map<string, string>> templatemap = new hashmap<>(); //some code fills map int biggestsize = 0; map<string, string> biggestvalues = null; (map.entry<templatebean, map<string, string>> entry : templatemap.values()) { map<string, string> currentvalues = entry.getvalue(); int currentsize = currentvalues.size(); if (currentsize > biggestsize) { biggestsize = currentsize; biggestvalues = currentvalues; } } if (biggestvalues != null) { values = biggestvalues; } it giving error on for-loop: incompatible types required: entry<templatebean,map<string,string>> found: map<string,string> however pretty sure got correct, i'm not new iterating on maps or anything, still tuesday morning. regards. change line - for (map.entry<templatebean, map<string, string>> entry:...

Regex for nested XML attributes -

lets have following string: "<aa v={<dd>sop</dd>} z={ <bb y={ <cc x={st}>abc</cc> }></bb> }></aa>" how can write general purpose regex (tag names change, attribute names change) match content inside {} , either <dd>sop</dd> or <bb y={ <cc x={st}>abc</cc> }></bb> . regex wrote "(\s*\w*=\s*\{)\s*(<.*>)\s*(\})" matches "<dd>sop</dd>} z={ <bb y={ <cc x={st}>abc</cc> }></bb>" not correct. in generic regex there's no way handle nesting in way. hence wining when question comes - never use regex parse xml/html. in simple cases might advantageous though. if, in example, there's limited number of levels of nesting, can quite add 1 regex each level. now let's in steps. handle first un-nested attribute can use {[^}]*} this matches starting brace followed number of but closing brace, followed closing ...

jquery - Recaptcha not shown by colorbox -

Image
i using colorbox jquery show registeration form in popup box. i used following script initiate popup <script type="text/javascript" language="javascript"> $(".ajax").colorbox({width:"30%"}); </script> in popup called registration form recaptcha. can form fields in popupbox not recaptcha . i getting recptcha code place of recaptcha in ajax form noscript <iframe src="http://www.google.com/recaptcha/api/noscript?k=6ldxveqsaaaaadjtoplughy6irxjgrefwwwof47h" height="300" width="500" frameborder="0"></iframe> <br/> <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/> actual registration form without ajax recaptcha in popup can done following code ...

php - faster way in loading full screen background images -

ive tried use jquery in loading pixelated image while big images loading both know not practice.. can please lead me right direction on loading big images (140kb largest) without images suffering? ive seen several sites load full screen images in high resolution without effect loading time.. how that? hope can me

websocket - How to send message to a particular session using web socket in java? -

here below client side script websockets. in code have defined websockets object ip address , port. client script: var websocket = new websocket('ws://localhost:8080/spring4jsonhandling/websocket'); websocket.onmessage = function processmessage(message) { var jsondata = json.parse(message.data); jsonforlogout = jsondata; //var user=json.parse(username.data); console.log(jsondata); //to print if (jsondata.message != null){ var msgadd = json.stringify(jsondata.message); msgadd = msgadd.replace(/[&\/\\#,+()$~%.'"*?<>{}]/g, ''); alert("3"+msgadd); var xyz = msgadd.split(" : "); var logged = '${me}'; alert("logged" + logged); alert("xyz[0]" + xyz[0]); if (logged == xyz[0]){ alert("1"); $("#chat" + xyz[0]).chatbox("option", "boxmanager").addmsg(xyz[0],...

WARN: HHH000402: Using Hibernate built-in connection pool (not for production use!) -

developing java ee application next warning: warn: hhh000402: using hibernate built-in connection pool (not production use!) información: hhh000401: using driver [com.mysql.jdbc.driver] @ url [jdbc:mysql://localhost:3306/city-help-point?zerodatetimebehavior=converttonull] información: hhh000046: connection properties: {user=chp, password=****} información: hhh000006: autocommit mode: false información: hhh000115: hibernate connection pool size: 20 (min=1) información: hhh000400: using dialect: org.hibernate.dialect.mysql5dialect información: hhh000397: using astquerytranslatorfactory información: hhh000030: cleaning connection pool [jdbc:mysql://localhost:3306/city-help-point?zerodatetimebehavior=converttonull] información: hhh000204: processing persistenceunitinfo [ name: chppun ...] how can avoid them?

jquery - Hiding <video> on iphone with bootstrap -

<video width="100%" height="100%" id="video" class="hidden-xs hidden-sm"> <source src="video.mp4" type="video/mp4"> </video> <div class="text-center"> <ul class="list-inline controls"> <li><a href="#" id="back"><img src="./css/images/back.png"></a></li> <li><a href="#" id="pause"><img src="./css/images/play.png"></a></li> <li><a href="#" id="stop"><img src="./css/images/stop.png"></a></li> <li><a href="#" id="forward"><img src="./css/images/forward.png"></a></li> </ul> </div> $('#pause').click(function(e) { e.preve...

php - How to upload video from local pc in ckeditor? -

please advice me how upload video(.flv,mp3,etc) in ckeditor using ckfinder in php. if have demo please provide link. instead of ckfinder if have better option(plug in), please give me demo link , advice me how integrate? thanks you have set few parameters in ckeditor config point uploading script: filebrowserbrowseurl: "index.php?route=filemanager/index", filebrowserimagebrowseurl: "index.php?route=filemanager/index", filebrowserflashbrowseurl: "index.php?route=filemanager/index", filebrowseruploadurl: "index.php?route=filemanager/index", filebrowserimageuploadurl: "index.php?route=filemanager/index", filebrowserflashuploadurl: "index.php?route=filemanager/index" and in php file save file: public function index() { $file = !empty($_files['upload']) ? $_files['upload'] : null; $fileurl = ''; if (!empty($file) && !empty($_get['ckeditor']) && !e...

python - AttributeError type object Person has no attribute id -

i created edit form edit name of person. based on related stackoverflow answers on subject changed model , view, after changes follow error persists: attributeerror @ /persion/4/edit type object 'person' has no attribute 'id' models.py: class person(models.model): person_text = models.charfield(max_length=200) pub_date = models.datetimefield(auto_now_add=true) urls.py url(r'^(?p<pk>\d+)/edit/$', views.person_edit, name='person_edit'), views.py def person_edit(request, pk): obj = get_object_or_404(person, pk=pk) if request.method == "post": form = personform(request.post, instance=obj) if form.is_valid(): obj = form.save(commit=false) obj.name = request.person_text obj.save() return redirect('/person/index.html',context) else: form = personform(instance=obj) return render(request, 'person/edit_person.html...

ruby on rails - Mocha mocking class method include before_filter -

i'm trying test before_filter being called concern. test looks this: class authorizablecontroller < applicationcontroller include authorizable end describe authorizable let(:dummy) { authorizablecontroller.new } "adds before filter class" authorizablecontroller.expects(:before_filter).with(:authorize) dummy.class_eval |klass| include authorizable end end end my concern looks so: module authorizable extend activesupport::concern included before_filter :authorize end end ...and i'm getting error looks (no mention of mocha, , instead minitest, when i'm using rspec...): failures: 1) authorizable adds before filter class failure/error: authorizablecontroller.expects(:before_filter).with(:authorize) minitest::assertion: not expectations satisfied unsatisfied expectations: - expected once, not yet invoked: authorizablecontroller.before_filter(:authorize) # ./spec/controllers/...

java - How to compare excel file table and mysql table and insert data into mysql column wise using jsp? -

i new in jsp , apache poi library, have 1 excel file data: my excel sheet and have 1 mysql table "data" column name "address" , "name". using following code insertion excel data mysql table. data insertion complete. <%@ page language="java" import="java.sql.*" contenttype="text/html charset=iso-8859-1" pageencoding="iso-8859-1"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <%@ page import ="java.util.date" %> <%@ page import ="java.io.*" %> <%@ page import ="java.io.filenotfoundexception" %> <%@ page import ="java.io.ioexception" %> <%@ page import ="java.util.iterator" %> <%@ page import ="java.util.arraylist" %> <%@ page import ="javax.servlet.http.httpservletrequest"%> ...

mysql - Changing list answers in python -

i've been trying input mysql table using python, thing i'm trying create list dates april 2016 can insert them individually sql insert, searched didn't find how can change value per list result (if it's 1 digit or 2 digits): dates = ['2016-04-'+str(i+1) in range(9,30)] i i add 0 every time i single digit (i.e 1,2,3 etc.) , when double digit stay way (i.e 10, 11, 12 etc.) using c style formatting, dates in april: dates = ['2016-04-%02d'%i in range(1,31)] need range(1,31) since last value in range not used, or use range(30) , add 1 i. the same using .format(): dates = ['2016-04-{:02}'.format(i) in range(1,31)]

java - How could we improve or increase spring connection handling capacity on the server side for any web or application server? -

if handle http request on server side using spring framework, how can check connection limit , how increase connection handling capacity. if 1 have solution please me. the http connection handling depends on configuration of web/application server. example in tomcat in server.xml, following parameters of http io/nio connectors can configure number of connections server can handle. maxconnections - maximum number of connections server accept , process @ given time. when number has been reached, server accept, not process, 1 further connection. additional connection blocked until number of connections being processed falls below maxconnections @ point server start accepting , processing new connections again. acceptorthreadcount - number of threads used accept connections. more 2 not required in multicore machines. other parameters affect same - connectionlinger , connectiontimeout etc. for more details check this

menu - nav-bar in wordpress is not displayed to mobile devices -

i have create nav bar describe convert bootstrap navbar wordpress menu can see menu in desktop menu not displayed in mobile devices. in mobile devices can see button menu displayed menu not displayed. <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"><div class="container"> <!-- brand , toggle grouped better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="nav navbar-nav"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <?php wp_nav_menu( array( 'menu' => 'pri...

how to eliminate empty arrays from an array of arrays in ruby? -

i have array of arrays. want eliminate empty arrays. iam using reject!(&:empty?) method. giving me unexpected results. 2.2.2 :306 > array = ["yes","yes","yes"] => ["yes", "yes", "yes"] 2.2.2 :307 > array.split("no") => [["yes", "yes", "yes"]] 2.2.2 :308 > array.split("no").reject!(&:empty?) => nil 2.2.2 :309 > array_with_no = ["yes","yes","yes","no"] => ["yes", "yes", "yes", "no"] 2.2.2 :310 > array_with_no.split("no") => [["yes", "yes", "yes"], []] 2.2.2 :311 > array.split("no").reject!(&:empty?) => nil 2.2.2 :312 > array_with_no.split("no").reject!(&:empty?) => [["yes", "yes", "yes"]] 2.2.2 :313 > i want result when there...

eclipse php xdebug doesn't stop at breakpoint -

zend eclipse php developers version: 3.2.0 php5.4.12 (wamp) i'm using php eclipse xdebug few years - sometime xdebug doesn't break. i notice happen on ajax calls, , found 1 cause previous debug session didn't end. but i'm debugging ajax call, i'm using chrome devtool , 'replay xhr' run exact same ajax call, , doesn't break 2 out of every 3 runs. this great waste of time me , appreciate idea of how overcome it, including suggestion different (and better debugger) note: upgrading php not option because must use same version production sev. i tried upgrading eclipse - causes many (other) issues in eclipse->preferences->php->debug->installed debuggers choose xdegbug, , click configure check use multisession checkbox click ok this cause xdebug break when session running - can pain when submiting multiple requests.

linux - Idea of memory reservation -

could explain me idea behind reserving memory in operation systems? why need "reserved" state @ all? enough have "free" , "commited"? reservation not eliminate probability of fault: attempt commit reserved memory still can fail if lack of resources. so, not guarantee anything. if question requires background appreciate references literature explaining matter. thanks in advance.

FragmentTransaction with CustomAnimation android 4+ -

i've notice since android 4+ cannot use animation anymore , objectanimator. i'm trying use slide-in animation according y scale. (should start -100% > 0 , 0 > 100%) thing objectanimator gets float value. example 1 of animation: <objectanimator xmlns:android="http://schemas.android.com/apk/res/android" android:propertyname="y" android:valuetype="floattype" android:valuefrom="-1280" android:valueto="0" android:duration="500"/> how can set valuefrom & valueto run ok on screens? or maybe there's way implement animation. help see roman nurik's answer here, shows full-screen scalable slide animation creating custom property: animate transition between fragments

android layout - Activity with two fragments showing different on screen rotation -

Image
i have 1 activity fragments. don't know how make layout 1 under in portrait orientation, , 1 next other in landscape orientation. have make 2 layouts , check orientation in "oncreate" method , render appropriate one? or should set layout differently? (as now, ok in portrait view, in landscape view overlap). here layout: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context="com.apps.rucsi.biorhytm.mainactivity"> <fragment android:name="com.apps.rucsi.biorhytm.inputfragment" android:...

google app engine - How to connect to a Cloud SQL instance in Netbeans -

using netbeans 7.3, trying connect cloud sql instance. have authorized project on local machine gauth using python 2.7. though create oauth 2.0 tokens needed when test connection using "com.google.cloud.sql.driver", connection cannot established. plan deploy java application on app engine, using kind of orm againts any suggestions make connection work? i had same problem yesterday : must download , launch google cloud sql command line tool. allow authorize google account access cloud sql service oauth2 authentication on local machine. follow steps described here : https://developers.google.com/cloud-sql/docs/commandline once application deployed on app engine, need configure database allow application access it. that's pretty straightforward, see google apis console : https://code.google.com/apis/console/ edit : can use simple mysql jdbc connector , configure cloud sql instance fixed ip. means can access cloud sql instance anywhere classic mysql datab...

mysql - Mysql2::Error: Unknown column 'sum_hours' in 'field list' -

its been 2 months since started learn rails doing modifications on plugin of redmine in enterprise (as student learning way of "life"), problem cant find solution anywhere. let me explain: i needed group huge ammount of time entries user_id , project_id(no problems that) if need sum hours in groups. the estructure this: | id | project_id | user_id | issue_id | hours | and information built method : def time_entries_for_user(user, options={}) extra_conditions = options.delete(:conditions) return timeentry.select('*,sum(hours) sum_hours'). includes(self.includes). where(self.conditions([user], extra_conditions)). group('issue_id, time_entries.project_id'). order('issues.id asc') end i added select because needed column plus sum 1 , group alone works , cant make sum columns appear. json code result of method: {"test1 / subproyectotest1":{"logs":[{"id":24,"project_id...

pointers - C - Calculator with parameters -

i try create simple calculator c. numbers , operators should parameters. have main function , calculate function: main: int main(int argc, char *argv[]){ long result; long number1 = strtol(argv[1], null, 10); long number2 = strtol(argv[3], null, 10); result = calculate(number1, number2, argv[2]); printf("result: %li", result); return 0; } calculate: long calculate(long number1, long number2, char operator){ long result; switch(operator){ case '+': result = number1 + number2; break; case '-': result = number1 - number2; break; } return result; } when start program this: ./calc 1 + 2 the result 0. think there problem operator parameter, because when write '+' instead of argv[2] works. dont know how fix it, works parameter, too. one problem calculate function expects char , main passes c string. problem when unexpected parameter passed, switch fails set result , l...

delphi - How to get "Library" path on actual iOS device -

i using following code app base directory: // /private/var/mobile/applications/exampleid/example.app/ fappdatadirpath := gethomepath + pathdelim + application.title + '.app' + pathdelim; // /private/var/mobile/applications/exampleid/example.app/library/ fappdatalibrarydirpath := fappdatadirpath + 'library' + pathdelim; on ios simulator both these paths exist. however, on ios device fappdatadirpath exists. "library" variation can not created using e.g forcedirectories what wrong? :(

How to plot several boxplots by group in r? -

Image
id <- 1:10 group <- c(1,1,1,2,2,2,3,3,3,3) var1 <- c(6:15) var2 <- c(7:16) var3 <- c(6:11, na, na, na, na) var4 <- c(4:9, na, na, na, na) data <- data.frame(id, group, var1, var2, var3, var4) library(dplyr) data %>% group_by(group) %>% boxplot(var1, var2) the last line not work wish. idea 4 boxplots in 1 graphic. 2 each variable. maybe need use ggplot2? you need reorganize data if want both variables in same plot. here ggplot2 solution: # load library library(ggplot2) library(tidyr) library(ggthemes) # reorganize data df <- gather(data, "id","group") #rename columns colnames(df) <- c("id","group","var","value") # plot ggplot(data=df) + geom_boxplot( aes(x=factor(group), y=value, fill=factor(var)), position=position_dodge(1)) + scale_x_discrete(breaks=c(1, 2, 3), labels=c("a", "b", "c")) + theme_minimal() + ...

Jenkins inside docker loses configuration when container is restarted -

i have followed next guide https://hub.docker.com/r/iliyan/jenkins-ci-php/ download docker image jenkins. when start container using docker start containername command, can access jenkins localhost:8080 . the problem comes when change jenkins configuration , restart jenkins using docker stop containername , docker start containername , jenkins doesn't contain of previous configuration changes.. how can persist jenkins configuration? you need mount jenkins configuration volume, -v flag you. (you can ignore --privileged flag in example unless plan on building docker images inside jenkins docker image) docker run --privileged --name='jenkins' -d -p 6999:8080 -p 50000:50000 -v /home/jan/jenkins:/var/jenkins_home jenkins:latest the -v flag mount /var/jenkins_home outside container in /home/jan/jenkins maintaining between rebuilds. --name have fixed name container start / stop from. then next time want run it, call docker start jenkins ...

javascript - Percentage calculation error -

i trying calculate percentage of number (taken 1 text field) , set calculated value form field. have tried below code observing mismatch in key event/decimal places js detecting. for example if provide 100 in first input field (to calculate percentage of 1.75), based on js code expect 1.75 in second text field coming 0.175. know simple calculation unable solve this. var refee = document.getelementbyid("estimated referral fee"); var lnamt = document.getelementbyid("loan amount"); refee.disabled = true; lnamt.onkeydown = function isnumber(evt) { evt = (evt) ? evt : window.event; var charcode = (evt.which) ? evt.which : evt.keycode; if (charcode > 31 && (charcode < 48 || charcode > 57)) { return false; } calcper(lnamt.value); } function calcper(amtval) { var pernum = 1.75; refee.value = (pernum / 100) * amtval; } <div class="form-group"> <label class="contro...

linq - C# get every n-th element with WHERE, strange result -

using system; using system.collections.generic; using system.linq; public class test { public static void main() { list<int> list = new list<int>(); for(int = 0; < 16; ++i) list.add(i); console.writeline(string.join(" ", list.where((o, i) => % 4 == 0).select((o, i) => i).toarray())); } } can explain, why code above returns 0 1 2 3 instead of 0 4 8 12? because selecting index instead value. try this: console.writeline(string.join(" ", list.where(o =>o % 4 == 0).select((o, i) => o).toarray())); if not going nothing index this: console.writeline(string.join(" ", list.where(o => o % 4 == 0).toarray()));

excel vba - How to identify a hidden carriage return character in a UNIX text file over VBA? -

Image
i have application written in excel/vba reads text files written in unix. these files consist in finite element modeling simulation settings, each line in 20k+ text file individual setting. application searches particular setting , returns them user in plain english. particular line this: model.settings.excitation.modes=50 so far, line of code worked find text between '=' sign , end of line instr(1, filecontents, vblf) where filecontents whole text file after '=' symbol. something somewhere upstream of application has changed assumed carriage return character 'vblf' cannot found, there when viewing in notepad++. application depends on finding carriage return, , doesn't work. i have tried using : asc(mid(adsfilecontentsx, 3, 1)) to isolate carriage return character end character next line, doesn't work either. i tried of below well instr(1, filecontents, vblf) instr(1, filecontents, vbcrlf) instr(1, filecontents, vbcr) instr(1, fil...

Universal(Fat) framework with CocoaPods -

cocoapod create frameworks, if adopt "use_frameworks!" in podfile. these frameworks located in ${build_style}-${platform_name} have 4 instances of same framework: debug-iphoneos release-iphoneos debug-iphonesimulator release-iphonesimulator how build universal framework cocoapods ??

c# - Editorfor checkbox field onclick -

i have editorfor field checkbox , when changed false true , form submitted need track checkbox changed , marked true. has javascript or jquery function. <div class="editor-field"> @html.editorfor(model => model.ispublic) </div> if need explain better please tell me. cant think of how else explain.thanks hope following code it: @html.hiddenfor(model => model.ispublicchanged) @*create special model field handling change event*@ $().ready(function () { //catch change event , assign value hidden field $("input[name=ispublic]").on("change", function () { $("input[name=ispublicchanged]").val('true'); }); }); or different js-code if want see if value of checkbox changed comparing it's initial value: $().ready(function () { var trackvalue = $("input[name=ispublic]").prop("checked"); $("form").on("submit", function () { ...

sql - search refinement in WebMatrix -

i starting build web page refine search results. code below works pretty well, , if add 1 of query strings (ie, ?beds=4, returns correct results. if, however, specify both query strings (ie, ?beds=4&sleeps=8, returns results matching either (all propertys 4 beds (regardless of sleeps) , propertys 8 sleeps (regardless of beds), , not both. need sort of , statement, results match beds , sleeps? @{ layout = "~/_sitelayout.cshtml"; page.title = "search"; string searchtext = request.unvalidated["searchtext"]; var searchterms = searchtext.split('"').select((element, index) => index % 2 == 0 ? element.split(new[] { ' ' }, stringsplitoptions.removeemptyentries) : new string[] { element }).selectmany(element => element).tolist(); (int i=0; i<searchterms.count; i++) { if (searchterms[i].toupper() == "the" || searchterms[i].toupper() == "and" || searchterms[i].toupper() == "as" || searchterm...