Search Results

Search found 45031 results on 1802 pages for 'same name'.

Page 56/1802 | < Previous Page | 52 53 54 55 56 57 58 59 60 61 62 63  | Next Page >

  • Display user name in reference to user id in django template

    - by Ed
    I expect this is an easy question. For some reason, I don't have a solution yet. I have an object set from django reversion: version_list. Each object in the set has a user id attached to it. How do I grab the user names that correspond to the user ID's? To try to be clearer, if each object in version_list has a name, date, and user id, how can I join the version_list set with the user table to figure out what user id goes with which name? This is done in the view, or the template?

    Read the article

  • What are possible reasons for java.io.IOException: "The filename, directory name, or volume label sy

    - by Turismo
    I am trying to copy a file using the following code: File targetFile = new File(targetPath + File.separator + filename); ... targetFile.createNewFile(); fileInputStream = new FileInputStream(fileToCopy); fileOutputStream = new FileOutputStream(targetFile); byte[] buffer = new byte[64*1024]; int i = 0; while((i = fileInputStream.read(buffer)) != -1) { fileOutputStream.write(buffer, 0, i); } For some users the targetFile.createNewFile results in this exception: java.io.IOException: The filename, directory name, or volume label syntax is incorrect at java.io.WinNTFileSystem.createFileExclusively(Native Method) at java.io.File.createNewFile(File.java:850) Filename and directory name seem to be correct. The directory targetPath is even checked for existence before the copy code is executed and the filename looks like this: AB_timestamp.xml The user has write permissions to the targetPath and can copy the file without problems using the OS. As I don't have access to a machine this happens on yet and can't reproduce the problem on my own machine I turn to you for hints on the reason for this exception.

    Read the article

  • How can I get mounted name and (Drive letter too) on Windows using python

    - by aberry
    I am using Daemon tool to mount an ISO image on Windows XP machine.I do mount using Daemon command (daemon.exe -mount 0,). Above command will mount ISO image to device number. In my case I have 4 partition (C,D,E,F) and G for DVD/CD-RW. Now what happen, ISO gets mounted to drive letter 'H:' with name (as defined while creating ISO) say 'testmount' My queries:- 1) How can I get mount name of mounted ISO image (i.e. 'testmount'). Just another case; if there are already some mount points existing on machine and I created a new one using Daemon tool. Then If I can get latest one using script that will be great. 2) How to get drive letter where it did get mounted. If anyone know python script or command (or even Win command ) to get these info. do let me know. Thanks...

    Read the article

  • How to get the file name for <input type="file" in jsp

    - by deepthinker121
    I want to read the file path from html input type="file" (the entry selected in the file dialog by the user) <script> function OpenFileDialog(form) { var a = document.getElementById("inputfile").click(); SampleForm.filePath.value = //set the path here document.SampleForm.submit(); } </script> <form name="SampleForm" action="TestServlet" method="get"> <input type="file" style="display:none;" id="inputfile"/> <a href="javascript:OpenFileDialog(this.form);">Open here</a> <input type="hidden" name="filePath" value=""/> </form> I want the path of the selected file to be read in my Servlet class How do I get the file path? Can I read it from var a? Or is there any way to directly access the file path from the input type="file" from my servlet?

    Read the article

  • alias_attribute and creating and method with the original attribute name causes a loop

    - by Tiago
    Im trying to dynamically create a method chain in one attribute in my model. By now I have this function: def create_filtered_attribute(attribute_name) alias_attribute "#{attribute_name}_without_filter", attribute_name define_method "#{attribute_name}" do filter_words(self.send("#{attribute_name}_without_filter")) end end so I receive a string with the attribute name, alias it for '*_without_filter*' (alias_method or alias_method_chain fails here, because the attribute isnt there when the class is created), and I create a new method with the attribute name, where I filter its contents. But somehow, when I call *"#{attribute_name}_without_filter"* it calls my new method (i think because the alias_attribute some how), and the program goes into a stack loop. Can someone please enlighten me on this.

    Read the article

  • Regular expression to validate name in .NET multilingual web application

    - by BT
    Hi, how can i write a regular expression to validate name field in a multilingual web application, i want to validate the name field for non-English languages e.g. Spanish or German, and we need to make sure that no one enter digits or special characters. I'm using .NET. I believe we can't use expression as below for non-English language. ^[a-zA-Z]{1,20}$ Any help will be highly appreciated! Solution: I'm using this regular expression ^\p{L}[\p{L}\p{Pd}\x27]*\p{L}$ , and the below MSISDN article was very helpful: MSDN - Regular Expression Also below tool is very helpful, in validating your regular expression: Regex Builder

    Read the article

  • Name of several objects that have the same type

    - by Tomek Tarczynski
    Lets assume we have a class car. How would You name parameters of function that takes two different cars? void Race(Car first, Car second); or maybe void Race(Car car1, Car car2); The same situation with function that takes car and list of cars as a parameters. I'm used to name 'cars' for list of cars, so it is inconvenient to use names like: void Race(Car car, List<Car> cars); Any suggestions about names?

    Read the article

  • List Directories and get the name of the Directory

    - by chrissygormley
    Hello, I am trying to get the code to list all the directories in a folder, change directory into that folder and get the name of the current folder. The code I have so far is below and isn't working at the minute. I seem to be getting the parent folder name. import os for directories in os.listdir(os.getcwd()): dir = os.path.join('/home/user/workspace', directories) os.chdir(dir) current = os.path.dirname(dir) new = str(current).split("-")[0] print new I also have other files in the folder but I do not want to list them. I have tried the below code but I haven't got it working yet either. for directories in os.path.isdir(os.listdir(os.getcwd())): Can anyone see where I am going wrong? Thanks

    Read the article

  • Create class instance in assembly from string name

    - by Arcadian
    I'm not sure if this is possible, and I'm quite new to using assemblies in C#.NET. What I would like to do is to create an instance of a class when supplied the string name of that class. Something like this: using MyAssembly; namespace MyNameSpace { Class MyClass { int MyValue1; int MyValue2; public MyClass(string myTypeName) { foreach(Type type in MyAssembly) { if((string)type == myTypeName) { //create a new instance of the type } } AssignInitialValues(//the type created above) } //Here I use an abstract type which the type above inherits from private void AssignInitialValues(AbstractType myClass) { this.value1 = myClass.value1; this.value2 = myClass.value2; } } } Obviously you cannot compare strings to types but it illustrates what I'm trying to do: create a type from a supplied string. Any thoughts? EDIT: After attempting: var myObject = (AbstractType) Activator.CreateInstance(null, myTypeName); AssignInitialValues(myObject); I get a number of errors: Inconsistent accessibility: parameter type 'MyAssembly.AbstractType' is less accessible than method 'MyNameSpace.MyClass.AssignInitialValues(MyAssembly.AstractType)' 'MyAssembly.AstractType' is inaccessible due to it's protection level The type or namespace name 'MyAssembly' could not be found (are you missing a using directive or an assembly reference?) The type or namespace name 'AbstractType' could not be found (are you missing a using directive or an assembly reference?) Not exactly sure why it can't find the assembly; I've added a reference to the assembly and I use a Using Directive for the namespace in the assembly. As for the protection level, it's calling classes (or rather the constructors of classes) which can only be public. Any clues on where the problem is? UPDATE: After looking through several articles on SO I came across this: http://stackoverflow.com/a/1632609/360627 Making the AbstractTypeclass public solved the issue of inconsistent accessibility. The new compiler error is this: Cannot convert type 'System.Runtime.Remoting.ObjectHandle' to 'MyAssembly.AbstractType' The line it references is this one: var myObject = (AbstractType) Activator.CreateInstance(null, myTypeName); Using .Unwrap() get's me past this error and I think it's the right way to do it (uncertain). However, when running the program I then get a TypeLoadException when this code is called. TypeLoadException: Could not load type ‘AbstractType’ from assembly ‘MyNameSpace'... Right away I can spot that the type its looking for is correct but the assembly it's looking in is wrong. Looking up the Activator.CreateInstance(String, String) method revealed that the null as the first argument means that the method will look in the executing assembly. This is contrary to the required behavior as in the original post. I've tried using MyAssembly as the first argument but this produces the error: 'MyAssembly' is a 'namespace' but is used like a 'variable' Any thoughts on how to fix this?

    Read the article

  • Adding an host programmatically (name resolution under Windows)

    - by Tanelorn
    I would like to programmatically add to Windows a name / IP association so that this name can be resolved locally. This does not have to be persisted between reboots. The only way I now is to add an entry to the "hosts" file, but this feels hacky especially since I would like to automate this. Is there any way to do this using a command-line tool or a Win32 API? Perhaps by addind an entry to Windows DNS cache or something similar? Oh, and please state if this solution is Vista-compatible. Regards. Edit : Thanks, guy. Sadly, all of your answers indeed involve DNS or other servers. I was looking for a purely local solution which would work on a "standard" Windows installation. Such a thing does not seem to exist, though.

    Read the article

  • Add class to .hover functionality on a specific class name - jQuery

    - by marcamillion
    So, throughout my entire document, I would like for every single time the user hovers over an element with a specific class name, I would like a class to be added. My CSS looks like this: .hotspot:hover, .hotspothover { border: 4px solid #fff; box-shadow: 0px 0px 20px #000; -webkit-box-shadow: 0px 0px 20px #000; -moz-box-shadow: 0px 0px 20px #000; z-index: 1; } Class name: "hotspot". I tried this, but it doesn't seem to work: $("#hotspot.hover #hotspothover").addClass("bubble bottom"); Thanks.

    Read the article

  • How to ste default name to GtkComboBox?

    - by PP
    Hello, I want to set my GtkComboBox to have some default name on it as follows: +---------------+---+ | Image Options | X | +---------------+---+ | Image Option 1 | +-------------------+ | Image Option 2 | +-------------------+ | Image Option 3 | +-------------------+ Thanks, PP.

    Read the article

  • Python: Dynamic attribute name generation without exec() or eval()

    - by PyNewbie27
    Hi, I'm trying to dynamically create buttons at runtime with PyQT4.7 However, this being my first python program I'm not sure how to get the functionality I want. I would like to be able to substitute a text string for an attribute name: i.e. for each in xrange(4): myname = "tab1_button%s" % each #tab1_button0, tab1_button1, tab1_button2 #self.ui.tab1_button0 = QtGui.QPushButton(self.ui.tab) <--normal code to create a named button setattr(self.ui,myname,QtGui.QPushButton(self.ui.tab)) #rewrite of line above to dynamicly generate a button #here's where I get stuck. this code isn't valid, but it shows what i want to do self.ui.gridLayout.addWidget(self.ui.%s) % myname #I need to have %s be tab1_button1, tab1_button2, etc. I know the % is for string substituion but how can I substitute the dynamically generated attribute name into that statement? I assume there's a basica language construct I'm missing that allows this. Since it's my first program, please take it easy on me ;)

    Read the article

  • Log the method name in objective-C?

    - by vodkhang
    Currently, we are defining ourselves an extended log mechanism to print out the class name and the source line number of the log. #define NCLog(s, ...) NSLog(@"<%@:%d> %@", [[NSString stringWithUTF8String:__FILE__] lastPathComponent], \ __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__]) For example, when I call NCLog(@"Hello world"); The output will be: Hello world Now I also want to log out the method name like: Hello world So, this would make our debugging become easier when we can know which method is getting called. I know that we also have XCode debugger but sometimes, I also want to do debugging by logging out.

    Read the article

  • Python: Getting the attribute name that the created object will be given

    - by cool-RR
    Before I ask this, do note: I want this for debugging purposes. I know that this is going to be some bad black magic, but I want to use it just during debugging so I could identify my objects more easily. It's like this. I have some object from class A that creates a few B instances as attributes: class A(object): def __init__(self) self.vanilla_b = B() self.chocolate_b = B() class B(object): def __init__(self): # ... What I want is that in B.__init__, it will figure out the "vanilla_b" or whatever attribute name it was given, and then put that as the .name attribute to this specific B. Then in debugging when I see some B object floating around, I could know which one it is. Is there any way to do this?

    Read the article

  • Sort files by name in Java differs from Windows Explorer

    - by Martyn Hopkins
    I have a simple Java program which reads a file directory and outputs a file list. I sort the files by name: String [] files = dirlist.list(); files = sort(files); My problem is that it sorts by name in a different way than Windows Explorer does. For instance if I have these files: abc1.doc, abc12.doc, abc2.doc. Java will sort like this: abc1.doc abc12.doc abc2.doc When I open the folder in Explorer, my files are sorted like this: abc1.doc abc2.doc abc12.doc How can I make Java sorts my files like in Windows Explorer? Is this a Windows trick?

    Read the article

  • Typecast to a type from just the string representation of the type name

    - by Water Cooler v2
    sTypeName = ... //do some string stuff here to get the name of the type /* The Assembly.CreateInstance function returns a type of System.object. I want to type cast it to the type whose name is sTypeName. assembly.CreateInstance(sTypeName) So, in effect I want to do something like: */ assembly.CreateInstance(sTypeName) as Type.GetType(sTypeName); How do I do that? And, what do I take on the left side of the assignment expression, assuming this is C# 2.0. I don't have the var keyword.

    Read the article

  • Detect LaTeX class name

    - by Matthew Leingang
    I'm working on a LaTeX package which might need to do some things differently depending on the class that's being used. I'm wondering if there's a way to auto-detect or test the document class. One could certainly look up the class files and test for the existence of a specific macro defined by that class, but is there a smarter way? I looked at the definition of the \ProvidesClass macro and can't see if it saves the class name anywhere except \@currname. I believe \@currname is just the name of the current package or class being read. Basically I want to execute \author{\longauthorname} in the article class but \author[\shortauthorname]{\longauthorname} in the beamer class.

    Read the article

< Previous Page | 52 53 54 55 56 57 58 59 60 61 62 63  | Next Page >