Daily Archives

Articles indexed Friday April 9 2010

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

  • Tips On Opting Affordable Web Design Solution

    More importantly the small business owners would find it highly comforting if one can find a proficient web designer with professional experience who charges reasonably or is affordable because affor... [Author: Alan Smith - Web Design and Development - April 08, 2010]

    Read the article

  • Using Unit of Work design pattern / NHibernate Sessions in an MVVM WPF

    - by Echiban
    I think I am stuck in the paralysis of analysis. Please help! I currently have a project that Uses NHibernate on SQLite Implements Repository and Unit of Work pattern: http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/04/10/nhibernate-and-the-unit-of-work-pattern.aspx MVVM strategy in a WPF app Unit of Work implementation in my case supports one NHibernate session at a time. I thought at the time that this makes sense; it hides inner workings of NHibernate session from ViewModel. Now, according to Oren Eini (Ayende): http://msdn.microsoft.com/en-us/magazine/ee819139.aspx He convinces the audience that NHibernate sessions should be created / disposed when the view associated with the presenter / viewmodel is disposed. He presents issues why you don't want one session per windows app, nor do you want a session to be created / disposed per transaction. This unfortunately poses a problem because my UI can easily have 10+ view/viewmodels present in an app. He is presenting using a MVP strategy, but does his advice translate to MVVM? Does this mean that I should scrap the unit of work and have viewmodel create NHibernate sessions directly? Should a WPF app only have one working session at a time? If that is true, when should I create / dispose a NHibernate session? And I still haven't considered how NHibernate Stateless sessions fit into all this! My brain is going to explode. Please help!

    Read the article

  • Customize the datetime format in Cakephp

    - by SpawnCxy
    When I use the form helper to make a time input,usaually I write code as follows <?php $options = array( 'label' => '', 'type' => 'datetime', 'timeFormat'=>'24', 'separator'=>'-' ); echo $form->input('Service.endtime',$options); ?> But now I get a problem that I want to make a time input style such as month-day-hour Then how can do this with setting some parameters in the helper?Suggestions would be appreciated.

    Read the article

  • SOAP namespace from SOAP request

    - by BANSAL MOHIT
    This request is generated when web service is called. Can you tell me what the namespace will be? I am confused <?xml version="1.0" encoding="UTF-8"?> <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Header/> <S:Body> <ns2:getNews xmlns:ns2="http://src/"> <ticker>NASDAQ:INFY</ticker> </ns2:getNews> </S:Body> </S:Envelope>

    Read the article

  • Setting generic type at runtime

    - by destroyer of evil
    I have a class public class A<T> { public static string B(T obj) { return TransformThisObjectToAString(obj); } } I can call the static function like this just fine on a known/specified type: string s= A<KnownType>.B(objectOfKnownType); How do I make this call, if I don't know T beforehand, rather I have a variable of type Type that holds the type. If I do this: Type t= typeof(string); string s= A<t>.B(someStringObject); I get this compiler error: Cannot implicitly convert type 't' to 'object'

    Read the article

  • Website stress test in Python - Django

    - by RadiantHex
    Hi folks, I'm trying to build a small stress test script to test how quickly a set of requests gets done. Need to measure speed for 100 requests. Problem is that I wouldn't know how to implement it, as it would require parallel url requests to be called. Any ideas?

    Read the article

  • Eclipse RAP - Firefox doesn't forget session

    - by Fritz H
    We've got an Eclipse RAP application that's behaving a bit strangely in Firefox - two distinct problems. When you browse around, you can click on a button in one part of the system. This opens a popup window like so: IWorkbenchBrowserSupport bs; bs = PlatformUI.getWorkbench().getBrowserSupport(); int style = IWorkbenchBrowserSupport.AS_EXTERNAL; IWebBrowser b = bs.createBrowser(style, getRandomID(), "Hello world", ""); b.openURL(new URL(...)); where the URL is another servlet in the application. This servlet is in the same runtime, but has nothing to do with RAP - it takes a binary blob from in-memory storage and dumps it in the output stream. Problem 1: This causes the HTTP session to die in firefox, and shows the "session expired" RAP error page with a link to restart the session. Problem 2: Now, when you click on the link to restart the session, it shows the application's dialog again, but the session expired error is shown again the moment you do anything. This prevents the user from using the system again, unless Firefox is closed down completely and restarted. A quick peek with FireBug reveals that the JSESSIONID passed by Firefox does not change. Has anyone seen this before?

    Read the article

  • data format encoding and etc

    - by hguser
    Hi: I Suddenly found that I have no idea about the concept of data format and the encoding. For exmpale, what is the differences about the ascii/binary/base64/text-xml ? For a real case, I am working with a web service whose parameter I have to define,however one of the parameter should be ascii,another is binary and the last is netcdf. So,how to define it? ALso I wonder the ascii needed parameter can be a .txt or .dat ?

    Read the article

  • How do we add ChoiceGroups dynamically in Java ME (CLDC) based on the answer to previous choice grou

    - by sana
    I am developing a Java ME application for CLDC devices. I have a requirement where the questions are generated based on the previous response. I would start with one choicegroup and then based on the answer to this choices give another set of question to the user- Kind of Yes/No- If Yes this question or No this question. How do we do that? Am novice in mobile app development. Any help in terms of ideas or blog posts or articles is much appreciated and is of great help.

    Read the article

  • operator+ overload returning object causing memory leaks, C++

    - by lampshade
    The problem i think is with returing an object when i overload the + operator. I tried returning a reference to the object, but doing so does not fix the memory leak. I can comment out the two statements: dObj = dObj + dObj2; and cObj = cObj + cObj2; to free the program of memory leaks. Somehow, the problem is with returning an object after overloading the + operator. #include <iostream> #include <vld.h> using namespace std; class Animal { public : Animal() {}; virtual void eat() = 0 {}; virtual void walk() = 0 {}; }; class Dog : public Animal { public : Dog(const char * name, const char * gender, int age); Dog() : name(NULL), gender(NULL), age(0) {}; virtual ~Dog(); Dog operator+(const Dog &dObj); private : char * name; char * gender; int age; }; class MyClass { public : MyClass() : action(NULL) {}; void setInstance(Animal &newInstance); void doSomething(); private : Animal * action; }; Dog::Dog(const char * name, const char * gender, int age) : // allocating here, for data passed in ctor name(new char[strlen(name)+1]), gender(new char[strlen(gender)+1]), age(age) { if (name) { size_t length = strlen(name) +1; strcpy_s(this->name, length, name); } else name = NULL; if (gender) { size_t length = strlen(gender) +1; strcpy_s(this->gender, length, gender); } else gender = NULL; if (age) { this->age = age; } } Dog::~Dog() { delete name; delete gender; age = 0; } Dog Dog::operator+(const Dog &dObj) { Dog d; d.age = age + dObj.age; return d; } void MyClass::setInstance(Animal &newInstance) { action = &newInstance; } void MyClass::doSomething() { action->walk(); action->eat(); } int main() { MyClass mObj; Dog dObj("Scruffy", "Male", 4); // passing data into ctor Dog dObj2("Scooby", "Male", 6); mObj.setInstance(dObj); // set the instance specific to the object. mObj.doSomething(); // something happens based on which object is passed in dObj = dObj + dObj2; // invoke the operator+ return 0; }

    Read the article

  • Modifying an old Windows program not to call exit after a keypress without source access

    - by rustyn2
    I have an older C++ Windows program that I've been asked to get run in a kiosk style environment for a student project. From the main menu, hitting ESC will exit the program, which is undesirable. In ye olden days I would have trapped the keyboard interrupt or whatever and dug around to NOOP whatever JMP or CALL was getting referenced in the case statement that likely decides all that, but on Windows everything goes through various registered event handlers, and I haven't done any windows internals work in about 10 years. Is there a good tool to breakpoint a program on certain WM_EVENT (WM_KEYDOWN being a prime target) messages or similar, so that I can narrow down where in the executable the check is made? I'm currently stepping back from various potential system calls made before the various thread cleanups and final exit calls but it seems like there has to be a better way to do this that I'm forgetting.

    Read the article

  • Child objects in MongoDB

    - by Jeremy B.
    I have been following along with Rob Conery's Linq for MongoDB and have come across a question. In the example he shows how you can easily nest a child object. For my current experiment I have the following structure. class Content { ... Profile Profile { get; set; } } class Profile { ... } This works great when looking at content items. The dilemma I'm facing now is if I want to treat the Profile as an atomic object. As it stands, it appears as if I can not query the Profile object directly but that it comes packaged with Content results. If I want it to be inclusive, but also be able to query on just Profile I feel like my first instinct would be to make Profiles a top level object and then create a foreign key like structure under the Content class to tie the two together. To me it feels like I'm falling back on RDBMS practices and that feels like I'm most likely going against the spirit of Mongo. How would you treat an object you need to act upon independently yet also want as a child object of another object?

    Read the article

  • Integrating Dynamics CMS with Sharepoint ASCX SecurityException Issue

    - by Gavin
    Hi, I've an ASCX control (WebParts aren't used in this solution) which interrogates CMS 4's data via the API provided by Microsoft.Crm.Sdk and Microsoft.Crm.SdkTypeProxy. The solution works until it's deployed to Sharepoint. Initially I received the following error: [SecurityException: That assembly does not allow partially trusted callers.] MyApp.SharePoint.Web.Applications.MyAppUtilities.RefreshUserFromCrm(String login) +0 MyApp.SharePoint.Web.Applications.MyApp_LoginForm.btnLogin_Click(Object sender, EventArgs e) +30 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111 Then I tried wrapping the calling code in the ASCX with SPSecurity.RunWithElevatedPrivileges: SPSecurity.RunWithElevatedPrivileges(delegate() { // FBA user may not exist yet or require refreshing MyAppUtilities.RefreshUserFromCrm(txtUser.Text); }); But this resulted in the following error: [SecurityException: Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed.] MyApp.SharePoint.Web.Applications.MyApp_LoginForm.btnLogin_Click(Object sender, EventArgs e) +0 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111 When I elevate the trust level in the Sharepoint site to full everything works fine, however I need to come up with a solution that uses minimal trust (or a customised minimal trust). I'm also trying to stay clear of adding anything to the GAC. Any ideas? I assume the issue is occuring when trying to call functionality from Microsoft.Crm.* Thanks in advance for any help anyone can provide. Cheers, Gavin

    Read the article

  • Rename "Event" object in jQuery FullCalendar plug-in

    - by Jeff
    GREAT PLUGIN!!! BUT... choice of word "Event" to mean a "calendar entry" was particularly unfortunate This is a wonderfully well-written plug in, and I've really impressed people here at work with what this thing can do. The documentation is astonishingly thorough and clear. Congratulations to Adam! HOWEVER, this plug-in refers to entries in the calendar as "Events" -- this has caused a lot of confusion in my development team's conversations, because when we use the word "Event" we think of things like onmouseover, click, etc. We would really prefer a term like CalendarEvent or CalendarEntry. I am not all that experienced with jQuery yet, so am wondering if there is a simple way to alias one of those terms to this plug-in's Event/Events object? (I know we could recode the plug-in directly, but our code will then break when we download an update.) Thanks!

    Read the article

  • How to correctly relay TCP traffic between sockets?

    - by flukes1
    I'm trying to write some Python code that will establish an invisible relay between two TCP sockets. My current technique is to set up two threads, each one reading and subsequently writing 1kb of data at a time in a particular direction (i.e. 1 thread for A to B, 1 thread for B to A). This works for some applications and protocols, but it isn't foolproof - sometimes particular applications will behave differently when running through this Python-based relay. Some even crash. I think that this is because when I finish performing a read on socket A, the program running there considers its data to have already arrived at B, when in fact I - the devious man in the middle - have yet to send it to B. In a situation where B isn't ready to receive the data (whereby send() blocks for a while), we are now in a state where A believes it has successfully sent data to B, yet I am still holding the data, waiting for the send() call to execute. I think this is the cause of the difference in behaviour that I've found in some applications, while using my current relaying code. Have I missed something, or does that sound correct? If so, my real question is: is there a way around this problem? Is it possible to only read from socket A when we know that B is ready to receive data? Or is there another technique that I can use to establish a truly 'invisible' two-way relay between [already open & established] TCP sockets?

    Read the article

  • Spreadsheet::WriteExcel Memory Usage

    - by Stomped
    Hi; I'm trying to create a multi-sheet excel document, and thus far I'd been doing it in PHP - but using PHPExcel was eating up 70MB of RAM for about 60,000 spreadsheet cells total. I'm wondering if anyone has experience with Spreadsheet::WriteExcel and if it has problems with creating very large documents. I'd just give it a shot but I'm very inexperienced with Perl and it could take me quite a bit of time to get this up and rolling even if for a test, and I thought someone here might have insight for me.

    Read the article

  • Are frameworks using byte-code generation creating leaky abstractions?

    - by Gabriel Šcerbák
    My point is, if you don't understand the abstraction of a framework, you can still decompile it and understand it, because you know the language e.g. Java. However, when byte-code generation happens, you have to understand even a lower level - JVM level byte-codes. I am really affraid of using any of such frameworks, which are many. Most of the time I think the reason for byte-code generation is simply lack of language features such as metaprogramming. Do you agree? What is your opinion and argument? How do you take over the problem with leaky abstractions in those frameworks?

    Read the article

  • Windows Server 2008 firewall rules order problem

    - by vnuk
    I have one rule that opens FTP port for all connections. I have second rule that blocks ALL connections on ALL protocols for some IP's. However, connections from those IP's that are blocked can still connect to FTP port because that rule obviously takes preccedence. How can I make this work, because I do not see how can I adjust order of rules on Windows Firewall.

    Read the article

  • SMTP account without POP3/IMAP account in Thunderbird

    - by KP
    I'd like to set up Thunderbird to be able to send messages via an SMTP server, but I don't want to actually download any messages from a POP3 or IMAP account to Thunderbird's local storage. Is there any way to get Thunderbird to send messages without creating an incoming account? Currently, I'm unable to use the Write/Send features if I just have an outgoing server set up, but no incoming account.

    Read the article

  • Original object is also changed when values of cloned object are changed.

    - by fari
    I am trying to use clone but the original object is also changed when values of cloned object are changed. As you can see KalaGameState does not use any objects so a shallow copy should work. /** * This class represents the current state of a Kala game, including * which player's turn it is along with the state of the board; i.e. the * numbers of stones in each side pit, and each player's 'kala'). */ public class KalaGameState implements Cloneable { // your code goes here private int turn; private int[] sidePit; private boolean game; public Object clone() { try { return super.clone(); } catch (CloneNotSupportedException e) { // This should never happen throw new InternalError(e.toString()); } } /** * Constructs a new GameState with a specified number of stones in each * player's side pits. * @param startingStones the number of starting stones in each side pit. * @throws InvalidStartingStonesException if startingStones not in the range 1-10. */ public KalaGameState(int startingStones) throws InvalidStartingStonesException { game=true; turn=0; sidePit=new int[14]; for (int i=0; i <= 13 ; i++) { sidePit[i] = startingStones; } sidePit[6] =0; sidePit[13] =0; // your code goes here } /** * Returns the ID of the player whose turn it is. * @return A value of 0 = Player A, 1 = Player B. */ public int getTurn() { return turn; // your code goes here } /** * Returns the current kala for a specified player. * @param playerNum A value of 0 for Player A, 1 for Player B. * @throws IllegalPlayerNumException if the playerNum parameter * is not 0 or 1. */ public int getKala(int playerNum) throws IllegalPlayerNumException { if(playerNum!=0 || playerNum!=1) throw new IllegalPlayerNumException(playerNum); if(playerNum==0) return sidePit[6]; else return sidePit[13]; // your code goes here } /** * Returns the current number of stones in the specified pit for * the player whose turn it is. * @param sidePitNum the side pit being queried in the range 1-6. * @throws IllegalSidePitNumException if the sidePitNum parameter. * is not in the range 1-6. */ public int getNumStones(int sidePitNum) throws IllegalSidePitNumException { if(turn==0) { if(sidePitNum>6 ) throw new IllegalSidePitNumException(sidePitNum); } else if(sidePitNum>12) throw new IllegalSidePitNumException(sidePitNum); if(turn==0) return sidePit[sidePitNum]; else return sidePit[sidePitNum+6]; // your code goes here } /** * Returns the current number of stones in the specified pit for a specified player. * @param playerNum the player whose kala is sought. (0 = Player A, 1 = Player B). * @param sidePitNum the side pit being queried (in the range 1-6). * @throws IllegalPlayerNumException if the playerNum parameter is not 0 or 1. * @throws IllegalSidePitNumException if the sidePitNum parameter is not in the * range 1-6. */ public int getNumStones(int playerNum, int sidePitNum) throws IllegalPlayerNumException, IllegalSidePitNumException { /*if(playerNum>2) throw new IllegalPlayerNumException(playerNum); if(turn==0) { if(sidePitNum>6 ) throw new IllegalSidePitNumException(sidePitNum); } else if(sidePitNum>12) throw new IllegalSidePitNumException(sidePitNum); */ if(playerNum==0) return sidePit[sidePitNum]; else if(playerNum==1) return sidePit[sidePitNum+7]; else return sidePit[sidePitNum]; } /** * Returns the current score for a specified player - the player's * kala plus the number of stones in each of their side pits. * @param playerNum the player whose kala is sought. (0 = Player A, 1 = Player B). * @throws IllegalPlayerNumException if the playerNum parameter is not 0 or 1. */ public int getScore(int playerNum) throws IllegalPlayerNumException { if(playerNum>1) throw new IllegalPlayerNumException(playerNum); int score=0; if(playerNum==0) { for(int i=0;i<=5;i++) score=score+sidePit[i]; score=score+sidePit[6]; } else { for(int i=7;i<=12;i++) score=score+sidePit[i]; score=score+sidePit[13]; } // your code goes here return score; } private int getSidePitArrayIndex(int sidePitNum) throws IllegalSidePitNumException { if(turn==0) { if(sidePitNum>6 ) throw new IllegalSidePitNumException(sidePitNum); } else if(sidePitNum>12) throw new IllegalSidePitNumException(sidePitNum); if(turn==0) { return sidePitNum--; } else { return sidePitNum+6; } } public boolean gameOver() { int stone=0; if(turn==0) for(int i=0;i<=5;i++) stone=stone+getNumStones(i); else for(int i=7;i<=12;i++) stone=stone+getNumStones(i-7); if (stone==0) game=false; return game; } /** * Makes a move for the player whose turn it is. * @param sidePitNum the side pit being queried (should be in the range 1-6) * @throws IllegalSidePitNumException if the sidePitNum parameter is not in the range 1-6. * @throws IllegalMoveException if the side pit is empty and has no stones in it. */ public void makeMove(int sidePitNum) throws IllegalSidePitNumException, IllegalMoveException { if(turn==0) { if(sidePitNum>6 ) throw new IllegalSidePitNumException(sidePitNum); } else if(sidePitNum>12) throw new IllegalSidePitNumException(sidePitNum); /* if(turn==0) { if(sidePit[sidePitNum-1]==0) throw new IllegalMoveException(sidePitNum); } else { if(sidePit[sidePitNum-1+7]==0) throw new IllegalMoveException(sidePitNum); } */ sidePitNum--; int temp=sidePitNum; int pitNum=sidePitNum+1; int stones=getNumStones(turn,sidePitNum); if(turn==0) sidePit[sidePitNum]=0; else { sidePitNum=sidePitNum+7; sidePit[sidePitNum]=0; pitNum=pitNum+7; } while(stones!=0) { if(turn==0) { sidePit[pitNum]=sidePit[pitNum]+1; stones--; pitNum++; if(pitNum==13) pitNum=0; } else { sidePit[pitNum]=sidePit[pitNum]+1; stones--; pitNum++; if(pitNum==6) pitNum=7; else if(pitNum==14) pitNum=0; } } boolean res=anotherTurn(pitNum); if(!res){ capture(pitNum,temp); if(turn==0) turn=1; else turn=0;} } private boolean anotherTurn(int pitNum) {pitNum--; boolean temp=false; if(turn==0) {if(pitNum==6) {turn=0; temp=true; } } else if(pitNum==-1) {turn=1; temp=true; } return temp; } private void capture(int pitNum, int pit) { pitNum--; if(turn==0){ if(sidePit[pitNum]==1 && pitNum<6) { if(pitNum==0) { sidePit[6]=sidePit[6]+sidePit[12]+1; sidePit[12]=0; } else if(pitNum==1) { sidePit[6]=sidePit[6]+sidePit[11]+1; sidePit[11]=0; } else if(pitNum==2) { sidePit[6]=sidePit[6]+sidePit[10]+1; sidePit[10]=0; } else if(pitNum==3) { sidePit[6]=sidePit[6]+sidePit[9]+1; sidePit[9]=0; } else if(pitNum==4) { sidePit[6]=sidePit[6]+sidePit[8]+1; sidePit[8]=0; } else if(pitNum==5) { sidePit[6]=sidePit[6]+sidePit[7]+1; sidePit[7]=0; } sidePit[pitNum]=0; } } if(turn==1) { //pitNum=pitNum; if(sidePit[pitNum]==1 && pit+7>6) { if(pitNum==7) { sidePit[13]=sidePit[13]+sidePit[5]+1; sidePit[7]=0; } else if(pitNum==8) { sidePit[13]=sidePit[13]+sidePit[4]+1; sidePit[4]=0; } else if(pitNum==9) { sidePit[13]=sidePit[13]+sidePit[3]+1; sidePit[3]=0; } else if(pitNum==10) { sidePit[13]=sidePit[13]+sidePit[2]+1; sidePit[2]=0; } else if(pitNum==11) { sidePit[13]=sidePit[13]+sidePit[1]+1; sidePit[1]=0; } else if(pitNum==12) { sidePit[13]=sidePit[13]+sidePit[0]+1; sidePit[0]=0; } sidePit[pitNum]=0; } } } } import java.io.BufferedReader; import java.io.InputStreamReader; public class RandomPlayer extends KalaPlayer{ //KalaGameState state; public int chooseMove(KalaGameState gs) throws NoMoveAvailableException {int[] moves; moves=getMoves(gs); try{ for(int i=0;i<=5;i++) System.out.println(moves[i]); for(int i=0;i<=5;i++) { if(moves[i]==1) { KalaGameState state=(KalaGameState) gs.clone(); state.makeMove(moves[i]); gs.getTurn(); moves[i]=evalValue(state.getScore(0),state.getScore(1)); } } } catch(IllegalMoveException e) { System.out.println(e); //chooseMove(state); } return 10; } private int evalValue(int score0,int score1) { int score=0; //int score0=0; // int score1=0; //getScore(0); //score1=state.getScore(1); //if((state.getTurn())==0) score=score1-score0; //else //score=score1-score0; System.out.println("score: "+score); return score; } public int[] getMoves(KalaGameState gs) { int[] moves=new int[6]; for(int i=1;i<=6;i++) { if(gs.getNumStones(i)!=0) moves[i-1]=1; else moves[i-1]=0; } return moves; } } Can you explain what is going wrong, please?

    Read the article

  • What is <ns0: for?

    - by Doug
    I was looking at this question: http://stackoverflow.com/questions/117641/how-to-remove-duplicate-elements-from-an-xml-file It has <ns0: for ? I have never seen it before.

    Read the article

  • Subclipse does not recognize my project as an SVN project

    - by Nicolas Raoul
    From SVN I checked out a "myproject" folder to my hard drive. It happens to be an Eclipse project, so I imported it into Eclipse and I can work on it. I have Subclipse installed and working as expected on other projects in the same Eclipse workspace. But for some reason, "myproject" does not have the usual Subclipse controls like TeamCommit or the decorations. Did I miss any obvious steps?

    Read the article

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