Daily Archives

Articles indexed Friday December 31 2010

Page 25/30 | < Previous Page | 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • C# Type Casting at Runtimefor Array.SetValue

    - by sprocketonline
    I'm trying to create an array using reflection, and insert values into it. I'm trying to do this for many different types so would like a createAndFillArray function capable of this : Type t1 = typeof(A); Type t2 = typeof(B); double exampleA = 22.5; int exampleB = 43; Array arrA = createAndFillArray(t1, exampleA); Array arrB = createAndFillArray(t2, exampleB); private Array createAndFillArray(Type t, object val){ Array arr = Array.CreateInstance( t, 1); //length 1 in this example only, real-world is of variable length. arr.SetValue( val, 0 ); //this causes the following error: "System.InvalidCastException : Object cannot be stored in an array of this type." return arr; } with the class A being as follows: public class A{ public A(){} private double val; public double Value{ get{ return val; } set{ this.val = value; } } public static implicit operator A(double d){ A a = new A(); a.Value = d; return a; } } and class B being very similar, but with int: public class B{ public B(){} private double val; public double Value{ get{ return val; } set{ this.val = value; } } public static implicit operator B(double d){ B b = new B(); b.Value = d; return b; } } I hoped that the implicit operator would have ensured that the double be converted to class A, or the int to class B, and the error avoided; but this is obviously not so. The above is used in a custom deserialization class, which takes data from a custom data format and fills in the corresponding .Net object properties. I'm doing this via reflection and at runtime, so I think both are unavoidable. I'm targeting the C# 2.0 framework. I've dozens, if not hundreds, of classes similar to A and B, so would prefer to find a solution which improved on the createAndFillArray method rather than a solution which altered these classes.

    Read the article

  • MonoTouch Hello World for iPad

    - by Bryan
    I have tried following the sample Hello World for MonoTouch by creating an iPad solution. For some reason I cannot get the MainWindow to load. I followed the instructions exactly and the app just closes before even loading a view. Is there something missing? Do I need to tell the solution how to load the MainWindow.XIB or something? Please help, this seems very basic and I am about to throw MonoTouch in the garbage.

    Read the article

  • django: how to use many-to-many relationships in values()?

    - by john
    i need to group results by a field that requires a few joins from the original model: // response_filter_args is created dynamically responses = Response.objects.filter(**response_filter_args) \ .values('customer__tags__tag') \ # django doesn't like this .annotate(average_score=Avg('rating__score')) Response - customer - tags (many-to-many field pointing to Tag) - tag (the tag as a string) Models are: class Response(models.Model): customer = models.ForeignKey(Customer) ... class Customer(models.Model): tags = models.ManyToManyField(Tag) ... class Tag(models.Model): tag = models.CharField(max_length=255) ... i'm trying to calculate average ratings. to make it work i need to tell django to group by 'tag', but it refuses to. it gives an error: Invalid field name: 'customer__tags__tag' anyone know how i can get it to group by tag? i've tried all the combinations of underscores in customer_tags_tag that i can think of, but nothing works.

    Read the article

  • Need method to seek next/previous records id without cycling through all records.

    - by dqhendricks
    I am using MySQL and PHP. I have a MySQL blog post result set with id fields, and publish_date fields. I display one blog post per page, and the script knows which blog post to display based on $_GET['id'], which correlates to each blog entry's id field. I would like to reference them by id in the url, because I would like each blog post to have a perminant url. I would like to order the blog posts by publish date (descending). Now, on each page there will be next and previous links, which contain the $_GET['id'] value for the next and previous blog posts. How can I figure out what the id of the next and previous blog posts (determined by it's publish_date order) without cycling through each mysql result row? I can't mysql_data_seek(), because I do not know the row index of the current blog post id. I do not want to store a row index in a GET variable because the urls would no longer be perminant. I obviously cannot store the row index in a SESSION variable because then direct links to specific blog posts would have broken next and previous links. Any suggestions would be greatly appreciated.

    Read the article

  • python packaging causes importerror

    - by Absolute0
    I am getting an annoying import error when I try to import a variable in an init.py file. I have attached the files involved and my directory structure: #/home/me/app/app/__init__.py from flaskext.sqlalchemy import SQLAlchemy db = SQLAlchemy(app) #/home/me/app/app/models/__init__.py from datetime import datetime from app import db #shell [me@archlinux app]$ pwd /home/me/app [me@archlinux app]$ ./manage.py /home/me/app/app/__init__.pyc Traceback (most recent call last): File "./manage.py", line 7, in <module> from app import app File "/home/me/app/app/__init__.py", line 3, in <module> from app.views.post import post File "/home/me/app/app/views/post.py", line 4, in <module> from app.models import Post File "/home/me/app/app/models/__init__.py", line 5, in <module> from app import db ImportError: cannot import name db [me@archlinux app]$ tree . +-- apikey.txt +-- manage.py +-- app ¦   +-- forms ¦   ¦   +-- __init__.py ¦   ¦   +-- __init__.py~ ¦   +-- __init__.py ¦   +-- __init__.py~ ¦   +-- __init__.pyc ¦   +-- models ¦   ¦   +-- __init__.py ¦   ¦   +-- __init__.py~ ¦   ¦   +-- __init__.pyc ¦   +-- static ¦   ¦   +-- css ¦   ¦   ¦   +-- style.css ¦   ¦   +-- images ¦   ¦   ¦   +-- favicon.png ¦   ¦   ¦   +-- logo.png ¦   ¦   ¦   +-- text_logo.png ¦   ¦   ¦   +-- thumb_down_active.png ¦   ¦   ¦   +-- thumb_down_inactive.png ¦   ¦   ¦   +-- thumb_up_active.png ¦   ¦   ¦   +-- thumb_up_inactive.png ¦   ¦   +-- js ¦   ¦   ¦   +-- index.js ¦   ¦   +-- sitemap.xml ¦   +-- templates ¦   ¦   +-- 404.html ¦   ¦   +-- 500.html ¦   ¦   +-- about.html ¦   ¦   +-- base.html ¦   ¦   +-- feedback ¦   ¦   ¦   +-- feedback_form.html ¦   ¦   +-- form.html ¦   ¦   +-- posts ¦   ¦   ¦   +-- comment.html ¦   ¦   ¦   +-- post.html ¦   ¦   ¦   +-- posts.html ¦   ¦   +-- spam.html ¦   ¦   +-- terms.html ¦   ¦   +-- users ¦   ¦   +-- login_form.html ¦   ¦   +-- sign_up_form.html ¦   +-- util ¦   ¦   +-- forms.py ¦   ¦   +-- honeypot.py ¦   ¦   +-- __init__.py ¦   ¦   +-- __init__.py~ ¦   ¦   +-- json_http.py ¦   ¦   +-- models.py ¦   ¦   +-- spam.py ¦   +-- views ¦   +-- feedback.py ¦   +-- __init__.py ¦   +-- __init__.pyc ¦   +-- post.py ¦   +-- post.pyc ¦   +-- user.py +-- settings.py +-- settings.pyc +-- TiddlyWiki.html 13 directories, 49 files What might be the problem?

    Read the article

  • Vim navigation clunkiness

    - by Sean Chambers
    I've committed myself to diving into vim to become faster at writing code for ruby/python and I'm having a hard time navigating around files. Mainly, I'm referring to switching between insert mode and navigation modes. Maybe I'm just not completely used to the editor yet but it feels very awkward to constantly be switching in and out of insert mode. Is this something that will go away with time? Are there any tricks to getting quicker at moving in and out of insert mode?

    Read the article

  • Rails: What's the suggested approach to retrieve xml from an outside source

    - by Syrahn
    Rails newbie (though long time programmer) here. I'm writing an test app that retrieves data from several outside sources (think Twitter, RSS feeds, etc.) and under certain circumstances, it stores that data in a db (or presents it to the user). The data model and the views are trivial. What I'm having difficulty with is making the actual xml HTTP call to the outside source and deserialize the xml response so I can query/use it in my controller/helper. What library/gem should I use to accomplish this? I tried looking this up around the net, but only came up with some article from 2006 which, knowing how fast Rails has developed, might well be completely deprecated. Your help is much appreciated.

    Read the article

  • Error while converting function from oracle to mssql

    - by sss
    Hi, I am migrating a function from oracle to mssql 2008.This function raises Select statements included within a function cannot return data to a client as error.How can i solve this problem? Original PLSQL Code CREATE OR REPLACE function f_birim_cevrim_katsayi (p_ID_MAMUL in number, p_ID_BIRIMDEN in number, p_ID_BIRIME in number) return number is v_katsayi number; begin v_katsayi:=0; if p_ID_BIRIMDEN!=p_ID_BIRIME then for c in ( select * from CR_BIRIM_CEVRIM where ID_MAMUL = p_ID_MAMUL and ( (ID_BIRIM = p_ID_BIRIMDEN and ID_BIRIM2 = p_ID_BIRIME) OR ( ID_BIRIM2 = p_ID_BIRIMDEN and ID_BIRIM = p_ID_BIRIME) ) and VALID = 1) loop if c.ID_BIRIM=p_ID_BIRIMDEN then v_katsayi:=c.MT_ORAN; else v_katsayi:=1/c.MT_ORAN; end if; end loop; else v_katsayi:=1; end if; return round(v_katsayi,10); exception when others then return 0; end; TSQL CODE If Exists ( SELECT name FROM sysobjects WHERE name = 'f_birim_cevrim_katsayi' AND type = 'FN') DROP FUNCTION f_birim_cevrim_katsayi GO CREATE FUNCTION f_birim_cevrim_katsayi ( @p_ID_MAMUL FLOAT , @p_ID_BIRIMDEN FLOAT , @p_ID_BIRIME FLOAT ) RETURNS float AS BEGIN DECLARE @adv_error INT DECLARE @v_katsayi FLOAT SELECT @v_katsayi = 0 IF @p_ID_BIRIMDEN != @p_ID_BIRIME BEGIN DECLARE cursor_for_inline_select1 CURSOR LOCAL FOR SELECT * FROM CR_BIRIM_CEVRIM WHERE ID_MAMUL = @p_ID_MAMUL AND ((ID_BIRIM = @p_ID_BIRIMDEN AND ID_BIRIM2 = @p_ID_BIRIME) OR (ID_BIRIM2 = @p_ID_BIRIMDEN AND ID_BIRIM = @p_ID_BIRIME)) AND VALID = 1 OPEN cursor_for_inline_select1 FETCH NEXT FROM cursor_for_inline_select1 WHILE (@@FETCH_STATUS <> -1) BEGIN IF c.ID_BIRIM = @p_ID_BIRIMDEN BEGIN SELECT @v_katsayi = c.MT_ORAN END ELSE BEGIN SELECT @v_katsayi = 1/c.MT_ORAN END END CLOSE cursor_for_inline_select1 DEALLOCATE cursor_for_inline_select1 END ELSE BEGIN SELECT @v_katsayi = 1 END DEALLOCATE cursor_for_inline_select1 return ROUND(@v_katsayi, 10) GOTO ExitLabel1 Exception1: BEGIN DEALLOCATE cursor_for_inline_select1 return 0 END ExitLabel1: return ROUND(@v_katsayi, 10) END GO

    Read the article

  • LINQ to SQL DB Connections not closing

    - by Joe
    I am using LINQ to SQL in an asp.net mvc application. I am calling stored procedures via ajax calls. The active connections for 2-3 users goes to 100 active connections. and then server timeouts happen. I then used IOC -autofac to resuse the same repository that has a datacontext. now tho i get an active connection on the SQL server per loggedin user plus one. I have never seen this before. Why wouldnt Lin2sql not drop a connection when not in use? would calling a stored procedure in an ajax call in a loggedin session creat an a new active connection? Could a Stored Procedure with loops and or a waitfor hold open a connection??

    Read the article

  • Stored Procedure or calculations via IQueryable?

    - by Shawn Mclean
    This is a question that is based on choosing performance over design practices. If I have a method that will be executed many times a second; public static IQueryable<IPerson> InRadius(this IQueryable<IPerson> query, Coordinate center, double radius) { return (from u in query where CallHeavyMathFormula(u, center, radius) select u); } This extension method for IQueryable generates a SQL that does some heavy maths calculation (Cosine, Sine, etc). This would mean the application sends 1-2KB of sql to the server per call. I've heard of placing all application logic, in your application. I also would like to change to a database such as azure or one of those scalable databases in the future. How do I handle something like this? Should I leave it as it is now or write stored procedures? How do applications like twitter or facebook do it?

    Read the article

  • What is a good java data structure for storing nested items (like cities in states)?

    - by anotherAlan
    I'm just getting started in Java and am looking for advice on a good way to store nested sets of data. For example, I'm interested in storing city population data that can be accessed by looking up the city in a given state. (Note: eventually, other data will be stored with each city as well, this is just the first attempt at getting started.) The current approach I'm using is to have a StateList Object which contains a HashMap that stores State Objects via a string key (i.e. HashMap<String, State>). Each State Object contains its own HashMap of City Objects keyed off the city name (i.e. HashMap<String, City>). A cut down version of what I've come up with looks like this: // TestPopulation.java public class TestPopulation { public static void main(String [] args) { // build the stateList Object StateList sl = new StateList(); // get a test state State stateAl = sl.getState("AL"); // make sure it's there. if(stateAl != null) { // add a city stateAl.addCity("Abbeville"); // now grab the city City cityAbbevilleAl = stateAl.getCity("Abbeville"); cityAbbevilleAl.setPopulation(2987); System.out.print("The city has a pop of: "); System.out.println(Integer.toString(cityAbbevilleAl.getPopulation())); } // otherwise, print an error else { System.out.println("That was an invalid state"); } } } // StateList.java import java.util.*; public class StateList { // define hash map to hold the states private HashMap<String, State> theStates = new HashMap<String, State>(); // setup constructor that loads the states public StateList() { String[] stateCodes = {"AL","AK","AZ","AR","CA","CO"}; // etc... for (String s : stateCodes) { State newState = new State(s); theStates.put(s, newState); } } // define method for getting a state public State getState(String stateCode) { if(theStates.containsKey(stateCode)) { return theStates.get(stateCode); } else { return null; } } } // State.java import java.util.*; public class State { // Setup the state code String stateCode; // HashMap for cities HashMap<String, City> cities = new HashMap<String, City>(); // define the constructor public State(String newStateCode) { System.out.println("Creating State: " + newStateCode); stateCode = newStateCode; } // define the method for adding a city public void addCity(String newCityName) { City newCityObj = new City(newCityName); cities.put(newCityName, newCityObj); } // define the method for getting a city public City getCity(String cityName) { if(cities.containsKey(cityName)) { return cities.get(cityName); } else { return null; } } } // City.java public class City { // Define the instance vars String cityName; int cityPop; // setup the constructor public City(String newCityName) { cityName = newCityName; System.out.println("Created City: " + newCityName); } public void setPopulation(int newPop) { cityPop = newPop; } public int getPopulation() { return cityPop; } } This is working for me, but I'm wondering if there are gotchas that I haven't run into, or if there are alternate/better ways to do the same thing. (P.S. I know that I need to add some more error checking in, but right now, I'm focused on trying to figure out a good data structure.) (NOTE: Edited to change setPop() and getPop() to setPopulation() and getPopulation() respectively to avoid confucsion)

    Read the article

  • Issue with clipping rectangles and back to front rendering

    - by Milo
    Here is my problem. My rendering algorithm renders from back to front. But logically, clipping rectangles need to be applied from front to back. Hence why the following does not work: void AguiWidgetManager::recursiveRender(const AguiWidget *root) { //recursively calls itself to render widgets from back to front AguiWidget* nonConstRoot = (AguiWidget*)root; if(!nonConstRoot->isVisable()) { return; } //push the clipping rectangle if(nonConstRoot->isClippingChildren()) { graphicsContext->pushClippingRect(nonConstRoot->getClippingRectangle()); } if(nonConstRoot->isEnabled()) { nonConstRoot->paint(AguiPaintEventArgs(true,graphicsContext)); for(std::vector<AguiWidget*>::const_iterator it = root->getPrivateChildBeginIterator(); it != root->getPrivateChildEndIterator(); ++it) { recursiveRender(*it); } for(std::vector<AguiWidget*>::const_iterator it = root->getChildBeginIterator(); it != root->getChildEndIterator(); ++it) { recursiveRender(*it); } } else { nonConstRoot->paint(AguiPaintEventArgs(false,graphicsContext)); for(std::vector<AguiWidget*>::const_iterator it = root->getPrivateChildBeginIterator(); it != root->getPrivateChildEndIterator(); ++it) { recursiveRenderDisabled(*it); } for(std::vector<AguiWidget*>::const_iterator it = root->getChildBeginIterator(); it != root->getChildEndIterator(); ++it) { recursiveRenderDisabled(*it); } } //release clipping rectangle if(nonConstRoot->isClippingChildren()) { graphicsContext->popClippingRect(); } } I could ofcourse go to the top of the tree, then apply clipping rectangles inward until I get to the currently rendered widget, but that would involve lots of clipping rectangles @ 60 frames per second. I want to minimize calls to pushing and popping rectangles. What could I do, Thanks

    Read the article

  • Spring @Autowired messageSource working in Controller but not in other classes?

    - by Jayaprakash
    New updates: As I could not succeed in configuring messageSource through annotations, I attempted to configure messageSource injection through servlet-context.xml. I still have messageSource as null. Please let me know if you need any more specific info, and I will provide. Thanks for your help in advance. servlet-context.xml <beans:bean id="message" class="com.mycompany.myapp.domain.common.message.Message"> <beans:property name="messageSource" ref="messageSource" /> </beans:bean> Spring gives the below information message about spring initialization. INFO : org.springframework.context.annotation.ClassPathBeanDefinitionScanner - JSR-330 'javax.inject.Named' annotation found and supported for component scanning INFO : org.springframework.beans.factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'message': replacing [Generic bean: class [com.mycompany.myapp.domain.common.message.Message]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in file [C:\springsource\tc-server-developer-2.1.0.RELEASE\spring-insight-instance\wtpwebapps\myapp\WEB-INF\classes\com\mycompany\myapp\domain\common\message\Message.class]] with [Generic bean: class [com.mycompany.myapp.domain.common.message.Message]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/spring/appServlet/servlet-context.xml]] INFO : org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring INFO : org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1c7caac5: defining beans [org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0,org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0,org.springframework.web.servlet.handler.MappedInterceptor#0,org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter,org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0,org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0,xxxDao,message,xxxService,jsonDateSerializer,xxxController,homeController,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,tilesViewResolver,tilesConfigurer,messageSource,org.springframework.web.servlet.handler.MappedInterceptor#1,localeResolver,org.springframework.web.servlet.view.ContentNegotiatingViewResolver#0,validator,resourceBundleLocator,messageInterpolator]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@4f47af3 I have the below definition for message source in 3 classes. In debug mode, I can see that in class xxxController, messageSource is initialized to org.springframework.context.support.ReloadableResourceBundleMessageSource. I have annotated Message class with @Component and xxxHibernateDaoImpl with @Repository. I also included context namespace definition in servlet-context.xml. But in Message class and xxxHibernateDaoImpl class, the messageSource is still null. Why is Spring not initializing messageSource in the two other classes though in xxxController classes, it initializes correctly? @Controller public class xxxController{ @Autowired private ReloadableResourceBundleMessageSource messageSource; } @Component public class Message{ @Autowired private ReloadableResourceBundleMessageSource messageSource; } @Repository("xxxDao") public class xxxHibernateDaoImpl{ @Autowired private ReloadableResourceBundleMessageSource messageSource; } <beans:beans xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=" http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <beans:bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> <beans:property name="basename" value="/resources/messages/messages" /> </beans:bean> <context:component-scan base-package="com.mycompany.myapp"/> </beans>

    Read the article

  • Android Canvas.DrawBitmap without blurring/AntiAliasing?

    - by Sh33p
    I'm trying to make an android game using sprites, (or very pixelated characters, backgrounds etc.). I draw them on the canvas like so... matrix.preScale(xrat,yrat); canvas.drawBitmap(img, matrix, null); Where img is the Bitmap and the xrat and yrat are the scales. My problem is that when I test, the Bitmap is blurry or anti-aliased, is there a way to prevent this? The rigid-blocky art style of the game will be ruined if the blocks are blurry. Any (ANY) help appreciated!

    Read the article

  • PHP readdir(): 3 is not a valid Directory resource

    - by Jordan
    <?php function convert(){ //enable error reporting for debugging error_reporting(E_ALL | E_STRICT); //convert pdf's to html using payroll.sh script and //pdftohtml command line tool $program = "payroll.sh"; $toexec="sh /var/www/html/tmp/" . $program . " 2>&1"; $exec=shell_exec($toexec); //display message from payroll.sh //echo $exec; //echo ('<br/>'); } function process(){ $dir = '/var/www/html/tmp/converted'; //echo ('one'); if (is_dir($dir)) { //echo ('two'); if ($dh = opendir($dir)) { //echo ('three'); while (($file = readdir($dh)) !== false) { //echo ('four'); if ($file != "." && $file != ".."){ echo 'opening file: '; echo $file; echo ("<br/>"); $fp = fopen('/var/www/html/tmp/converted/' . $file, 'r+'); $count = 0; //while file is not at the EOF marker while (!feof($fp)) { $line = fgets($fp); if($count==21) { $employeeID = substr($line,71,4); echo 'employee ID: '; echo $employeeID; echo ('<br/>'); //echo ('six'); $count++; } else if($count==30) { $employeeDate = substr($line,71,10); echo 'employee Date: '; echo $employeeDate; echo ('<br/>'); //echo ('seven'); $count++; } else { //echo ('eight'); //echo ('<br/>'); $count++; } } fclose($fp); closedir($dh); } } } } } convert(); process(); ?> I am setting up a php script that will take a paystub in pdf format, convert it to html, then import it into Drupal after getting the date and employee ID. The code only seems to process the first file in the directory then it gives me this: opening file: dd00000112_28_2010142011-1.html employee ID: 9871 employee Date: 12/31/2010 Warning: readdir(): 3 is not a valid Directory resource in /var/www/html/pay.mistequaygroup.com/payroll.php on line 29 The '3' in the error really confuses me, and google is not helping much. Could it be the 3rd iteration of the loop? The only files in the directory reddir() is scanning are the .html files waiting to be processed. Any ideas? Also, how does my code look? I'm fairly new to doing any real programming and I don't get too much input around work.

    Read the article

  • MATLAB help required function root

    - by programmeur
    Dear All, I have made an program, function bisection; x1=input('enter the first value=') x2=input('enter the second value=') %f3=[]; for x=1:20 %x=1; x3=(x1+x2)/2; while x3-x1 >= 0.001 f3(x)=x3^3 + x3^2 - 3*x3 - 3; f1(x)=x1^3 + x1^2 - 3*x1 - 3; if ((f3(x)*f1(x)) < 0) x2=x3; else x1=x3; end break end format long f3' disp('The root is found to be ='); x3 end . . . . . program calculate function of interval (x1, x2) given by user, my program compile and execute but little stupid repetition until for loop complete, i want to stop further printing loop when desired value is achieved with while condition is used.

    Read the article

  • How do i have optional parameter but still validate them in asp.net mvc routing ?

    - by ooo
    I have this route that i just added routes.MapRoute( "MyRoute", "MyController/{action}/{orgId}/{startDate}/{endDate}", new { controller = "MyController", action = "MyAction", orgId = 0, startDate = DateTime.Today.AddMonths(-1), endDate = DateTime.Today }, new { action = new FromValuesListConstraint(new string[] { "MyAction", "MyActionEx" }), orgId = new IntegerRouteConstraint(), startDate = new DateTimeRouteConstraint(), endDate = new DateTimeRouteConstraint() } when i put in this url, it resolves down to the default route (controller, action,id) and the above rout does not catch this url: http://localhost:1713/MyController/MyAction/16 But this below works fine. http://localhost:1713/MyController/MyAction/16/11-May-10/11-May-10 my question is that i thought both would work as i am giving default values to the startDate and enddate fields i tested this using the RouteDebugger and this route turned up false how can i have these last two parameter as optional but still have the validation ?

    Read the article

  • .Net assembly references being lost as soon as project is compiled

    - by Truegilly
    I have a windows service project, one of many C# projects in a solution file. I add a reference to my "Data_objects" class library for my windows service. this is added to the references no problem. all the classes become available and I can begin to code. As soon a I compile the windows service it says "The type or namespace name 'Data_Objects' could not be found (are you missing a using directive or an assembly reference?)" yet in the solution explorer the reference is fine, no yellow exclamation mark. I have to remove and add it again for it to pick it up, but then as soon as I compile it loses it. This reference works fine in my two other web application projects. what the hell is going on !! Truegilly Update there are no naming conflicts the only bit of code I have is a using statement - eg using Data_Objects.DataContext; also this only happens with a windows service project, i just created a new web app project and it works fine.

    Read the article

  • Parse Facebook API data using loop for getting fan page ID#s?

    - by Brandon Lee
    I've been learning how to parse json data returned from the facebook-api. I've figured out how to fetch fan pages from a specific profile id and want to parse them using a loop! Heres the code and example I have below: This is the data I get back from the facebook-api Array ( [0] => Array ( [page_id] => XXXXXX60828 ) [1] => Array ( [page_id] => XXXXXX0750 ) [2] => Array ( [page_id] => XXXXXX91225 ) [3] => Array ( [page_id] => XXXXXX1960343 ) [4] => Array ( [page_id] => XXXXXX60863 ) [5] => Array ( [page_id] => XXXXXX8582 ) ) I need to be able to put this data in a loop and extract the page_id#s out... still getting familiar with json and am having issues figuring this out? How can I get this in a loop using for each and strip out the page id#s?

    Read the article

  • TeamCity build triggers don't automatically run

    - by Phil.Wheeler
    I've been playing around with and learning a bit about TeamCity and have the server correctly set up with my .Net MVC project committed in Subversion successfully and build configurations and triggers sorted to kick off when any changes are committed to the repository. TeamCity polls on its default time period and is picking up that changes have been committed, but it is adding these to the queue without actually ever running them. I have to manually click the "Run" button to kick them off. What setting do I need to change in order to ensure that any new changes are automatically run?

    Read the article

  • Where is a small, simple CMS that has no Front End done in PHP?

    - by user559469
    The keys are: small and simple PHP MySql no Front End By "no front end" I mean literally, I can control the look 100%. I just want a CMS on the "backend" to manage content (user login/security, upload images, udate articles, etc.) that will not dictate in anyway how the managed data is presented. Maybe it just keeps the info in a (MySql) database (which I can query and extract myself) or if it writes content, it is in super-clean xhtml fragments or even just xml I will parse myself? I have looked at Wordpress -- and don't like the code it generates, not to mention the sites look too "canned" (you can usually spot a WP site a mile a way.) Joomla and Drupal look more customizable, but they are bloated now in my opinion, and really I just want something lightweight and simple. For one-user mom-and-pop sites. (No tiered publishing/approval systems, and all that.) I envision plugging this CMS into existing websites/web apps where most of the site is made and managed by me, but a few choice areas are managed by the site owner.

    Read the article

  • What Are The Ways to Devide Text in Multi-Column? Need an Overview of Possibilities.

    - by Sam
    Hi folks, From source1 and source2 i gather that IE9 will NOT support multi-column css3!! Since it is still the most popular browser (another thing i cannot understand), i am left but no other choice than to use Programming Power to make multi-columns work. Now, I use three divs that float to left, and which are manually filled with text. Please don't laugh i know its stupid! But I would wish to not to have to worry about the columns and just have a one piece of (un-interrupted) text which all goes into only 1 div, and then have a program smart enough to split it up into X equally wide columns. Question: before i start reinvent the wheel, what methods of programming power have you known that tackle this elegantly? Please suggest your best working multi-column layout sources so I can evaluate which option is the best (I will update the below table). Exploring all possibilities 2011 and further, to enable multi column text user experience: Language Author SourceCodeUsage WorksOnAllMajorBrowser? ================================================================================= html manual labour put text manually in separate left-floating divs "Y" // Upside: control! Downside: few changes necessitates to reflow 3 divs manually! CSS3 w3c css3.info/preview/multi-column-layout/ "N" // {-moz-column-count: 3; -webkit-column-count: 3; } Thats all! javascript a list apart will add url soon ? // php ? ? ? //

    Read the article

  • Do two portforward rules translate to "and"?

    - by blsub6
    I just set up an Exchange server to replace my DeskNow mail server. I want to start testing my internet mail exchange of my Exchange server. I can only set the MX records on my DNS up to my one external IP address so I was thinking that I could set up a firewall rule on my internet-facing firewall that port forwarded the smtp packets to two different servers. My question is: If I do that, will that mean that the smtp packets will be forwarded to just the first internal IP on the list? Or does it mean that the packet will be cloned and sent to both IPs?

    Read the article

  • Accessing Application Server directly by public IP in citrix Farm

    - by EmilioG
    I have an citrix application server in SiteB and I have a Farm in SiteA. We want to add this server into that Farm in SiteB, and access it from the internet via web interface. SiteA and SiteB are connected via VPN. But we would like to do that in a way the ICA traffic goes directly to the application server public IP (behind NAT) in siteB without using siteA and the VPN to route this traffic. Do you know if this is posible? Maybe there is a way to change the host in the ica file for this server in the webinterface (without editing manually each time)? We are using Citrix 4.5. Thanks in advance.

    Read the article

  • Setup my domain at Whois.com as nameservers for a Dedicated Server with Kloxo

    - by BoDiE2003
    Hello, this is my first time at ServerFault, I'm a stackoverflow user. I'm faceing the next problem and may be its me, but I can't find proper guides to set up a domain and nameservers for a dedicated box. I have a domain, at whois.com, and a Dedicated server at Reliable Hosting Services, the server has 5 IPs, I know that I need 2 of them for the nameservers. Right now, my domain at whois.com is using nsX.whois.com nameservers and it has 2 child nameservers: ns1.mydomain.com & ns2.mydomain.com pointing to those 2 IPs from my Server. Whats next? I still cannot set that domain as my main server domain since it says: To map an IP to a domain, the domain must ping to the same IP, otherwise, the domain will stop working. The domain you are trying to map this IP to, doesn't resolve back to the IP, and so it cannot be set as the default domain for the IP. Well and I'm stuck on those steps, whats next to have my nameservers working and my main domain assigned to my server? Thank you very much and happy new year!!

    Read the article

< Previous Page | 21 22 23 24 25 26 27 28 29 30  | Next Page >