Search Results

Search found 5456 results on 219 pages for 'named pipes'.

Page 147/219 | < Previous Page | 143 144 145 146 147 148 149 150 151 152 153 154  | Next Page >

  • Reflection alternative for switch on enum in order to select namespace/class

    - by Am
    Hi, I have an interface named IHarvester. There are 3 implementations of that interface, each under their own namespace: Google Yahoo Bing A HarvesterManager uses the given harvester. It knows the interface and all 3 implementations. I want some way of letting the class user say in which harvester it wants to use. And in the code select that implementation, without a switch-case implementation. Can reflection save my day? Here is the code bits: // repeat for each harvester namespace Harvester.Google { public abstract class Fetcher : BaseHarvester, IInfoHarvester {...} } public enum HarvestingSource { Google, Yahoo, Bing, } class HarvesterManager { public HarvestingSource PreferedSource {get;set;} public HarvestSomthing() { switch (PreferedSource) .... // awful... } } Thanks. I will give my 2 cents of why I want to change this. There several people writing harvesters, I want them to focus only on building more harvesters, without ever needing to update the enum, or at worst, update only the enum.

    Read the article

  • xsl:variable xsl:copy-of select

    - by user1901345
    I have the following XML: Picture 1 Picture 2 Picture 3 While this XSL does what is expected (output the attr of the first picture): It seems to be not possible to do the same inside the variable declaration using xsl:copy-of: Curious: If I just select "$FirstPicture" instead of "$FirstPicture/@attr" in the second example, it outputs the text node of Picture 1 as expected... Before you all suggest me to rewrite the code: This is just a simplified test, my real aim is to use a named template to select a node into the variable FirstPicture and reuse it for further selections. I hope someone could help me to understand the behavior or could suggest me a proper way to select a node with code which could be easily reused (the decission which node is the first one is complex in my real application). Thanks.

    Read the article

  • How to convert string to integer?

    - by user1260584
    So I'm having a hard time with my situation and need some advice. I'm trying to convert my two Strings that I have into integers, so that I can use them in math equations. Here is what I tried, however it brings me an error in the app. ' equals.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { // TODO Auto-generated method stub num1 = edit.getText().toString(); num2 = edit.getText().toString(); int first = Integer.parseInt(num1); int second = Integer.parseInt(num2); edit.setText(first + second); } }); Is there something that I am doing wrong? Thank you for any help. EDIT: Yes this is Java. num1 and num2 are strings that I have previously named. What do you mean by trim?

    Read the article

  • DataSet.GetChanges - Save the updated record in a different table than the source one

    - by John Dev
    I'm doing operation on a dataset containing data from a sql table named Test_1 and then get the updated records using the DataSet.GetChanges(DataRowState.Modified) function. Then i try to save the dataset containing the updated records on a different table than the source one (the table is names Test and has the same structure as Test_1) using the following statement: sqlDataAdapter.Update(changesDataSet,"Test"); I'm getting the following error : Update unable to find TableMapping['Test'] or DataTable 'Test' I'm new to ado.net and don't even know if it"s something possible. Any advice is welcome. Just to provide a bit of context. ETL jobs are importing data in temp table with same structure as the original but with _jobid suffix. Right after a rule engine is doing validation before updating the original table.

    Read the article

  • finding the value of radio button with jquery

    - by oo
    i have this code below to show different divs when i choose certain radio buttons: if ($("input[@name='exerciseRB']:checked").val() == 'New') { $("#newExercise").show(); $("#existingExercise").hide(); } else { $("#newExercise").hide(); $("#existingExercise").show(); } at first, i just had two radio buttons (both named exerciseRB and everything works fine. Now, later in my web page i added two new radio buttons (with the name lessonRB). The issue is that once i added these other new radio buttons when i look up this in firebug: $("input[@name='exerciseRB']:checked") i actually get an array back with both the exerciseRB item as well as the lessonRB item. Its almost as if the @name='exerciseRB' is being ignored. any ideas here?

    Read the article

  • Output of Iterable.sliding as Tuple

    - by ziggystar
    The method sliding on collections returns a sliding window of given size in the form of X[Iterable[A]] with X being the type of the collection and A the element type. Often I need two or three elements and I prefer to have them named. One ugly workaround for sliding(2) is the following: points.sliding(2).foreach{ twoPoints => val (p1,p2) = (twoPoints.head,twoPoints.last) //do something } This sucks and only works for two elements. Also note that (a,b) = (twoPoints(0),twoPoints(1)) doesn't work. Help me!

    Read the article

  • how does tomcat like web container handle struts 2 variables ?

    - by mobby1982
    i am a newbie . i have a question regarding struts 2 framework and tomcat . i know that each request has it own thread , but my question is are the global variables defined in struts action shared amongst requests. for ex: if i have a global variable named say int pageNo; and i am using in say method called paginationAll() can i use the same variable (pageNo) for another method called say paginatonMaterialAll() in the same action or does each thread has its own set of variables even though globally defined?

    Read the article

  • PHP arrays & keys - fetching particular ones

    - by Rohan
    Hi Lets say I have an array with a structure like this: $arr= Array( array( "id"=>"a" "type">"apple"), array( "id"=>"b"), array( "id"=>"c"), array( "id"=>"c" "type"=>"banana") ); now I want to have a foreach loop which fetches all the array elements which have a key in them named "type". Something like foreach(all arrays which have type in them as $item) How would I do that? many thanks.

    Read the article

  • Data structure name: combination array/linked list

    - by me_and
    I have come up with a data structure that combines some of the advantages of linked lists with some of the advantages of fixed-size arrays. It seems very obvious to me, and so I'd expect someone to have thought of it and named it already. Does anyone know what this is called: Take a small fixed-size array. If the number of elements you want to put in your array is greater than the size of the array, add a new array and whatever pointers you like between the old and the new. Thus you have: Static array ————————————————————————— |1|2|3|4|5|6|7|8|9|a|b|c| ————————————————————————— Linked list ———— ———— ———— ———— ———— |1|*->|2|*->|3|*->|4|*->|5|*->NULL ———— ———— ———— ———— ———— My thing: ———————————— ———————————— |1|2|3|4|5|*->|6|7|8|9|a|*->NULL ———————————— ————————————

    Read the article

  • what is the accepted naming convention for int, string, array, list, object, etc...

    - by RJ
    The company I work for now uses a set naming convention for their C# variables such as iSomeName for int, sSomeName for string, aSomeName for arrays, bSomeName for boolean, dSomeName for datetime and so on. My previous employer did not use the i, s, a, b and d prefixes and just named the variables a good understandable name. My impression is that these prefixes lost favor a while ago and from what I read it is not the current trend. It seems fine to me either way as long as the variable is descriptive enough to understand what it is doing but I was wondering what the now-a-day accepted practice is for naming variables?

    Read the article

  • C++ inheritance doubt

    - by Poiuyt
    Can you explain why this is not allowed, #include <stdio.h> class B { private: int a; public: int a; }; int main() { return 0; } while this is? #include <stdio.h> class A { public: int a; }; class B : public A{ private: int a; }; int main() { return 0; } In both the cases, we have one public and one private variable named a in class B.

    Read the article

  • LINQ to SQL, how to write a method which checks if a row exists when we have multiple tables

    - by Beles
    Hi, I'm trying to write a method in C# which can take as parameter a tabletype, column and a columnvalue and check if the got a row with a with value the method looks like: public object GetRecordFromDatabase(Type tabletype, string columnname, string columnvalue) I'm using LINQ to SQL and need to to this in a generic way so I don't need to write each table I got in the DB. I have been doing this so far for each table, but with more than 70 of these it becomes cumbersome and boring to do. Is there a way to generate the following code dynamically, And swap out the hardcoded tablenames with the values from the parameterlist? In this example I have a table in the DB named tbl_nation, which the DataContext pluralizes to tbl_nations, and I'm checking the column for the value if (DB.tbl_nations.Count(c => c.code.Equals(columnvalue)) == 1) { return DB.tbl_nations.Single(c => c.code.Equals(columnvalue)); }

    Read the article

  • How to programatically set a permanent environment variable in Linux?

    - by Richard
    I am writing a little install script for some software. All it does is unpack a target tar, and then i want to permanently set some environment variables - principally the location of the unpacked libs and updating $PATH. Do I need to programmatically edit the .bashrc file, adding the appropriate entries to the end for example, or is there another way? What's standard practice? Edit: The package includes a number of run scripts (20+) that all use these named environment variables, so I need to set them somehow (the variable names have been chosen such that a collision is extremely unlikely)

    Read the article

  • SQL searching two columns for best results

    - by brsmnc
    Hi all I would like to perform an sql search and I would like to get best results. I tried some things but they didn't work well. I have got two columns named subject and content For example we will search "search this keywords" text on subject and content area. First I'm searching "search this keywords" then searching "search" and "this" and "keywords" I would like to retrieve subject's results on top and I would like to retrieve best results liking "search this keywords".My query sometimes works well sometimes not. How should I write this query Thanks..

    Read the article

  • using both layout-land and onConfigurationChanged()

    - by joe
    I just want to change Layout when the device has been rotated. but I've found that onConfigurationChanged() must call onCreate() again using setContentView with separated layout named of *_land.xml if(getActivity().getWindowManager().getDefaultDisplay(). getRotation() == Surface.ROTATION_0) view = inflater.inflate(R.layout.fragment_layout, null); else view = inflater.inflate(R.layout.fragment_layout_land, null); Project is too big and there are many codes to fix If onCreate again without finish(). I'd like somebody help this. Thank you. - onConfigurationChanged concept is keep layout I think

    Read the article

  • Utilizing a third party application for GitHub in a django project

    - by Smock
    I'm trying to use a third party application located here: git://github.com/Star2Billing/django-audiofield.git I'm using Aptana Studio as my IDE. I created my project and then I clicked on the project and imported the app from the github location. It looked like it imported. I wanted to check that it imported properly before beginning any real coding so I performed manage.py validate. I got a message that stated: "No module named audiofield". I added the app to my Installed Apps settings and followed the installation instructions. I'm not sure if I'm importing it incorrectly. Also, I'm using virtualenv in Aptana. I'm not sure if this may have added to the problem. Please help.

    Read the article

  • Dynamic decision on which class to use

    - by Sirupsen
    Hello, Let's say I have a class named Klass, and a class called Klass2. Depending on the user's input, I'd like to decide whether I'll call "hello_world" on Klass, or Klass2: class Klass def self.hello_world "Hello World from Klass1!" end end class Klass2 def self.hello_world "Hello World from Klass2!" end end input = gets.strip class_to_use = input puts class_to_use.send :hello_world The user inputs "Klass2" and the script should say: Hello World from Klass2! Obviously this code doesn't work, since I'm calling #hello_world on String, but I'd like to call #hello_world on Klass2. How do I "convert" the string into a referrence to Klass2 (or whatever the user might input), or how could I else would I achieve this behavior?

    Read the article

  • Creating Oracle stored procedure that returns data

    - by user3614327
    In Firebird you can create a stored procedure that returns data an invoke it like a table passing the arguments: create or alter procedure SEL_MAS_IVA ( PCANTIDAD double precision) returns ( CANTIDAD_CONIVA double precision) as begin CANTIDAD_CONIVA = pCANTIDAD*(1.16); suspend; end select * from SEL_MAS_IVA(100) will return a single row single column (named CANTIDAD_CONIVA) relation with the value 116 This is a very simple example. The stored procedure can of course have any number of input and output parameters and do whatever it needs to return data (including multiple rows), which is accomplished by the "suspend" statement (which as it name implies, suspends the SP execution, returns data to the caller, and resumes with the next statement) How can I create such kind of stored procedures in Oracle?

    Read the article

  • How do they read clusters/cylinders/sectors from the disk?

    - by claws
    Hello, I needed to recover the partition table I deleted accidentally. I used an application named TestDisk. Its simply mind blowing. I reads each cylinder from the disk. I've seen similar such applications which work with MBR & partitioning. I'm curious. How do they read clusters/cylinders/sectors from the disk? Is it again OS dependent? If so whats the way to for Linux & for windows?

    Read the article

  • what's the javascript "var _gaq = _gaq || []; " for ?

    - by parvas
    The Async Tracking in google analytics looks like this: var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); About The first line var _gaq = _gaq || []; I think it ensures that if _gaq is already defined we should use it otherwise we should an array. Can anybody explain what this is for ? Also, does it matter if _gaq gets renamed ? in other words does google analytics rely on a global object named _gaq ? Thanks Parvas

    Read the article

  • Navigating sharepoint with a treeview

    - by linqmonkey
    I'm trying to replace the navigation on our sharepoint site with a treeview. It's a large site with up to 4 subsite leves in places. All I need it to do is show a consistent structure from page to page show only sites and pages The default sharepoint treeview seems to do neither of these things (doesn't display items from the parent site, includes document libraries but not pages). Does anyone have any idea how to achieve this? We're using the publishing site template throughout if that makes a difference. I've tried binding the tree to the datasource the quick launch uses but I guess from the error message they expect differently named properties.

    Read the article

  • Can i query a List? Java

    - by Nitesh Panchal
    Hello, Say i have List<SomeObject> objList = new ArrayList<SomeObject>(); If someObject contains a field named id. Can we find it through some query like objList.filter('id=2'); wihout looping through the list? If not, then why? This can be so useful method and used as an alternative to write tedious for loop? Just a question that came to my mind so i thought i must clear it here :) Thanks in advance :)

    Read the article

  • C#: Converting string to namespace

    - by Am
    Hi, I have an interface named IHarvester. There are 3 implementations of that interface, each under their own namespace: Google Yahoo Bing A HarvesterManager uses the given harvester. It knows the interface and all 3 implementations. I want some way of letting the class user say in which harvester it wants to use. And in the code select that implementation, without a switch-case implementation. Can reflection save my day? Here is the code bits: // repeat for each harvester namespace Harvester.Google { public abstract class Fetcher : BaseHarvester, IInfoHarvester {...} } public enum HarvestingSource { Google, Yahoo, Bing, } class HarvesterManager { public HarvestingSource PreferedSource {get;set;} public HarvestSomthing() { switch (PreferedSource) .... // awful... } } Thanks.

    Read the article

  • How to create wordpress-like option table and get values for each row? (PHP-MySQL)

    - by Nacho
    Hi guys. I'm looking to create an options table in my db that makes every record a system option, so i can work with a little number of fields. my db has the following structure: 3 columns named id, name, and value following data is inserted as an example -- id - name - value 1 - uri - www.example.com 2 - sitename - Working it out 3 - base_folder - /folder1/folder2/ 4 - slogan - Just a slogan for the site -- that way i can include a large number of customizable system options very easily the problem is that i don't know how to retrieve them how do i get the value of uri and store it as a var? and better yet, how do i get, for exmaple, values of id 1 and 4 only without making a query each time? (i assume multiple queries are useless and a pretty ugly method) i know the question is pretty basic but i'm lost here. i'd really appreciate your answer! Thanks in advance

    Read the article

  • Return from jQuery Ajax Method

    - by Lijo
    I have a button named searchReportButton. On this button click, I need to check session value from server using a ajax web method "Error.aspx/CheckSessionExpiry".This is done in checkSession javascript function. The checkSession is not returning anything now - instead it is handling the required operation based on the result (redirecting to error page). I need to return the result of ajax web method to the Main Caller. How can we do this return? Main Caller searchReportButton.click(function () { checkSession(); //Remainging Code }); Helper function checkSession() { var win = 101; $.ajax( { type: "POST", url: "Error.aspx/CheckSessionExpiry", data: '{"winNumber": "' + win + '"}', contentType: "application/json; charset=utf-8", dataType: "json", success: handleSessionResult } ); } Result Helper function handleSessionResult(result) { if (result.hasOwnProperty("d")) { result = result.d } if (result == "ACTIVE") { window.location.href("Error.aspx"); return false; } //alert(result); }

    Read the article

< Previous Page | 143 144 145 146 147 148 149 150 151 152 153 154  | Next Page >