Daily Archives

Articles indexed Monday May 31 2010

Page 10/98 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • MEF Constructor Parameters with Multiple Constructors

    - by InterWAS
    Hi, i starting to use MEF, and i have a class with multiple constructors, like this: [Export(typeof(ifoo))] class foo : ifoo { void foo() { ... } [ImportingConstructor] void foo(object par1) { ... } } Everthing works fine, except that the 2nd constructor is never called, i am using catalog.ComposeExportedValue() when composing, what's wrong?

    Read the article

  • nested for loop

    - by Gary
    Hello, Just learning Python and trying to do a nested for loop. What I'd like to do in the end is place a bunch of email addresses in a file and have this script find the info, like the sending IP of mail ID. For now i'm testing it on my /var/log/auth.log file Here is my code so far: #!/usr/bin/python # this section puts emails from file(SpamEmail) in to a array(array) in_file = open("testFile", "r") array = in_file.readlines() in_file.close() # this section opens and reads the target file, in this case 'auth.log' log = open("/var/log/auth.log", "r") auth = log.readlines() for email in array: print "Searching for " +email, for line in auth: if line.find(email) > -1: about = line.split() print about[0], print Inside 'testfile' I have the word 'disconnect' cause I know it's in the auth.log file. It just doesn't find the word 'disconnect'. In the line of "if line.find(email) -1:" i can replace email and put "disconnect" the scripts finds it fine. Any idea? Thanks in advance. Gary

    Read the article

  • Need help with strange Class#getResource() issue

    - by Andreas_D
    I have some legacy code that reads a configuration file from an existing jar, like: URL url = SomeClass.class.getResource("/configuration.properties"); // some more code here using url variable InputStream in = url.openStream(); Obviously it worked before but when I execute this code, the URL is valid but I get an IOException on the third line, saying it can't find the file. The url is something like "file:jar:c:/path/to/jar/somejar.jar!configuration.properties" so it doesn't look like a classpath issue - java knows pretty well where the file can be found.. The above code is part of an ant task and it fails while the task is executed. Strange enough - I copied the code and the jar file into a separate class and it works as expected, the properties file is readable. At some point I changed the code of the ant task to URL url = SomeClass.class.getResource("/configuration.properties"); // some more code here using url variable InputStream in = SomeClass.class.getResourceAsStream("/configuration.properties"); and now it works - just until it crashes in another class where a similiar access pattern is implemented.. Why could it have worked before, why does it fail now? The only difference I see at the moment is, that the old build was done with java 1.4 while I'm trying it with Java 6 now. Workaround Today I installed Java 1.4.2_19 on the build server and made ant to use it. To my totally frustrating surprise: The problem is gone. It looks to me, that java 1.4.2 can handle URLs of this type while Java 1.6 can't (at least in my context/environment). I'm still hoping for an explanation although I'm facing the work to rewrite parts of the code to use Class#getRessourceAsStream which behaved much more stable...

    Read the article

  • Wine + InstallShield can't find a locale challenged .msi file

    - by visudo
    I am trying to install this cheap old Japanese game I've bought but I can't get past the Installer. The CD contains a File named D:\[Japanese Characters].msi and Installshield running under wine is unable to find it giving me error 1155. I have tried mounting the CD with iocharset=sjis as well as the default utf-8 and also running the installer with and without LANG=ja_JP.Shift-JIS, but it doesn't make a difference. Also the file really is in D:. Any idea?

    Read the article

  • MySQL & PHP Use of Undefined Constant

    - by Nik
    Alright, PHP is throwing this error (only in the logs): Error PHP Notice: Use of undefined constant department - assumed 'department' (line 5) PHP Notice: Use of undefined constant name - assumed 'name' (line 6) PHP Notice: Use of undefined constant email - assumed 'email' (line 7) PHP Notice: Use of undefined constant message - assumed 'message' (line 8) Lines 4-7 $department = mysql_real_escape_string($_POST[department]); $name = mysql_real_escape_string($_POST[name]); $email = mysql_real_escape_string($_POST[email]); $message = mysql_real_escape_string($_POST[message]); I think it has something to do with defining constants before defining them (how is this possible).

    Read the article

  • Trying to provide a global logging function

    - by Gekitsuu
    I typically write my scripts with a structure like s #!/usr/bin/python import stuff def do_things(): print "FOO" def main(): do_things() if __name__ == "__main__": main() The problem I have is I'd like to have a logging function that is defined globally and I"m not really sure how to do this. I tried a decorator function but if I define it in main I can't call it from other functions in the script. It seems like something that should be easy to do but not something I have experience with.

    Read the article

  • Hide horizontal scrollbar in IE 7 and below

    - by Bradley Bell
    Hi all. Basically, I'm having trouble removing the horizontal scrollbar in Internet Explorer 7 and Below. I've tried the code below and It seems to work fine in every browser except IE. overflow-x: hidden; The even bigger problem is that, even though the scrollbar isn't even removed, it seems to completely screw the layout.. It somehow hides the majority of the page content in boxes 2 and 3? It also.. adds a second vertical scrollbar which moves relatively/absolute positioned items down?! I did contemplate just leaving the scrollbar in IE via a specified stylesheet, but even that seems to be messing with the page? The website is on a test directory here.. I'll post the stylesheet in a comment below. Any suggestions? Thanks in advance, hope you can help! Bradley

    Read the article

  • How to properly force a Blackberry Java application to install using Loader.exe

    - by Kevin White
    I want to include the Application Loader process in a software installation, to ensure that users get our software installed on their Blackberry by the time our installer software finishes. I know this is possible, because Aerize Card Loader (http://aerize.com/blackberry/software/loader/) does this. When you install their software, if your Blackberry is connected the Application Loader will come up and force the .COD file to install to the device. I can't make it work. Looking at RIM's own documentation, I need to: Place the ALX and COD files into a subfolder here: C:\Program Files\Common Files\Research In Motion\Shared\Applications\ Add a path to the ALX file in HKCU\Software\Research In Motion\Blackberry\Loader\Packages Index the application, by executing this at the command line: loader.exe /index Start the force load, by doing this: loader.exe /defaultUSB /forceload When I execute that last command, the Application Loader comes up and says that all applications are up to date and nothing needs to be done. If I execute loader.exe by double-clicking on it (or typing in the command with no parameters), I get the regular Application Loader wizard. It shows my program as listed, but un-checked. If I check it and click next, it will install to the Blackberry. (This is the part that I want to avoid, and that Aerize Card Loader's install process avoids.) What am I missing? It appears that the Aerize installer is doing something different but I haven't been able to ascertain what.

    Read the article

  • How to properly use Gearman with my PHP application?

    - by luckytaxi
    For now I just want to use Gearman for background processing. For example, I need to email a recipient that they have a private message waiting for them once the sender submits their message into the DB. I assume I can run the worker/client and server on my primary server but I have no problems offloading some of the tasks to a different web server. Anyways, my question is how do I handle multiple "functions?" Let's say I need a job that handles the email portion and a job to handle image manipulation. Can I have multiple functions in the worker? I've followed a couple of examples I found online but each example only shows one function being initialized. Do I have to start up multiple "workers" to handle multiple functions?

    Read the article

  • Ubuntu + virtualenv = a mess? virtualenv hates dist-packages, wants site-packages

    - by lostincode
    Can someone please explain to me what is going on with python in ubuntu 9.04? I'm trying to spin up virtualenv, and the --no-site-packages flag seems to do nothing with ubuntu. I installed virtualenv 1.3.3 with easy_install (which I've upgraded to setuptools 0.6c9) and everything seems to be installed to /usr/local/lib/python2.6/dist-packages I assume that when installing a package using apt-get, it's placed in /usr/lib/python2.6/dist-packages/ ? The issue is, there is a /usr/local/lib/python2.6/site-packages as well that just sits there being empty. It would seem (by looking at the path in a virtualenv) that this is the folder virtualenv uses as backup. Thus even thought I omit --no-site-packages, I cant access my local systems packages from any of my virtualenv's. So my questions are: How do I get virtualenv to point to one of the dist-packages? Which dist-packages should I point it to? /usr/lib/python2.6/dist-packages or /usr/local/lib/python2.6/dist-packages/ What is the point of /usr/lib/python2.6/site-packages? There's nothing in there! Is it first come first serve on the path? If I have a newer version of package XYZ installed in /usr/local/lib/python2.6/dist-packages/ and and older one (from ubuntu repos/apt-get) in /usr/lib/python2.6/dist-packages, which one gets imported when I import xyz? I'm assuming this is based on the path list, yes? Why the hell is this so confusing? Is there something I'm missing here? Where is it defined that easy_install should install to /usr/local/lib/python2.6/dist-packages? Will this affect pip as well? Thanks to anyone who can clear this up!

    Read the article

  • jquery load not loading in IE6

    - by Moak
    I got a simple jquery script workin on all but IE j('.slide').click(function(){ j('#content').load('/menu.php'); return false; }); Here's the url http://identitykit.gotdns.org/ it's valid xhtml and all other similar questions don't answer my problem. menu.php starts with <?php header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past ?>

    Read the article

  • PHP javascript link id

    - by Jordan Pagaduan
    <?php //connect to database .... //select query .... if(isset($_GET["link"])==false){ echo "sample 1"; }else{ echo "sample 2" ; } ?> <script type="javascript"> function Link(id) { location.href='linktest.php&link='+id; } </script> <html> <input type="button" value="link test" onclick="javascript: Link<?php $row['id']; ?>"> </html> (assumed question) How do I force the onclick event to contain the value of $row['id']?

    Read the article

  • Errors Installing PIL on Mac OS Tiger

    - by john2x
    I'm trying to install the Python Imaging Library on Mac OS X 10.4, but I get errors. I'm not sure where the error starts, it's just a huge wall of text when executing sudo python setup.py install. But the last few lines are: ... collect2: ld returned 1 exit status lipo: can't open input file: /var/tmp//ccNKvQpP.out (No such file or directory) error: command 'gcc' failed with exit status 1 I've googled, but none of the results are working.

    Read the article

  • UITableView - Select nearest row after row deletion.

    - by sunnycmf
    like build in apple notes app, after you swipe to delete the selected row, it will select the nearest available row automatically. The logic should be: if row count 0 then if deleted_row == last row then select deleted_row_index-1 row else select deleted_row_index+1 row end end i have try to implement the above logic in the commitEditingStyle event, but the selection fail. the selectRowAtIndexPath logic just don't work in this event, if i apply it in a button, it works. any idea?

    Read the article

  • Schema for element with Attributes and Child nodes

    - by Matthew
    I am trying to write xsd type schema for an element that has a custom type to include addition attributes to extend a base type. I am running into trouble getting the syntax right. <xs:element name="graphs"> <xs:complexType> <xs:sequence> <xs:element name="graph" minOccurs="1" maxOccurs="unbounded" type="graphType"> <!-- child elements --> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:complexType name="graphType"> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="title" type="xs:string"/> <xs:attribute name="type" type="xs:string"/> </xs:extension> </xs:simpleContent> </xs:complexType> I thought this would be something very common, but having read many tuts and forums, I cant seem to find an answer that works for me.

    Read the article

  • Beginning with event listeners

    - by terence6
    I have a simple app, showing picture made of tiled images(named u1, u2,...,u16.jpg). Now I'd like to add some Events to it, so that I can show these images only when proper button is clicked. I've tried doing it on my own, but it's not working. Where am I doing something wrong? Original code : import java.awt.GridLayout; import javax.swing.*; import javax.swing.border.BevelBorder; public class Tiles_2 { public static void main(String[] args) { final JFrame f = new JFrame("Usmiech"); JPanel panel = new JPanel(new GridLayout(4, 4, 3, 3)); JLabel l = new JLabel(); for (int i = 1; i < 17; i++) { String path = "u"+ i+".jpg"; l = new JLabel(new ImageIcon(path)); l.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); panel.add(l); } f.setContentPane(panel); f.setSize(300, 300); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); } } New code : import java.awt.GridLayout; import javax.swing.*; import javax.swing.border.BevelBorder; import java.awt.event.*; public class Zad_8_1 implements ActionListener { public void actionPerformed(ActionEvent e) { JButton b = (JButton)(e.getSource()); String i = b.getText(); b = new JButton(new ImageIcon("u"+i+".jpg")); } public static void main(String[] args) { final JFrame f = new JFrame("Smile"); JPanel panel = new JPanel(new GridLayout(4, 4, 3, 3)); JButton l = null; for (int i = 1; i < 17; i++) { String path = "u"+ i+".jpg"; l = new JButton(""+i); l.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); l.setSize(53,53); panel.add(l); } f.setContentPane(panel); f.setSize(300, 300); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); } } This should work like this : http://img535.imageshack.us/img535/3129/lab8a.jpg

    Read the article

  • How to overlay one div over another div

    - by tonsils
    Hi, Hoping someone can assist but I need assistance with overlaying one individual div over another individual div, i.e. my code looks like this: <div class="navi"></div> <div id="infoi"><img src="info_icon2.png" height="20" width="32"/></div> Unfortunately I cannot nest the infoi div or img inside the first div (class navi) - it has to be two separate divs as shown but I need to know how I could place the img div over the first div (navi) and to the right most side and centered on top of the navi div. Would appreciate any help is achieving this (hopefully it's possible) Thanks.

    Read the article

  • Asp.net fileupload control postback problems

    - by Spooky2010
    using ASP.net, vs2008 C#. Im using a FileUpload control on a webform. The uploading of a file (ie PDF dcouments) to a server directory works ok. I have on the webform a "preview" button that the user can use to preview the PDF file after they have selected it via the Fileupload browse feature. I do this by if (this.FileUpload1.HasFile) { localURL = FileUpload1.PostedFile.FileName; // use this to preview file. Other methods are restricted by local security requirements Process.Start(localURL); } My problems is that after the button click Postback occurs the location of the selected file disappears from the textbox part of the Fileupload control. How can i keep this info there, so the user does not have to browse again and instead can just click upload to upload the file. Any help appreciated thanks

    Read the article

  • Access values of a group of select boxes in php from post

    - by 2Real
    Hi, I'm new to PHP, and I can't figure this out. I'm trying to figure out how to access the data of a group of select boxes I have defined in my HTML code. I tried grouping them as a class, but that doesn't seem to work... maybe I was doing it wrong. This is the following HTML code. <form action="" method="post"> <select class="foo"> <option> 1.....100</option> </select> <select class="foo"> <option> 1.... 500></option> </select> <input type="submit" value="Submit" name="submit"/> </form> I essentially want to group all my select boxes and access all the values in my PHP code. Thanks

    Read the article

  • getting the "this" that a function's caller was called with in JavaScript

    - by David Morrissey
    Is it possible to get the this that a function's caller was called with in JavaScript without passing this to the arguments in a way which supports IE as well as Firefox/Chrome et al? For example: var ob = { callme: function() { doSomething() } } function doSomething() { alert(doSomething.caller.this === ob) // how can I make this work? } ob.callme() I'm starting to suspect it's not, but I thought I may as well ask as it'd make my code much shorter and easier to read. Thanks for any information!

    Read the article

  • How sophisticated should be DAL?

    - by Andrew Florko
    Basically, DAL (Data Access Layer) should provide simple CRUD (Create/Read/Update/Delete) methods but I always have a temptation to create more sophisticated methods in order to minimize database access roundtrips from Business Logic Layer. What do you think about following extensions to CRUD (most of them are OK I suppose): Read: GetById, GetByName, GetPaged, GetByFilter... e.t.c. methods Create: GetOrCreate methods (model entity is returned from DB or created if not found and returned), Create(lots-of-relations) instead of Create and multiple AssignTo methods calls Update: Merge methods (entities list are updated, created and deleted in one call) Delete: Delete(bool children) - optional children delete, Cleanup methods Where do you usually implement Entity Cache capabilities? DAL or BLL? (My choice is BLL, but I have seen DAL implementations also) Where is the boundary when you decide: this operation is too specific so I should implement it in Business Logic Layer as DAL multiple calls? I often found insufficient BLL operations that were implemented in dozen database roundtrips because developer was afraid to create a bit more sophisticated DAL. Thank you in advance!

    Read the article

  • Pattern for verifying authenticity of a request to WCF service

    - by fung
    I have a client app that makes calls to a WCF service. This app is on a public computer that's easily accessible and anyone can easily copy the .EXE and .CONFIG of my app into another machine and start using it. Is there a pattern where I can check if the request is coming only from an app on a computer I installed it on and not on one it has been copied to? Thanks in advance.

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >