Posts

Showing posts from August, 2013

c# - Is there a form Level Method or Event that fires after the keyDown event of focused control not before? -

the following method occurs before event parsed focused control. protected override bool processcmdkey(ref message msg, keys keydata) { return base.processcmdkey(ref msg, keydata); } i want exact opposite of method, meant want method or event occurs after child control's keydown event. any reason not store response, work allow response bubble? protected override bool processcmdkey(ref message msg, keys keydata) { var ret = base.processcmdkey(ref msg, keydata); dosomething(); return ret; } if needs be, dosomething() method can take msg , keydata , return value base.processcmdkey . depends need it. if that's no quite want, you'll need explain "just after" little better. how long after?

c# - How to focus a visual .NET-Component in Delphi ObjectInspector -

i'm including visual .net-component delphi project. using component @ runtime works fine while delphi designer not cooperate properly. every click on component in designer sends message component (the impact can seen). want see published properties of component in ide designer's object inspector resize , drag , drop component on form. i considered inherit twincontrol.wndproc method , catch wm_mouseactivate , wm_parentnotify messages (those messages sent when clicking component in designer) , this... procedure tmycomponent.wndproc(var message: tmessage); case message.msg of wm_parentnotify, wm_mouseactivate: begin self.setfocus; self.borderwidth := 15; end; else inherited; end; end; clicking component in designer setting borderwidth 15 now. still not focused in ide's object inspector. additional information project: i using delphi xe7 , visual studio 2013... in .net i'm using classlibrary project component. inherit class u

vectorwise - SQL - Months and Dates -

month , date funtions sql ok, don't know vectorwise or how ansidate stored, however, if it's stored integer value assume represents amount of time, measured on specific time unit since starting time point. if it's true, can convert 3 months time unit in ansidate being stored , add converted value.

Is it possble to do comparion of two variables in javascript of different types -

i having jstree , in javascript function checking node has been selected thats working fine. when assign node value variable comparasion normal string variable thats not working. $(document).ready(function() { $('#bdeviewnew').on('changed.jstree', function(e, data) { var i, j, r = []; (i = 0, j = data.selected.length; < j; i++) { var x = data.instance.get_node(data.selected[i]).text; r.push(data.instance.get_node(data.selected[i]).text); if(x=="hadoop") {alert("hi");} else{ alert("hello"); } } }); }); any 1 know how can such comparasion? thanks in advance it possible variable has unexpected whitespace @ start or end, that's common problem. should able rid of with var x = data.instance.get_node(data.selected[i]).text.trim(); should work on modern browsers. also keep in mind jav

string parsing - java.text.ParseException: Unparseable date: "531772200000" -

i need convert string 531772200000 java date object. date stored in database. when doing this, getting java.text.parseexception: unparseable date: "531772200000" . my code: string datetobeconverted = string.valueof(dbobject.get("customerdateofbirth")); string parseabledate = datetobeconverted .replace("/date(","") .replace(")/","") .replace("+0530", ""); dbobject.put("_id", string.valueof(dbobject.get("userinfoid"))); simpledateformat formatter = new simpledateformat("dd-mmm-yyyy"); date date; date = formatter.parse(parseabledate); this looks timestamp value, give date: new date(long.parselong("531772200000")); which works out @ fri nov 07 1986 18:30:00 gmt+0000

http - How to prevent Denial of Service (DoS) using IIS? -

Image
i've detected ips perform lots of requests website. want block these massive requests, because generate lot of traffic. used iis address , domain restrictions block these ips: this method requires monitorize iis every day , add rule manually. is there feature in iis, or best practice perform task automatically? thanks in advance dos attacks cannot prevented @ web server level. requires commercial firewall, or cloud based services such cloudflare . like discovered, manual configuration on iis, or simple scripting won't save that.

javascript - Value of HTML input range, getattribute vs value -

i have created html input element type="range" , id="slider". why cannot access value using getattribute("value") method? debugger shows there attribute named "value" value not equal value of element. should not value of range element attribute? var slidervalue1=document.getelementbyid("slider").getattribute("value"); var slidervalue2= document.getelementbyid("slider").value; why cannot access value using getattribute("value") method? you can't because, .getattribute("value") return value of element write html (if don't change that, default value). example: with: <input type="range" id="slider" value="500"> document.getelementbyid("slider").getattribute("value"); return 500 if use input change range. debugger shows there attribute named "value" value not equal value of element. it's

sublimetext3 - SublimeText Find in files Plugin -

i have source code base lot of re-directions (mostly #defines) want write plugin find definition, , automatically find "references". i'm done "conversation", 10 find size_of_hashstag or etc, can not start automatic(built in) find in files method. i tried: where = 'my_src_dir' args = { "panel": "find_in_files", "in_selection": "true", "where": where} sublime.active_window().run_command("show_panel", args) ofc myself python script, easier if use built-in.

c++ - WxWidgets Show form after first is closed -

i'm working on project involves ogre 3d part , wxwidgets user interface. have followed hello world tutorial , i'm able create application, window , message map. goal display @ startup window can choose specific settings fullscreen, texture quality , other application specific settings. after have chosen settings, window needs close , start ogre part settings window. i have tried put code start new window ogre in init function: bool myapp::oninit() { myframe *frame = new myframe( "settings", wxpoint(50, 50), wxsize(640, 480) ); frame->show( true ); start_ogre(); return true; } the problem both forms showed @ same time. application, frame , window in code split in seperate classes. tried put code in main.cpp after wxwidget code: wximplement_app(myapp); start_ogre(); this gives same problem. tried in close event, nothing. is there easy way make ogre form show when settings form closed without shutting down application or starting both @ same time?

php - Display data from mysql/phpmyadmin on html page -

i'm beginner in php . have tried put php in html file in order call data database called test , table called myemployee. tried recommendation other forum still did not display in table, instead, code displayed. following code. there wrong in code? even if put in php file , then, call html file <?php include ('test.php')?> still didn't work. <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>home</title> <link href="style/index-layout.css" rel="stylesheet" type="text/css" /> <link href="style/homepage-layout.css" rel="stylesheet" type="text/css"/> </head> <body> <!--right--> <div id="body"> <div id="left"> <br /><br /> <p ><b><h3>progress</h3></font></b></p> </div></div> <?php $username = "

if statement - Excel - check if one of the rows with same number has a value in an other column -

i have problem data request trying analyse automatically. data consists of number of values , depening on formula answer in specific column set "yes" or "no". want check if 1 of rows containing same number have answer "yes" in second column. the number of rows same number in can vary. the solution might simple, can't seem right formula determine it. hope can me out. below example of dataset , expected outcome. 1 yes 1 yes 2 no 3 no 3 yes 4 no 4 no 5 yes 5 yes 5 no 5 no 5 no 6 no 6 yes so based on dataset result should be: 1 yes 2 no 3 yes 4 no 5 yes 6 yes assuming data in columns a:b , c:c column numbers 1-6 : =if(countifs($a:$a,$c1,$b:$b,"yes")>0,"yes","no")

entity framework 4 - Why SaveChanges method takes up memory? -

while preparing large amount (several thousand rows) of data , insert them database through entity framework, creating entity objects or in-memory object-graphs doesn’t take memory, when savechanges() method called, on duration continues consume noticeable amount of memory until method returns. what happens under-the-hood during period of savechanges() call causes memory consumption? it depends on depth of object graph, deeper graph more memory going consumed. more costly operations happen after call savechanges following: views generated queries: before ef can execute query against model, must generate a set of local query views access database. more complex object graph is, more complicated views, although can pre-generated improve performance. queries prepared: ef composes query commands, generates command trees based on metadata etc. again, cost rises increased query complexity. the cost of executing queries relatively low. see here more info. in general,

Python Mechanize response on submit -

i'm trying fill form , print response page in mechanize, when use browser.reponse() , response <response_seek_wrapper @ 0x21f0648 wrapped object = <closeable_response @ 0x21fc3a0 fp = <socket._fileobject object @ 0x021edd70>>> how print html response? i think browser.response().read() return expected. source : http://www.pythonforbeginners.com/cheatsheet/python-mechanize-cheat-sheet

html - Unable to type in text input in Firefox & IExplorer -

i have basic registration form on website. while testing in different browsers noticed functioning in chrome not in firefox or iexplorer. in both firefox , iexplorer i'm unable type in of input fields. don't know what's causing , i'm not getting errors. here's page. you can type in fields, can't see text because padding , height inside text boxes pushing text around inside text box, moving outside visible area of input field. the following remove unnecessary vertical padding: #registration input, #registration textarea { /* other properties */ padding: 0px 8px; }

elasticsearch - _all field in match phrase prefix query -

my documents have field product_code containing string value pc00xxa x replaced digit 1..9. i'm expecting result of 9 documents phrase prefix query: { "query": { "match": { "_all": { "query": "pc001", "type": "phrase_prefix" } } } } ... result empty. using product_code instead of _all , expected 9 documents. using prefix query instead of phrase prefix query seems work expected both _all , product_code fields. following query gives me 9 documents: { "query": { "prefix": { "_all": { "value": "pc001" } } } } elasticsearch documentation says "the match_phrase_prefix same match_phrase, except allows prefix matches on last term in text". in case have 1 term in query expect work prefix. how phrase prefix query differ prefix query when query contains single term? , why

javascript - Stop Movement on Collision -

i'm creating little game in javascript , have created collision detection function detects when 2 images collide. have player image , enemy image , move player around arrow keys. when collide enemy image want player not able cross on image still able move, colliding wall or something. don't know how go cant supply , example code can give collide function , player objects; //player objects var playerimg = new image(); playerimg.src = "../images/player.png"; var playerready = false; playerimg.onload = function(){ playerready = true; }; var player = { x: 300, y: 150, speed: 200 }; //collide function function collisioncheck(img1, img2, obj1, obj2, width){ var colliding = false; if(obj1.x < obj2.x + width && obj1.x + width > obj2.x && obj1.y < obj2.y + width && obj1.y + width > obj2.y){ colliding = true; }else{ colliding = false; } return colliding; } may

java - OpenJPA Cache not working -

i using openjpa 2.1.0 manage entities , trying activate cache 1 of them. have followed next steps: i have added next lines in persistence.xml file. <shared-cache-mode>enable_selective</shared-cache-mode> <properties> <property name="openjpa.datacache" value="true(types=com.example.entitytocache)"/> <property name="openjpa.remotecommitprovider" value="sjvm"/> </properties> and annotation @cacheable in entity. @entity @javax.persistence.cacheable public class entitytocache implements serializable { @id private string id; } but cache not seem work. debugging can see entitytocache objects added cache, , cache.get method called everytime want retrieve object, calls database executed every time. failing cache. any ideas why not working? thanks in in advance.

asp.net mvc - Display value in Database DataContext -

this query => var department = datacontext.query<department>("select id tbldepartment"); i want display values in variable department in viewbag or anywhere.how can that? var department = datacontext.query<department>("select id tbldepartment").tolist() and work list

Return the first n elements of an array in Coffeescript -

what best way return first n elements of array in coffeescript? if there fewer n elements in array, array should returned unchanged. these 2 solutions came with: with loop , break: arr = ["one", "two", "three", "four", "five"] n = 3 firstn = [] in [0..n-1] if arr[i] firstn.push(arr[i]) else break with list comprehension arr = ["one", "two", "three", "four", "five"] n = 3 firstn = (arr[i] in [0..n-1] when arr[i]) both of these work, neither clean. first not clear @ first glance. second better iterates on whole array unnecessarily , looks value twice each element in output. there better way? use array slicing ( http://coffeescript.org/#language ) arr = ["one", "two", "three", "four", "five"] arr[..2] works want if there fewer n element in array (just returns whole array)

svg - Ruby's named parameters with hyphens -

i have generate svg files, , doing ruby's nokogiri. nice thing nokogiri lets create attributes passing hash "functions", so doc.rect(:x => 0, :y => 0, :width => 100, :height => 100) which great. there attributes have hyphens: in case can take advantage of ruby's awesomeness , like doc.rect(:x => 0, :y => 0, :width => 100, :height => 100, :stroke => 'black', 'stroke-width' => 3) and relatively well. enter ruby 2.0 , named parameters. prefer syntax, it's bit more concise , bit more smalltalkesque, like. however, way create hyphenated attributes mix 2 approaches, provided place 'hash' after named parameters (i assume has way, haven't checked). in case, it's ugly. is there way wise people can conjure create hyphenated attributes using named parameters syntax? edit : clarify, named parameters this: doc.rect(x: 0, y: 0, width: 100, height: 100) use either 'stroke-width'.to

ios - Embedding TableView in TableViewController into another view -

i customize content of table view controller(add buttons, etc.) root view table view. way embed view , add controls on it? you can use container view . in storyboard create view controller use host controls. drag in container view object library (normally last item in list) , place want table view appear (which whole screen). doing this, container view create view controller. delete , ctrl drag container view table view controller , select embed segue. by doing this, not have change in current table view controller if doesn't depend on other view controllers give data in order work. if does, however, assign segue identifier embed segue, implement prepareforsegue:sender: , whatever other segues.

java - Why do you need synchronous interface for GWT RPC? -

i wondering why need define synchonous interface when using gwt rpc calls asynchornous ( http://www.gwtproject.org/doc/latest/devguideservercommunication.html )? i not see synchornous interface used! i.e. why can't implement synchonous interface in our service implementation class? from documentation: http://www.gwtproject.org/doc/latest/devguideservercommunication.html#devguidecreatingservices this synchronous interface definitive version of service's specification. implementation of service on server-side must extend remoteserviceservlet , implement service interface. package com.example.foo.server; import com.google.gwt.user.server.rpc.remoteserviceservlet; import com.example.client.myservice; public class myserviceimpl extends remoteserviceservlet implements myservice { public string mymethod(string s) { // interesting 's' here on server. return s; } } tip: not possible call version of rpc directly client. must create asy

oracle - SQL Dynamic ASC and DESC -

i have following sql statement order clause passed dynamically . how can pass 'order asc , desc' dynamically sql? select table1.prod_id,table2.prod_name table1 left outer join table2 on table1.prod1 = table2.prod_id order case when :odb = 1 prod_id end i pass order asc or desc above sql dynamically, how can this? you can solutions @tonyandrews manipulating numeric or data values. varchar2 alternative dynamic sql have 2 expressions: order case when :sorting='asc' col1 end asc, case when :sorting='desc' col1 end desc when :sorting has value 'asc' result of order by becomes if had been: order col1 asc, null desc when :sorting has value 'desc' result of order by becomes if had been: order null asc, col1 desc one downside method cases optimizer can skip sort operation because there index involved makes data sorted desired, not happen when using case method this. mand

i18next json dot in key or label -

js: i18n.t("some text translated.") json: "some text translated.": "een stukje tekst om te vertalen" i18n.t("some text translated.") gives me "some text translated.". if remove "." (dot) label , function t, text translated. how solve this? documentation explains dot default treated key separator. can replace dot &#46; put dot outside translated string i18n.t("some text translated") + "." change key separator you can change namespace and/or key separator setting options on init: nsseparator = ':::' keyseparator = '::'

c++ - Pointer casts for itk::SmartPointer? -

i'm looking std::static_pointer_cast , std::const_pointer_cast , , std::dynamic_pointer_cast std::shared_pointer . i tried itk's documentation , itk::smartpointer 's source code , found nothing smart pointer casting. in 1 particular case needed add 'constness' pointer (convert itk::smartpointer<t> itk::smartpointer<const t> ) in order pass third-party function. passing raw pointer out of question because data deleted once automatically created const smart pointer goes out of scope. the relatively safe solution found: static_cast<itk::smartpointer<const t>>(itk_smart_pointer_of_t) . i don't know whether approach thread-safe or has other possible pitfalls. moreover, in case of dynamic_cast things messier. it seems strange itk doesn't have native std::const_pointer_cast -like , other casts. tl;dr : itk::smartpointer doesn't need pointer casts, cast "raw" pointer , re-wrap instead. itk smart

Set Default Element in CKEditor -

Image
i have custom style set called 'paragraph', (obviously) creates p element user enter text into. when first entering ckeditor area, no style set , user entering text inside no specific element. eg location bar @ bottom reads body is there way can make editor default having p element when user first enters editor area, in body > p ? i've spent while checking documentation, , can see how set default font , font size, isn't want. edit here styles.js file have customised provide styles: ckeditor.stylesset.add( 'default', [ /* block styles */ // these styles available in "format" combo ("format" plugin), // not needed here default. may enable them avoid // placing "format" combo in toolbar, maintaining same features. { name: 'paragraph', element: 'p' }, { name: 'heading 1', element: 'h1' }, { name: 'heading 2', element: 'h2' }, { name: 'heading 3

c# - Datagrid binding with LINQ results? WPF -

i trying bind(no code behind =)) datagridview example wpf application results of linq. must pretty easy missing "somehow" somewhere. things must consider: first of using oracle db , have made mappings, having result: this.searchcommand = new relaycommand(this.displaymessage, candisplaymessage); } public bool candisplaymessage() { return true; } public void displaymessage() { using ( entities ctx = new entities()) { var query = e in ctx.employees select new { e.employee_id,e.first_name, e.last_name, e.email, e.phone_number, e.salary, e.department_id}; var results = query.tolist(); } } http://s27.postimg.org/ya0crw701/linqresults.jpg i know have bind datagrid itemssource, have have made it. used observablecollection bind results datareader (with normal sql commands...) datagrid. xaml looks this: <datagrid grid.row="1&q

io - How to decode base64 file into binary in Python? -

i'm building system handles pdf file data (for use pypdf2 lib ). obtain base64 encoded pdf can decode , store correctly using following: import base64 # base64filedata <= base64 file data filedata = base64.urlsafe_b64decode(base64filedata.encode('utf-8')) open('thefilename.pdf', 'w') thefile: thefile.write(filedata) i want use filedata binary file split up, when type(filedata) , filedata turns out <type 'str'> . how can convert filedata binary (or @ least not string)? all tips welcome! [edit] if open(filedata, 'rb') error, saying typeerror: file() argument 1 must encoded string without null bytes, not str to remove null bytes tried, filedata.rstrip(' \t\r\n\0') , filedata.rstrip('\0') , filedata.partition(b'\0')[0] , nothing seems work. ideas? [edit2] the thing pass string pypdf2 pdffilereader class , on lines 909 912 following (in stream filedata provide): if type(str

Jquery Ajax call works with HTML but not JSON -

i have started work drupal 8 , doing ajax calls server using fresh controller system implemented drupal team. my problem occurs when have defined route , make ajax call using jquery. if set datatype "json" receive 404, changing "html" work. the function route points looks this: function createresponse(){ return new jsonresponse(['data' => 'test']); } my response/request-headers this: response cache-control must-revalidate, no-cache, post-check=0, pre-check=0, private connection keep-alive content-encoding gzip content-language en content-type application/json date wed, 19 nov 2014 12:20:35 gmt expires sun, 19 nov 1978 05:00:00 gmt keep-alive timeout=10 server nginx transfer-encoding chunked vary accept-encoding x-powered-by php/5.5.18-1~dotdeb.1 x-ua-compatible ie=edge,chrome=1 request header accept application/json, text/javascript, */*; q=0.01 accept-encoding gzip, deflate accept-language en-us,e

get value of ddl, txtbox, calendar used in user control on main page using findcontrol in asp.net c#? -

i want task in want using findcontrol during use of webusercontrol on web form value of webusercontrol on main page mean, i've created webusercontrol , have used on web form. in webusercontrol.ascx page use textbox, calendar, , dropdownlist. want value(which choose txtbox, ddl etc) should display on main page. mean, want use button on default.aspx page , in variable want store value of txtbox, calendar etc. , using findcontrol want these values on main page. how can plz me code plz i'm new in programing. this code of ascx page <%@ control language="c#" classname="calendarusercontrol" %> <asp:textbox id="txtdata" runat="server"></asp:textbox> <br /> <asp:calendar id="calendar1" runat="server" backcolor="beige" > </asp:calendar> <br/> <asp:dropdownlist id="ddlthings" runat="server"> <asp:listitem> apple&l

How to seperate data in one variable php -

i have data store in 1 varible, how separate this: $data="john doe 25yr london" become this: $name="john doe"; $age="25"; $city="london"; <?php $data="john doe 25yr london"; $arr = preg_split('/(?=\d)/', $data, 2); if(count($arr) == 2) { $name = trim($arr[0]); $city = trim(strstr($arr[1], ' ')); $age = trim(str_replace($city, '', $arr[1])); }

javascript - Why does gulp-sprite-generator throw "SyntaxError: Unexpected token ;"? -

running gulp task im getting following error: syntaxerror: unexpected token ; - im wondering relates in terms of gulp task? var gulp = require('gulp'); var sprite = require('gulp-sprite-generator'); gulp.task('sprites', function() { var spriteoutput; spriteoutput = gulp.src("src/css/*.css") .pipe(sprite({ baseurl: "src/image/", spritesheetname: "sprite.png", spritesheetpath: "dist/image/" }); spriteoutput.css.pipe(gulp.dest("dist/css/")); spriteoutput.img.pipe(gulp.dest("dist/image/")); }); gulp.task('default', ['sprites']); i've installed 2 modules mentioned in code. have gulp file in root , created src baseurl directories. in css dir, have 1 simple .css file following: #image1 { background: url("../image/banana.png") no-repeat; width: 165px; height: 146px; } as refere

python 3.x - access (read-only) global variable within class method -

i have class config() loads configuration options. create instance of class named cfg. have many classes a, b, c have read only members cfg. from mylib.config import * mylib.a import * mylib.b import * mylib.c import * cfg = config(filename) = a() a.do_things() and instance in constructor have: def __init__(self): self.name = cfg.name problem @ runtime "nameerror: name 'cfg' not defined" on line self.name = cfg.name i first thought it's import mylib.a, mylib.b , mylib.c before declaring cfg moved cfg = config(filename) before importing mylib.a...b...c. still same error. possible solutions: 1. pass object 'cfg' argument, have change signature methods in classes a, b, c , feel it's not clean since multiplies same argument accross methods. 2. create private member _cfg classes a, b, c. better nor nice again, data multiplied 3. put class definition + instance declaration in 1 file, , import in mylib.a, mylib.b , mylib.c :

javaFX: a custom control(made with scene builder) contain a buttom with an onAction -

javafx: custom control(made scene builder) contain buttom onaction(and other components). how can implement method when use controll in screen ? you can provide callback can implemented. example: public class mycontrol { private button button; private callback<void, void> buttoncallback; public mycontrol() { button.setonaction(new eventhandler<actionevent>() { @override public void handle(actionevent event) { if(getbuttoncallback() != null){ getbuttoncallback().call(null); } } }); } public callback<void, void> getbuttoncallback() { return buttoncallback; } public void setbuttoncallback(callback<void, void> buttoncallback) { this.buttoncallback = buttoncallback; } } now can provide different implementations of callback using setter.

xaml - Custom WPF TextBox with attached unit TextBlock -

my application has tons of textbox controls user can enter numeric values. of these values in physical unit. unit indicator displayed @ right side of textbox control. that looks following sketch: [________] km (where unit "km") currently have done stackpanel instances everywhere. it's same pattern. makes xaml less readable should be. i'm looking textbox control includes textblock @ side display unit. my first try class derived textbox , xaml file replaces template property this: <textbox x:class="wpfapplication1.unittextbox" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:name="_this" keyboardnavigation.istabstop="false" style="{staticresource {x:type textbox}}"> <textbox.template> <controltemplate> <grid> <grid.columndefiniti

mysql - SQL Operand should contain 1 column(s) -

i think should quite simple can't seem figure out. i have 2 tables. table , table b joined field same value. i want select rows table a. table b, want select joined table column in table specific value. this how see working select tablea.*, (select * tableb inner join tablea on tableb.id = tablea.id tablea.complete = 1) tablea i have run code error operand should contain 1 column(s) how can values table , joining rows table b table column 1? edit: this expect output should be table_a.someid table_a.col table_a.complete table_b.someid table_b.col ----------------|----------------|---------------------|-------------------|---------------- 123 | | 1 | 123 | value 124 | | 1 | 124 | value 125 | | 1 | 125 | value 126 | | 0 | | 127

json - Rails active resource: how to send post parameters in the request body and not as query strings? -

i calling post request using rails activeresource, parameters sent query string , result called url long , webrick::httpstatus::requesturitoolarge exception. so need send parameters in request body instead, couldn't find how this. thanks lot to send post request in activeresource should reference the documentation for example can this #entity.post(custom_method_name, options = {}, body = '') company.post(:add_role, nil, {user_id: 1, role_id: 2}.to_json) tell me if need else.

r - Plotting each column of a dataframe as one line using ggplot -

the whole dataset describes module (or cluster if prefer). in order reproduce example, dataset available at: https://www.dropbox.com/s/y1905suwnlib510/example_dataset.txt?dl=0 (54kb file) you can read as: test_example <- read.table(file='example_dataset.txt') what have in plot this on plot, x-axis timepoints column, , y-axis columns on dataset, except last 3 columns. used facet_wrap() group conditionid column. this want, way achieved following code: plot <- ggplot(dataset, aes(x=timepoints)) plot <- plot + geom_line(aes(y=dataset[,1],colour = dataset$inmodule)) plot <- plot + geom_line(aes(y=dataset[,2],colour = dataset$inmodule)) plot <- plot + geom_line(aes(y=dataset[,3],colour = dataset$inmodule)) plot <- plot + geom_line(aes(y=dataset[,4],colour = dataset$inmodule)) plot <- plot + geom_line(aes(y=dataset[,5],colour = dataset$inmodule)) plot <- plot + geom_line(aes(y=dataset[,6],colour = dataset$inmodule)) plot <- plot + geom_li

Mongoose (node.js), failed to connect to [localhost:27017] -

i'm trying start server, getting error: error: failed connect [localhost:27017] @ null.<anonymous> (c:\node\project\node_modules\mongoose\node_modules\mong odb\lib\mongodb\connection\server.js:549:74) @ emit (events.js:106:17) @ null.<anonymous> (c:\node\project\node_modules\mongoose\node_modules\mong odb\lib\mongodb\connection\connection_pool.js:150:15) @ emit (events.js:98:17) @ socket.<anonymous> (c:\node\project\node_modules\mongoose\node_modules\mo ngodb\lib\mongodb\connection\connection.js:533:10) @ socket.emit (events.js:95:17) @ net.js:440:14 @ process._tickcallback (node.js:419:13) here code: var debug = require('debug')('project'); var app = require('../app'); app.set('port', process.env.port || 3000); var server = app.listen(app.get('port'), function() { debug('express server listening on port ' + server.address().port); }); when using "npm start" -

Enable JavaScript in PhantomJS with C# -

i've used phantomjs in c# application , it's not executing javascript though property phantomjsdriver.capabilities.isjavascriptenabled true. simple page below still executes content of noscript tag. how can make phantomjs execute javascript? i've added selenium , phantomjs vs2012 solution via nuget: pm> install-package selenium.webdriver pm> install-package phantomjs i've created simple html page demonstrate javascript not enabled: <html> <body> <a href="javascript:gotoanotherpage()">go page</a> <noscript> no javascript! </noscript> </body> </html> i've used phantomjsdriver . src displays "no javascript!" public class program { public static void main(string[] args) { var phantomdriver = new phantomjsdriver(); phantomdriver.url = @"c:\page.html"; var src = phantomdriver.pagesource; } } javascript d

ios - String does not conform to type AnyObject in NSarray Swift -

i creating custom object in swift. 1 of properties of object array, meant contain strings: exersice (name: "test", type: "test", muscles: nsarray(objects: "muscle1", "muscle2"), descriptionstring: "test", pace: true, sets: 1, reps: nsmutablearray(15, 12, 12), time: false, duration: 0) this part question about: muscles: nsarray(objects: "muscle1", "muscle2") i keep on getting error: string not conform type anyobject i don't understand why. looking around on web shows many cases of error, none in context or helpful in solving problem. how rid of error? highly appreciated the problem here not nsarray(objects: "muscle1", "muscle2") , this: nsmutablearray(15, 12, 12) this should be nsmutablearray(objects: 15, 12, 12) but, @natecook said in answer, should use swift array .

android - WebView backbutton -

my webview loading previous page when backbutton being pressed, without me overriding onbackpressed() method. wondering how prevent behavior, since not desired design of app. backbutton should merely does, navigate fragments/activities, not webview itself. webview = (webview) getview().findviewbyid(r.id.webview); webview.setwebviewclient(new internalwebclient()); webview.getsettings().setjavascriptenabled(true); webview.getsettings().setlayoutalgorithm(layoutalgorithm.narrow_columns); webview.getsettings().setloadsimagesautomatically(true); webview.setscrollbarstyle(view.scrollbars_inside_inset); webview.setlayertype(view.layer_type_software, null); regards. ok, simple enough... webview.setonkeylistener(new view.onkeylistener() { @override public boolean onkey(view v, int keycode, keyevent event) { if (keycode == keyevent.keycode_back) { myactivity.this.finish(); // or getactivity().finish() when in fragment } return fal

html - HTML5 Boilerplate makes a gap in the bottom of the site -

Image
i'm starting html5 boilerplate days and, in actual project, i'm having trouble. see, css of boilerplate defines <html> this: html { color: #222; font-size: 1em; line-height: 1.4; } this makes gap in bottom of site and, removing font-size , line-height, gap decreases doesn't disappear. this gap appears on chrome , not in firefox, safari or opera. any idea why? solved guys. it cache , javascript. i've cleaned browser cache , hit ctrl+f5. seems ok now. thank you.

javascript - Google custom search autocomplete doesn't work -

i have website @ http://googl-customsearch.fablefly.com/ , uses google custom search. can't find method make search box have autocomplete, there 2 versions of code , i'm using old 1 , since dosnt have urgly layout users. see in source there "setautocomplete(true);" in google settings see "autocomplete on" in 2 places , have generated many times code paste website , no luck. maybe guys , girls know answer problem. thank you.

php - Laravel 4: Generate language files with google translator -

i having site in english language files inside "en" folder. want provide multiple language option user. for need have "cn" folder china language. make it, need convert each file in google translator. any faster way generate new language files new language? using google translator or other option availble this? help?

parsing - C# parse non uniform bit sequences from array of bytes -

question: there more efficient way parse bits out of byte array integer values? if so, be? data read off stream packet consisting of series of bytes (which held in byte array). data compressed in these bytes such value may spread across multiple bytes (in sequence). bits making values vary in size depending on "type" of packet (which held in first 5 bits (starting msb) of first byte. e.g., byte[] bytes = {0x73, 0xa4}; // yields: 0111001110100100 // vals: [ 1 ][ 2 ]3[4] currently use extension method: public static string converttobinarystring(this byte[] bytes) { return string.join("", bytes.select(x => convert.tostring(x, 2).padleft(8, '0'))); } to convert byte array binary string. use 1 of these 2 extension methods convert binary string int or array of int: static readonly regex isbinary = new regex("^[01]{1,32}$", regexoptions.compiled); public static bool tryparsebits(this string toparse, int start, int length, out

How do I write a function that converts character vector to date vector in R? -

this seems simple enough function write, think i'm misunderstanding requirements formal arguments / how r parses , evaluates function. i'm trying write function converts character vector of form "%m/%d/%y" (and belonging data.frame df ) date vector, , formats "%m/%d/%y" , follows: dateformat <- function(x) { df$x <- (format(as.date(df$x, format = "%m/%d/%y"), "%m/%d/%y")) } i thinking that... dateformat(a) ... take "a" actual argument x , plug function, resolving as: df$a <- (format(as.date(df$a, format = "%m/%d/%y"), "%m/%d/%y")) however, following error when running dateformat(a) : error in as.date.default(df$x, format = "%m/%d/%y") : not know how convert 'df$x' class “date” can please explain why understanding of formal/actual arguments and/or r function parsing/evaluation incorrect? thank you. update of course, variables want convert dates (e.g

c# - Nuget Installation Failed -

Image
i trying install nuget visual studio 2013, unfortunately gives me following error. has encountered same issue? here log report: vsixinstaller.noapplicableskusexception: extension not installable on installed products. @ vsixinstaller.app.initializeinstall() @ system.threading.tasks.task.innerinvoke() @ system.threading.tasks.task.execute() visual studio 2013 comes nuget package manager pre-installed , can therefore not installed manually.

HTTPS And Node.Js Just Won't work -

i'm building json service using node.js , journey. working great on http needed make work on https. believe i've implemented https correctly not matter https connection killed during handshake. var http = require('https'); //code var httpsserver = http.createserver({ pfx: fs.readfilesync('sslcertificate_wildcard.pfx') }, function (request, response) { console.log('incoming request', { url: request.url }); request.on('end', function () { router.handle(request, body, function (route) { //code }); }); }); httpsserver.listen(11555); i've attached event handlers "checkcontinue", "connection", "connect", "upgrade", "clienterror", , "error" , "connection" ever raised. do see request going out chrome via chrome developer tools network tab? https works great experience guess either not going out or going out http mista

smartcard - javaemvreader android example code -

i trying build android application read credit card / smart card data form micro usb smart card reader. when use app google play, can read card data using card reader: https://play.google.com/store/apps/details?id=com.scdroid.emvdemo&hl=en according developer's website use library build app: https://code.google.com/p/javaemvreader/ unfortunately tried use code in getting terminal exception : sasc.terminal.terminalexception: no provider available my code looks this: protected void testscreader() { smartcard smartcard = null; cardconnection conn = null; try { conn = terminalutil.connect(terminalutil.state.card_present); if(conn == null){ rawt.append("terminalutil.connect returned null"); return; } sessionprocessingenv env = new sessionprocessingenv(); env.setreadmasterfile(true); env.setprobeallknownaids(t

Extending the Laravel Eloquent\Collection Class -

i understand default eloquent\collection class can overridden in model using method: public function newcollection(array $models = array()) { return new customcollection($models); } which works great if i'm using typical queries such as: model::where('name', $name)->get(); this great can add methods eloquent collection class, such as: $records = model::where('name', $name)->get(); $records->totable(); but if i'm using pagination on model, example: model::where('name', $name)->paginate(25); it returns instance of class illuminate\support\collection instead of illuminate\database\eloquent\collection . is there way of overriding or extending typical illuminate\support\collection ? i'm trying add totable() method returned collection. i'd rather not have replace pagination service provider own. thanks!! you need replace pagination service provider, amongst couple of other classes in pagination li

javascript - Ember js, URL state for group edit -

as says ember's ideology: "every application state should shown in url". , don't have idea how represent state in url group actions on models? as example have edit action song, url is: http://myapplication.com/song/123/edit but need have functionality group edit. how should represent in url? may this? http://myapplication.com/song/123,124,125,126/edit thanks lot suggestion you might think of url other way around: put action (edit) first, targets. syntax you, add targets url parameters this: http://myapplication.com/edit?song=123 then if there mutiple songs: http://myapplication.com/edit?song=123&song=456&song=789 it's been while since worked in ember, don't remember if there's preferred way specify list/array of url parameters.

Ajax call for PHP MultiThreading -

one of javascript ajax call following php file - -----------------------myajax.php----------------------------- function mymethod($username) { echo $username; } class asyncoperation extends thread { public function __construct($username) { $this->username = $username; } public function run() { mymethod($this->username); } } $stack = array(); $stack[0] = new asyncoperation("ifti"); $stack[1] = new asyncoperation("jami"); foreach ( $stack $t ) { $t->start(); } i'm not getting response string ajax response. may due the thread operation. there way overcome issue ?

javascript - make div do -200px multiple times? -

i trying move div -200px original position when press button. want able multiple times. function leftanimate(){ original = document.getelementbyid("sliderzelf").setattribute("style", "margin-left: -200px;"); } this piece of code ( assume, correct me if im wrong.) sets attribute once -200px. there way can make -200px every new starting position? since have used jquery-animate tag, shall presume have jquery. in case following should work: function leftanimate() { $("#sliderzelf").css("margin-left", "-=200"); }

objective c - What's the correct way to accumulate NSDecimalNumber values? -

i trying accumulate nsdecimalnumber values obtained array ( apptdataarray , obtained coredata store; acurrentcharges defined nsdecimalnumber). code: nsdecimalnumber *accumulatedfees = 0; for(int = 0; < apptdataarray.count; i++) { appointmentinfo *currentappointment = [apptdataarray objectatindex: i]; accumulatedfees = [accumulatedfees decimalnumberbyadding: currentappointment.acurrentcharges]; // <---- not accumulating } oaccumulatedcharges.text = [nsstring stringwithformat:@"%@",accumulatedfees]; my problem line marked not accumulating doing -- not accumulating. doing wrong? the variable accumulatedfees not being initialized correctly. try setting way: nsdecimalnumber *accumulatedfees = [nsdecimalnumber zero];

functional programming - How can Erlang support both single assignment and dynamic typing? -

let me start saying computer science enthusiast, relatively little knowledge of subject. question is: if single assignment idea variable (e.g., a ) can assigned single value without value change ( a = 1 , a = 2 -> error ) how can language have dynamic typing? if value of variable cannot change, surely cannot change type... right? if language dynamically typed means not possible determine type of given expression without running program. doesn't have mean variables have able change type, it's not possible tell type variable has without running program. so take piece of code example: a = if some_condition -> 42; true -> "hello" end here can not know whether number or string without knowing whether condition true or false (which can't know without running code can arbitrarily complex expression). in statically typed language above illegal, in erlang allowed.