Search Results

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

Page 90/1802 | < Previous Page | 86 87 88 89 90 91 92 93 94 95 96 97  | Next Page >

  • Help for creating a random String

    - by Max
    I need to create a random string which should be between the length of 6 to 10 but it sometimes generates only about the length of 3 to 5. Here's my code. Can anyone would be able to find out the problem? :( int lengthOfName = (int)(Math.random() * 4) + 6; String name = ""; /* randomly choosing a name*/ for (int j = 0; j <= lengthOfName; j++) { int freq = (int)(Math.random() * 100) + 1; if(freq <= 6){ name += "a"; }if(freq == 7 && freq == 8){ name += "b"; }if(freq >= 9 && freq <= 11){ name += "c"; }if(freq >= 12 && freq <= 15){ name += "d"; }if(freq >= 16 && freq <= 25){ name += "e"; }if(freq == 26 && freq == 27){ name += "f"; }if(freq == 28 && freq == 29){ name += "g"; }if(freq >= 30 && freq <= 33){ name += "h"; }if(freq >= 34 && freq <= 48){ name += "i"; }if(freq == 49 && freq == 50){ name += "j"; }if(freq >= 51 && freq <= 55){ name += "k"; }if(freq >= 56 && freq <= 60){ name += "l"; }if(freq == 61 && freq == 62){ name += "m"; }if(freq >= 63 && freq <= 70){ name += "n"; }if(freq >= 71 && freq <= 75){ name += "o"; }if(freq == 76 && freq == 77){ name += "p"; }if(freq == 78){ name += "q"; }if(freq >= 79 && freq <= 84){ name += "r"; }if(freq == 85 && freq == 86){ name += "s"; }if(freq == 87 && freq == 88){ name += "t"; }if(freq >= 89 && freq <= 93){ name += "u"; }if(freq == 94){ name += "v"; }if(freq == 95 && freq == 96){ name += "w"; }if(freq == 97){ name += "x"; }if(freq == 98 && freq == 99){ name += "y"; }if(freq == 100){ name += "z"; } }

    Read the article

  • How to get OMElement by name in mediate?

    - by luohao
    I have a response message like this: <message> <header> <TransactionID>1</TransactionID> <Timestamp>2012-05-22 10:10:36</Timestamp> <OpCode>BOSS_DELETE_USER_SME.CD</OpCode> <MsgType>RESP</MsgType> <ReturnCode>1016</ReturnCode> <ErrorMessage>uif return error message!</ErrorMessage> </header> </message> I need convert RetuenCode "1016" to "0" in extension class. How to get OMElement "ReturnCode" in mediate? My code is failed. SOAPEnvelope envelope = context.getEnvelope(); SOAPBody soapBody = envelope.getBody(); QName ReturnCode = new QName(null, "ReturnCode"); OMElement response = soapBody.getFirstChildWithName(ReturnCode);

    Read the article

  • Get name of property as a string

    - by Jim C
    I'm trying to improve the maintainability of some code involving reflection. The app has a .NET Remoting interface exposing (among other things) a method called Execute for accessing parts of the app not included in its published remote interface. Here is how the app designates properties (a static one in this example) which are meant to be accessible via Execute: RemoteMgr.ExposeProperty("SomeSecret", typeof(SomeClass), "SomeProperty"); So a remote user could call: string response = remoteObject.Execute("SomeSecret"); and the app would use reflection to find SomeClass.SomeProperty and return its value as a string. Unfortunately, if someone renames SomeProperty and forgets to change the 3rd parm of ExposeProperty(), it breaks this mechanism. I need to the equivalent of: SomeClass.SomeProperty.GetTheNameOfThisPropertyAsAString() to use as the 3rd parm in ExposeProperty so refactoring tools would take care of renames. Is there a way to do this? Thanks in advance.

    Read the article

  • What's the formal name for this Syntax?

    - by rlb.usa
    Sometimes in Scheme, I have functions that take arguments like this add 3 4 What do you call this kind of "list" where it's elements are like a1 a2 a3 ? I don't think you can call it a list because lists are contained in parenthesis and elements are comma-seperated.

    Read the article

  • Win32 WndProc Name: why can't I change its name ?

    - by asksuperuser
    I have compiled a simple win32 app successfully with bc++ (2 lines excerpt only): LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); wincl.lpfnWndProc = WindowProcedure; Why can't I rename WindowProcedure and compile this: LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM); wincl.lpfnWndProc = WndProc; as error message gives: Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland Error: Unresolved external 'stdcall WndProc(HWND *, unsigned int, unsigned int, long)' referenced from C:\PROGRAMMING\SALLY\WIN32TUTORIAL\MAIN.OBJ

    Read the article

  • Rails - Dynamic name routes namespace

    - by Kuro
    Hi, Using Rails 2.3, I'm trying to configure my routes but I uncounter some difficulties. I would like to have something like : http:// mydomain.com/mycontroller/myaction/myid That should respond with controllers in :front namespace http:// mydomain.com/aname/mycontroller/myaction/mydi That should respond with controllers in :custom namespace I try something like this, but I'm totaly wrong : map.namespace :front, :path_prefix => "" do |f| f.root :controller => :home, :action => :index f.resources :home ... end map.namespace :custom, :path_prefix => "" do |m| m.root :controller => :home, :action => :index m.resources :home ... m.match ':sub_url/site/:controller/:action/:id' m.match ':sub_url/site/:controller/:action/:id' m.match ':sub_url/site/:controller/:action/:id.:format' m.match ':sub_url/site/:controller/:action.:format' end I put matching instruction in custom namespace but I'm not sure it's the right place for it. I think I really don't get the way to customize fields in url matching and I don't know how to find documentation about Rails 2.3, most of my research drove me to Rails 3 doc about the topic... Somebody to help me ?

    Read the article

  • Is correct name enough to make it happen?

    - by Knowing me knowing you
    Guys, I've just dipped in to limits.h by MS. I tried to check what's the return type for max() fnc and to my surprise I see something like this: // TEMPLATE CLASS numeric_limits template<class _Ty> class numeric_limits : public _Num_base { // numeric limits for arbitrary type _Ty (say little or nothing) public: static _Ty (__CRTDECL min)() _THROW0() { // return minimum value return (_Ty(0)); } static _Ty (__CRTDECL max)() _THROW0() { // return maximum value return (_Ty(0));//EXACTLY THE SAME WHAT IN min<<------------------ } //... other stuff }; so how is it possiple that in both min and max return does exactly the same? So does it mean if I would write makeSanwich() return (_Ty(0)) it would make a sandwich for me? How is it possible that having this same code just fnc names different we are getting different results?

    Read the article

  • Putting a variable name = value format in Ruby

    - by Calm Storm
    Hi, I would like to add some debugs for my simple ruby functions and I wrote a function as below, def debug(&block) varname = block.call.to_s puts "#{varname} = #{eval(varname,block)}" end debug {:x} #prints x = 5 debug {:y} #prints y = 5 I understand that eval is evil. So I have two questions. Is there any way to write that debug method without using eval? If NO is there a preferred way to do this? Is there any way to pass a list of arguments to this method? I would ideally prefer debug {:x, :y. :anynumOfvariables}. I could not quite figure out how to factor that into the debug method (i.e, to take a list of arguments)

    Read the article

  • Allow Incorrect Package Name in Eclipse

    - by SamBeran
    I have some classes in my current project which have the wrong package declaration (they are in the wrong folder for their declared package.) Unfortunately, fixing the problem by moving the class is not an option. Is there a way I can get eclipse to ignore the error?

    Read the article

  • Get class instance by class name string

    - by VDVLeon
    Hi all, I noticed the function Object.factory(char[] className) in D. But it does not work like I hoped it would work; it does not work ;) An example: import std.stdio; class TestClass { override string toString() { return typeof(this).stringof; // TestClass } }; void main(string[] args) { auto i = Object.factory("TestClass"); if (i is null) { writeln("Class not found"); } else { writeln("Class string: " ~ i); } } I think this should result in the message: "Class string: TestClass" but it says "Class not found". Does anybody know why this happens and how I could fix it ? Or do I need to make my own class factory. For example by make a class with a static array Object[string] classes; with class instances. When I want a new instance I do this: auto i = (className in classes); if (i is null) { return null; } return i.classinfo.create();

    Read the article

  • How do i find out in sql what db name I'm connect to

    - by gjutras
    We have a change control environment where the developers give scripts to change control people to run. we have dev,qa, & production environments. I want to conditionalize a couple segments to do some different things depending on what database the change control person is running my script. If @dbname='dev' then begin --do some dev stuff end If @dbname='QA' then begin --do some qa stuff end If @dbname='Prod' then begin --do some production stuff end How do I get at what the current connected database is and fill @dbname?

    Read the article

  • Does a child control inherit its parents properties of the same name

    - by Dave Colwell
    Hi all, simple question regarding property value inheritance in UserControls. If i create a UserControl, it has some standard properties like Background, BorderBrush and BorderThickness. Within that UserControl i have a border. I want to know, if i dont specify any set value or binding for the property BorderBrush of that border, will it automatically inherit the value of BorderBrush from the parent control? Thanks!

    Read the article

  • Knowing the user name in a Page

    - by ctacke
    Let's assume the following: I have an IIS web site set up IIS is configured to use Digest authentication I'm running an ASP.NET page The page has a code-behing assembly that overrides Page_Load When a user navigates to that page, I get a security prompt for the username and password. If the username and password are invalid (i.e. incorrect password) is there a way for the called page, in Page_Load to know, or does IIS handle this and return the 401 before the ASP.NET engine ever gets around to resolving the actual Page class that will get executed?

    Read the article

  • Regex to remove all but file name from links

    - by Moasely
    Hi, I am trying to write a regexp that removes file paths from links and images. href="path/path/file" to href="file" href="/file" to href="file" src="/path/file" to src="file" and so on... I thought that I had it working, but it messes up if there are two paths in the string it is working on. I think my expression is too greedy. It finds the very last file in the entire string. This is my code that shows the expression messing up on the test input: <script type="text/javascript" src="/javascripts/jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ var s = '<a href="one/keepthis"><img src="/one/two/keep.this"></a>'; var t = s.replace(/(src|href)=("|').*\/(.*)\2/gi,"$1=$2$3$2"); alert(t); }); </script> It gives the output: <a href="keep.this"></a> The correct output should be: <a href="keepthis"><img src="keep.this"></a> Thanks for any tips!

    Read the article

  • ASP.NET MVC subdomain shows folder name

    - by Paul
    Hi, I'm using godaddy shared hosting, with IIS7, Integrated mode, and published up a bog standard MVC2 app to dev.lazygekko.com created with Visual Web Developer 2010. It all works, however when any of the links are clicked, they point to dev.lazygekko.com/dev/..., dev being the folder it is pointing at. Can anyone shed some light on what I may be doing wrong? Many thanks.

    Read the article

  • How to join by column name

    - by Daniel Vaca
    I have a table T1 such that gsdv |nsdv |esdv ------------------- 228.90 |216.41|0.00 and a table T2 such that ds |nm -------------------------- 'Non-Revenue Sales'|'ESDV' 'Gross Sales' |'GSDV' 'Net Sales' |'NSDV' How do I get the following table? ds |nm |val --------------------------------- 'Non-Revenue Sales'|'ESDV'|0.00 'Gross Sales' |'GSDV'|228.90 'Net Sales' |'NSDV'|216.41 I know that I can this by doing the following SELECT ds,nm,esdv val FROM T1,T2 WHERE nm = 'esdv' UNION SELECT ds,nm,gsdv val FROM T1,T2 WHERE nm = 'gsdv' UNION SELECT ds,nm,nsdv val FROM T1,T2 WHERE nm = 'nsdv' but I am looking for a more generic/nicer solution. I am using Sybase, but if you can think of a way to do this with other DBMS, please let me know. Thanks.

    Read the article

  • JQuery if/else statement matching a wildcard css name

    - by Neokoenig
    Hi All, I'm trying to write an if/else statement in jQuery which can change an elements class by matching 'IN' or 'OUT' (in this case). I.e, I have several Divs with class='IN-something' OR class='OUT-something'. The below would work if I new the exact CSS class, but all I'll know is whether it contains 'IN' or 'OUT'. So like this, but works: if ($(jRow).hasClass('IN-*')) {jRow.attr( "class", "OUT-foo" );} else {jRow.attr( "class", "IN-foo");} Ideas? Thanks!

    Read the article

  • Combine First, Middle Initial, Last name and Suffix in T-SQL (No extra spaces)

    - by Paul
    I'm trying not to reinvent the wheel here...I have these four fields [tbl_Contacts].[FirstName], [tbl_Contacts].[MiddleInitial], [tbl_Contacts].[LastName], [tbl_Contacts].[Suffix] And I want to create a FullName field in a view, but I can't have extra spaces if fields are blank...So I can't do FirstName + ' ' + MiddleInitial + ' ' + LastName + ' ' + Suffix...Because if there is no middle initial or suffix I'd have 2 extra spaces in the field. I think I need a Case statement, but I thought someone would have a handy method for this...Also, the middleinitial and suffix may be null.

    Read the article

  • Trying to instantiate a class member in C++ with a variable name

    - by MarcZero
    Hello. I am writing a program for class that is asking us to create a class of "book". We are then supposed to create new instantiations of that class upon demand from the user. I am new to C++ so I am attempting to code this out but am running into a problem. The main problem is how do I instantiate a class with a variable if I don't know how many I will have to do ahead of time. The user could ask to add 1 book or 1000. I am looking at this basic code: This is the simple code I started with. I wanted to have an index int keep a number and have the book class I create be called by that int (0, 1, 2, etc...) So I attempted to convert the incoming index int into a string, but I'm kind of stuck from here. void addBook(int index){ string bookName; std::stringstream ss; ss << index; book bookName; cout << "Enter the Books Title: "; cin >> bookName.title; } But obviously this doesn't work as "bookName" is a string to the computer and not the class member I tried to create. All of the tutorials I have seen online and in my text show the classes being instantiated with names in the code, but I just don't know how to make it variable so I can create any amount of "books" that the user might want. Any insight on this would be appreciated. Thank you for your time.

    Read the article

  • How can i get the selected option name or id of a select element using jQuery

    - by bill
    Hi All, i have a "questionairre" that is made up of a series of select boxes. i need to use two properties in the options. For each selected option i need the value (which i know how to get and is working fine) but i also need to store an additional value which represents the id of the specific option in a DB. One solution would be to put the two values in the "value" property and parse it out.. but if there is some other property i can use that might be easier and clearer.. can i add a custom property?? like databaseId that could be accessed with jQuery? thanks for ANY suggestions.

    Read the article

< Previous Page | 86 87 88 89 90 91 92 93 94 95 96 97  | Next Page >