class

read.table and apply functions to a column

这一生的挚爱 提交于 2020-01-06 15:32:12
问题 I am reading an apache logfile using read.table and am wondering if it's somehow possible to apply a function (i.e. strptime ) while the data are being imported, instead of post-processing it. More details as requested: The column containing the date has the format: [10/Nov/2011:06:25:14 I can successfully parse it using: strptime(red[1,4],format="[%d/%b/%Y:%H:%M:%S") or as.POSIXct(strptime(red[1,4],format="[%d/%b/%Y:%H:%M:%S")) but as.POSIXct(red[1,4],format="[%d/%b/%Y:%H:%M:%S") fails.

Setting off a function in another class

你离开我真会死。 提交于 2020-01-06 15:28:14
问题 I'm trying to set off a function in my custom tableViewCell-class by using a function in my view controller. I'm really clueless on how to do this, so I tried writing it like this: TableViewCell.timerStarted() The function I'm trying to set off looks like this: func timerStarted(){ timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: "update", userInfo: nil, repeats: true) } Where TableViewCell is the name of my class and timerStarted the name of the function. This gives

wordpress live site : include them class in a cron job

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-06 14:26:35
问题 import a class from theme directory outside of wordpress. The CRON I am cronning a daily job via Cpanel for my site that will feed a stats table. I created a file in the root Home/myDirectory (same level as public_html ) beloo is the code <?php include dirname(__FILE__) . '/public_html/wp-load.php'; // Load WP Functions include dirname(__FILE__) . '/public_html/wp-content/themes/cooking/config/Data/ViewsData.php'; // require a class function test(){ if(class_exists('ViewsData')){ $viewsData =

Calling methods from other classes java

耗尽温柔 提交于 2020-01-06 13:52:59
问题 I have just started programming some things with Greenfoot, learning java along the way. I have become familiar on how to call certain methods between classes, and also differences between static and non-static. I'm makeing a game where you play the crab and move around to collect worms. There is a lobster that randomly roams around and if comes in contact with the crab, the crab dissapears. Every time you eat a worm, the score goes up by 10. It contains 5 classes named Crab, Lobster, Worm,

Building class names form strings

爱⌒轻易说出口 提交于 2020-01-06 13:30:20
问题 I have an array of strings like this: tableArray: { "Map", "Web", "Help" + 10 other strings} The array is used to build the table cells in a UITableViewController. When tapped I want the appropriate view controller to show, in the didSelectRowAtIndexPath method. Instead of creating a large switch, or if .. then .. else statement, can I somehow create the class name from the strings above, so that Map becomes MapViewController: MapViewController *detailViewController = [[MapViewController

Java - How to use a variable from a method when imported into the main class

我们两清 提交于 2020-01-06 13:26:33
问题 I am trying to use a variable from a method I created in another class in the main section. For example: public class test { public static int n; public void getLower(){ int p = 12; } public static void main(String[] args) { test example = new test(); example.getLower(); System.out.println(p); } } However, I get the error message 'p cannot be resolved to a variable'. Is what I'm trying to do possible? Thanks in advance! 回答1: p is a local variable within the getLower method. You're not

Seeing what class an object is

主宰稳场 提交于 2020-01-06 13:12:09
问题 If I have a pointer to a base class A in C++, how would I be able to tell in my code that the pointer is to a derived class B or C ? 回答1: Assuming the base class A is polymorphic (i.e. it has at least one virtual function), you can use dynamic_cast . Given an A* ap; : if (B* bp = dynamic_cast<B*>(ap)) { // the object is a B } else if (C* cp = dynamic_cast<C*>(ap)) { // the object is a C } 回答2: You generally shouldn't need to know: struct A { virtual int generate_foo() = 0; }; struct B : A {

What's the support for .className.andClassName in the current browsers?

╄→尐↘猪︶ㄣ 提交于 2020-01-06 12:46:11
问题 Confusing title? Sure! In CSS, you can specify: .button.blue { ... } Which will target elements that have both class names. Does anyone know what the browser support is? 回答1: I've never seen chaining of modifiers fail. I think you're good to go in all browsers still in use today, if not all browsers that ever implemented CSS. EDIT : Nope. Just watched IE6 choke on it. Plugged this example into Adobe Browserlab, and both the class attributes hello world and world respond to the .hello.world

How to display contents of selected class Jquery

隐身守侯 提交于 2020-01-06 09:56:39
问题 I have some html/jquery/css which I have combined to create a multiple choice style quiz, which is working quite well. When a user clicks on a choice, the choice list is replaced with the appropriate answer. I have added a working codepen link at the end of the question. I wish to identify the html contents of the most recently picked choice so that I can understand when a user has reached the end of their questions, and thus append a separate block of text, however, I am struggling to do

How to display contents of selected class Jquery

江枫思渺然 提交于 2020-01-06 09:53:34
问题 I have some html/jquery/css which I have combined to create a multiple choice style quiz, which is working quite well. When a user clicks on a choice, the choice list is replaced with the appropriate answer. I have added a working codepen link at the end of the question. I wish to identify the html contents of the most recently picked choice so that I can understand when a user has reached the end of their questions, and thus append a separate block of text, however, I am struggling to do