Daily Archives

Articles indexed Tuesday October 29 2013

Page 14/19 | < Previous Page | 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • MySQL Query to find consecutive available times of variable lenth

    - by Armaconn
    I have an events table that has user_id, date ('2013-10-01'), time ('04:15:00'), and status_id; What I am looking to find is a solution similar to http://stackoverflow.com/questions/2665574/find-consecutive-rows-calculate-duration but I need I need two additional components: 1) Take date into consideration, so 10/1/2013 at 11:00 PM - 10/2/2013 at 3:00AM. Feel free to just put in a fake date range (like '2013-10-01' to '2013-10-31') 2) Limit output to only include when there are 4+ consecutive times (each event is 15 minutes and I want it to display minimum blocks of an hour, but would also like to be able to switch this restriction to 1.5 hours or some other duration if possible). SUMMARY - Looking for a query that provides the start and end times for a set of events that have the same user_id, status_id, and are in a continuous series based on date and time. For which I can restrict results based on date range and minimum series duration. So the output should have: user_id, date_start, time_start, date_end, time_end, status_id, duration CREATE TABLE `events` ( `event_id` int(11) NOT NULL auto_increment COMMENT 'ID', `user_id` int(11) NOT NULL, `date` date NOT NULL, `time` time NOT NULL, `status_id` int(11) default NULL, PRIMARY KEY (`event_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1568 ; INSERT INTO `events` VALUES(1, 101, '2013-08-14', '23:00:00', 2); INSERT INTO `events` VALUES(2, 101, '2013-08-14', '23:15:00', 2); INSERT INTO `events` VALUES(3, 101, '2013-08-14', '23:30:00', 2); INSERT INTO `events` VALUES(4, 101, '2013-08-14', '23:45:00', 2); INSERT INTO `events` VALUES(5, 101, '2013-08-15', '00:00:00', 2); INSERT INTO `events` VALUES(6, 101, '2013-08-15', '00:15:00', 1); INSERT INTO `events` VALUES(7, 500, '2013-08-14', '23:45:00', 1); INSERT INTO `events` VALUES(8, 500, '2013-08-15', '00:00:00', 1); INSERT INTO `events` VALUES(9, 500, '2013-08-15', '00:15:00', 2); INSERT INTO `events` VALUES(10, 500, '2013-08-15', '00:30:00', 2); INSERT INTO `events` VALUES(11, 500, '2013-08-15', '00:45:00', 1); Desired output row |user_id | date_start | time_start | date_end | time_end | status_id | duration 1 |101 |'2013-08-14'| '23:00:00' |'2013-08-15'|'00:15:00'| 2 | 5 2 |101 |'2013-08-15'| '00:00:15' |'2013-08-15'|'00:30:00'| 1 | 1 3 |500 |'2013-08-14'| '00:23:45' |'2013-08-15'|'00:15:00'| 1 | 2 4 |500 |'2013-08-15'| '00:00:15' |'2013-08-15'|'00:45:00'| 2 | 2 5 |500 |'2013-08-15'| '00:00:45' |'2013-08-15'|'01:00:00'| 2 | 1 *except that rows 2 and 5 wouldn't appear if duration had to be greater than 30 minutes Thanks for any help that you can provide! And please let me know if there is anything I can further clarify!!

    Read the article

  • Project compilation requires a class that is not used anywhere

    - by Susei
    When I build with ant my project that uses libgdx, I get a strange error. It says that a class com.google.gwt.dom.client.ImageElement is not found, but it isn't used at all in the code. How can I find what makes this class necessary? Even searching over the whole project doesn't give any results. It says that error is at PixmapTextureAtlas.java:16 (class source), but there is no code that uses that ImageElement class. Adding the library containing com.google.gwt.dom.client.ImageElement class helps, of course, but I'd like to figure out why this class in needed. Here is the place in ant log that tells of the actual error: Compiling 3 source files to /home/suseika/Projects/tendiwa/client/bin /home/suseika/Projects/tendiwa/client/src/org/tendiwa/client/PixmapTextureAtlas.java:16: error: cannot access ImageElement class file for com.google.gwt.dom.client.ImageElement not found Here is the whole ant log: /usr/lib/jvm/java-7-oracle/bin/java -Xmx128m -Xss2m -Dant.home=/opt/intellijidea/lib/ant -Dant.library.dir=/opt/intellijidea/lib/ant/lib -Dfile.encoding=UTF-8 -classpath /opt/intellijidea/lib/ant/lib/ant-apache-regexp.jar:/opt/intellijidea/lib/ant/lib/ant-swing.jar:/opt/intellijidea/lib/ant/lib/ant-apache-xalan2.jar:/opt/intellijidea/lib/ant/lib/ant-jdepend.jar:/opt/intellijidea/lib/ant/lib/ant-apache-resolver.jar:/opt/intellijidea/lib/ant/lib/ant-jsch.jar:/opt/intellijidea/lib/ant/lib/ant.jar:/opt/intellijidea/lib/ant/lib/ant-testutil.jar:/opt/intellijidea/lib/ant/lib/ant-launcher.jar:/opt/intellijidea/lib/ant/lib/ant-apache-bsf.jar:/opt/intellijidea/lib/ant/lib/ant-commons-logging.jar:/opt/intellijidea/lib/ant/lib/ant-netrexx.jar:/opt/intellijidea/lib/ant/lib/ant-junit.jar:/opt/intellijidea/lib/ant/lib/ant-commons-net.jar:/opt/intellijidea/lib/ant/lib/ant-apache-bcel.jar:/opt/intellijidea/lib/ant/lib/ant-antlr.jar:/opt/intellijidea/lib/ant/lib/ant-apache-log4j.jar:/opt/intellijidea/lib/ant/lib/ant-jai.jar:/opt/intellijidea/lib/ant/lib/ant-apache-oro.jar:/opt/intellijidea/lib/ant/lib/ant-jmf.jar:/opt/intellijidea/lib/ant/lib/ant-javamail.jar:/usr/lib/jvm/java-7-oracle/lib/tools.jar:/opt/intellijidea/lib/idea_rt.jar com.intellij.rt.ant.execution.AntMain2 -logger com.intellij.rt.ant.execution.IdeaAntLogger2 -inputhandler com.intellij.rt.ant.execution.IdeaInputHandler -buildfile /home/suseika/Projects/tendiwa/client/build.xml jar build.xml property path description compile ant property property property description compile mkdir javac jar ant property description _core_src_available available ontology antcall property description _core_src_available available _build_core ant property property compile echo /home/suseika/Projects/tendiwa/client mkdir javac jar jar Building jar: /home/suseika/Projects/tendiwa/MainModule.jar description tempfile mkdir Created dir: /tmp/tendiwa373148820 unjar Expanding: /home/suseika/Projects/tendiwa/MainModule.jar into /tmp/tendiwa373148820 Expanding: /home/suseika/Projects/tendiwa/tendiwa-backend.jar into /tmp/tendiwa373148820 Expanding: /home/suseika/Projects/tendiwa/tendiwa-ontology.jar into /tmp/tendiwa373148820 copy Copying 1 file to /tmp/tendiwa373148820 java Created item short_sword Created item short_bow Created item bucket Created item boot Created item steel_morningstar Created item rifle_ammo Created item handAxe Created item iron_armor Created item steel_mace Created item jacket Created item fedora Created item wooden_arrow Saving sources to /tmp/tendiwa373148820/ontology/src tendiwa/resources/SoundTypes.java tendiwa/resources/CharacterTypes.java tendiwa/resources/ObjectTypes.java tendiwa/resources/FloorTypes.java tendiwa/resources/ItemTypes.java tendiwa/resources/MaterialTypes.java mkdir mkdir mkdir Created dir: /tmp/tendiwa373148820/ontology/bin javac jar Building jar: /home/suseika/Projects/tendiwa/tendiwa-ontology.jar echo Resources source code generated ant property property compile echo /home/suseika/Projects/tendiwa/client mkdir javac jar jar jar Building jar: /home/suseika/Projects/tendiwa/MainModule.jar mkdir javac /home/suseika/Projects/tendiwa/client/build.xml:25: Compile failed; see the compiler error output for details. at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1150) at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:912) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:390) at org.apache.tools.ant.Target.performTasks(Target.java:411) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399) at org.apache.tools.ant.Project.executeTarget(Project.java:1368) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1251) at org.apache.tools.ant.Main.runBuild(Main.java:809) at org.apache.tools.ant.Main.startAnt(Main.java:217) at org.apache.tools.ant.Main.start(Main.java:180) at org.apache.tools.ant.Main.main(Main.java:268) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:30) /home/suseika/Projects/tendiwa/client/build.xml (25:46)'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds Compiling 3 source files to /home/suseika/Projects/tendiwa/client/bin /home/suseika/Projects/tendiwa/client/src/org/tendiwa/client/PixmapTextureAtlas.java:16: error: cannot access ImageElement class file for com.google.gwt.dom.client.ImageElement not found 1 error /home/suseika/Projects/tendiwa/client/build.xml:25: Compile failed; see the compiler error output for details. at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1150) at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:912) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:390) at org.apache.tools.ant.Target.performTasks(Target.java:411) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399) at org.apache.tools.ant.Project.executeTarget(Project.java:1368) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1251) at org.apache.tools.ant.Main.runBuild(Main.java:809) at org.apache.tools.ant.Main.startAnt(Main.java:217) at org.apache.tools.ant.Main.start(Main.java:180) at org.apache.tools.ant.Main.main(Main.java:268) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:30) /home/suseika/Projects/tendiwa/client/build.xml:25: Compile failed; see the compiler error output for details. at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1150) at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:912) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:390) at org.apache.tools.ant.Target.performTasks(Target.java:411) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399) at org.apache.tools.ant.Project.executeTarget(Project.java:1368) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1251) at org.apache.tools.ant.Main.runBuild(Main.java:809) at org.apache.tools.ant.Main.startAnt(Main.java:217) at org.apache.tools.ant.Main.start(Main.java:180) at org.apache.tools.ant.Main.main(Main.java:268) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:30) Ant build completed with 3 errors one warning in 4s at 10/30/13 3:09 AM Here is a part of ant file where this error appears: <path id="tendiwa.jars"> <fileset dir="../libs"> <include name="**/*.jar"/> </fileset> <pathelement path="../tendiwa-backend.jar"/> <pathelement path="../tendiwa-ontology.jar"/> <!--<fileset dir="/usr/share/java" includes="gwt*.jar"/>--> </path> <target name="compile"> <ant dir="../MainModule" target="jar"/> <mkdir dir="bin"/> <javac destdir="bin" failonerror="true"> <classpath> <path refid="tendiwa.jars"/> <!--temporary--> <pathelement path="../tendiwa-ontology.jar"/> <!--temporary--> <pathelement path="../MainModule.jar"/> <fileset dir="../libs" includes="**/*.jar"/> </classpath> <src> <pathelement path="Desktop/src"/> <pathelement path="src"/> </src> </javac> </target>

    Read the article

  • Programmatically Binding to a Property

    - by M312V
    I know it's a generic title, but my question is specific. I think it will boil down to a question of practice. So, I have the following code: public class Component : UIElement { public Component() { this.InputBindings.Add(new MouseBinding(SomeCommandProperty, new MouseGesture(MouseAction.LeftClick))); } } I could easily aggregate the ViewModel that owns SomeCommandProperty into the Component class, but I'm currently waiving that option assuming there is another way. Component is a child of ComponentCollection which is child of a Grid which DataContext is the ViewModel. ComponentCollection as the name suggests contains a collection of Components. <Grid Name="myGrid"> <someNamespace:ComponentCollection x:Name="componentCollection"/> </Grid> It's the same scenario as the XAML below, but with TextBlock. I guess I'm trying to replicate what's being done in the XAML below programatically. Again, Component's top most ancestor's DataContext is set to ViewModel. <Grid Name="myGrid"> <TextBlock Text="SomeText"> <TextBlock.InputBindings> <MouseBinding Command="{Binding SomeCommandProperty}" MouseAction="LeftClick" /> </TextBlock.InputBindings> </TextBlock> </Grid> Update 1 Sorry, I'm unable to comment because I lack the reputation points. Basically, I have a custom control which inherit from a Panel which children are a collection of Component. It's not a hack, like I've mentioned, I could directly have access to SomeCommandProperty If I aggregate the ViewModel into Component. Doing so, however, feels icky. That is, having direct access to ViewModel from a Model. I guess the question I'm asking is. Given the situation that Component's parent UIElement's DataContext is set to ViewModel, is it possible to access SomeCommandProperty without Component owning a reference to the ViewModel that owns SomeCommandProperty? Programatically, that is. Using ItemsControl doesn't change the fact that I still need to bind SomeCommandProperty to each Items.

    Read the article

  • Java exception: "Can't get a Writer while an OutputStream is already in use" when running xAgent

    - by Steve Zavocki
    I am trying to implement Paul Calhoun's Apache FOP solution for creating PDF's from Xpages (from Notes In 9 #102). I am getting the following java exception when trying to run the xAgent that does the processing -- Can't get a Writer while an OutputStream is already in use The only changes that I have done from Paul's code was to change the package name. I have isolated when the exception happens to the SSJS line: var jce: DominoXMLFO2PDF = new DominoXMLFO2PDF(); All that line does is instantiate the class, there is no custom constructor. I don't believe it is the code itself, but some configuration issue. The SSJS code is in the beforeRenderResponse event where it should be, I haven't changed anything on the xAgent. I have copied the jar files from Paul's sample database to mine, I have verified that the build paths are the same between the two databases. Everything compiles fine (after I did all this.) This exception appears to be an xpages only exception.

    Read the article

  • Creating many native GUI frontends for a cross-platform application

    - by Hugh Young
    I've been away from GUI programming for quite some time so please pardon my ignorance. I would like to attempt the following: Write a Mac OSX app but still be able to port to Win/Linux (i.e. C++ core with Obj-C GUI) Avoid Qt/other toolkits on OSX (i.e. talk to Cocoa directly - I feel that many Qt apps I use stick out like sore thumbs compared to the rest of my system) Not as important, but it would be nice to avoid Visual Studio if it means I can have the freedom to use newer C++ features even on Windows if they help create better code. I believe this configuration might get me what I'm looking for: Core C++ Static Library OSX GUI (Cocoa) Windows GUI (Qt+MinGW?) OR (no new C++ features, Visual Studio + ManagedC++/C#/????) Linux GUI (Qt) Once again, sorry for my ignorance but is this possible? Is this sane? Are there any real-world open source examples accomplish something like this?

    Read the article

  • Ember-App-Kit: How to execute code only in release mode?

    - by Dominik Schmidt
    I have created an error handler as described here: http://emberjs.com/guides/understanding-ember/debugging/#toc_implement-a-code-ember-onerror-code-hook-to-log-all-errors-in-production But this code is not only executed in production mode but also in normal debug builds which floods my server logs. I know that Ember.debug() calls and alike are being filtered out for production builds, but I couldn't find out where/how that is implemented and if that same mechanism could be used to make my code only fire in production code.

    Read the article

  • Variable type for Application on Time Events [on hold]

    - by user2931226
    Been Trying to figure out how to go about setting a Variable for some Application On Time events, But still not confident to do it. These events (Macro's) get called by another Macro then they wait for 10 - 20 minutes, then they don't Run. So have read that (EarliestTime argument) should be assigned to a variable to store it other wise it looses it when other things are running Help appreciated Thanks Sub settimers() Application.OnTime TimeValue(Range("$X$9").Text), "StartBlink" Application.OnTime TimeValue(Range("$W$11").Text), "StopBlink" End Sub

    Read the article

  • The sign of zero with float2

    - by JackOLantern
    Consider the following code performing operations on complex numbers with C/C++'s float: float real_part = log(3.f); float imag_part = 0.f; float real_part2 = (imag_part)*(imag_part)-(real_part*real_part); float imag_part2 = (imag_part)*(real_part)+(real_part*imag_part); The result will be real_part2= -1.20695 imag_part2= 0 angle= 3.14159 where angle is the phase of the complex number and, in this case, is pi. Now consider the following code: float real_part = log(3.f); float imag_part = 0.f; float real_part2 = (-imag_part)*(-imag_part)-(real_part)*(real_part); float imag_part2 = (-imag_part)*(real_part)+(real_part)*(-imag_part); The result will be real_part2= -1.20695 imag_part2= 0 angle= -3.14159 The imaginary part of the result is -0 which makes the phase of the result be -pi. Although still accomplishing with the principal argument of a complex number and with the signed property of floating point's 0, this changes is a problem when one is defining functions of complex numbers. For example, if one is defining sqrt of a complex number by the de Moivre formula, this will change the sign of the imaginary part of the result to a wrong value. How to deal with this effect?

    Read the article

  • How do I convert an AMD module from a singleton to an instance?

    - by Jamie Ide
    I'm trying to convert a working Durandal view model module from a singleton to an instance. The original working version followed this pattern: define(['knockout'], function(ko) { var vm = { activate: activate, companyId: null; company: ko.observable({}) }; return vm; function activate(companyId) { vm.companyId = companyId; //get company data then vm.company(data); } } The new version exports a function so that I get a new instance on every request... define(['knockout'], function(ko) { var vm = function() { activate = activate; companyId = null; company = ko.observable({}); }; return vm; function activate(companyId) { vm.companyId = companyId; //get company data then vm.company(data); } } The error I'm getting is "object function () [...function signature...] has no method company on the line vm.company(data);. What am I doing wrong? Why can I set the property but can't access the knockout observable? How should I refactor the original code so that I get a new instance on every request? My efforts to simplify the code for this question hid the actual problem. My real code was using Q promises and calling two methods with Q.All. Since Q is in the global namespace, it couldn't resolve my viewmodel after converting to a function. Passing the view model to the methods called by Q resolved the problem.

    Read the article

  • Cocoa WebView won't render all images on OSX 10.8

    - by user2906962
    I'm currently developing an application for OS X, backwards compatible with OS X 10.6. At some point I create a WebView in which I load html content that I create dynamically. The html content is formed only of image links <img src= and text, there is no javascript or anything of that kind. All the images (there are only 5 png images) are stored locally and their size is 4 KB. The problem I have is that some images (those that are not on the visible side of the "scroll"), the very first time I run the application,the images are not shown unless I drag the window to another screen or load again the view controller that contains the WebView. In those cases the images appear on the "scroll" even if they are offsite. I've tried creating the WebView both with IB and programatically, I've used WebPreferences like Autosaves, AllowsAnimatedImages … I've tried using NSURLCache to load each image so that the WebView will get access to them easier ... same result. Taking into account that my code is quite extensive I'm gonna post only the bits that I think are relevant: NSString *finalHtml ... //contains the complete html CGRect screenRect = [self.fixedView bounds]; CGRect webFrame = CGRectMake(0.0f, 0.0f, screenRect.size.width, screenRect.size.height); self.miwebView=[[WebView alloc] initWithFrame:webFrame]; [self.miwebView setEditable:NO]; [self.miwebView setUIDelegate:self]; ... NSURLCache *URLCache = [[NSURLCache alloc] initWithMemoryCapacity:4 * 1024 * 1024 diskCapacity:20 * 1024 * 1024 diskPath:nil]; [NSURLCache setSharedURLCache:URLCache]; NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"line" ofType:@"png"]; NSURL *resourceUrl = [NSURL URLWithString:imagePath]; NSURLRequest *request = [NSURLRequest requestWithURL:resourceUrl cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10.0f]; [URLCache cachedResponseForRequest:request]; ... [self.miwebView setResourceLoadDelegate:self]; WebPreferences *webPref = [[WebPreferences alloc]init]; [webPref setAutosaves:YES]; [webPref setAllowsAnimatedImages:YES]; [webPref setAllowsAnimatedImageLooping:YES]; [self.miwebView setPreferences:webPref]; NSString *pathResult = [[NSBundle mainBundle] bundlePath]; NSURL *baseURLRes = [NSURL fileURLWithPath:pathResult]; [[self.miwebView mainFrame] loadHTMLString:finalHtml baseURL:baseURLRes]; [self.fixedView addSubview:self.miwebView]; I should also mention that if an image is caught somewhere in between the visible and non visible side of the "scroll" only the visible bit of the image is going to be rendered even if the page gets scrolled up ... so I think all this is some rendering issue ... I appreciate your help, thank you!

    Read the article

  • How to filter and intercept Linux packets by using net_dev_add() API?

    - by Khajavi
    I'm writing ethernet network driver for linux. I want to receive packets, edit and resend them. I know how to edit the packet in packet_interceptor function, but how can I drop incoming packets in this function?? #include <linux/netdevice.h> #include <linux/skbuff.h> #include <linux/ip.h> #include <net/sock.h> struct packet_type my_proto; int packet_interceptor(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) { // I dont want certain packets go to upper in net_devices for further processing. // How can I drop sk_buff here?! return 0; } static int hello_init( void ) { printk(KERN_INFO "Hello, world!\n"); my_proto.type = htons(ETH_P_ALL); my_proto.dev = NULL; my_proto.func = packet_interceptor; dev_add_pack(&my_proto); return 0; } static void hello_exit(void) { dev_remove_pack(&my_proto); printk(KERN_INFO "Bye, world\n"); } module_init(hello_init); module_exit(hello_exit);

    Read the article

  • Tomcat deploy: make included scripts executable

    - by AlexS
    I'm devellopping a WebApplication (for Tomcat) using netbeans on Windows 7. For the Webapplication to run I need to run a insall-script once. This script (*.bat for windows and *.sh for linux is included in my war-file (WEB_INF). Now everytime I deploy the WAR-file and want to run the script on linux I have to call chmod +x install.sh first. Is there a way that this script can be made executable by default? I don't want to have to execute some extra commands after the deploy to make the script executable. For clarification: I'm not new to Linux and I know how to set executable-rights on files. That's not the problem. My problem is: What do I have to do, so that this script is executable right after tomcat deployed my *.war-file (unpacked it). If I would be using Linux for development as well, I would try to set the rights according in my sources (maybe I'll try it when I have a little more spare time). But I am using Windows and netbeans. Are there any attributes I can set to achive my goal, or is it possible to achive this using ant? By the way: Are there security related issues with this approach? The script looks for java executable and calls a javabased GUI-installer...

    Read the article

  • Solr Vs. Sphinx in a Ruby project

    - by Robert Ross
    I have a project that is being written on top of the Grape API framework in ruby. (https://github.com/intridea/grape) The problem I'm having is that Thinking-Sphinx vs. Sunspot (Gems used to interface with each search index) have worlds different benchmarks. View the Benchmark Here We're trying to develop something that is quick and easy to deploy (Solr needs Java). The issues we see right now is mainly that Solr is slower through Sunspot gem and Sphinx is faster through Thinking-Sphinx because Solr is HTTP REST calls where Sphinx is sockets. Anyone have any experience in either and can explain pitfalls / bonuses? Note: Needs to be deployable to Rails AND non-rails apps (Hence Sunspot). Thanks!

    Read the article

  • .htaccess rewrite rule to ignore a directory

    - by Kirk Strobeck
    I am running a Symphony installation out of the directory symphony but I want to remove that word from the URL in specific cases. When a user visits http://domain.com/demo It should go to http://domain.com/symphony/demo because I've added a specific rule for demo. If I haven't added a specific rule for demo in the .htaccess, then it should resolve to http://domain.com/demo as typed. This will route it to another part of our app. Here is my current rewrite rule ### Symphony 2.3.x ### Options +FollowSymlinks -Indexes <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / ### SECURITY - Protect crucial files RewriteRule ^manifest/(.*)$ - [F] RewriteRule ^workspace/(pages|utilities)/(.*)\.xsl$ - [F] RewriteRule ^(.*)\.sql$ - [F] RewriteRule (^|/)\. - [F] ### DO NOT APPLY RULES WHEN REQUESTING "favicon.ico" RewriteCond %{REQUEST_FILENAME} favicon.ico [NC] RewriteRule .* - [S=14] ### IMAGE RULES RewriteRule ^image\/(.+\.(jpg|gif|jpeg|png|bmp))$ extensions/jit_image_manipulation/lib/image.php?param=$1 [B,L,NC] ### CHECK FOR TRAILING SLASH - Will ignore files RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !/$ RewriteCond %{REQUEST_URI} !(.*)/$ RewriteRule ^(.*)$ $1/ [L,R=301] ### URL Correction RewriteRule ^(symphony/)?index.php(/.*/?) $1$2 [NC] ### ADMIN REWRITE RewriteRule ^symphony\/?$ index.php?mode=administration&%{QUERY_STRING} [NC,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^symphony(\/(.*\/?))?$ index.php?symphony-page=$1&mode=administration&%{QUERY_STRING} [NC,L] ### FRONTEND REWRITE - Will ignore files and folders RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*\/?)$ index.php?symphony-page=$1&%{QUERY_STRING} [L] </IfModule> ###### How would I change the rewrite rule to support those cases?

    Read the article

  • converting node inheritance to hiera

    - by quickshiftin
    I'm working on moving over a node inheritance tree to hiera. Presently working on the hierarchy. Prior to hiera, my nodes had a hierarchy as such base pre-prod qa nodes staging nodes development nodes prod nodes Now I'm trying to get the same tier with hiera. Starting out I have this :hierarchy: - base - "%{environment}" - "%{clientcert}" but I need another level to capture pre-prod and prod. My thought would be to add an entry to puppet.conf, something like [agent] realm = pre-prod then :hierarchy: - base - "%{realm}" - "%{environment}" - "%{clientcert}" A couple of questions Are you allowed to place arbitrary properties into puppet.conf? Will hiera see the realm property?

    Read the article

  • What does Apache's "Require all granted" really do?

    - by John Crawford
    I've just update my Apache server to Apache/2.4.6 which is running under Ubuntu 13.04. I used to have a vhost file that had the following: <Directory "/home/john/development/foobar/web"> AllowOverride All </Directory> But when I ran that I got a "Forbidden. You don't have permission to access /" After doing a little bit of googling I found out that to get my site working again I needed to add the following line "Require all granted" so that my vhost looked like this: <Directory "/home/john/development/foobar/web"> AllowOverride All Require all granted </Directory> I want to know if this is "safe" and does not bring in any security issues. I read on Apache's page that this "mimics the functionality the was previously provided by the 'Allow from all' and 'Deny from all' directives. This provider can take one of two arguments which are 'granted' or 'denied'. The following examples will grant or deny access to all requests." But it didn't say if this was a security issue of some sort or why we now have to do it when in the past you did not have to.

    Read the article

  • Create a share on iscsi drive in Windows Server 2012

    - by Crash893
    I am brand new to server administration but I don't belive im trying to do anything to exotic I have a windows server 2012 (standard) and a drobo 800i My goal is to setup company shares on the iscsi target I have setup on the drobo So far I have: initialized the iscsi and connected made the iscsi disk read/write(it default started as read only) formatted and mounted it (as drive E:) from the server local desktop I can see and write files to the E:\ drive in shares wizard I do not see it as a volume option when I view the volumes window I see (e: drobo Fixed 16tb 16tb) I'm new to everything but I would think since its a mounted drive I should be able to share a folder on it but it appears its not that straight forward suggestions?

    Read the article

  • How to correctly configure DNS for Icelandic domains and Plesk

    - by Leonard Challis
    I have a domain registered with ISNIC (domain.is). They only let you set nameservers that pass their requirements. I've been told it's this requirement that I need to fix: Nameserver must be consistently registered in DNS, i.e. its own A resource record must be available and a corresponding PTR resource record as well. I allocated two new IP addresses from my server host and at that point set their PTR records to ns0.domain.is and ns1.domain.is. After that I created two A records for that domain in Plesk, again ns0. and ns2.domain.is with their respective IPs. Next, I went to the ISNIC page to register my nameservers, along with their IP addresses I'd allocated and this worked perfectly for both without error. So the final job was to set the nameservers for the domain via ISNIC's control panel, however when I try, I'm getting this error: Test results for "NS0.DOMAIN.IS": The nameserver ns1.vps123.vpsprovider.com is not consistently registered in DNS (ns1.vps123.vpsprovider.com => 1123.123.123.123 => vps123.vpsprovider.com) The nameserver ns0.vps123.vpsprovider.com is not consistently registered in DNS (ns0.vps123.vpsprovider.com => 1123.123.123.123 => vps123.vpsprovider.com) The nameserver ns0.DOMAIN.IS is missing from the NS record set for DOMAIN.IS Test results for "NS1.DOMAIN.IS": The nameserver ns1.DOMAIN.IS is missing from the NS record set for DOMAIN.IS The nameserver ns0.DOMAIN.IS is missing from the NS record set for DOMAIN.IS This is really at the limits of my DNS knowledge I'm afraid. It feels like I'm close but maybe missing a vital part, linking the nameservers in Plesk or something?

    Read the article

  • WAMP phpmyadmin gives a blank page no matter what I do

    - by Samuraisoulification
    I've been trying to get phpmyadmin to work on Win 7 64bit (newest download on the site) and I can get it working, the php part works fine, the problem is I can't get into phpmyadmin. It just gives a blank page, even I click view source it's completely blank. I've been scouring the internet for 2 or 3 days now, but no luck. Also, the php and mysql error logs don't have any errors. I need to get this up to work on a project for school, so any help would be appreciated! If you need any more info just ask!

    Read the article

  • Error with Apache, Nagios and Snorby integration

    - by user1428366
    I'm trying to use apache to serve two different websites (Nagios and Snorby). The problem is that when I try to see the "/snorby" website, apache sends me the "It works" page. If I try to access to "/nagios" it works perfectly. Snorby is running under ruby passenger .This are the config files. <VirtualHost *:80> ScriptAlias /nagios/cgi-bin "/srv/nagios/sbin" <Directory "/srv/nagios/sbin"> # SSLRequireSSL Options ExecCGI AllowOverride None Order allow,deny Allow from all # Order deny,allow # Deny from all # Allow from 127.0.0.1 AuthName "Nagios Access" AuthType Basic AuthUserFile /srv/nagios/etc/htpasswd.users Require valid-user </Directory> Alias /nagios "/srv/nagios/share" <Directory "/srv/nagios/share"> # SSLRequireSSL Options None AllowOverride None Order allow,deny Allow from all # Order deny,allow # Deny from all # Allow from 127.0.0.1 AuthName "Nagios Access" AuthType Basic AuthUserFile /srv/nagios/etc/htpasswd.users Require valid-user </Directory> </VirtualHost> And the other one is this: <VirtualHost *:80> #Alias /snorby "/var/www/snorby-2.6.0/public" # !!! Be sure to point DocumentRoot to 'public'! DocumentRoot /var/www/snorby-2.6.0/public <Directory /var/www/snorby-2.6.0/public> # This relaxes Apache security settings. AllowOverride all # MultiViews must be turned off. Options -MultiViews </Directory> </VirtualHost> If I disable the Nagios webpage, the Snorby webpage works. I think the problem is Snorby because when I try to access to the Ip address with Nagios page disable, the webapplication redirects me to http:// myserverip/dashboard. Can anyone help me please? Thank you so much! Regards

    Read the article

  • Restart an in-use NFS server without interruption (within timeout)

    - by zebediah49
    I have a bunch of compute clients working on jobs, saving output data to a NAS machine. All machines are centos 6.2. They mount it via automount NFS, with a timeout of 1200 (default config). The NAS machine needs to be restarted. If I can restart the machine within that 1200s (20 minute) window, will the clients just block on IO until it comes back up? A minor interruption (pause) in service is ok, as long as it doesn't cause the running processes to error out. If necessary I could loop through and SIGSTOP all job processes, restart and resume them -- I just don't want to break the open file handles. How can I run a restart like this without killing processes with open files?

    Read the article

  • Linux server became extremely slow

    - by Ariel Aharonson
    I have a file sharing website, and my files hosted in a server with those system specifications: 32GB RAM 12x3TB 2x Intel Quad Core E5620 I have files in this server up to 4gb for each file. 446gb is full (/36TB) [root@hosted-by ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 50G 2.7G 44G 6% / tmpfs 16G 0 16G 0% /dev/shm /dev/sda1 97M 57M 36M 62% /boot /dev/mapper/VolGroup01-LogVol00 33T 494G 33T 2% /home And take a look at this: Why is the wa% so high? (I think that what makes the server to be so slow)

    Read the article

  • iSCSI: LUNs per target?

    - by badnews
    My question relates specifically to ZFS/COMSTAR but I assume is generally applicable to any iSCSI system: Should one prefer to create a target for every LUN that you want to expose? Or is it good practise to have a single target with multiple LUNs? Does either approach have a performance impact? And is there some crossover point where the other approach makes sense? The use case is for VM disks, where each disk (zvol) is a LUN. So far we have created a a separate target for each VM; but a single target that contains all the LUNs would probably greatly simplify management... but we may need hundreds of LUNs per a single target. (And then possibly tens of initiator connections to that target)

    Read the article

  • Citrix Access Gateway not redirecting to login URL

    - by Dave
    We have an older setup for XenApp - users log in through Citrix Secure Gateway running on a windows box. (We hope to start using a NetScaler soon.) Earlier today, connections to https://citrix.company.com/ starting throwing up a 503 error page, instead of redirecting to https://citrix.company.com/Citrix/XenApp/ If you go directly to the /Citrix/Xenapp/ URL, the user is properly directed to the login page, and can launch apps. We've restarted the service, and rebooted the server. We haven't yet tried uninstalling and reinstalling the software. Before we do this, I'm looking for ideas as to how we can get the redirect working again without a fairly major outage window. To make things more interesting, many of our users have Citrix Receiver installed, also pointed at https://citrix.company.com/. Receiver makes itself the default launcher for ICA files, and gives a connection error when it tries to load apps - probably because of the same non-functional rediect?

    Read the article

  • How to enable Sqlite on a Mac OS X Mavericks [migrated]

    - by sehummel
    I upgraded my Mac with OS X Mavericks last week. It appears to have taken away support for Sqlite -- not Sqlite3, but sqlite. I need that for a website I work on. I went to Sqlite's website, but all I could find was older versions of Sqlite3. Where can I find a version of Sqlite? I've been through the php.ini and can only find one reference to sqlite. In short, how do I get Sqlite support on my Mac? I have Sqlite3 enabled and the issue isn't going away. I uncommented pdo_sqlite in the php.ini and I still have the issue.

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19  | Next Page >